-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flexible ruler description #888
base: dev
Are you sure you want to change the base?
Flexible ruler description #888
Conversation
TODOsHere's a list of TODOs for this PR:
|
e0cf458
to
f4e7e32
Compare
cf7d6a7
to
06e0d42
Compare
Just a comment: |
Now I think the PR is good enough to remove draft status. Thanks @sebojolais for valuable input! |
Another good point of this PR: it is not a local feature, it will benefit for every users. |
Very useful feature! Another interesting option would be to have a specific logo in the corner of the page. |
0434504
to
623fc18
Compare
2fade4f
to
505eefc
Compare
505eefc
to
fd241f2
Compare
This PR is now updated to deal with the snap-to-grid feature. We can now snap to a flexible background definition as follows:
|
I remember some features requests that asked for the ability to have a dark green background to mimic some old school blackboards where the slate used was of this color. Do you think it would be possible to add this as a parameter, where one must give the background color, and the expected behavior (behave as a dark background, or behave as a light background) ? |
The background color is still drawn here: OpenBoard/src/domain/UBGraphicsScene.cpp Lines 2913 to 2920 in 4dd51f4
So the flexible ruler description does not affect that in any way. As long as you replace black and white by configurable colors there, it will work. And of course, the dark background should really be dark and the light background should be light, so that the foreground color substitution works. This means, that the feature of a configurable background color is completely independent of the rulings! |
Good point, it's not mandatory to attach this to the ruler descriptions. |
Yes, exactly. The ruler descriptions only describe the lines, not the color behind. They currently just assume that there are exactly two possible background colors, light and dark. And for those they offer the option to define a line color. But also this is only an option. If you omit that, then the line color defined in the preferences is used. The color definition in the ruling description is more meant for things like the red lines in Seyes or similar. Or just to modify the alpha value of the default line color, as I do it for the 1mm grid, where 10mm, 5mm and 1mm lines have different alpha, but still the same (default) color. |
7ccd532
to
72ec947
Compare
- add UBBackgroundRulings to read/write/keep a ruling description - add UBBackgroundManager to manage UBBackgroundRulings - add XML schema for ruling descriptions - add initial set of rulings - provide compatibility with legacy background flags - save and load rulings in document pages
- add a widget to the "Grid" preferences page - display all available background rulings - allow to reorder rulings by DnD - first six background rulings will be in background palette - persist preferred rulings
- save patterns when loading a document - allow to delete user provided patterns in preferences - move background button templates to resources - add copyright header - improve code style for new classes - add missing classes to gui.pri
- remove the extra template subdirectory from the path
- use stretch element to limit length of lines - positive values extend outside of page border - negative values restrict to inside page border - keep option to draw border lines - fix algorithm so that it works for any line group angle - stretch now also works for single lines (spacing = 0) - add stack element to limit stacking of line groups - positive values extend outside of page border - negative values restrict to inside page border - update XML schema accordingly - update rules accordingly
- the topmost line group was not painted in some cases - re-introduce a decrement lost in previous rework
- fixed regression - initialization of the black scene caused unintentional switch to dark background during startup
- ruled with border - crossed with border
- move the snap function from UBGraphicsScene to UBBackgroundRuling - calculate snap points based on ruling description - factor out common code with background drawing
72ec947
to
5a63e0d
Compare
This PR replaces the fixed background rulings (blank, lined, crossed, Seyes) by a mechanism that allows flexible ruler descriptions, where additional background rulings can simply be added by providing an additional description file. In the
resources/etc/background
directory, there is already a set of 12 different rulings (plus one for the blank page).The idea is to have an XML description for the rulings. There is an XML Schema file, which describes the format both formally and with user readable comments. Basically a background ruling is described as a set of line groups. Each line group has a defined angle and one or several lines in a specified distance. Line groups may repeat infinitely. The color and opacity of lines can be specified, but also the default colors defined in the preferences can be used. Additional settings allow to limit lines to the right and the left and to add a border on one or both sides.
For the user, the background palette changes as follows:
Background rulings are stored in the document SVG files. To provide some interoperability with existing documents, the current flags for "lined", "crossed" and "intermediateLines" are interpreted, when no ruling description is provided. These flags are also written when rulings are used, which to some extend mimic the "old" patterns.
See Flexible background patterns for a deeper description of the user experience and pattern design.
This PR is still a draft, as I want to collect more input about usability. The code may also need more testing.