зеркало из https://github.com/mozilla/gecko-dev.git
Bug 120189 - fix selection crash with xbl select widget. Move content node updating to the XBL event handlers. r=varga, sr=jag.
This commit is contained in:
Родитель
802df48be3
Коммит
fd7cdd1838
|
@ -117,7 +117,8 @@ interface nsISelectElement : nsISupports
|
|||
in long aEndIndex,
|
||||
in boolean aIsSelected,
|
||||
in boolean aClearAll,
|
||||
in boolean aSetDisabled);
|
||||
in boolean aSetDisabled,
|
||||
in boolean aNotify);
|
||||
|
||||
/**
|
||||
* Called when an option is disabled
|
||||
|
|
|
@ -183,29 +183,7 @@ public:
|
|||
nsString* aNames);
|
||||
|
||||
// nsISelectElement
|
||||
NS_IMETHOD WillAddOptions(nsIContent* aOptions,
|
||||
nsIContent* aParent,
|
||||
PRInt32 aContentIndex);
|
||||
NS_IMETHOD WillRemoveOptions(nsIContent* aParent,
|
||||
PRInt32 aContentIndex);
|
||||
NS_IMETHOD AddOption(nsIContent* aContent);
|
||||
NS_IMETHOD RemoveOption(nsIContent* aContent);
|
||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
||||
NS_IMETHOD IsDoneAddingContent(PRBool * aIsDone);
|
||||
NS_IMETHOD IsOptionSelected(nsIDOMHTMLOptionElement* anOption,
|
||||
PRBool * aIsSelected);
|
||||
NS_IMETHOD SetOptionSelected(nsIDOMHTMLOptionElement* anOption,
|
||||
PRBool aIsSelected);
|
||||
NS_IMETHOD SetOptionsSelectedByIndex(PRInt32 aStartIndex,
|
||||
PRInt32 aEndIndex,
|
||||
PRBool aIsSelected,
|
||||
PRBool aClearAll,
|
||||
PRBool aSetDisabled,
|
||||
PRBool* aChangedSomething);
|
||||
NS_IMETHOD IsOptionDisabled(PRInt32 aIndex, PRBool* aIsDisabled);
|
||||
NS_IMETHOD OnOptionDisabled(nsIDOMHTMLOptionElement* anOption);
|
||||
NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsIPresState** aState);
|
||||
NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsIPresState* aState);
|
||||
NS_DECL_NSISELECTELEMENT
|
||||
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAReadableString& aValue,
|
||||
|
@ -226,7 +204,8 @@ protected:
|
|||
nsresult OnOptionSelected(nsISelectControlFrame* aSelectFrame,
|
||||
nsIPresContext* aPresContext,
|
||||
PRInt32 aIndex,
|
||||
PRBool aSelected);
|
||||
PRBool aSelected,
|
||||
PRBool aNotify);
|
||||
nsresult InitializeOption(nsIDOMHTMLOptionElement* aOption,
|
||||
PRUint32* aNumOptions);
|
||||
nsresult RestoreStateTo(nsAString* aNewSelected);
|
||||
|
@ -479,13 +458,13 @@ nsHTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
|
|||
PRBool isMultiple;
|
||||
GetMultiple(&isMultiple);
|
||||
if (!isMultiple) {
|
||||
SetOptionsSelectedByIndex(i, i, PR_TRUE, PR_TRUE, PR_TRUE, nsnull);
|
||||
SetOptionsSelectedByIndex(i, i, PR_TRUE, PR_TRUE, PR_TRUE, PR_TRUE, nsnull);
|
||||
}
|
||||
|
||||
// This is sort of a hack ... we need to notify that the option was
|
||||
// set and change selectedIndex even though we didn't really change
|
||||
// its value.
|
||||
OnOptionSelected(selectFrame, presContext, i, PR_TRUE);
|
||||
OnOptionSelected(selectFrame, presContext, i, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -978,7 +957,7 @@ NS_IMETHODIMP
|
|||
nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelectedByIndex(aIndex, aIndex, PR_TRUE,
|
||||
PR_FALSE, PR_TRUE, nsnull);
|
||||
PR_FALSE, PR_TRUE, PR_TRUE, nsnull);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1049,7 +1028,8 @@ nsresult
|
|||
nsHTMLSelectElement::OnOptionSelected(nsISelectControlFrame* aSelectFrame,
|
||||
nsIPresContext* aPresContext,
|
||||
PRInt32 aIndex,
|
||||
PRBool aSelected)
|
||||
PRBool aSelected,
|
||||
PRBool aNotify)
|
||||
{
|
||||
//printf("OnOptionSelected(%d = '%c')\n", aIndex, (aSelected ? 'Y' : 'N'));
|
||||
// Set the selected index
|
||||
|
@ -1064,7 +1044,7 @@ nsHTMLSelectElement::OnOptionSelected(nsISelectControlFrame* aSelectFrame,
|
|||
Item(aIndex, getter_AddRefs(option));
|
||||
if (option) {
|
||||
nsCOMPtr<nsIOptionElement> optionElement(do_QueryInterface(option));
|
||||
optionElement->SetSelectedInternal(aSelected, PR_TRUE);
|
||||
optionElement->SetSelectedInternal(aSelected, aNotify);
|
||||
}
|
||||
|
||||
// Let the frame know too
|
||||
|
@ -1105,7 +1085,7 @@ nsHTMLSelectElement::SetOptionSelected(nsIDOMHTMLOptionElement* anOption,
|
|||
}
|
||||
|
||||
return SetOptionsSelectedByIndex(index, index, aIsSelected,
|
||||
PR_FALSE, PR_TRUE, nsnull);
|
||||
PR_FALSE, PR_TRUE, PR_TRUE, nsnull);
|
||||
}
|
||||
|
||||
// XXX Consider splitting this into two functions for ease of reading:
|
||||
|
@ -1133,6 +1113,7 @@ nsHTMLSelectElement::SetOptionsSelectedByIndex(PRInt32 aStartIndex,
|
|||
PRBool aIsSelected,
|
||||
PRBool aClearAll,
|
||||
PRBool aSetDisabled,
|
||||
PRBool aNotify,
|
||||
PRBool* aChangedSomething)
|
||||
{
|
||||
#if 0
|
||||
|
@ -1239,7 +1220,7 @@ nsHTMLSelectElement::SetOptionsSelectedByIndex(PRInt32 aStartIndex,
|
|||
|
||||
did_get_frame = PR_TRUE;
|
||||
|
||||
OnOptionSelected(selectFrame, presContext, optIndex, PR_TRUE);
|
||||
OnOptionSelected(selectFrame, presContext, optIndex, PR_TRUE, aNotify);
|
||||
optionsSelected = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1272,7 +1253,7 @@ nsHTMLSelectElement::SetOptionsSelectedByIndex(PRInt32 aStartIndex,
|
|||
did_get_frame = PR_TRUE;
|
||||
}
|
||||
|
||||
OnOptionSelected(selectFrame, presContext, optIndex, PR_FALSE);
|
||||
OnOptionSelected(selectFrame, presContext, optIndex, PR_FALSE, aNotify);
|
||||
optionsDeselected = PR_TRUE;
|
||||
|
||||
// Only need to deselect one option if not multiple
|
||||
|
@ -1314,7 +1295,7 @@ nsHTMLSelectElement::SetOptionsSelectedByIndex(PRInt32 aStartIndex,
|
|||
did_get_frame = PR_TRUE;
|
||||
}
|
||||
|
||||
OnOptionSelected(selectFrame, presContext, optIndex, PR_FALSE);
|
||||
OnOptionSelected(selectFrame, presContext, optIndex, PR_FALSE, aNotify);
|
||||
optionsDeselected = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1915,7 +1896,7 @@ nsHTMLSelectElement::RestoreStateTo(nsAString* aNewSelected)
|
|||
GetLength(&len);
|
||||
|
||||
// First clear all
|
||||
SetOptionsSelectedByIndex(-1, -1, PR_TRUE, PR_TRUE, PR_TRUE, nsnull);
|
||||
SetOptionsSelectedByIndex(-1, -1, PR_TRUE, PR_TRUE, PR_TRUE, PR_TRUE, nsnull);
|
||||
|
||||
// Next set the proper ones
|
||||
PRUint32 currentInd = 0;
|
||||
|
@ -1927,7 +1908,7 @@ nsHTMLSelectElement::RestoreStateTo(nsAString* aNewSelected)
|
|||
nsDependentSubstring s = Substring(*aNewSelected,
|
||||
currentInd, (nextInd-currentInd));
|
||||
PRInt32 i = atoi(NS_ConvertUCS2toUTF8(s).get());
|
||||
SetOptionsSelectedByIndex(i, i, PR_TRUE, PR_FALSE, PR_TRUE, nsnull);
|
||||
SetOptionsSelectedByIndex(i, i, PR_TRUE, PR_FALSE, PR_TRUE, PR_TRUE, nsnull);
|
||||
currentInd = (PRUint32)nextInd+1;
|
||||
}
|
||||
|
||||
|
|
|
@ -2043,6 +2043,7 @@ nsListControlFrame::SetOptionsSelectedFromFrame(PRInt32 aStartIndex,
|
|||
aValue,
|
||||
aClearAll,
|
||||
PR_FALSE,
|
||||
PR_TRUE,
|
||||
&wasChanged);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetSelected failed");
|
||||
if (NS_SUCCEEDED(rv) && !mChangesNotNotified && wasChanged) {
|
||||
|
@ -2077,6 +2078,7 @@ nsListControlFrame::ToggleOptionSelectedFromFrame(PRInt32 aIndex)
|
|||
!value,
|
||||
PR_FALSE,
|
||||
PR_FALSE,
|
||||
PR_TRUE,
|
||||
&wasChanged);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetSelected failed");
|
||||
|
|
|
@ -55,8 +55,10 @@
|
|||
var row = {};
|
||||
var col = {};
|
||||
var obj = {};
|
||||
var b = this.parentNode.parentNode.parentNode.outlinerBoxObject;
|
||||
b.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
var select = this.parentNode.parentNode.parentNode;
|
||||
var box = select.outlinerBoxObject;
|
||||
var selection = box.selection;
|
||||
box.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
|
||||
// save off the last selected row
|
||||
this._lastSelectedRow = row.value;
|
||||
|
@ -64,8 +66,10 @@
|
|||
if (row.value == -1)
|
||||
return;
|
||||
|
||||
if (!b.selection.isSelected(row.value)) {
|
||||
b.selection.select(row.value);
|
||||
if (!selection.isSelected(row.value)) {
|
||||
selection.select(row.value);
|
||||
select.selectElement.setOptionsSelectedByIndex(row.value, row.value,
|
||||
true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
}
|
||||
|
@ -81,18 +85,28 @@
|
|||
var row = {};
|
||||
var col = {};
|
||||
var obj = {};
|
||||
var b = this.parentNode.parentNode.parentNode.outlinerBoxObject;
|
||||
b.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
var select = this.parentNode.parentNode.parentNode;
|
||||
var box = select.outlinerBoxObject;
|
||||
select = select.selectElement;
|
||||
var selection = box.selection;
|
||||
box.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
|
||||
if (row.value == -1)
|
||||
return;
|
||||
|
||||
var augment = event.ctrlKey || event.metaKey;
|
||||
if (event.shiftKey)
|
||||
b.selection.rangedSelect(-1, row.value, augment);
|
||||
if (event.shiftKey) {
|
||||
selection.rangedSelect(-1, row.value, augment);
|
||||
var start = selection.shiftSelectPivot;
|
||||
if (start == -1)
|
||||
start = selection.currentIndex;
|
||||
select.setOptionsSelectedByIndex(start, row.value, true, !augment, false, false);
|
||||
}
|
||||
else if (augment) {
|
||||
b.selection.toggleSelect(row.value);
|
||||
b.selection.currentIndex = row.value;
|
||||
selection.toggleSelect(row.value);
|
||||
select.setOptionsSelectedByIndex(row.value, row.value,
|
||||
!selection.isSelected(row.value), false, false, false);
|
||||
selection.currentIndex = row.value;
|
||||
}
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
|
@ -106,7 +120,9 @@
|
|||
// mousedown and the time we click, don't fire the select handler.
|
||||
// see bug #92366
|
||||
if (this._lastSelectedRow == row.value) {
|
||||
b.selection.select(row.value);
|
||||
selection.select(row.value);
|
||||
select.setOptionsSelectedByIndex(row.value, row.value,
|
||||
true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
}
|
||||
|
@ -134,8 +150,11 @@
|
|||
|
||||
<implementation>
|
||||
<property name="outlinerBoxObject"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);"
|
||||
readonly="true"/>
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);"
|
||||
readonly="true"/>
|
||||
<property name="selectElement"
|
||||
onget="return this.QueryInterface(Components.interfaces.nsISelectElement);"
|
||||
readonly="true"/>
|
||||
<property name="currentIndex"
|
||||
onget="return this.outlinerBoxObject.selection.currentIndex;"
|
||||
onset="return this.outlinerBoxObject.selection.currentIndex=val;"/>
|
||||
|
@ -164,6 +183,7 @@
|
|||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(c-1, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c-1);
|
||||
this.selectElement.setOptionsSelectedByIndex(c-1, c-1, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -179,6 +199,7 @@
|
|||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(c+1, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c+1);
|
||||
this.selectElement.setOptionsSelectedByIndex(c+1, c+1, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -191,19 +212,25 @@
|
|||
var c = this.currentIndex;
|
||||
if (c == -1 || c == 0)
|
||||
return;
|
||||
var selection = this.outlinerBoxObject.selection;
|
||||
var select = this.selectElement;
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead < this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c);
|
||||
selection.toggleSelect(c);
|
||||
select.setOptionsSelectedByIndex(c, c, selection.isSelected(c),
|
||||
false, false, false);
|
||||
this.currentIndex = c - 1;
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c - 1);
|
||||
selection.toggleSelect(c - 1);
|
||||
select.setOptionsSelectedByIndex(c, c, true, false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, c - 1, true);
|
||||
selection.rangedSelect(c, c - 1, true);
|
||||
select.setOptionsSelectedByIndex(c, c-1, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = c - 1;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c - 1);
|
||||
|
@ -220,18 +247,24 @@
|
|||
try { if (c+1 == this.outlinerBoxObject.view.rowCount)
|
||||
return;
|
||||
} catch (e) {}
|
||||
var selection = this.outlinerBoxObject.selection;
|
||||
var select = this.selectElement;
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead > this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c);
|
||||
selection.toggleSelect(c);
|
||||
select.setOptionsSelectedByIndex(c, c, !selection.isSelected(c), false, false, false);
|
||||
this.currentIndex = c + 1;
|
||||
}
|
||||
else
|
||||
this.outlinerBoxObject.selection.toggleSelect(c + 1);
|
||||
else {
|
||||
selection.toggleSelect(c + 1);
|
||||
select.setOptionsSelectedByIndex(c+1, c+1, !selection.isSelected(c), false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, c + 1, true);
|
||||
selection.rangedSelect(c, c + 1, true);
|
||||
select.setOptionsSelectedByIndex(c, c+1, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = c + 1;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c + 1);
|
||||
|
@ -279,6 +312,7 @@
|
|||
this.outlinerBoxObject.scrollByPages(-1);
|
||||
}
|
||||
this.outlinerBoxObject.selection.timedSelect(i, 500);
|
||||
this.selectElement.setOptionsSelectedByIndex(i, i, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -304,6 +338,7 @@
|
|||
this.outlinerBoxObject.scrollByPages(1);
|
||||
}
|
||||
this.outlinerBoxObject.selection.timedSelect(i, 500);
|
||||
this.selectElement.setOptionsSelectdByIndex(i, i, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -316,34 +351,43 @@
|
|||
var c = this.currentIndex;
|
||||
if (c == 0)
|
||||
return;
|
||||
var f = this.outlinerBoxObject.getFirstVisibleRow();
|
||||
var box = this.outlinerBoxObject;
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
var f = box.getFirstVisibleRow();
|
||||
var i = 0;
|
||||
if (f > 0) {
|
||||
var p = this.outlinerBoxObject.getPageCount();
|
||||
var p = box.getPageCount();
|
||||
if (f - p >= 0)
|
||||
i = c - p;
|
||||
else
|
||||
i = c - f;
|
||||
this.outlinerBoxObject.scrollByPages(-1);
|
||||
box.scrollByPages(-1);
|
||||
}
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead < this.selectionTail) {
|
||||
if (i < this.selectionHead) {
|
||||
this.outlinerBoxObject.selection.clearRange(c, this.selectionHead + 1);
|
||||
this.outlinerBoxObject.selection.rangedSelect(this.selectionHead - 1, i, true);
|
||||
selection.clearRange(c, this.selectionHead + 1);
|
||||
selection.rangedSelect(this.selectionHead - 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c, this.selectionHead + 1, false, false, false, false);
|
||||
select.setOptionsSelectedByIndex(this.selectionHead - 1, i, true, false, false, false);
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearRange(c, i + 1);
|
||||
selection.clearRange(c, i + 1);
|
||||
select.setOptionsSelectedByIndex(c, i+1, false, false, false, false);
|
||||
this.currentIndex = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
this.outlinerBoxObject.selection.rangedSelect(c - 1, i, true);
|
||||
else {
|
||||
selection.rangedSelect(c - 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c-1, i, true, false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, i, true);
|
||||
selection.rangedSelect(c, i, true);
|
||||
select.setOptionsSelectedByIndex(c, i, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = i;
|
||||
if ("onchange" in this)
|
||||
|
@ -356,11 +400,12 @@
|
|||
if (this.singleSelection)
|
||||
return;
|
||||
var c = this.currentIndex;
|
||||
var l = this.outlinerBoxObject.view.rowCount - 1;
|
||||
var box = this.outlinerBoxObject;
|
||||
var l = box.view.rowCount - 1;
|
||||
if (c == l)
|
||||
return;
|
||||
var f = this.outlinerBoxObject.getFirstVisibleRow();
|
||||
var p = this.outlinerBoxObject.getPageCount();
|
||||
var f = box.getFirstVisibleRow();
|
||||
var p = box.getPageCount();
|
||||
var i = l;
|
||||
var lastTopRowIndex = l - p;
|
||||
if (f <= lastTopRowIndex) {
|
||||
|
@ -368,26 +413,34 @@
|
|||
i = c + p;
|
||||
else
|
||||
i = lastTopRowIndex + c - f + 1;
|
||||
this.outlinerBoxObject.scrollByPages(1);
|
||||
box.scrollByPages(1);
|
||||
}
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead > this.selectionTail) {
|
||||
if (i > this.selectionHead) {
|
||||
this.outlinerBoxObject.selection.clearRange(c, this.selectionHead - 1);
|
||||
this.outlinerBoxObject.selection.rangedSelect(this.selectionHead + 1, i, true);
|
||||
selection.clearRange(c, this.selectionHead - 1);
|
||||
selection.rangedSelect(this.selectionHead + 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c, this.selectionHead - 1, false, false, false, false);
|
||||
select.setOptionsSelectedByIndex(this.selectionHead + 1, i, true, false, false, false);
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearRange(c, i - 1);
|
||||
selection.clearRange(c, i - 1);
|
||||
select.setOptionsSelectedByIndex(c, i-1, false, false, false, false);
|
||||
this.currentIndex = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
this.outlinerBoxObject.selection.rangedSelect(c + 1, i, true);
|
||||
else {
|
||||
selection.rangedSelect(c + 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c+1, i, true, false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, i, true);
|
||||
selection.rangedSelect(c, i, true);
|
||||
select.setOptionsSelectedByIndex(c, i, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = i;
|
||||
if ("onchange" in this)
|
||||
|
@ -441,8 +494,10 @@
|
|||
return;
|
||||
this.selectionHead = -1;
|
||||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(0, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(0);
|
||||
var box = this.outlinerBoxObject;
|
||||
box.selection.timedSelect(0, 500);
|
||||
this.selectElement.setOptionsSelectedByIndex(0, 0, true, true, false, false);
|
||||
box.ensureRowIsVisible(0);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -450,13 +505,15 @@
|
|||
<handler event="keypress" keycode="vk_end">
|
||||
<![CDATA[
|
||||
event.preventDefault();
|
||||
var l = this.outlinerBoxObject.view.rowCount - 1;
|
||||
var box = this.outlinerBoxObject;
|
||||
var l = box.view.rowCount - 1;
|
||||
if (this.currentIndex == l)
|
||||
return;
|
||||
this.selectionHead = -1;
|
||||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(l, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(l);
|
||||
box.selection.timedSelect(l, 500);
|
||||
this.selectElement.setOptionsSelectedByIndex(l, l, true, true, false, false);
|
||||
box.ensureRowIsVisible(l);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -469,13 +526,18 @@
|
|||
var c = this.currentIndex;
|
||||
if (c == 0)
|
||||
return;
|
||||
var box = this.outlinerBoxObject;
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
if (c != this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
select.setOptionsSelectedByIndex(-1, -1, true, true, false, false);
|
||||
this.selectionHead = c;
|
||||
}
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, 0, true);
|
||||
selection.rangedSelect(c, 0, true);
|
||||
select.setOptionsSelectedByIndex(c, 0, true, false, false, false);
|
||||
this.selectionTail = 0;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(0);
|
||||
box.ensureRowIsVisible(0);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -486,16 +548,21 @@
|
|||
if (this.singleSelection)
|
||||
return;
|
||||
var c = this.currentIndex;
|
||||
var l = this.outlinerBoxObject.view.rowCount - 1;
|
||||
var box = this.outlinerBoxObject;
|
||||
var l = box.view.rowCount - 1;
|
||||
if (c == l)
|
||||
return;
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
if (c != this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
select.setOptionsSelectedByIndex(-1, -1, true, true, false, false);
|
||||
this.selectionHead = c;
|
||||
}
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, l, true);
|
||||
selection.rangedSelect(c, l, true);
|
||||
select.setOptionsSelectedByIndex(c, l, true, false, false, false);
|
||||
this.selectionTail = l;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(l);
|
||||
box.ensureRowIsVisible(l);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -524,8 +591,10 @@
|
|||
event.preventDefault();
|
||||
if (event.keyCode == ' ') {
|
||||
var c = this.currentIndex;
|
||||
if (!this.outlinerBoxObject.selection.isSelected(c)) {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c);
|
||||
var selection = this.outlinerBoxObject.selection;
|
||||
if (!selection.isSelected(c)) {
|
||||
selection.toggleSelect(c);
|
||||
this.selectElement.setOptionsSelectedByIndex(c, c, true, false, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
}
|
||||
|
@ -611,7 +680,7 @@
|
|||
return;
|
||||
|
||||
this.selectElement.setOptionsSelectedByIndex(itemIndex, itemIndex, true,
|
||||
true, false);
|
||||
true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
|
|
@ -55,8 +55,10 @@
|
|||
var row = {};
|
||||
var col = {};
|
||||
var obj = {};
|
||||
var b = this.parentNode.parentNode.parentNode.outlinerBoxObject;
|
||||
b.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
var select = this.parentNode.parentNode.parentNode;
|
||||
var box = select.outlinerBoxObject;
|
||||
var selection = box.selection;
|
||||
box.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
|
||||
// save off the last selected row
|
||||
this._lastSelectedRow = row.value;
|
||||
|
@ -64,8 +66,10 @@
|
|||
if (row.value == -1)
|
||||
return;
|
||||
|
||||
if (!b.selection.isSelected(row.value)) {
|
||||
b.selection.select(row.value);
|
||||
if (!selection.isSelected(row.value)) {
|
||||
selection.select(row.value);
|
||||
select.selectElement.setOptionsSelectedByIndex(row.value, row.value,
|
||||
true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
}
|
||||
|
@ -81,18 +85,28 @@
|
|||
var row = {};
|
||||
var col = {};
|
||||
var obj = {};
|
||||
var b = this.parentNode.parentNode.parentNode.outlinerBoxObject;
|
||||
b.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
var select = this.parentNode.parentNode.parentNode;
|
||||
var box = select.outlinerBoxObject;
|
||||
select = select.selectElement;
|
||||
var selection = box.selection;
|
||||
box.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
|
||||
if (row.value == -1)
|
||||
return;
|
||||
|
||||
var augment = event.ctrlKey || event.metaKey;
|
||||
if (event.shiftKey)
|
||||
b.selection.rangedSelect(-1, row.value, augment);
|
||||
if (event.shiftKey) {
|
||||
selection.rangedSelect(-1, row.value, augment);
|
||||
var start = selection.shiftSelectPivot;
|
||||
if (start == -1)
|
||||
start = selection.currentIndex;
|
||||
select.setOptionsSelectedByIndex(start, row.value, true, !augment, false, false);
|
||||
}
|
||||
else if (augment) {
|
||||
b.selection.toggleSelect(row.value);
|
||||
b.selection.currentIndex = row.value;
|
||||
selection.toggleSelect(row.value);
|
||||
select.setOptionsSelectedByIndex(row.value, row.value,
|
||||
!selection.isSelected(row.value), false, false, false);
|
||||
selection.currentIndex = row.value;
|
||||
}
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
|
@ -106,7 +120,9 @@
|
|||
// mousedown and the time we click, don't fire the select handler.
|
||||
// see bug #92366
|
||||
if (this._lastSelectedRow == row.value) {
|
||||
b.selection.select(row.value);
|
||||
selection.select(row.value);
|
||||
select.setOptionsSelectedByIndex(row.value, row.value,
|
||||
true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
}
|
||||
|
@ -134,8 +150,11 @@
|
|||
|
||||
<implementation>
|
||||
<property name="outlinerBoxObject"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);"
|
||||
readonly="true"/>
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);"
|
||||
readonly="true"/>
|
||||
<property name="selectElement"
|
||||
onget="return this.QueryInterface(Components.interfaces.nsISelectElement);"
|
||||
readonly="true"/>
|
||||
<property name="currentIndex"
|
||||
onget="return this.outlinerBoxObject.selection.currentIndex;"
|
||||
onset="return this.outlinerBoxObject.selection.currentIndex=val;"/>
|
||||
|
@ -164,6 +183,7 @@
|
|||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(c-1, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c-1);
|
||||
this.selectElement.setOptionsSelectedByIndex(c-1, c-1, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -179,6 +199,7 @@
|
|||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(c+1, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c+1);
|
||||
this.selectElement.setOptionsSelectedByIndex(c+1, c+1, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -191,19 +212,25 @@
|
|||
var c = this.currentIndex;
|
||||
if (c == -1 || c == 0)
|
||||
return;
|
||||
var selection = this.outlinerBoxObject.selection;
|
||||
var select = this.selectElement;
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead < this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c);
|
||||
selection.toggleSelect(c);
|
||||
select.setOptionsSelectedByIndex(c, c, selection.isSelected(c),
|
||||
false, false, false);
|
||||
this.currentIndex = c - 1;
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c - 1);
|
||||
selection.toggleSelect(c - 1);
|
||||
select.setOptionsSelectedByIndex(c, c, true, false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, c - 1, true);
|
||||
selection.rangedSelect(c, c - 1, true);
|
||||
select.setOptionsSelectedByIndex(c, c-1, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = c - 1;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c - 1);
|
||||
|
@ -220,18 +247,24 @@
|
|||
try { if (c+1 == this.outlinerBoxObject.view.rowCount)
|
||||
return;
|
||||
} catch (e) {}
|
||||
var selection = this.outlinerBoxObject.selection;
|
||||
var select = this.selectElement;
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead > this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c);
|
||||
selection.toggleSelect(c);
|
||||
select.setOptionsSelectedByIndex(c, c, !selection.isSelected(c), false, false, false);
|
||||
this.currentIndex = c + 1;
|
||||
}
|
||||
else
|
||||
this.outlinerBoxObject.selection.toggleSelect(c + 1);
|
||||
else {
|
||||
selection.toggleSelect(c + 1);
|
||||
select.setOptionsSelectedByIndex(c+1, c+1, !selection.isSelected(c), false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, c + 1, true);
|
||||
selection.rangedSelect(c, c + 1, true);
|
||||
select.setOptionsSelectedByIndex(c, c+1, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = c + 1;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(c + 1);
|
||||
|
@ -279,6 +312,7 @@
|
|||
this.outlinerBoxObject.scrollByPages(-1);
|
||||
}
|
||||
this.outlinerBoxObject.selection.timedSelect(i, 500);
|
||||
this.selectElement.setOptionsSelectedByIndex(i, i, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -304,6 +338,7 @@
|
|||
this.outlinerBoxObject.scrollByPages(1);
|
||||
}
|
||||
this.outlinerBoxObject.selection.timedSelect(i, 500);
|
||||
this.selectElement.setOptionsSelectdByIndex(i, i, true, true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -316,34 +351,43 @@
|
|||
var c = this.currentIndex;
|
||||
if (c == 0)
|
||||
return;
|
||||
var f = this.outlinerBoxObject.getFirstVisibleRow();
|
||||
var box = this.outlinerBoxObject;
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
var f = box.getFirstVisibleRow();
|
||||
var i = 0;
|
||||
if (f > 0) {
|
||||
var p = this.outlinerBoxObject.getPageCount();
|
||||
var p = box.getPageCount();
|
||||
if (f - p >= 0)
|
||||
i = c - p;
|
||||
else
|
||||
i = c - f;
|
||||
this.outlinerBoxObject.scrollByPages(-1);
|
||||
box.scrollByPages(-1);
|
||||
}
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead < this.selectionTail) {
|
||||
if (i < this.selectionHead) {
|
||||
this.outlinerBoxObject.selection.clearRange(c, this.selectionHead + 1);
|
||||
this.outlinerBoxObject.selection.rangedSelect(this.selectionHead - 1, i, true);
|
||||
selection.clearRange(c, this.selectionHead + 1);
|
||||
selection.rangedSelect(this.selectionHead - 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c, this.selectionHead + 1, false, false, false, false);
|
||||
select.setOptionsSelectedByIndex(this.selectionHead - 1, i, true, false, false, false);
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearRange(c, i + 1);
|
||||
selection.clearRange(c, i + 1);
|
||||
select.setOptionsSelectedByIndex(c, i+1, false, false, false, false);
|
||||
this.currentIndex = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
this.outlinerBoxObject.selection.rangedSelect(c - 1, i, true);
|
||||
else {
|
||||
selection.rangedSelect(c - 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c-1, i, true, false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, i, true);
|
||||
selection.rangedSelect(c, i, true);
|
||||
select.setOptionsSelectedByIndex(c, i, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = i;
|
||||
if ("onchange" in this)
|
||||
|
@ -356,11 +400,12 @@
|
|||
if (this.singleSelection)
|
||||
return;
|
||||
var c = this.currentIndex;
|
||||
var l = this.outlinerBoxObject.view.rowCount - 1;
|
||||
var box = this.outlinerBoxObject;
|
||||
var l = box.view.rowCount - 1;
|
||||
if (c == l)
|
||||
return;
|
||||
var f = this.outlinerBoxObject.getFirstVisibleRow();
|
||||
var p = this.outlinerBoxObject.getPageCount();
|
||||
var f = box.getFirstVisibleRow();
|
||||
var p = box.getPageCount();
|
||||
var i = l;
|
||||
var lastTopRowIndex = l - p;
|
||||
if (f <= lastTopRowIndex) {
|
||||
|
@ -368,26 +413,34 @@
|
|||
i = c + p;
|
||||
else
|
||||
i = lastTopRowIndex + c - f + 1;
|
||||
this.outlinerBoxObject.scrollByPages(1);
|
||||
box.scrollByPages(1);
|
||||
}
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
if (c == this.selectionTail) {
|
||||
if (this.selectionHead > this.selectionTail) {
|
||||
if (i > this.selectionHead) {
|
||||
this.outlinerBoxObject.selection.clearRange(c, this.selectionHead - 1);
|
||||
this.outlinerBoxObject.selection.rangedSelect(this.selectionHead + 1, i, true);
|
||||
selection.clearRange(c, this.selectionHead - 1);
|
||||
selection.rangedSelect(this.selectionHead + 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c, this.selectionHead - 1, false, false, false, false);
|
||||
select.setOptionsSelectedByIndex(this.selectionHead + 1, i, true, false, false, false);
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearRange(c, i - 1);
|
||||
selection.clearRange(c, i - 1);
|
||||
select.setOptionsSelectedByIndex(c, i-1, false, false, false, false);
|
||||
this.currentIndex = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
this.outlinerBoxObject.selection.rangedSelect(c + 1, i, true);
|
||||
else {
|
||||
selection.rangedSelect(c + 1, i, true);
|
||||
select.setOptionsSelectedByIndex(c+1, i, true, false, false, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
this.selectionHead = c;
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, i, true);
|
||||
selection.rangedSelect(c, i, true);
|
||||
select.setOptionsSelectedByIndex(c, i, true, true, false, false);
|
||||
}
|
||||
this.selectionTail = i;
|
||||
if ("onchange" in this)
|
||||
|
@ -441,8 +494,10 @@
|
|||
return;
|
||||
this.selectionHead = -1;
|
||||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(0, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(0);
|
||||
var box = this.outlinerBoxObject;
|
||||
box.selection.timedSelect(0, 500);
|
||||
this.selectElement.setOptionsSelectedByIndex(0, 0, true, true, false, false);
|
||||
box.ensureRowIsVisible(0);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -450,13 +505,15 @@
|
|||
<handler event="keypress" keycode="vk_end">
|
||||
<![CDATA[
|
||||
event.preventDefault();
|
||||
var l = this.outlinerBoxObject.view.rowCount - 1;
|
||||
var box = this.outlinerBoxObject;
|
||||
var l = box.view.rowCount - 1;
|
||||
if (this.currentIndex == l)
|
||||
return;
|
||||
this.selectionHead = -1;
|
||||
this.selectionTail = -1;
|
||||
this.outlinerBoxObject.selection.timedSelect(l, 500);
|
||||
this.outlinerBoxObject.ensureRowIsVisible(l);
|
||||
box.selection.timedSelect(l, 500);
|
||||
this.selectElement.setOptionsSelectedByIndex(l, l, true, true, false, false);
|
||||
box.ensureRowIsVisible(l);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -469,13 +526,18 @@
|
|||
var c = this.currentIndex;
|
||||
if (c == 0)
|
||||
return;
|
||||
var box = this.outlinerBoxObject;
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
if (c != this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
select.setOptionsSelectedByIndex(-1, -1, true, true, false, false);
|
||||
this.selectionHead = c;
|
||||
}
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, 0, true);
|
||||
selection.rangedSelect(c, 0, true);
|
||||
select.setOptionsSelectedByIndex(c, 0, true, false, false, false);
|
||||
this.selectionTail = 0;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(0);
|
||||
box.ensureRowIsVisible(0);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -486,16 +548,21 @@
|
|||
if (this.singleSelection)
|
||||
return;
|
||||
var c = this.currentIndex;
|
||||
var l = this.outlinerBoxObject.view.rowCount - 1;
|
||||
var box = this.outlinerBoxObject;
|
||||
var l = box.view.rowCount - 1;
|
||||
if (c == l)
|
||||
return;
|
||||
var selection = box.selection;
|
||||
var select = this.selectElement;
|
||||
if (c != this.selectionTail) {
|
||||
this.outlinerBoxObject.selection.clearSelection();
|
||||
selection.clearSelection();
|
||||
select.setOptionsSelectedByIndex(-1, -1, true, true, false, false);
|
||||
this.selectionHead = c;
|
||||
}
|
||||
this.outlinerBoxObject.selection.rangedSelect(c, l, true);
|
||||
selection.rangedSelect(c, l, true);
|
||||
select.setOptionsSelectedByIndex(c, l, true, false, false, false);
|
||||
this.selectionTail = l;
|
||||
this.outlinerBoxObject.ensureRowIsVisible(l);
|
||||
box.ensureRowIsVisible(l);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
@ -524,8 +591,10 @@
|
|||
event.preventDefault();
|
||||
if (event.keyCode == ' ') {
|
||||
var c = this.currentIndex;
|
||||
if (!this.outlinerBoxObject.selection.isSelected(c)) {
|
||||
this.outlinerBoxObject.selection.toggleSelect(c);
|
||||
var selection = this.outlinerBoxObject.selection;
|
||||
if (!selection.isSelected(c)) {
|
||||
selection.toggleSelect(c);
|
||||
this.selectElement.setOptionsSelectedByIndex(c, c, true, false, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
}
|
||||
|
@ -611,7 +680,7 @@
|
|||
return;
|
||||
|
||||
this.selectElement.setOptionsSelectedByIndex(itemIndex, itemIndex, true,
|
||||
true, false);
|
||||
true, false, false);
|
||||
if ("onchange" in this)
|
||||
this.onchange();
|
||||
]]>
|
||||
|
|
|
@ -2043,6 +2043,7 @@ nsListControlFrame::SetOptionsSelectedFromFrame(PRInt32 aStartIndex,
|
|||
aValue,
|
||||
aClearAll,
|
||||
PR_FALSE,
|
||||
PR_TRUE,
|
||||
&wasChanged);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetSelected failed");
|
||||
if (NS_SUCCEEDED(rv) && !mChangesNotNotified && wasChanged) {
|
||||
|
@ -2077,6 +2078,7 @@ nsListControlFrame::ToggleOptionSelectedFromFrame(PRInt32 aIndex)
|
|||
!value,
|
||||
PR_FALSE,
|
||||
PR_FALSE,
|
||||
PR_TRUE,
|
||||
&wasChanged);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetSelected failed");
|
||||
|
|
|
@ -56,40 +56,4 @@ interface nsIOutlinerContentView : nsISupports
|
|||
* Retrieve the index associated with the specified content item.
|
||||
*/
|
||||
long getIndexOfItem(in nsIDOMElement item);
|
||||
|
||||
/**
|
||||
* Notification that an item has been selected.
|
||||
*/
|
||||
void select(in long index);
|
||||
|
||||
/**
|
||||
* Notification that all items have been selected.
|
||||
*/
|
||||
void selectAll();
|
||||
|
||||
/**
|
||||
* Notification that an item has been deselected.
|
||||
*/
|
||||
void deselect(in long index);
|
||||
|
||||
/**
|
||||
* Notification that all items have been deselected.
|
||||
*/
|
||||
void deselectAll();
|
||||
|
||||
/**
|
||||
* Notification that a range of items has been selected.
|
||||
*/
|
||||
void selectRange(in long start, in long end);
|
||||
|
||||
/**
|
||||
* Notification that a range of items has been deselected.
|
||||
*/
|
||||
void deselectRange(in long start, in long end);
|
||||
|
||||
/**
|
||||
* Notification that all items except this one have been deselected.
|
||||
*/
|
||||
void deselectAllBut(in long index);
|
||||
|
||||
};
|
||||
|
|
|
@ -132,6 +132,12 @@ interface nsIOutlinerSelection : nsISupports
|
|||
* selected).
|
||||
*/
|
||||
attribute long currentIndex;
|
||||
|
||||
/**
|
||||
* The selection "pivot". This is the first item the user selected as
|
||||
* part of a ranged select.
|
||||
*/
|
||||
readonly attribute long shiftSelectPivot;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsChildIterator.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsISelectElement.h"
|
||||
|
||||
|
||||
// A content model view implementation for the outliner.
|
||||
|
@ -602,48 +601,6 @@ nsOutlinerContentView::GetIndexOfItem(nsIDOMElement* aItem, PRInt32* _retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::Select(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::SelectAll()
|
||||
{
|
||||
return SetOptionsSelected(0, mRows.Count() - 1, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::Deselect(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelected(aIndex, aIndex, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::DeselectAll()
|
||||
{
|
||||
return SetOptionsSelected(0, mRows.Count() - 1, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::SelectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
return SetOptionsSelected(aStart, aEnd, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::DeselectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
return SetOptionsSelected(aStart, aEnd, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::DeselectAllBut(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::BeginUpdate(nsIDocument *aDocument)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsIOutlinerBoxObject.h"
|
||||
#include "nsIOutlinerSelection.h"
|
||||
#include "nsIOutlinerContentView.h"
|
||||
#include "nsISelectElement.h"
|
||||
|
||||
class Property;
|
||||
|
||||
|
@ -185,20 +184,6 @@ class nsOutlinerContentView : public nsIOutlinerView,
|
|||
|
||||
nsresult ParseProperties(nsIContent* aContent, Property** aProperty);
|
||||
|
||||
inline nsresult SetOptionsSelected(PRInt32 aStart, PRInt32 aEnd,
|
||||
PRBool aSelect, PRBool aClear)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mRoot) {
|
||||
nsCOMPtr<nsISelectElement> selectElement = do_QueryInterface(mRoot);
|
||||
if (selectElement)
|
||||
rv = selectElement->SetOptionsSelectedByIndex(aStart, aEnd, aSelect,
|
||||
aClear, PR_FALSE, nsnull);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIOutlinerBoxObject> mBoxObject;
|
||||
nsCOMPtr<nsIOutlinerSelection> mSelection;
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsIOutlinerContentView.h"
|
||||
|
||||
// A helper class for managing our ranges of selection.
|
||||
struct nsOutlinerRange
|
||||
|
@ -350,7 +349,6 @@ NS_IMETHODIMP nsOutlinerSelection::Select(PRInt32 aIndex)
|
|||
if (count > 1) {
|
||||
// We need to deselect everything but our item.
|
||||
mFirstRange->RemoveAllBut(aIndex);
|
||||
ContentViewDeselectAllBut(aIndex);
|
||||
FireOnSelectHandler();
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -358,7 +356,6 @@ NS_IMETHODIMP nsOutlinerSelection::Select(PRInt32 aIndex)
|
|||
else {
|
||||
// Clear out our selection.
|
||||
mFirstRange->Invalidate();
|
||||
ContentViewDeselectAll();
|
||||
delete mFirstRange;
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +365,6 @@ NS_IMETHODIMP nsOutlinerSelection::Select(PRInt32 aIndex)
|
|||
mFirstRange->Invalidate();
|
||||
|
||||
// Fire the select event
|
||||
ContentViewSelect(aIndex);
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -390,16 +386,12 @@ NS_IMETHODIMP nsOutlinerSelection::ToggleSelect(PRInt32 aIndex)
|
|||
Select(aIndex);
|
||||
else {
|
||||
if (!mFirstRange->Contains(aIndex)) {
|
||||
if (! SingleSelection()) {
|
||||
ContentViewSelect(aIndex);
|
||||
if (! SingleSelection())
|
||||
mFirstRange->Add(aIndex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ContentViewDeselect(aIndex);
|
||||
else
|
||||
mFirstRange->Remove(aIndex);
|
||||
}
|
||||
|
||||
|
||||
mOutliner->InvalidateRow(aIndex);
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
@ -416,7 +408,6 @@ NS_IMETHODIMP nsOutlinerSelection::RangedSelect(PRInt32 aStartIndex, PRInt32 aEn
|
|||
if (!aAugment) {
|
||||
// Clear our selection.
|
||||
if (mFirstRange) {
|
||||
ContentViewDeselectAll();
|
||||
mFirstRange->Invalidate();
|
||||
delete mFirstRange;
|
||||
}
|
||||
|
@ -437,12 +428,10 @@ NS_IMETHODIMP nsOutlinerSelection::RangedSelect(PRInt32 aStartIndex, PRInt32 aEn
|
|||
if (aAugment && mFirstRange) {
|
||||
// We need to remove all the items within our selected range from the selection,
|
||||
// and then we insert our new range into the list.
|
||||
ContentViewDeselectRange(start, end);
|
||||
mFirstRange->RemoveRange(start, end);
|
||||
}
|
||||
|
||||
nsOutlinerRange* range = new nsOutlinerRange(this, start, end);
|
||||
ContentViewSelectRange(start, end);
|
||||
range->Invalidate();
|
||||
|
||||
if (aAugment && mFirstRange)
|
||||
|
@ -464,7 +453,6 @@ NS_IMETHODIMP nsOutlinerSelection::ClearRange(PRInt32 aStartIndex, PRInt32 aEndI
|
|||
PRInt32 end = aStartIndex < aEndIndex ? aEndIndex : aStartIndex;
|
||||
|
||||
mFirstRange->RemoveRange(start, end);
|
||||
ContentViewDeselectRange(start, end);
|
||||
|
||||
mOutliner->InvalidateRange(start, end);
|
||||
}
|
||||
|
@ -477,7 +465,6 @@ NS_IMETHODIMP nsOutlinerSelection::ClearSelection()
|
|||
if (mFirstRange) {
|
||||
mFirstRange->Invalidate();
|
||||
delete mFirstRange;
|
||||
ContentViewDeselectAll();
|
||||
mFirstRange = nsnull;
|
||||
}
|
||||
mShiftSelectPivot = -1;
|
||||
|
@ -512,7 +499,6 @@ NS_IMETHODIMP nsOutlinerSelection::SelectAll()
|
|||
|
||||
mFirstRange = new nsOutlinerRange(this, 0, rowCount-1);
|
||||
mFirstRange->Invalidate();
|
||||
ContentViewSelectAll();
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
||||
|
@ -711,6 +697,13 @@ nsOutlinerSelection::InvalidateSelection()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerSelection::GetShiftSelectPivot(PRInt32* aIndex)
|
||||
{
|
||||
*aIndex = mShiftSelectPivot;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOutlinerSelection::FireOnSelectHandler()
|
||||
{
|
||||
|
@ -760,69 +753,6 @@ PRBool nsOutlinerSelection::SingleSelection()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOutlinerSelection::GetContentView(nsIOutlinerContentView** aView)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerView> outlinerView;
|
||||
mOutliner->GetView(getter_AddRefs(outlinerView));
|
||||
return CallQueryInterface(outlinerView, aView);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewSelect(PRInt32 aIndex)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->Select(aIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewSelectAll()
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->SelectAll();
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselect(PRInt32 aIndex)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->Deselect(aIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselectAll()
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->DeselectAll();
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewSelectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->SelectRange(aStart, aEnd);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->DeselectRange(aStart, aEnd);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselectAllBut(PRInt32 aIndex)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->DeselectAllBut(aIndex);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include "nsITimer.h"
|
||||
|
||||
class nsIOutlinerBoxObject;
|
||||
class nsIOutlinerContentView;
|
||||
|
||||
struct nsOutlinerRange;
|
||||
|
||||
class nsOutlinerSelection : public nsIOutlinerSelection
|
||||
|
@ -48,16 +46,6 @@ protected:
|
|||
static void SelectCallback(nsITimer *aTimer, void *aClosure);
|
||||
PRBool SingleSelection();
|
||||
|
||||
// Content view notification
|
||||
nsresult GetContentView(nsIOutlinerContentView** aView);
|
||||
void ContentViewSelect(PRInt32 aIndex);
|
||||
void ContentViewSelectAll();
|
||||
void ContentViewDeselect(PRInt32 aIndex);
|
||||
void ContentViewDeselectAll();
|
||||
void ContentViewSelectRange(PRInt32 aStart, PRInt32 aEnd);
|
||||
void ContentViewDeselectRange(PRInt32 aStart, PRInt32 aEnd);
|
||||
void ContentViewDeselectAllBut(PRInt32 aIndex);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
nsIOutlinerBoxObject* mOutliner; // [Weak]. The outliner will hold on to us through the view and let go when it dies.
|
||||
|
|
|
@ -56,40 +56,4 @@ interface nsIOutlinerContentView : nsISupports
|
|||
* Retrieve the index associated with the specified content item.
|
||||
*/
|
||||
long getIndexOfItem(in nsIDOMElement item);
|
||||
|
||||
/**
|
||||
* Notification that an item has been selected.
|
||||
*/
|
||||
void select(in long index);
|
||||
|
||||
/**
|
||||
* Notification that all items have been selected.
|
||||
*/
|
||||
void selectAll();
|
||||
|
||||
/**
|
||||
* Notification that an item has been deselected.
|
||||
*/
|
||||
void deselect(in long index);
|
||||
|
||||
/**
|
||||
* Notification that all items have been deselected.
|
||||
*/
|
||||
void deselectAll();
|
||||
|
||||
/**
|
||||
* Notification that a range of items has been selected.
|
||||
*/
|
||||
void selectRange(in long start, in long end);
|
||||
|
||||
/**
|
||||
* Notification that a range of items has been deselected.
|
||||
*/
|
||||
void deselectRange(in long start, in long end);
|
||||
|
||||
/**
|
||||
* Notification that all items except this one have been deselected.
|
||||
*/
|
||||
void deselectAllBut(in long index);
|
||||
|
||||
};
|
||||
|
|
|
@ -132,6 +132,12 @@ interface nsIOutlinerSelection : nsISupports
|
|||
* selected).
|
||||
*/
|
||||
attribute long currentIndex;
|
||||
|
||||
/**
|
||||
* The selection "pivot". This is the first item the user selected as
|
||||
* part of a ranged select.
|
||||
*/
|
||||
readonly attribute long shiftSelectPivot;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsChildIterator.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsISelectElement.h"
|
||||
|
||||
|
||||
// A content model view implementation for the outliner.
|
||||
|
@ -602,48 +601,6 @@ nsOutlinerContentView::GetIndexOfItem(nsIDOMElement* aItem, PRInt32* _retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::Select(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::SelectAll()
|
||||
{
|
||||
return SetOptionsSelected(0, mRows.Count() - 1, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::Deselect(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelected(aIndex, aIndex, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::DeselectAll()
|
||||
{
|
||||
return SetOptionsSelected(0, mRows.Count() - 1, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::SelectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
return SetOptionsSelected(aStart, aEnd, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::DeselectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
return SetOptionsSelected(aStart, aEnd, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::DeselectAllBut(PRInt32 aIndex)
|
||||
{
|
||||
return SetOptionsSelected(aIndex, aIndex, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerContentView::BeginUpdate(nsIDocument *aDocument)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsIOutlinerBoxObject.h"
|
||||
#include "nsIOutlinerSelection.h"
|
||||
#include "nsIOutlinerContentView.h"
|
||||
#include "nsISelectElement.h"
|
||||
|
||||
class Property;
|
||||
|
||||
|
@ -185,20 +184,6 @@ class nsOutlinerContentView : public nsIOutlinerView,
|
|||
|
||||
nsresult ParseProperties(nsIContent* aContent, Property** aProperty);
|
||||
|
||||
inline nsresult SetOptionsSelected(PRInt32 aStart, PRInt32 aEnd,
|
||||
PRBool aSelect, PRBool aClear)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mRoot) {
|
||||
nsCOMPtr<nsISelectElement> selectElement = do_QueryInterface(mRoot);
|
||||
if (selectElement)
|
||||
rv = selectElement->SetOptionsSelectedByIndex(aStart, aEnd, aSelect,
|
||||
aClear, PR_FALSE, nsnull);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIOutlinerBoxObject> mBoxObject;
|
||||
nsCOMPtr<nsIOutlinerSelection> mSelection;
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsIOutlinerContentView.h"
|
||||
|
||||
// A helper class for managing our ranges of selection.
|
||||
struct nsOutlinerRange
|
||||
|
@ -350,7 +349,6 @@ NS_IMETHODIMP nsOutlinerSelection::Select(PRInt32 aIndex)
|
|||
if (count > 1) {
|
||||
// We need to deselect everything but our item.
|
||||
mFirstRange->RemoveAllBut(aIndex);
|
||||
ContentViewDeselectAllBut(aIndex);
|
||||
FireOnSelectHandler();
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -358,7 +356,6 @@ NS_IMETHODIMP nsOutlinerSelection::Select(PRInt32 aIndex)
|
|||
else {
|
||||
// Clear out our selection.
|
||||
mFirstRange->Invalidate();
|
||||
ContentViewDeselectAll();
|
||||
delete mFirstRange;
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +365,6 @@ NS_IMETHODIMP nsOutlinerSelection::Select(PRInt32 aIndex)
|
|||
mFirstRange->Invalidate();
|
||||
|
||||
// Fire the select event
|
||||
ContentViewSelect(aIndex);
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -390,16 +386,12 @@ NS_IMETHODIMP nsOutlinerSelection::ToggleSelect(PRInt32 aIndex)
|
|||
Select(aIndex);
|
||||
else {
|
||||
if (!mFirstRange->Contains(aIndex)) {
|
||||
if (! SingleSelection()) {
|
||||
ContentViewSelect(aIndex);
|
||||
if (! SingleSelection())
|
||||
mFirstRange->Add(aIndex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ContentViewDeselect(aIndex);
|
||||
else
|
||||
mFirstRange->Remove(aIndex);
|
||||
}
|
||||
|
||||
|
||||
mOutliner->InvalidateRow(aIndex);
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
@ -416,7 +408,6 @@ NS_IMETHODIMP nsOutlinerSelection::RangedSelect(PRInt32 aStartIndex, PRInt32 aEn
|
|||
if (!aAugment) {
|
||||
// Clear our selection.
|
||||
if (mFirstRange) {
|
||||
ContentViewDeselectAll();
|
||||
mFirstRange->Invalidate();
|
||||
delete mFirstRange;
|
||||
}
|
||||
|
@ -437,12 +428,10 @@ NS_IMETHODIMP nsOutlinerSelection::RangedSelect(PRInt32 aStartIndex, PRInt32 aEn
|
|||
if (aAugment && mFirstRange) {
|
||||
// We need to remove all the items within our selected range from the selection,
|
||||
// and then we insert our new range into the list.
|
||||
ContentViewDeselectRange(start, end);
|
||||
mFirstRange->RemoveRange(start, end);
|
||||
}
|
||||
|
||||
nsOutlinerRange* range = new nsOutlinerRange(this, start, end);
|
||||
ContentViewSelectRange(start, end);
|
||||
range->Invalidate();
|
||||
|
||||
if (aAugment && mFirstRange)
|
||||
|
@ -464,7 +453,6 @@ NS_IMETHODIMP nsOutlinerSelection::ClearRange(PRInt32 aStartIndex, PRInt32 aEndI
|
|||
PRInt32 end = aStartIndex < aEndIndex ? aEndIndex : aStartIndex;
|
||||
|
||||
mFirstRange->RemoveRange(start, end);
|
||||
ContentViewDeselectRange(start, end);
|
||||
|
||||
mOutliner->InvalidateRange(start, end);
|
||||
}
|
||||
|
@ -477,7 +465,6 @@ NS_IMETHODIMP nsOutlinerSelection::ClearSelection()
|
|||
if (mFirstRange) {
|
||||
mFirstRange->Invalidate();
|
||||
delete mFirstRange;
|
||||
ContentViewDeselectAll();
|
||||
mFirstRange = nsnull;
|
||||
}
|
||||
mShiftSelectPivot = -1;
|
||||
|
@ -512,7 +499,6 @@ NS_IMETHODIMP nsOutlinerSelection::SelectAll()
|
|||
|
||||
mFirstRange = new nsOutlinerRange(this, 0, rowCount-1);
|
||||
mFirstRange->Invalidate();
|
||||
ContentViewSelectAll();
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
||||
|
@ -711,6 +697,13 @@ nsOutlinerSelection::InvalidateSelection()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOutlinerSelection::GetShiftSelectPivot(PRInt32* aIndex)
|
||||
{
|
||||
*aIndex = mShiftSelectPivot;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOutlinerSelection::FireOnSelectHandler()
|
||||
{
|
||||
|
@ -760,69 +753,6 @@ PRBool nsOutlinerSelection::SingleSelection()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOutlinerSelection::GetContentView(nsIOutlinerContentView** aView)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerView> outlinerView;
|
||||
mOutliner->GetView(getter_AddRefs(outlinerView));
|
||||
return CallQueryInterface(outlinerView, aView);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewSelect(PRInt32 aIndex)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->Select(aIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewSelectAll()
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->SelectAll();
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselect(PRInt32 aIndex)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->Deselect(aIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselectAll()
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->DeselectAll();
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewSelectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->SelectRange(aStart, aEnd);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselectRange(PRInt32 aStart, PRInt32 aEnd)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->DeselectRange(aStart, aEnd);
|
||||
}
|
||||
|
||||
void
|
||||
nsOutlinerSelection::ContentViewDeselectAllBut(PRInt32 aIndex)
|
||||
{
|
||||
nsCOMPtr<nsIOutlinerContentView> contentView;
|
||||
if (NS_SUCCEEDED(GetContentView(getter_AddRefs(contentView))))
|
||||
contentView->DeselectAllBut(aIndex);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include "nsITimer.h"
|
||||
|
||||
class nsIOutlinerBoxObject;
|
||||
class nsIOutlinerContentView;
|
||||
|
||||
struct nsOutlinerRange;
|
||||
|
||||
class nsOutlinerSelection : public nsIOutlinerSelection
|
||||
|
@ -48,16 +46,6 @@ protected:
|
|||
static void SelectCallback(nsITimer *aTimer, void *aClosure);
|
||||
PRBool SingleSelection();
|
||||
|
||||
// Content view notification
|
||||
nsresult GetContentView(nsIOutlinerContentView** aView);
|
||||
void ContentViewSelect(PRInt32 aIndex);
|
||||
void ContentViewSelectAll();
|
||||
void ContentViewDeselect(PRInt32 aIndex);
|
||||
void ContentViewDeselectAll();
|
||||
void ContentViewSelectRange(PRInt32 aStart, PRInt32 aEnd);
|
||||
void ContentViewDeselectRange(PRInt32 aStart, PRInt32 aEnd);
|
||||
void ContentViewDeselectAllBut(PRInt32 aIndex);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
nsIOutlinerBoxObject* mOutliner; // [Weak]. The outliner will hold on to us through the view and let go when it dies.
|
||||
|
|
Загрузка…
Ссылка в новой задаче