added inspector to split views.

Rough setup, nothing working right now
This commit is contained in:
michael starke
2013-03-05 01:56:19 +01:00
parent 03bb227c16
commit cb6326480e
17 changed files with 328 additions and 3574 deletions

View File

@@ -69,6 +69,8 @@
4C6B0E8C16C9B99B00A9ED23 /* PasswordInputView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C6B0E8B16C9B99B00A9ED23 /* PasswordInputView.xib */; };
4C6DA0F916D81B8A0011224B /* MPPathBarItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6DA0F816D81B8A0011224B /* MPPathBarItemView.m */; };
4C75CE3C16CB128700F61A4D /* MPDatabaseController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C75CE3B16CB128700F61A4D /* MPDatabaseController.m */; };
4C77547516E55FE800970E02 /* MPInspectorTabViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C77547416E55FE800970E02 /* MPInspectorTabViewController.m */; };
4C77547716E55FFC00970E02 /* InspectorTabView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C77547616E55FFC00970E02 /* InspectorTabView.xib */; };
4C77E36715B84A240093A587 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C77E36615B84A240093A587 /* Cocoa.framework */; };
4C77E37115B84A240093A587 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C77E36F15B84A240093A587 /* InfoPlist.strings */; };
4C77E37315B84A240093A587 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C77E37215B84A240093A587 /* main.m */; };
@@ -104,8 +106,6 @@
4CE06D7D16DEF3FE00840E3A /* MPButtonBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE06D7C16DEF3FE00840E3A /* MPButtonBar.m */; };
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; };
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; };
4CF5D49616D5B6E900CB78BD /* MPEntryEditController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D49416D5B6E900CB78BD /* MPEntryEditController.m */; };
4CF5D49716D5B6E900CB78BD /* EntryEditView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CF5D49516D5B6E900CB78BD /* EntryEditView.xib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -223,6 +223,9 @@
4C6DA0F816D81B8A0011224B /* MPPathBarItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPathBarItemView.m; sourceTree = "<group>"; };
4C75CE3A16CB128700F61A4D /* MPDatabaseController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatabaseController.h; sourceTree = "<group>"; };
4C75CE3B16CB128700F61A4D /* MPDatabaseController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDatabaseController.m; sourceTree = "<group>"; };
4C77547316E55FE800970E02 /* MPInspectorTabViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPInspectorTabViewController.h; sourceTree = "<group>"; };
4C77547416E55FE800970E02 /* MPInspectorTabViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPInspectorTabViewController.m; sourceTree = "<group>"; };
4C77547616E55FFC00970E02 /* InspectorTabView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InspectorTabView.xib; sourceTree = "<group>"; };
4C77E36215B84A240093A587 /* MacPass.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MacPass.app; sourceTree = BUILT_PRODUCTS_DIR; };
4C77E36615B84A240093A587 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
4C77E36915B84A240093A587 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -286,9 +289,6 @@
4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayWindowController.m; sourceTree = "<group>"; };
4CE8247316E2F2B900573141 /* MPOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOverlayView.h; sourceTree = "<group>"; };
4CE8247416E2F2B900573141 /* MPOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayView.m; sourceTree = "<group>"; };
4CF5D49316D5B6E900CB78BD /* MPEntryEditController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryEditController.h; sourceTree = "<group>"; };
4CF5D49416D5B6E900CB78BD /* MPEntryEditController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEntryEditController.m; sourceTree = "<group>"; };
4CF5D49516D5B6E900CB78BD /* EntryEditView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryEditView.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -310,7 +310,6 @@
isa = PBXGroup;
children = (
4C25D58616CF0FAA00F6806C /* EntryView.xib */,
4CF5D49516D5B6E900CB78BD /* EntryEditView.xib */,
4CA0B2EF15BCADC800654E32 /* GeneralSettings.xib */,
4C77E37B15B84A240093A587 /* MainMenu.xib */,
4C61EA0416D2FFE200AC519E /* OutlineView.xib */,
@@ -319,6 +318,7 @@
4C25D58416CF0F8800F6806C /* WelcomeView.xib */,
4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */,
4C4E1DC616DC6536007B9B47 /* PathBar.xib */,
4C77547616E55FFC00970E02 /* InspectorTabView.xib */,
4C69A73816D589DF00EC1B1A /* MPGradientView.h */,
4C69A73916D589DF00EC1B1A /* MPGradientView.m */,
4CE8247316E2F2B900573141 /* MPOverlayView.h */,
@@ -576,8 +576,8 @@
4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */,
4C61EA0116D2FD0800AC519E /* MPOutlineViewController.h */,
4C61EA0216D2FD0800AC519E /* MPOutlineViewController.m */,
4CF5D49316D5B6E900CB78BD /* MPEntryEditController.h */,
4CF5D49416D5B6E900CB78BD /* MPEntryEditController.m */,
4C77547316E55FE800970E02 /* MPInspectorTabViewController.h */,
4C77547416E55FE800970E02 /* MPInspectorTabViewController.m */,
);
name = "View Controller";
sourceTree = "<group>";
@@ -776,10 +776,10 @@
4CD78AC016D155FF00768A1D /* 11_CameraTemplate.pdf in Resources */,
4C61EA0516D2FFE200AC519E /* OutlineView.xib in Resources */,
4CB9339916D3A0DD00A13B5D /* Credits.rtf in Resources */,
4CF5D49716D5B6E900CB78BD /* EntryEditView.xib in Resources */,
4C3FFD9E16DAF60600DF9186 /* FilterBar.xib in Resources */,
4C4E1DC716DC6536007B9B47 /* PathBar.xib in Resources */,
4C431BCF16E2BAB000700A81 /* OverlayWindow.xib in Resources */,
4C77547716E55FFC00970E02 /* InspectorTabView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -865,7 +865,6 @@
4C2C4C2C16D3BE3700D49295 /* KdbGroup+MPAdditions.m in Sources */,
4CC1AEBE16D4467C006D2AAB /* KdbTree+MPAdditions.m in Sources */,
4C69A73A16D589DF00EC1B1A /* MPGradientView.m in Sources */,
4CF5D49616D5B6E900CB78BD /* MPEntryEditController.m in Sources */,
4C16854416D704980027ECBC /* MPPathBar.m in Sources */,
4C6DA0F916D81B8A0011224B /* MPPathBarItemView.m in Sources */,
4C920E2A16DCDFA00083839B /* MPLoggerProxy.m in Sources */,
@@ -876,6 +875,7 @@
4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */,
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */,
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */,
4C77547516E55FE800970E02 /* MPInspectorTabViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12C3103</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">3084</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSCustomObject</string>
<string>NSCustomView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001">
<string key="NSClassName">MPInspectorTabViewController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomView" id="1005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews"/>
<string key="NSFrameSize">{289, 504}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSClassName">NSView</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">10</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="1005"/>
<array class="NSMutableArray" key="children"/>
<reference key="parent" ref="0"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">20</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MPInspectorTabViewController</string>
<string key="superclassName">MPViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPInspectorTabViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPViewController</string>
<string key="superclassName">NSViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
</data>
</archive>

View File

@@ -1,18 +0,0 @@
//
// MPEntryEditController.h
// MacPass
//
// Created by michael starke on 21.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPViewController.h"
@class KdbNode;
@interface MPEntryEditController : MPViewController
@property (retain) id selectedItem;
- (IBAction)save:(id)sender;
@end

View File

@@ -1,48 +0,0 @@
//
// MPEntryEditController.m
// MacPass
//
// Created by michael starke on 21.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPEntryEditController.h"
#import "MPMainWindowController.h"
@interface MPEntryEditController ()
@property (assign) IBOutlet NSButton *cancelButton;
@end
@implementation MPEntryEditController
- (id)init {
return [self initWithNibName:@"EntryEditView" bundle:nil];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Initialization code here.
}
return self;
}
- (void)dealloc {
self.selectedItem = nil;
[super dealloc];
}
- (NSResponder *)reconmendedFirstResponder {
return self.cancelButton;
}
#pragma mark Actions
- (IBAction)save:(id)sender {
MPMainWindowController *controller = [[self.view window] windowController];
[controller showEntries];
}
@end

View File

@@ -38,6 +38,6 @@ typedef enum {
- (void)copyPassword:(id)sender;
//- (void)copyURL:(id)sender;
//- (void)createEntry:(id)sender;
//- (void)deleteEntry:(id)sender;
- (void)deleteEntry:(id)sender;
@end

View File

@@ -413,6 +413,15 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
[[MPOverlayWindowController sharedController] displayOverlayImage:image label:lable atView:self.view];
}
- (void)deleteEntry:(id)sender {
KdbEntry *selectedEntry = [self _selectedEntry];
if(!selectedEntry) {
return; // no entry selected
}
//[[selectedEntry parent] removeEntry:selectedEntry];
[self.entryArrayController removeObject:selectedEntry];
}
- (void)_toggleFilterSpace:(id)sender {
NSButton *button = sender;
NSNumber *value = self.filterButtonToMode[[button identifier]];

View File

@@ -0,0 +1,13 @@
//
// MPInspectorTabViewController.h
// MacPass
//
// Created by Michael Starke on 05.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPViewController.h"
@interface MPInspectorTabViewController : MPViewController
@end

View File

@@ -0,0 +1,29 @@
//
// MPInspectorTabViewController.m
// MacPass
//
// Created by Michael Starke on 05.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPInspectorTabViewController.h"
@interface MPInspectorTabViewController ()
@end
@implementation MPInspectorTabViewController
- (id)init {
return [[MPInspectorTabViewController alloc] initWithNibName:@"InspectorTabView" bundle:nil];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
@end

View File

@@ -20,5 +20,6 @@
Clears the Search filter
*/
- (void)clearFilter:(id)sender;
- (void)toggleInspector:(id)sender;
@end

View File

@@ -14,15 +14,18 @@
#import "MPToolbarDelegate.h"
#import "MPOutlineViewController.h"
#import "MPMainWindowSplitViewDelegate.h"
#import "MPInspectorTabViewController.h"
#import "MPAppDelegate.h"
#import "MPEntryEditController.h"
static CGFloat _outlineSplitterPosition;
static CGFloat _inspectorSplitterPosition;
@interface MPMainWindowController ()
@property (assign) IBOutlet NSView *outlineView;
@property (assign) IBOutlet NSSplitView *splitView;
@property (assign) IBOutlet NSView *contentView;
@property (assign) IBOutlet NSView *inspectorView;
@property (retain) IBOutlet NSView *welcomeView;
@property (assign) IBOutlet NSTextField *welcomeText;
@@ -30,14 +33,17 @@
@property (retain) MPPasswordInputController *passwordInputController;
@property (retain) MPEntryViewController *entryViewController;
@property (retain) MPEntryEditController *entryEditController;
@property (retain) MPOutlineViewController *outlineViewController;
@property (retain) MPInspectorTabViewController *inspectorTabViewController;
@property (retain) MPToolbarDelegate *toolbarDelegate;
@property (retain) MPMainWindowSplitViewDelegate *splitViewDelegate;
/* View show/hide */
- (void)_collapseOutlineView;
- (void)_expandOutlineView;
- (void)_toggleInspector;
- (void)_setContentViewController:(MPViewController *)viewController;
- (void)_updateWindowTitle;
@@ -50,6 +56,7 @@
if( self ) {
_toolbarDelegate = [[MPToolbarDelegate alloc] init];
_outlineViewController = [[MPOutlineViewController alloc] init];
_inspectorTabViewController = [[MPInspectorTabViewController alloc] init];
_splitViewDelegate = [[MPMainWindowSplitViewDelegate alloc] init];
[[NSBundle mainBundle] loadNibNamed:@"WelcomeView" owner:self topLevelObjects:NULL];
@@ -65,17 +72,17 @@
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
self.welcomeView = nil;
self.welcomeText = nil;
self.toolbar = nil;
[_welcomeView release];
[_welcomeText release];
[_toolbar release];
self.passwordInputController = nil;
self.entryViewController = nil;
self.entryEditController = nil;
self.outlineViewController = nil;
[_passwordInputController release];
[_entryViewController release];
[_outlineViewController release];
[_inspectorTabViewController release];
self.toolbarDelegate = nil;
self.splitViewDelegate = nil;
[_toolbarDelegate release];
[_splitViewDelegate release];
[super dealloc];
}
@@ -98,11 +105,20 @@
[self.splitView setDelegate:self.splitViewDelegate];
NSRect frame = [self.outlineView frame];
[self.outlineViewController.view setFrame:frame];
/* Add outlineview */
const NSRect outlineFrame = [self.outlineView frame];
[self.outlineViewController.view setFrame:outlineFrame];
[self.outlineViewController.view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self.splitView replaceSubview:self.outlineView with:[self.outlineViewController view]];
[self.outlineViewController updateResponderChain];
/* Add inspector view */
const NSRect inspectorFrame = [self.inspectorView frame];
[self.inspectorTabViewController.view setFrame:inspectorFrame];
[self.inspectorTabViewController.view setAutoresizesSubviews:NSViewWidthSizable | NSViewHeightSizable ];
[self.splitView replaceSubview:self.inspectorView with:[self.inspectorTabViewController view]];
[self.inspectorTabViewController updateResponderChain];
[self.splitView adjustSubviews];
[self _setContentViewController:nil];
@@ -144,16 +160,18 @@
}
- (void)_collapseOutlineView {
NSView *outlineView = [self.splitView subviews][0];
if(![outlineView isHidden]) {
[self.splitView setPosition:0 ofDividerAtIndex:0];
NSView *outlineView = [self.splitView subviews][MPSplitViewOutlineViewIndex];
if([outlineView isHidden]) {
_outlineSplitterPosition = [outlineView frame].size.width;
[self.splitView setPosition:0 ofDividerAtIndex:MPSplitViewOutlineViewIndex];
}
}
- (void)_expandOutlineView {
NSView *outlineView = [self.splitView subviews][0];
if([outlineView isHidden]) {
[self.splitView setPosition:MPMainWindowSplitViewDelegateMinimumOutlineWidth ofDividerAtIndex:0];
NSView *outlineView = [self.splitView subviews][MPSplitViewOutlineViewIndex];
if(![outlineView isHidden]) {
CGFloat splitterPosition = MAX( MPMainWindowSplitViewDelegateMinimumOutlineWidth, _outlineSplitterPosition );
[self.splitView setPosition:splitterPosition ofDividerAtIndex:MPSplitViewOutlineViewIndex];
}
}
@@ -170,6 +188,22 @@
#pragma mark Actions
- (void)toggleInspector:(id)sender {
NSView *inspectorView = [self.splitView subviews][MPSplitViewInspectorViewIndex];
const BOOL collapsed = [self.splitView isSubviewCollapsed:inspectorView];
if(collapsed) {
CGFloat splitterPosition = MAX(MPMainWindowSplitViewDelegateMinimumInspectorWidth, _inspectorSplitterPosition);
[self.splitView setPosition:splitterPosition ofDividerAtIndex:1];
}
else {
_inspectorSplitterPosition = [inspectorView frame].origin.x;
CGFloat splitterPosition = [inspectorView frame].origin.x * [inspectorView frame].size.width;
[[NSAnimationContext currentContext] setDuration:2];
[[self.splitView animator] setPosition:splitterPosition ofDividerAtIndex:1];
}
[inspectorView setHidden:!collapsed];
}
- (void)performFindPanelAction:(id)sender {
[self.window makeFirstResponder:[self.toolbarDelegate.searchItem view]];
}
@@ -220,16 +254,6 @@
}
- (void)showEditForm:(id)sender {
if( ![MPDatabaseController hasOpenDatabase] ) {
return; // No database open - nothing to do;
}
if(!self.entryEditController) {
self.entryEditController = [[[MPEntryEditController alloc] init] autorelease];
}
//find active selection
self.entryEditController.selectedItem = nil;
[self _setContentViewController:self.entryEditController];
}

View File

@@ -8,9 +8,15 @@
#import <Foundation/Foundation.h>
extern const CGFloat MPMainWindowSplitViewDelegateMinimumOutlineWidth;
extern const CGFloat MPMainWindowSplitViewDelegateMaximumOutlineWidth;
extern const CGFloat MPMainWindowSplitViewDelegateMinimumContentWidth;
APPKIT_EXTERN const CGFloat MPMainWindowSplitViewDelegateMinimumOutlineWidth;
APPKIT_EXTERN const CGFloat MPMainWindowSplitViewDelegateMinimumContentWidth;
APPKIT_EXTERN const CGFloat MPMainWindowSplitViewDelegateMinimumInspectorWidth;
typedef enum {
MPSplitViewOutlineViewIndex,
MPSplitViewContentViewIndex,
MPSplitViewInspectorViewIndex,
} MPSplitViewSubViewIndex;
@interface MPMainWindowSplitViewDelegate : NSObject <NSSplitViewDelegate>

View File

@@ -10,51 +10,59 @@
const CGFloat MPMainWindowSplitViewDelegateMinimumOutlineWidth = 150.0;
const CGFloat MPMainWindowSplitViewDelegateMinimumContentWidth = 400.0;
const CGFloat MPMainWindowSplitViewDelegateMinimumInspectorWidth = 200.0;
@interface MPMainWindowSplitViewDelegate ()
- (NSView *)_leftView:(NSSplitView *)splitView;
- (NSView *)_rightView:(NSSplitView *)splitView;
- (NSView *)_subViewOfType:(MPSplitViewSubViewIndex)subViewType splitView:(NSSplitView *)splitView;
@end
@implementation MPMainWindowSplitViewDelegate
- (NSView *)_leftView:(NSSplitView *)splitView {
return [splitView subviews][0];
}
- (NSView *)_rightView:(NSSplitView *)splitView {
return [splitView subviews][1];
- (NSView *)_subViewOfType:(MPSplitViewSubViewIndex)subViewType splitView :(NSSplitView *)splitView {
return [splitView subviews][subViewType];
}
- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview {
return (subview == [self _leftView:splitView]);
return (subview != [self _subViewOfType:MPSplitViewContentViewIndex splitView:splitView]);
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex {
return (proposedMinimumPosition < MPMainWindowSplitViewDelegateMinimumOutlineWidth) ? MPMainWindowSplitViewDelegateMinimumOutlineWidth : proposedMinimumPosition;
return proposedMinimumPosition;
//return (proposedMinimumPosition < MPMainWindowSplitViewDelegateMinimumOutlineWidth) ? MPMainWindowSplitViewDelegateMinimumOutlineWidth : proposedMinimumPosition;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex {
CGFloat availableWidth = [splitView frame].size.width - [splitView dividerThickness];
return (availableWidth - MPMainWindowSplitViewDelegateMinimumOutlineWidth);
return proposedMaximumPosition;
// CGFloat availableWidth = [splitView frame].size.width - [splitView dividerThickness];
// return (availableWidth - MPMainWindowSplitViewDelegateMinimumOutlineWidth);
}
- (void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:(NSSize)oldSize {
NSSize newSize = [splitView frame].size;
const CGFloat dividierThickness = [splitView dividerThickness];
NSView *leftView = [self _leftView:splitView];
NSView *rightView = [self _rightView:splitView];
NSView *outlineView = [self _subViewOfType:MPSplitViewOutlineViewIndex splitView:splitView];
NSView *contentView = [self _subViewOfType:MPSplitViewContentViewIndex splitView:splitView];
NSView *inspectorView = [self _subViewOfType:MPSplitViewInspectorViewIndex splitView:splitView];
CGFloat leftWidth = [leftView isHidden] ? 0.0 : [leftView frame].size.width;
NSRect newRightFrame = NSMakeRect(leftWidth + dividierThickness, 0, newSize.width - leftWidth - dividierThickness, newSize.height);
NSRect newLeftFrame = NSMakeRect(0, 0, leftWidth, newSize.height);
if(NO == [leftView isHidden]) {
[leftView setFrame:newLeftFrame];
CGFloat outlineWidth = [outlineView isHidden] ? 0.0 : [outlineView frame].size.width;
CGFloat inspectorWidth = [inspectorView isHidden] ? 0.0 : [inspectorView frame].size.width;
CGFloat contentWidth = newSize.width - outlineWidth - inspectorWidth - 2 * dividierThickness;
NSRect newContentFrame = NSMakeRect(outlineWidth + dividierThickness, 0, contentWidth, newSize.height);
NSRect newOutlineFrame = NSMakeRect(0, 0, outlineWidth, newSize.height);
NSRect newInpectorFrame = NSMakeRect(newContentFrame.origin.x + contentWidth + dividierThickness, 0, inspectorWidth, newSize.height);
if(NO == [outlineView isHidden]) {
[outlineView setFrame:newOutlineFrame];
}
[rightView setFrame:newRightFrame];
if(NO == [inspectorView isHidden]) {
[inspectorView setFrame:newInpectorFrame];
}
[contentView setFrame:newContentFrame];
};
@end

View File

@@ -17,6 +17,7 @@ NSString *const MPToolbarItemEdit = @"Edit";
NSString *const MPToolbarItemDelete =@"Delete";
NSString *const MPToolbarItemAction = @"Action";
NSString *const MPToolbarItemSearch = @"Search";
NSString *const MPToolbarItemInspector = @"Inspector";
@interface MPToolbarDelegate()
@@ -32,7 +33,7 @@ NSString *const MPToolbarItemSearch = @"Search";
- (id)init {
self = [super init];
if (self) {
_toolbarIdentifiers = [@[ MPToolbarItemAddEntry, MPToolbarItemDelete, MPToolbarItemEdit, MPToolbarItemAddGroup, MPToolbarItemAction, NSToolbarFlexibleSpaceItemIdentifier, MPToolbarItemSearch ] retain];
_toolbarIdentifiers = [@[ MPToolbarItemAddEntry, MPToolbarItemDelete, MPToolbarItemEdit, MPToolbarItemAddGroup, MPToolbarItemAction, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, MPToolbarItemInspector, MPToolbarItemSearch ] retain];
_toolbarImages = [[self createToolbarImages] retain];
_toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:[self.toolbarIdentifiers count]];
}
@@ -107,6 +108,9 @@ NSString *const MPToolbarItemSearch = @"Search";
[button setTarget:nil];
[button setAction:@selector(showEditForm:)];
}
else if( [itemIdentifier isEqualToString:MPToolbarItemInspector]) {
[button setAction:@selector(toggleInspector:)];
}
NSRect fittingRect = [button frame];
fittingRect.size.width = MAX( (CGFloat)32.0,fittingRect.size.width);
@@ -134,7 +138,8 @@ NSString *const MPToolbarItemSearch = @"Search";
MPToolbarItemAddGroup: [MPIconHelper icon:MPIconPassword],
MPToolbarItemDelete: [NSImage imageNamed:NSImageNameRemoveTemplate],
MPToolbarItemEdit: [MPIconHelper icon:MPIconNotepad],
MPToolbarItemAction: [NSImage imageNamed:NSImageNameActionTemplate]
MPToolbarItemAction: [NSImage imageNamed:NSImageNameActionTemplate],
MPToolbarItemInspector: [NSImage imageNamed:NSImageNameInfo],
};
return imageDict;
}

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3E4</string>
<string>401</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>

View File

@@ -2,7 +2,7 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.SystemVersion">12C3103</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
@@ -56,7 +56,7 @@
<reference key="NSNextResponder" ref="947682332"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews"/>
<string key="NSFrameSize">{256, 449}</string>
<string key="NSFrameSize">{209, 449}</string>
<reference key="NSSuperview" ref="947682332"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="938782220"/>
@@ -67,13 +67,22 @@
<reference key="NSNextResponder" ref="947682332"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews"/>
<string key="NSFrame">{{257, 0}, {470, 449}}</string>
<string key="NSFrame">{{210, 0}, {383, 449}}</string>
<reference key="NSSuperview" ref="947682332"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="350501330"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="350501330">
<reference key="NSNextResponder" ref="947682332"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{594, 0}, {133, 449}}</string>
<reference key="NSSuperview" ref="947682332"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">NSView</string>
</object>
</array>
<string key="NSFrameSize">{727, 449}</string>
<reference key="NSSuperview" ref="1006"/>
@@ -89,7 +98,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="947682332"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{400, 422}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
@@ -129,6 +138,14 @@
</object>
<int key="connectionID">634</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">inspectorView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="350501330"/>
</object>
<int key="connectionID">676</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -178,6 +195,7 @@
<array class="NSMutableArray" key="children">
<reference ref="938782220"/>
<reference ref="425088172"/>
<reference ref="350501330"/>
</array>
<reference key="parent" ref="1006"/>
</object>
@@ -192,6 +210,11 @@
<reference key="object" ref="425088172"/>
<reference key="parent" ref="947682332"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">675</int>
<reference key="object" ref="350501330"/>
<reference key="parent" ref="947682332"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -207,12 +230,13 @@
<string key="603.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="605.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="628.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="675.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">674</int>
<int key="maxID">676</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -221,6 +245,7 @@
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contentView">NSView</string>
<string key="inspectorView">NSView</string>
<string key="outlineView">NSView</string>
<string key="splitView">NSSplitView</string>
<string key="welcomeText">NSTextField</string>
@@ -231,6 +256,10 @@
<string key="name">contentView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="inspectorView">
<string key="name">inspectorView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="outlineView">
<string key="name">outlineView</string>
<string key="candidateClassName">NSView</string>

View File

@@ -53,7 +53,7 @@
<object class="NSTextField" id="668073146">
<reference key="NSNextResponder" ref="151608046"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{53, 20}, {45, 19}}</string>
<string key="NSFrame">{{53, 20}, {45, 18}}</string>
<reference key="NSSuperview" ref="151608046"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
@@ -96,7 +96,7 @@
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
</set>
<string key="NSFrame">{{43, 47}, {64, 64}}</string>
<string key="NSFrame">{{43, 46}, {64, 65}}</string>
<reference key="NSSuperview" ref="151608046"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="668073146"/>
@@ -125,7 +125,7 @@
<reference key="NSNextKeyView" ref="129824625"/>
<string key="NSReuseIdentifierKey">_NS:20</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>