2016-10-27 10:02:12 +13:00
|
|
|
|
2016-11-13 12:55:00 +13:00
|
|
|
import * as helpers from '../../helpers'
|
2016-10-27 10:02:12 +13:00
|
|
|
|
2017-07-21 22:56:28 +12:00
|
|
|
export function setSelectedTracks(keys = []){
|
|
|
|
|
if (typeof(keys) === 'string'){
|
|
|
|
|
keys = [keys]
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
type: 'SET_SELECTED_TRACKS',
|
|
|
|
|
keys: keys
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-29 16:25:05 +13:00
|
|
|
export function showContextMenu(data){
|
|
|
|
|
data.position_x = data.e.clientX
|
|
|
|
|
data.position_y = data.e.clientY
|
2016-10-27 10:02:12 +13:00
|
|
|
return {
|
2016-11-09 15:51:38 +13:00
|
|
|
type: 'SHOW_CONTEXT_MENU',
|
2016-10-27 10:02:12 +13:00
|
|
|
data: data
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 07:16:33 +12:00
|
|
|
export function setSlimMode(slim_mode){
|
|
|
|
|
return {
|
|
|
|
|
type: 'SET_SLIM_MODE',
|
|
|
|
|
slim_mode: slim_mode
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-27 10:02:12 +13:00
|
|
|
export function hideContextMenu(){
|
2016-11-09 15:49:25 +13:00
|
|
|
return {
|
2016-11-09 15:51:38 +13:00
|
|
|
type: 'HIDE_CONTEXT_MENU'
|
2016-11-09 15:49:25 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-29 16:25:05 +13:00
|
|
|
export function showTouchContextMenu(data){
|
|
|
|
|
return {
|
|
|
|
|
type: 'SHOW_TOUCH_CONTEXT_MENU',
|
|
|
|
|
data: data
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function hideTouchContextMenu(){
|
|
|
|
|
return {
|
|
|
|
|
type: 'HIDE_TOUCH_CONTEXT_MENU'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-01 08:57:28 +13:00
|
|
|
export function lazyLoading( start ){
|
|
|
|
|
return {
|
2016-11-09 15:51:38 +13:00
|
|
|
type: 'LAZY_LOADING',
|
2016-11-01 08:57:28 +13:00
|
|
|
start: start
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-30 09:32:46 +13:00
|
|
|
export function toggleSidebar( new_state = 'toggle' ){
|
|
|
|
|
var action = { type: 'TOGGLE_SIDEBAR' }
|
|
|
|
|
if( new_state != 'toggle' ) action.new_state = new_state
|
|
|
|
|
return action
|
2016-11-21 21:46:53 +13:00
|
|
|
}
|
|
|
|
|
|
2017-02-15 19:21:42 +13:00
|
|
|
export function dragStart( e, context, from_uri = null, victims, victims_indexes = null ){
|
2016-11-10 16:17:10 +13:00
|
|
|
return {
|
|
|
|
|
type: 'DRAG_START',
|
|
|
|
|
context: context,
|
2017-02-15 19:21:42 +13:00
|
|
|
from_uri: from_uri,
|
2016-11-10 16:17:10 +13:00
|
|
|
victims: victims,
|
2016-11-15 17:08:21 +13:00
|
|
|
victims_indexes: victims_indexes,
|
|
|
|
|
start_x: e.clientX,
|
|
|
|
|
start_y: e.clientY
|
2016-11-10 16:17:10 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-15 17:08:21 +13:00
|
|
|
export function dragActive(){
|
|
|
|
|
return { type: 'DRAG_ACTIVE' }
|
2016-11-10 21:33:23 +13:00
|
|
|
}
|
|
|
|
|
|
2016-11-10 16:17:10 +13:00
|
|
|
export function dragEnd(){
|
|
|
|
|
return { type: 'DRAG_END' }
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 18:47:10 +13:00
|
|
|
export function set( data ){
|
2016-11-21 10:06:25 +13:00
|
|
|
return {
|
2016-12-09 18:47:10 +13:00
|
|
|
type: 'UI_SET',
|
|
|
|
|
data: data
|
2016-11-21 10:06:25 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-02 09:31:05 +12:00
|
|
|
|
|
|
|
|
|
2016-12-13 11:08:13 +13:00
|
|
|
/**
|
|
|
|
|
* Modal
|
|
|
|
|
*
|
|
|
|
|
* Immersive full-screen dialog
|
|
|
|
|
**/
|
|
|
|
|
|
2016-11-11 23:21:51 +13:00
|
|
|
export function openModal( name, data ){
|
|
|
|
|
return {
|
|
|
|
|
type: 'OPEN_MODAL',
|
|
|
|
|
modal: {
|
|
|
|
|
name: name,
|
|
|
|
|
data: data
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function closeModal(){
|
2017-08-01 14:59:59 +12:00
|
|
|
return {
|
|
|
|
|
type: 'CLOSE_MODAL'
|
|
|
|
|
}
|
2016-11-11 23:21:51 +13:00
|
|
|
}
|
2016-10-27 10:02:12 +13:00
|
|
|
|
2016-12-13 11:08:13 +13:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notifications
|
|
|
|
|
*
|
|
|
|
|
* Subtle info/tooltip messages
|
|
|
|
|
**/
|
|
|
|
|
|
2017-02-21 05:46:28 +13:00
|
|
|
export function createBrowserNotification( data ){
|
|
|
|
|
return {
|
|
|
|
|
type: 'BROWSER_NOTIFICATION',
|
|
|
|
|
data: data
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-29 16:29:49 +12:00
|
|
|
export function createNotification(content, type = 'default', key = null, title = null, sticky = false){
|
|
|
|
|
if (!key){
|
|
|
|
|
key = helpers.generateGuid()
|
|
|
|
|
}
|
2016-12-13 11:08:13 +13:00
|
|
|
return {
|
|
|
|
|
type: 'CREATE_NOTIFICATION',
|
|
|
|
|
notification: {
|
2017-04-05 20:28:41 +12:00
|
|
|
key: key,
|
2016-12-13 11:08:13 +13:00
|
|
|
type: type,
|
2017-05-29 16:29:49 +12:00
|
|
|
title: title,
|
|
|
|
|
content: content,
|
|
|
|
|
sticky: sticky
|
2016-12-13 11:08:13 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-05 20:28:41 +12:00
|
|
|
export function removeNotification(key){
|
2016-12-13 11:08:13 +13:00
|
|
|
return {
|
|
|
|
|
type: 'REMOVE_NOTIFICATION',
|
2017-04-05 20:28:41 +12:00
|
|
|
key: key
|
2016-12-13 11:08:13 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-06-02 09:31:05 +12:00
|
|
|
|
2017-03-27 14:23:38 +13:00
|
|
|
/**
|
|
|
|
|
* Loaders
|
|
|
|
|
**/
|
2016-12-13 11:08:13 +13:00
|
|
|
|
2017-03-27 14:23:38 +13:00
|
|
|
export function startLoading(key,source){
|
|
|
|
|
return {
|
|
|
|
|
type: 'START_LOADING',
|
|
|
|
|
source: source,
|
|
|
|
|
key: key
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function stopLoading(key){
|
|
|
|
|
return {
|
|
|
|
|
type: 'STOP_LOADING',
|
|
|
|
|
key: key
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-04-05 20:28:41 +12:00
|
|
|
|
2017-08-11 21:59:14 +12:00
|
|
|
export function startProcess(key,message,data = {}){
|
2017-04-05 20:28:41 +12:00
|
|
|
return {
|
|
|
|
|
type: 'START_PROCESS',
|
2017-04-06 09:01:53 +12:00
|
|
|
key: key,
|
2017-08-11 21:59:14 +12:00
|
|
|
message: message,
|
|
|
|
|
data: data
|
2017-04-05 20:28:41 +12:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-11 21:59:14 +12:00
|
|
|
export function updateProcess(key,message,data = {}){
|
2017-08-10 16:41:19 +12:00
|
|
|
return {
|
|
|
|
|
type: 'UPDATE_PROCESS',
|
|
|
|
|
key: key,
|
2017-08-11 21:59:14 +12:00
|
|
|
message: message,
|
|
|
|
|
data: data
|
2017-08-10 16:41:19 +12:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-11 21:59:14 +12:00
|
|
|
export function runProcess(key,data = {}){
|
2017-08-10 16:41:19 +12:00
|
|
|
return {
|
2017-08-12 00:02:41 +12:00
|
|
|
type: key,
|
|
|
|
|
data: data
|
2017-08-10 16:41:19 +12:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-05 20:28:41 +12:00
|
|
|
export function cancelProcess(key){
|
|
|
|
|
return {
|
|
|
|
|
type: 'CANCEL_PROCESS',
|
|
|
|
|
key: key
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-10 16:41:19 +12:00
|
|
|
export function processFinished(key){
|
2017-04-05 20:28:41 +12:00
|
|
|
return {
|
2017-08-10 16:41:19 +12:00
|
|
|
type: 'PROCESS_FINISHED',
|
2017-04-05 20:28:41 +12:00
|
|
|
key: key
|
|
|
|
|
}
|
|
|
|
|
}
|