Indent entries in the folder popup to reflect the hierarchy. from Richard Schreyer (richards9@mac.com)

git-svn-id: svn://10.0.0.236/trunk@120301 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pinkerton%netscape.com
2002-04-30 14:58:16 +00:00
parent fe9f14c48f
commit 15db7e42d6
4 changed files with 40 additions and 20 deletions

View File

@@ -814,7 +814,7 @@ void BookmarksService::EnsureToolbarRoot()
}
static
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch)
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch, int depth = 0)
{
// Get the menu item children.
NSArray* children = [aMenu itemArray];
@@ -823,18 +823,23 @@ void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTa
startPosition = 3;
int count = [children count];
for (int i = startPosition; i < count; i++) {
for (int i = startPosition; i < count; ++i) {
NSMenuItem* menuItem = [children objectAtIndex: i];
NSMenu* submenu = [menuItem submenu];
if (submenu) {
// This is a folder. Add it to our list and then recur.
[aPopup addItemWithTitle: [menuItem title]];
// This is a folder. Add it to our list and then recur. Indent it
// the apropriate depth for readability in the menu.
NSMutableString *title = [NSMutableString stringWithString:[menuItem title]];
for (int j = 0; j <= depth; ++j)
[title insertString:@" " atIndex: 0];
[aPopup addItemWithTitle: title];
NSMenuItem* lastItem = [aPopup lastItem];
if ([menuItem tag] == aTagToMatch)
[aPopup selectItem: lastItem];
[lastItem setTag: [menuItem tag]];
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch);
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch, depth+1);
}
}
}

View File

@@ -814,7 +814,7 @@ void BookmarksService::EnsureToolbarRoot()
}
static
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch)
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch, int depth = 0)
{
// Get the menu item children.
NSArray* children = [aMenu itemArray];
@@ -823,18 +823,23 @@ void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTa
startPosition = 3;
int count = [children count];
for (int i = startPosition; i < count; i++) {
for (int i = startPosition; i < count; ++i) {
NSMenuItem* menuItem = [children objectAtIndex: i];
NSMenu* submenu = [menuItem submenu];
if (submenu) {
// This is a folder. Add it to our list and then recur.
[aPopup addItemWithTitle: [menuItem title]];
// This is a folder. Add it to our list and then recur. Indent it
// the apropriate depth for readability in the menu.
NSMutableString *title = [NSMutableString stringWithString:[menuItem title]];
for (int j = 0; j <= depth; ++j)
[title insertString:@" " atIndex: 0];
[aPopup addItemWithTitle: title];
NSMenuItem* lastItem = [aPopup lastItem];
if ([menuItem tag] == aTagToMatch)
[aPopup selectItem: lastItem];
[lastItem setTag: [menuItem tag]];
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch);
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch, depth+1);
}
}
}

View File

@@ -814,7 +814,7 @@ void BookmarksService::EnsureToolbarRoot()
}
static
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch)
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch, int depth = 0)
{
// Get the menu item children.
NSArray* children = [aMenu itemArray];
@@ -823,18 +823,23 @@ void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTa
startPosition = 3;
int count = [children count];
for (int i = startPosition; i < count; i++) {
for (int i = startPosition; i < count; ++i) {
NSMenuItem* menuItem = [children objectAtIndex: i];
NSMenu* submenu = [menuItem submenu];
if (submenu) {
// This is a folder. Add it to our list and then recur.
[aPopup addItemWithTitle: [menuItem title]];
// This is a folder. Add it to our list and then recur. Indent it
// the apropriate depth for readability in the menu.
NSMutableString *title = [NSMutableString stringWithString:[menuItem title]];
for (int j = 0; j <= depth; ++j)
[title insertString:@" " atIndex: 0];
[aPopup addItemWithTitle: title];
NSMenuItem* lastItem = [aPopup lastItem];
if ([menuItem tag] == aTagToMatch)
[aPopup selectItem: lastItem];
[lastItem setTag: [menuItem tag]];
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch);
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch, depth+1);
}
}
}

View File

@@ -814,7 +814,7 @@ void BookmarksService::EnsureToolbarRoot()
}
static
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch)
void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTagToMatch, int depth = 0)
{
// Get the menu item children.
NSArray* children = [aMenu itemArray];
@@ -823,18 +823,23 @@ void RecursiveAddBookmarkConstruct(NSPopUpButton* aPopup, NSMenu* aMenu, int aTa
startPosition = 3;
int count = [children count];
for (int i = startPosition; i < count; i++) {
for (int i = startPosition; i < count; ++i) {
NSMenuItem* menuItem = [children objectAtIndex: i];
NSMenu* submenu = [menuItem submenu];
if (submenu) {
// This is a folder. Add it to our list and then recur.
[aPopup addItemWithTitle: [menuItem title]];
// This is a folder. Add it to our list and then recur. Indent it
// the apropriate depth for readability in the menu.
NSMutableString *title = [NSMutableString stringWithString:[menuItem title]];
for (int j = 0; j <= depth; ++j)
[title insertString:@" " atIndex: 0];
[aPopup addItemWithTitle: title];
NSMenuItem* lastItem = [aPopup lastItem];
if ([menuItem tag] == aTagToMatch)
[aPopup selectItem: lastItem];
[lastItem setTag: [menuItem tag]];
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch);
RecursiveAddBookmarkConstruct(aPopup, submenu, aTagToMatch, depth+1);
}
}
}