You can subscribe to this list here.
2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <kr_...@us...> - 2003-04-23 21:49:30
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv26873/port/src/cbits/Win32 Modified Files: Frame.c Menu.c Util.c Window.c Added Files: MenuHandlesMap.c MenuHandlesMap.h Log Message: Complete implementation for Menu with both GTK and Win32. Supported: - command menu items with bitmaps - checked menu items - radio menu items - sepparators - sub menus --- NEW FILE: MenuHandlesMap.c --- #include "MenuHandlesMap.h" #include "Window.h" #include "Internals.h" #include "Handlers_stub.h" #include <stdlib.h> MenuHandlesMap *newMenuHandlesMap() { MenuHandlesMap *pMap; pMap = (MenuHandlesMap *) malloc(sizeof(MenuHandlesMap)); if (!pMap) return NULL; pMap->children = NULL; pMap->pFreeList = NULL; pMap->pBlocks = NULL; pMap->nAccelCount = 0; pMap->hAccelTable = NULL; pMap->nMenuID = 0; memset(pMap->HashTable, 0, sizeof(MenuHandle)*HASH_TABLE_SIZE); return pMap; } void deleteMenuHandlesMap(MenuHandlesMap *pMap) { Block *p, *pNext; pMap->pFreeList = NULL; p = pMap->pBlocks; while (p != NULL) { pNext = p->pNext; free(p); p = pNext; } if (pMap->hAccelTable) DestroyAcceleratorTable(pMap->hAccelTable); free(pMap); } MenuHandle newMenuHandle(MenuHandlesMap *pMap, MenuHandle parent, MENU_TYPE type, int pos) { int i; MenuHandle handle, child, *prev; unsigned int nHash; // it doesn't exist, add a new Association if (pMap->pFreeList == NULL) { // add another block Block *p = (Block *) malloc(sizeof(Block) + HASH_BLOCK_SIZE * sizeof(*handle)); if (!p) return 0; p->pNext = pMap->pBlocks; pMap->pBlocks = p; // change head (adds in reverse order for simplicity) // chain them into free list handle = (MenuHandle) (p+1); // free in reverse order to make it easier to debug handle += HASH_BLOCK_SIZE - 1; for (i = HASH_BLOCK_SIZE-1; i >= 0; i--, handle--) { handle->next = pMap->pFreeList; pMap->pFreeList = handle; } } handle = pMap->pFreeList; pMap->pFreeList = pMap->pFreeList->next; handle->parent = parent; handle->id = ++pMap->nMenuID; handle->key = 0; handle->mods = 0; handle->bitmap = NULL; handle->children = NULL; handle->type = type; handle->hMenu = NULL; if (parent) { child = parent->children; prev = &parent->children; } else { child = pMap->children; prev = &pMap->children; } if (pos < 0) while (child) { prev = &child->sibling; child = child->sibling; } else while (child && pos > 0) { prev = &child->sibling; child = child->sibling; pos--; } handle->sibling = child; *prev = handle; // put into hash table nHash = (handle->id >> 4) % HASH_TABLE_SIZE; handle->next = pMap->HashTable[nHash]; pMap->HashTable[nHash] = handle; return handle; } void deleteMenuHandle(MenuHandlesMap *pMap, MenuHandle handle) { int nHash; MenuHandle child, *prev; while (handle->children) deleteMenuHandle(pMap, handle->children); if (handle->parent) { prev = &handle->parent->children; child = handle->parent->children; } else { prev = &pMap->children; child = pMap->children; } while (child) { if (child == handle) { *prev = handle->sibling; break; } prev = &child->sibling; child = child->sibling; } nHash = (handle->id >> 4) % HASH_TABLE_SIZE; prev = &(pMap->HashTable[nHash]); child = pMap->HashTable[nHash]; while (child) { if (child == handle) { *prev = handle->next; break; } prev = &child->next; child = child->next; } handle->next = pMap->pFreeList; pMap->pFreeList = handle; } MenuHandle getMenuHandle(MenuHandlesMap *pMap, UINT id) { MenuHandle handle; unsigned int nHash; nHash = (id >> 4) % HASH_TABLE_SIZE; for (handle = pMap->HashTable[nHash]; handle != NULL; handle = handle->next) { if (handle->id == id) return handle; } return NULL; } void updateAccelTable(MenuHandlesMap *pMap, MenuHandle handle, int key, unsigned int mods) { if ( handle->key && !key) pMap->nAccelCount--; if (!handle->key && key) pMap->nAccelCount++; handle->key = key; handle->mods = mods; if (pMap->hAccelTable) { DestroyAcceleratorTable(pMap->hAccelTable); pMap->hAccelTable = NULL; } }; HACCEL getAccelTableFromMap(MenuHandlesMap *pMap) { int i,k; MenuHandle handle; ACCEL *pAccel; if (pMap->hAccelTable) return pMap->hAccelTable; if (pMap->nAccelCount == 0) return NULL; pAccel = malloc(sizeof(ACCEL)*pMap->nAccelCount); if (!pAccel) return NULL; for (k = 0, i = 0; k < pMap->nAccelCount; i++) { handle = pMap->HashTable[i]; while (handle) { pAccel[k].cmd = handle->id; if (handle->key > 0 && handle->key < 256) { pAccel[k].key = handle->key; pAccel[k].fVirt = 0; k++; } else if (handle->key > 256 && handle->key < 512) { pAccel[k].key = handle->key-256; pAccel[k].fVirt = FALT; k++; } else { pAccel[k].fVirt = (((handle->mods & shiftBIT) ? FSHIFT : 0) | ((handle->mods & ctrlBIT ) ? FCONTROL : 0) | ((handle->mods & altBIT ) ? FALT : 0) | FVIRTKEY); switch (handle->key) { case kbUp: pAccel[k++].key = VK_UP; break; case kbDown: pAccel[k++].key = VK_DOWN; break; case kbLeft: pAccel[k++].key = VK_LEFT; break; case kbRight: pAccel[k++].key = VK_RIGHT; break; case kbPgUp: pAccel[k++].key = VK_PRIOR; break; case kbPgDown: pAccel[k++].key = VK_NEXT; break; case kbEnd: pAccel[k++].key = VK_END; break; case kbBegin: pAccel[k++].key = VK_HOME; break; case kbBackSpace:pAccel[k++].key = VK_BACK; break; case kbDelete: pAccel[k++].key = VK_DELETE; break; case kbEnter: pAccel[k++].key = VK_RETURN; break; case kbEscape: pAccel[k++].key = VK_ESCAPE; break; case kbTab: pAccel[k++].key = VK_TAB; break; case kbHelp: pAccel[k++].key = VK_HELP; break; case kbF1: pAccel[k++].key = VK_F1; break; case kbF2: pAccel[k++].key = VK_F2; break; case kbF3: pAccel[k++].key = VK_F3; break; case kbF4: pAccel[k++].key = VK_F4; break; case kbF5: pAccel[k++].key = VK_F5; break; case kbF6: pAccel[k++].key = VK_F6; break; case kbF7: pAccel[k++].key = VK_F7; break; case kbF8: pAccel[k++].key = VK_F8; break; case kbF9: pAccel[k++].key = VK_F9; break; case kbF10: pAccel[k++].key = VK_F10; break; case kbF11: pAccel[k++].key = VK_F11; break; case kbF12: pAccel[k++].key = VK_F12; break; case kbClear: pAccel[k++].key = VK_CLEAR; break; } } handle = handle->next; } } pMap->hAccelTable = CreateAcceleratorTable(pAccel, pMap->nAccelCount); free(pAccel); return pMap->hAccelTable; }; static BOOL getMenuPosEx(MenuHandle firstSibling, MenuHandle handle, int *pos) { MenuHandle h; h = firstSibling; while (h) { if (h == handle) return TRUE; if (h->type != MENU_RADIO_GROUP) *pos += 1; else { if (getMenuPosEx(h->children, handle, pos)) return TRUE; } h = h->sibling; } return FALSE; }; int getMenuPos(MenuHandlesMap *pMap, MenuHandle handle) { int pos; MenuHandle parent; parent = handle->parent; while (parent && parent->hMenu == NULL) parent = parent->parent; pos = 0; if (!getMenuPosEx(parent ? parent->children : pMap->children, handle, &pos)) return -1; return pos; }; int getMenuIndex(MenuHandlesMap *pMap, MenuHandle handle) { int index; MenuHandle child; index = 0; child = handle->parent ? handle->parent->children : pMap->children; while (child) { if (child == handle) break; index += 1; child = child->sibling; } return index; }; HMENU getParentHMENU(MenuHandle handle) { MenuHandle parent; parent = handle->parent; while (parent && parent->hMenu == NULL) parent = parent->parent; if (parent == NULL) return GetMenu(ghWndFrame); else return parent->hMenu; } int getChildrenCount(MenuHandlesMap *pMap, MenuHandle handle) { int count; MenuHandle child; count = 0; child = handle ? handle->children : pMap->children; while (child != NULL) { count++; child = child->sibling; } return count; } MenuHandle getNthChild(MenuHandlesMap *pMap, MenuHandle handle, int index) { MenuHandle child; child = handle ? handle->children : pMap->children; while (child != NULL && index > 0) { index--; child = child->sibling; } return child; } void notifyHandleForDestroy(MenuHandle handle) { MenuHandle child; child = handle->children; while (child) { notifyHandleForDestroy(child); child = child->sibling; } handleMenuDestroy(handle); } void notifyAllHandlesForDestroy(MenuHandlesMap *pMap) { MenuHandle child; child = pMap->children; while (child) { notifyHandleForDestroy(child); child = child->sibling; } } --- NEW FILE: MenuHandlesMap.h --- #ifndef MENU_ITEMS_MAP_H #define MENU_ITEMS_MAP_H #include "Types.h" #define HASH_BLOCK_SIZE 10 #define HASH_TABLE_SIZE 17 enum MENU_TYPE { MENU_SEPARATOR = 1 , MENU_ITEM = 2 , MENU_POPUP = 4 , MENU_CHECK_ITEM = 8 , MENU_RADIO_GROUP = 16 , MENU_RADIO_ITEM = 32 }; typedef enum MENU_TYPE MENU_TYPE; struct MenuHandle { struct MenuHandle *next; struct MenuHandle *parent; struct MenuHandle *children; struct MenuHandle *sibling; UINT id; HMENU hMenu; int key, mods; BitmapHandle bitmap; MENU_TYPE type; }; typedef struct Block_tag { struct Block_tag *pNext; } Block; typedef struct { struct MenuHandle *children; Block* pBlocks; MenuHandle pFreeList; MenuHandle HashTable[HASH_TABLE_SIZE]; HACCEL hAccelTable; int nAccelCount; UINT nMenuID; } MenuHandlesMap; MenuHandlesMap *newMenuHandlesMap(); void deleteMenuHandlesMap(MenuHandlesMap *pMap); MenuHandle newMenuHandle(MenuHandlesMap *pMap, MenuHandle parent, MENU_TYPE type, int pos); void deleteMenuHandle(MenuHandlesMap *pMap, MenuHandle handle); MenuHandle getMenuHandle(MenuHandlesMap *pMap, UINT id); int getMenuPos(MenuHandlesMap *pMap, MenuHandle handle); int getMenuIndex(MenuHandlesMap *pMap, MenuHandle handle); void updateAccelTable(MenuHandlesMap *pMap, MenuHandle item, int key, unsigned int mods); HACCEL getAccelTableFromMap(MenuHandlesMap *pMap); HMENU getParentHMENU(MenuHandle handle); int getChildrenCount(MenuHandlesMap *pMap, MenuHandle handle); MenuHandle getNthChild(MenuHandlesMap *pMap, MenuHandle handle, int index); void notifyHandleForDestroy(MenuHandle handle); void notifyAllHandlesForDestroy(MenuHandlesMap *pMap); #endif Index: Frame.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Frame.c 1 Apr 2003 23:54:20 -0000 1.6 --- Frame.c 23 Apr 2003 21:48:53 -0000 1.7 *************** *** 1,11 **** #include "Types.h" #include "Window.h" #include "Internals.h" #include "Handlers_stub.h" ! #define OSMenuIDEnd 500 LRESULT CALLBACK HFrameSharedFunction(int DocumentInterface, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { FrameData *pData = (FrameData *) GetWindowLong(hWnd,GWL_USERDATA); --- 1,19 ---- #include "Types.h" #include "Window.h" + #include "MenuHandlesMap.h" + #include "Canvas.h" #include "Internals.h" #include "Handlers_stub.h" ! #define OSMenuIDEnd 1500 ! ! #define Spacing 1 LRESULT CALLBACK HFrameSharedFunction(int DocumentInterface, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + int pos, ppos; + HMENU hParent; + MENUITEMINFO mii; + MenuHandle handle; FrameData *pData = (FrameData *) GetWindowLong(hWnd,GWL_USERDATA); *************** *** 16,22 **** --- 24,32 ---- return 0; case WM_DESTROY: + notifyAllHandlesForDestroy(pData->pMenuHandlesMap); handleProcessDestroy(); DeleteObject(pData->hControlFont); free(pData->lpszAppName); + deleteMenuHandlesMap(pData->pMenuHandlesMap); free(pData); PostQuitMessage(0); *************** *** 59,62 **** --- 69,73 ---- pData->hControlFont = hControlFont; pData->lpszAppName = NULL; + pData->pMenuHandlesMap = newMenuHandlesMap(); nLen = GetWindowTextLength(hWnd); *************** *** 85,90 **** case WM_COMMAND: if (lParam == 0) ! handleMenuCommand((MenuHandle) (UINT) LOWORD(wParam)); break; } --- 96,346 ---- case WM_COMMAND: if (lParam == 0) ! { ! handle = getMenuHandle(pData->pMenuHandlesMap, (UINT) LOWORD(wParam)); ! if (handle) ! { ! hParent = getParentHMENU(handle); ! pos = getMenuPos(pData->pMenuHandlesMap, handle); ! ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STATE; ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ! switch (handle->type) ! { ! case MENU_RADIO_ITEM: ! ppos = getMenuPos(pData->pMenuHandlesMap, handle->parent); ! CheckMenuRadioItem(hParent, ppos, ppos+getChildrenCount(pData->pMenuHandlesMap, handle->parent)-1, pos, MF_BYPOSITION); ! break; ! case MENU_CHECK_ITEM: ! CheckMenuItem(hParent, pos, ((mii.fState & MFS_CHECKED) ? MF_UNCHECKED : MF_CHECKED) | MF_BYPOSITION); ! break; ! default: ! } ! ! handleMenuCommand(handle); ! } ! } ! break; ! case WM_MEASUREITEM: ! { ! LPMEASUREITEMSTRUCT lpMIS = (LPMEASUREITEMSTRUCT) lParam; ! ! if (lpMIS->CtlType == ODT_MENU) ! { ! handle = getMenuHandle(pData->pMenuHandlesMap, lpMIS->itemID); ! ! if (handle && handle->bitmap) ! { ! NONCLIENTMETRICS ncm; ! HFONT hFont, hOldFont; ! RECT rc; ! HDC hDC; ! long lDims; ! WORD wCheckWidth, wCheckHeight; ! ! hDC = GetDC(hWnd); ! ! ZeroMemory(&ncm,sizeof(ncm)); ! ncm.cbSize = sizeof(ncm); ! ! // Get the menu dimensions ! SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,(PVOID)&ncm,FALSE); ! ! // Create a font based on menu metrics ! hFont = CreateFontIndirect(&ncm.lfMenuFont); ! ! hOldFont = SelectObject(hDC, hFont); ! ! // Draw out menu item caption - text. ! pos = getMenuPos(pData->pMenuHandlesMap, handle); ! hParent = getParentHMENU(handle); ! ! ZeroMemory(&mii,sizeof(mii)); ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STRING; ! mii.fType = MFT_STRING; ! mii.dwTypeData = NULL; ! mii.cch = 0; ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! mii.cch++; ! mii.dwTypeData = malloc(mii.cch); ! ! if (mii.dwTypeData) ! { ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ! DrawText(hDC,mii.dwTypeData,mii.cch,&rc,DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_CALCRECT|DT_EXPANDTABS); ! ! lDims = GetMenuCheckMarkDimensions(); ! wCheckWidth = (WORD)(LOWORD(lDims)+Spacing); ! wCheckHeight = (WORD)(HIWORD(lDims)+Spacing); ! ! wCheckWidth = (WORD)max(handle->bitmap->destsize.cx, wCheckWidth); ! wCheckHeight = (WORD)max(handle->bitmap->destsize.cy, wCheckHeight); ! ! lpMIS->itemWidth = (rc.right-rc.left) + wCheckWidth + (Spacing*2); // Text width ! lpMIS->itemHeight = max((rc.bottom-rc.top),wCheckHeight) + (Spacing*2); // Text Height ! } ! ! free(mii.dwTypeData); ! ! // Clean up resources ! SelectObject(hDC,hOldFont); ! DeleteObject(hFont); ! ReleaseDC(hWnd,hDC); ! } ! } ! } break; + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) lParam; + + if (lpDIS->CtlType == ODT_MENU) + { + handle = getMenuHandle(pData->pMenuHandlesMap, lpDIS->itemID); + + if (handle && handle->bitmap) + { + long lDims; + RECT rcFrame, rcBox, rcFill, rc; + POINT pt; + WORD wCheckWidth, wCheckHeight; + WORD wWidth, wHeight; + int nIndexDC; + HBRUSH hFillBrush; + DWORD dwDrawFlags; + struct CanvasHandle canvas; + + canvas.hDC = lpDIS->hDC; + + // Check box dimensions + lDims = GetMenuCheckMarkDimensions(); + wCheckWidth = LOWORD(lDims); + wCheckHeight = HIWORD(lDims); + + wWidth = max(handle->bitmap->destsize.cx, wCheckWidth) + (Spacing*2); + wHeight = max(handle->bitmap->destsize.cy, wCheckHeight) + (Spacing*2); + + rcFrame.left = lpDIS->rcItem.left; + rcFrame.top = lpDIS->rcItem.top; + rcFrame.right = lpDIS->rcItem.bottom - lpDIS->rcItem.top; + rcFrame.bottom= lpDIS->rcItem.top+wHeight; + + rcBox.left = rcFrame.left+1; + rcBox.top = rcFrame.top+1; + rcBox.right = rcFrame.right-1; + rcBox.bottom= rcFrame.bottom-1; + + // Save off context attributes + nIndexDC = SaveDC(lpDIS->hDC); + + // create brush for selection state + if (lpDIS->itemState & ODS_SELECTED) + { + hFillBrush = GetSysColorBrush(COLOR_HIGHLIGHT); + SetTextColor(lpDIS->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + } + else + hFillBrush = CreateSolidBrush(GetBkColor(lpDIS->hDC)); + + SetBkMode(lpDIS->hDC,TRANSPARENT); + + // Add some spacing before drawing the text and hi-lite + rcFill.left = lpDIS->rcItem.left; + rcFill.top = lpDIS->rcItem.top-1; + rcFill.right = lpDIS->rcItem.right; + rcFill.bottom= lpDIS->rcItem.bottom; + + if ((lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemState & ODS_CHECKED)) + rcFill.left+=wWidth+Spacing; + + FillRect(lpDIS->hDC, &rcFill, hFillBrush); + + rc = lpDIS->rcItem; + rc.left += wWidth+Spacing; + + // Draw out the bitmap associated with the menu item. + pt.x = rcFrame.left+(((rcFrame.right-rcFrame.left) - handle->bitmap->destsize.cx)/2); + pt.y = rcFrame.top +(((rcFrame.bottom-rcFrame.top) - handle->bitmap->destsize.cy)/2); + + osDrawBitmap(pt.x, pt.y, handle->bitmap, &canvas); + + // Draw bounding frame + if (lpDIS->itemState & ODS_SELECTED) + DrawEdge(lpDIS->hDC,&rcFrame,BDR_RAISEDINNER,BF_RECT); + + rc.left+=Spacing; + + // Draw out menu item caption - text. + pos = getMenuPos(pData->pMenuHandlesMap, handle); + hParent = getParentHMENU(handle); + + ZeroMemory(&mii,sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING; + mii.fType = MFT_STRING; + mii.dwTypeData = NULL; + mii.cch = 0; + GetMenuItemInfo(hParent, pos, TRUE, &mii); + mii.cch++; + mii.dwTypeData = malloc(mii.cch); + + if (mii.dwTypeData) + { + GetMenuItemInfo(hParent, pos, TRUE, &mii); + + dwDrawFlags = DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_EXPANDTABS; + + if (lpDIS->itemState & ODS_GRAYED) + { + // This will give it a disable text look + if (!(lpDIS->itemState & ODS_SELECTED)) + { + SetTextColor(lpDIS->hDC, GetSysColor(COLOR_3DHILIGHT)); + OffsetRect(&rc,1,1); + DrawText(lpDIS->hDC,mii.dwTypeData,mii.cch,&rc,dwDrawFlags); + OffsetRect(&rc,-1,-1); + + SetTextColor(lpDIS->hDC,GetSysColor(COLOR_GRAYTEXT)); + DrawText(lpDIS->hDC,mii.dwTypeData,mii.cch,&rc,dwDrawFlags); + } + else + { + COLORREF crGray = (GetSysColor(COLOR_GRAYTEXT) + RGB(64,64,64)); + SetTextColor(lpDIS->hDC,crGray); + DrawText(lpDIS->hDC,mii.dwTypeData,mii.cch,&rc,dwDrawFlags); + } + } + else + DrawText(lpDIS->hDC,mii.dwTypeData,mii.cch,&rc,dwDrawFlags); + } + + free(mii.dwTypeData); + + RestoreDC(lpDIS->hDC,nIndexDC); + } + } + } + return TRUE; + case WM_INITMENUPOPUP: + { + HMENU hMenu; + int i, nCount; + + hMenu = (HMENU) wParam; + nCount = GetMenuItemCount((HMENU) wParam); + for (i = 0; i < nCount; i++) + { + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_ID; + GetMenuItemInfo(hMenu, i, TRUE, &mii); + + handle = getMenuHandle(pData->pMenuHandlesMap, (UINT) mii.wID); + if (handle) handleMenuUpdate(handle); + } + } + break; } Index: Menu.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Menu.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Menu.c 1 Apr 2003 23:54:20 -0000 1.5 --- Menu.c 23 Apr 2003 21:48:53 -0000 1.6 *************** *** 4,13 **** #include "Handlers_stub.h" - static UINT gMenuItemID = 0; ! static UINT NextMenuItemID() ! { ! return ++gMenuItemID; ! } static void AddAccelString(int nKeyCode, int mods, char *text) --- 4,21 ---- #include "Handlers_stub.h" ! #define CHECK_MENU_TYPE(handle,mask,ret) \ ! if (((handle ? handle->type : MENU_POPUP) & (mask)) == 0) \ ! { \ ! printf("Invalid menu handle type."); \ ! return ret; \ ! } ! ! #define CHECK_MENU_TYPE_V(handle,mask) \ ! if (((handle ? handle->type : MENU_POPUP) & (mask)) == 0) \ ! { \ ! printf("Invalid menu handle type."); \ ! return; \ ! } static void AddAccelString(int nKeyCode, int mods, char *text) *************** *** 82,90 **** } - static HMENU getHMENU(HMENU hMenu) - { - return (hMenu) ? hMenu : GetMenu(ghWndFrame); - } - static void updateMenuBar(MenuHandle parent) { --- 90,93 ---- *************** *** 106,202 **** } ! MenuHandle osAddMenu(MenuHandle parent, char *title) { ! HMENU hMenu, hParent; ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! hMenu = CreateMenu(); ! hParent = getHMENU(parent); ! if (pFrameData->DocumentInterface == 1) ! InsertMenu(hParent,-1,MF_BYPOSITION | MF_POPUP,(UINT)hMenu,title); ! else ! InsertMenu(hParent,GetMenuItemCount(hParent)-1,MF_BYPOSITION | MF_POPUP,(UINT)hMenu,title); ! updateMenuBar(parent); ! ! return hMenu; }; ! MenuHandle osAddMenuItem(MenuHandle parent, int key, unsigned int mods, char *title) { ! UINT nMenuItemID = NextMenuItemID(); ! char *temp = rmalloc(strlen(title)+32); ! strcpy(temp, title); ! AddAccelString(key, mods, temp); ! InsertMenu(getHMENU(parent),-1,MF_BYPOSITION | MF_STRING,nMenuItemID,temp); ! free(temp); ! updateMenuBar(parent); ! return (MenuHandle) nMenuItemID; }; ! MenuHandle osAddMenuCheckItem(MenuHandle parent, int key, unsigned int mods, char *title) { ! UINT nMenuItemID = NextMenuItemID(); ! char *temp = rmalloc(strlen(title)+32); ! strcpy(temp, title); ! AddAccelString(key, mods, temp); ! InsertMenu(getHMENU(parent),-1,MF_BYPOSITION | MF_STRING,nMenuItemID,title); ! free(temp); ! updateMenuBar(parent); ! return (MenuHandle) nMenuItemID; }; ! void osAddMenuSeparatorItem(MenuHandle parent) { ! InsertMenu(getHMENU(parent),-1,MF_BYPOSITION | MF_SEPARATOR,0,NULL); ! updateMenuBar(parent); } ! void osSetMenuItemEnabled(MenuHandle parent, MenuHandle item, BOOL bState) { ! EnableMenuItem(getHMENU(parent), (UINT) item, (bState ? MF_ENABLED : MF_GRAYED) | MF_BYCOMMAND); }; ! BOOL osGetMenuItemEnabled(MenuHandle parent, MenuHandle item) { MENUITEMINFO mii; mii.cbSize = sizeof(mii); mii.fMask = MIIM_STATE; ! GetMenuItemInfo(getHMENU(parent), (UINT) item, FALSE, &mii); ! return (mii.fState & MFS_ENABLED) != 0; }; ! void osSetMenuItemChecked(MenuHandle parent, MenuHandle item, BOOL bState) { ! CheckMenuItem(getHMENU(parent), (UINT) item, (bState ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND); }; ! BOOL osGetMenuItemChecked(MenuHandle parent, MenuHandle item) { MENUITEMINFO mii; mii.cbSize = sizeof(mii); mii.fMask = MIIM_STATE; ! GetMenuItemInfo(getHMENU(parent), (UINT) item, FALSE, &mii); return (mii.fState & MFS_CHECKED) != 0; } ! void osSetMenuItemLabel(MenuHandle parent, MenuHandle item, int key, unsigned int mods, char* title) { ! MENUITEMINFO menuItemInfo; ! char *temp = rmalloc(strlen(title)+32); ! strcpy(temp, title); ! AddAccelString(key, mods, temp); ! memset(&menuItemInfo,0,sizeof(menuItemInfo)); ! menuItemInfo.cbSize = sizeof(menuItemInfo); ! menuItemInfo.fMask = MIIM_STRING; ! menuItemInfo.fType = MFT_STRING; ! menuItemInfo.dwTypeData = temp; ! menuItemInfo.cch = strlen(temp); ! SetMenuItemInfo(getHMENU(parent), (UINT) item, FALSE, &menuItemInfo); ! free(temp); } ! void osDrawMenuBar(WindowHandle window) { ! DrawMenuBar(window); } --- 109,508 ---- } ! MenuHandle osInsertMenu(MenuHandle parent, int pos) { ! MenuHandle handle; ! FrameData *pFrameData; ! CHECK_MENU_TYPE(parent, MENU_POPUP, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handle = newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_POPUP, pos); ! ! if (handle) ! { ! handle->hMenu = CreateMenu(); ! ! InsertMenu(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),MF_BYPOSITION | MF_POPUP,(UINT)handle->hMenu,""); ! ! updateMenuBar(parent); ! } ! ! return handle; }; ! MenuHandle osInsertMenuItem(MenuHandle parent, int pos) { ! MenuHandle handle; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(parent, MENU_POPUP, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handle = newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_ITEM, pos); ! ! if (handle) ! { ! InsertMenu(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),MF_BYPOSITION | MF_STRING,handle->id,""); ! updateMenuBar(parent); ! } ! ! return handle; }; ! MenuHandle osInsertMenuCheckItem(MenuHandle parent, int pos) { ! MenuHandle handle; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(parent, MENU_POPUP, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handle = newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_CHECK_ITEM, pos); ! ! if (handle) ! { ! InsertMenu(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),MF_BYPOSITION | MF_STRING,handle->id,""); ! updateMenuBar(parent); ! } ! ! return handle; }; ! MenuHandle osInsertMenuSeparatorItem(MenuHandle parent, int pos) { ! MenuHandle handle; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(parent, MENU_POPUP, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handle = newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_SEPARATOR, pos); ! ! if (handle) ! { ! InsertMenu(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),MF_BYPOSITION | MF_SEPARATOR,0,NULL); ! updateMenuBar(parent); ! } ! ! return handle; } ! MenuHandle osInsertMenuRadioGroup(MenuHandle parent, int pos) { ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(parent, MENU_POPUP, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! return newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_RADIO_GROUP, pos); }; ! MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos) ! { ! MenuHandle handle; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(parent, MENU_RADIO_GROUP, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handle = newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_RADIO_ITEM, pos); ! ! if (handle) ! { ! InsertMenu(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),MF_BYPOSITION | MF_STRING,handle->id,""); ! updateMenuBar(parent); ! } ! ! return handle; ! }; ! ! void osDestroyMenu(MenuHandle handle) ! { ! int pos, count; ! HMENU hParent; ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! notifyHandleForDestroy(handle); ! ! hParent = getParentHMENU(handle); ! pos = getMenuPos(pFrameData->pMenuHandlesMap, handle); ! ! if (handle->type != MENU_RADIO_GROUP) ! DeleteMenu(hParent, pos, MF_BYPOSITION); ! else ! { ! count = getChildrenCount(pFrameData->pMenuHandlesMap, handle); ! while (count--) ! DeleteMenu(hParent, pos, MF_BYPOSITION); ! } ! ! deleteMenuHandle(pFrameData->pMenuHandlesMap, handle); ! } ! ! int osGetMenuItemCount(MenuHandle handle) ! { ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(handle, MENU_RADIO_GROUP | MENU_POPUP, 0); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! return getChildrenCount(pFrameData->pMenuHandlesMap, handle); ! } ! ! void osSetMenuItemEnabled(MenuHandle handle, BOOL bState) ! { ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE_V(handle, MENU_RADIO_ITEM | MENU_CHECK_ITEM | MENU_ITEM); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! EnableMenuItem(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), (bState ? MF_ENABLED : MF_GRAYED) | MF_BYPOSITION); ! }; ! ! BOOL osGetMenuItemEnabled(MenuHandle handle) { MENUITEMINFO mii; + FrameData *pFrameData; + + CHECK_MENU_TYPE(handle, MENU_RADIO_ITEM | MENU_CHECK_ITEM | MENU_ITEM, FALSE); + + pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + mii.cbSize = sizeof(mii); mii.fMask = MIIM_STATE; ! GetMenuItemInfo(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), TRUE, &mii); ! return (mii.fState & MFS_DISABLED) == 0; }; ! void osSetMenuItemChecked(MenuHandle handle, BOOL bState) { ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE_V(handle, MENU_CHECK_ITEM); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! CheckMenuItem(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), (bState ? MF_CHECKED : MF_UNCHECKED) | MF_BYPOSITION); ! ! handleMenuCommand(handle); }; ! BOOL osGetMenuItemChecked(MenuHandle handle) { MENUITEMINFO mii; + FrameData *pFrameData; + + CHECK_MENU_TYPE(handle, MENU_CHECK_ITEM, FALSE); + + pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + mii.cbSize = sizeof(mii); mii.fMask = MIIM_STATE; ! GetMenuItemInfo(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), TRUE, &mii); return (mii.fState & MFS_CHECKED) != 0; } ! void osSetMenuRadioGroupSelection(MenuHandle handle, int index) { ! int pos; ! HMENU hParent; ! FrameData *pFrameData; ! MenuHandle child; ! ! CHECK_MENU_TYPE_V(handle, MENU_RADIO_GROUP); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! hParent = getParentHMENU(handle); ! pos = getMenuPos(pFrameData->pMenuHandlesMap, handle); ! child = getNthChild(pFrameData->pMenuHandlesMap, handle, index); ! ! if (!child) return; ! ! CheckMenuRadioItem(hParent, pos, pos+getChildrenCount(pFrameData->pMenuHandlesMap, handle)-1, pos+index, MF_BYPOSITION); ! ! handleMenuCommand(child); ! } ! int osGetMenuRadioGroupSelection(MenuHandle handle) ! { ! HMENU hParent; ! int pos, index; ! MenuHandle child; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(handle, MENU_RADIO_GROUP, -1); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! hParent = getParentHMENU(handle); ! pos = getMenuPos(pFrameData->pMenuHandlesMap, handle); ! ! index = 0; ! child = handle->children; ! while (child) ! { ! MENUITEMINFO mii; ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STATE; ! GetMenuItemInfo(hParent, pos+index, TRUE, &mii); ! if (mii.fState & MFT_RADIOCHECK) ! return index; ! ! index++; ! child = child->sibling; ! } ! ! return index; } ! char *osGetMenuLabel(MenuHandle handle) { ! int pos; ! HMENU hParent; ! char *s; ! MENUITEMINFO mii; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE(handle, MENU_POPUP | MENU_RADIO_ITEM | MENU_CHECK_ITEM | MENU_ITEM, NULL); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! pos = getMenuPos(pFrameData->pMenuHandlesMap, handle); ! hParent = getParentHMENU(handle); ! ! memset(&mii,0,sizeof(mii)); ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STRING; ! mii.fType = MFT_STRING; ! mii.dwTypeData = NULL; ! mii.cch = 0; ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! mii.cch++; ! mii.dwTypeData = malloc(mii.cch); ! ! if (mii.dwTypeData) ! { ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ! s = mii.dwTypeData; ! while (*s && *s != '\t') s++; ! *s = 0; ! } ! ! return mii.dwTypeData; ! } ! ! void osSetMenuLabel(MenuHandle handle, char *title) ! { ! char *s, *temp; ! MENUITEMINFO mii; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE_V(handle, MENU_POPUP | MENU_RADIO_ITEM | MENU_CHECK_ITEM | MENU_ITEM); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! temp = malloc(strlen(title)+32); ! ! if (temp) ! { ! s = temp; ! while (*title) ! { ! if (*title != '\t') *s++ = *title; ! title++; ! } ! *s = 0; ! AddAccelString(handle->key, handle->mods, temp); ! ! memset(&mii,0,sizeof(mii)); ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STRING; ! mii.fType = MFT_STRING; ! mii.dwTypeData = temp; ! mii.cch = strlen(temp); ! SetMenuItemInfo(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), TRUE, &mii); ! ! updateMenuBar(handle->parent); ! } ! ! free(temp); ! } ! ! void osSetMenuItemAccel(MenuHandle handle, int key, unsigned int mods) ! { ! int pos; ! HMENU hParent; ! char *s; ! MENUITEMINFO mii; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE_V(handle, MENU_RADIO_ITEM | MENU_CHECK_ITEM | MENU_ITEM); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! pos = getMenuPos(pFrameData->pMenuHandlesMap, handle); ! hParent = getParentHMENU(handle); ! ! updateAccelTable(pFrameData->pMenuHandlesMap, handle, key, mods); ! ! memset(&mii,0,sizeof(mii)); ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STRING; ! mii.fType = MFT_STRING; ! mii.dwTypeData = NULL; ! mii.cch = 0; ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! mii.dwTypeData = malloc(mii.cch+32); ! ! if (mii.dwTypeData) ! { ! mii.cch++; ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ! s = mii.dwTypeData; ! while (*s && *s != '\t') s++; ! *s = 0; ! ! AddAccelString(key, mods, s); ! ! mii.cch = strlen(mii.dwTypeData); ! SetMenuItemInfo(hParent, pos, TRUE, &mii); ! ! updateMenuBar(handle->parent); ! } ! ! free(mii.dwTypeData); ! } ! ! void osGetMenuItemAccel(MenuHandle handle, int *key, unsigned int *mods) ! { ! CHECK_MENU_TYPE_V(handle, MENU_RADIO_ITEM | MENU_CHECK_ITEM | MENU_ITEM); ! ! *key = handle->key; ! *mods = handle->mods; ! } ! ! void osSetMenuItemBitmap(MenuHandle handle, BitmapHandle bitmap) ! { ! MENUITEMINFO mii; ! FrameData *pFrameData; ! ! CHECK_MENU_TYPE_V(handle, MENU_ITEM); ! ! pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handle->bitmap = bitmap; ! ! memset(&mii,0,sizeof(mii)); ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_FTYPE; ! mii.fType = bitmap ? MFT_OWNERDRAW : MFT_STRING; ! SetMenuItemInfo(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), TRUE, &mii); ! ! updateMenuBar(handle->parent); ! } ! ! int osGetMenuItemPos(MenuHandle handle) ! { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! return getMenuIndex(pFrameData->pMenuHandlesMap, handle); } Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Util.c 30 Mar 2003 18:49:07 -0000 1.11 --- Util.c 23 Apr 2003 21:48:54 -0000 1.12 *************** *** 179,198 **** } ! extern StgClosure GHCziConc_yield_closure; void osStart() { MSG msg; ! while (GetMessage(&msg, NULL, 0, 0) != 0) { ! TranslateMessage(&msg); ! DispatchMessage(&msg); } doneGdiPlus(); }; - - extern void doneGdiPlus(); void osQuit() --- 179,201 ---- } ! extern void doneGdiPlus(); void osStart() { MSG msg; ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! while (GetMessage(&msg, NULL, 0, 0) != 0) { ! if ((pFrameData->DocumentInterface != 1 || !TranslateMDISysAccel(pFrameData->hClientWnd, &msg)) && ! !TranslateAccelerator(pFrameData->hClientWnd, getAccelTableFromMap(pFrameData->pMenuHandlesMap), &msg)) ! { ! TranslateMessage(&msg); ! DispatchMessage(&msg); ! } } doneGdiPlus(); }; void osQuit() Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Window.c 2 Apr 2003 00:06:52 -0000 1.24 --- Window.c 23 Apr 2003 21:48:54 -0000 1.25 *************** *** 111,114 **** --- 111,115 ---- case VK_F11: return kbF11; case VK_F12: return kbF12; + case VK_CLEAR: return kbClear; } *************** *** 221,225 **** else { ! handleMenuCommand((MenuHandle) (UINT) LOWORD(wParam)); } break; --- 222,257 ---- else { ! int pos, ppos; ! HMENU hParent; ! MENUITEMINFO mii; ! FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! MenuHandle handle = getMenuHandle(pData->pMenuHandlesMap, (UINT) LOWORD(wParam)); ! ! if (handle) ! { ! hParent = getParentHMENU(handle); ! pos = getMenuPos(pData->pMenuHandlesMap, handle); ! ! mii.cbSize = sizeof(mii); ! mii.fMask = MIIM_STATE; ! GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ! if ((mii.fState & MFS_DISABLED) == 0) ! { ! switch (handle->type) ! { ! case MENU_RADIO_ITEM: ! ppos = getMenuPos(pData->pMenuHandlesMap, handle->parent); ! CheckMenuRadioItem(hParent, ppos, ppos+getChildrenCount(pData->pMenuHandlesMap, handle->parent)-1, pos, MF_BYPOSITION); ! break; ! case MENU_CHECK_ITEM: ! CheckMenuItem(hParent, pos, ((mii.fState & MFS_CHECKED) ? MF_UNCHECKED : MF_CHECKED) | MF_BYPOSITION); ! break; ! default: ! } ! ! handleMenuCommand(handle); ! } ! } } break; |
From: <kr_...@us...> - 2003-04-14 20:40:41
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv24947/src/Graphics/UI/GIO Modified Files: Events.hs Log Message: fix export list Index: Events.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Events.hs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Events.hs 14 Apr 2003 17:57:31 -0000 1.10 --- Events.hs 14 Apr 2003 20:40:37 -0000 1.11 *************** *** 68,72 **** -- ** Reactive , Reactive ! , mouse, keyboard -- ** Form --- 68,72 ---- -- ** Reactive , Reactive ! , mouse, keyboard, contextMenu -- ** Form *************** *** 98,104 **** , downKey,upKey,leftKey,rightKey - -- * Context menu - , contextMenu - -- * Internal -- ** Standard events --- 98,101 ---- |
From: <kr_...@us...> - 2003-04-14 18:22:36
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv22778/src/Port Modified Files: Handlers.hs Timer.hs Log Message: bugfix: Proper timer registration. The getAllTimerHandles function now returns a list of all exiting timer handles even if they are inactive. Index: Handlers.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Handlers.hs 14 Apr 2003 17:36:53 -0000 1.19 --- Handlers.hs 14 Apr 2003 18:22:32 -0000 1.20 *************** *** 32,35 **** --- 32,38 ---- -- * Timers + ,registerTimer, unregisterTimer, getAllTimerHandles + + -- ** Events ,setTimerHandler, setTimerDefHandler, getTimerHandler ,setTimerDestroyHandler, setTimerDestroyDefHandler, getTimerDestroyHandler *************** *** 132,138 **** return () ! {----------------------------------------------------------------------------------------- ! Keep track of all windows ! -----------------------------------------------------------------------------------------} {-# NOINLINE windows #-} windows :: MVar [WindowHandle] --- 135,141 ---- return () ! ----------------------------------------------------------------------------------------- ! -- Keep track of all windows ! ----------------------------------------------------------------------------------------- {-# NOINLINE windows #-} windows :: MVar [WindowHandle] *************** *** 578,582 **** ----------------------------------------------------------------------------------------- ! -- Timers ----------------------------------------------------------------------------------------- {-# NOINLINE handlersTimer #-} --- 581,607 ---- ----------------------------------------------------------------------------------------- ! -- Keep track of all timers ! ----------------------------------------------------------------------------------------- ! {-# NOINLINE timers #-} ! timers :: MVar [TimerHandle] ! timers ! = unsafePerformIO (newMVar []) ! ! registerTimer :: TimerHandle -> IO () ! registerTimer htimer ! = do htimers <- takeMVar timers ! putMVar timers (htimer : L.delete htimer htimers) ! ! unregisterTimer :: TimerHandle -> IO () ! unregisterTimer htimer ! = do htimers <- takeMVar timers ! putMVar timers (L.delete htimer htimers) ! ! -- | 'getAllTimerHandles' returns list of handles for all created timers. ! getAllTimerHandles :: IO [TimerHandle] ! getAllTimerHandles = readMVar timers ! ! ----------------------------------------------------------------------------------------- ! -- TimerEvent ----------------------------------------------------------------------------------------- {-# NOINLINE handlersTimer #-} *************** *** 601,607 **** = getHandler htimer (return ()) handlersTimer - getAllTimerHandles :: IO [TimerHandle] - getAllTimerHandles = fmap keys (readMVar handlersTimer) - ----------------------------------------------------------------------------------------- -- TimerDestroy --- 626,629 ---- *************** *** 615,619 **** handleTimerDestroy :: TimerHandle -> IO () handleTimerDestroy htimer ! = invokeHandler htimer handlersTimerDestroy id setTimerDestroyHandler :: TimerHandle -> IO () -> IO () --- 637,647 ---- handleTimerDestroy :: TimerHandle -> IO () handleTimerDestroy htimer ! = do map <- takeMVar handlersTimerDestroy ! setTimerDefHandler htimer ! putMVar handlersTimerDestroy (delete htimer map) ! case lookup htimer map of ! Nothing -> return () ! Just io -> safeio io ! unregisterTimer htimer setTimerDestroyHandler :: TimerHandle -> IO () -> IO () Index: Timer.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Timer.hs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Timer.hs 14 Apr 2003 17:49:52 -0000 1.3 --- Timer.hs 14 Apr 2003 18:22:32 -0000 1.4 *************** *** 22,36 **** import Graphics.UI.Port.Types ! import Graphics.UI.Port.Handlers(setTimerDefHandler, getAllTimerHandles) -- | Create a timer with a handler that is called on a specified milli-second interval. ! foreign import ccall "osCreateTimer" createTimer :: Int -> IO TimerHandle -- | Destroy a timer and automatically unregister its event handler. ! destroyTimer :: TimerHandle -> IO () ! destroyTimer htimer = do ! setTimerDefHandler htimer ! osDestroyTimer htimer ! foreign import ccall osDestroyTimer :: TimerHandle -> IO () -- | Change the delay time for the timer --- 22,37 ---- import Graphics.UI.Port.Types ! import Graphics.UI.Port.Handlers(registerTimer, getAllTimerHandles) -- | Create a timer with a handler that is called on a specified milli-second interval. ! createTimer :: Int -> IO TimerHandle ! createTimer interval = do ! htimer <- osCreateTimer interval ! registerTimer htimer ! return htimer ! foreign import ccall osCreateTimer :: Int -> IO TimerHandle -- | Destroy a timer and automatically unregister its event handler. ! foreign import ccall "osDestroyTimer" destroyTimer :: TimerHandle -> IO () -- | Change the delay time for the timer |
From: <kr_...@us...> - 2003-04-14 18:01:39
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv14756/src/Graphics/UI/GIO Modified Files: Timer.hs Log Message: bugfix` Index: Timer.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Timer.hs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Timer.hs 14 Apr 2003 17:57:33 -0000 1.7 --- Timer.hs 14 Apr 2003 18:01:34 -0000 1.8 *************** *** 50,52 **** instance Deadly Timer where destroyWidget t = Lib.destroyTimer (getTimerHandle t) ! destroy = newEvent (const Lib.getTimerDestroyHandler) (const Lib.setTimerDestroyHandler) (const Lib.setTimerDestroyDefHandler) --- 50,52 ---- instance Deadly Timer where destroyWidget t = Lib.destroyTimer (getTimerHandle t) ! destroy = newEvent (Lib.getTimerDestroyHandler . getTimerHandle) (Lib.setTimerDestroyHandler . getTimerHandle) (Lib.setTimerDestroyDefHandler . getTimerHandle) |
From: <kr_...@us...> - 2003-04-14 17:57:42
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv12351/src/Graphics/UI/GIO Modified Files: Events.hs Process.hs Window.hs Timer.hs Log Message: Split the Deadly class into Deadly and Dismissible classes Index: Events.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Events.hs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Events.hs 1 Apr 2003 22:46:36 -0000 1.9 --- Events.hs 14 Apr 2003 17:57:31 -0000 1.10 *************** *** 73,79 **** , Form, activate, deactivate, scroll, resize ! -- ** Deadly ! , Deadly , dismissWidget, dismiss , destroyWidget, destroy --- 73,82 ---- , Form, activate, deactivate, scroll, resize ! -- ** Dismissible ! , Dismissible , dismissWidget, dismiss + + -- ** Deadly + , Deadly , destroyWidget, destroy *************** *** 167,178 **** resize :: Event w (Size -> IO ()) ! -- | The Deadly widgets can be destroyed and dissmissed ! class Deadly w where ! -- | Close a widget dismissWidget :: w -> IO Bool -- | The 'dismiss' event is called when the user tries to close the form. dismiss :: Event w (IO ()) ! destroyWidget :: w -> IO () --- 170,183 ---- resize :: Event w (Size -> IO ()) ! -- | The Dismissible widgets can be dissmissed ! class Dismissible w where ! -- | Dismiss a widget dismissWidget :: w -> IO Bool -- | The 'dismiss' event is called when the user tries to close the form. dismiss :: Event w (IO ()) ! ! -- | The Deadly widgets can be destroyed. ! class Deadly w where destroyWidget :: w -> IO () Index: Process.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Process.hs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Process.hs 30 Mar 2003 18:49:07 -0000 1.1 --- Process.hs 14 Apr 2003 17:57:32 -0000 1.2 *************** *** 30,36 **** pc = error "The Process is an abstract object and cannot be evaluated" ! instance Deadly Process where dismissWidget p = quit dismiss = newEvent (const Lib.getProcessDismissHandler) (const Lib.setProcessDismissHandler) (const Lib.setProcessDismissDefHandler) destroyWidget p = halt destroy = newEvent (const Lib.getProcessDestroyHandler) (const Lib.setProcessDestroyHandler) (const Lib.setProcessDestroyDefHandler) --- 30,38 ---- pc = error "The Process is an abstract object and cannot be evaluated" ! instance Dismissible Process where dismissWidget p = quit dismiss = newEvent (const Lib.getProcessDismissHandler) (const Lib.setProcessDismissHandler) (const Lib.setProcessDismissDefHandler) + + instance Deadly Process where destroyWidget p = halt destroy = newEvent (const Lib.getProcessDestroyHandler) (const Lib.setProcessDestroyHandler) (const Lib.setProcessDestroyDefHandler) Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Window.hs 12 Apr 2003 07:30:58 -0000 1.11 --- Window.hs 14 Apr 2003 17:57:33 -0000 1.12 *************** *** 150,156 **** (\w sz-> Lib.setWindowViewSize (hwindow w) sz) ! instance Deadly Window where dismissWidget w = Lib.dismissWindow (hwindow w) dismiss = newDismissEvent hwindow destroyWidget w = Lib.destroyWindow (hwindow w) destroy = newDestroyEvent hwindow --- 150,158 ---- (\w sz-> Lib.setWindowViewSize (hwindow w) sz) ! instance Dismissible Window where dismissWidget w = Lib.dismissWindow (hwindow w) dismiss = newDismissEvent hwindow + + instance Deadly Window where destroyWidget w = Lib.destroyWindow (hwindow w) destroy = newDestroyEvent hwindow Index: Timer.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Timer.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Timer.hs 14 Apr 2003 17:49:56 -0000 1.6 --- Timer.hs 14 Apr 2003 17:57:33 -0000 1.7 *************** *** 12,16 **** ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Timer ! ( Timer, timer, interval, destroyTimer ) where --- 12,16 ---- ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Timer ! ( Timer, timer, interval ) where *************** *** 48,51 **** command = newEvent (Lib.getTimerHandler . getTimerHandle) (Lib.setTimerHandler . getTimerHandle) (Lib.setTimerDefHandler . getTimerHandle) ! destroyTimer :: Timer -> IO () ! destroyTimer = Lib.destroyTimer . getTimerHandle \ No newline at end of file --- 48,52 ---- command = newEvent (Lib.getTimerHandler . getTimerHandle) (Lib.setTimerHandler . getTimerHandle) (Lib.setTimerDefHandler . getTimerHandle) ! instance Deadly Timer where ! destroyWidget t = Lib.destroyTimer (getTimerHandle t) ! destroy = newEvent (const Lib.getTimerDestroyHandler) (const Lib.setTimerDestroyHandler) (const Lib.setTimerDestroyDefHandler) |
From: <kr_...@us...> - 2003-04-14 17:50:29
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv9449/port/src/include Modified Files: Timer.h Log Message: Rename osEnableTimer to osSetTimerEnabled and osIsTimerEnabled to osGetTimerEnabled Index: Timer.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Timer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Timer.h 26 Mar 2003 02:19:57 -0000 1.2 --- Timer.h 14 Apr 2003 17:49:55 -0000 1.3 *************** *** 8,13 **** void osSetTimerInterval(TimerHandle timer, int msecs); int osGetTimerInterval(TimerHandle timer); ! void osEnableTimer(TimerHandle timer, BOOL enabled); ! BOOL osIsTimerEnabled(TimerHandle timer); #endif --- 8,13 ---- void osSetTimerInterval(TimerHandle timer, int msecs); int osGetTimerInterval(TimerHandle timer); ! void osSetTimerEnabled(TimerHandle timer, BOOL enabled); ! BOOL osGetTimerEnabled(TimerHandle timer); #endif |
From: <kr_...@us...> - 2003-04-14 17:50:27
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv9449/port/src/cbits/Win32 Modified Files: Timer.c Log Message: Rename osEnableTimer to osSetTimerEnabled and osIsTimerEnabled to osGetTimerEnabled Index: Timer.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Timer.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Timer.c 14 Apr 2003 17:36:54 -0000 1.5 --- Timer.c 14 Apr 2003 17:49:53 -0000 1.6 *************** *** 89,93 **** }; ! void osEnableTimer(TimerHandle timer, BOOL enabled) { timer->enabled = enabled; --- 89,93 ---- }; ! void osSetTimerEnabled(TimerHandle timer, BOOL enabled) { timer->enabled = enabled; *************** *** 105,109 **** }; ! BOOL osIsTimerEnabled(TimerHandle timer) { return timer->enabled; --- 105,109 ---- }; ! BOOL osGetTimerEnabled(TimerHandle timer) { return timer->enabled; |
From: <kr_...@us...> - 2003-04-14 17:50:27
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv9449/port/src/Port Modified Files: Timer.hs Log Message: Rename osEnableTimer to osSetTimerEnabled and osIsTimerEnabled to osGetTimerEnabled Index: Timer.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Timer.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Timer.hs 26 Mar 2003 02:19:57 -0000 1.2 --- Timer.hs 14 Apr 2003 17:49:52 -0000 1.3 *************** *** 17,21 **** ( createTimer, destroyTimer , setTimerInterval, getTimerInterval ! , enableTimer, isTimerEnabled , getAllTimerHandles, destroyAllTimers ) where --- 17,21 ---- ( createTimer, destroyTimer , setTimerInterval, getTimerInterval ! , setTimerEnabled, getTimerEnabled , getAllTimerHandles, destroyAllTimers ) where *************** *** 41,48 **** -- | Enable\/disable timer ! foreign import ccall "osEnableTimer" enableTimer :: TimerHandle -> Bool -> IO () -- | Returns True when the timer is enabled. ! foreign import ccall "osIsTimerEnabled" isTimerEnabled :: TimerHandle -> IO Bool -- Destroy all timers (called by quit). --- 41,48 ---- -- | Enable\/disable timer ! foreign import ccall "osSetTimerEnabled" setTimerEnabled :: TimerHandle -> Bool -> IO () -- | Returns True when the timer is enabled. ! foreign import ccall "osGetTimerEnabled" getTimerEnabled :: TimerHandle -> IO Bool -- Destroy all timers (called by quit). |
From: <kr_...@us...> - 2003-04-14 17:50:00
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv9449/gio/src/Graphics/UI/GIO Modified Files: Timer.hs Log Message: Rename osEnableTimer to osSetTimerEnabled and osIsTimerEnabled to osGetTimerEnabled Index: Timer.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Timer.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Timer.hs 27 Mar 2003 13:35:09 -0000 1.5 --- Timer.hs 14 Apr 2003 17:49:56 -0000 1.6 *************** *** 43,47 **** instance Able Timer where ! enabled = newAttr (Lib.isTimerEnabled . getTimerHandle) (Lib.enableTimer . getTimerHandle) instance Commanding Timer where --- 43,47 ---- instance Able Timer where ! enabled = newAttr (Lib.getTimerEnabled . getTimerHandle) (Lib.setTimerEnabled . getTimerHandle) instance Commanding Timer where |
From: <kr_...@us...> - 2003-04-14 17:49:59
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv9449/port/src/cbits/GTK Modified Files: Timer.c Log Message: Rename osEnableTimer to osSetTimerEnabled and osIsTimerEnabled to osGetTimerEnabled Index: Timer.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Timer.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Timer.c 14 Apr 2003 17:36:55 -0000 1.7 --- Timer.c 14 Apr 2003 17:49:54 -0000 1.8 *************** *** 48,52 **** }; ! void osEnableTimer(TimerHandle timer, BOOL enabled) { timer->enabled = enabled; --- 48,52 ---- }; ! void osSetTimerEnabled(TimerHandle timer, BOOL enabled) { timer->enabled = enabled; *************** *** 64,68 **** }; ! BOOL osIsTimerEnabled(TimerHandle timer) { return timer->enabled; --- 64,68 ---- }; ! BOOL osGetTimerEnabled(TimerHandle timer) { return timer->enabled; |
From: <kr_...@us...> - 2003-04-14 17:36:59
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv3723/src/cbits/GTK Modified Files: Timer.c Log Message: Add TimerDestroy event Index: Timer.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Timer.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Timer.c 29 Mar 2003 08:12:18 -0000 1.6 --- Timer.c 14 Apr 2003 17:36:55 -0000 1.7 *************** *** 22,25 **** --- 22,26 ---- if (timer!=NULL) { + handleTimerDestroy(timer); if (timer->id > 0) gtk_timeout_remove(timer->id); |
From: <kr_...@us...> - 2003-04-14 17:36:58
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv3723/src/cbits/Win32 Modified Files: Timer.c Log Message: Add TimerDestroy event Index: Timer.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Timer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Timer.c 29 Mar 2003 08:12:19 -0000 1.4 --- Timer.c 14 Apr 2003 17:36:54 -0000 1.5 *************** *** 63,66 **** --- 63,67 ---- if (timer!=NULL) { + handleTimerDestroy(timer); if (timer->id > 0) KillTimer(ghTimerWnd,timer->id); |
From: <kr_...@us...> - 2003-04-14 17:36:57
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv3723/src/Port Modified Files: Handlers.hs Log Message: Add TimerDestroy event Index: Handlers.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Handlers.hs 1 Apr 2003 23:54:20 -0000 1.18 --- Handlers.hs 14 Apr 2003 17:36:53 -0000 1.19 *************** *** 32,36 **** -- * Timers ! ,setTimerHandler, setTimerDefHandler, getTimerHandler, getAllTimerHandles -- * Windows --- 32,38 ---- -- * Timers ! ,setTimerHandler, setTimerDefHandler, getTimerHandler ! ,setTimerDestroyHandler, setTimerDestroyDefHandler, getTimerDestroyHandler ! ,getAllTimerHandles -- * Windows *************** *** 575,581 **** handleProcessDestroy = readMVar handlersProcessDestroy >>= id ! {----------------------------------------------------------------------------------------- ! Timers ! -----------------------------------------------------------------------------------------} {-# NOINLINE handlersTimer #-} handlersTimer :: MVar (PtrMap TimerHandle (IO ())) --- 577,583 ---- handleProcessDestroy = readMVar handlersProcessDestroy >>= id ! ----------------------------------------------------------------------------------------- ! -- Timers ! ----------------------------------------------------------------------------------------- {-# NOINLINE handlersTimer #-} handlersTimer :: MVar (PtrMap TimerHandle (IO ())) *************** *** 602,605 **** --- 604,632 ---- getAllTimerHandles = fmap keys (readMVar handlersTimer) + ----------------------------------------------------------------------------------------- + -- TimerDestroy + ----------------------------------------------------------------------------------------- + + {-# NOINLINE handlersTimerDestroy #-} + handlersTimerDestroy :: MVar (PtrMap TimerHandle (IO ())) + handlersTimerDestroy + = unsafePerformIO (newMVar empty) + + handleTimerDestroy :: TimerHandle -> IO () + handleTimerDestroy htimer + = invokeHandler htimer handlersTimerDestroy id + + setTimerDestroyHandler :: TimerHandle -> IO () -> IO () + setTimerDestroyHandler htimer handler + = setHandler htimer handler handlersTimerDestroy + + setTimerDestroyDefHandler :: TimerHandle -> IO () + setTimerDestroyDefHandler htimer + = setDefHandler htimer handlersTimerDestroy + + getTimerDestroyHandler :: TimerHandle -> IO (IO ()) + getTimerDestroyHandler htimer + = getHandler htimer (return ()) handlersTimerDestroy + {----------------------------------------------------------------------------------------- foreign exports *************** *** 620,623 **** --- 647,651 ---- foreign export ccall handleMenusUpdate :: IO () foreign export ccall handleTimer :: TimerHandle -> IO () + foreign export ccall handleTimerDestroy :: TimerHandle -> IO () foreign export ccall handleProcessDismiss :: IO () foreign export ccall handleProcessDestroy :: IO () |
From: <kr_...@us...> - 2003-04-13 19:12:10
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv2495/src/Graphics/UI/GIO Modified Files: Types.hs Log Message: Remove isJust, isNothing and when functions. Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Types.hs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Types.hs 7 Apr 2003 21:03:10 -0000 1.8 --- Types.hs 13 Apr 2003 19:12:07 -0000 1.9 *************** *** 92,97 **** -- ** Misc. - , isNothing, isJust - , when , bounded --- 92,95 ---- *************** *** 109,124 **** import Graphics.UI.Port.Colors import Control.Concurrent.MVar - import Control.Monad( when ) {-------------------------------------------------------------------- Misc. --------------------------------------------------------------------} - isNothing, isJust :: Maybe a -> Bool - - isNothing Nothing = True - isNothing other = False - - isJust (Just _) = True - isJust other = False - bounded :: Ord a => a -> a -> a -> a --- 107,113 ---- |
From: <kr_...@us...> - 2003-04-12 07:31:01
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv25672/src/Graphics/UI/GIO Modified Files: Window.hs Canvas.hs Log Message: Explicitly import when function from Control.Monad Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Window.hs 31 Mar 2003 00:12:06 -0000 1.10 --- Window.hs 12 Apr 2003 07:30:58 -0000 1.11 *************** *** 24,27 **** --- 24,28 ---- import Graphics.UI.GIO.Canvas import Graphics.UI.GIO.Layout + import Control.Monad( when ) {-------------------------------------------------------------------- Index: Canvas.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Canvas.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Canvas.hs 7 Apr 2003 21:03:09 -0000 1.6 --- Canvas.hs 12 Apr 2003 07:30:58 -0000 1.7 *************** *** 71,74 **** --- 71,75 ---- import Graphics.UI.GIO.Attributes import Graphics.UI.GIO.Bitmap + import Control.Monad( when ) {-------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-04-09 22:35:44
|
Update of /cvsroot/htoolkit/gio/src/examples/simple/res In directory sc8-pr-cvs1:/tmp/cvs-serv12176 Added Files: new.bmp open.bmp save.bmp Log Message: Add images for future usage with samples --- NEW FILE: new.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: open.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: save.bmp --- (This appears to be a binary file; contents omitted.) |
From: <kr_...@us...> - 2003-04-09 22:34:09
|
Update of /cvsroot/htoolkit/gio/src/examples/simple/res In directory sc8-pr-cvs1:/tmp/cvs-serv11791/res Log Message: Directory /cvsroot/htoolkit/gio/src/examples/simple/res added to the repository |
From: <kr_...@us...> - 2003-04-09 17:17:47
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv31760/src/cbits/GTK Modified Files: Util.c Log Message: BUGFIX: Initialize the global variables at right place Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Util.c 9 Apr 2003 16:57:25 -0000 1.14 --- Util.c 9 Apr 2003 17:17:42 -0000 1.15 *************** *** 55,63 **** void osStart() { - gAppName = NULL; - gFrameWidget = NULL; - gClientWidget = NULL; - gMenuBar = NULL; - gtk_main(); handleProcessDestroy(); --- 55,58 ---- |
From: <kr_...@us...> - 2003-04-09 16:57:30
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv21972/src/cbits/GTK Modified Files: Util.c Log Message: BUGFIX: Initialize global variables at right place Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Util.c 3 Apr 2003 00:40:03 -0000 1.13 --- Util.c 9 Apr 2003 16:57:25 -0000 1.14 *************** *** 30,43 **** if (!bInitialized) { ! int margc; ! char **margv; ! gtk_set_locale(); ! getProgArgv(&margc, &margv); ! gtk_init(&margc,&margv); ! setProgArgv(margc, margv); ! bInitialized = TRUE; gDocumentInterface = DocumentInterface; if (gDocumentInterface == 2) --- 30,48 ---- if (!bInitialized) { ! int margc; ! char **margv; ! gtk_set_locale(); ! getProgArgv(&margc, &margv); ! gtk_init(&margc,&margv); ! setProgArgv(margc, margv); ! bInitialized = TRUE; gDocumentInterface = DocumentInterface; + + gAppName = NULL; + gFrameWidget = NULL; + gClientWidget = NULL; + gMenuBar = NULL; if (gDocumentInterface == 2) |
From: <kr_...@us...> - 2003-04-07 21:03:16
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv12462/src/Graphics/UI/GIO Modified Files: Canvas.hs Bitmap.hs Types.hs Log Message: Export some additional bitmap related features from the Port library Index: Canvas.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Canvas.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Canvas.hs 8 Feb 2003 08:32:53 -0000 1.5 --- Canvas.hs 7 Apr 2003 21:03:09 -0000 1.6 *************** *** 441,448 **** -- | Draw a bitmap bitmap :: Point -> Bitmap -> Canvas -> IO () ! bitmap p bitmap can ! = do bh <- get bitmap bitmapHandle ! Port.drawBitmap p bh (hcanvas can) ! {-------------------------------------------------------------------- --- 441,445 ---- -- | Draw a bitmap bitmap :: Point -> Bitmap -> Canvas -> IO () ! bitmap p bitmap can = Port.drawBitmap p bitmap (hcanvas can) {-------------------------------------------------------------------- Index: Bitmap.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Bitmap.hs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Bitmap.hs 26 Jan 2003 12:41:40 -0000 1.1.1.1 --- Bitmap.hs 7 Apr 2003 21:03:10 -0000 1.2 *************** *** 14,24 **** ( -- * Bitmaps ! Bitmap, readBitmap ! -- * Internal ! , bitmapHandle ) where ! import qualified Graphics.UI.Port as Port import Graphics.UI.GIO.Types import Graphics.UI.GIO.Attributes --- 14,24 ---- ( -- * Bitmaps ! createBitmap ! , readBitmap, writeBitmap ! , getAvailableCodecs ) where ! import qualified Graphics.UI.Port as Lib import Graphics.UI.GIO.Types import Graphics.UI.GIO.Attributes *************** *** 28,49 **** Bitmaps --------------------------------------------------------------------} ! -- | A bitmap. ! data Bitmap = Bitmap{ bitmap :: Port.Bitmap } -- | Read a bitmap from file. readBitmap :: FilePath -> [Prop Bitmap] -> IO Bitmap readBitmap fname props ! = do b <- do bm <- Port.readBitmap fname ! return (Bitmap bm) set b props return b ! bitmapHandle :: Attr Bitmap Port.Bitmap ! bitmapHandle ! = readAttr "bitmapHandle" (\b -> return (bitmap b)) instance Dimensions Bitmap where ! frame = newAttr (\b -> do sz <- Port.getBitmapSize (bitmap b); return (rectOfSize sz)) ! (\b r -> do Port.resizeBitmap (bitmap b) (rectSize r)) {-------------------------------------------------------------------- --- 28,55 ---- Bitmaps --------------------------------------------------------------------} ! ! -- | Create an empty bitmap of a certain size. ! createBitmap :: Size -> IO Bitmap ! createBitmap = Lib.createBitmap -- | Read a bitmap from file. readBitmap :: FilePath -> [Prop Bitmap] -> IO Bitmap readBitmap fname props ! = do b <- Lib.readBitmap fname set b props return b + + -- | Write a bitmap image to file. Can select different formats with the supplied MIME + -- string. The image type \"image\/bmp\" is always supported. See also 'getAvailableCodecs'. + writeBitmap :: Bitmap -> FilePath -> String -> IO () + writeBitmap = Lib.writeBitmap ! -- | Return all available codec's on this platform. ! getAvailableCodecs :: IO [Codec] ! getAvailableCodecs = Lib.getAvailableCodecs instance Dimensions Bitmap where ! frame = newAttr (\b -> do sz <- Lib.getBitmapSize b; return (rectOfSize sz)) ! (\b r -> do Lib.setBitmapSize b (rectSize r)) {-------------------------------------------------------------------- Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Types.hs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Types.hs 24 Mar 2003 17:18:37 -0000 1.7 --- Types.hs 7 Apr 2003 21:03:10 -0000 1.8 *************** *** 67,71 **** -- ** Bitmaps ! -- , Bitmap , Codec(..) --- 67,71 ---- -- ** Bitmaps ! , Bitmap , Codec(..) |
From: <kr_...@us...> - 2003-04-07 20:59:21
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv10179/src/cbits/GTK Modified Files: Bitmap.c Log Message: Rename resizeBitmap function to setBitmapSize Index: Bitmap.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Bitmap.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Bitmap.c 10 Feb 2003 22:42:09 -0000 1.4 --- Bitmap.c 7 Apr 2003 20:58:47 -0000 1.5 *************** *** 65,69 **** } ! void osResizeBitmap (BitmapHandle bitmap, int width, int height) { GdkPixbuf *new_pixbuf; --- 65,69 ---- } ! void osSetBitmapSize (BitmapHandle bitmap, int width, int height) { GdkPixbuf *new_pixbuf; |
From: <kr_...@us...> - 2003-04-07 20:59:21
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv10179/src/cbits/Win32 Modified Files: Bitmap.c Log Message: Rename resizeBitmap function to setBitmapSize Index: Bitmap.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Bitmap.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Bitmap.c 1 Feb 2003 08:58:56 -0000 1.3 --- Bitmap.c 7 Apr 2003 20:58:46 -0000 1.4 *************** *** 267,271 **** } ! void osResizeBitmap (BitmapHandle bitmap, int width, int height) { bitmap->destsize.cx = width; --- 267,271 ---- } ! void osSetBitmapSize (BitmapHandle bitmap, int width, int height) { bitmap->destsize.cx = width; |
From: <kr_...@us...> - 2003-04-07 20:58:56
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv10179/src/Port Modified Files: Bitmap.hs Log Message: Rename resizeBitmap function to setBitmapSize Index: Bitmap.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Bitmap.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Bitmap.hs 23 Mar 2003 10:17:54 -0000 1.4 --- Bitmap.hs 7 Apr 2003 20:58:48 -0000 1.5 *************** *** 21,25 **** -- * Operations , getBitmapSize ! , resizeBitmap , drawInBitmap --- 21,25 ---- -- * Operations , getBitmapSize ! , setBitmapSize , drawInBitmap *************** *** 100,109 **** -- | Stretch a bitmap to a different size. ! resizeBitmap :: Bitmap -> Size -> IO () ! resizeBitmap bitmap size = withCBitmap bitmap$ \bh -> withCSize size $ \cw ch -> ! osResizeBitmap bh cw ch ! foreign import ccall osResizeBitmap :: BitmapHandle -> CInt -> CInt -> IO () --- 100,109 ---- -- | Stretch a bitmap to a different size. ! setBitmapSize :: Bitmap -> Size -> IO () ! setBitmapSize bitmap size = withCBitmap bitmap$ \bh -> withCSize size $ \cw ch -> ! osSetBitmapSize bh cw ch ! foreign import ccall osSetBitmapSize :: BitmapHandle -> CInt -> CInt -> IO () |
From: <kr_...@us...> - 2003-04-07 20:58:51
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv10179/src/include Modified Files: Bitmap.h Log Message: Rename resizeBitmap function to setBitmapSize Index: Bitmap.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Bitmap.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Bitmap.h 31 Jan 2003 23:25:38 -0000 1.3 --- Bitmap.h 7 Apr 2003 20:58:48 -0000 1.4 *************** *** 8,12 **** extern BitmapHandle osReadBitmap (char *, int *); extern int osWriteBitmap(BitmapHandle bitmap, char *format, char *fname); ! extern void osResizeBitmap (BitmapHandle bitmap, int width, int height); extern void osGetBitmapSize (BitmapHandle bitmap, int *size); extern CanvasHandle osGetBitmapCanvas(BitmapHandle bitmap); --- 8,12 ---- extern BitmapHandle osReadBitmap (char *, int *); extern int osWriteBitmap(BitmapHandle bitmap, char *format, char *fname); ! extern void osSetBitmapSize (BitmapHandle bitmap, int width, int height); extern void osGetBitmapSize (BitmapHandle bitmap, int *size); extern CanvasHandle osGetBitmapCanvas(BitmapHandle bitmap); |
From: <kr_...@us...> - 2003-04-03 00:40:06
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv21062a/src/cbits/GTK Modified Files: Util.c Log Message: Add initialization for global variables Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Util.c 2 Apr 2003 19:19:15 -0000 1.12 --- Util.c 3 Apr 2003 00:40:03 -0000 1.13 *************** *** 50,53 **** --- 50,58 ---- void osStart() { + gAppName = NULL; + gFrameWidget = NULL; + gClientWidget = NULL; + gMenuBar = NULL; + gtk_main(); handleProcessDestroy(); |