/********************************************************************** * * * **********************************************************************/ define(function(require){ var module = {} //var DEBUG = DEBUG != null ? DEBUG : true var toggler = require('lib/toggler') var actions = require('lib/actions') var features = require('lib/features') var data = require('data') var images = require('images') var ribbons = require('ribbons') var core = require('features/core') var base = require('features/base') /*********************************************************************/ // XXX add setup / teardown... // XXX might be a good idea to merge this with single image mode... var makeStateIndicator = function(type){ return $('
') .addClass('state-indicator-container ' + type || '') } // XXX do we need this??? var makeStateIndicatorItem = function(container, type, text){ var item = $('
') .addClass('item '+ type || '') .attr('text', text) this.ribbons.viewer.find('.state-indicator-container.'+container) .append(item) return item } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // XXX revise how/where info is displayed... var StatusBarActions = actions.Actions({ config: { 'status-bar-mode': 'minimal', 'status-bar-modes': [ 'none', 'minimal', 'full' ], 'status-bar-items': [ 'index', 'gid', //'path', // separates left/right aligned elements... '---', 'mark', 'bookmark', ], // XXX not sure about this... 'status-bar-full-only': [ 'gid', 'path', ], }, __statusbar_elements__: { index: function(item, gid, img){ var that = this gid = gid || this.current // make an element... if(typeof(item) == typeof('str')){ var type = item item = $('') .addClass(type) .append($('') .addClass('position') .attr('info', 'Image position (click to edit image position)') .click(function(){ // XXX enter edit mode -> select contents... // XXX might be a good idea to live select // the indexed image... (???) //$(this) // .prop('contenteditable', true) // XXX })) .append($('') .addClass('length') .attr('info', 'Image position (click to toggle ribbon/global)') // toggle index state... .click(function(){ $(this).parent() .toggleClass('global') that.updateStatusBar() })) } else { var type = item.attr('type') } // update... // global index... if(item.hasClass('global')){ item.find('.position') .text(this.data.getImageOrder(gid)+1) item.find('.length') .text('/'+ this.data.length) // ribbon index... } else { item.find('.position') .text(this.data.getImageOrder('ribbon', gid)+1) item.find('.length') .text('/'+ this.data.getImages(gid).len) } return item }, // XXX handle path correctly... gid: function(item, gid, img){ var that = this gid = gid || this.current img = img || (this.images && gid in this.images && this.images[gid]) // make an element... if(typeof(item) == typeof('str')){ var type = item item = $('') .addClass(type + ' expanding-text ') .attr('info', type == 'gid' ? 'Image GID' : type == 'path'? 'Image filename/path' : '') .append($('')) .append($('