FB2 Reader: fixed rolling up

git-svn-id: svn://kolibrios.org@9912 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2023-04-11 21:53:43 +00:00
parent 7028e04565
commit 21c201190a
4 changed files with 90 additions and 54 deletions

Binary file not shown.

View File

@ -119,6 +119,7 @@ VAR
sb: box_lib.scrollbar;
urlstr* : S.STRING;
DrawStatus, DrawToolbar: PROCEDURE;
win_size_x, win_size_y: INTEGER;
PROCEDURE PushRef(ref: XML.TAG);
@ -1543,7 +1544,7 @@ END CleanHistory;
PROCEDURE Save;
VAR history: File.FS; win_size_x, win_size_y, size, pos: INTEGER;
VAR history: File.FS; size, pos: INTEGER;
PROCEDURE WriteInt(history: File.FS; x: INTEGER);
BEGIN
@ -1578,7 +1579,6 @@ BEGIN
IF File.WriteChar(history, 0X) THEN END;
WriteInt(history, fsize2);
WriteInt(history, chksum);
SU.GetWindowSize(win_size_x, win_size_y);
WriteInt(history, win_size_x);
WriteInt(history, win_size_y);
WriteInt(history, Settings.PADDING.LRpc);
@ -1792,6 +1792,13 @@ BEGIN
END Set_b_pict;
PROCEDURE SetWinSize* (x, y: INTEGER);
BEGIN
win_size_x := x;
win_size_y := y
END SetWinSize;
BEGIN
clickRef := NIL;
hoverRef := NIL;

View File

@ -124,12 +124,16 @@ BEGIN
SU.GetSystemColors;
SU.WindowRedrawStatus(1);
IF Window.created THEN
Resize
IF ~SU.RolledUp() THEN
Resize;
DOM.SetWinSize(Window.width, Window.height)
END
ELSE
Window.created := TRUE
END;
SU.DefineAndDrawWindow(Window.left, Window.top, Window.width, Window.height,
SU.winColor, LSL(ORD({0, 1, 2}), 4) + 4 - ORD(DOM.loaded), Window.caption);
IF ~SU.RolledUp() THEN
SU.DrawRect(0, 0, Window.width - 2 * WINDOW_BEVEL - 1, CANVAS_TOP, SU.winColor);
SU.DrawRect(0, Window.height - SkinHeight - WINDOW_BEVEL - STATUSBAR_HEIGHT + 1, Window.width - 2 * WINDOW_BEVEL - 1, STATUSBAR_HEIGHT, SU.winColor);
SU.DrawRect(0, 0, CANVAS_LEFT, Window.height - SkinHeight - WINDOW_BEVEL, SU.winColor);
@ -138,6 +142,7 @@ BEGIN
ToolBar;
DOM.Draw;
DrawStatus
END
END;
SU.WindowRedrawStatus(2)
END DrawWindow;
@ -270,7 +275,10 @@ END IsFB2;
PROCEDURE main(title: ARRAY OF CHAR);
VAR WinW, X1, Y1, X2, Y2, scr_pos: INTEGER; Win2: W.tWindow; resize: BOOLEAN; FilePath: S.STRING; defpath: BOOLEAN;
VAR
WinW, X1, Y1, X2, Y2, scr_pos, ignore: INTEGER;
Win2: W.tWindow; resize: BOOLEAN;
FilePath: S.STRING; defpath: BOOLEAN;
BEGIN
SkinHeight := SU.SkinHeight();
sb := box_lib.kolibri_new_scrollbar(10 * 65536 + 200, 10 * 65536 + 30, 25, 15, 10, 0, 0, 0, 0, 0);
@ -302,7 +310,8 @@ BEGIN
SU.SetEventsMask({0, 1, 2, 5, 31});
SU.GetScreenArea(X1, Y1, X2, Y2);
WinW := (X2 - X1) DIV 2;
W.init(Window, WinW DIV 2, Y1, WinW, Y2 - Y1, title);
SU.MinMax(WinW, 640, 65535);
W.init(Window, (X2 - X1 - WinW) DIV 2, Y1, WinW, Y2 - Y1, title);
Settings.Default;
DOM.GetWinSize(FileName, Window.width, Window.height);
@ -342,7 +351,8 @@ BEGIN
DOM.Open(FileName, DrawWindow, DrawStatus, DrawToolbar);
IF resize THEN
DOM.Resize(Window.width - 2 * CANVAS_LEFT - 2 * WINDOW_BEVEL - 1 - SCROLLBAR_WIDTH, Window.height - SkinHeight - CANVAS_TOP - WINDOW_BEVEL + 1 - STATUSBAR_HEIGHT)
DOM.Resize(Window.width - 2 * CANVAS_LEFT - 2 * WINDOW_BEVEL - 1 - SCROLLBAR_WIDTH,
Window.height - SkinHeight - CANVAS_TOP - WINDOW_BEVEL + 1 - STATUSBAR_HEIGHT)
END;
DrawWindow;
@ -350,20 +360,30 @@ BEGIN
WHILE TRUE DO
CASE SU.WaitForEvent() OF
|1 : DrawWindow
|2 : KeyDown
|2 :
IF ~SU.RolledUp() THEN
KeyDown
ELSE
ignore := SU.GetKey()
END
|3 : ButtonClick
|6 : box_lib.scrollbar_v_mouse(sb);
|6 :
IF ~SU.RolledUp() THEN
box_lib.scrollbar_v_mouse(sb);
IF sb.position # scr_pos THEN
DOM.ScrollBar;
DOM.Draw;
scr_pos := sb.position;
END;
MouseEvent
ELSE
ignore := SU.MouseVScroll()
END
END
END
END main;
BEGIN
main("FB2 Reader v0.97a")
main("FB2 Reader v0.97c")
END FB2READ.

View File

@ -377,4 +377,13 @@ BEGIN
END GetSystemColors;
PROCEDURE RolledUp* (): BOOLEAN;
VAR
buffer: ARRAY 1024 OF BYTE;
BEGIN
K.sysfunc3(9, sys.ADR(buffer[0]), -1)
RETURN ODD(LSR(buffer[70], 2))
END RolledUp;
END SysUtils.