WIP allow editing habit/task labels
This commit is contained in:
@@ -23,7 +23,7 @@ import flixel.util.FlxSave;
|
||||
import flixel.input.mouse.FlxMouseEventManager;
|
||||
import flixel.addons.display.FlxExtendedSprite;
|
||||
import flixel.addons.plugin.FlxMouseControl;
|
||||
import flixel.addons.ui.FlxInputText;
|
||||
import kiss_flixel.KissInputText;
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import kiss_tools.FlxKeyShortcutHandler;
|
||||
|
@@ -40,7 +40,7 @@
|
||||
(prop &mut :EntryType typeAdding Todo)
|
||||
(prop &mut :Array<String> labelsAdding [])
|
||||
(prop &mut :Bool addingLabels false)
|
||||
(prop &mut :FlxInputText entryNameText)
|
||||
(prop &mut :KissInputText entryNameText)
|
||||
|
||||
(prop &mut :DebugLayer debugLayer null)
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
"Add a label for this ${typeDescriptor}, or use SHIFT+ENTER to add a ${multipleLabelDescriptor}:")
|
||||
(set entryCreationWindow (new SimpleWindow title null null 0.9 0.9 true xKey backToEntryWindow))
|
||||
// TODO don't allow /, +, $, *
|
||||
(set entryNameText (new FlxInputText 0 0 FlxG.width "" textSize true))
|
||||
(set entryNameText (new KissInputText 0 0 FlxG.width "" textSize true))
|
||||
(entryCreationWindow.addControl entryNameText)
|
||||
(entryCreationWindow.makeText "Create" FlxColor.LIME ->:Void _ (addCreatedEntry))
|
||||
(when entryWindow
|
||||
@@ -193,6 +193,7 @@
|
||||
(prop &mut :SimpleWindow entryWindow null)
|
||||
(prop &mut :SimpleWindow puzzlePackChoiceWindow null)
|
||||
(prop &mut :SimpleWindow entryDeletionWindow null)
|
||||
(prop &mut :SimpleWindow entryEditWindow null)
|
||||
(prop &mut :SimpleWindow entryCreationWindow null)
|
||||
(prop &mut :SimpleWindow priorityWindow null)
|
||||
|
||||
@@ -200,7 +201,7 @@
|
||||
(or (tempWindowIsShown) (and entryWindow (entryWindow.isShown))))
|
||||
|
||||
(method tempWindowIsShown []
|
||||
(doFor window [puzzlePackChoiceWindow entryDeletionWindow entryCreationWindow priorityWindow]
|
||||
(doFor window [puzzlePackChoiceWindow entryDeletionWindow entryCreationWindow priorityWindow entryEditWindow]
|
||||
(when (and window (window.isShown))
|
||||
(return true)))
|
||||
false)
|
||||
@@ -342,6 +343,17 @@
|
||||
}
|
||||
null null FlxColor.WHITE 0.9 0.9 true (defAndReturn prop xKey "escape") backToEntryWindow true)]
|
||||
(set priorityWindow pw))))
|
||||
|
||||
(_makeText "Edit a habit or task's labels" 0
|
||||
->_
|
||||
(defAndCall method chooseEditLabels
|
||||
(entryWindow.hide)
|
||||
(let [editWindow (SimpleWindow.promptForChoice "Edit which habit/task's labels?"
|
||||
(model.allUndeletedEntries)
|
||||
editLabels
|
||||
null null FlxColor.WHITE 0.9 0.9 true xKey backToEntryWindow true)]
|
||||
(set entryEditWindow editWindow))))
|
||||
|
||||
(let [showOrHide (if model.showLowerPriority "Hide" "Show")]
|
||||
(_makeText "$showOrHide lower-priority habits and tasks" 0
|
||||
->_
|
||||
@@ -842,7 +854,7 @@
|
||||
|
||||
(method createIntervalEntry []
|
||||
(set entryCreationWindow (new SimpleWindow "After finishing this habit, how many days do you wait before doing it again?" null null 0.9 0.9 true xKey backToEntryWindow))
|
||||
(set entryNameText (new FlxInputText 0 0 FlxG.width "" textSize true))
|
||||
(set entryNameText (new KissInputText 0 0 FlxG.width "" textSize true))
|
||||
(set addingLabels false)
|
||||
(entryCreationWindow.addControl entryNameText)
|
||||
(entryCreationWindow.makeText "Confirm" FlxColor.LIME
|
||||
@@ -892,4 +904,27 @@
|
||||
(method :Array<Array<KissExtendedSprite>> listAvailableMatches []
|
||||
(apply concat (the Array<Array<Array<KissExtendedSprite>>> (withConnectedAndMatching for
|
||||
(for piece (filter matchingPieces ->p !(contains connectedPieces p))
|
||||
[s piece])))))
|
||||
[s piece])))))
|
||||
|
||||
(method editLabels [:Entry e]
|
||||
(let [window (new SimpleWindow "Editing labels" null null 0.9 0.9 true xKey backToEntryWindow)
|
||||
inputTexts (for l e.labels
|
||||
// TODO don't allow /, +, $, *
|
||||
(new KissInputText 0 0 FlxG.width l.label textSize true))]
|
||||
|
||||
// TODO allow adding more labels in between/before/at end
|
||||
// TODO allow deleting labels (keep score?)
|
||||
|
||||
(doFor inputText inputTexts
|
||||
(window.addControl inputText))
|
||||
|
||||
(window.makeText "Save" FlxColor.LIME ->:Void _
|
||||
{
|
||||
(set e.labels (for [inputText label] (zip inputTexts e.labels)
|
||||
(object points label.points label inputText.text)))
|
||||
(model.save)
|
||||
(window.hide)
|
||||
(backToEntryWindow)
|
||||
})
|
||||
(set entryEditWindow window)
|
||||
(window.show)))
|
Reference in New Issue
Block a user