Browse files

reverted kfsplitview to default, didn't realize it was a library by k…

…en ferry. also removed divider style customziation from the library and added it into the plugin code
  • Loading branch information...
1 parent 256fa31 commit 15870c3bb275624be56fac2f9e912379db5ee3ec @markhuot committed Jul 14, 2011
Showing with 43 additions and 3 deletions.
  1. +42 −3 src/sidebar/KFSplitView.m
  2. +1 −0 src/sidebar/SideBarSwitching.mm
View
45 src/sidebar/KFSplitView.m
@@ -166,14 +166,53 @@ + (void)initialize
- (void)kfSetup
{
+ // be sure to setup cursors before calling setVertical:
+ [self kfSetupResizeCursors];
+
kfCollapsedSubviews = [[NSMutableSet alloc] init];
kfDividerRects = [[NSMutableArray alloc] init];
kfDefaults = [NSUserDefaults standardUserDefaults];
kfNotificationCenter = [NSNotificationCenter defaultCenter];
[self setVertical:[self isVertical]];
- [self setDividerStyle:NSSplitViewDividerStyleThin];
+}
+
+// Attempts to find cursors to use as kfIsVerticalResizeCursor and kfNotIsVerticalResizeCursor.
+// These cursors are eventually released, so make sure each receives a retain message now.
+// If no good cursors can be found, an error is printed and the arrow cursor is used.
+- (void)kfSetupResizeCursors
+{
+ NSImage *isVerticalImage, *isNotVerticalImage;
+
+ if (isVerticalImage = [NSImage imageNamed:@"NSTruthHorizontalResizeCursor"]); // standard Jaguar NSSplitView resize cursor
+ else if (isVerticalImage = [NSImage imageNamed:@"NSTruthHResizeCursor"]);
+
+ if (isVerticalImage)
+ {
+ kfIsVerticalResizeCursor = [[NSCursor alloc] initWithImage:isVerticalImage
+ hotSpot:NSMakePoint(8,8)];
+ }
+
+ if (isNotVerticalImage = [NSImage imageNamed:@"NSTruthVerticalResizeCursor"]); // standard Jaguar NSSplitView resize cursor
+ else if (isNotVerticalImage = [NSImage imageNamed:@"NSTruthVResizeCursor"]);
+
+ if (isNotVerticalImage)
+ {
+ kfNotIsVerticalResizeCursor = [[NSCursor alloc] initWithImage:isNotVerticalImage
+ hotSpot:NSMakePoint(8,8)];
+ }
+
+ if (kfIsVerticalResizeCursor == nil)
+ {
+ kfIsVerticalResizeCursor = [[NSCursor arrowCursor] retain];
+ NSLog(@"Warning - no horizontal resizing cursor located. Please report this as a bug.");
+ }
+ if (kfNotIsVerticalResizeCursor == nil)
+ {
+ kfNotIsVerticalResizeCursor = [[NSCursor arrowCursor] retain];
+ NSLog(@"Warning - no vertical resizing cursor located. Please report this as a bug.");
+ }
}
- (void)awakeFromNib
@@ -808,11 +847,11 @@ - (void)setVertical:(BOOL)flag
kfIsVertical = flag;
if (kfIsVertical)
{
- kfCurrentResizeCursor = [NSCursor resizeLeftRightCursor];
+ kfCurrentResizeCursor = kfIsVerticalResizeCursor;
}
else
{
- kfCurrentResizeCursor = [NSCursor resizeLeftRightCursor];
+ kfCurrentResizeCursor = kfNotIsVerticalResizeCursor;
}
}
View
1 src/sidebar/SideBarSwitching.mm
@@ -44,6 +44,7 @@ - (void)SideBarSwitching_windowDidLoad
[splitView setVertical:YES];
[splitView setDelegate:self];
[splitView setSideBarOnRight:[SideBarSwitching sidebarOnRight]];
+ [splitView setDividerStyle:NSSplitViewDividerStyleThin];
if(not [SideBarSwitching sidebarOnRight])
[splitView addSubview:drawerView];

0 comments on commit 15870c3

Please sign in to comment.