now hookup commands to multiple toolbars and fix compiler warnings.
git-svn-id: svn://10.0.0.236/trunk@18871 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
dd74f3be20
commit
e86bfb00bf
@ -420,7 +420,7 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD
|
||||
return;
|
||||
|
||||
// load up commands
|
||||
PRUint32 endCount = 0;
|
||||
int endCount = 0;
|
||||
nsCOMPtr<nsIDOMNode> parentCmd ( dont_AddRef(FindNamedDOMNode(nsAutoString("commands"), window, endCount, 1)) );
|
||||
if (nsnull != parentCmd) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
@ -454,53 +454,60 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD
|
||||
}
|
||||
}
|
||||
|
||||
// Now install the commands onto the Toolbar GUI Nodes
|
||||
nsCOMPtr<nsIDOMNode> toolbar ( dont_AddRef(FindNamedDOMNode(nsAutoString("toolbar"), window, endCount, 1)) );
|
||||
if (nsnull != toolbar) {
|
||||
nsAutoString cmdAtom("cmd");
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
toolbar->GetFirstChild(getter_AddRefs(node));
|
||||
while (nsnull != node) {
|
||||
nsAutoString value;
|
||||
nsString nodeCmd;
|
||||
nsCOMPtr<nsIDOMElement> element ( node );
|
||||
if ( element ) {
|
||||
nsString name;
|
||||
element->GetNodeName(name);
|
||||
if (name.Equals(nsAutoString("BUTTON"))) {
|
||||
element->GetAttribute(cmdAtom, nodeCmd);
|
||||
PRInt32 i, n = mCommands.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIXULCommand* cmd = (nsIXULCommand*) mCommands.ElementAt(i);
|
||||
nsAutoString cmdName;
|
||||
cmd->GetName(cmdName);
|
||||
//printf("Cmd [%s] Node[%s]\n", cmdName.ToNewCString(), nodeCmd.ToNewCString());
|
||||
if (nodeCmd.Equals(cmdName)) {
|
||||
printf("Linking up cmd to button [%s]\n", cmdName.ToNewCString());
|
||||
cmd->AddUINode(node);
|
||||
}
|
||||
}
|
||||
} else if (name.Equals(nsAutoString("INPUT"))) {
|
||||
nsXULCommand * xulCmd = new nsXULCommand();
|
||||
xulCmd->SetName(name);
|
||||
xulCmd->SetCommand(value);
|
||||
xulCmd->SetWebShell(aWebShell);
|
||||
xulCmd->SetDOMElement(element);
|
||||
nsIXULCommand * icmd;
|
||||
if (NS_OK == xulCmd->QueryInterface(kIXULCommandIID, (void**) &icmd)) {
|
||||
mCommands.AppendElement(icmd);
|
||||
}
|
||||
xulCmd->AddUINode(node);
|
||||
//printf("Linking up cmd to button [%s]\n", cmdName.ToNewCString());
|
||||
}
|
||||
}
|
||||
// Now install the commands onto the Toolbar GUI Nodes for each toolbar in the toolbox
|
||||
PRUint32 count = 1;
|
||||
nsCOMPtr<nsIDOMNode> toolbar;
|
||||
do {
|
||||
toolbar = dont_AddRef(FindNamedDOMNode(nsAutoString("toolbar"), window, endCount, count));
|
||||
if (nsnull != toolbar) {
|
||||
nsAutoString cmdAtom("cmd");
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
toolbar->GetFirstChild(getter_AddRefs(node));
|
||||
while (nsnull != node) {
|
||||
nsAutoString value;
|
||||
nsString nodeCmd;
|
||||
nsCOMPtr<nsIDOMElement> element ( node );
|
||||
if ( element ) {
|
||||
nsString name;
|
||||
element->GetNodeName(name);
|
||||
if (name.Equals(nsAutoString("BUTTON"))) {
|
||||
element->GetAttribute(cmdAtom, nodeCmd);
|
||||
PRInt32 i, n = mCommands.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIXULCommand* cmd = (nsIXULCommand*) mCommands.ElementAt(i);
|
||||
nsAutoString cmdName;
|
||||
cmd->GetName(cmdName);
|
||||
//printf("Cmd [%s] Node[%s]\n", cmdName.ToNewCString(), nodeCmd.ToNewCString());
|
||||
if (nodeCmd.Equals(cmdName)) {
|
||||
printf("Linking up cmd to button [%s]\n", cmdName.ToNewCString());
|
||||
cmd->AddUINode(node);
|
||||
}
|
||||
}
|
||||
} else if (name.Equals(nsAutoString("INPUT"))) {
|
||||
nsXULCommand * xulCmd = new nsXULCommand();
|
||||
xulCmd->SetName(name);
|
||||
xulCmd->SetCommand(value);
|
||||
xulCmd->SetWebShell(aWebShell);
|
||||
xulCmd->SetDOMElement(element);
|
||||
nsIXULCommand * icmd;
|
||||
if (NS_OK == xulCmd->QueryInterface(kIXULCommandIID, (void**) &icmd)) {
|
||||
mCommands.AppendElement(icmd);
|
||||
}
|
||||
xulCmd->AddUINode(node);
|
||||
//printf("Linking up cmd to button [%s]\n", cmdName.ToNewCString());
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> oldNode ( node );
|
||||
oldNode->GetNextSibling(getter_AddRefs(node));
|
||||
}
|
||||
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> oldNode ( node );
|
||||
oldNode->GetNextSibling(getter_AddRefs(node));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
++count;
|
||||
|
||||
} while ( toolbar ) ;
|
||||
|
||||
/*PRInt32 i, n = mCommands.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
nsIXULCommand* cmd = (nsIXULCommand*) mCommands.ElementAt(i);
|
||||
@ -520,7 +527,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
|
||||
return;
|
||||
|
||||
nsresult rv;
|
||||
PRUint32 endCount = 0;
|
||||
int endCount = 0;
|
||||
nsCOMPtr<nsIDOMNode> menubarNode ( dont_AddRef(FindNamedDOMNode(nsAutoString("menubar"), window, endCount, 1)) );
|
||||
if (nsnull != menubarNode) {
|
||||
nsIMenuBar * pnsMenuBar = nsnull;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user