Fetcher: Add browser icons, pulled from icons.res at runtime
This commit is contained in:
parent
a033fae4ae
commit
f6fed505cc
|
@ -10,6 +10,8 @@ MODULE Browser;
|
||||||
browserPrevPageButton: Fox32OSButtonWidget;
|
browserPrevPageButton: Fox32OSButtonWidget;
|
||||||
browserDiskId: INT;
|
browserDiskId: INT;
|
||||||
browserFileList: ARRAY 341 OF CHAR;
|
browserFileList: ARRAY 341 OF CHAR;
|
||||||
|
browserHasIcons: CHAR;
|
||||||
|
browserIconsResPtr: PTR;
|
||||||
|
|
||||||
EXTERN browserMenuItemsRoot: POINTER TO CHAR;
|
EXTERN browserMenuItemsRoot: POINTER TO CHAR;
|
||||||
EXTERN browserFileListFriendly: ARRAY 12 OF POINTER TO CHAR;
|
EXTERN browserFileListFriendly: ARRAY 12 OF POINTER TO CHAR;
|
||||||
|
@ -36,14 +38,17 @@ MODULE Browser;
|
||||||
browserRunning := 1;
|
browserRunning := 1;
|
||||||
browserPage := 0;
|
browserPage := 0;
|
||||||
browserDiskId := diskId;
|
browserDiskId := diskId;
|
||||||
|
browserHasIcons := 0;
|
||||||
|
browserIconsResPtr := iconsResPtr;
|
||||||
|
|
||||||
(* if icons.res was loaded, then pull the `dsk` resource from it *)
|
(* if icons.res was loaded, then pull the `dsk` resource from it *)
|
||||||
IF hasIcons THEN
|
IF hasIcons THEN
|
||||||
tempDskIconResPtr := get_resource(iconsResPtr, "dsk", 4096);
|
tempDskIconResPtr := get_resource(browserIconsResPtr, "dsk", 4096);
|
||||||
IF tempDskIconResPtr THEN
|
IF tempDskIconResPtr THEN
|
||||||
copy_memory_bytes(tempDskIconResPtr, PTROF(desktopDiskIcon), 4096);
|
copy_memory_bytes(tempDskIconResPtr, PTROF(desktopDiskIcon), 4096);
|
||||||
free_memory(tempDskIconResPtr);
|
free_memory(tempDskIconResPtr);
|
||||||
END;
|
END;
|
||||||
|
browserHasIcons := 1;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
(* create the window and draw its initial contents *)
|
(* create the window and draw its initial contents *)
|
||||||
|
@ -123,6 +128,29 @@ MODULE Browser;
|
||||||
fill_window(0FFFFFFFFH, PTROF(browserWindow));
|
fill_window(0FFFFFFFFH, PTROF(browserWindow));
|
||||||
SetupBrowserIconStructs();
|
SetupBrowserIconStructs();
|
||||||
draw_widgets_to_window(PTROF(browserWindow));
|
draw_widgets_to_window(PTROF(browserWindow));
|
||||||
|
IF browserHasIcons THEN
|
||||||
|
DrawBrowserIcons();
|
||||||
|
END;
|
||||||
|
END;
|
||||||
|
|
||||||
|
PROCEDURE DrawBrowserIcons();
|
||||||
|
VAR i: INT;
|
||||||
|
icon: POINTER TO Fox32OSButtonWidget;
|
||||||
|
tempFileIconResPtr: PTR;
|
||||||
|
overlay: INT;
|
||||||
|
BEGIN
|
||||||
|
i := 0;
|
||||||
|
overlay := get_window_overlay_number(PTROF(browserWindow));
|
||||||
|
WHILE i <| 12 DO
|
||||||
|
icon := PTROF(browserIcons[i]);
|
||||||
|
tempFileIconResPtr := get_resource(browserIconsResPtr, icon^.text + string_length(icon^.text) - 3, 4096);
|
||||||
|
IF tempFileIconResPtr THEN
|
||||||
|
set_tilemap(tempFileIconResPtr, 32, 32);
|
||||||
|
draw_tile_to_overlay(0, icon^.x, icon^.y, overlay);
|
||||||
|
free_memory(tempFileIconResPtr);
|
||||||
|
END;
|
||||||
|
i := i + 1;
|
||||||
|
END;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
PROCEDURE SetupBrowserIconStructs();
|
PROCEDURE SetupBrowserIconStructs();
|
||||||
|
|
|
@ -10,7 +10,7 @@ MODULE OS;
|
||||||
set_window_flags, menu_update_event, menu_bar_click_event, close_menu, new_messagebox,
|
set_window_flags, menu_update_event, menu_bar_click_event, close_menu, new_messagebox,
|
||||||
launch_fxf_from_disk, get_boot_disk_id, string_to_int, set_tilemap, draw_tile_to_overlay,
|
launch_fxf_from_disk, get_boot_disk_id, string_to_int, set_tilemap, draw_tile_to_overlay,
|
||||||
ryfs_get_file_list, copy_memory_bytes, IsRomDiskAvailable, end_current_task, sleep_task,
|
ryfs_get_file_list, copy_memory_bytes, IsRomDiskAvailable, end_current_task, sleep_task,
|
||||||
open, read, get_size, get_boot_disk_id, get_resource, allocate_memory, free_memory: INT;
|
open, read, get_size, get_boot_disk_id, get_resource, allocate_memory, free_memory, string_length: INT;
|
||||||
|
|
||||||
EXTERN PROCEDURE brk: INT;
|
EXTERN PROCEDURE brk: INT;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user