From c106a2ecdbdd30c0a3bb69ca3e7966cde33f42a1 Mon Sep 17 00:00:00 2001 From: itozyun Date: Thu, 17 May 2012 06:47:09 +0900 Subject: [PATCH] client is version0.4.32, updated add image. --- 0.4.x/javascripts/system.js | 44 +++++++++++++++++------------ 0.4.x/javascripts/work.js | 67 ++++++++++++++++++++++++++++----------------- 0.4.x/json/comics_1.json | 2 +- 3 files changed, 70 insertions(+), 43 deletions(-) diff --git a/0.4.x/javascripts/system.js b/0.4.x/javascripts/system.js index 23913d2..6162a6f 100644 --- a/0.4.x/javascripts/system.js +++ b/0.4.x/javascripts/system.js @@ -1,6 +1,6 @@ /* * pettanR system.js - * version 0.4.29 + * version 0.4.32 * * author: * itozyun @@ -974,7 +974,7 @@ pettanr.finder = ( function(){ } } - var FinderClass = function( ELM_CONTAINER, tree, header, footer ){ + var FinderClass = function( ELM_CONTAINER, tree, header, footer, onSelect, viewerOption, editorOption ){ var ICON_ARRAY = [], BREAD_ARRAY = [], elmContainer = ELM_ORIGIN_CONTAINER.cloneNode( true ), @@ -1059,24 +1059,26 @@ pettanr.finder = ( function(){ if( _file !== null && ( _file.getChildFileLength() !== -1 || _file.getType() === pettanr.file.FILE_TYPE.FOLDER)){ tree.down( i ); draw( w, h ); + } else { + Type.isFunction( onSelect ) === true && onSelect( _file ); } } } - function onEditor( _file, _app ){ - _app.boot( _file ); + function onEditor( _file, _app, editorOption ){ + _app.boot( _file, editorOption ); } function onViwer( _file, _app ){ - _app.bootInOverlay( _file ); + _app.bootInOverlay( _file, viewerOption ); } function onAction( _file ){ } - this.rootElement = elmContainer; + this.rootElement = elmContainer; this.parentElement = ELM_CONTAINER; - this.displayName = 'finder'; - this.ID = 'finder'; - this.MIN_WIDTH = 240; - this.MIN_HEIGHT = 240; + this.displayName = 'finder'; + this.ID = 'finder'; + this.MIN_WIDTH = 240; + this.MIN_HEIGHT = 240; this.init = function(){ //$( elmLocation).click( onHeadClick); //$( elmContainer).click( onBodyClick); @@ -1127,10 +1129,10 @@ pettanr.finder = ( function(){ init: function(){ }, - createFinder: function( _applicationReference, _elmTarget, _tree, _header, _footer ){ + createFinder: function( _applicationReference, _elmTarget, _tree, _header, _footer, _onSelect, _viewerOption, _editorOption ){ if( pettanr.view.isApplicationReference( _applicationReference ) === false ) return; - var _finder = new FinderClass( _elmTarget, _tree, _header, _footer ); + var _finder = new FinderClass( _elmTarget, _tree, _header, _footer, _onSelect, _viewerOption, _editorOption ); FINDER_ARRAY.push( _finder ); return _finder; }, @@ -1153,14 +1155,14 @@ pettanr.finder = ( function(){ pettanr.driver = ( function(){ - var MyAuthorID = 'current_author' in window ? current_author.id : ( pettanr.DEBUG ? 1 : -1 ), - MyArtistID = 'current_artist' in window ? current_artist.id : ( pettanr.DEBUG ? 1 : -1 ), + var MyAuthorID = 'current_author' in window ? current_author.id : ( pettanr.CONST.SERVER_SUPPORT === false ? 1 : -1 ), + MyArtistID = 'current_artist' in window ? current_artist.id : ( pettanr.CONST.SERVER_SUPPORT === false ? 1 : -1 ), Driver = { getSeqentialFiles: function( _file){ var _data = FileAPI.getFileData( _file), _json = _data !== null ? _data.json : null; if( _json === true && _data.type === pettanr.driver.FILE_TYPE.COMIC ){ - if( pettanr.LOCAL === true ){ + if( pettanr.CONST.SERVER_SUPPORT === false ){ _json = [ 'json\/comics_', _data.id, '.json' ].join( '' ); } else { _json = [ pettanr.CONST.PETTANR_ROOT_PATH, 'comics\/', _data.id, '.json\/play\/' ].join( '' ); @@ -1558,7 +1560,15 @@ pettanr.driver = ( function(){ return pettanr.file.createTree( FILE_DATA_SERVICE_ROOT ); //FILE_DATA_COMICS_ROOT); }, createPictureTree: function(){ - return pettanr.file.createTree( FILE_DATA_PICTURE_ROOT ); + var _tree = pettanr.file.createTree( FILE_DATA_PICTURE_ROOT ); + _root = _tree.getRootFile(); + _myPic = _root.getChildFileByIndex( 0 ); + _pic = _root.getChildFileByIndex( 1 ); + _myPic.getSeqentialFiles(); + _pic.getSeqentialFiles(); + _myPic.destroy(); + _pic.destroy(); + return _tree; }, createArtistTree: function(){ return pettanr.file.createTree( FILE_DATA_ARTIST_ROOT ); @@ -1778,7 +1788,7 @@ pettanr.premiumSatge = pettanr.view.registerApplication( function(){ elmButton.onclick = clickOK; - var BASE_PATH = pettanr.LOCAL === true ? 'resource_pictures\/' : pettanr.CONST.RESOURCE_PICTURE_PATH, + var BASE_PATH = pettanr.CONST.RESOURCE_PICTURE_PATH, THUMB_PATH = BASE_PATH, // + 'thumbnail/', LIMIT_FILESIZE = 1024 * 10; // 10KB diff --git a/0.4.x/javascripts/work.js b/0.4.x/javascripts/work.js index e9495ec..901e9c7 100644 --- a/0.4.x/javascripts/work.js +++ b/0.4.x/javascripts/work.js @@ -1,6 +1,6 @@ /* * pettanR work.js - * version 0.4.29 + * version 0.4.32 * * author: * itozyun @@ -819,7 +819,8 @@ pettanr.editor = pettanr.view.registerApplication( function(){ MENU_BAR_CONTROL.EDIT.createSelection( 'show Grid', 'ctrl + G', switchGrid, true, true, true); function addImage( e){ - setTimeout( COMIC_ELEMENT_CONTROL.createImageElement, 0); + setTimeout( IMAGE_EXPLORER_WINDOW.open, 0); + instance.bodyBackOrForward( true ); e && e.preventDefault && e.preventDefault(); return false; } @@ -876,6 +877,15 @@ pettanr.editor = pettanr.view.registerApplication( function(){ var IMAGE_EXPLORER_WINDOW = ( function(){ var instance, finder; + function onFileSelect( _file ){ + // 他の image ファイルも許可する? + if( pettanr.driver.isPettanrFileInstance( _file ) === true ){ + if( _file.getType() === pettanr.driver.FILE_TYPE.PICTURE ){ + COMIC_ELEMENT_CONTROL.onImageSelect( pettanr.driver._getAPI().getFileData( _file ) ); + } + } + } + return WINDOWS_CONTROL.createWindow( { onInit: function(){ @@ -883,14 +893,22 @@ pettanr.editor = pettanr.view.registerApplication( function(){ delete this.onInit; }, onOpen: function( _w, _h){ - finder = finder || pettanr.finder.createFinder( pettanr.editor, document.getElementById( 'image-exproler-container'), pettanr.driver.createPictureTree()); + finder = finder || pettanr.finder.createFinder( + pettanr.editor, + document.getElementById( 'image-exproler-container'), + pettanr.driver.createPictureTree(), + null, null, + onFileSelect, + COMIC_ELEMENT_CONTROL.onImageSelect + ); + finder.resize( _w, _h ); }, onResize: function( _w, _h ){ finder.resize( _w, _h ); } }, - 'image-exproler', 'Album', 0, 215, 400, 350, false, true, true, 300, 300 + 'image-exproler', 'Album', 0, 215, 600, 350, false, true, true, 300, 300 ); })(); @@ -2545,25 +2563,6 @@ pettanr.editor = pettanr.view.registerApplication( function(){ function restoreReplaceElement( arg){ replaceComicElement( arg[ 0], arg[ 1]); } - - function onImageSelect( data, isPanelPictureData ){ - if( isPanelPictureData !== true ){ - data = { - resource_picture:data, - x: Math.floor( panelW /2 - data.width /2 ), - y: Math.floor( panelH /2 - data.height /2 ), - z: -1, - t: PANEL_ELEMENT_ARRAY.length, - width: data.width, - height: data.height - } - } - var _panelElement = new ImageElementClass( data ); - _panelElement.init && _panelElement.init(); - appendComicElement( _panelElement ); - _panelElement.animate( undefined, undefined, data.width, data.height ); - SAVE( restoreComicElement, [ false, _panelElement], [ true, _panelElement], true ); - } function onTextInput( _panelElement ){ appendComicElement( _panelElement ); SAVE( restoreComicElement, [ false, _panelElement ], [ true, _panelElement ], true ); @@ -2669,10 +2668,28 @@ pettanr.editor = pettanr.view.registerApplication( function(){ }, createImageElement: function( data ){ if( Type.isObject( data ) === false ){ - pettanr.premiumSatge.bootInOverlay( 1, onImageSelect ); + pettanr.premiumSatge.bootInOverlay( 1, COMIC_ELEMENT_CONTROL.onImageSelect ); } else { - onImageSelect( data, true ); + COMIC_ELEMENT_CONTROL.onImageSelect( data, true ); + } + }, + onImageSelect: function( data, isPanelPictureData ){ + if( isPanelPictureData !== true ){ + data = { + resource_picture:data, + x: Math.floor( panelW /2 - data.width /2 ), + y: Math.floor( panelH /2 - data.height /2 ), + z: -1, + t: PANEL_ELEMENT_ARRAY.length, + width: data.width, + height: data.height + } } + var _panelElement = new ImageElementClass( data ); + _panelElement.init && _panelElement.init(); + appendComicElement( _panelElement ); + _panelElement.animate( undefined, undefined, data.width, data.height ); + SAVE( restoreComicElement, [ false, _panelElement], [ true, _panelElement], true ); }, createTextElement: function( data ){ var _panelElement; diff --git a/0.4.x/json/comics_1.json b/0.4.x/json/comics_1.json index 43259de..0d6049a 100644 --- a/0.4.x/json/comics_1.json +++ b/0.4.x/json/comics_1.json @@ -47,7 +47,7 @@ "height":151, "speaches_attributes":{ "newf2":{ - "content":"Hello", + "content":"Hello, world!", "x":-34, "y":35, "t":2, -- 2.11.0