make text and drawings the same width

[?]
May 20, 2022, 5:02 AM
LUNH47XXUUITDLE6NBI3J7GJQWQ45OQAGXY2HJI4HRPOR2GUULPAC

Dependencies

  • [2] 7DPPMI2U another integer coordinate
  • [3] DAENUOGV eliminate assumptions that line length == size in bytes
  • [4] V5TP27FP ctrl-+ and ctrl-- to adjust font size
  • [5] WDWXNW7V slightly strange way to move points
  • [6] JVRL5TWL store device-independent coordinates inside drawings
  • [7] 2KRK3OBV don't rely on defaults
  • [8] YKRF5V3Z starting to load/save
  • [9] 2FBLO5FH adjust window size
  • [10] JCSLDGAH beginnings of support for multiple shapes
  • [11] FJ4L6N74 draw lines by default
  • [12] YJGADSGK delete unused arg
  • [13] WTDKUACN rectangle and square shapes
  • [14] 4C375P53 this is a bit clearer
  • [15] AVQ5MC5D finish uppercasing all globals
  • [16] NYQ7HD4D move
  • [17] BLWAYPKV extract a module
  • [18] M36DBSDE bit more polish to help screen
  • [19] 252M2QMD forgot to move this special case out
  • [20] DLQMM265 scroll past first page
  • [21] PWHZPJJM always show current filename in window title
  • [22] W4UVZETR 2 regressions:
  • [23] UWNHC4AA redo y computations
  • [24] XNFTJHC4 split keyboard handling between Text and Drawing
  • [25] 2C7CTIQY make space for multiple kinds of width
  • [26] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [27] VHQCNMAR several more modules
  • [*] OTIBCAUJ love2d scaffold

Change contents

  • replacement in main.lua at line 49
    [4.4][4.4:79](),[4.79][4.158:257]()
    -- All drawings span 100% of some conceptual 'page width' and divide it up
    -- into 256 parts. `Drawing_width` describes their width in pixels.
    Drawing_width = nil -- pixels
    [4.4]
    [4.1]
    Line_width = nil -- maximum width available to either text or drawings, in pixels
  • replacement in main.lua at line 64
    [4.43][4.557:608]()
    Drawing_width = math.floor(Screen_width/2/40)*40
    [4.43]
    [4.2]
    Line_width = math.floor(Screen_width/2/40)*40
  • replacement in main.lua at line 130
    [3.595][3.595:675]()
    y = Text.draw(line, Drawing_width, line_index, Cursor_line, Cursor_pos)
    [3.595]
    [4.56]
    y = Text.draw(line, Line_width, line_index, Cursor_line, Cursor_pos)
  • edit in drawing.lua at line 5
    [4.148]
    [4.38]
    -- All drawings span 100% of some conceptual 'page width' and divide it up
    -- into 256 parts.
  • replacement in drawing.lua at line 9
    [4.234][4.18269:18359]()
    if pmx < 16+Drawing_width and pmy > line.y and pmy < line.y+Drawing.pixels(line.h) then
    [4.234]
    [4.316]
    if pmx < 16+Line_width and pmy > line.y and pmy < line.y+Drawing.pixels(line.h) then
  • replacement in drawing.lua at line 11
    [4.359][4.18360:18445]()
    love.graphics.rectangle('line', 16,line.y, Drawing_width,Drawing.pixels(line.h))
    [4.359]
    [4.18445]
    love.graphics.rectangle('line', 16,line.y, Line_width,Drawing.pixels(line.h))
  • replacement in drawing.lua at line 13
    [4.18484][4.18484:18548]()
    icon[Current_drawing_mode](16+Drawing_width-20, line.y+4)
    [4.18484]
    [4.523]
    icon[Current_drawing_mode](16+Line_width-20, line.y+4)
  • replacement in drawing.lua at line 15
    [4.532][4.18549:18614]()
    icon[Previous_drawing_mode](16+Drawing_width-20, line.y+4)
    [4.532]
    [4.589]
    icon[Previous_drawing_mode](16+Line_width-20, line.y+4)
  • replacement in drawing.lua at line 183
    [4.2271][4.688:795](),[4.688][4.688:795]()
    return y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width
    [4.2271]
    [4.795]
    return y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Line_width
  • replacement in drawing.lua at line 325
    [4.5283][4.5283:5322]()
    Drawing_width = Drawing_width/Zoom
    [4.5283]
    [4.5322]
    Line_width = Line_width/Zoom
  • replacement in drawing.lua at line 327
    [4.5342][4.5342:5381]()
    Drawing_width = Drawing_width*Zoom
    [4.5342]
    [4.5381]
    Line_width = Line_width*Zoom
  • replacement in drawing.lua at line 329
    [4.5410][4.5410:5449]()
    Drawing_width = Drawing_width/Zoom
    [4.5410]
    [4.5449]
    Line_width = Line_width/Zoom
  • replacement in drawing.lua at line 331
    [4.5469][4.5469:5508]()
    Drawing_width = Drawing_width*Zoom
    [4.5469]
    [4.5508]
    Line_width = Line_width*Zoom
  • replacement in drawing.lua at line 333
    [4.5537][4.5537:5576]()
    Drawing_width = Drawing_width/Zoom
    [4.5537]
    [4.5576]
    Line_width = Line_width/Zoom
  • replacement in drawing.lua at line 335
    [4.5591][4.5591:5630]()
    Drawing_width = Drawing_width*Zoom
    [4.5591]
    [4.5760]
    Line_width = Line_width*Zoom
  • replacement in drawing.lua at line 693
    [4.27500][2.10:51]()
    return math.floor(n*Drawing_width/256)
    [4.27500]
    [4.27529]
    return math.floor(n*Line_width/256)
  • replacement in drawing.lua at line 696
    [4.27579][4.27579:27620]()
    return math.floor(n*256/Drawing_width)
    [4.27579]
    [4.11944]
    return math.floor(n*256/Line_width)