From 04ce48ae643f98095a9bc46da659eba132f6e3b9 Mon Sep 17 00:00:00 2001 From: David Norton Date: Wed, 2 Aug 2006 16:08:19 +0000 Subject: [PATCH] Closes #156, Double-clicking a note in the item list should open it in a popup window --- chrome/chromeFiles/content/scholar/overlay.js | 25 ++++++++++++++++--- .../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 index 82bc07e255..d74a08b1ff 100644 --- 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 index 0f056d512c..62710ef5ec 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -109,6 +109,7 @@ -