+++ /dev/null
-\r
-#include "core.h"\r
-\r
-//\8ae\83V\81[\83g\82Ì\8d¶\8fã\82ðP\81A\8d¶\89º\82ðQ\81A\89E\89º\82ðR\81A\89E\8fã\82ðS\81i\82·\82×\82Ä\8f\91\82«\8d\9e\82ß\82é\8dÀ\95W\81j\82Æ\82·\82é\81B\r
-\r
-UI_Sheet *Sheet_Initialize(void)\r
-{\r
- UI_Sheet *sheet;\r
-\r
- sheet = (UI_Sheet *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_SHEET);\r
-\r
- sheet->flags.bit.initialized = True;\r
- sheet->flags.bit.autorefresh_upperlevel = True;\r
-\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Initialize:[0x%08X]\n", sheet);\r
- #endif\r
-\r
- sheet->Drawing.Fill_Rectangle = &Sheet_Drawing_Fill_Rectangle_Invalid;\r
- sheet->Drawing.Put_String = &Sheet_Drawing_Put_String_Invalid;\r
- sheet->Drawing.Draw_Point = &Sheet_Drawing_Draw_Point_Invalid;\r
-\r
- sheet->RefreshSheet = &Sheet_Internal_RefreshSheet_Invalid;\r
-\r
- return sheet;\r
-}\r
-\r
-uint Sheet_Free(UI_Sheet *sheet)\r
-{\r
- UI_Sheet **search;\r
- uint i;\r
-\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Free:Null sheet.\n");\r
- #endif\r
- return 0;\r
- }\r
- if(!sheet->flags.bit.initialized){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Free:Not Initialized sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
-\r
-//\90e\82Ì\8eq\93o\98^\82ð\8dí\8f\9c\82·\82é\r
- if(sheet->parent != Null){\r
- search = &sheet->parent->child;\r
- for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
- if(*search == sheet){\r
- *search = sheet->next;\r
- sheet->parent = Null;\r
- break;\r
- }\r
- search = &(*search)->next;\r
- }\r
- if(i == SHEET_MAX_CHILDREN){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Free:TRAP:Sheet not found in the link for the parent.\n");\r
- #endif\r
- INT_3();\r
- }\r
- }\r
-\r
-//\8eq\82Ì\90e\93o\98^\82ð\8dí\8f\9c\82·\82é\r
- if(sheet->child != Null){\r
- search = &sheet->child;\r
- for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
- if(search == Null){\r
- break;\r
- }\r
- (*search)->parent = Null;\r
- search = &(*search)->child;\r
- }\r
- }\r
-\r
- if(sheet->flags.bit.vram_auto_allocated){\r
- System_Memory_Free(sheet->vram, sheet->vramsize);\r
- }\r
-\r
- System_CommonStruct_Free(&sheet->common_tag);\r
-\r
- return 0;\r
-}\r
-\r
-//vram==Null:Auto allocate\r
-uint Sheet_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp)\r
-{\r
- uint retv;\r
- UI_Sheet *search;\r
-\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetBuffer:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.initialized){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetBuffer:Not Initialized sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
-\r
- for(search = sheet->child; search != Null; search = search->next){\r
- search->RefreshSheet = &Sheet_Internal_RefreshSheet_Invalid;\r
- }\r
-\r
- retv = 0;\r
- if(bpp == 8){\r
- retv = Sheet08_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);\r
- } else if(bpp == 16){\r
- retv = Sheet16_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);\r
- } else if(bpp == 32){\r
- retv = Sheet32_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);\r
- } else{\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetBuffer:Not implemented %d bpp. Abort.\n", bpp);\r
- #endif\r
- INT_3();\r
- }\r
-\r
- if(retv != 0){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetBuffer:Function Failed.\n");\r
- #endif\r
- return 10 + retv;\r
- }\r
-\r
- if(sheet->flags.bit.using_map){\r
- Sheet_Internal_MapInitialize(sheet);\r
- }\r
-\r
- for(search = sheet->child; search != Null; search = search->next){\r
- search->Config_Functions(search);\r
- Sheet_RefreshSheet_All(search);\r
- }\r
-\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetBuffer:[0x%08X]\n", sheet);\r
- debug("Sheet_SetBuffer:vram:[0x%08X] xsize:%d ysize:%d bpp:%d\n", vram, xsize, ysize, bpp);\r
- #endif\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_SetParent(UI_Sheet *sheet, UI_Sheet *parent)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetParent:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetParent:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
- if(parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetParent:Null parent.\n");\r
- #endif\r
- sheet->parent = Null;\r
- \r
- return 3;\r
- }\r
- if(!parent->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetParent:Not buffer_configured parent.\n");\r
- #endif\r
- return 4;\r
- }\r
-\r
- sheet->parent = parent;\r
-\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetParent:[0x%08X] parent:[0x%08X]\n", sheet, parent);\r
- #endif\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_Show(UI_Sheet *sheet, uint height, int px, int py)\r
-{\r
- uint retv;\r
-\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Show:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Show:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
- if(sheet->parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Show:Null parent.\n");\r
- #endif\r
- return 3;\r
- }\r
- if(sheet->flags.bit.visible == True){\r
- return 4;\r
- }\r
-\r
- retv = sheet->Config_Functions(sheet);\r
-\r
- if(retv != 0){\r
- return 10 + retv;\r
- }\r
-\r
- Sheet_Internal_ChangeHeight(sheet, height);\r
-\r
- if(px != SHEET_LOCATION_NOCHANGE){\r
- sheet->location.x = px;\r
- }\r
- if(py != SHEET_LOCATION_NOCHANGE){\r
- sheet->location.y = py;\r
- }\r
- sheet->flags.bit.visible = True;\r
-\r
- if(!sheet->parent->flags.bit.using_map){\r
- Sheet_Internal_MapInitialize(sheet->parent);\r
- }\r
-\r
- Sheet_Internal_MapRefresh(sheet, sheet->location.x, sheet->location.y, sheet->location.x + sheet->size.x - 1, sheet->location.y + sheet->size.y - 1);\r
-\r
- Sheet_RefreshSheet_All(sheet);\r
-\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Show:[0x%08X] height:%d\n", sheet, i);\r
- #endif\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_ChangeHeight(UI_Sheet *sheet, uint height)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_ChangeHeight:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_ChangeHeight:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
- if(sheet->parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_ChangeHeight:Null parent.\n");\r
- #endif\r
- return 3;\r
- }\r
-\r
- Sheet_Internal_ChangeHeight(sheet, height);\r
- Sheet_RefreshAllInRange(sheet->parent, sheet->location.x, sheet->location.y, sheet->location.x + (int)sheet->size.x - 1, sheet->location.y + (int)sheet->size.y - 1);\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_RefreshSheet_All(UI_Sheet *sheet)\r
-{\r
- #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
- debug("Sheet_RefreshSheet_All:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
- #endif\r
-\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshSheet_All:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
-\r
- return Sheet_RefreshSheet(sheet, 0, 0, sheet->size.x - 1, sheet->size.y - 1);\r
-}\r
-\r
-uint Sheet_Slide_Absolute(UI_Sheet *sheet, int apx, int apy)\r
-{\r
- uint retv;\r
-\r
- #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
- debug("Sheet_Slide_Absolute:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
- #endif\r
-\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Slide_Absolute:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Slide_Absolute:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
- if(sheet->parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Slide_Absolute:Null parent.\n");\r
- #endif\r
- return 3;\r
- }\r
- if(!sheet->flags.bit.visible){\r
- if(apx != SHEET_LOCATION_NOCHANGE){\r
- sheet->location.x = apx;\r
- }\r
- if(apy != SHEET_LOCATION_NOCHANGE){\r
- sheet->location.y = apy;\r
- }\r
- return 0;\r
- }\r
-\r
- retv = Sheet_Internal_SlideSub(sheet, apx - sheet->location.x, apy - sheet->location.y);\r
-\r
- if(retv != 0){\r
- return 10 + retv;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_Slide_Relative(UI_Sheet *sheet, int rpx, int rpy)\r
-{\r
- uint retv;\r
-\r
- #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
- debug("Sheet_Slide_Relative:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
- #endif\r
-\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Slide_Relative:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Slide_Relative:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
- if(sheet->parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Slide_Relative:Null parent.\n");\r
- #endif\r
- return 3;\r
- }\r
- if(!sheet->flags.bit.visible){\r
- if(rpx != SHEET_LOCATION_NOCHANGE){\r
- sheet->location.x += rpx;\r
- }\r
- if(rpy != SHEET_LOCATION_NOCHANGE){\r
- sheet->location.y += rpy;\r
- }\r
- return 0;\r
- }\r
-\r
- retv = Sheet_Internal_SlideSub(sheet, rpx, rpy);\r
-\r
- if(retv != 0){\r
- return 10 + retv;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_RefreshAllInRange(UI_Sheet *parent, int px0, int py0, int px1, int py1)\r
-{\r
- uint i;\r
- UI_Sheet *search;\r
-\r
- if(parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshAllInRange:Null parent.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!parent->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshAllInRange:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
-\r
- search = parent->child;\r
- for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
- if(search == Null){\r
- break;\r
- }\r
- if(Sheet_Internal_IsRangeOverlappedWithSheet(search, px0, py0, px1, py1)){\r
- Sheet_Internal_RefreshSheet(search, px0, py0, px1, py1);\r
- }\r
- search = search->next;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-uint Sheet_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshSheet:[0x%08X]Null sheet.\n", sheet);\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshSheet:[0x%08X]Not buffer_configured sheet.\n", sheet);\r
- #endif\r
- return 2;\r
- }\r
-\r
- return Sheet_Internal_RefreshSheet(sheet, px0 + sheet->location.x, py0 + sheet->location.y, px1 + sheet->location.x, py1 + sheet->location.y);\r
-}\r
-\r
-uint Sheet_RefreshMap(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshMap:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshMap:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
-\r
- return Sheet_Internal_MapRefresh(sheet, px0 + sheet->location.x, py0 + sheet->location.y, px1 + sheet->location.x, py1 + sheet->location.y);\r
-}\r
-\r
-uint Sheet_RefreshMap_All(UI_Sheet *sheet)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_RefreshMap_All:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
-\r
- return Sheet_RefreshMap(sheet, 0, 0, sheet->size.x - 1, sheet->size.y - 1);\r
-}\r
-\r
-uint Sheet_Enable_InvisibleColor(UI_Sheet *sheet, uint invcol)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Enable_InvisibleColor:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Enable_InvisibleColor:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
-\r
- if(sheet->bpp == 8){\r
- sheet->invcol = RGB_32_To_08(invcol);\r
- sheet->IsVisiblePixel = &Sheet08_Internal_IsVisiblePixel;\r
- } else if(sheet->bpp == 16){\r
- sheet->invcol = RGB_32_To_16(invcol);\r
- sheet->IsVisiblePixel = &Sheet16_Internal_IsVisiblePixel;\r
- } else if(sheet->bpp == 32){\r
- sheet->invcol = invcol;\r
- sheet->IsVisiblePixel = &Sheet32_Internal_IsVisiblePixel;\r
- } else{\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Enable_InvisibleColor:Not implemented invisible-color in %d bpp.\n", sheet->bpp);\r
- #endif\r
- return 3;\r
- }\r
- sheet->flags.bit.using_invcol = True;\r
- return 0;\r
-}\r
-\r
-uint Sheet_Disable_InvisibleColor(UI_Sheet *sheet)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Disable_InvisibleColor:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
- if(!sheet->flags.bit.buffer_configured){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_Disable_InvisibleColor:Not buffer_configured sheet.\n");\r
- #endif\r
- return 2;\r
- }\r
- sheet->flags.bit.using_invcol = False;\r
- sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;\r
- return sheet->invcol;\r
-}\r
-\r
-uint Sheet_SetTopmost(UI_Sheet *sheet, bool topmost)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetTopmost:Null sheet.\n");\r
- #endif\r
- return Null;\r
- }\r
-\r
- if(topmost){\r
- sheet->flags.bit.topmost = True;\r
- if(sheet->flags.bit.visible){\r
- Sheet_Show(sheet, SHEET_MAX_CHILDREN, SHEET_LOCATION_NOCHANGE, SHEET_LOCATION_NOCHANGE);\r
- }\r
- } else{\r
- sheet->flags.bit.topmost = False;\r
- }\r
- return 0;\r
-}\r
-\r
-//use map\r
-UI_Sheet *Sheet_GetSheetFromLocation(UI_Sheet *parent, int px, int py)\r
-{\r
- if(parent == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_GetSheetFromLocation:Null parent.\n");\r
- #endif\r
- return Null;\r
- }\r
- if(parent->map == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_GetSheetFromLocation:Null map.\n");\r
- #endif\r
- return Null;\r
- }\r
-\r
- if(px < 0 || py < 0 || px >= (int)parent->size.x || py >= (int)parent->size.y){\r
- return Null;\r
- }\r
-\r
- return (UI_Sheet *)parent->map[py * parent->size.x + px];\r
-}\r
-\r
-uint Sheet_SetMovable(UI_Sheet *sheet, bool movable)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetMovable:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
-\r
- sheet->flags.bit.movable = movable;\r
- return 0;\r
-}\r
-\r
-uint Sheet_SetInputFIFO(UI_Sheet *sheet, DATA_FIFO32 *fifo)\r
-{\r
- if(sheet == Null){\r
- #ifdef CHNOSPROJECT_DEBUG_SHEET\r
- debug("Sheet_SetInputFIFO:Null sheet.\n");\r
- #endif\r
- return 1;\r
- }\r
-\r
- sheet->input_fifo = fifo;\r
-\r
- return 0;\r
-}\r
-\r