diff options
-rw-r--r-- | todo.txt | 2 | ||||
-rw-r--r-- | ui.js | 43 |
2 files changed, 42 insertions, 3 deletions
diff --git a/todo.txt b/todo.txt index 905c49b..869e88d 100644 --- a/todo.txt +++ b/todo.txt @@ -501,3 +501,5 @@ TODO: "Lock scroll to cursor" option in queue listing. Will make the listing past the ends... maybe put a dim background behind the element currently occupying the locked position, scrolling such that the selected element is at that position whenever doing so doesn't go out of bounds?) + +TODO: Revisit labels and notes features! They're commented out for now :P diff --git a/ui.js b/ui.js index 57fc22f..8cb0501 100644 --- a/ui.js +++ b/ui.js @@ -53,7 +53,10 @@ const { } } = require('tui-lib') +/* text editor features disabled because theyre very much incomplete and havent + * gotten much use from me or anyonea afaik! const TuiTextEditor = require('tui-text-editor') +*/ const { promisify } = require('util') const { spawn } = require('child_process') @@ -80,7 +83,7 @@ const keyBindings = [ ['isScrollToStart', telc.isHome], ['isScrollToEnd', telc.isEnd], ['isTogglePause', telc.isSpace], - ['isToggleLoop', 'l', {caseless: false}], + ['isToggleLoop', 'l'], ['isStop', telc.isEscape], ['isVolumeUp', 'v', {caseless: false}], ['isVolumeDown', 'V', {caseless: false}], @@ -100,7 +103,7 @@ const keyBindings = [ ['isShuffleQueue', 's'], ['isClearQueue', 'c'], ['isFocusMenubar', ';'], - ['isFocusLabels', 'L', {caseless: false}], // todo: better key? to let isToggleLoop be caseless again + // ['isFocusLabels', 'L', {caseless: false}], // todo: better key? to let isToggleLoop be caseless again ['isSelectUp', telc.isShiftUp], ['isSelectDown', telc.isShiftDown], @@ -221,6 +224,7 @@ class AppElement extends FocusElement { this.textInfoPane = new Pane() this.addChild(this.textInfoPane) + /* this.textEditor = new NotesTextEditor() this.textInfoPane.addChild(this.textEditor) this.textInfoPane.visible = false @@ -229,6 +233,7 @@ class AppElement extends FocusElement { this.root.select(this.tabber) this.fixLayout() }) + */ if (!this.config.showTabberPane) { this.tabberPane.visible = false @@ -725,11 +730,13 @@ class AppElement extends FocusElement { grouplikeListing.pathElement.on('select', item => this.reveal(item)) grouplikeListing.on('menu', (item, el) => this.showMenuForItemElement(el, grouplikeListing)) + /* grouplikeListing.on('selected', item => this.editNotesFile(item, false)) grouplikeListing.on('edit-notes', item => { this.reveal(item) this.editNotesFile(item, true) }) + */ } showContextMenu(opts) { @@ -883,6 +890,7 @@ class AppElement extends FocusElement { items.splice(items.indexOf(item), 0, file) } + /* async editNotesFile(item, focus) { if (!item) { return @@ -925,14 +933,17 @@ class AppElement extends FocusElement { this.fixLayout() } } + */ openSpecialOrThroughSystem(item) { if (item.url.endsWith('.json')) { return this.handlePlaylistSource(item.url, true) + /* } else if (item.url.endsWith('.txt')) { if (this.textInfoPane.visible) { this.root.select(this.textEditor) } + */ } else { return this.openThroughSystem(item) } @@ -1056,8 +1067,10 @@ class AppElement extends FocusElement { canProcessMetadata && isTrack(item) && {label: 'Process metadata', action: () => this.processMetadata(item, true)}, isOpenable(item) && item.url.endsWith('.json') && {label: 'Open (JSON Playlist)', action: () => this.openSpecialOrThroughSystem(item)}, isOpenable(item) && {label: 'Open (System)', action: () => this.openThroughSystem(item)}, + /* !hasNotesFile && isPlayable(item) && {label: 'Create notes file', action: () => this.editNotesFile(item, true)}, hasNotesFile && isPlayable(item) && {label: 'Edit notes file', action: () => this.editNotesFile(item, true)}, + */ canControlQueue && isPlayable(item) && {label: 'Remove from queue', action: () => this.unqueue(item)}, {divider: true}, @@ -1132,7 +1145,9 @@ class AppElement extends FocusElement { await this.backend.stopPlayingAll() } + /* await this.textEditor.save() + */ this.emit('quitRequested') } @@ -1193,6 +1208,7 @@ class AppElement extends FocusElement { const leftWidth = Math.max(Math.floor(0.8 * this.contentW), this.contentW - 80) + /* if (this.textInfoPane.visible) { this.textInfoPane.w = leftWidth if (this.textEditor.isSelected) { @@ -1206,6 +1222,7 @@ class AppElement extends FocusElement { this.textEditor.fillParent() this.textEditor.fixLayout() } + */ if (this.tabberPane.visible) { this.tabberPane.w = leftWidth @@ -1679,8 +1696,10 @@ class GrouplikeListingElement extends Form { } else if (keyBuf[0] === 12) { // ctrl-L if (this.grouplike.isTheQueue) { this.form.selectAndShow(this.app.SQP.playingTrack) + /* } else { this.toggleExpandLabels() + */ } } else if (keyBuf[0] === 1) { // ctrl-A this.toggleSelectAll() @@ -1713,6 +1732,7 @@ class GrouplikeListingElement extends Form { this.scheduleDrawWithoutPropertyChange() } + /* toggleExpandLabels() { this.expandLabels = !this.expandLabels for (const input of this.form.inputs) { @@ -1725,6 +1745,7 @@ class GrouplikeListingElement extends Form { } } } + */ buildItems(resetIndex = false) { if (!this.grouplike) { @@ -1816,12 +1837,14 @@ class GrouplikeListingElement extends Form { itemElement.on(evtName, (...data) => this.emit(evtName, itemElement.item, ...data)) } + /* itemElement.on('unselected labels', () => { if (!this.expandLabels) { itemElement.expandLabels = false itemElement.computeText() } }) + */ } loadParentGrouplike() { @@ -2594,9 +2617,12 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { this.item = item this.app = app this.hideMetadata = false + + /* this.expandLabels = false this.labelsSelected = false this.selectedLabelIndex = 0 + */ } drawTo(writable) { @@ -2616,6 +2642,7 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { this.computeText() } + /* unselected() { this.unselectLabels() } @@ -2696,16 +2723,20 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { getMinLeftTextColumns() { return this.expandLabels ? 0 : super.getMinLeftTextColumns() } + */ getLeftPadding() { return 3 } + /* getSelfSelected() { return !this.labelsSelected && super.getSelfSelected() } + */ keyPressed(keyBuf) { + /* if (this.labelsSelected) { if (input.isRight(keyBuf)) { this.selectNextLabel() @@ -2715,7 +2746,7 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { this.unselectLabels() return false } - } else if (input.isDownload(keyBuf)) { + } else */ if (input.isDownload(keyBuf)) { this.emit('download') } else if (input.isQueueAfterSelectedTrack(keyBuf)) { this.emit('queue', {where: 'next-selected'}) @@ -2733,15 +2764,18 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { this.emit('remove') } else if (input.isMenu(keyBuf)) { this.emit('menu', this) + /* } else if (input.isFocusTextEditor(keyBuf)) { this.emit('edit-notes') } else if (input.isFocusLabels(keyBuf)) { this.labelsSelected = true this.expandLabels = true this.selectedLabelIndex = 0 + */ } } + /* unselectLabels() { this.labelsSelected = false this.emit('unselected labels') @@ -2763,6 +2797,7 @@ class InteractiveGrouplikeItemElement extends BasicGrouplikeItemElement { } this.computeText() } + */ clicked(button, {ctrl}) { if (button === 'left') { @@ -4049,6 +4084,7 @@ class PartyBanner extends DisplayElement { } } +/* class NotesTextEditor extends TuiTextEditor { constructor() { super() @@ -4141,5 +4177,6 @@ class NotesTextEditor extends TuiTextEditor { } } } +*/ module.exports = AppElement |