Skip to content

Commit 1893034

Browse files
committed
add Database Menu and some minor cleanup
1 parent abca252 commit 1893034

File tree

7 files changed

+56
-23
lines changed

7 files changed

+56
-23
lines changed

bin/icon.ico

170 KB
Binary file not shown.

bin/icon.png

77 Bytes
Loading

bin/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ <h1>Column Props</h1>
102102
<div class="content">
103103
<h1>About</h1>
104104
<p>
105-
Version 1.5
105+
Version 1.6.1+
106106
</p>
107107
<p>
108108
CastleDB has been created by Nicolas Cannasse
109109
</p>
110110
<p>
111-
Help and updates on <a href="http://castledb.org" target="_blank">http://castledb.org</a>
111+
Built and maintained here: <a href="https://github.com/dazKind/castle" target="_blank">https://github.com/dazKind/castle</a>
112112
</p>
113113
<p>
114114
<input type="submit" value="Close" onclick="$(this).parents('.modal').hide()"/>
@@ -122,10 +122,10 @@ <h1>About</h1>
122122
ERROR
123123
</div>
124124

125-
<a href="javascript:_.editTypes()">Edit Types</a>
125+
<!--<a href="javascript:_.editTypes()">Edit Types</a>
126126
<a href="javascript:_.insertLine()">New Line</a>
127127
<a href="javascript:_.newColumn()">New Column</a>
128-
<a href="javascript:_.newSheet()">New Sheet</a>
128+
<a href="javascript:_.newSheet()">New Sheet</a>-->
129129

130130
<ul class="sheets" id="sheets">
131131
<li>Sheet 1</li>

bin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "CastleDB",
33
"window" : {
4-
"title" : "CastleDB",
4+
"title" : "CastleDB Editor",
55
"icon" : "icon.png",
66
"width" : 800,
77
"height" : 600,

bin/style.css

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ div#menu ul.sheets li.active {
285285
cursor : nw-resize;
286286
}
287287
.castle tr.separator, .dialog-floating tr.separator {
288-
background-color : #BFC8E3;
288+
background-color : #ffeeb0;
289289
height : 10px;
290290
}
291291
.castle tr.separator td, .dialog-floating tr.separator td {
292-
border-top : 1px solid #99A6D2;
292+
border-top : 1px solid #d29d99;
293293
padding-top : 6px;
294-
color : #2B3762;
294+
color : #370617;
295295
font-weight : bold;
296296
padding-left : 20px;
297297
}
@@ -366,14 +366,12 @@ div#menu ul.sheets li.active {
366366
text-align : center;
367367
}
368368
.castle td.t_bool.true, .dialog-floating td.t_bool.true {
369-
color : #76AA09;
370369
font-weight : bold;
371-
font-size : 125%;
370+
font-size : 110%;
372371
}
373372
.castle td.t_bool.false, .dialog-floating td.t_bool.false {
374-
color : #888;
375373
font-weight : bold;
376-
font-size : 125%;
374+
font-size : 110%;
377375
}
378376
.castle td.t_int, .castle td.t_float, .dialog-floating td.t_int, .dialog-floating td.t_float {
379377
text-align : center;
@@ -451,6 +449,7 @@ div#menu ul.sheets li.active {
451449
}
452450
.imagePreview {
453451
pointer-events : none;
452+
display : none;
454453
border : 1px solid #aaa;
455454
background-color : #000000;
456455
background-color : rgba(0, 0, 0, 0.7);

bin/style.hss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,12 @@ div#menu {
340340

341341

342342
tr.separator {
343-
background-color : #BFC8E3;
343+
background-color : #ffeeb0;
344344
height : 10px;
345345
td {
346-
border-top: 1px solid #99A6D2;
346+
border-top: 1px solid #d29d99;
347347
padding-top: 6px;
348-
color : #2B3762;
348+
color : #370617;
349349
font-weight : bold;
350350
padding-left : 20px;
351351
}
@@ -441,14 +441,14 @@ div#menu {
441441
text-align : center;
442442
}
443443
td.t_bool.true {
444-
color: #76AA09;
444+
//color: #76AA09;
445445
font-weight: bold;
446-
font-size: 125%;
446+
font-size: 110%;
447447
}
448448
td.t_bool.false {
449-
color: #888;
449+
//color: #888;
450450
font-weight: bold;
451-
font-size: 125%;
451+
font-size: 110%;
452452
}
453453

454454
td.t_int, td.t_float {
@@ -537,6 +537,7 @@ div#menu {
537537

538538
.imagePreview {
539539
pointer-events: none;
540+
display: none;
540541
border : 1px solid #aaa;
541542
background-color : rgba(0,0,0,0.7);
542543
position : fixed;

src/Main.hx

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ class Main extends Model {
167167
if( cursor.x == -1 && ctrl ) {
168168
if( dy != 0 )
169169
moveLine(cursor.s, cursor.y, dy);
170+
// if( dy != 0 ) {
171+
// var s = getSelection();
172+
// if (dy < 0)
173+
// for( y in s.y1...s.y2+1 )
174+
// moveLine(cursor.s, y, dy);
175+
// else
176+
// for( y in -s.y2...-s.y1+1 )
177+
// moveLine(cursor.s, -y, dy);
178+
// }
170179
updateCursor();
171180
return;
172181
}
@@ -486,10 +495,10 @@ class Main extends Model {
486495
}
487496

488497

489-
function moveLine( sheet : Sheet, index : Int, delta : Int ) {
498+
function moveLine( sheet : Sheet, _index : Int, delta : Int ) {
490499
// remove opened list
491-
getLine(sheet, index).next("tr.list").change();
492-
var index = sheet.moveLine(index, delta);
500+
getLine(sheet, _index).next("tr.list").change();
501+
var index = sheet.moveLine(_index, delta);
493502
if( index != null ) {
494503
setCursor(sheet, -1, index, false);
495504
refresh();
@@ -582,7 +591,8 @@ class Main extends Model {
582591
i == null ? '<span class="error">#REF($v)</span>' : (i.ico == null ? "" : tileHtml(i.ico,true)+" ") + StringTools.htmlEscape(i.disp);
583592
}
584593
case TBool:
585-
v ? '&#x2611;' : '&#9744;';
594+
// v ? '&#x2611;' : '&#9744;';
595+
v ? '<i class="fa fa-check-square-o" aria-hidden="true"></i>' : '<i class="fa fa-square-o" aria-hidden="true"></i>';
586596
case TEnum(values):
587597
values[v];
588598
case TImage:
@@ -1337,6 +1347,7 @@ class Main extends Model {
13371347
cursor.x = max - 1;
13381348
cursor.select = null;
13391349
}
1350+
13401351
var l = getLine(cursor.s, cursor.y);
13411352
if( cursor.x < 0 ) {
13421353
l.addClass("selected");
@@ -2546,16 +2557,38 @@ class Main extends Model {
25462557

25472558
};
25482559

2560+
// create an edit menu
2561+
modifier = "ctrl+shift";
2562+
if(Sys.systemName().indexOf("Mac") != -1)
2563+
modifier = "cmd+shift";
2564+
2565+
var medit = new MenuItem({ label : "Database" });
2566+
var medits = new Menu();
2567+
var mnewsheet = new MenuItem( { label : "New Sheet", key : "N", modifiers : modifier } );
2568+
var mnewcolumn = new MenuItem( { label : "Add Column", key : "C", modifiers : modifier } );
2569+
var mnewline = new MenuItem( { label : "Add Line", key : "L", modifiers : modifier } );
2570+
var medittypes = new MenuItem( { label : "Edit Types", key : "E", modifiers : modifier } );
2571+
mnewcolumn.click = ()->newColumn();
2572+
mnewsheet.click = ()->newSheet();
2573+
medittypes.click = ()->editTypes();
2574+
mnewline.click = ()->insertLine();
2575+
2576+
for(m in [mnewsheet, mnewcolumn, mnewline, medittypes])
2577+
medits.append(m);
2578+
medit.submenu = medits;
2579+
25492580
if(Sys.systemName().indexOf("Mac") != -1) {
25502581
menu.createMacBuiltin("CastleDB", {hideEdit: false, hideWindow: true}); // needed so copy&paste inside INPUTs work
25512582
menu.removeAt(0); // remove default menu
25522583
macEditMenu = menu.items[0]; // save default edit menu
25532584
menu.removeAt(0); // remove default edit menu
25542585
menu.insert(mfile, 0); // put it before the default Edit menu
25552586
mfiles.insert(mdebug, 7); // needs to go under File or it won't show
2587+
mfiles.insert(medit, 7); // needs to go under File or it won't show
25562588
}
25572589
else {
25582590
menu.append(mfile);
2591+
menu.append(medit);
25592592
menu.append(mdebug);
25602593
}
25612594

0 commit comments

Comments
 (0)