now everything is a feature...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-11-07 19:44:52 +03:00
parent c66eb2e354
commit 5e3d6ead54
4 changed files with 41 additions and 8 deletions

View File

@ -760,11 +760,13 @@ module.MetaActions = {
// //
// XXX add doc, ldoc, tags and save them to each action... // XXX add doc, ldoc, tags and save them to each action...
// XXX is .config processing correct here??? // XXX is .config processing correct here???
// XXX should this be a full fledged object???
var Actions = var Actions =
module.Actions = module.Actions =
function Actions(a, b){ function Actions(a, b){
var obj = b == null ? a : b var obj = b == null ? a : b
var proto = b == null ? MetaActions : a var proto = b == null ? MetaActions : a
obj = obj || {}
// NOTE: this is intentionally done only for own attributes... // NOTE: this is intentionally done only for own attributes...
Object.keys(obj).forEach(function(k){ Object.keys(obj).forEach(function(k){

View File

@ -563,6 +563,8 @@ module.FeatureSet = {
setup.call(that[n], obj) setup.call(that[n], obj)
} }
}) })
return obj
}, },
remove: function(obj, lst){ remove: function(obj, lst){
lst = lst.constructor !== Array ? [lst] : lst lst = lst.constructor !== Array ? [lst] : lst

View File

@ -37,7 +37,7 @@ var browser = require('browser')
var nw = require('nw') var nw = require('nw')
// XXX load only the actualy used here modules... // XXX load only the actualy used here modules...
var actions = require('actions') var actions = require('lib/actions')
var data = require('data') var data = require('data')
var ribbons = require('ribbons') var ribbons = require('ribbons')
@ -240,8 +240,8 @@ module.GLOBAL_KEYBOARD = {
$(function(){ $(function(){
// XXX // XXX stub action set -- this needs to be auto-generated...
window.a = testing.setupActions() window.a = actions.Actions()
// used switch experimental actions on (set to true) or off (unset or false)... // used switch experimental actions on (set to true) or off (unset or false)...
//a.experimental = true //a.experimental = true
@ -283,6 +283,7 @@ $(function(){
// setup base keyboard for devel, in case something breaks... // setup base keyboard for devel, in case something breaks...
// This branch does not drop keys...
if(module.MAX_KEY_REPEAT_RATE < 0 || module.MAX_KEY_REPEAT_RATE == null){ if(module.MAX_KEY_REPEAT_RATE < 0 || module.MAX_KEY_REPEAT_RATE == null){
$(document) $(document)
.keydown( .keydown(
@ -293,6 +294,8 @@ $(function(){
}, },
a)) a))
// drop keys if repeating to fast...
// NOTE: this is done for smoother animations...
} else { } else {
$(document) $(document)
.keydown( .keydown(

View File

@ -142,6 +142,13 @@ function makeTagWalker(direction, dfl_tag){
/*********************************************************************/
var ImageGridFeatures =
module.ImageGridFeatures = Object.create(features.FeatureSet)
/*********************************************************************/ /*********************************************************************/
// //
// XXX Tasks to accomplish here: // XXX Tasks to accomplish here:
@ -152,8 +159,8 @@ function makeTagWalker(direction, dfl_tag){
// //
// //
var Client = var BaseActions =
module.Client = module.BaseActions =
actions.Actions({ actions.Actions({
config: { config: {
@ -781,11 +788,19 @@ actions.Actions({
}) })
var Base =
module.Base = ImageGridFeatures.Feature({
title: 'ImageGrid base',
/*********************************************************************/ tag: 'base',
var ImageGridFeatures = config: {
module.ImageGridFeatures = Object.create(features.FeatureSet) // see .direction for details...
'steps-to-change-direction': 3,
},
actions: BaseActions,
})
@ -1298,6 +1313,8 @@ module.Viewer = ImageGridFeatures.Feature({
tag: 'ui', tag: 'ui',
depends: ['base'],
config: { config: {
// The maximum screen width allowed when zooming... // The maximum screen width allowed when zooming...
'max-screen-images': 30, 'max-screen-images': 30,
@ -1342,6 +1359,8 @@ module.Journal = ImageGridFeatures.Feature({
tag: 'system-journal', tag: 'system-journal',
depends: ['base'],
actions: actions.Actions({ actions: actions.Actions({
// XXX might be good to add some kind of metadata to journal... // XXX might be good to add some kind of metadata to journal...
journalPush: ['Journal/Add an item to journal', journalPush: ['Journal/Add an item to journal',
@ -2666,6 +2685,8 @@ module.ImageMarks = ImageGridFeatures.Feature({
tag: 'image-marks', tag: 'image-marks',
depends: ['base'],
actions: ImageMarkActions, actions: ImageMarkActions,
handlers: [ handlers: [
@ -2728,6 +2749,8 @@ module.ImageBookmarks = ImageGridFeatures.Feature({
tag: 'image-bookmarks', tag: 'image-bookmarks',
depends: ['base'],
actions: ImageBookmarkActions, actions: ImageBookmarkActions,
handlers: [ handlers: [
@ -2818,6 +2841,8 @@ module.FileSystemLoader = ImageGridFeatures.Feature({
// //
ImageGridFeatures.Feature('viewer-testing', [ ImageGridFeatures.Feature('viewer-testing', [
'base',
'ui', 'ui',
// features... // features...
@ -2850,6 +2875,7 @@ ImageGridFeatures.Feature('viewer-testing', [
]) ])
ImageGridFeatures.Feature('viewer-minimal', [ ImageGridFeatures.Feature('viewer-minimal', [
'base',
'ui', 'ui',
'ui-ribbon-align-to-order', 'ui-ribbon-align-to-order',
'ui-animation', 'ui-animation',