diff --git a/keys.scad b/keys.scad index 768110e..9caa575 100644 --- a/keys.scad +++ b/keys.scad @@ -17,4 +17,13 @@ dcs_row(5) legend("⇪", size=9) key(); } */ // example layout -/* preonic_default("dcs"); */ \ No newline at end of file +// preonic_default("dcs") key(); + +// example dual top Legend row +// legend_test=[["{","["],["|","\\"],[":",";"],["?","/"],["_","-"]]; +// for (x = [0:1:4]) { +// translate_u(0,-x) dsa_row() legend(legend_test[x], [0,0,6]) key(); +// } + +// example dual top layout +// full_size_dual_default("cherry") key(); \ No newline at end of file diff --git a/src/features/legends.scad b/src/features/legends.scad index 2f0171a..117571f 100644 --- a/src/features/legends.scad +++ b/src/features/legends.scad @@ -3,7 +3,14 @@ module keytext(text, position, font_size, depth) { hoffset = (top_total_key_height()/3.5) * -position[1]; translate([woffset, hoffset, -depth]){ color($tertiary_color) linear_extrude(height=$dish_depth + depth){ - text(text=text, font=$font, size=font_size, halign="center", valign="center"); + // Allows for dual top keytext + if(is_list(text)&&len(text)==2){ + translate([0, (top_total_key_height()/4.25), 0]) text(text=text[0], font=$font, size=font_size*.70, halign="center", valign="center"); + translate([0, -(top_total_key_height()/4.25), 0]) text(text=text[1], font=$font, size=font_size*.70, halign="center", valign="center"); + } + else { + text(text=text, font=$font, size=font_size, halign="center", valign="center"); + } } } } diff --git a/src/key_layouts.scad b/src/key_layouts.scad index 10b5630..a592715 100644 --- a/src/key_layouts.scad +++ b/src/key_layouts.scad @@ -18,3 +18,7 @@ include include include + +include +include +include diff --git a/src/layouts/full_size/default.scad b/src/layouts/full_size/default.scad new file mode 100644 index 0000000..e597bf6 --- /dev/null +++ b/src/layouts/full_size/default.scad @@ -0,0 +1,61 @@ +include <../layout.scad> + +full_size_default_layout = [ + [1,-1,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,2,-0.5,1,1,1,-0.5,1,1,1,1], + [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5,-0.5,1,1,1,-0.5,1,1,1,1], + [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25,-4,1,1,1], + [2.25,1,1,1,1,1,1,1,1,1,1,2.75,-1.5,1,-1.5,1,1,1,1], + [1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25,-0.5,1,1,1,-0.5,2,1] +]; + +full_size_vertical_size = [ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] +]; + +full_size_legend_size = [ + [-2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -3, -3, -2], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -3, -3, 0, -2, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +]; + +full_size_legends = [ + ["esc", "", "f1", "f2", "f3", "f4", "", "f5", "f6", "f7", "f8", "", "f9", "f10", "f11", "f12", "", "ptsc", "sclk", "pse"], + ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫", "", "ins", "home", "pgup", "", "num", "/", "*", "-"], + ["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\", "", "del", "end", "pgdn", "", "7", "8", "9", "+"], + ["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter", "", "4", "5", "6"], + ["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "shift", "", "up", "", "1", "2", "3", "ent"], + ["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl", "", "lt", "dn", "rt", "", "0", "."], +]; + + +module full_size_default(profile="dcs") { + simple_layout(full_size_default_layout) { + fs_legend = full_size_legends[$row][$column]; + legend_size = $font_size + full_size_legend_size[$row][$column]; + vertical_size = full_size_vertical_size[$row][$column]; + + legend(fs_legend, size=legend_size) { + key_profile(profile, $row, $column) { + if(vertical_size > 1){ + v_offset = -(vertical_size - 1) / 2; + translate_u(0, v_offset){ + uh(vertical_size) { + stabilized(vertical=true) children(); + } + } + } else { + key(); + } + } + } + } +} \ No newline at end of file diff --git a/src/layouts/full_size_dual/default.scad b/src/layouts/full_size_dual/default.scad new file mode 100644 index 0000000..9f103d2 --- /dev/null +++ b/src/layouts/full_size_dual/default.scad @@ -0,0 +1,46 @@ +include <../layout.scad> + +rt_arrow="\u2192"; +lt_arrow="\u2190"; +up_arrow="\u2191"; +dn_arrow="\u2193"; +menu="\u2261"; +enter=lt_arrow; //"\u2386" with supported Unicode Font +backspace="BkSp"; //"\u232B" with supported Unicode Font + +// Keys are defined independently: [legend, horizontalSize, verticalSize, fontChg] +full_size_dual = [[["Esc",1,1,-2], ["",-1,1,0], ["F1",1,1,-2], ["F2",1,1,-2], ["F3",1,1,-2], ["F4",1,1,-2], ["",-.5,1,0], ["F5",1,1,-2], ["F6",1,1,-2], ["F7",1,1,-2], ["F8",1,1,-2], ["",-.5,1,0], ["F9",1,1,-2], ["F10",1,1,-2], ["F11",1,1,-2], ["F12",1,1,-2], ["",-0.5,1,0], [["Print","Screen"],1,1,-3], [["Scroll", "Lock"],1,1,-3], [["Pause","Break"],1,1,-3]], + [[["~","`"],1,1,0], [["!","1"],1,1,0], [["@","2"],1,1,0], [["#","3"],1,1,0], [["$","4"],1,1,0], [["%","5"],1,1,0], [["^","6"],1,1,0], [["&","7"],1,1,0], [["*","8"],1,1,0], [["(","9"],1,1,0], [[")","0"],1,1,0], [["_","-"],1,1,0], [["+","="],1,1,0], [backspace,2,1,-2], ["",-0.5,1,0], ["Ins",1,1,-2], ["Home",1,1,-2], [["Pg","Up"],1,1,-1], ["",-0.5,1,0], [["Num","Lock"],1,1,-2], ["/",1,1,0], ["*",1,1,0], ["-",1,1,0]], + [["Tab",1.5,1,-2], ["Q",1,1,0], ["W",1,1,0], ["E",1,1,0], ["R",1,1,0], ["T",1,1,-2], ["Y",1,1,0], ["U",1,1,0], ["I",1,1,0], ["O",1,1,0], ["P",1,1,0], [["{","["],1,1,0], [["}","]"],1,1,0], [["|","\\"],1.5,1,0], ["",-0.5,1,0], ["Del",1,1,-2], ["End",1,1,-2], [["Pg","Dn"],1,1,-1], ["",-0.5,1,0], ["7",1,1,0], ["8",1,1,0], ["9",1,1,0], ["+",1,2,0]], + [["Caps",1.75,1,-2], ["A",1,1,0], ["S",1,1,0], ["D",1,1,0], ["F",1,1,-2], ["G",1,1,0], ["H",1,1,0], ["J",1,1,0], ["K",1,1,0], ["L",1,1,0], [[":",";"],1,1,0], [["\"","'"],1,1,0], ["Enter",2.25,1,-2], ["",-4,1,0], ["4",1,1,0], ["5",1,1,0], ["6",1,1,0]], + [["Shift",2.25,1,-2], ["Z",1,1,0], ["X",1,1,0], ["C",1,1,-2], ["V",1,1,0], ["B",1,1,0], ["N",1,1,0], ["M",1,1,0], [["<",","],1,1,0], [[">","."],1,1,0], [["?","/"],1,1,0], ["Shift",2.75,1,-2], ["",-1.5,1,0], [up_arrow,1,1,0], ["",-1.5,1,0], ["1",1,1,0], ["2",1,1,0], ["3",1,1,0], [enter,1,2,0]], + [["Ctrl",1.25,1,-2], ["Win",1.25,1,-2], ["Alt",1.25,1,-2], ["",6.25,1,0], ["Alt",1.25,1,-2], ["FN",1.25,1,-2], [menu,1.25,1,0], ["Ctrl",1.25,1,-2], ["",-0.5,1,0], [lt_arrow,1,1,0], [dn_arrow,1,1,0], [rt_arrow,1,1,0], ["",-0.5,1,0], ["0",2,1,0], [".",1,1,0]]]; + +// Derive/seperate out tables +full_size_dual_legends = [ for (row = full_size_dual) [ for (col = row) col[0]]]; +full_size_dual_default_layout = [ for (row = full_size_dual) [ for (col = row) col[1]]]; +full_size_dual_vertical_size = [ for (row = full_size_dual) [ for (col = row) col[2]]]; +full_size_dual_legend_size = [ for (row = full_size_dual) [ for (col = row) col[3]]]; + +module full_size_dual_default(profile="dcs") { + simple_layout(full_size_dual_default_layout) { + dual_legend = full_size_dual_legends[$row][$column]; + legend_size = $font_size+full_size_dual_legend_size[$row][$column]; + vertical_size = full_size_dual_vertical_size[$row][$column]; + + legend(dual_legend, size=legend_size) { + key_profile(profile, $row, $column) { + if(vertical_size > 1){ + v_offset = -(vertical_size - 1) / 2; + translate_u(0, v_offset){ + uh(vertical_size) { + stabilized(vertical=true) children(); + } + } + } else { + children(); + } + } + } + } +} \ No newline at end of file diff --git a/src/layouts/tkl/default.scad b/src/layouts/tkl/default.scad new file mode 100644 index 0000000..1119ed4 --- /dev/null +++ b/src/layouts/tkl/default.scad @@ -0,0 +1,38 @@ +include <../layout.scad> + +tkl_default_layout = [ + [1,-1,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,2,-0.5,1,1,1], + [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5,-0.5,1,1,1], + [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25], + [2.25,1,1,1,1,1,1,1,1,1,1,2.75,-1.5,1], + [1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25,-0.5,1,1,1] +]; + +tkl_legend_size = [ + [-2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -3, -3, -2], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -3, -3], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]; + +tkl_legends = [ + ["esc", "", "f1", "f2", "f3", "f4", "", "f5", "f6", "f7", "f8", "", "f9", "f10", "f11", "f12", "", "ptsc", "sclk", "pse"], + ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫", "", "ins", "home", "pgup"], + ["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\", "", "del", "end", "pgdn"], + ["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter"], + ["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "shift", "", "up"], + ["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl", "", "lt", "dn", "rt"], +]; + +module tkl_default(profile="dcs") { + simple_layout(tkl_default_layout) { + tkl_legend = tkl_legends[$row][$column]; + legend_size = $font_size + tkl_legend_size[$row][$column]; + + legend(tkl_legend, size=legend_size) { + key_profile(profile, $row, $column) children(); + } + } +} \ No newline at end of file