add state arg to Drawing.keychord_pressed

[?]
Jul 12, 2022, 11:21 PM
23MA4T3GWPOLM5S6JCNQJU2SRT7VQGYZ2JZJN26KA5MKI4LOCC4QC

Dependencies

  • [2] LF7BWEG4 group all editor globals
  • [3] HOSPP2AN crisp font rendering
  • [4] JAXPXLEB set current_drawing_index with current_drawing
  • [5] 6DE7RBZ6 move mouse_released events to Drawing
  • [6] WTDKUACN rectangle and square shapes
  • [7] 2MA33THZ few more transitions between shapes
  • [8] 6LIPEQ5I more robust transitions to temporary modes
  • [9] 73OCE2MC after much struggle, a brute-force undo
  • [10] JFFUF5AL override mouse state lookups in tests
  • [11] YCDYGEZU include drawing index in a few places
  • [12] VHQCNMAR several more modules
  • [13] 253TWKDA clean up
  • [14] LNUHQOGH start passing in Editor_state explicitly
  • [15] OWK3U6VD tests for drawing polygons
  • [16] U2TKUOID bugfix: undo drawing creation
  • [17] F3OOGMME switch freehand hotkey to eliminate conflict with search
  • [18] NVSWVPW5 move
  • [19] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [20] 6VQIWTQU standardize on ordering of cases
  • [21] XNFTJHC4 split keyboard handling between Text and Drawing
  • [22] BYG5CEMV support for naming points
  • [23] LYN3L74W correct commit f3abc2cbf2
  • [24] WPW3AVFS more precise shape selection
  • [25] DRFE3B3Z mouse buttons are integers, not strings
  • [26] LAW2O3NW extract variable Margin_left
  • [27] 2L5MEZV3 experiment: new edit namespace
  • [*] BLWAYPKV extract a module

Change contents

  • replacement in edit.lua at line 405
    [3.14724][3.14724:14762]()
    Drawing.keychord_pressed(chord)
    [3.14724]
    [3.14762]
    Drawing.keychord_pressed(State, chord)
  • replacement in drawing.lua at line 375
    [3.19077][3.5217:5258]()
    function Drawing.keychord_pressed(chord)
    [3.19077]
    [3.1614]
    function Drawing.keychord_pressed(State, chord)
  • replacement in drawing.lua at line 377
    [3.1665][2.131706:131757]()
    Editor_state.current_drawing_mode = 'freehand'
    [3.1665]
    [3.15]
    State.current_drawing_mode = 'freehand'
  • replacement in drawing.lua at line 379
    [3.64][2.131758:131805]()
    Editor_state.current_drawing_mode = 'line'
    [3.64]
    [3.98]
    State.current_drawing_mode = 'line'
  • replacement in drawing.lua at line 390
    [3.724][2.131806:131853]()
    Editor_state.current_drawing_mode = 'line'
    [3.724]
    [3.758]
    State.current_drawing_mode = 'line'
  • replacement in drawing.lua at line 392
    [3.807][2.131854:131906]()
    Editor_state.current_drawing_mode = 'manhattan'
    [3.807]
    [3.846]
    State.current_drawing_mode = 'manhattan'
  • replacement in drawing.lua at line 405
    [3.1550][2.131907:131959]()
    Editor_state.current_drawing_mode = 'manhattan'
    [3.1550]
    [3.1666]
    State.current_drawing_mode = 'manhattan'
  • replacement in drawing.lua at line 407
    [3.1721][2.131960:132010]()
    Editor_state.current_drawing_mode = 'polygon'
    [3.1721]
    [3.1722]
    State.current_drawing_mode = 'polygon'
  • replacement in drawing.lua at line 409
    [3.1771][2.132011:132061]()
    Editor_state.current_drawing_mode = 'polygon'
    [3.1771]
    [3.16]
    State.current_drawing_mode = 'polygon'
  • replacement in drawing.lua at line 424
    [3.1827][2.132062:132114]()
    Editor_state.current_drawing_mode = 'rectangle'
    [3.1827]
    [3.1828]
    State.current_drawing_mode = 'rectangle'
  • replacement in drawing.lua at line 426
    [3.1877][2.132115:132167]()
    Editor_state.current_drawing_mode = 'rectangle'
    [3.1877]
    [3.65]
    State.current_drawing_mode = 'rectangle'
  • replacement in drawing.lua at line 441
    [3.1933][2.132168:132217]()
    Editor_state.current_drawing_mode = 'square'
    [3.1933]
    [3.1934]
    State.current_drawing_mode = 'square'
  • replacement in drawing.lua at line 443
    [3.1983][2.132218:132267]()
    Editor_state.current_drawing_mode = 'square'
    [3.1983]
    [3.114]
    State.current_drawing_mode = 'square'
  • replacement in drawing.lua at line 461
    [3.7998][2.132268:132368]()
    elseif App.mouse_down(1) and chord == 'p' and Editor_state.current_drawing_mode == 'polygon' then
    [3.7998]
    [3.9508]
    elseif App.mouse_down(1) and chord == 'p' and State.current_drawing_mode == 'polygon' then
  • replacement in drawing.lua at line 463
    [3.9556][2.132369:132481]()
    local mx,my = Drawing.coord(App.mouse_x()-Editor_state.margin_left), Drawing.coord(App.mouse_y()-drawing.y)
    [3.9556]
    [3.9655]
    local mx,my = Drawing.coord(App.mouse_x()-State.margin_left), Drawing.coord(App.mouse_y()-drawing.y)
  • replacement in drawing.lua at line 466
    [3.9759][2.132482:132635]()
    elseif App.mouse_down(1) and chord == 'p' and (Editor_state.current_drawing_mode == 'rectangle' or Editor_state.current_drawing_mode == 'square') then
    [3.9759]
    [3.163]
    elseif App.mouse_down(1) and chord == 'p' and (State.current_drawing_mode == 'rectangle' or State.current_drawing_mode == 'square') then
  • replacement in drawing.lua at line 468
    [3.211][2.132636:132748]()
    local mx,my = Drawing.coord(App.mouse_x()-Editor_state.margin_left), Drawing.coord(App.mouse_y()-drawing.y)
    [3.211]
    [3.6888]
    local mx,my = Drawing.coord(App.mouse_x()-State.margin_left), Drawing.coord(App.mouse_y()-drawing.y)
  • replacement in drawing.lua at line 475
    [3.2204][2.132749:132897]()
    Editor_state.current_drawing_mode = 'circle'
    elseif App.mouse_down(1) and chord == 'a' and Editor_state.current_drawing_mode == 'circle' then
    [3.2204]
    [3.212]
    State.current_drawing_mode = 'circle'
    elseif App.mouse_down(1) and chord == 'a' and State.current_drawing_mode == 'circle' then
  • replacement in drawing.lua at line 479
    [3.7258][2.132898:133010]()
    local mx,my = Drawing.coord(App.mouse_x()-Editor_state.margin_left), Drawing.coord(App.mouse_y()-drawing.y)
    [3.7258]
    [3.7414]
    local mx,my = Drawing.coord(App.mouse_x()-State.margin_left), Drawing.coord(App.mouse_y()-drawing.y)
  • replacement in drawing.lua at line 484
    [3.2341][2.133011:133060]()
    Editor_state.current_drawing_mode = 'circle'
    [3.2341]
    [3.261]
    State.current_drawing_mode = 'circle'
  • replacement in drawing.lua at line 497
    [3.10172][2.133061:133196]()
    if Editor_state.previous_drawing_mode == nil then
    Editor_state.previous_drawing_mode = Editor_state.current_drawing_mode
    [3.10172]
    [3.107]
    if State.previous_drawing_mode == nil then
    State.previous_drawing_mode = State.current_drawing_mode
  • replacement in drawing.lua at line 500
    [3.117][2.133197:133463]()
    Editor_state.current_drawing_mode = 'move'
    drawing.pending = {mode=Editor_state.current_drawing_mode, target_point=p, target_point_index=i}
    Editor_state.lines.current_drawing_index = drawing_index
    Editor_state.lines.current_drawing = drawing
    [3.117]
    [3.10357]
    State.current_drawing_mode = 'move'
    drawing.pending = {mode=State.current_drawing_mode, target_point=p, target_point_index=i}
    State.lines.current_drawing_index = drawing_index
    State.lines.current_drawing = drawing
  • replacement in drawing.lua at line 508
    [3.1972][2.133464:133520]()
    if Editor_state.previous_drawing_mode == nil then
    [3.1972]
    [3.268]
    if State.previous_drawing_mode == nil then
  • replacement in drawing.lua at line 510
    [3.293][2.133521:133600]()
    Editor_state.previous_drawing_mode = Editor_state.current_drawing_mode
    [3.293]
    [3.346]
    State.previous_drawing_mode = State.current_drawing_mode
  • replacement in drawing.lua at line 512
    [3.356][2.133601:133650]()
    Editor_state.current_drawing_mode = 'name'
    [3.356]
    [3.2059]
    State.current_drawing_mode = 'name'
  • replacement in drawing.lua at line 514
    [3.2077][2.133651:133856]()
    drawing.pending = {mode=Editor_state.current_drawing_mode, target_point=point_index}
    Editor_state.lines.current_drawing_index = drawing_index
    Editor_state.lines.current_drawing = drawing
    [3.2077]
    [3.10680]
    drawing.pending = {mode=State.current_drawing_mode, target_point=point_index}
    State.lines.current_drawing_index = drawing_index
    State.lines.current_drawing = drawing