[Libreoffice-commits] online.git: 2 commits - loleaflet/dist loleaflet/src

Ozcan Esen ozcan.esen at collabora.com
Mon Jan 4 13:51:09 PST 2016


 loleaflet/dist/images/preview_placeholder.png |binary
 loleaflet/src/control/Control.PartsPreview.js |    1 
 loleaflet/src/control/Control.Presentation.js |   42 +++----------------
 loleaflet/src/control/Parts.js                |   57 ++++++++++++++++++++++++++
 loleaflet/src/layer/tile/ImpressTileLayer.js  |   12 ++---
 5 files changed, 72 insertions(+), 40 deletions(-)

New commits:
commit 56ac4eac7454399d11b9a60fff1dfb332a774f21
Author: Ozcan Esen <ozcan.esen at collabora.com>
Date:   Sat Jan 2 23:24:29 2016 +0200

    loleaflet: load tiles of the first slide before loading slide thumbnails
    
    and show 180x135 white placeholder image in the thumbnail while waiting
    for the actual thumbnail
    
    Change-Id: I768815b5d54e02000718d5a443f820ac665dac60
    Reviewed-on: https://gerrit.libreoffice.org/21049
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/dist/images/preview_placeholder.png b/loleaflet/dist/images/preview_placeholder.png
new file mode 100644
index 0000000..ddf8651
Binary files /dev/null and b/loleaflet/dist/images/preview_placeholder.png differ
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 93a2cfa..7cf4fd8 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -63,6 +63,7 @@ L.Control.PartsPreview = L.Control.extend({
 		var imgClassName = 'preview-img';
 		var img = L.DomUtil.create('img', imgClassName, frame);
 		img.id = id;
+		img.src = L.Icon.Default.imagePath + '/preview_placeholder.png';
 		L.DomEvent
 			.on(img, 'click', L.DomEvent.stopPropagation)
 			.on(img, 'click', L.DomEvent.stop)
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 0868c43..e6351da 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -113,6 +113,12 @@ L.ImpressTileLayer = L.TileLayer.extend({
 			this._parts = command.parts;
 			this._selectedPart = command.selectedPart;
 			L.Socket.sendMessage('setclientpart part=' + this._selectedPart);
+			this._resetPreFetching(true);
+			this._update();
+			if (this._preFetchPart !== this._selectedPart) {
+				this._preFetchPart = this._selectedPart;
+				this._preFetchBorder = null;
+			}
 			var partNames = textMsg.match(/[^\r\n]+/g);
 			// only get the last matches
 			partNames = partNames.slice(partNames.length - this._parts);
@@ -122,12 +128,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
 				docType: this._docType,
 				partNames: partNames
 			});
-			this._resetPreFetching(true);
-			this._update();
-			if (this._preFetchPart !== this._selectedPart) {
-				this._preFetchPart = this._selectedPart;
-				this._preFetchBorder = null;
-			}
 		}
 	}
 });
commit 13eacefe6022f96386887db2cfac3da48a9b03dc
Author: Ozcan Esen <ozcan.esen at collabora.com>
Date:   Tue Dec 29 06:14:49 2015 +0200

    loleaflet: make presentation controls more portable
    
    Change-Id: I3834f115a3bde8720149fdefdf132684e9a546da
    Reviewed-on: https://gerrit.libreoffice.org/21000
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/src/control/Control.Presentation.js b/loleaflet/src/control/Control.Presentation.js
index 469dd3a..edefa2f 100644
--- a/loleaflet/src/control/Control.Presentation.js
+++ b/loleaflet/src/control/Control.Presentation.js
@@ -12,9 +12,9 @@ L.Control.Presentation = L.Control.extend({
 		    container = L.DomUtil.create('div', buttonsName + '-container' + ' leaflet-bar');
 
 		this._buttons = {
-			'insertpage':    {title: 'Insert Page',          uno: 'InsertPage',        iconName: 'insertpage.png'},
-			'duplicatepage': {title: 'Duplicate Page',       uno: 'DuplicatePage',     iconName: 'duplicatepage.png'},
-			'deletepage':    {title: 'Delete Page',          uno: 'DeletePage',        iconName: 'deletepage.png'}
+			'insertpage':    {title: 'Insert Page',     iconName: 'insertpage.png'},
+			'duplicatepage': {title: 'Duplicate Page',  iconName: 'duplicatepage.png'},
+			'deletepage':    {title: 'Delete Page',     iconName: 'deletepage.png'}
 		};
 
 		for (var key in this._buttons) {
@@ -62,41 +62,15 @@ L.Control.Presentation = L.Control.extend({
 			return;
 		}
 		var id = e.target.id;
-		var button = this._buttons[id];
-		var docLayer = this._map._docLayer;
 
-		// TO DO: Deleting all the pages causes problem.
-		if (id === 'deletepage' && docLayer._parts === 1) {
-			return;
+		if (id === 'insertpage') {
+			this._map.insertPage();
 		}
-
-		if (button.uno) {
-			L.Socket.sendMessage('uno .uno:' + button.uno);
-		}
-
-		// TO DO: We should fire these events after server response
-		// Unfortunately server does not send any response.
-		if (id === 'insertpage' || id === 'duplicatepage') {
-			this._map.fire('insertpage', {
-				selectedPart: docLayer._selectedPart,
-				parts: 		  docLayer._parts
-			});
-
-			docLayer._parts++;
-			this._map.setPart('next');
+		else if (id === 'duplicatepage') {
+			this._map.duplicatePage();
 		}
 		else if (id === 'deletepage') {
-			this._map.fire('deletepage', {
-				selectedPart: docLayer._selectedPart,
-				parts: 		  docLayer._parts
-			});
-
-			docLayer._parts--;
-			if (docLayer._selectedPart >= docLayer._parts) {
-				docLayer._selectedPart--;
-			}
-
-			this._map.setPart(docLayer._selectedPart);
+			this._map.deletePage();
 		}
 	}
 });
diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index 88585bf..811388a 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -144,6 +144,63 @@ L.Map.include({
 		});
 	},
 
+	insertPage: function() {
+		if (this.getDocType() !== 'presentation') {
+			return;
+		}
+		L.Socket.sendMessage('uno .uno:InsertPage');
+		var docLayer = this._docLayer;
+
+		this.fire('insertpage', {
+			selectedPart: docLayer._selectedPart,
+			parts:        docLayer._parts
+		});
+
+		docLayer._parts++;
+		this.setPart('next');
+	},
+
+	duplicatePage: function() {
+		if (this.getDocType() !== 'presentation') {
+			return;
+		}
+		L.Socket.sendMessage('uno .uno:DuplicatePage');
+		var docLayer = this._docLayer;
+
+		this.fire('insertpage', {
+			selectedPart: docLayer._selectedPart,
+			parts:        docLayer._parts
+		});
+
+		docLayer._parts++;
+		this.setPart('next');
+	},
+
+	deletePage: function () {
+		if (this.getDocType() !== 'presentation') {
+			return;
+		}
+
+		L.Socket.sendMessage('uno .uno:DeletePage');
+		var docLayer = this._docLayer;
+		// TO DO: Deleting all the pages causes problem.
+		if (docLayer._parts === 1) {
+			return;
+		}
+
+		this.fire('deletepage', {
+			selectedPart: docLayer._selectedPart,
+			parts:        docLayer._parts
+		});
+
+		docLayer._parts--;
+		if (docLayer._selectedPart >= docLayer._parts) {
+			docLayer._selectedPart--;
+		}
+
+		this.setPart(docLayer._selectedPart);
+	},
+
 	getNumberOfPages: function () {
 		return this._docLayer._pages;
 	},


More information about the Libreoffice-commits mailing list