mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
minor fixes + Makefile update...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8276ea7689
commit
774fcf0413
@ -34,6 +34,7 @@ CSS_FILES := $(patsubst %.less,%.css,$(wildcard css/*.less))
|
|||||||
LIB_DIR=lib
|
LIB_DIR=lib
|
||||||
EXT_LIB_DIR=ext-lib
|
EXT_LIB_DIR=ext-lib
|
||||||
CSS_DIR=css
|
CSS_DIR=css
|
||||||
|
FEATURES_DIR=features
|
||||||
NW_PROJECT_FILE=package.json
|
NW_PROJECT_FILE=package.json
|
||||||
JS_FILES := $(wildcard *.js)
|
JS_FILES := $(wildcard *.js)
|
||||||
HTML_FILES := $(wildcard *.html)
|
HTML_FILES := $(wildcard *.html)
|
||||||
@ -48,7 +49,7 @@ LOGS := *.log
|
|||||||
NODE_DIR=node_modules
|
NODE_DIR=node_modules
|
||||||
BUILD_DIR=build
|
BUILD_DIR=build
|
||||||
CHROME_APP_BUILD_DIR=build/Chrome-App/ImageGrid.Viewer
|
CHROME_APP_BUILD_DIR=build/Chrome-App/ImageGrid.Viewer
|
||||||
WIN_BUILD_DIR=build/Win32
|
WIN_BUILD_DIR=build/Win
|
||||||
MAC_BUILD_DIR=build/MacOSX
|
MAC_BUILD_DIR=build/MacOSX
|
||||||
MAC_10_6_BUILD_DIR=build/MacOSX-10.6
|
MAC_10_6_BUILD_DIR=build/MacOSX-10.6
|
||||||
LINUX_IA32_BUILD_DIR=build/Linux-ia32
|
LINUX_IA32_BUILD_DIR=build/Linux-ia32
|
||||||
@ -108,8 +109,8 @@ $(DIST_DIR):
|
|||||||
|
|
||||||
$(APP_ZIP): $(CSS_FILES) $(BUILD_DIR) $(NODE_DIR) node-deps
|
$(APP_ZIP): $(CSS_FILES) $(BUILD_DIR) $(NODE_DIR) node-deps
|
||||||
zip -r $(APP_ZIP) $(NW_PROJECT_FILE) $(JS_FILES) $(CSS_FILES) \
|
zip -r $(APP_ZIP) $(NW_PROJECT_FILE) $(JS_FILES) $(CSS_FILES) \
|
||||||
$(HTML_FILES) $(LIB_DIR) $(EXT_LIB_DIR) $(CSS_DIR) \
|
$(HTML_FILES) $(LIB_DIR) $(EXT_LIB_DIR) $(FEATURES_DIR) \
|
||||||
$(NODE_DIR)
|
$(CSS_DIR) $(NODE_DIR)
|
||||||
|
|
||||||
zip: $(APP_ZIP)
|
zip: $(APP_ZIP)
|
||||||
|
|
||||||
@ -129,12 +130,12 @@ sharp: node-deps
|
|||||||
css: $(CSS_FILES)
|
css: $(CSS_FILES)
|
||||||
|
|
||||||
dev: css
|
dev: css
|
||||||
#unzip -uj $(wildcard targets/node-webkit/node-webkit-*-win-ia32.zip) -d .
|
#unzip -uj $(wildcard targets/nwjs/nwjs-*-win-ia32.zip) -d .
|
||||||
#rm -f nwsnapshot.exe credits.html
|
#rm -f nwsnapshot.exe credits.html
|
||||||
#chmod +x *.{exe,dll}
|
#chmod +x *.{exe,dll}
|
||||||
|
|
||||||
#dev-targets:
|
#dev-targets:
|
||||||
# mkdir -p targets/node-webkit
|
# mkdir -p targets/nwjs
|
||||||
# wget
|
# wget
|
||||||
|
|
||||||
|
|
||||||
@ -151,12 +152,12 @@ chrome-app: $(APP_ZIP) $(CHROME_APP_BUILD_DIR)
|
|||||||
# this needs to be OS independent...
|
# this needs to be OS independent...
|
||||||
chrome --pack-extension=$(CHROME_APP_BUILD_DIR) --pack-extension-key=$(CHROME_APP_KEY)
|
chrome --pack-extension=$(CHROME_APP_BUILD_DIR) --pack-extension-key=$(CHROME_APP_KEY)
|
||||||
|
|
||||||
# node-webkit win32
|
# nwjs win32
|
||||||
win32: $(APP_ZIP) $(WIN_BUILD_DIR)
|
win32: $(APP_ZIP) $(WIN_BUILD_DIR)
|
||||||
unzip -u targets/node-webkit/node-webkit-*-win-ia32.zip \
|
unzip -u targets/nwjs/nwjs-*-win-ia32.zip \
|
||||||
-d $(WIN_BUILD_DIR)
|
-d $(WIN_BUILD_DIR)
|
||||||
mv $(WIN_BUILD_DIR)/node-webkit*win-ia32/* $(WIN_BUILD_DIR)/
|
mv $(WIN_BUILD_DIR)/nwjs*win-ia32/* $(WIN_BUILD_DIR)/
|
||||||
rm -rf $(WIN_BUILD_DIR)/node-webkit*/
|
rm -rf $(WIN_BUILD_DIR)/nwjs*/
|
||||||
cat $(APP_ZIP) >> $(WIN_BUILD_DIR)/nw.exe
|
cat $(APP_ZIP) >> $(WIN_BUILD_DIR)/nw.exe
|
||||||
mv $(WIN_BUILD_DIR)/nw.exe $(WIN_BUILD_DIR)/$(APP_NAME).exe
|
mv $(WIN_BUILD_DIR)/nw.exe $(WIN_BUILD_DIR)/$(APP_NAME).exe
|
||||||
chmod +x $(WIN_BUILD_DIR)/*.{exe,dll}
|
chmod +x $(WIN_BUILD_DIR)/*.{exe,dll}
|
||||||
@ -171,18 +172,38 @@ win32-dist: win32 $(DIST_DIR)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# node-webkit mac
|
# nwjs win32
|
||||||
|
win64: $(APP_ZIP) $(WIN_BUILD_DIR)
|
||||||
|
unzip -u targets/nwjs/nwjs-*-win-x64.zip \
|
||||||
|
-d $(WIN_BUILD_DIR)
|
||||||
|
mv $(WIN_BUILD_DIR)/nwjs*win-x64/* $(WIN_BUILD_DIR)/
|
||||||
|
rm -rf $(WIN_BUILD_DIR)/nwjs*/
|
||||||
|
cat $(APP_ZIP) >> $(WIN_BUILD_DIR)/nw.exe
|
||||||
|
mv $(WIN_BUILD_DIR)/nw.exe $(WIN_BUILD_DIR)/$(APP_NAME).exe
|
||||||
|
chmod +x $(WIN_BUILD_DIR)/*.{exe,dll}
|
||||||
|
rm -f $(WIN_BUILD_DIR)/nwsnapshot.exe \
|
||||||
|
$(WIN_BUILD_DIR)/credits.html
|
||||||
|
|
||||||
|
win64-dist: win64 $(DIST_DIR)
|
||||||
|
# XXX include vips...
|
||||||
|
# XXX build and include gid, buldcache...
|
||||||
|
# XXX include scripts/utils...
|
||||||
|
zip -r $(WIN_DIST_ZIP) $(WIN_BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# nwjs mac
|
||||||
# XXX BUG: rebuilding without cleaning will mess up folders...
|
# XXX BUG: rebuilding without cleaning will mess up folders...
|
||||||
# XXX this is for 10.7+
|
# XXX this is for 10.7+
|
||||||
osx: $(APP_ZIP) $(MAC_BUILD_DIR) Info.plist
|
osx: $(APP_ZIP) $(MAC_BUILD_DIR) Info.plist
|
||||||
unzip -u $(wildcard targets/node-webkit/node-webkit-*-osx-ia32.zip) \
|
unzip -u $(wildcard targets/nwjs/nwjs-*-osx-ia32.zip) \
|
||||||
-d $(MAC_BUILD_DIR)
|
-d $(MAC_BUILD_DIR)
|
||||||
cp $(APP_ZIP) $(MAC_BUILD_DIR)/node-webkit.app/Contents/Resources/app.nw
|
cp $(APP_ZIP) $(MAC_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw
|
||||||
# XXX not sure if this is needed...
|
# XXX not sure if this is needed...
|
||||||
chmod +x $(MAC_BUILD_DIR)/node-webkit.app/Contents/Resources/app.nw
|
chmod +x $(MAC_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw
|
||||||
# XXX there is something wrong with the updated Info.plist, need to investigate...
|
# XXX there is something wrong with the updated Info.plist, need to investigate...
|
||||||
cp Info.plist $(MAC_BUILD_DIR)/node-webkit.app/Contents/
|
cp Info.plist $(MAC_BUILD_DIR)/nwjs.app/Contents/
|
||||||
mv $(MAC_BUILD_DIR)/node-webkit.app $(MAC_BUILD_DIR)/$(APP_NAME).app
|
mv $(MAC_BUILD_DIR)/nwjs.app $(MAC_BUILD_DIR)/$(APP_NAME).app
|
||||||
# XXX TODO: add real credits...
|
# XXX TODO: add real credits...
|
||||||
rm -f $(MAC_BUILD_DIR)/nwsnapshot \
|
rm -f $(MAC_BUILD_DIR)/nwsnapshot \
|
||||||
$(MAC_BUILD_DIR)/credits.html
|
$(MAC_BUILD_DIR)/credits.html
|
||||||
@ -190,14 +211,14 @@ osx: $(APP_ZIP) $(MAC_BUILD_DIR) Info.plist
|
|||||||
# XXX this is almost identical to osx...
|
# XXX this is almost identical to osx...
|
||||||
# XXX BUG: rebuilding without cleaning will mess up folders...
|
# XXX BUG: rebuilding without cleaning will mess up folders...
|
||||||
osx-10.6: $(APP_ZIP) $(MAC_10_6_BUILD_DIR) Info.plist
|
osx-10.6: $(APP_ZIP) $(MAC_10_6_BUILD_DIR) Info.plist
|
||||||
unzip -u $(wildcard targets/node-webkit/node-webkit-*-osx10.6-ia32.zip) \
|
unzip -u $(wildcard targets/nwjs/nwjs-*-osx10.6-ia32.zip) \
|
||||||
-d $(MAC_10_6_BUILD_DIR)
|
-d $(MAC_10_6_BUILD_DIR)
|
||||||
cp $(APP_ZIP) $(MAC_10_6_BUILD_DIR)/node-webkit.app/Contents/Resources/app.nw
|
cp $(APP_ZIP) $(MAC_10_6_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw
|
||||||
# XXX not sure if this is needed...
|
# XXX not sure if this is needed...
|
||||||
chmod +x $(MAC_10_6_BUILD_DIR)/node-webkit.app/Contents/Resources/app.nw
|
chmod +x $(MAC_10_6_BUILD_DIR)/nwjs.app/Contents/Resources/app.nw
|
||||||
# XXX there is something wrong with the updated Info.plist, need to investigate...
|
# XXX there is something wrong with the updated Info.plist, need to investigate...
|
||||||
cp Info.plist $(MAC_10_6_BUILD_DIR)/node-webkit.app/Contents/
|
cp Info.plist $(MAC_10_6_BUILD_DIR)/nwjs.app/Contents/
|
||||||
mv $(MAC_10_6_BUILD_DIR)/node-webkit.app $(MAC_10_6_BUILD_DIR)/$(APP_NAME).app
|
mv $(MAC_10_6_BUILD_DIR)/nwjs.app $(MAC_10_6_BUILD_DIR)/$(APP_NAME).app
|
||||||
# XXX TODO: add real credits...
|
# XXX TODO: add real credits...
|
||||||
rm -f $(MAC_10_6_BUILD_DIR)/nwsnapshot \
|
rm -f $(MAC_10_6_BUILD_DIR)/nwsnapshot \
|
||||||
$(MAC_10_6_BUILD_DIR)/credits.html
|
$(MAC_10_6_BUILD_DIR)/credits.html
|
||||||
@ -212,10 +233,10 @@ osx-10.6-dist: osx $(DIST_DIR)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# node-webkit linux-ia32
|
# nwjs linux-ia32
|
||||||
linux-ia32: $(APP_ZIP) $(LINUX_IA32_BUILD_DIR)
|
linux-ia32: $(APP_ZIP) $(LINUX_IA32_BUILD_DIR)
|
||||||
tar --strip-components 1 \
|
tar --strip-components 1 \
|
||||||
-xzf $(wildcard targets/node-webkit/node-webkit-*-linux-ia32.tar.gz) \
|
-xzf $(wildcard targets/nwjs/nwjs-*-linux-ia32.tar.gz) \
|
||||||
-C $(LINUX_IA32_BUILD_DIR)
|
-C $(LINUX_IA32_BUILD_DIR)
|
||||||
cat $(APP_ZIP) >> $(LINUX_IA32_BUILD_DIR)/nw
|
cat $(APP_ZIP) >> $(LINUX_IA32_BUILD_DIR)/nw
|
||||||
mv $(LINUX_IA32_BUILD_DIR)/nw $(LINUX_IA32_BUILD_DIR)/$(APP_NAME)
|
mv $(LINUX_IA32_BUILD_DIR)/nw $(LINUX_IA32_BUILD_DIR)/$(APP_NAME)
|
||||||
@ -229,10 +250,10 @@ linux-ia32-dist: linux-ia32 $(DIST_DIR)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# node-webkit linux-x64
|
# nwjs linux-x64
|
||||||
linux-x64: $(APP_ZIP) $(LINUX_X64_BUILD_DIR)
|
linux-x64: $(APP_ZIP) $(LINUX_X64_BUILD_DIR)
|
||||||
tar --strip-components 1 \
|
tar --strip-components 1 \
|
||||||
-xzf $(wildcard targets/node-webkit/node-webkit-*-linux-x64.tar.gz) \
|
-xzf $(wildcard targets/nwjs/nwjs-*-linux-x64.tar.gz) \
|
||||||
-C $(LINUX_X64_BUILD_DIR)
|
-C $(LINUX_X64_BUILD_DIR)
|
||||||
cat $(APP_ZIP) >> $(LINUX_X64_BUILD_DIR)/nw
|
cat $(APP_ZIP) >> $(LINUX_X64_BUILD_DIR)/nw
|
||||||
mv $(LINUX_X64_BUILD_DIR)/nw $(LINUX_X64_BUILD_DIR)/$(APP_NAME)
|
mv $(LINUX_X64_BUILD_DIR)/nw $(LINUX_X64_BUILD_DIR)/$(APP_NAME)
|
||||||
@ -250,9 +271,9 @@ linux-x64-dist: linux-x64 $(DIST_DIR)
|
|||||||
# XXX iOS...
|
# XXX iOS...
|
||||||
|
|
||||||
|
|
||||||
all: win32 osx osx-10.6 linux-ia32 linux-x64
|
all: win64 win32 osx osx-10.6 linux-ia32 linux-x64
|
||||||
|
|
||||||
dist: win32-dist osx-dist
|
dist: win64-dist win32-dist osx-dist
|
||||||
|
|
||||||
|
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|||||||
@ -21,8 +21,6 @@ var core = require('features/core')
|
|||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
// Helpers and meta stuff...
|
// Helpers and meta stuff...
|
||||||
|
|
||||||
// mode can be:
|
// mode can be:
|
||||||
@ -53,6 +51,7 @@ function(direction, dfl_tag){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
// XXX split this into read and write actions...
|
// XXX split this into read and write actions...
|
||||||
|
|||||||
@ -12,6 +12,7 @@ var actions = require('lib/actions')
|
|||||||
var features = require('lib/features')
|
var features = require('lib/features')
|
||||||
|
|
||||||
var core = require('features/core')
|
var core = require('features/core')
|
||||||
|
var widgets = require('features/ui-widgets')
|
||||||
|
|
||||||
var overlay = require('lib/widget/overlay')
|
var overlay = require('lib/widget/overlay')
|
||||||
var browse = require('lib/widget/browse')
|
var browse = require('lib/widget/browse')
|
||||||
@ -399,7 +400,7 @@ var URLHistoryUIActions = actions.Actions({
|
|||||||
// XXX need to check items...
|
// XXX need to check items...
|
||||||
// XXX use svg icons for buttons...
|
// XXX use svg icons for buttons...
|
||||||
listURLHistory: ['History|File/Show history',
|
listURLHistory: ['History|File/Show history',
|
||||||
function(){
|
widgets.makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
var parent = this.preventClosing ? this.preventClosing() : null
|
var parent = this.preventClosing ? this.preventClosing() : null
|
||||||
var cur = this.location.path
|
var cur = this.location.path
|
||||||
@ -418,66 +419,65 @@ var URLHistoryUIActions = actions.Actions({
|
|||||||
to_remove = []
|
to_remove = []
|
||||||
}
|
}
|
||||||
|
|
||||||
var o = overlay.Overlay(this.ribbons.viewer,
|
var o = browse.makeList(
|
||||||
browse.makeList(
|
null,
|
||||||
null,
|
Object.keys(this.url_history)
|
||||||
Object.keys(this.url_history)
|
.reverse()
|
||||||
.reverse()
|
// NOTE: this might get a little slow for
|
||||||
// NOTE: this might get a little slow for
|
// very large sets...
|
||||||
// very large sets...
|
.map(function(p){
|
||||||
.map(function(p){
|
return !that.checkURLFromHistory(p) ?
|
||||||
return !that.checkURLFromHistory(p) ?
|
'- ' + p
|
||||||
'- ' + p
|
: p
|
||||||
: p
|
}),
|
||||||
}),
|
{
|
||||||
{
|
// add item buttons...
|
||||||
// add item buttons...
|
itemButtons: [
|
||||||
itemButtons: [
|
// move to top...
|
||||||
// move to top...
|
['♦',
|
||||||
['♦',
|
function(p){
|
||||||
function(p){
|
var top = this.filter('*', false).first()
|
||||||
var top = this.filter('*', false).first()
|
var cur = this.filter('"'+p+'"', false)
|
||||||
var cur = this.filter('"'+p+'"', false)
|
|
||||||
|
|
||||||
console.log('!!!', p)
|
console.log('!!!', p)
|
||||||
|
|
||||||
if(!top.is(cur)){
|
if(!top.is(cur)){
|
||||||
top.before(cur)
|
top.before(cur)
|
||||||
that.setTopURLHistory(p)
|
that.setTopURLHistory(p)
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
// mark for removal...
|
||||||
|
['×',
|
||||||
|
function(p){
|
||||||
|
var e = this.filter('"'+p+'"', false)
|
||||||
|
.toggleClass('strike-out')
|
||||||
|
|
||||||
|
if(e.hasClass('strike-out')){
|
||||||
|
to_remove.indexOf(p) < 0
|
||||||
|
&& to_remove.push(p)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var i = to_remove.indexOf(p)
|
||||||
|
if(i >= 0){
|
||||||
|
to_remove.splice(i, 1)
|
||||||
}
|
}
|
||||||
}],
|
}
|
||||||
// mark for removal...
|
}],
|
||||||
['×',
|
],
|
||||||
function(p){
|
})
|
||||||
var e = this.filter('"'+p+'"', false)
|
.open(function(evt, path){
|
||||||
.toggleClass('strike-out')
|
removeStriked('open')
|
||||||
|
|
||||||
if(e.hasClass('strike-out')){
|
o.parent.close()
|
||||||
to_remove.indexOf(p) < 0
|
|
||||||
&& to_remove.push(p)
|
|
||||||
|
|
||||||
} else {
|
// close the parent ui...
|
||||||
var i = to_remove.indexOf(p)
|
parent
|
||||||
if(i >= 0){
|
&& parent.close
|
||||||
to_remove.splice(i, 1)
|
&& parent.close()
|
||||||
}
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
],
|
|
||||||
})
|
|
||||||
.open(function(evt, path){
|
|
||||||
removeStriked('open')
|
|
||||||
|
|
||||||
o.close()
|
that.openURLFromHistory(path)
|
||||||
|
})
|
||||||
// close the parent ui...
|
.on('close', function(){
|
||||||
parent
|
|
||||||
&& parent.close
|
|
||||||
&& parent.close()
|
|
||||||
|
|
||||||
that.openURLFromHistory(path)
|
|
||||||
}))
|
|
||||||
.close(function(){
|
|
||||||
removeStriked('close')
|
removeStriked('close')
|
||||||
|
|
||||||
parent
|
parent
|
||||||
@ -485,21 +485,19 @@ var URLHistoryUIActions = actions.Actions({
|
|||||||
&& parent.focus()
|
&& parent.focus()
|
||||||
})
|
})
|
||||||
|
|
||||||
var list = o.client
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Object.keys(this.url_history).reverse().forEach(function(p){
|
Object.keys(this.url_history).reverse().forEach(function(p){
|
||||||
that.checkURLFromHistory(p) || list.filter(p).addClass('disabled')
|
that.checkURLFromHistory(p) || o.filter(p).addClass('disabled')
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// select and highlight current path...
|
// select and highlight current path...
|
||||||
cur && list
|
cur && o
|
||||||
.select('"'+ cur +'"')
|
.select('"'+ cur +'"')
|
||||||
.addClass('highlighted')
|
.addClass('highlighted')
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}],
|
})],
|
||||||
})
|
})
|
||||||
|
|
||||||
var URLHistoryUI =
|
var URLHistoryUI =
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var features = require('lib/features')
|
|||||||
var toggler = require('lib/toggler')
|
var toggler = require('lib/toggler')
|
||||||
|
|
||||||
var core = require('features/core')
|
var core = require('features/core')
|
||||||
|
var widgets = require('features/ui-widgets')
|
||||||
|
|
||||||
var overlay = require('lib/widget/overlay')
|
var overlay = require('lib/widget/overlay')
|
||||||
var browse = require('lib/widget/browse')
|
var browse = require('lib/widget/browse')
|
||||||
@ -372,7 +373,7 @@ module.Sort = core.ImageGridFeatures.Feature({
|
|||||||
var SortUIActions = actions.Actions({
|
var SortUIActions = actions.Actions({
|
||||||
// XXX should we be able to edit modes???
|
// XXX should we be able to edit modes???
|
||||||
sortDialog: ['Edit|Sort/Sort images...',
|
sortDialog: ['Edit|Sort/Sort images...',
|
||||||
function(){
|
widgets.makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
var dfl = this.config['default-sort']
|
var dfl = this.config['default-sort']
|
||||||
@ -389,54 +390,54 @@ var SortUIActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var o = overlay.Overlay(this.ribbons.viewer,
|
var o = browse.makeLister(null, function(path, make){
|
||||||
browse.makeLister(null, function(path, make){
|
var lister = this
|
||||||
var cur = that.toggleImageSort('?')
|
var cur = that.toggleImageSort('?')
|
||||||
|
|
||||||
that.toggleImageSort('??').forEach(function(mode){
|
that.toggleImageSort('??').forEach(function(mode){
|
||||||
// skip 'none'...
|
// skip 'none'...
|
||||||
if(mode == 'none'){
|
if(mode == 'none'){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
make(mode)
|
make(mode)
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
that.toggleImageSort(null, mode,
|
that.toggleImageSort(null, mode,
|
||||||
that.config['default-sort-order'] == 'reverse')
|
that.config['default-sort-order'] == 'reverse')
|
||||||
o.close()
|
lister.parent.close()
|
||||||
})
|
})
|
||||||
.addClass(mode == cur ? 'highlighted' : '')
|
.addClass(mode == cur ? 'highlighted' : '')
|
||||||
.addClass(mode == dfl ? 'default' : '')
|
.addClass(mode == dfl ? 'default' : '')
|
||||||
|
})
|
||||||
|
|
||||||
|
// Commands...
|
||||||
|
make('---')
|
||||||
|
|
||||||
|
make('Reverse images')
|
||||||
|
.on('open', function(){
|
||||||
|
that.reverseImages()
|
||||||
|
lister.parent.close()
|
||||||
})
|
})
|
||||||
|
/*
|
||||||
|
make('Reverse ribbons')
|
||||||
|
.on('open', function(){
|
||||||
|
that.reverseRibbons()
|
||||||
|
o.close()
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
// Commands...
|
// Settings...
|
||||||
make('---')
|
make('---')
|
||||||
|
|
||||||
make('Reverse images')
|
make(['Default order: ', that.config['default-sort-order'] || 'ascending'])
|
||||||
.on('open', function(){
|
.on('open', _makeTogglHandler('toggleDefaultSortOrder'))
|
||||||
that.reverseImages()
|
.addClass('item-value-view')
|
||||||
o.close()
|
})
|
||||||
})
|
|
||||||
/*
|
|
||||||
make('Reverse ribbons')
|
|
||||||
.on('open', function(){
|
|
||||||
that.reverseRibbons()
|
|
||||||
o.close()
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Settings...
|
|
||||||
make('---')
|
|
||||||
|
|
||||||
make(['Default order: ', that.config['default-sort-order'] || 'ascending'])
|
|
||||||
.on('open', _makeTogglHandler('toggleDefaultSortOrder'))
|
|
||||||
.addClass('item-value-view')
|
|
||||||
}))
|
|
||||||
|
|
||||||
// select the current order...
|
// select the current order...
|
||||||
o.client.select('"' + this.toggleImageSort('?') + '"')
|
o.select('"' + this.toggleImageSort('?') + '"')
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}]
|
})]
|
||||||
})
|
})
|
||||||
|
|
||||||
var SortUI =
|
var SortUI =
|
||||||
|
|||||||
@ -202,6 +202,9 @@ var SingleImageActions = actions.Actions({
|
|||||||
|
|
||||||
// NOTE: setting this to null or to -1 will disable the feature...
|
// NOTE: setting this to null or to -1 will disable the feature...
|
||||||
'single-image-proportions-threshold': 2,
|
'single-image-proportions-threshold': 2,
|
||||||
|
|
||||||
|
// XXX HACK...
|
||||||
|
'-single-image-redraw-on-focus': true,
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSingleImage: ['Interface/Toggle single image view',
|
toggleSingleImage: ['Interface/Toggle single image view',
|
||||||
@ -211,6 +214,11 @@ var SingleImageActions = actions.Actions({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// XXX HACK: we are forcing redraw of images in some conditions (when
|
||||||
|
// they are close to their original size) to compensate for chrome
|
||||||
|
// rendering them blurry off screen in these conditions...
|
||||||
|
// XXX I would not bother and leave this as-is but this makes the
|
||||||
|
// image jump in size slightly when redrawing...
|
||||||
var SingleImageView =
|
var SingleImageView =
|
||||||
module.SingleImageView = core.ImageGridFeatures.Feature({
|
module.SingleImageView = core.ImageGridFeatures.Feature({
|
||||||
title: '',
|
title: '',
|
||||||
@ -235,7 +243,18 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
|||||||
// ...if needed do a .reload() / ctrl-r
|
// ...if needed do a .reload() / ctrl-r
|
||||||
['focusImage',
|
['focusImage',
|
||||||
function(){
|
function(){
|
||||||
if(this.toggleSingleImage('?') == 'on'){
|
var img = this.ribbons.getImage()
|
||||||
|
var d = Math.max(img.attr('preview-width')*1, img.attr('preview-width')*1)
|
||||||
|
var D = this.ribbons.getVisibleImageSize('max')
|
||||||
|
|
||||||
|
if(this.config['-single-image-redraw-on-focus']
|
||||||
|
// NOTE: redraw only when close to original preview
|
||||||
|
// size -- this is where chrome cheats and
|
||||||
|
// shows images blurry...
|
||||||
|
// XXX this causes some images to jump a bit, aligning
|
||||||
|
// to nearest pixel might fix this...
|
||||||
|
&& Math.abs(D-d)/D < 0.30
|
||||||
|
&& this.toggleSingleImage('?') == 'on'){
|
||||||
this.scale = this.scale
|
this.scale = this.scale
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|||||||
@ -47,8 +47,10 @@ var SlideshowActions = actions.Actions({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// XXX use widgets.makeNestedConfigListEditor(...)???
|
// XXX use widgets.makeNestedConfigListEditor(...)???
|
||||||
slideshowIntervalDialog: ['Slideshow/Slideshow interval',
|
slideshowIntervalDialog: ['Slideshow/Slideshow interval...',
|
||||||
function(){
|
// XXX using both widgets.makeUIDialog(..) and widgets.makeConfigListEditor(..)
|
||||||
|
// is a bit too complicated...
|
||||||
|
widgets.makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
// suspend the timer if it's not suspended outside...
|
// suspend the timer if it's not suspended outside...
|
||||||
@ -68,25 +70,28 @@ var SlideshowActions = actions.Actions({
|
|||||||
callback: function(value){
|
callback: function(value){
|
||||||
that.config['slideshow-interval'] = value
|
that.config['slideshow-interval'] = value
|
||||||
|
|
||||||
o.close()
|
o.parent.close()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.close(function(){
|
.on('close', function(){
|
||||||
// reset the timer if it was not suspended outside...
|
// reset the timer if it was not suspended outside...
|
||||||
suspended_timer || that.resetSlideshowTimer()
|
suspended_timer || that.resetSlideshowTimer()
|
||||||
})
|
})
|
||||||
|
|
||||||
o.client.select(that.config['slideshow-interval'])
|
// XXX HACK: without a setTimeout(..) this will not select...
|
||||||
|
setTimeout(function(){
|
||||||
|
o.select(that.config['slideshow-interval'])
|
||||||
|
}, 0)
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}],
|
})],
|
||||||
// XXX BUG: there are still problems with focus...
|
// XXX BUG: there are still problems with focus...
|
||||||
// to reproduce:
|
// to reproduce:
|
||||||
// click on the first option with a mouse...
|
// click on the first option with a mouse...
|
||||||
// result:
|
// result:
|
||||||
// the top dialog is not focused...
|
// the top dialog is not focused...
|
||||||
slideshowDialog: ['Slideshow/Slideshow settings and start',
|
slideshowDialog: ['Slideshow/Slideshow settings and start...',
|
||||||
function(){
|
widgets.makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
// suspend the timer if it's not suspended outside...
|
// suspend the timer if it's not suspended outside...
|
||||||
@ -98,42 +103,38 @@ var SlideshowActions = actions.Actions({
|
|||||||
return function(){
|
return function(){
|
||||||
var txt = $(this).find('.text').first().text()
|
var txt = $(this).find('.text').first().text()
|
||||||
that[toggler]()
|
that[toggler]()
|
||||||
o.client.update()
|
o.update()
|
||||||
.then(function(){ o.client.select(txt) })
|
.then(function(){ o.select(txt) })
|
||||||
that.toggleSlideshow('?') == 'on'
|
that.toggleSlideshow('?') == 'on'
|
||||||
&& o.close()
|
&& o.parent.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var o = overlay.Overlay(this.ribbons.viewer,
|
var o = browse.makeLister(null, function(path, make){
|
||||||
browse.makeLister(null, function(path, make){
|
|
||||||
make(['Interval: ',
|
make(['Interval: ',
|
||||||
function(){ return that.config['slideshow-interval'] }])
|
function(){ return that.config['slideshow-interval'] }])
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
var txt = $(this).find('.text').first().text()
|
var txt = $(this).find('.text').first().text()
|
||||||
|
|
||||||
var oo = that.slideshowIntervalDialog()
|
var oo = that.slideshowIntervalDialog()
|
||||||
.close(function(){
|
.on('close', function(){
|
||||||
// slideshow is running -- close directly...
|
// slideshow is running -- close directly...
|
||||||
if(that.toggleSlideshow('?') == 'on'){
|
if(that.toggleSlideshow('?') == 'on'){
|
||||||
o.close()
|
o.parent.close()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
o.client.update()
|
o.update()
|
||||||
.then(function(){
|
.then(function(){
|
||||||
o.client.select(txt)
|
o.select(txt)
|
||||||
|
|
||||||
// XXX this is ugly...
|
|
||||||
o.focus()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// update slideshow menu...
|
// update slideshow menu...
|
||||||
oo.client.open(function(){
|
oo.client.open(function(){
|
||||||
o.client.update()
|
o.update()
|
||||||
.then(function(){
|
.then(function(){
|
||||||
o.client.select(txt)
|
o.select(txt)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -150,19 +151,19 @@ var SlideshowActions = actions.Actions({
|
|||||||
return that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start' }])
|
return that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start' }])
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
that.toggleSlideshow()
|
that.toggleSlideshow()
|
||||||
o.close()
|
o.parent.close()
|
||||||
})
|
})
|
||||||
}))
|
})
|
||||||
.close(function(){
|
.on('close', function(){
|
||||||
// reset the timer if it was not suspended outside...
|
// reset the timer if it was not suspended outside...
|
||||||
suspended_timer || that.resetSlideshowTimer()
|
suspended_timer || that.resetSlideshowTimer()
|
||||||
})
|
})
|
||||||
|
|
||||||
o.client.dom.addClass('metadata-view tail-action')
|
o.dom.addClass('metadata-view tail-action')
|
||||||
o.client.select(-1)
|
o.select(-1)
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}],
|
})],
|
||||||
|
|
||||||
toggleSlideshowDirection: ['- Slideshow/Slideshow direction',
|
toggleSlideshowDirection: ['- Slideshow/Slideshow direction',
|
||||||
core.makeConfigToggler('slideshow-direction', ['forward', 'reverse'])],
|
core.makeConfigToggler('slideshow-direction', ['forward', 'reverse'])],
|
||||||
|
|||||||
@ -205,9 +205,7 @@ function(actions, list_key, options){
|
|||||||
options.callback && options.callback.call(list, path)
|
options.callback && options.callback.call(list, path)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.on('close', function(){
|
||||||
var o = overlay.Overlay(actions.ribbons.viewer, list)
|
|
||||||
.close(function(){
|
|
||||||
// prevent editing non-arrays...
|
// prevent editing non-arrays...
|
||||||
if(!(actions.config[list_key] instanceof Array)){
|
if(!(actions.config[list_key] instanceof Array)){
|
||||||
return
|
return
|
||||||
@ -230,7 +228,7 @@ function(actions, list_key, options){
|
|||||||
|
|
||||||
new_button && list.dom.addClass('tail-action')
|
new_button && list.dom.addClass('tail-action')
|
||||||
|
|
||||||
return o
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -284,17 +282,140 @@ function(actions, parent, list_key, value_key, options){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************/
|
||||||
|
// Dialogs and containers...
|
||||||
|
|
||||||
|
var makeUIContainer =
|
||||||
|
module.makeUIContainer = function(make){
|
||||||
|
var f = function(dialog){
|
||||||
|
var o = make.call(this, dialog)
|
||||||
|
|
||||||
|
// prevent the client event from bubbling up...
|
||||||
|
// XXX is this the right way to go???
|
||||||
|
o.client.on('close', function(evt){ evt.stopPropagation() })
|
||||||
|
|
||||||
|
// notify the client that we are closing...
|
||||||
|
o.close(function(){ o.client.trigger('close') })
|
||||||
|
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
f.__container__ = true
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
var makeUIDialog =
|
||||||
|
module.makeUIDialog = function(make){
|
||||||
|
var f = function(){
|
||||||
|
var args = [].slice.call(arguments)
|
||||||
|
|
||||||
|
// see if the first arg is a container spec...
|
||||||
|
var container = this.uiContainers.indexOf(args[0]) >= 0 ?
|
||||||
|
args.shift()
|
||||||
|
: (this.config['ui-default-container'] || 'Overlay')
|
||||||
|
|
||||||
|
return this[container](make.apply(this, args))
|
||||||
|
}
|
||||||
|
f.__dialog__ = true
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
var DialogsActions = actions.Actions({
|
||||||
|
config: {
|
||||||
|
'ui-default-container': 'Overlay',
|
||||||
|
},
|
||||||
|
|
||||||
|
// a bit of introspection...
|
||||||
|
get uiContainers(){
|
||||||
|
return this.actions.filter(this.isUIContainer.bind(this)) },
|
||||||
|
get uiDialogs(){
|
||||||
|
return this.actions.filter(this.isUIDialog.bind(this)) },
|
||||||
|
get uiElements(){
|
||||||
|
return this.actions.filter(this.isUIElement.bind(this)) },
|
||||||
|
|
||||||
|
// get top overlay and overlay client...
|
||||||
|
get overlay(){
|
||||||
|
return overlay.getOverlay(this.viewer) },
|
||||||
|
|
||||||
|
// testers...
|
||||||
|
isUIContainer: ['- Interface/',
|
||||||
|
actions.doWithRootAction(function(action){
|
||||||
|
return action.__container__ == true })],
|
||||||
|
isUIDialog: ['- Interface/',
|
||||||
|
actions.doWithRootAction(function(action){
|
||||||
|
return action.__dialog__ == true })],
|
||||||
|
isUIElement: ['- Interface/',
|
||||||
|
actions.doWithRootAction(function(action){
|
||||||
|
return action.__dialog__ == true || action.__container__ == true })],
|
||||||
|
|
||||||
|
|
||||||
|
// container constructors...
|
||||||
|
// NOTE: there are not intended for direct use...
|
||||||
|
Overlay: ['- Interface/',
|
||||||
|
makeUIContainer(function(dialog){
|
||||||
|
var that = this
|
||||||
|
return overlay.Overlay(this.ribbons.viewer, dialog)
|
||||||
|
// XXX focus parent on exit...
|
||||||
|
.on('close', function(){
|
||||||
|
var o = that.overlay
|
||||||
|
|
||||||
|
o && o.focus()
|
||||||
|
})
|
||||||
|
})],
|
||||||
|
// XXX
|
||||||
|
Panel: ['- Interface/',
|
||||||
|
makeUIContainer(function(dialog){
|
||||||
|
// XXX
|
||||||
|
})],
|
||||||
|
|
||||||
|
|
||||||
|
listDialogs: ['Interface/List dialogs...',
|
||||||
|
makeUIDialog(function(){
|
||||||
|
var actions = this
|
||||||
|
|
||||||
|
return browse.makeLister(null, function(path, make){
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
actions.uiDialogs.forEach(function(dialog){
|
||||||
|
make(actions.getDoc(dialog)[dialog][0].replace(/^- (.*)$/, '$1 (disabled)'))
|
||||||
|
.on('open', function(){
|
||||||
|
actions[dialog]()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
})],
|
||||||
|
})
|
||||||
|
|
||||||
|
var Dialogs =
|
||||||
|
module.Dialogs = core.ImageGridFeatures.Feature({
|
||||||
|
title: '',
|
||||||
|
doc: '',
|
||||||
|
|
||||||
|
tag: 'ui-dialogs',
|
||||||
|
depends: [
|
||||||
|
'ui',
|
||||||
|
],
|
||||||
|
|
||||||
|
actions: DialogsActions,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
// NOTE: if the action returns an instance of overlay.Overlay this will
|
// NOTE: if the action returns an instance of overlay.Overlay this will
|
||||||
// not close right away but rather bind to:
|
// not close right away but rather bind to:
|
||||||
// overlay.close -> self.focus()
|
// overlay.close -> self.focus()
|
||||||
// overlay.client.open -> self.close()
|
// overlay.client.open -> self.close()
|
||||||
|
// XXX revise this...
|
||||||
var makeActionLister = function(list, filter, pre_order){
|
var makeActionLister = function(list, filter, pre_order){
|
||||||
pre_order = typeof(filter) == typeof(true) ? filter : pre_order
|
pre_order = typeof(filter) == typeof(true) ? filter : pre_order
|
||||||
filter = typeof(filter) == typeof(true) ? null : filter
|
filter = typeof(filter) == typeof(true) ? null : filter
|
||||||
|
|
||||||
return function(path, inline_state){
|
return makeUIDialog(function(path, inline_state){
|
||||||
inline_state = inline_state == null ?
|
inline_state = inline_state == null ?
|
||||||
this.config['actions-list-show-toggler-state-inline']
|
this.config['actions-list-show-toggler-state-inline']
|
||||||
: inline_state
|
: inline_state
|
||||||
@ -302,7 +423,7 @@ var makeActionLister = function(list, filter, pre_order){
|
|||||||
var that = this
|
var that = this
|
||||||
var paths = this.getPath()
|
var paths = this.getPath()
|
||||||
var actions = {}
|
var actions = {}
|
||||||
var o
|
var d
|
||||||
|
|
||||||
// pre-order the main categories...
|
// pre-order the main categories...
|
||||||
if(pre_order){
|
if(pre_order){
|
||||||
@ -331,9 +452,9 @@ var makeActionLister = function(list, filter, pre_order){
|
|||||||
if(child instanceof overlay.Overlay){
|
if(child instanceof overlay.Overlay){
|
||||||
closingPrevented = true
|
closingPrevented = true
|
||||||
child
|
child
|
||||||
.on('close', function(){ o.focus() })
|
.on('close', function(){ d.parent.focus() })
|
||||||
.client
|
.client
|
||||||
.on('open', function(){ o.close() })
|
.on('open', function(){ d.parent.close() })
|
||||||
}
|
}
|
||||||
return child
|
return child
|
||||||
}
|
}
|
||||||
@ -368,7 +489,7 @@ var makeActionLister = function(list, filter, pre_order){
|
|||||||
/*
|
/*
|
||||||
closingPrevented = true
|
closingPrevented = true
|
||||||
// XXX need to re-render the overlay paths...
|
// XXX need to re-render the overlay paths...
|
||||||
that.getOverlay().client
|
that.overlay.client
|
||||||
.pop()
|
.pop()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -379,30 +500,25 @@ var makeActionLister = function(list, filter, pre_order){
|
|||||||
var config = Object.create(that.config['browse-actions-settings'] || {})
|
var config = Object.create(that.config['browse-actions-settings'] || {})
|
||||||
config.path = path
|
config.path = path
|
||||||
|
|
||||||
// XXX get the correct parent...
|
d = list(null, actions, config)
|
||||||
o = overlay.Overlay(that.ribbons.viewer,
|
.open(function(evt){
|
||||||
list(null, actions, config)
|
if(!closingPrevented){
|
||||||
.open(function(evt){
|
d.parent.close()
|
||||||
if(!closingPrevented){
|
}
|
||||||
o.close()
|
closingPrevented = false
|
||||||
}
|
})
|
||||||
closingPrevented = false
|
|
||||||
}))
|
|
||||||
// save show disabled state to .config...
|
// save show disabled state to .config...
|
||||||
.close(function(){
|
.on('close', function(){
|
||||||
var config = that.config['browse-actions-settings']
|
var config = that.config['browse-actions-settings']
|
||||||
|
|
||||||
config.showDisabled = o.client.options.showDisabled
|
config.showDisabled = d.options.showDisabled
|
||||||
})
|
})
|
||||||
|
|
||||||
// XXX DEBUG
|
return d
|
||||||
//window.LIST = o.client
|
})
|
||||||
|
|
||||||
//return o.client
|
|
||||||
return o
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: yes, this is a funny name ;)
|
||||||
var BrowseActionsActions = actions.Actions({
|
var BrowseActionsActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
// NOTE: the slashes at the end are significant, of they are not
|
// NOTE: the slashes at the end are significant, of they are not
|
||||||
@ -422,16 +538,9 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX move this to a generic modal overlay feature...
|
browseActions: ['Interface/Browse actions...',
|
||||||
getOverlay: ['- Interface/Get overlay object',
|
|
||||||
function(o){
|
|
||||||
return overlay.getOverlay(o || this.viewer)
|
|
||||||
}],
|
|
||||||
|
|
||||||
|
|
||||||
browseActions: ['Interface/Browse actions',
|
|
||||||
makeActionLister(browse.makePathList, true)],
|
makeActionLister(browse.makePathList, true)],
|
||||||
listActions:['Interface/List actions',
|
listActions:['Interface/List actions...',
|
||||||
makeActionLister(browse.makeList,
|
makeActionLister(browse.makeList,
|
||||||
// format the doc to: <name> (<category>, ..)
|
// format the doc to: <name> (<category>, ..)
|
||||||
// NOTE: this a bit naive...
|
// NOTE: this a bit naive...
|
||||||
@ -450,7 +559,8 @@ module.BrowseActions = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
tag: 'ui-browse-actions',
|
tag: 'ui-browse-actions',
|
||||||
depends: [
|
depends: [
|
||||||
'ui'
|
'ui',
|
||||||
|
'ui-dialogs',
|
||||||
],
|
],
|
||||||
|
|
||||||
actions: BrowseActionsActions,
|
actions: BrowseActionsActions,
|
||||||
@ -510,6 +620,46 @@ module.ContextActionMenu = core.ImageGridFeatures.Feature({
|
|||||||
// XXX make this not applicable to production...
|
// XXX make this not applicable to production...
|
||||||
|
|
||||||
var WidgetTestActions = actions.Actions({
|
var WidgetTestActions = actions.Actions({
|
||||||
|
|
||||||
|
testBrowse: ['- Test/Demo new style dialog...',
|
||||||
|
makeUIDialog(function(){
|
||||||
|
var actions = this
|
||||||
|
|
||||||
|
console.log('>>> args:', [].slice.call(arguments))
|
||||||
|
|
||||||
|
return browse.makeLister(null, function(path, make){
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
make('select last')
|
||||||
|
.on('open', function(){
|
||||||
|
that.select(-1)
|
||||||
|
})
|
||||||
|
|
||||||
|
make('do nothing')
|
||||||
|
|
||||||
|
make('nested dialog...')
|
||||||
|
.on('open', function(){
|
||||||
|
actions.testBrowse()
|
||||||
|
})
|
||||||
|
|
||||||
|
make('---')
|
||||||
|
|
||||||
|
make('close parent')
|
||||||
|
.on('open', function(){
|
||||||
|
that.parent.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
// XXX the parent is not yet set at this point...
|
||||||
|
//console.log('>>>', that.parent)
|
||||||
|
})
|
||||||
|
// NOTE: this is not a dialog event, it is defined by the
|
||||||
|
// container to notify us that we are closing...
|
||||||
|
.on('close', function(){
|
||||||
|
console.log('Dialog closing...')
|
||||||
|
})
|
||||||
|
})],
|
||||||
|
|
||||||
|
|
||||||
// XXX this is just a test...
|
// XXX this is just a test...
|
||||||
embededListerTest: ['Test/Lister test (embeded)/*',
|
embededListerTest: ['Test/Lister test (embeded)/*',
|
||||||
function(path, make){
|
function(path, make){
|
||||||
|
|||||||
@ -122,6 +122,10 @@ function updateImagePosition(actions, target){
|
|||||||
// NOTE: this uses the base feature API but does not need it imported...
|
// NOTE: this uses the base feature API but does not need it imported...
|
||||||
//
|
//
|
||||||
// XXX split this into read and write actions...
|
// XXX split this into read and write actions...
|
||||||
|
// XXX need a way to neutrally scale images and store that scale...
|
||||||
|
// - fit N images/ribbons is neutral but might mean different things
|
||||||
|
// depending on image and viewer proportions
|
||||||
|
// - .scale is a bad way to go...
|
||||||
var ViewerActions =
|
var ViewerActions =
|
||||||
module.ViewerActions = actions.Actions({
|
module.ViewerActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
|
|||||||
@ -158,6 +158,19 @@ var normalizeTabs = function(str){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var doWithRootAction =
|
||||||
|
module.doWithRootAction =
|
||||||
|
function(func){
|
||||||
|
return function(name){
|
||||||
|
var handlers = (this.getHandlerList
|
||||||
|
|| MetaActions.getHandlerList)
|
||||||
|
.call(this, name)
|
||||||
|
|
||||||
|
return func.call(this, handlers.pop(), name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
@ -346,10 +359,19 @@ module.MetaActions = {
|
|||||||
get actions(){
|
get actions(){
|
||||||
var res = []
|
var res = []
|
||||||
for(var k in this){
|
for(var k in this){
|
||||||
// avoid recursion...
|
// avoid recursion, skip props...
|
||||||
if(k == 'actions' || k == 'length'){
|
var cur = this
|
||||||
|
var prop = Object.getOwnPropertyDescriptor(cur, k)
|
||||||
|
while(!prop && cur.__proto__ != null){
|
||||||
|
var cur = cur.__proto__
|
||||||
|
var prop = Object.getOwnPropertyDescriptor(cur, k)
|
||||||
|
}
|
||||||
|
if(prop.get != null){
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
//if(k == 'actions' || k == 'length'){
|
||||||
|
// continue
|
||||||
|
//}
|
||||||
// get only actions...
|
// get only actions...
|
||||||
if(this[k] instanceof Action){
|
if(this[k] instanceof Action){
|
||||||
res.push(k)
|
res.push(k)
|
||||||
@ -491,17 +513,8 @@ module.MetaActions = {
|
|||||||
// action can be or not be a toggler in different contexts.
|
// action can be or not be a toggler in different contexts.
|
||||||
//
|
//
|
||||||
// For more info on togglers see: lib/toggler.js
|
// For more info on togglers see: lib/toggler.js
|
||||||
isToggler: function(name){
|
isToggler: doWithRootAction(function(action){
|
||||||
var handlers = (this.getHandlerList
|
return action instanceof toggler.Toggler }),
|
||||||
|| MetaActions.getHandlerList)
|
|
||||||
.call(this, name)
|
|
||||||
|
|
||||||
if(handlers.slice(-1)[0] instanceof toggler.Toggler){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// Register an action callback...
|
// Register an action callback...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user