phantasmal-world/src/quest_editor/gui/AsmEditorToolBar.ts

34 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-09-15 04:25:21 +08:00
import { ToolBar } from "../../core/gui/ToolBar";
import { CheckBox } from "../../core/gui/CheckBox";
import { asm_editor_store } from "../stores/AsmEditorStore";
2019-09-15 04:25:21 +08:00
export class AsmEditorToolBar extends ToolBar {
constructor() {
const inline_args_mode_checkbox = new CheckBox(true, {
label: "Inline args mode",
2019-09-16 02:47:13 +08:00
tooltip: asm_editor_store.has_issues.map(has_issues => {
let text =
"Transform arg_push* opcodes to be inline with the opcode the arguments are given to.";
if (has_issues) {
text += "\nThis mode cannot be toggled because there are issues in the script.";
}
return text;
}),
});
2019-09-15 04:25:21 +08:00
super({
2019-09-16 02:47:13 +08:00
children: [inline_args_mode_checkbox],
2019-09-15 04:25:21 +08:00
});
this.disposables(
asm_editor_store.inline_args_mode.bind_to(inline_args_mode_checkbox.checked),
inline_args_mode_checkbox.enabled.bind_to(asm_editor_store.has_issues.map(b => !b)),
);
2019-09-15 04:25:21 +08:00
this.finalize_construction(AsmEditorToolBar.prototype);
}
}