From e80b274a23cb6bbe83bc48058c779624b16dd556 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 7 May 2024 14:46:11 +0200 Subject: MHR-23: ErrorID error codes are now deprecated in favor of HError. - Cleanup done in SystemLib. - Refactor system API. Signed-off-by: Amlal El Mahrouss --- Public/Developer/SystemLib/Sources/App.c | 2 +- Public/Developer/SystemLib/Sources/TrueType.c | 42 ----------- Public/Developer/SystemLib/Sources/Wm.c | 100 -------------------------- 3 files changed, 1 insertion(+), 143 deletions(-) delete mode 100644 Public/Developer/SystemLib/Sources/TrueType.c delete mode 100644 Public/Developer/SystemLib/Sources/Wm.c (limited to 'Public/Developer/SystemLib/Sources') diff --git a/Public/Developer/SystemLib/Sources/App.c b/Public/Developer/SystemLib/Sources/App.c index c85b2dd8..7778c064 100644 --- a/Public/Developer/SystemLib/Sources/App.c +++ b/Public/Developer/SystemLib/Sources/App.c @@ -7,7 +7,7 @@ #include /// @brief Main Application object, retrieved from the RtGetAppPointer symbol. -ApplicationRef kSharedApplication = NullPtr; +ApplicationInterfaceRef kSharedApplication = NullPtr; /// @brief Gets the app arguments count. /// @param void no arguments. diff --git a/Public/Developer/SystemLib/Sources/TrueType.c b/Public/Developer/SystemLib/Sources/TrueType.c deleted file mode 100644 index 49b1c2e8..00000000 --- a/Public/Developer/SystemLib/Sources/TrueType.c +++ /dev/null @@ -1,42 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include -#include -#include -#include - -#define kTTFFork "fon " /* TrueType */ - -/// @brief TrueType container reader -typedef struct TTFReader -{ - FSForkRef fFork; - FSRef fFile; - PtrVoidType fBlob; // cached blob - SizeType fBlobSize; // cached blob size - VoidType (*__fReadBytes)(SizeType count); - VoidType (*__fSkipBytes)(SizeType count); -} TTFReader; - -/// @brief Grab a TTF reader reference. -/// @param fs filesystem reference. -/// @return TTFReader* the new TTFReader type. -CA_STATIC TTFReader* GrabTTFReader(FSRef fs) -{ - FSForkRef forkRef = FsGetFork(fs, kTTFFork); - - if (forkRef = kInvalidRef) - return NullPtr; - - TTFReader* reader = RtTlsAllocate(sizeof(TTFReader), kStandardAllocation); - - reader->fFile = fs; - reader->fFork = forkRef; - - return reader; -} -/// EOF. diff --git a/Public/Developer/SystemLib/Sources/Wm.c b/Public/Developer/SystemLib/Sources/Wm.c deleted file mode 100644 index 607e7dcf..00000000 --- a/Public/Developer/SystemLib/Sources/Wm.c +++ /dev/null @@ -1,100 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include -#include - -/// invalid resource handle, they always start from 1. -#define kInvalidRsrc (0U) - -/// @brief Color refs. - -const ColorRef kRgbRed = 0x000000FF; -const ColorRef kRgbGreen = 0x0000FF00; -const ColorRef kRgbBlue = 0x00FF0000; -const ColorRef kRgbBlack = 0x00000000; -const ColorRef kRgbWhite = 0xFFFFFFFF; - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, - const DWordType rsrcId) -{ - CA_MUST_PASS(name); - CA_MUST_PASS(rsrcId != kInvalidRsrc); - - if (!name) - return NullPtr; - if (rsrcId == kInvalidRsrc) - return NullPtr; - - return (WindowPort*)kSharedApplication->Invoke( - kSharedApplication, kCallCreateWindow, name, rsrcId); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* winPort) -{ - CA_MUST_PASS(winPort); - if (!winPort) - return; - - kSharedApplication->Invoke(kSharedApplication, kCallCloseWindow, winPort); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, - const DWordType rsrcId) -{ - CA_MUST_PASS(name); - CA_MUST_PASS(rsrcId != kInvalidRsrc); - - if (!name) - return NullPtr; - if (rsrcId == kInvalidRsrc) - return NullPtr; - - return (WindowPort*)kSharedApplication->Invoke(kSharedApplication, - kCallCreateMenu, name, rsrcId); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* winPort) -{ - CA_MUST_PASS(winPort); - - if (!winPort) - return; - kSharedApplication->Invoke(kSharedApplication, kCallCloseMenu, winPort); -} - -///////////////////////////////////////////////////////////////////////// - -CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where) -{ - if (!wndPort) - return kWmErrInvalidArg; - - wndPort->windowPosition.X = where.X; - wndPort->windowPosition.Y = where.Y; - wndPort->windowMoving = True; - - return 0; -} - -/// @brief Causes the window to invalidate and redraw. -/// @param wndPort The Window port. -/// @return nothing. -CA_EXTERN_C VoidType WmInvalidateGfx(WindowPort* wndPort) -{ - if (wndPort) - { - wndPort->windowInvalidate = Yes; - } -} -- cgit v1.2.3