small change to the way you get selection

This commit is contained in:
mjudge%netscape.com 2000-04-28 06:22:07 +00:00
Родитель 6e453761da
Коммит 19d29307eb
4 изменённых файлов: 13 добавлений и 9 удалений

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

@ -1748,7 +1748,7 @@ nsXULDocument::SelectAll()
startPnt->SetPoint(start, -1, PR_TRUE); startPnt->SetPoint(start, -1, PR_TRUE);
endPnt->SetPoint(end, -1, PR_FALSE); endPnt->SetPoint(end, -1, PR_FALSE);
#endif #endif
SetDisplaySelection(nsIDocument::SELECTION_ON); SetDisplaySelection(nsISelectionController::SELECTION_ON);
return NS_OK; return NS_OK;
} }

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

@ -1748,7 +1748,7 @@ nsXULDocument::SelectAll()
startPnt->SetPoint(start, -1, PR_TRUE); startPnt->SetPoint(start, -1, PR_TRUE);
endPnt->SetPoint(end, -1, PR_FALSE); endPnt->SetPoint(end, -1, PR_FALSE);
#endif #endif
SetDisplaySelection(nsIDocument::SELECTION_ON); SetDisplaySelection(nsISelectionController::SELECTION_ON);
return NS_OK; return NS_OK;
} }

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

@ -3352,11 +3352,12 @@ nsBrowserWindow::DoToggleSelection()
{ {
nsIPresShell* shell = GetPresShell(); nsIPresShell* shell = GetPresShell();
if (nsnull != shell) { if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsISelectionController> selCon;
shell->GetDocument(getter_AddRefs(doc)); selCon = do_QueryInterface(shell);
if (doc) { if (selCon) {
PRInt8 current = doc->GetDisplaySelection(); PRInt16 current;
doc->SetDisplaySelection(!current); selCon->GetDisplaySelection(&current);
selCon->SetDisplaySelection(!current);
ForceRefresh(); ForceRefresh();
} }
NS_RELEASE(shell); NS_RELEASE(shell);

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

@ -37,6 +37,8 @@
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "resources.h" #include "resources.h"
#include "nsISelectionController.h"
#include "nsIPresShell.h"
static nsIEditor *gEditor; static nsIEditor *gEditor;
@ -81,8 +83,9 @@ nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPresShel
if (!gEditor) { if (!gEditor) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
nsCOMPtr<nsISelectionController> selCon;
result = gEditor->Init(aDOMDocument, aPresShell, 0); selCon = do_QueryInterface(aPresShell);
result = gEditor->Init(aDOMDocument, aPresShell, selCon, 0);
if (NS_SUCCEEDED(result)) if (NS_SUCCEEDED(result))
result = gEditor->PostCreate(); result = gEditor->PostCreate();
return result; return result;