Edit history, like a true winner, start of redraw logic.

This commit is contained in:
visionmercer 2026-05-12 10:17:52 +02:00
commit 9e5db80b0a
2 changed files with 169 additions and 153 deletions

View file

@ -8,7 +8,7 @@ function textinput$ (x as integer,y as integer,w as integer,h as integer,__text
end if
drawtextinput x,y,w,h,__text,1
if not mouseclicked then exit function
text=""
'text=""
cursor=len(text)+1
dim relativeX as integer
do

View file

@ -65,14 +65,14 @@ addcommand "fcolor ("+hex$(state.fcolor)+")"
addcommand "bcolor ("+hex$(state.bcolor)+")"
dim lastMX, lastMY
dim diffX as integer
dim diffY as integer
dim oldWidth as integer
dim oldHeight as integer
dim keyin as string
dim mouseWorldY as integer
dim mouseWorldX as integer
dim diffX as integer
dim diffY as integer
dim oldWidth as integer
dim oldHeight as integer
oldWidth=_width
oldHeight=_height
do
@ -164,7 +164,7 @@ loop
sub commandlist
dim i as long
dim listWidth as integer:listWidth = 150
dim listWidth as integer:listWidth = 250
dim x as integer:x=_width-listWidth
' Draw background for the list
@ -176,8 +176,34 @@ sub commandlist
for i = ubound(commands) - 1 to 0 step -1
y = (ubound(commands)-i) * 16
if y < _height - 20 then
_printstring (x + 5, y + 5), left$(commands(i), 18)
'_printstring (x + 5, y + 5), left$(commands(i), 31)
if link(x + 5, y + 5, left$(commands(i), 31)) then
commands(i)=textinput(x + 5, y + 5,248,23, commands(i))
end if
end if
next i
if button(x,_height-25, 60,23, "redraw") then redraw
end sub
sub redraw
redim numarr(0) as long
for i=lbound(commands) to ubound(commands)
select case lcase$(_trim$(left$(commands(i),instr(commands(i),"(")-1)))
case "canvas"
case "fcolor"
case "bcolor"
case "pixel"
case "line"
case "brushwidth"
case "box"
case "fbox"
case "circle"
case "fcircle"
case "polygon"
case "fpolygon"
case "floodfill"
case else
end select
next i
end sub
@ -328,10 +354,6 @@ sub canvas
static drawCol
if _mousebutton(1) then drawCol = state.fcolor
if _mousebutton(2) then drawCol = state.bcolor
' 4. Interaction Logic
'if _mousex > boxX1 then
' Start Drawing Logic
if state.tool = 9 and (mouseclicked or rmouseclicked) then
_dest layers(1).ihandle
_source layers(1).ihandle
@ -346,7 +368,6 @@ sub canvas
_source 0
exit sub
end if
if state.tool = 10 and (mouseclicked or rmouseclicked) then
_dest layers(1).ihandle
_source layers(1).ihandle
@ -361,7 +382,6 @@ sub canvas
_source 0
exit sub
end if
if state.tool = 7 or state.tool = 8 then
if mouseclicked then
polypoints(pointCount * 2) = canX
@ -376,7 +396,6 @@ sub canvas
state.isDrawing = -1
end if
end if
if state.isDrawing then
' We use Layer 2 as the temporary preview "rubber-band" layer
_dest layers(2).ihandle
@ -415,7 +434,6 @@ sub canvas
thickline polypoints((pointCount - 1) * 2), polypoints((pointCount - 1) * 2 + 1), canX, canY, state.fcolor
end if
end select
' 5. Commit Logic
dim commit as integer: commit = 0
if state.tool = 7 or state.tool = 8 then
@ -423,7 +441,6 @@ sub canvas
else
if (mousedown=0) and (rmousedown=0) then commit = -1
end if
if commit then
_dest layers(1).ihandle ' Final destination is always the drawing layer
if (state.tool = 8 or state.tool=7) and pointCount > 2 then
@ -475,14 +492,13 @@ sub canvas
addcommand "fbox ("+tst(state.startX)+","+tst(state.startY)+","+tst(canX)+","+tst(canY)+","+hex$(drawCol)+")"
end select
end if
_dest layers(2).ihandle: cls , 0
state.isDrawing = 0
pointCount = 0
end if
end if
'end if
_dest 0 ' Ensure we return to main screen
_dest 0
end sub
function icon (index as long)