diff options
author | Adrien Hopkins <ahopk127@my.yorku.ca> | 2022-07-08 10:18:50 -0500 |
---|---|---|
committer | Adrien Hopkins <ahopk127@my.yorku.ca> | 2022-07-08 10:18:50 -0500 |
commit | c2be02ac6ce0ef592b93ce11879a4f7a5c8fe201 (patch) | |
tree | 927534a2d894da70aea13e656f574325cf9ffd52 /docs/design.org | |
parent | 3f9c8cb17655e348d3e2c453a301ed7ab0e6ba9b (diff) |
Added search settings to the manual and design document
Diffstat (limited to 'docs/design.org')
-rw-r--r-- | docs/design.org | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/docs/design.org b/docs/design.org index 42fad74..467c018 100644 --- a/docs/design.org +++ b/docs/design.org @@ -1,6 +1,6 @@ #+TITLE: 7Units Design Document #+SUBTITLE: For version 0.4.0-alpha.1 -#+DATE: 2022 June 18 +#+DATE: 2022 July 8 #+LaTeX_HEADER: \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} #+LaTeX_HEADER: \usepackage{xurl} #+LaTeX: \newpage @@ -104,6 +104,13 @@ Both of these ~View~ implementations implement ~UnitConversionView~ and ~ExpressionConversionView~. ** The Presenter The ~Presenter~ is an intermediary between the ~View~ and the backend code. It accepts the user's input and passes it to the backend, then accepts the backend's output and passes it to the frontend for user viewing. Its main functions do not have arguments or return values; instead it takes input from and provides output to the ~View~ via its public methods. +*** Rules + The ~Presenter~ has a set of function-object rules that determine some of its behaviours. Each corresponds to a setting in the ~View~, but they can be set to other values via the ~Presenter~'s setters (although nonstandard rules cannot be saved and loaded): + - numberDisplayRule :: A function that determines how numbers are displayed. This controls the rounding rules. + - prefixRepetitionRule :: A function that determines which combinations of prefixes are valid in unit expressions. This controls the unit prefix rules. + - searchRule :: A function that determines which prefixes are shown in the unit lists in unit conversion (which prefixed units are searchable). + + These rules have been made this way to enable an incredible level of customization of these behaviours. Because any function object with the correct arguments and return type is accepted, these rules (especially the number display rule) can do much more than the default behaviours. ** Utility Classes The frontend has many miscellaneous utility classes. Many of them are package-private. Here is a list of them, with a brief description of what they do and where they are used: - DefaultPrefixRepetitionRule :: An enum containing the available rules determining when you can repeat prefixes. Used by the ~TabbedView~ for selecting the rule and by the ~Presenter~ for loading it from a file. |