Editing Groups
When I create a group, I quite often miss a point. For now there is no function to add a point to a group, so I delete the group and create it again, in the hope of not forgetting a point again.
I thought of several solutions and the least complexe (at least I think it's the least one) I came up with is the following: In Draw mode, in the context menu of an element (right click), the following options appears:
- "Add to group"
- when hovering, a second sub menu opens, with the list of the groups in which the item isn't already. When clicking on one, it's added to it.
- "Remove from group"
- if the point is already in a group, the menu item appears. When hovering a sub menu opens with the list of the groups the element is in. When clicking on one, it's removed from it.
It could be the first step of a more complexe solution in the future. What do you think?
I'd like to work on this issue.
Comments (22)
-
-
repo owner I like Ronan's idea. You can do it.
-
repo owner @bespoketailoring , it is better to add your ideas as separate issues. Merging looks interesting. But "Start creating in group" even more better. Again, deserve two separate issue tickets.
-
reporter I started working on the issue, the context menu has now the 2 submenus "Add to group" and "Remove from group" (only when they are corresponding groups). The groups are listed and when clicking on them, it successfuly removes or add the item to the corresponding group.
Can you have a look at my code and tell me if you think it's ok so far ? https://bitbucket.org/crazyrori/valentina/commits/689ac7b088abfb42bb1e4d1b5f4b1922eba7caa2
I still want to do this :
- order the groups in alphabetical order (now they appear in creation order)
- support the redo / undo function
What should happen, if the user removes the last item of a group? For the moment, the parser throws an error when a group doesn't have items and the pattern can't be opened.
I see 2 possibilites :
- group without items should be allowed and there shoudln't be parsing error
- when the last item of a group is removed, the group should be removed as well
-
repo owner What should happen, if the user removes the last item of a group?
I think we shouldn't remove the group. But use strikethrough font for a name.
-
repo owner And another thing. You made new named branch issue826, it is a problem because of way how mercurial handle such branches. In opposite to git where your branch is just a pointer to commit and can be easily removed when we no longer need it a named branch will stay in repo forever. I don't use a named branch for short lived tasks. You have two options: use develop branch directly or create new feature branch. I just don't care which issue it was. But i care were changes finished or not. One issue can contain many changes and it is right way to show them in a separate branch. For example you already made two changes.
-
reporter I think we shouldn't remove the group. But use strikethrough font for a name.
ok, I prefer this option too, i'll keep the empty group then, make sure they can be parsed and us the strikethrough font in the group list when they're empty.
You made new named branch issue826
Ok good to know, I thought they worked the same. I just read about bookmarks : https://www.mercurial-scm.org/wiki/Bookmarks . Do you use this feature?
The feature branch already exists. Should I merge develop in it and use it, or create my own feature branche from develop, something like feature_crazyrori?
-
repo owner Do you use this feature?
Only locally. But there is possibility to push bookmarks if you want use them.
The feature branch already exists.
Yes, i know. You can have as many heads as you want. Just force creating. So, use exactly name "feature".
Just see a named branch as color of commits. Because each commit should contain finished changes and very often this is not possible i gather such changes in a feature branch. This way i can show my changes, work in separate branch, see it is part of unfinished task in history and merge them with develop at the end.
As to bookmarks, you can use them to distinguish between several named branches. For example we have several active feature branches and so on.
I know, this is little bit awkward especially because not so many developers want to learn two tools. Git approach is more popular these days.
-
reporter I have updated the schema to 0.7.8 to allow empty groups, I made the changes you recommended and updated the group list after adding / removing an item, so that an empty group gets the strikethrough font.
https://bitbucket.org/crazyrori/valentina/commits/a30b9616656d1059a1f6d3f75c94243169f576e8
Now I will see how to use the feature branch as you said. I'll let you know if I have difficulties with it.
After that I have the undo / redo and the alphabetical order still on my list.
-
reporter Alphabetical order is in:
https://bitbucket.org/crazyrori/valentina/commits/0ba063992ccb197557100af61c582afea6e92556
Now only the undo redo is missing.
-
reporter I have a little problem, maybe you can help me Roman.
In the VDrawTool::ContextMenu, I have acces to the toolId and the itemId. The itemId is only set if it's a point.
In the groups, the elements are defined with the itemId and the toolId, with itemId = toolId when the itemId is not set.
I have a special case, where I want to add for instance a spline that is the result of a rotation or a flip by axis to a group.
In this case, in ContextMenu the toolId is set for instance to the specific rotation, but the itemId is null because the spline is not a point.
That's my problem, how do I find out the Id of the spline (the idObject of the item inside the rotation) ? Because for now, the itemId is null and this i add to the group toolId = itemId = Id of the rotation, wich doesn't identify the spline.
-
repo owner I see. Currently there is no way to get this information. I propose send an id as a point does. To determine which type it is use
VContainer::GetGObject
andVGObject::getType
. -
reporter Thank you for the tipp. I tried something, is it what you meant:
https://bitbucket.org/crazyrori/valentina/commits/b80cfa0da311fbfd7703d7d38168d90809ca608d
It's working well. Is VSimpleCurve the base class of the the arc, elliptical arc, and curved path?
-
repo owner Is VSimpleCurve the base class of the the arc, elliptical arc, and curved path?
Yes.
-
reporter https://bitbucket.org/crazyrori/valentina/commits/a16862e3a6cde339e9c6b980bfaee219ba016ffc
I started working on the undo command, can you have a look if it's fine so far and also tell me how I should handle the connect between the AddItemToGroup class and the Update of the Groups? I wrote a question/comment in the vdrawtool.h.
-
reporter I started defining an UpdateGroups in the mainwindow. Now I have a problem in the vdrawtool.h
When connecting the signal to the slot (kline 292), i get the error "undefined reference to MainWindow::UpdateGroups()" and I can't find a solution cause I don't understand the problem.
Can you have a look at my commit and tell me if you see an error? Thank you.
-
repo owner You cannot use MainWindow like this. First of all VDrawTool lives in static library. When you link the code linker cannot find appropriate reference. To resolve this issue make MainWindow::UpdateGroups() virtual and add to VAbstractMainWindow empty virtual definition too. Use reference to VAbstractMainWindow elsewhere in code. Don't use MainWindow directly. This should help you.
-
reporter This should help you.
Yes thank you! Now I can go on. I still have a lot to learn :-)
-
reporter https://bitbucket.org/crazyrori/valentina/commits/a9b616fc23ba6c4da1c25e053298784493047ed8
Undo and redo now work. It's almost finished.
One last thing that I would like to do is to unselect the current item in the draw mode when changing the visibility of a group and when adding an item to a group, because in some cases the selection is still there but the element underneath is invisible.
-
repo owner merge feature issue 826 into develop
→ <<cset 58359511424f>>
-
repo owner - changed status to resolved
resolves
#826code refactoring and corrections→ <<cset 5f0d3f6e9a9f>>
-
repo owner Issue
#770was marked as a duplicate of this issue. - Log in to comment
I would like to add something to this.
"Start creating in group".
User would toggle this mode and all points created until untoggled will be added to a specific group.
This would greatly improve usability.
Agree with all ronan's points. now I just hack the val file to add to groups or merge groups. This is only for advanced users, almost nobody will bother.,