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 "NiceController.h"
@class SUUpdater;
@interface NPApplication : NSApplication {
NSTimer *inactiveTimer;
NSPoint lastPoint;
IBOutlet SUUpdater* sparkleUpdater;
}
-(void)setShouldCheckAtStartup:(bool)aBool;
-(bool)shouldCheckAtStartUp;
-(void)copyDefaultScriptsToApplicationSupport;
-(id)bestMovieWindow;
-(NSArray *)movieWindows;
View
@@ -50,6 +50,9 @@
#import <CocoaScriptMenu/CocoaScriptMenu.h>
#import "NiceUtilities.h"
#import <HodgePodge/IndyKit.h>
#import <Sparkle/Sparkle.h>
BOOL selectNiceWindow(id each, void* context){
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 theVolumeView;
IBOutlet id theTitleField;
IBOutlet id theResizeWindow;
IBOutlet NiceScrubber* theScrubBar;
IBOutlet id theTimeField;
IBOutlet id thePlayButton;
@@ -94,7 +95,13 @@
NSPoint initialDrag;
id notifierTimer;
}
-(float)resizeWidth;
-(float)resizeHeight;
-(float)scrubberHeight;
-(float)titlebarHeight;
-(void)setResizeDrag:(bool)aDrag;
@@ -60,6 +60,21 @@
@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
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
@@ -259,7 +274,9 @@ - (void)performMiniaturize:(id)sender
*/
-(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{
@@ -368,9 +385,9 @@ -(void)setupOverlays
[self putOverlay:theOverlaySubTitleWindow
inFrame:NSMakeRect(currentFrame.origin.x,
currentFrame.origin.y+32,
currentFrame.origin.y+[theOverlayWindow frame].size.height,
currentFrame.size.width,
currentFrame.size.height - 24 - 32)
currentFrame.size.height - [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height)
withVisibility:NO];
[theOverlayWindow createResizeTriangle];
@@ -486,18 +503,32 @@ -(void)setOverlayWindowLocation
[theOverlayWindow setFrame:NSMakeRect(frame.origin.x,
frame.origin.y,
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 {
[theOverlayWindow setFrame:NSMakeRect(intersect.origin.x,
intersect.origin.y,
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,
mainFrame.origin.y,
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
@@ -508,7 +539,7 @@ -(void)hideOverLayWindow
[self hideInitialWindows];
else
[[FadeOut fadeOut] addWindow:theOverlayWindow];
[self setShowsResizeIndicator:NO];
// [self setShowsResizeIndicator:NO];
windowOverlayIsShowing = NO;
}
@@ -550,19 +581,19 @@ -(void)setOverLaySubtitleLocation{
if(!fullScreen){
if(NSEqualRects(intersect, frame))
[theOverlaySubTitleWindow setFrame:NSMakeRect(frame.origin.x,
frame.origin.y+32,
frame.origin.y+[theOverlayWindow frame].size.height,
frame.size.width,
frame.size.height- 24 - 32) display:YES];
frame.size.height- [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height) display:YES];
else
[theOverlaySubTitleWindow setFrame:NSMakeRect(intersect.origin.x,
intersect.origin.y+32,
intersect.origin.y+[theOverlayWindow frame].size.height,
intersect.size.width,
intersect.size.height- 24 - 32) display:YES];
intersect.size.height- [theOverlayTitleBar frame].size.height - [theOverlayWindow frame].size.height) display:YES];
} else
[theOverlaySubTitleWindow setFrame:NSMakeRect(visibleFrame.origin.x,
visibleFrame.origin.y+32,
visibleFrame.origin.y+[theOverlayWindow frame].size.height,
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(NSEqualRects(intersect, frame))
[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,
24) display:YES];
[theOverlayTitleBar frame].size.height) display:YES];
else
[theOverlayTitleBar setFrame:NSMakeRect(intersect.origin.x,
intersect.origin.y
+ intersect.size.height - 24,
+ intersect.size.height - [theOverlayTitleBar frame].size.height,
intersect.size.width,
24) display:YES];
[theOverlayTitleBar frame].size.height) display:YES];
} else{
[theOverlayTitleBar setFrame:NSMakeRect(visibleFrame.origin.x,
visibleFrame.origin.y
+ visibleFrame.size.height - 48,
+ visibleFrame.size.height - [theOverlayTitleBar frame].size.height - [NSMenuView menuBarHeight],
visibleFrame.size.width,
24) display:YES];
[theOverlayTitleBar frame].size.height) display:YES];
}
}
@@ -44,8 +44,9 @@
* ***** END LICENSE BLOCK ***** */
#import "NiceScrubber.h"
#import <Carbon/Carbon.h>
#define OFFSET (10)
#define OFFSET (10 * HIGetScaleFactor())
@implementation NiceScrubber
@@ -54,9 +55,11 @@ - (id)initWithFrame:(NSRect)frame
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
left = [[NSImage imageNamed:@"scrubbar_left"]retain];
right = [[NSImage imageNamed:@"scrubbar_right"]retain];
center = [[NSImage imageNamed:@"scrubbar_center"]retain];
// left = [[NSImage imageNamed:@"scrubbar_left"]retain];
// right = [[NSImage imageNamed:@"scrubbar_right"]retain];
// center = [[NSImage imageNamed:@"scrubbar_center"]retain];
scrubClick = [[NSImage imageNamed:@"scrubberClick"]retain];
scrub = [[NSImage imageNamed:@"scrubber"] retain];
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
click at any point and continue dragging and the entire thing will drag at that point anyway. */
id tempImage = scrub;
#if 0
if (dragging)
tempImage = scrubClick;
else
tempImage = scrub;
#endif
//#if 0
// if (dragging)
// tempImage = scrubClick;
// else
// tempImage = scrub;
//#endif
if([self loadedValue] >= 0){
[self lockFocus];
[left drawAtPoint:NSMakePoint(0,0)
fromRect:NSMakeRect(0, 0,
[left size].width,
[left size].height)
operation:NSCompositeSourceOver
fraction:1.0];
[center drawInRect:NSMakeRect(5,0,
[self frame].size.width-10,
[self frame].size.height)
fromRect:NSMakeRect(0,0,
[center size].width,
[center size].height)
operation:NSCompositeSourceOver
fraction:1.0];
//[left drawAtPoint:NSMakePoint(0,0)
// fromRect:NSMakeRect(0, 0,
// [left size].width,
// [left size].height)
// operation:NSCompositeSourceOver
// fraction:1.0];
//
// [center drawInRect:NSMakeRect(5,0,
// [self frame].size.width-10,
// [self frame].size.height)
// fromRect:NSMakeRect(0,0,
// [center size].width,
// [center size].height)
// operation:NSCompositeSourceOver
// fraction:1.0];
CGPoint points[2];
points[0] = CGPointMake(OFFSET + 1, floor([self frame].size.height / 2.0));
points[1] = CGPointMake([self frame].size.width - 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, floor([self frame].size.height / 2.0));
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);
CGContextStrokeLineSegments(cgRef, points, 2);
CGContextSetAllowsAntialiasing(cgRef, YES);
[right drawAtPoint:NSMakePoint([self frame].size.width-5,0)
fromRect:NSMakeRect(0,0,
[right size].width,
[right size].height)
operation:NSCompositeSourceOver
fraction:1.0];
//
// [right drawAtPoint:NSMakePoint([self frame].size.width-5,0)
// fromRect:NSMakeRect(0,0,
// [right size].width,
// [right size].height)
// operation:NSCompositeSourceOver
// 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,
[tempImage size].width,
[tempImage size].height)
@@ -186,7 +189,7 @@ -(SEL)action
- (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)
[self setDoubleValue:0.0];
@@ -212,7 +215,7 @@ -(void)mouseUp:(NSEvent *)anEvent
-(void)mouseDown:(NSEvent *)anEvent
{
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)
[self setDoubleValue:0.0];
@@ -65,7 +65,12 @@ -(void)createResizeTriangle
{
[self addChildWindow:overlayResize ordered:NSWindowAbove];
[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];
}
@@ -75,15 +80,6 @@ -(void)setAlphaValue:(float)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
{
@@ -50,7 +50,7 @@
+(id)control;
-(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;
@end
Oops, something went wrong.

0 comments on commit f0f1ed6

Please sign in to comment.