Commit Graph

6 Commits

Author SHA1 Message Date
Jules Aguillon
ad7314a016 Move layout definitions into srcs/layouts
This separates the layout definitions from the special layouts
(bottom_row, greekmath) and other unrelated files (method, settings).

This is also a more intuitive location for layouts and make the resource
directory easier to navigate.

Under the hood, layouts are copied back into
build/generated-resources/xml.
2024-01-21 16:34:49 +01:00
Jules Aguillon
500f4e41d3 Allow multiple custom layouts
This merges the "Layouts" option with the "Custom layout" option.
A custom layout becomes an item in the "Layouts" list among the other
layouts. It's possible to add several custom layouts.

Selecting the "Custom layout" item in the list opens a second dialog for
entering the layout description.

Layouts are serialized as JSON object and are decoded solely in the
LayoutsPreference class.
2023-08-16 12:21:23 +02:00
Jules Aguillon
dad5f57a03 Allow more than 2 layouts
The two layout selection options are replaced by a ListGroupPreference
that allow to enter an arbitrary amount of layouts.

The "switch_second" and "switch_second_back" keys are replaced by
"switch_forward" and "switch_backward", which allow to cycle through the
selected layouts in two directions.

Layouts are changed to place these two key on the space bar.
The backward key is not shown if there's only two layouts.
2023-07-30 21:44:14 +02:00
Jules Aguillon
de6c3b024d Update guidelines about adding layouts
to reflect the recent changes. Also, change `gen_layouts.py` to not
generate warnings for file that are known not to be layouts.
2023-06-25 16:48:18 +02:00
Jules Aguillon
15c608b8cd Use generated arrays in Config.layout_of_string
This function is no longer an hardcoded list of layout ids. It's
replaced by a linear scan of the previously generated array and a new
corresponding array of resource ids.
2023-06-25 16:34:05 +02:00
Jules Aguillon
8ba82d2555 Generate layouts arrays used in settings
`gen_layouts.py` lists the layouts in `res/xml` and generate the
`pref_layout_values` and `pref_layout_entries` arrays into
`res/values/layouts.xml`.

These arrays are hard to maintain as the order has to match, which is
fragile.

This relies on every layouts having a `name` attribute.
2023-06-25 15:52:24 +02:00