Hi
Here a small description of something that could be useful I think.
(Useful for me sure , but maybe useful for other users too
)
Edit: rewritten feature taking in account remarks
Description
My idea is to be able to store some comments on layers, ideally a right-click on layer and then “properties” menu to display layer properties.
Currently, I use a text file in addition to kra file…
It’s better than nothing but:
- It will be faster to write directly on layer
- No risk to loose notes (as embedded in Kra file)
- Don’t need to update text file if layer is renamed/deleted/moved
Solution to anotate directly by drawing on a paint layer or in vector layer is a workaround but:
- Can’t easily change content on a paint layer
- Not ideal as not linked directly to a layer, and usually these kind of notes are more technical and ideas that don’t really have to be available directly on drawing area
Editing a comment on a layer
The Layer Properties dialog box could be completed with a simple text editor to take note about layer content.
Using the dialog box properties make sense:
- Comment would be a property of layer
- No need to implement a new interface, just improve existing one
- Easy to access (context menu on layer, "properties / properties buttons in layer docker)
Ideally, editor for text comment:
- Is pure text only
- Easier/faster to implement than rich text formatting interface
- Rich text formatting interface is source of bug
- Idea for comment is to take short notes, not a complete documentation
Note: editor as a rich text edit could off course be implemented if it’s not too complex to implement/maintain
If a rich text edit is implemented, please take care about merging of rich text content that could be a little bit more complex and plain text (cf. below rules defined about layers merge)
- Use monospace font
- Because it’s not rich text, monospace font allows simple formatting with spaces, minus and plus signs
(old school mode :-))
Note: in case of a rich text editor is implemented, at least:
- Choice of font familly & size
- Bold & Italic
Other formatting action are bonus:- Underline & Strikethrough
- Text color
- Bullet list
- Accept unicode characters (UTF8)
- Because maybe some users like chinese or japanese need to use it
- Because other users would use some unicode characters
- No text size limit
- Even if main usage is to take short notes rather than a complete documentation, it’s better to not be blocked with a text size limit
- But maybe 32KB or 64KB limit size could be imposed for technical reasons if needed
- Optional functions
Could be useful for lazy users
- A button [Current date/time]
– Insert current date/time (locale format) at current cursor position - A button [Separator]
– Insert a separator (15 minus sign “---------------”) at current cursor position - A button [Clear comment]
– Reset comment content
Note: an updated mockup can be provided if needed
Creation of layer
When a new layer is created, there’s no comment
Duplicate of a layer
When a layer is duplicated:
- if original layer have no comments, duplicated layer have no comments
- if original layer have comments, duplicated layer have the same comments prefixed with following header
–---[Duplicated from layer "<Layer name>" @ YYYY-MM-DD HH24:MI:SS]---
(Date/time should match local format)
Deletion of layer
When a layer with comment is deleted, there’s no confirmation, no warning (like it’s made for a layer with painted content)There’s no reason to have an alert/warning about this more than
Editing layer properties
When opening the property editor, if comment text editor need scrollbars, scrollbar is on top (let user start comment from beginning)
But cursor position is at the end (let user continue to edit comment from the end)
Merge of layers
Keep in mind that it’s always a “merge down” and then, bottom layer is always the final layer
When layers are merged, the following rules can be applied:
- Merged layer (“above” layer) comment is added below final layer comment
- A blank line followed by a specific separator is added between comments
–---[From merged layer "<Layer name>" @ YYYY-MM-DD HH24:MI:SS]---
(Date/time should match locale format)
Example:
- Layer 4 (comment = “C444”)
- Layer 3 (comment = “C333”)
- Layer 2 (comment = no)
- Layer 1 (comment = “C111”)
Merged result:
C111
---[From layer "Layer 3" @ 2020-02-02 00:25:00]---
C333
---[From layer "Layer 4" @ 2020-02-02 00:25:00]---
C444
Note: When doing multiple “duplicate layer” and then “merge” actions, comments in final layer would be awful
A solution would be to ask user if he want to merge comments or ignore comments…
But I think this case should be ignored because it’s a workflow breaker
And the most simple case is to let user manually remove unwanted merged comments from final layer (easy as merged comment are prefixed with a separator)
Copy/Paste of layers
When a layer is pasted (ie: right click on layer>copy layer and then right-click>paste layer):
- if original layer have no comments, pasted layer have no comments
- if original layer have comments, pasted layer have the same comments prefixed with following header
–---[Pasted from layer "<Layer name>" @ YYYY-MM-DD HH24:MI:SS]---
(Date/time should match locale format)
Note: when a group layer is copied/pasted, rule is applied for group layer and all sub-layers
Cut/Paste of layers
When a layer is cut/pasted, comments should be unchanged
Copy/Paste a selection from layer
Only a copy/paste of a layer should impact comments.
When doing a copy of a selection and paste it as a new layer, it doesn’t seems to be a good idea to copy comments content because the copied/pasted selection might be modified/transformed/filtered before being merged with somethingelse and in this case it’s better to let user define an appropriate comment to new layer.
(and same rule for Cut selection to a new layer and Copy selection to a new layer)
Concerned layers
Should be concerned by this feature:
- Paint layer
- Vector layer
- Group layer
An maybe:
- File layer
- Clone layer
Layers docker
We need to easily spot layers with comments in tree without overload current layer row.
Icons
A new icon on right side is added according to situation
Case | Icon |
---|---|
Layer without comments | nothing |
Layer with comments | ![]() |
Group layer without comments + sub-layer with comments | ![]() |
Group layer with comments + sub-layer with comments | ![]() |
Example of layers docker with commented layers:
Note: Sorry for icon quality, drawn quickly, but it’s more here to provide an example
When comment icon is visible and not grayed, a click on it will open properties dialog box, allowing user to read/edit comment
Tooltip
Tooltip have to be improved to display comment.
Note: for a group layer with sub-layer for which comment are set, property value is:
- “Yes (Sub layers: Yes)” if group have a comment
- “No (Sub layers: Yes))” if group have a comment
For comment text, according to implementation choice:
- If plain text, text use monospace font
- If rich text, text is formatted as defined by user
According to what user set in comments, content can be heavy and oversized to be properly displayed in a tooltip.
Here some possible rules to apply concerning tooltip size (can be affined if needed)
-
Width should be:
MAX(thumbnail.width, thumbnail.height) + propertiesBox.width + 2 * margin
-
Height should be:
2 * (MAX(thumbnail.width, thumbnail.height, propertiesBox.height) + 2 * margin) + title.height
– Meaning: height for comment part is equal to height defined for properties+thumbnail
(sorry mockup doesn’t respect this rule)
Note: currently, there’s a bug on tooltip layout
=> Properties box content shouldn’t be wrapped, tooltip width should be adapted according to content
Context menu
Note: no time for now to write it properly, just write the idea
Context menu is udpated with a new menu entry
[ ] Show comments on layers
When checked (by default) comments icons are visible
When unchecked, comments icons are not visible
=> option is global to all layers (not per layer like “pin to timeline”)
Status is saved in kra file
Saving KRA document
A document made from a previous Krita version won’t have comments; then consider there’s no comments.
For retro-compatibility, a document made with Krita X+1 must be able to be opened with a Krita X-1
This is a technical part for developper but an unknown XML node and/or attribute might currently be ignored when maindoc.xml is loaded.
Like current files in layers directory, in maindoc.xml, a reference to a text file *layerN.comment could be a solution.
Python
Ideally, the comment property would be accessible in python:
myNode.setComment(text)
myNode.comment()
This will allows plugins to provide extended functionnalities around comment (markdown formatting, direct editor in docker for selected layer, …)
Currently the Node class is the base class for all layers types.
But also the class used to manage paint layer type.
This means:
- Method to get/set comments should be implemented in this class
-
myNode.comment()
should returnNone
for layers type for which comment is not possible
– Method also returnsNone
if no comments are set on a layer that support comments -
myNode.setComment()
should do nothing for layers type for which comment is not possible
Grum999