Repository navigation
Adding key action to move entry boundary to cursour position under multiple entries editing mode #45
Description
Activity
Thank you for your idea and work!
I think your idea looks good, except for the wording:
forwardandbackwardmight not be clear enough. Personally, what you are doing in the demo looks likemoving backwardto me.
How about usingleft/right? e.g.Move the closest boundary in the left to cursor position(please ignore this if you have a better choice)Another idea:
Is there any chance / does it make sense to just use the existingSetValueXactions instead?
Currently, they are only used in the single-edit mode, simply because it takes some extra cost to figure out which entry it should refer to in the multiple-edit mode. But since you are implementing this part, would it be possible to just support allSetValueXactions in the multiple-edit mode? The start/end boundaries should be mapped to0andfieldCount + 1(ASIS).For naming, maybe
Move Left/Right Boundary To Cursor Positioncould be consise version of your suggestion that shows in key action setting dialog.And I would say it kindda make sense to correspond
SetValue1withMove Left, andSetValue2withMove Rightif consider start and end boundaries without potential field in that entry. I'm not pretty sure wheather there is this kind of situation that entries can have fields with shortcuts in multiple-edit mode. And fixed-drag might also need be considered under the situation. I would like to do some experiment first to see if I can handle it. I will let you know the result ASAP.If you have any other advice or suggestion, please let me know.
Reacted by colin.wengAfter some attempts, and try editing with this new key action, I found out that maybe seperate
SetValueXandMove Left/Right Boundary To Cursor Positionis semanticly better. When excutingSetValueX, you can move the parameter line from both direction relative to cursor position (basicly anywhere you want), while latter can only move from one direciton to the cursor. So maybe adding new key action would be more appropriate? I guess?And
SetValueXcould also be implemented in multiple-edit mode if I can get the index of current entry, but it seems like this value cannot be access inMakerStateand it is stored inEditorState.project. Is there anyway to accessing this value? Or is there a better way to doSetValueX?I think it's good to have both
- new Move Left/Right actions
- support SetValueX in multi-edit mode
About how to access the current entry:
In multi-edit mode, theMarkerState.entrieswill be assigned with a list of all entries that are currently being edited.
The extra info we need here, is "which entry is the current cursor on".
Theproject.currentModule.currentIndexhas less meaning here, because user can edit any entries without selecting them. Instead, we should focus on the cursor position.
Currently, we have apositionsaved inMarkerState.cursorState(typeMarkerCursorState), but it's only maintained when theCursortool is being used. So we may need to modify the update logic to make it always updated. For example, we can move thepositionoutsideMarkerCursorStateas a direct property ofMarkerState(here, note that it needs to be aMutableState<Float>).
Once we havepositionupdated all the time, we can use its value to find which entry inentrieshas currently covered the cursor position during the execution of the actions.
I hope this answers your question.Sorry for the late reply due to some personal issue and I am so so sorry. I hope it would not cause any trouble to you.
Back in this feature, I would follow your advice to have both:- support SetValue1-2 in multi-edit mode corresponding to left and right parameter
- new Move actions for currentEntry
While trying to get currentIndex I add
currentIndexas a direct property ofMarkerState:fun rememberMarkerState(...) { ... val currentIndex = mutableStateOf(project.currentModule.currentIndex) ... }
But it would not get updated by jumping to other entry, both click on entry list or scrolling, but it could be updated after entries updated, like through SetValueX of dragging. How could I keep it update all the time?
And beside, I am also working on two other feature: click on canvas to jump to entry and border highlight, which might look like this:
Border highlight

Click to jump

Should I open new issue for further disscusion or it is fine to disscuss here?
But it would not get updated by jumping to other entry, both click on entry list or scrolling, but it could be updated after entries updated, like through SetValueX of dragging. How could I keep it update all the time?
Sorry I am not sure what you are asking. Maybe you can open a PR if you already have most of the code, and we can discuss on the PR. It will be more easy for me to help testing.
For other two features, samely, if you already have code, PR is better, if not, you can open new issues for each 😄
Why
In oto, there is default key action to set certain parameter to cursor position, beacuse of its fields are set. While in textgrid is different, with no preset fields and fields numbers, so the default key action would not work. I want to add a similar feature to move parameter line by key action.
What
In details, two key action,
Move Boundary Forward To Cursor PositionandMove Boundary Backward To Cursor Positionwould be added, and what they do, is base on current cursor position, move the boundary line after or before the cursor position (corresponding move forward and backward) to the cursor position.I wrote a little demo to show how it may works (only move forward is implemented)

In demostration, I use a key action to move three parameter lines forward to current cursor position. If this feature is welcome, I would like to complete it and notify with a pull request.
Where
This change only work under multiple entries mode, which means single entry mode like editing oto would not be affected. Currently I only test on textgrid, but I assume labeler that edit
labfile would also work.Customize these key action and corrrespondent Simplified Chinese translation would also be added.
How
To implentment the main functionalty, I would modify
getUpdatedEntriesByKeyActionincom.sdercolin.vlabeler.ui.edior.labeler.marker.MarkerState.kt, when the size ofentriesis more than 1 it would excute some other code, instead of early return. Also, to locate entry base on cursor position, anthor function would be added inMarkerStateclass, which would return the entry and its index. Beside, fix-drag would not be consider since this has little pratical meaning.Additional context
Please let me know if there is any problem or lack of consideration, thanks.