www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 04ce48ae643f98095a9bc46da659eba132f6e3b9
parent b79420e75b732f0c371044265ade3fed0b28e86d
Author: David Norton <david@nortoncrew.com>
Date:   Wed,  2 Aug 2006 16:08:19 +0000

Closes #156, Double-clicking a note in the item list should open it in a popup window

Diffstat:
Mchrome/chromeFiles/content/scholar/overlay.js | 25++++++++++++++++++++++---
Mchrome/chromeFiles/content/scholar/overlay.xul | 3++-
2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js @@ -26,6 +26,7 @@ var ScholarPane = new function() this.getSelectedItems = getSelectedItems; this.buildCollectionContextMenu = buildCollectionContextMenu; this.buildItemContextMenu = buildItemContextMenu; + this.onDoubleClick = onDoubleClick; this.openNoteWindow = openNoteWindow; this.newNote = newNote; this.addFileFromDialog = addFileFromDialog; @@ -180,11 +181,11 @@ var ScholarPane = new function() var noteEditor = document.getElementById('scholar-note-editor'); noteEditor.item = null; noteEditor.note = item.ref; - document.getElementById('scholar-view-note').lastChild.setAttribute('noteID',item.ref.getID()); + document.getElementById('scholar-view-note-button').setAttribute('noteID',item.ref.getID()); if(item.ref.getSource() != null) - document.getElementById('scholar-view-note').lastChild.setAttribute('sourceID',item.ref.getSource()); + document.getElementById('scholar-view-note-button').setAttribute('sourceID',item.ref.getSource()); else - document.getElementById('scholar-view-note').lastChild.removeAttribute('sourceID'); + document.getElementById('scholar-view-note-button').removeAttribute('sourceID'); document.getElementById('item-pane').selectedIndex = 2; } else if(item.isFile()) @@ -370,6 +371,24 @@ var ScholarPane = new function() } } + // Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9 + function onDoubleClick(event, tree) + { + if (event && tree && (event.type == "click" || event.type == "dblclick")) + { + var row = {}, col = {}, obj = {}; + tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj); + if (obj.value && itemsView && itemsView.selection.currentIndex > -1) + { + var item = getSelectedItems()[0]; + if(item && item.isNote()) + { + document.getElementById('scholar-view-note-button').doCommand(); + } + } + } + } + function newNote() { var c = getSelectedCollection(); diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul @@ -109,6 +109,7 @@ </hbox> <tree id="items-tree" context="scholar-itemmenu" + ondblclick="ScholarPane.onDoubleClick(event, this);" enableColumnDrag="true" onkeypress="if(event.keyCode == event.DOM_VK_BACK_SPACE){ ScholarPane.deleteSelectedItem(); return false; }" onselect="ScholarPane.itemSelected();" ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ScholarPane.getItemsView());" @@ -182,7 +183,7 @@ <deck id="scholar-view-item" flex="1"/> <vbox id="scholar-view-note" flex="1"> <noteeditor id="scholar-note-editor" flex="1"/> - <button label="Edit in a separate window" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/> + <button id="scholar-view-note-button" label="Edit in a separate window" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/> </vbox> <vbox id="scholar-view-file" flex="1"> <label id="scholar-file-label"/>