More changes for in-window bookmarks. bookmarks display and can be edited,

buttons hooked up. Still off by default.
This commit is contained in:
pinkerton%netscape.com 2003-03-07 03:06:47 +00:00
Родитель 405417d01c
Коммит 51f8215dae
6 изменённых файлов: 156 добавлений и 7 удалений

Просмотреть файл

@ -10,6 +10,19 @@
},
{CLASS = BookmarkItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = BookmarkManagerView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
{
CLASS = BookmarksController;
LANGUAGE = ObjC;
OUTLETS = {
mAddFolderButton = NSButton;
mAddItemButton = NSButton;
mContainersSplit = NSSplitView;
mItemPane = NSOutlineView;
mItemSearchSplit = NSSplitView;
mSearchPane = NSTableView;
};
SUPERCLASS = NSObject;
},
{
ACTIONS = {
addBookmark = id;
@ -118,6 +131,7 @@
mAddBookmarkSheetWindow = NSWindow;
mAddBookmarkTitleField = NSTextField;
mBackItem = NSMenuItem;
mBookmarksController = BookmarksController;
mContentView = BrowserContentView;
mCopyItem = NSMenuItem;
mForwardItem = NSMenuItem;

Просмотреть файл

@ -27,7 +27,7 @@
<key>654</key>
<string>159 629 198 144 0 0 1280 832 </string>
<key>731</key>
<string>265 306 654 459 0 0 1280 832 </string>
<string>313 341 654 459 0 0 1280 832 </string>
</dict>
<key>IBFramework Version</key>
<string>291.0</string>

Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -525,6 +525,7 @@ const int kBookmarksRootItemTag = -2;
// Called by the outliner to determine whether or not we should allow the
// user to edit this item. We're leaving it off for now, becaue there are
// some usability issues with inline editing (no undo, Escape doesn't work).
//
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
return NO; //([[tableColumn identifier] isEqualToString:@"name"]);
@ -579,7 +580,7 @@ const int kBookmarksRootItemTag = -2;
if (!mRegisteredClient) return nil;
NSString *columnName = [tableColumn identifier];
NSMutableAttributedString *cellValue = nil;
id retValue = nil;
if ([columnName isEqualToString: @"name"])
{
@ -588,7 +589,7 @@ const int kBookmarksRootItemTag = -2;
//Set cell's textual contents
//[cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length]) withString:[NSString stringWith_nsAString: nameAttr]];
cellValue = [[[NSMutableAttributedString alloc] initWithString:[item name]] autorelease];
NSMutableAttributedString* cellValue = [[[NSMutableAttributedString alloc] initWithString:[item name]] autorelease];
//Create an attributed string to hold the empty attachment, then release the components.
NSMutableAttributedString* attachmentAttrString = [NSMutableAttributedString attributedStringWithAttachment:textAttachment];
@ -608,8 +609,13 @@ const int kBookmarksRootItemTag = -2;
[cellValue addAttribute:NSBaselineOffsetAttributeName
value:[NSNumber numberWithFloat:-3.0]
range:NSMakeRange(0, 1)];
retValue = cellValue;
}
return cellValue;
else if ([columnName isEqualToString: @"url"])
{
retValue = [item url];
}
return retValue;
}
- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item

Просмотреть файл

@ -78,6 +78,36 @@ class nsIDOMNode;
@end
#pragma mark -
@interface BookmarksController : NSObject
{
IBOutlet NSButton* mAddItemButton;
IBOutlet NSButton* mAddFolderButton;
IBOutlet NSSplitView* mContainersSplit; // vertical split
IBOutlet NSSplitView* mItemSearchSplit; // horizontal split
IBOutlet NSOutlineView* mItemPane;
IBOutlet NSTableView* mSearchPane; // shows search results, can be hidden
}
// Set focus to something in the bookmark manager view
- (void) focus;
- (void) windowDidLoad;
// NSSplitView delegate methods
//- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize;
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedCoord ofSubviewAt:(int)offset;
//- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedCoord ofSubviewAt:(int)offset;
//- (void)splitViewWillResizeSubviews:(NSNotification *)notification;
- (void)splitViewDidResizeSubviews:(NSNotification *)notification;
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview;
//- (float)splitView:(NSSplitView *)splitView constrainSplitPosition:(float)proposedPosition ofSubviewAt:(int)index;
@end
#pragma mark -
typedef enum
{
@ -114,6 +144,7 @@ typedef enum
IBOutlet BookmarksDataSource* mSidebarBookmarksDataSource;
IBOutlet HistoryDataSource* mHistoryDataSource;
IBOutlet BookmarksController* mBookmarksController;
IBOutlet BookmarksToolbar* mPersonalToolbar;

Просмотреть файл

@ -449,6 +449,9 @@ static NSArray* sToolbarDefaults = nil;
[[self window] setFrameTopLeftPoint:topLeft];
}
}
// let the in-window bookmark controller finish up some initialization
[mBookmarksController windowDidLoad];
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
@ -1522,7 +1525,6 @@ static NSArray* sToolbarDefaults = nil;
- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)aTabViewItem
{
NSLog(@"Notify: did select %@", [aTabViewItem label]);
// we'll get called for the sidebar tabs as well. ignore any calls coming from
// there, we're only interested in the browser tabs.
if (aTabView != mTabBrowser)
@ -2124,11 +2126,15 @@ NSLog(@"Notify: did select %@", [aTabViewItem label]);
// swap out between content and bookmarks.
[mContentView toggleBookmarkManager:sender];
//XXXXXX needed until we can turn this on full time, since it's a nib change.
mSidebarBookmarksDataSource->mOutlineView = mBookmarksController->mItemPane;
[mSidebarBookmarksDataSource ensureBookmarks];
// if we're now showing the bm manager, force it to have focus,
// otherwise give focus back to gecko.
if ( [mContentView isBookmarkManagerVisible] ) {
//XXX set focus to appropriate area of bm manager
// set focus to appropriate area of bm manager
[mBookmarksController focus];
}
else {
CHBrowserView* browserView = [mBrowserView getBrowserView];
@ -2255,3 +2261,95 @@ static Boolean movieControllerFilter(MovieController mc, short action, void *par
@end
#pragma mark -
@implementation BookmarksController
#if 0
- (id) init
{
if ( self = [super init] )
{
mAddItemButton = nil;
}
return self;
}
#endif
//
// - splitViewDidResizeSubviews:
//
// Called when one of the views got resized. We want to ensure that the "add bookmark
// item" button gets lined up with the left edge of the item panel. If the container/item
// split was the one that changed, move it accordingly
//
- (void)splitViewDidResizeSubviews:(NSNotification *)notification
{
const int kButtonGutter = 8;
if ( [notification object] == mContainersSplit ) {
// get the position of the item view relative to the window and set the button
// to that X value. Yes, this will fall down if the bookmark view is inset from the window
// but i think we can safely assume it won't be.
NSRect windowRect = [mItemPane convertRect:[mItemPane bounds] toView:nil];
NSRect newButtonLocation = [mAddItemButton frame];
newButtonLocation.origin.x = windowRect.origin.x;
[mAddItemButton setFrame:newButtonLocation];
[mAddItemButton setNeedsDisplay:YES];
// offset by the width of the button and the gutter and we've got the location
// of the add folder button next to it.
newButtonLocation.origin.x += newButtonLocation.size.width + kButtonGutter;
[mAddFolderButton setFrame:newButtonLocation];
[mAddFolderButton setNeedsDisplay:YES];
}
}
//
// - splitView:canCollapseSubview:
//
// Called when appkit wants to ask if it can collapse a subview. The only subview
// of our splits that we allow to be hidden is the search panel.
//
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview
{
BOOL retVal = NO;
// subview will be a NSScrollView, so we have to get the superview of the
// search pane for comparison.
if ( sender == mItemSearchSplit && subview == [mSearchPane superview] )
retVal = YES;
return retVal;
}
- (void)windowDidLoad
{
// hide the search panel
// set up the font on the item view to be smaller
NSArray* columns = [mItemPane tableColumns];
if ( columns ) {
int numColumns = [columns count];
NSFont* smallerFont = [NSFont systemFontOfSize:11];
NSLog(@"font is %@", smallerFont);
for ( int i = 0; i < numColumns; ++i )
[[[columns objectAtIndex:i] dataCell] setFont:smallerFont];
}
}
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedCoord ofSubviewAt:(int)offset
{
const int kMinimumContainerSplitWidth = 150;
float retVal = proposedCoord;
if ( sender == mContainersSplit )
retVal = kMinimumContainerSplitWidth;
return retVal;
}
- (void) focus
{
[[mItemPane window] makeFirstResponder:mItemPane];
}
@end