fix win32 compiler errors (can't do (nsnull != foop) where foop is a nsCOMPtr, which is fine by me) and fix command hookup code to actually work for multiple toolbars. I dunno what I was smoking with the last checkin.

This commit is contained in:
pinkerton%netscape.com 1999-01-28 02:26:27 +00:00
Родитель 160af16727
Коммит f7c2c5bb3c
1 изменённых файлов: 52 добавлений и 52 удалений

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

@ -422,10 +422,10 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD
// load up commands // load up commands
int endCount = 0; int endCount = 0;
nsCOMPtr<nsIDOMNode> parentCmd ( dont_AddRef(FindNamedDOMNode(nsAutoString("commands"), window, endCount, 1)) ); nsCOMPtr<nsIDOMNode> parentCmd ( dont_AddRef(FindNamedDOMNode(nsAutoString("commands"), window, endCount, 1)) );
if (nsnull != parentCmd) { if ( parentCmd ) {
nsCOMPtr<nsIDOMNode> node; nsCOMPtr<nsIDOMNode> node;
parentCmd->GetFirstChild(getter_AddRefs(node)); parentCmd->GetFirstChild(getter_AddRefs(node));
while (nsnull != node) { while ( node ) {
nsString value; nsString value;
nsString nodeType; nsString nodeType;
nsString name; nsString name;
@ -455,15 +455,14 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD
} }
// Now install the commands onto the Toolbar GUI Nodes for each toolbar in the toolbox // Now install the commands onto the Toolbar GUI Nodes for each toolbar in the toolbox
PRUint32 count = 1; int count = 1;
nsCOMPtr<nsIDOMNode> toolbar; endCount = 0;
do { nsCOMPtr<nsIDOMNode> toolbar ( dont_AddRef(FindNamedDOMNode(nsAutoString("toolbar"), window, endCount, count)) );
toolbar = dont_AddRef(FindNamedDOMNode(nsAutoString("toolbar"), window, endCount, count)); while ( toolbar ) {
if (nsnull != toolbar) {
nsAutoString cmdAtom("cmd"); nsAutoString cmdAtom("cmd");
nsCOMPtr<nsIDOMNode> node; nsCOMPtr<nsIDOMNode> node;
toolbar->GetFirstChild(getter_AddRefs(node)); toolbar->GetFirstChild(getter_AddRefs(node));
while (nsnull != node) { while ( node ) {
nsAutoString value; nsAutoString value;
nsString nodeCmd; nsString nodeCmd;
nsCOMPtr<nsIDOMElement> element ( node ); nsCOMPtr<nsIDOMElement> element ( node );
@ -502,11 +501,12 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD
oldNode->GetNextSibling(getter_AddRefs(node)); oldNode->GetNextSibling(getter_AddRefs(node));
} }
} // find the next toolbar
endCount = 0;
toolbar = dont_AddRef(FindNamedDOMNode(nsAutoString("toolbar"), window, endCount, count));
++count; ++count;
} while ( toolbar ) ; } // for each toolbar
/*PRInt32 i, n = mCommands.Count(); /*PRInt32 i, n = mCommands.Count();
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -529,7 +529,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
nsresult rv; nsresult rv;
int endCount = 0; int endCount = 0;
nsCOMPtr<nsIDOMNode> menubarNode ( dont_AddRef(FindNamedDOMNode(nsAutoString("menubar"), window, endCount, 1)) ); nsCOMPtr<nsIDOMNode> menubarNode ( dont_AddRef(FindNamedDOMNode(nsAutoString("menubar"), window, endCount, 1)) );
if (nsnull != menubarNode) { if (menubarNode) {
nsIMenuBar * pnsMenuBar = nsnull; nsIMenuBar * pnsMenuBar = nsnull;
rv = nsRepository::CreateInstance(kMenuBarCID, nsnull, kIMenuBarIID, rv = nsRepository::CreateInstance(kMenuBarCID, nsnull, kIMenuBarIID,
(void**)&pnsMenuBar); (void**)&pnsMenuBar);