Permalink
Browse files

MOst of resolution independance fixed

  • Loading branch information...
jbtule
jbtule committed Nov 8, 2007
1 parent 36768ed commit f0f1ed660a83436ae4fcd185ee5025cbe5f7d8a9
View
@@ -47,12 +47,18 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "NiceController.h" #import "NiceController.h"
@class SUUpdater;
@interface NPApplication : NSApplication { @interface NPApplication : NSApplication {
NSTimer *inactiveTimer; NSTimer *inactiveTimer;
NSPoint lastPoint; NSPoint lastPoint;
IBOutlet SUUpdater* sparkleUpdater;
} }
-(void)setShouldCheckAtStartup:(bool)aBool;
-(bool)shouldCheckAtStartUp;
-(void)copyDefaultScriptsToApplicationSupport; -(void)copyDefaultScriptsToApplicationSupport;
-(id)bestMovieWindow; -(id)bestMovieWindow;
-(NSArray *)movieWindows; -(NSArray *)movieWindows;
View
@@ -50,6 +50,9 @@
#import <CocoaScriptMenu/CocoaScriptMenu.h> #import <CocoaScriptMenu/CocoaScriptMenu.h>
#import "NiceUtilities.h" #import "NiceUtilities.h"
#import <HodgePodge/IndyKit.h> #import <HodgePodge/IndyKit.h>
#import <Sparkle/Sparkle.h>
BOOL selectNiceWindow(id each, void* context){ BOOL selectNiceWindow(id each, void* context){
return [each isKindOfClass:[NiceWindow class]]; return [each isKindOfClass:[NiceWindow class]];
} }
@@ -71,6 +74,14 @@ - (void)finishLaunching
// } // }
} }
-(void)setShouldCheckAtStartup:(bool)aBool{
[[NSUserDefaults standardUserDefaults] setBool:aBool forKey: SUCheckAtStartupKey];
}
-(bool)shouldCheckAtStartUp{
return [[NSUserDefaults standardUserDefaults] boolForKey: SUCheckAtStartupKey];
}
@@ -57,7 +57,8 @@
IBOutlet id theOverlayNotifier; IBOutlet id theOverlayNotifier;
IBOutlet id theVolumeView; IBOutlet id theVolumeView;
IBOutlet id theTitleField; IBOutlet id theTitleField;
IBOutlet id theResizeWindow;
IBOutlet NiceScrubber* theScrubBar; IBOutlet NiceScrubber* theScrubBar;
IBOutlet id theTimeField; IBOutlet id theTimeField;
IBOutlet id thePlayButton; IBOutlet id thePlayButton;
@@ -94,7 +95,13 @@
NSPoint initialDrag; NSPoint initialDrag;
id notifierTimer; id notifierTimer;
} }
-(float)resizeWidth;
-(float)resizeHeight;
-(float)scrubberHeight;
-(float)titlebarHeight;
-(void)setResizeDrag:(bool)aDrag; -(void)setResizeDrag:(bool)aDrag;
@@ -60,6 +60,21 @@
@implementation NiceWindow @implementation NiceWindow
-(float)resizeHeight{
return [theResizeWindow frame].size.height;
}
-(float)resizeWidth{
return [theResizeWindow frame].size.width;
}
-(float)scrubberHeight{
return [theOverlayWindow frame].size.height;
}
-(float)titlebarHeight{
return [theOverlayTitleBar frame].size.height;
}
- (id)initWithContentRect:(NSRect)contentRect - (id)initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType backing:(NSBackingStoreType)bufferingType
@@ -259,7 +274,9 @@ - (void)performMiniaturize:(id)sender
*/ */
-(BOOL)inResizeLocation:(NSEvent *)anEvent -(BOOL)inResizeLocation:(NSEvent *)anEvent
{ {
return ([anEvent locationInWindow].x > ([self frame].size.width-16) && [anEvent locationInWindow].y < (16));
NSRect tRect =NSMakeRect([self frame].origin.x + ([self frame].size.width-[self resizeWidth]), [self frame].origin.y, [self resizeWidth],[self resizeHeight]);
return NSPointInRect([self convertBaseToScreen:[anEvent locationInWindow]], tRect);
} }
-(void)setResizeDrag:(bool)aDrag{ -(void)setResizeDrag:(bool)aDrag{
@@ -368,9 +385,9 @@ -(void)setupOverlays
[self putOverlay:theOverlaySubTitleWindow [self putOverlay:theOverlaySubTitleWindow
inFrame:NSMakeRect(currentFrame.origin.x, inFrame:NSMakeRect(currentFrame.origin.x,
currentFrame.origin.y+32, currentFrame.origin.y+[theOverlayWindow frame].size.height,
currentFrame.size.width, currentFrame.size.width,
currentFrame.size.height - 24 - 32) currentFrame.size.height - [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height)
withVisibility:NO]; withVisibility:NO];
[theOverlayWindow createResizeTriangle]; [theOverlayWindow createResizeTriangle];
@@ -486,18 +503,32 @@ -(void)setOverlayWindowLocation
[theOverlayWindow setFrame:NSMakeRect(frame.origin.x, [theOverlayWindow setFrame:NSMakeRect(frame.origin.x,
frame.origin.y, frame.origin.y,
frame.size.width, frame.size.width,
32) display:YES]; [theOverlayWindow frame].size.height) display:YES];
[theResizeWindow setFrame:NSMakeRect(frame.origin.x + frame.size.width - [self resizeWidth], frame.origin.y , [self resizeWidth], [self resizeHeight]) display:YES];
} else { } else {
[theOverlayWindow setFrame:NSMakeRect(intersect.origin.x, [theOverlayWindow setFrame:NSMakeRect(intersect.origin.x,
intersect.origin.y, intersect.origin.y,
intersect.size.width, intersect.size.width,
32) display:YES]; [theOverlayWindow frame].size.height) display:YES];
[theResizeWindow setFrame:NSMakeRect(intersect.origin.x + intersect.size.width - [self resizeWidth], intersect.origin.y , [self resizeWidth], [self resizeHeight]) display:YES];
} }
} else
} else{
[theOverlayWindow setFrame:NSMakeRect(mainFrame.origin.x, [theOverlayWindow setFrame:NSMakeRect(mainFrame.origin.x,
mainFrame.origin.y, mainFrame.origin.y,
mainFrame.size.width, mainFrame.size.width,
32) display:YES]; [theOverlayWindow frame].size.height) display:YES];
[theResizeWindow setFrame:NSMakeRect([self frame].origin.x + [self frame].size.width - [self resizeWidth] ,
[self frame].origin.y,
[self resizeWidth],
[self resizeHeight]) display:YES];
}
} }
-(void)hideOverLayWindow -(void)hideOverLayWindow
@@ -508,7 +539,7 @@ -(void)hideOverLayWindow
[self hideInitialWindows]; [self hideInitialWindows];
else else
[[FadeOut fadeOut] addWindow:theOverlayWindow]; [[FadeOut fadeOut] addWindow:theOverlayWindow];
[self setShowsResizeIndicator:NO]; // [self setShowsResizeIndicator:NO];
windowOverlayIsShowing = NO; windowOverlayIsShowing = NO;
} }
@@ -550,19 +581,19 @@ -(void)setOverLaySubtitleLocation{
if(!fullScreen){ if(!fullScreen){
if(NSEqualRects(intersect, frame)) if(NSEqualRects(intersect, frame))
[theOverlaySubTitleWindow setFrame:NSMakeRect(frame.origin.x, [theOverlaySubTitleWindow setFrame:NSMakeRect(frame.origin.x,
frame.origin.y+32, frame.origin.y+[theOverlayWindow frame].size.height,
frame.size.width, frame.size.width,
frame.size.height- 24 - 32) display:YES]; frame.size.height- [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height) display:YES];
else else
[theOverlaySubTitleWindow setFrame:NSMakeRect(intersect.origin.x, [theOverlaySubTitleWindow setFrame:NSMakeRect(intersect.origin.x,
intersect.origin.y+32, intersect.origin.y+[theOverlayWindow frame].size.height,
intersect.size.width, intersect.size.width,
intersect.size.height- 24 - 32) display:YES]; intersect.size.height- [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height) display:YES];
} else } else
[theOverlaySubTitleWindow setFrame:NSMakeRect(visibleFrame.origin.x, [theOverlaySubTitleWindow setFrame:NSMakeRect(visibleFrame.origin.x,
visibleFrame.origin.y+32, visibleFrame.origin.y+[theOverlayWindow frame].size.height,
visibleFrame.size.width, visibleFrame.size.width,
visibleFrame.size.height- 24 - 32) display:YES]; visibleFrame.size.height- [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height) display:YES];
@@ -581,21 +612,21 @@ -(void)setOverlayTitleLocation
if(!fullScreen){ if(!fullScreen){
if(NSEqualRects(intersect, frame)) if(NSEqualRects(intersect, frame))
[theOverlayTitleBar setFrame:NSMakeRect(frame.origin.x, [theOverlayTitleBar setFrame:NSMakeRect(frame.origin.x,
frame.origin.y + frame.size.height - 24, frame.origin.y + frame.size.height - [theOverlayTitleBar frame].size.height,
frame.size.width, frame.size.width,
24) display:YES]; [theOverlayTitleBar frame].size.height) display:YES];
else else
[theOverlayTitleBar setFrame:NSMakeRect(intersect.origin.x, [theOverlayTitleBar setFrame:NSMakeRect(intersect.origin.x,
intersect.origin.y intersect.origin.y
+ intersect.size.height - 24, + intersect.size.height - [theOverlayTitleBar frame].size.height,
intersect.size.width, intersect.size.width,
24) display:YES]; [theOverlayTitleBar frame].size.height) display:YES];
} else{ } else{
[theOverlayTitleBar setFrame:NSMakeRect(visibleFrame.origin.x, [theOverlayTitleBar setFrame:NSMakeRect(visibleFrame.origin.x,
visibleFrame.origin.y visibleFrame.origin.y
+ visibleFrame.size.height - 48, + visibleFrame.size.height - [theOverlayTitleBar frame].size.height - [NSMenuView menuBarHeight],
visibleFrame.size.width, visibleFrame.size.width,
24) display:YES]; [theOverlayTitleBar frame].size.height) display:YES];
} }
} }
@@ -44,8 +44,9 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#import "NiceScrubber.h" #import "NiceScrubber.h"
#import <Carbon/Carbon.h>
#define OFFSET (10) #define OFFSET (10 * HIGetScaleFactor())
@implementation NiceScrubber @implementation NiceScrubber
@@ -54,9 +55,11 @@ - (id)initWithFrame:(NSRect)frame
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
// Initialization code here. // Initialization code here.
left = [[NSImage imageNamed:@"scrubbar_left"]retain];
right = [[NSImage imageNamed:@"scrubbar_right"]retain]; // left = [[NSImage imageNamed:@"scrubbar_left"]retain];
center = [[NSImage imageNamed:@"scrubbar_center"]retain]; // right = [[NSImage imageNamed:@"scrubbar_right"]retain];
// center = [[NSImage imageNamed:@"scrubbar_center"]retain];
scrubClick = [[NSImage imageNamed:@"scrubberClick"]retain]; scrubClick = [[NSImage imageNamed:@"scrubberClick"]retain];
scrub = [[NSImage imageNamed:@"scrubber"] retain]; scrub = [[NSImage imageNamed:@"scrubber"] retain];
value=0.0; value=0.0;
@@ -84,35 +87,35 @@ - (void)drawRect:(NSRect)rect
/* I think it looks better without the pressed state -- the entire area is draggable anyway, and you can /* I think it looks better without the pressed state -- the entire area is draggable anyway, and you can
click at any point and continue dragging and the entire thing will drag at that point anyway. */ click at any point and continue dragging and the entire thing will drag at that point anyway. */
id tempImage = scrub; id tempImage = scrub;
#if 0 //#if 0
if (dragging) // if (dragging)
tempImage = scrubClick; // tempImage = scrubClick;
else // else
tempImage = scrub; // tempImage = scrub;
#endif //#endif
if([self loadedValue] >= 0){ if([self loadedValue] >= 0){
[self lockFocus]; [self lockFocus];
[left drawAtPoint:NSMakePoint(0,0) //[left drawAtPoint:NSMakePoint(0,0)
fromRect:NSMakeRect(0, 0, // fromRect:NSMakeRect(0, 0,
[left size].width, // [left size].width,
[left size].height) // [left size].height)
operation:NSCompositeSourceOver // operation:NSCompositeSourceOver
fraction:1.0]; // fraction:1.0];
//
[center drawInRect:NSMakeRect(5,0, // [center drawInRect:NSMakeRect(5,0,
[self frame].size.width-10, // [self frame].size.width-10,
[self frame].size.height) // [self frame].size.height)
fromRect:NSMakeRect(0,0, // fromRect:NSMakeRect(0,0,
[center size].width, // [center size].width,
[center size].height) // [center size].height)
operation:NSCompositeSourceOver // operation:NSCompositeSourceOver
fraction:1.0]; // fraction:1.0];
CGPoint points[2]; CGPoint points[2];
points[0] = CGPointMake(OFFSET + 1, floor([self frame].size.height / 2.0)); points[0] = CGPointMake(OFFSET , floor([self frame].size.height / 2.0));
points[1] = CGPointMake([self frame].size.width - OFFSET - 1, floor([self frame].size.height / 2.0)); points[1] = CGPointMake([self frame].size.width - OFFSET, floor([self frame].size.height / 2.0));
points[1].x =(points[1].x - points[0].x) * [self loadedValue] + points[0].x; points[1].x =(points[1].x - points[0].x) * [self loadedValue] + points[0].x;
@@ -123,15 +126,15 @@ - (void)drawRect:(NSRect)rect
CGContextSetLineCap(cgRef, kCGLineCapRound); CGContextSetLineCap(cgRef, kCGLineCapRound);
CGContextStrokeLineSegments(cgRef, points, 2); CGContextStrokeLineSegments(cgRef, points, 2);
CGContextSetAllowsAntialiasing(cgRef, YES); CGContextSetAllowsAntialiasing(cgRef, YES);
//
[right drawAtPoint:NSMakePoint([self frame].size.width-5,0) // [right drawAtPoint:NSMakePoint([self frame].size.width-5,0)
fromRect:NSMakeRect(0,0, // fromRect:NSMakeRect(0,0,
[right size].width, // [right size].width,
[right size].height) // [right size].height)
operation:NSCompositeSourceOver // operation:NSCompositeSourceOver
fraction:1.0]; // fraction:1.0];
[tempImage drawAtPoint:NSMakePoint(OFFSET+([self doubleValue]*([self frame].size.width-(OFFSET * 2)))-[scrub size].width/2,[self frame].size.height/2 - [tempImage size].height/2 + 0.5) [tempImage drawAtPoint:NSMakePoint(OFFSET+([self doubleValue]*([self frame].size.width-(OFFSET * 2)))-[scrub size].width/2,[self frame].size.height/2 - [tempImage size].height/2)
fromRect:NSMakeRect(0,0, fromRect:NSMakeRect(0,0,
[tempImage size].width, [tempImage size].width,
[tempImage size].height) [tempImage size].height)
@@ -186,7 +189,7 @@ -(SEL)action
- (void)mouseDragged:(NSEvent *)anEvent - (void)mouseDragged:(NSEvent *)anEvent
{ {
float loc =[self convertPoint:[anEvent locationInWindow]fromView:[[self window] contentView]].x; float loc =[self convertPoint:[anEvent locationInWindow]fromView:nil].x;
if(loc <= OFFSET) if(loc <= OFFSET)
[self setDoubleValue:0.0]; [self setDoubleValue:0.0];
@@ -212,7 +215,7 @@ -(void)mouseUp:(NSEvent *)anEvent
-(void)mouseDown:(NSEvent *)anEvent -(void)mouseDown:(NSEvent *)anEvent
{ {
dragging =YES; dragging =YES;
float loc =[self convertPoint:[anEvent locationInWindow]fromView:[[self window] contentView]].x; float loc =[self convertPoint:[anEvent locationInWindow]fromView:nil].x;
if(loc <= OFFSET) if(loc <= OFFSET)
[self setDoubleValue:0.0]; [self setDoubleValue:0.0];
@@ -65,7 +65,12 @@ -(void)createResizeTriangle
{ {
[self addChildWindow:overlayResize ordered:NSWindowAbove]; [self addChildWindow:overlayResize ordered:NSWindowAbove];
[self setHasShadow:NO]; [self setHasShadow:NO];
[overlayResize setFrame:[[self parentWindow] frame] display:NO]; NSRect tRect =NSMakeRect([[self parentWindow] frame].origin.x + [[self parentWindow] frame].size.width - [((NiceWindow*)[self parentWindow])resizeWidth] ,
[[self parentWindow] frame].origin.y,
[((NiceWindow*)[self parentWindow])resizeWidth],
[((NiceWindow*)[self parentWindow])resizeHeight]);
[overlayResize setFrame:tRect display:YES];
[overlayResize setAlphaValue:[self alphaValue]];
[overlayResize orderFront:self]; [overlayResize orderFront:self];
} }
@@ -75,15 +80,6 @@ -(void)setAlphaValue:(float)windowAlpha
[super setAlphaValue:windowAlpha]; [super setAlphaValue:windowAlpha];
} }
-(void)setFrame:(NSRect)frameRect display:(BOOL)flag
{
[super setFrame:frameRect display:flag];
NSRect movieRect = [[[self parentWindow] contentView] frame];
movieRect.origin = [[self parentWindow] convertBaseToScreen:movieRect.origin];
[overlayResize setFrame:movieRect display:flag];
}
-(void)setLevel:(int)newLevel -(void)setLevel:(int)newLevel
{ {
@@ -50,7 +50,7 @@
+(id)control; +(id)control;
-(void)mouseMovedInScreenPoint:(NSPoint)aScreenPoint; -(void)mouseMovedInScreenPoint:(NSPoint)aScreenPoint;
-(BOOL)inResizeRegion:(NSPoint)aScreenPoint forWindow:(id)aWindow; -(BOOL)inResizeRegion:(NSPoint)aScreenPoint forWindow:(NiceWindow*)aWindow;
-(BOOL)showOverlayForWindow:(NiceWindow *)aWindow atPoint:(NSPoint)aScreenPoint; -(BOOL)showOverlayForWindow:(NiceWindow *)aWindow atPoint:(NSPoint)aScreenPoint;
@end @end
Oops, something went wrong.

0 comments on commit f0f1ed6

Please sign in to comment.