Skip to content

Commit 2e1b05e

Browse files
committed
Halfway done with BookMacster 1.18.
1 parent e6b57c0 commit 2e1b05e

7 files changed

+69
-40
lines changed

SSYAppInfo.m

+10-13
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ - (void)setUpgradeState:(enum SSYAppInfoUpgradeState)upgradeState {
6060
_upgradeState = upgradeState ;
6161
}
6262

63-
// Keep this method private, vecause it gives the value from User Defaults, which
63+
// Keep this method private, because it gives the value from User Defaults, which
6464
// will already have been changed to the current version after the SSYAppInfo
6565
// singleton instance has been created, which is probably not what you expect.
6666
// You probably want +previousVersionTriplet instead.
@@ -71,27 +71,22 @@ + (SSYVersionTriplet*)rawPreviousVersionTriplet {
7171
}
7272

7373
+ (SSYVersionTriplet*)rawCurrentVersionTriplet {
74-
// Prior BookMacster 1.6.8/1.7.0, we used this:
75-
// SSYVersionTriplet* cvt = [SSYVersionTriplet versionTripletFromBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]] ;
76-
// which was bad because it allowed Launch Services to give us the bundle, which
77-
// may have been from a different app instance if different versions of thisapp
78-
// are installed on this Mac. That was pretty stupid, but probably is because
79-
// originally that method was used to get versions of *other* apps.
80-
NSString* versionString = [SSYVersionTriplet rawVersionStringFromBundle:[NSBundle mainBundle]] ;
74+
NSString* versionString = [SSYVersionTriplet rawVersionStringFromBundle:[NSBundle mainBundle]] ;
8175
SSYVersionTriplet* cvt = [SSYVersionTriplet versionTripletFromString:versionString] ;
8276
return cvt ;
8377
}
8478

8579

8680
- (id)init {
87-
self = [super init];
81+
self = [super init] ;
8882
if (self != nil) {
8983
SSYVersionTriplet* previousVersionTriplet = [SSYAppInfo rawPreviousVersionTriplet] ;
9084
[self setPreviousVersionTriplet:previousVersionTriplet] ;
9185
[self setCurrentVersionTriplet:[SSYAppInfo rawCurrentVersionTriplet]] ;
92-
_upgradeState = [SSYAppInfo upgradeStateForCurrentVersionTriplet:[self currentVersionTriplet]
93-
previousVersionTriplet:[self previousVersionTriplet]] ;
94-
if (_upgradeState != SSYCurrentRev) {
86+
enum SSYAppInfoUpgradeState upgradeState = [SSYAppInfo upgradeStateForCurrentVersionTriplet:[self currentVersionTriplet]
87+
previousVersionTriplet:[self previousVersionTriplet]] ;
88+
[self setUpgradeState:upgradeState] ;
89+
if ([self upgradeState] != SSYCurrentRev) {
9590
// Get a nice, clean, filtered versionString of the form "major.minor.bugFix" using SSVersionTriplet methods
9691
SSYVersionTriplet* currentVersionTriplet = [SSYVersionTriplet versionTripletFromBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]] ;
9792
NSString* currentVersionString = [currentVersionTriplet string] ;
@@ -110,7 +105,9 @@ - (id)init {
110105

111106

112107
+ (BOOL)isNewUser {
113-
return ([[self sharedInfo] upgradeState] >= SSYNewUser) ;
108+
enum SSYAppInfoUpgradeState upgradeState = [[self sharedInfo] upgradeState] ;
109+
BOOL answer = (upgradeState >= SSYNewUser) ;
110+
return answer ;
114111
}
115112

116113
+ (BOOL)didUpgradeSinceLastRun {

SSYGrayRect.h

+16-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,22 @@
77
toolbar at the top of same window.
88
*/
99
@interface SSYGrayRect : NSView {
10-
10+
CGFloat m_topWhite ;
11+
CGFloat m_bottomWhite ;
1112
}
1213

14+
15+
/*!
16+
@brief The white value (0=black, 1=white) at the top of the receiver
17+
@details Initial default value is 0.627.
18+
*/
19+
@property (assign) CGFloat topWhite ;
20+
21+
/*!
22+
@brief The white value (0=black, 1=white) at the top of the receiver
23+
@details Initial default value is 0.784.
24+
*/
25+
@property (assign) CGFloat bottomWhite ;
26+
27+
1328
@end

SSYGrayRect.m

+20-7
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,32 @@
33

44
@implementation SSYGrayRect
55

6+
7+
8+
- (void)awakeFromNib {
9+
[self setTopWhite:0.627] ;
10+
[self setBottomWhite:0.784] ;
11+
}
12+
613
- (void)drawRect:(NSRect)dirtyRect {
714
[super drawRect:dirtyRect] ;
815

916
[self lockFocus] ;
1017

11-
// Using Digital Color Meter.app, Safari's status bar measures 216 at the bottom, 221 at the top.
12-
// To match this, I need to use 208/255 at the bottom, 214/255 at the top (Why????)
13-
// However, I want it to complement the toolbar in BookMacster, which is a little darker.
14-
NSGradient* gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:(160.0/255.0) alpha:1.0] // top color
15-
endingColor:[NSColor colorWithCalibratedWhite:(200.0/255.0) alpha:1.0]] ; // bottom color
16-
[gradient drawInRect:[self frame]
18+
NSGradient* gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:[self topWhite]
19+
alpha:1.0]
20+
endingColor:[NSColor colorWithCalibratedWhite:[self bottomWhite]
21+
alpha:1.0]] ;
22+
23+
// The following was fixed in BookMacster 1.18 so that it works
24+
// if the instance does not happen to located at {0,0} in its superview :)
25+
NSRect frame ;
26+
frame.origin.x = 0 ;
27+
frame.origin.y = 0 ;
28+
frame.size.width = [self frame].size.width ;
29+
frame.size.height = [self frame].size.height ;
30+
[gradient drawInRect:frame
1731
angle:270.0] ;
18-
1932
[self unlockFocus] ;
2033
[gradient release] ;
2134
}

SSYPersistentDocumentMultiMigrator.m

-2
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,9 @@ + (BOOL)migrateIfNeededStoreAtUrl:(NSURL*)url
255255
// Fix 20130610 - Does not work.
256256
BOOL isWritable = [[NSFileManager defaultManager] isWritableFileAtPath:[url absoluteString]] ;
257257
BOOL isInViewingMode = [document isInViewingMode] ;
258-
/*SSYDBL*/ NSLog(@"isWritable = %ld isInViewingMode = %ld ", isWritable, isInViewingMode) ;
259258
if (isInViewingMode) {
260259
NSString* fileNameExtension = [[url absoluteString] pathExtension] ;
261260
NSString* writablePath = [[[NSFileManager defaultManager] temporaryFilePath] stringByAppendingPathExtension:fileNameExtension] ;
262-
/*SSYDBL*/ NSLog(@"Not writable.\nCopying: %@\n To: %@", [url absoluteString], writablePath) ;
263261
ok = [[NSFileManager defaultManager] copyItemAtPath:[url absoluteString]
264262
toPath:writablePath
265263
error:&underlyingError] ;

SSYProcessTyper.m

+15-14
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ @implementation SSYProcessTyper
55
/*
66
Added in BookMacster 1.14.4. See piggyback comment in counterpart .h file.
77
*/
8-
+ (ProcessApplicationTransformState)appleTypeForType:(SSYProcessTyperType)type {
8+
+ (ProcessApplicationTransformState)appleTypeForType:(SSYProcessTyperType)type {
99
ProcessApplicationTransformState answer ;
10-
10+
1111
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1060
1212
switch (type) {
1313
case SSYProcessTyperTypeForeground:
@@ -47,7 +47,7 @@ + (SSYProcessTyperType)currentType {
4747
else {
4848
type = SSYProcessTyperTypeForeground ;
4949
}
50-
50+
5151
if (info != NULL) {
5252
CFRelease((CFDictionaryRef)info) ;
5353
}
@@ -86,10 +86,11 @@ + (void)bringFrontPid:(pid_t)pid {
8686
}
8787

8888
+ (void)transformToType:(SSYProcessTyperType)type {
89-
if (type == [self currentType]) {
90-
// Nothing to do
91-
return ;
92-
}
89+
// The following was removed in BookMacster 1.18
90+
// if (type == [self currentType]) {
91+
// // Nothing to do
92+
// return ;
93+
// }
9394

9495
if (type != SSYProcessTyperTypeForeground) {
9596
if (NSAppKitVersionNumber < 1100) {
@@ -102,19 +103,19 @@ + (void)transformToType:(SSYProcessTyperType)type {
102103
// Actual Subtance
103104
ProcessSerialNumber psn = { 0, kCurrentProcess } ;
104105
OSStatus err ;
105-
err = TransformProcessType(&psn, [self appleTypeForType:type]) ;
106+
ProcessApplicationTransformState appleType = [self appleTypeForType:type] ;
107+
err = TransformProcessType(&psn, appleType) ;
106108
if (err != noErr) {
107-
NSLog(@"Internal Error 915-9387 %ld", (long)err) ;
109+
// If you TransformProcessType to the current process type, that is,
110+
// don't change the type, you'll get err = -50 = paramErr here.
111+
// We don't consider that to be an error, and there are no other
112+
// reasonable errors that we know of. So we ignore err.
108113
}
109114

110115
BOOL doShow = (type == SSYProcessTyperTypeForeground) ;
111-
116+
112117
if (doShow) {
113118
[NSApp activateIgnoringOtherApps:YES] ;
114-
err = ShowHideProcess(&psn, true);
115-
if (err != noErr) {
116-
NSLog(@"Internal Error 915-9172 %ld", (long)err) ;
117-
}
118119
}
119120
}
120121

SSYTempWindowController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
In this nib,
2222
* File's Owner should be set to your subclass of this class
2323
* File's Owner 'window' outlet should be wired to a window
24-
* Said window should have checked
24+
* Said window should have these checkboxes switched ON
2525
** ON Release When Closed
2626
** OFF Visible At Launch
2727
** In the MEMORY section,

SSYVectorImages.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ enum SSYVectorImageStyles_enum
55
{
66
SSYVectorImageStylePlus,
77
SSYVectorImageStyleMinus,
8-
/* Triangle, horizonal baseline, pointing up, with top vertex 90 degrees */
8+
/* Triangle, horizonal baseline, pointing up, with top vertex 90 degrees.
9+
This one is shorter and fatter. */
910
SSYVectorImageStyleTriangle90,
10-
/* Triangle, horizonal baseline, pointing up, with top vertex 2*arctan(.5) = 53.2 degrees */
11+
/* Triangle, horizonal baseline, pointing up, with top vertex 2*arctan(.5)
12+
= 53.2 degrees. This one is a taller and thinner. */
1113
SSYVectorImageStyleTriangle53,
1214
SSYVectorImageStyleInfo,
1315
/* Five-pointed star used in SSYStarRatingView */
@@ -21,6 +23,9 @@ typedef enum SSYVectorImageStyles_enum SSYVectorImageStyle ;
2123
@interface SSYVectorImages : NSObject {
2224
}
2325

26+
/*
27+
@param Measure by which the result should be rotated clockwise
28+
*/
2429
+ (NSImage*)imageStyle:(SSYVectorImageStyle)style
2530
diameter:(CGFloat)diameter
2631
color:(NSColor*)color

0 commit comments

Comments
 (0)