From 948060f9bf65a70c245330ad378e82ac0f1d10b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zsef=20Farkas?= Date: Sat, 25 Jun 2016 14:24:07 +0200 Subject: [PATCH] PlayMacroAction rendering --- .../config-items/UhkConfiguration.ts | 7 +++- .../keys/svg-icon-text-key.component.ts | 33 +++++++++++++++++++ .../keys/svg-keyboard-key.component.ts | 20 ++++++++++- src/services/mapper.service.ts | 1 + 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/components/keys/svg-icon-text-key.component.ts diff --git a/config-serializer/config-items/UhkConfiguration.ts b/config-serializer/config-items/UhkConfiguration.ts index c055ae6c..8c6bdf17 100644 --- a/config-serializer/config-items/UhkConfiguration.ts +++ b/config-serializer/config-items/UhkConfiguration.ts @@ -1,7 +1,8 @@ import {Serializable} from '../Serializable'; import {ModuleConfigurations} from './ModuleConfigurations'; -import {Keymaps} from './Keymaps'; import {Keymap} from './Keymap'; +import {Keymaps} from './Keymaps'; +import {Macro} from './Macro'; import {Macros} from './Macros'; import {UhkBuffer} from '../UhkBuffer'; import {assertUInt8, assertUInt32} from '../assert'; @@ -95,4 +96,8 @@ export class UhkConfiguration extends Serializable { } } } + + getMacro(macroId: number): Macro { + return this.macros.elements.find(macro => macroId === macro.id); + } } diff --git a/src/components/keys/svg-icon-text-key.component.ts b/src/components/keys/svg-icon-text-key.component.ts new file mode 100644 index 00000000..d20fc038 --- /dev/null +++ b/src/components/keys/svg-icon-text-key.component.ts @@ -0,0 +1,33 @@ +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + moduleId: module.id, + selector: 'g[svg-icon-text-key]', + template: + ` + + + + {{ text }} + + ` +}) +export class SvgIconTextKeyComponent implements OnInit { + @Input() width: number; + @Input() height: number; + @Input() icon: string; + @Input() text: string; + + constructor() { } + + ngOnInit() { } + +} diff --git a/src/components/keys/svg-keyboard-key.component.ts b/src/components/keys/svg-keyboard-key.component.ts index 5e0e0690..d74a9851 100644 --- a/src/components/keys/svg-keyboard-key.component.ts +++ b/src/components/keys/svg-keyboard-key.component.ts @@ -4,6 +4,7 @@ import {NgSwitch, NgSwitchCase} from '@angular/common'; import {KeyAction} from '../../../config-serializer/config-items/KeyAction'; import {KeystrokeAction} from '../../../config-serializer/config-items/KeystrokeAction'; import {KeyModifiers} from '../../../config-serializer/config-items/KeyModifiers'; +import {PlayMacroAction} from '../../../config-serializer/config-items/PlayMacroAction'; import {SwitchLayerAction, LayerName} from '../../../config-serializer/config-items/SwitchLayerAction'; import {MapperService} from '../../services/mapper.service'; import {SwitchKeymapAction} from '../../../config-serializer/config-items/SwitchKeymapAction'; @@ -14,6 +15,7 @@ import {SvgOneLineTextKeyComponent} from './svg-one-line-text-key.component'; import {SvgTwoLineTextKeyComponent} from './svg-two-line-text-key.component'; import {SvgSingleIconKeyComponent} from './svg-single-icon-key.component'; import {SvgTextIconKeyComponent} from './svg-text-icon-key.component'; +import {SvgIconTextKeyComponent} from './svg-icon-text-key.component'; import {SvgSwitchKeymapKeyComponent} from './svg-switch-keymap-key.component'; enum LabelTypes { @@ -21,7 +23,8 @@ enum LabelTypes { TwoLineText, TextIcon, SingleIcon, - SwitchKeymap + SwitchKeymap, + IconText } @Component({ @@ -53,6 +56,12 @@ enum LabelTypes { [text]="labelSource.text" [icon]="labelSource.icon"> + + (); this.nameToFileName.set('toggle', 'icon-kbd__fn--toggle'); this.nameToFileName.set('switch-keymap', 'icon-kbd__mod--switch-keymap'); + this.nameToFileName.set('macro', 'icon-icon__macro'); } }