- added popup and configuration panel api

- remove all href attributes to prevent dragging showing urls
This commit is contained in:
jean-emmanuel 2015-09-09 14:45:25 +02:00 • committed by bordun
parent e5b7f63f08
commit 2d673310dd
7 changed files with 190 additions and 56 deletions

View file

@ -89,7 +89,9 @@ $scrollbar-margin:5px;
input:focus::selection{
background:$color-accent;
}
input {
cursor: text;
}
@ -118,7 +120,7 @@ body {
a.btn {
background: $bg-button;
display: block;
display: block;border:1px solid $color-border;
padding:10px;
&:hover {
background: $bg-button-hover;
@ -143,10 +145,9 @@ a.btn {
box-shadow: 0 0 0 1px $color-border inset;
}
a {
padding-right:25px;
padding-right:35px;
overflow: hidden;
margin-top:10px;
box-shadow: 0 0 0 1px $color-border inset;
position: relative;
white-space: nowrap;
text-overflow: ellipsis;
@ -156,6 +157,10 @@ a.btn {
top:1px;
bottom:1px;
padding:9px;
color:$color-text-fade;
&:hover {
color:$color-text
}
}
}
}
@ -220,7 +225,6 @@ a.btn {
display:block;
margin-bottom:15px;
background:$bg-button;
border:1px solid $color-border;
}
.inspector {
@ -448,6 +452,81 @@ a {
.popup {
position: fixed;
top:0;
left:0;
right:0;
bottom:0;
padding:10%;
background:rgba(black,.5);
z-index:1000000;
.popup-title {
position: relative;
padding:10px;
background:$bg-button;
.closer {
position:absolute;
right:0px;
top:0;
padding:10px;
color:$color-text-fade;
cursor: pointer;
&:hover {
color:$color-text;
}
}
}
.popup-wrapper {
background:$color-fg;
height:100%;
width:100%;
position: relative;
overflow: hidden;
.popup-content {
height:100%;
width:100%;
padding:10px;
overflow-y:scroll;
white-space: normal;
}
}
}
form {
label {
display: block;
padding-top:10px;
margin-bottom:10px;
}
.info {
color:$color-text-fade;
margin-bottom:10px;
}
input {
display:block;
margin-bottom:10px;
background:$color-bg;
font:inherit;
color:$color-text;
border:1px solid $color-border;
width:100%;
padding:10px;
&:focus {
box-shadow: 0 0 0 1px $color-accent;
}
}
.submit {
margin-top:30px;
}
}
@ -639,33 +718,6 @@ a {
/* STRIP (vertical fader) */
.fader-wrapper-outer {
padding-bottom:30px;
overflow:hidden;
height:100%;
width:100%;
position: relative;
input {
position:absolute;
bottom:0;
box-shadow: 0 0 1px 0 $color-border inset;
}
}
.fader-wrapper {
padding:20px 15px 20px 20px ;
overflow:hidden;
height:100%;
width:95px;
position: relative;
}
.fader{
height:100%;
}
/* XY */
.xy-wrapper {
@ -825,15 +877,10 @@ a {
}
.fader-wrapper-outer {
padding-bottom:30px;
overflow:hidden;
// height:100%;
height:100%;
position: relative;
input {
position:absolute;

View file

@ -19,7 +19,7 @@ ipc.on('load',function(preset){
ipc.on('listSessions',function(data){
for (i in data) {
$('#lobby .list').append('<li><a class="btn" data-session="'+i+'">'+data[i]+'<span>x</span></a></li>')
$('#lobby .list').append('<li><a class="btn" data-session="'+i+'">'+data[i]+'<span>'+icon('remove')+'</span></a></li>')
}
$('#lobby .list').append('<a class="btn" data-session="browse">...</a>')
$('#lobby a').click(function(){

View file

@ -37,7 +37,7 @@ init = function(callback) {
// Tabs...
$('.tablist a').click(function(){
var id = $(this).attr('href');
var id = $(this).data('tab');
$(id).siblings('.on').removeClass('on');
$(id).addClass('on');
$(this).parents('ul').find('.on').removeClass('on');
@ -103,10 +103,11 @@ init = function(callback) {
},
{
label:'Config',
icon:'gears'
icon:'gears',
click:configPanel
},
{
html:'<div class="inspector">\
html:'<div class="inspector btn">\
Inspector\
<div class="result"><em>Click on a widges\'s title to inspect</em></div>\
</div>',
@ -117,7 +118,7 @@ init = function(callback) {
$('#open-toggle').click(function(){
$('#open-toggle, #sidepanel, #container').toggleClass('sidepanel-open');
}).click()
})
$('.title').click(function(){
if (!$('#sidepanel').hasClass('sidepanel-open')){return}

View file

@ -21,7 +21,7 @@ parsetabs = function(tabs,parent,sub){
var title = tabData.title||tabId
var id = parent?parent.attr('id')+tabId:tabId
$navtabs.append('<li><a href="#'+id+'"><span>'+title+'</span></a></li>');
$navtabs.append('<li><a data-tab="#'+id+'"><span>'+title+'</span></a></li>');
var $tabContent = $(document.createElement('div')).addClass('tab').attr('id',id);

View file

@ -72,7 +72,7 @@ createMenu = function(template) {
html
if (!item.html) {
html = $('<a href="" class="'+classname+' btn">'+label+'</a>')
html = $('<a class="'+classname+' btn">'+label+'</a>')
} else {
html = $(item.html)
}
@ -88,3 +88,80 @@ createMenu = function(template) {
return menu
}
createPopup = function(title,content) {
var popup = $('\
<div class="popup">\
<div class="popup-wrapper">\
<div class="popup-title">'+title+'<span class="closer">'+icon('remove')+'</span></div>\
<div class="popup-content"></div>\
</div>\
</div>'),
closer = popup.find('.popup-title .closer')
closer.click(function(){
popup.close()
})
popup.close = function(){
$(document).unbind('keydown.popup')
popup.remove()
}
popup.find('.popup-content').append(content)
$('body').append(popup)
$(document).on('keydown.popup', function(){
popup.close()
})
return popup
}
var remote = require('remote');
configPanel = function(){
var readConfig = remote.getGlobal('readConfig')
var writeConfig = remote.getGlobal('writeConfig')
var config = readConfig()
var form = $('<form></form>')
for (i in config) {
var html = $('\
<label for="'+i+'">'+i+'</label>\
<p class="info">'+config[i].info+'</p>\
<input name="'+i+'" value="'+config[i].value+'"/>')
form.append(html)
}
var submit = $('<a class="btn submit">'+icon('save')+'&nbsp;Save configuration</a>')
form.append(submit)
popup = createPopup(icon('gear')+'&nbsp;Configuration panel',form)
submit.click(function(e){
e.preventDefault()
var data = form.serializeArray(),
newconfig = {}
for (i in data) {
newconfig[data[i].name] = data[i].value
}
writeConfig(newconfig)
popup.close();
})
}

View file

@ -2,12 +2,12 @@
"presetPath": "/home/bordun/oscwork/oschtmlgui/presets/",
"sessionPath": "/home/bordun/oscwork/oschtmlgui/sessions/",
"recentSessions": [
"/home/bordun/oscwork/oschtmlgui/sessions/demo.js",
"/home/bordun/oscwork/oschtmlgui/sessions/knob.js",
"/home/bordun/oscwork/oschtmlgui/sessions/xy.js",
"/home/bordun/oscwork/oschtmlgui/sessions/sebkhachott.js",
"/home/bordun/oscwork/oschtmlgui/sessions/demo-full.js",
"/home/bordun/oscwork/oschtmlgui/sessions/fadertest.js",
"/home/bordun/oscwork/oschtmlgui/sessions/monitorsjeannot.js"
]
"/home/bordun/oscwork/oschtmlgui/sessions/demo.js",
"/home/bordun/oscwork/oschtmlgui/sessions/xy.js",
"/home/bordun/oscwork/oschtmlgui/sessions/fadertest.js"
],
"oscInPort": "2222",
"syncTargets": ""
}

View file

@ -27,8 +27,8 @@ var defaultConfig = {
oscInPort:5555
}
var editableConfig = {
syncTargets: "List of target host (ip:port pairs), separeted by spaces. Every OSC message sent by the app will be sent to these hosts too.",
oscInPort: "Port on which the app listens to synchronise with other apps."
syncTargets: "List of target hosts (ip:port pairs), separeted by spaces. Every OSC message sent by the app will be sent to these hosts too.",
oscInPort: "Port on which the app listens to synchronise with other apps. You'll need to restart the app for this change to take effect."
}
@ -45,7 +45,18 @@ writeConfig = function(newconfig) {
}
readConfig = function(key) {
return config[key] || defaultConfig[key]
if (key!=undefined) {
return config[key] || defaultConfig[key]
} else {
var ret = {}
for (i in editableConfig) {
ret[i] = {
value:readConfig(i),
info:editableConfig[i]
}
}
return ret
}
}
@ -97,8 +108,6 @@ app.on('ready', function() {
var Menu = require('menu');
var MenuItem = require('menu-item');
var menu = new Menu();
var template = [
{
label: 'View',