mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-07 09:25:33 +00:00
chore(developer): cleanup displayUnderlying flag in kmw compiler
This commit is contained in:
parent
164823a643
commit
a67abadb2f
2 changed files with 12 additions and 34 deletions
|
|
@ -3,23 +3,11 @@ import { FTabStop, nl } from "./compiler-globals.js";
|
|||
import { CKeymanWebKeyCodes } from "./keymanweb-key-codes.js";
|
||||
import { RequotedString } from "./write-compiled-keyboard.js";
|
||||
|
||||
interface VKFFResult {
|
||||
result: string;
|
||||
displayUnderling: boolean;
|
||||
}
|
||||
|
||||
export function VisualKeyboardFromFile(visualKeyboard: VisualKeyboard.VisualKeyboard, debug: boolean): VKFFResult {
|
||||
let f102 = visualKeyboard.header.flags & KvkFile.BUILDER_KVK_HEADER_FLAGS.kvkh102 ? '1' : '0';
|
||||
|
||||
let result = `{F:' 1em "${RequotedString(visualKeyboard.header.unicodeFont.name)}"',K102:${f102}}` +
|
||||
export function VisualKeyboardFromFile(visualKeyboard: VisualKeyboard.VisualKeyboard, debug: boolean): string {
|
||||
const f102 = visualKeyboard.header.flags & KvkFile.BUILDER_KVK_HEADER_FLAGS.kvkh102 ? '1' : '0';
|
||||
return `{F:' 1em "${RequotedString(visualKeyboard.header.unicodeFont.name)}"',K102:${f102}}` +
|
||||
`;` + VisualKeyboardToKLS(visualKeyboard) +
|
||||
';' + BuildBKFromKLS(debug);
|
||||
|
||||
return {
|
||||
result: result,
|
||||
// TODO: this can go in caller, later
|
||||
displayUnderling: !!(visualKeyboard.header.flags & KvkFile.BUILDER_KVK_HEADER_FLAGS.kvkhDisplayUnderlying)
|
||||
}
|
||||
}
|
||||
|
||||
function WideQuote(s: string): string {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { KMX, CompilerOptions, CompilerCallbacks, KvkFileReader, VisualKeyboard, KmxFileReader, Osk } from "@keymanapp/common-types";
|
||||
import { KMX, CompilerOptions, CompilerCallbacks, KvkFileReader, VisualKeyboard, KmxFileReader, Osk, KvkFile } from "@keymanapp/common-types";
|
||||
import { ExpandSentinel, incxstr, xstrlen } from "./util.js";
|
||||
import { options, nl, FTabStop, setupGlobals, IsKeyboardVersion10OrLater, callbacks, FFix183_LadderLength } from "./compiler-globals.js";
|
||||
import { JavaScript_ContextMatch, JavaScript_KeyAsString, JavaScript_Name, JavaScript_OutputString, JavaScript_Rules, JavaScript_Shift, JavaScript_ShiftAsString, JavaScript_Store, zeroPadHex } from './javascript-strings.js';
|
||||
|
|
@ -54,7 +54,7 @@ export function WriteCompiledKeyboard(callbacks: CompilerCallbacks, kmnfile: str
|
|||
let vMnemonic: number = 0;
|
||||
let /*s: string,*/ sRTL: string = "", sHelp: string = "''", sHelpFile: string = "",
|
||||
sEmbedJS: string = "", sEmbedCSS: string = "";
|
||||
let sVisualKeyboard: string = "", sFullName: string = "";
|
||||
let sVisualKeyboardFilename: string = "", sFullName: string = "";
|
||||
let sBegin_NewContext: string = "", sBegin_PostKeystroke: string = "";
|
||||
let sLayoutFile: string = "", sVKDictionary: string = "";
|
||||
let linecomment: string; // I3438
|
||||
|
|
@ -81,7 +81,7 @@ export function WriteCompiledKeyboard(callbacks: CompilerCallbacks, kmnfile: str
|
|||
sHelp = '"'+RequotedString(fsp.dpString)+'"';
|
||||
}
|
||||
else if (fsp.dpName == 'VisualKeyboard' || fsp.dwSystemID == KMX.KMXFile.TSS_VISUALKEYBOARD) {
|
||||
sVisualKeyboard = fsp.dpString;
|
||||
sVisualKeyboardFilename = fsp.dpString;
|
||||
}
|
||||
else if (fsp.dpName == 'EmbedJS' || fsp.dwSystemID == KMX.KMXFile.TSS_KMW_EMBEDJS) {
|
||||
sEmbedJS = fsp.dpString;
|
||||
|
|
@ -190,24 +190,14 @@ export function WriteCompiledKeyboard(callbacks: CompilerCallbacks, kmnfile: str
|
|||
// layout platform.displayUnderlying property or, if that is not present for
|
||||
// the given platform, by the OSK property.
|
||||
let fDisplayUnderlying = false;
|
||||
let sVisualKeyboard = 'null'; // 'null' as a string is correct
|
||||
|
||||
if (sVisualKeyboard != '') {
|
||||
// TODO: stop reusing sVisualKeyboard for both filename and content
|
||||
let reader = new KvkFileReader();
|
||||
let kvk: VisualKeyboard.VisualKeyboard = reader.read(kvkData);
|
||||
let result = VisualKeyboardFromFile(kvk, options.saveDebug);
|
||||
if(!result.result) {
|
||||
// TODO: error
|
||||
sVisualKeyboard = 'null';
|
||||
}
|
||||
else {
|
||||
sVisualKeyboard = result.result;
|
||||
}
|
||||
if (sVisualKeyboardFilename != '') {
|
||||
const reader = new KvkFileReader();
|
||||
const kvk: VisualKeyboard.VisualKeyboard = reader.read(kvkData);
|
||||
fDisplayUnderlying = !!(kvk.header.flags & KvkFile.BUILDER_KVK_HEADER_FLAGS.kvkhDisplayUnderlying);
|
||||
sVisualKeyboard = VisualKeyboardFromFile(kvk, options.saveDebug);
|
||||
}
|
||||
else {
|
||||
sVisualKeyboard = 'null';
|
||||
}
|
||||
|
||||
|
||||
const fMnemonic = vMnemonic == 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue