Commit Graph

88 Commits

Author SHA1 Message Date
Léa Saviot
016f87c266 [escher/layout_field] Reset the scroll when clearing the layout
Scenario: Go to the graph app, create f(x) = 1 then create g(x) -> there
is a weird big margin in the edition field
2020-05-15 02:39:11 -07:00
Romain Goyet
fc4b0a8d35 [escher] Add an insertionField in LayoutField 2020-05-11 10:34:28 +02:00
Romain Goyet
84768472bd Explicit std::min/max template usage
This is unfortunately required in several cases:
 - Sometimes when we use either float and double (this should be changed)
 - Because KDCoordinate is not an int, so any arithmemtic promotes it to
an int
 - Because we mix pointer differences and ints
2020-04-14 09:31:02 -04:00
Romain Goyet
950862f8d0 Use std::min and std::max 2020-04-14 09:31:02 -04:00
Romain Goyet
64a1094edf [escher/layout_field] Use IsMoveEvent 2020-04-09 09:47:43 +02:00
Romain Goyet
ec4def61c3 [escher/layout_field] Avoid calling the same method over and over again 2020-04-09 09:47:43 +02:00
Romain Goyet
35d446353f [escher] Avoid long switches on Left/Up/Right/Down 2020-04-08 09:56:33 +02:00
Léa Saviot
92378b9496 [escher/layout_field] Handle Cut events 2020-02-18 10:08:34 +01:00
Émilie Feral
879843ce2b [escher] LayoutField: reset selection when the field should finish
editing

This fixes the following bug: in solver, input Matrix(Matrix()) and select the
inner Matrix. When handling "OK" event, the "=0" is inserted at a wrong
position leading to a crash !
2020-02-12 15:13:24 +01:00
Émilie Feral
9d1a5ea0a8 [escher] LayoutField: fix putCursorRightOfLayout to update matrix
layouts if necessary
2020-02-12 15:13:24 +01:00
Léa Saviot
963edd5c35 [apps/solver] Fix addition of "=0" to equations
ShiftRight no longer puts the cursor at the end of the text/layout.
2020-02-12 15:13:24 +01:00
Léa Saviot
40ed9b3557 Revert "[eshcer/layout_field] Factor handleEvent"
This reverts commit d1ebbc685d67702994aa3ef822886a681cee63b9.

There were problems in the calculation app for instance:
- Write 34 then press ans -> the cursor is not drawn right of ans, but
left.
- Write a large layout, go up in th history, then go back to edition:
the view is not scrolled to the cursor
2020-02-12 15:13:22 +01:00
Léa Saviot
756eeeb2d8 [poincare/parser] Add context 2020-02-12 15:13:21 +01:00
Léa Saviot
408a33f8a6 [escher/layout_field] Allow copy-paste of ^2 2020-02-12 15:13:18 +01:00
Léa Saviot
8f86769cd1 [escher/layout_field] When pasting, force cursor right of pasted text
Even if the text is inserted code point per code point
2020-02-12 15:13:18 +01:00
Léa Saviot
8a8d4677a8 [escher/layout_field] Fix addSelection
Better handling of adding an horizontal to the selection of all its
children / or the contrary
2020-02-12 15:13:18 +01:00
Léa Saviot
2c1cc02a19 [escher/layout_field] Fix selection + matrices
When selecting inside a matrix and then selecting outside, the grey
squares should disappear.
2020-02-12 15:13:18 +01:00
Léa Saviot
5f52c36439 [escher/layout_field] Reset selection when finishing edition 2020-02-12 15:13:18 +01:00
Léa Saviot
51742aef40 [escher/layout_cursor] Set height to the selection height
4
For instance, 123+- with "123+" selected, the cursor on the left of the
                  5
fraction will have the height of the selection.
2020-02-12 15:13:17 +01:00
Léa Saviot
c29ab14f20 [escher/layout_field] Better handling of layout recomputation
After a selection event, there is no need to recompute the layout. We
still need to dirty the union of the previous and next selection
rectangles.
2020-02-12 15:13:17 +01:00
Léa Saviot
f9b738a41e [escher/layout_field] Remove TODO comment 2020-02-12 15:13:17 +01:00
Léa Saviot
f7ada7dac0 [escher/layout_field] Simplify the layout selection algorithm 2020-02-12 15:13:17 +01:00
Léa Saviot
61f26e3e4c [escher/test] Layout selection in layout_field 2020-02-12 15:13:17 +01:00
Léa Saviot
a92326f9c9 [poincare/layout_cursor] Rename MoveDirection -> Direction 2020-02-12 15:13:17 +01:00
Léa Saviot
785cd2f88c [poincare/layout_cursor] Rename layoutReference -> layout
It was an historic name
2020-02-12 15:13:17 +01:00
Léa Saviot
5c2ea9899d [poincare/layout_field] Select up/down 2020-02-12 15:13:17 +01:00
Léa Saviot
5de65e0d7e [escher/layout_field] Copy selection 2020-02-12 15:13:17 +01:00
Léa Saviot
2e589f6eac [escher] Delete selection on layouts 2020-02-12 15:13:17 +01:00
Léa Saviot
f38bac6942 [escher/layout_field] Handle text addition while layouts are selected 2020-02-12 15:13:17 +01:00
Léa Saviot
a959f9fa98 [poincare/lyt_cursor] When selecting, we add one full layout each time 2020-02-12 15:13:17 +01:00
Léa Saviot
03f07d65ed [escher/layout_field] Remove selection on simple left/right/up/down 2020-02-12 15:13:17 +01:00
Léa Saviot
b9a8f12f25 [escher/poincare] Clean layout selection 2020-02-12 15:13:17 +01:00
Léa Saviot
377cca7e3d [escher/layout_field] Start handling selection 2020-02-12 15:13:17 +01:00
Ruben Dashyan
7f4dd1255a Revert "[escher/layout_field] Factor insertLayoutAtCursor"
This reverts commit b06cac4fcce0c1ab3fedd6c44846983962316749.
2020-02-12 15:13:16 +01:00
Ruben Dashyan
bc0b5c092a [escher/layout_field] Factor insertLayoutAtCursor 2020-02-12 15:13:16 +01:00
Ruben Dashyan
89ea31d190 [eshcer/layout_field] Factor handleEvent 2020-02-12 15:13:16 +01:00
Ruben Dashyan
d604df85b2 [escher/layout_field] Remove magic number 2020-02-12 15:13:16 +01:00
Léa Saviot
9f018eb9d9 [escher/view] setFrame and layoutSubviews can be forced 2020-02-12 15:13:15 +01:00
Léa Saviot
c839fb52a3 [escher/layout_field] Fix cursor position on Empty layout
Scenario: In the calculations app, write 1, Enter, write •|/2, go up,
then go down. There is a problem with the empty layout and the cursor.
2019-08-08 17:22:03 +02:00
Léa Saviot
ce15bc202d [escher/layout_field] Fix EmptyLayout disappearance
Scenario :
In the calculation app, write 1, press Enter.
       •|
Write ---
       2
Then go up. The empty layout on top of the fraction disappears.
2019-08-08 17:22:03 +02:00
Ruben Dashyan
e4ec398ecd [escher] InputEventHandler gets the app directly 2019-07-19 15:06:25 +02:00
Léa Saviot
e72c7d8564 [escher/layout_field] Fix cursor position when inserting layout
Scenario : In calculation, write 10/7, enter
Go up, press OK on 10/7 -> the cursor is not on the right of the layout
2019-06-26 10:08:03 +02:00
Léa Saviot
0478fc816e [escher/layout_field] Fix cursor position when inserting "cos()" 2019-06-17 08:25:29 -04:00
Léa Saviot
e17658181d [escher/layout_field] Compute the pointed layout after the insertion
Otherwise it breaks the scenario:
Initial layout:   '0
"abs(x)" pressed in the toolbox => |•| is added, • being an empty layout
Final layout: |0'|
2019-06-14 08:20:54 -04:00
Léa Saviot
3d991e56da [escher/poincare] Cleaner way to find the cursored layout in LayoutField
Everything is now in the virtual method
LayoutNode::layoutToPointWhenInserting
This removes a dirty inclusion of apps/i18n.h in escher
2019-05-27 17:24:11 +02:00
Émilie Feral
5e280c7538 [escher] ExpressionView: optimize setLayouts to avoid marking the whole
view as dirty when the layout did not really changed
2019-05-03 15:54:21 +02:00
Émilie Feral
9665f11d06 [poincare] Layout: discard methods isVerticalOffset(), isHorizontal(),
isRightParenthesisLayout(), isLeftBracket(), isRightBracket(),
isCodePoint(),
isLeftParenthesisLayout() and use type() instead
2019-05-03 15:54:21 +02:00
Léa Saviot
5df9e0af71 Use correct unicode symbols 2019-05-03 15:53:19 +02:00
Léa Saviot
496d346049 Remove max/min inline from KDCoordinate header 2019-05-03 15:53:19 +02:00
Léa Saviot
bbb10f1993 [ion/kandinsky] Move unicode to ion 2019-05-03 15:53:19 +02:00