More fixes/optimizations for new pane code
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Nov 2009 00:16:38 +0000 (17:16 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Nov 2009 00:16:38 +0000 (17:16 -0700)
imp/js/DimpBase.js
imp/js/DimpSlider.js
imp/js/ViewPort.js
imp/templates/index/index-dimp.inc
imp/themes/screen-dimp.css

index b17e42a..52e129f 100644 (file)
@@ -40,7 +40,7 @@ var DimpBase = {
 
         this.toggleButtons();
 
-        if ($('previewPane').visible()) {
+        if (DIMP.conf.preview_pref) {
             if (opts.right) {
                 this.clearPreviewPane();
             } else {
@@ -66,7 +66,7 @@ var DimpBase = {
         this.toggleButtons();
         if (opts.right || !count) {
             this.clearPreviewPane();
-        } else if ((count == 1) && $('previewPane').visible()) {
+        } else if ((count == 1) && DIMP.conf.preview_pref) {
             this.loadPreview(sel.get('dataob').first());
         }
     },
@@ -232,7 +232,6 @@ var DimpBase = {
                 if (!Object.isUndefined(this.folder) && !this.search) {
                     this._addHistory(loc);
                 }
-
             }
 
             this.loadMailbox(f);
@@ -1082,7 +1081,7 @@ var DimpBase = {
     {
         var pp_uid;
 
-        if (!$('previewPane').visible()) {
+        if (!DIMP.conf.preview_pref) {
             return;
         }
 
index 6b30e35..65de92d 100644 (file)
@@ -56,7 +56,7 @@ var DimpSlider = Class.create({
         this.sbdownsize = this.sbupsize = this.value = 0;
         this.active = this.dragging = false;
 
-        if (this._showScroll()) {
+        if (this.needScroll()) {
             this._initScroll();
         }
 
@@ -144,16 +144,18 @@ var DimpSlider = Class.create({
         }
     },
 
-    updateHandleLength: function(pagesize, totalsize)
+    setHandleLength: function(pagesize, totalsize)
     {
         this.options.pagesize = pagesize;
         this.options.totalsize = totalsize;
-        if (!this._showScroll()) {
+    },
+
+    updateHandleLength: function()
+    {
+        if (!this.needScroll()) {
             this.value = 0;
             this.track.hide();
-            return;
-        }
-        if (!this._initScroll()) {
+        } else if (!this._initScroll()) {
             this.track.show();
             this._updateHandleLength();
         }
@@ -179,12 +181,10 @@ var DimpSlider = Class.create({
 
     setScrollPosition: function(val)
     {
-        if (this._showScroll()) {
-            var oldval = this.getValue();
-            this._setScrollPosition('val', val);
-            if (oldval != this.getValue()) {
-                this._updateFinished();
-            }
+        var oldval = this.getValue();
+        this._setScrollPosition('val', val);
+        if (oldval != this.getValue()) {
+            this._updateFinished();
         }
     },
 
@@ -212,7 +212,7 @@ var DimpSlider = Class.create({
         this.handle.setStyle({ top: this.handlevalue + 'px' });
     },
 
-    _showScroll: function()
+    needScroll: function()
     {
         return (this.options.pagesize < this.options.totalsize);
     }
index a5c0fda..b9c7013 100644 (file)
@@ -467,7 +467,7 @@ var ViewPort = Class.create({
             break;
         }
 
-        this.scroller.onResize();
+        this.requestContentRefresh(this.currentOffset());
     },
 
     // offset = (integer) TODO
@@ -807,7 +807,7 @@ var ViewPort = Class.create({
             this.opts.onClear(this.visibleRows());
         }
 
-        this.scroller.updateSize();
+        this.scroller.setSize(page_size, this.getMetaData('total_rows'));
         this.scrollTo(offset + 1, { noupdate: true, top: true });
 
         offset = this.currentOffset();
@@ -824,6 +824,8 @@ var ViewPort = Class.create({
             this.opts.onContentComplete(c_nodes);
         }
 
+        this.scroller.updateDisplay();
+
         return true;
     },
 
@@ -1148,7 +1150,7 @@ var ViewPort = Class.create({
  */
 ViewPort_Scroller = Class.create({
     // Variables initialized to undefined:
-    //   lastpane, noupdate, scrollDiv, scrollbar, scrollsize, vp
+    //   noupdate, scrollDiv, scrollbar, vertscroll, vp
 
     initialize: function(vp)
     {
@@ -1184,56 +1186,48 @@ ViewPort_Scroller = Class.create({
         }.bindAsEventListener(this));
     },
 
-    onResize: function()
+    setSize: function(viewsize, totalsize)
     {
-        // Update the scrollbar size
-        this.updateSize();
-
-        // Update displayed content.
-        this.vp.requestContentRefresh(this.currentOffset());
+        this._createScrollBar();
+        this.scrollbar.setHandleLength(viewsize, totalsize);
     },
 
-    updateSize: function()
+    updateDisplay: function()
     {
-        this._createScrollBar();
-        this.scrollbar.updateHandleLength(this.vp.getPageSize(), this.vp.getMetaData('total_rows'));
-
         var c = this.vp.opts.content,
-            w = this.scrollDiv.getWidth();
+            vs = false;
 
-        if (this.scrollDiv.visible()) {
+        if (this.scrollbar.needScroll()) {
             switch (this.vp.pane_mode) {
             case 'horiz':
-                this.scrollDiv.setStyle({ float: 'left', marginLeft: '-' + w + 'px', position: null });
+                this.scrollDiv.setStyle({ float: 'left', marginLeft: '-' + this.scrollDiv.getWidth() + 'px', position: null });
                 break;
 
             case 'vert':
-                if (this.lastpane != this.vp.pane_mode) {
-                    c.setStyle({ width: (c.clientWidth - w) + 'px' });
-                }
                 this.scrollDiv.setStyle({ float: 'left', marginLeft: 0, position: null });
+                if (!this.vertscroll) {
+                    c.setStyle({ width: (c.clientWidth - this.scrollDiv.getWidth()) + 'px' });
+                }
+                vs = true;
                 break;
 
             default:
-                this.scrollDiv.setStyle({ marginLeft: '-' + w + 'px', position: 'absolute', right: 0, top: 0 });
+                this.scrollDiv.setStyle({ float: 'none', marginLeft: '-' + this.scrollDiv.getWidth() + 'px', position: 'absolute', right: 0, top: 0 });
                 break;
             }
 
             this.scrollDiv.setStyle({ height: c.clientHeight + 'px' });
-            this.scrollsize = c.clientHeight;
-        } else if (this.vp.pane_mode == 'vert' &&
-                   this.lastpane == this.vp.pane_mode) {
-            c.setStyle({ width: (c.clientWidth + w) + 'px' });
+        } else if ((this.vp.pane_mode =='vert') && this.vertscroll) {
+            c.setStyle({ width: (c.clientWidth + this.scrollDiv.getWidth()) + 'px' });
         }
 
-        this.lastpane = this.vp.pane_mode;
+        this.vertscroll = vs;
+        this.scrollbar.updateHandleLength();
     },
 
     clear: function()
     {
-        if (this.scrollDiv) {
-            this.scrollbar.updateHandleLength(0, 0);
-        }
+        this.setSize(0, 0);
     },
 
     // offset = (integer) Offset to move the scrollbar to
index fb67f61..bbd943c 100644 (file)
@@ -196,7 +196,7 @@ function _simpleButton($id, $text, $image)
     <div id="previewPane" style="display:none">
      <span id="msgLoading" class="loadingImg" style="display:none"></span>
      <div id="previewInfo" style="display:none">
-      <?php echo _("To preview a message, select it from the list above.") ?>
+      <?php echo _("To preview a message, select it from the message list.") ?>
       <br />
 <?php if ($browser->isBrowser('opera')): ?>
       <?php echo _("A left click") ?> + <span class="kbd"><?php echo _("Shift") ?></span> + <span class="kbd"><?php echo _("Ctrl") ?></span> <?php echo _("will display available actions.") ?>
index 14f2639..456da49 100644 (file)
@@ -237,9 +237,9 @@ div.flagDeleted {
 }
 .msglist div.vpRowVert div.msgStatus {
     height: 24px;
-    padding-right: 4px;
+    margin-right: 2px;
     padding-top: 8px;
-    width: 20%;
+    width: 15%;
 }
 .msglist div.vpRowVert div.msgFrom {
     font-weight: bold;