/*[]=====================================================================[]*/ /*[] LeadTools Run Time Library - Version 14 []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2004 LEAD Technologies, Inc. []*/ /*[] All Rights Reserved. []*/ /*[]=====================================================================[]*/ /*------------------------------------------------------------------------- We have made the assumption that the user has the knowledge of programming in C and Windows. --------------------------------------------------------------------------*/ #include "ImgConVw.h" DISPSTACKACTIONPROPS StackProp; static L_BOOL StackWndProc_OnCommand (HWND hWnd, L_INT nID, HWND hWndCtl, L_UINT codeNotify); static L_BOOL StackWndProc_OnInitDialog (HWND hWnd, HWND hWndFocus, LPARAM lParam); L_BOOL CALLBACK StackWndProc (HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam) { switch(uMessage) { HANDLE_MSG (hWnd, WM_COMMAND, StackWndProc_OnCommand); HANDLE_MSG (hWnd, WM_INITDIALOG, StackWndProc_OnInitDialog); } return FALSE; } static L_BOOL StackWndProc_OnCommand (HWND hWnd, L_INT nID, HWND hWndCtl, L_UINT codeNotify) { HDISPCONTAINER hCon = (HDISPCONTAINER)GetWindowLong(hWnd, GWL_USERDATA); L_INT nRet; switch(nID) { case IDC_ACTION_UPKEY_COM: case IDC_ACTION_DOWNKEY_COM: CheckKeyValidity(GetDlgItem(hWnd, IDC_ACTION_MOD_COM), 0); break; case IDC_ACTION_CELLINDEX_EDT: if (nCellIndex == (L_INT)GetDlgItemInt(hWnd, nID, NULL, TRUE)) break; nCellIndex = GetDlgItemInt(hWnd, nID, NULL, TRUE); L_DispContainerGetActionProperties(hCon, CONTAINER_ACTION_STACK, nCellIndex, nSubCellIndex, (LONG)&StackProp, CONTAINER_ACTION_CELLLEVEL); SetDlgItemInt(hWnd, IDC_STACKACTION_STACK_EDT, StackProp.nScrollValue, TRUE); SetDlgItemInt(hWnd, IDC_STACKACTION_ACTV_EDT , StackProp.nActiveSubCell, TRUE); break; case IDC_ACTION_CELLINDEX_COM: nRet = ComboBox_GetCurSel(hWndCtl); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_EDT), (nRet == 2)); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM), (nRet != 0)); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_EDT), (nRet != 0) && ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM)) ); EnableWindow(GetDlgItem(hWnd, IDC_STACKACTION_STACK_EDT), (nRet != 0)); EnableWindow(GetDlgItem(hWnd, IDC_STACKACTION_ACTV_EDT), (nRet != 0)); break; case IDC_ACTION_SUBCELLINDEX_COM: nRet = ComboBox_GetCurSel(hWndCtl); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_EDT), (nRet == 1)); break; case IDC_ACTION_CUR_BTN: OpenCursorDialog(hWndCtl, &StackProp.DispContainerActionProps.hCursor); break; case IDAPPLY: case IDOK: { L_INT nVk; L_INT bShiftedRemoved = (ComboBox_GetCount(GetDlgItem(hWnd, IDC_ACTION_MOD_COM)) == 3); L_UINT uState = (8 >> (4 - ( ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_ACTION_MOD_COM)) + bShiftedRemoved))); StackProp.DispContainerActionProps.uStructSize = sizeof(DISPSTACKACTIONPROPS); StackProp.DispContainerActionProps.bCircularMouseMove = Button_GetCheck(GetDlgItem(hWnd, IDC_ACTION_CIRCLE_CHK)); StackProp.DispContainerActionProps.nChange = GetDlgItemInt(hWnd, IDC_ACTION_SEN_EDT, NULL, FALSE); L_DispContainerSetActionProperties(hCon, CONTAINER_ACTION_STACK, 0, 0, (LONG)&StackProp, CONTAINER_ACTION_CONTAINERLEVEL); nRet = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_COM)); if (nRet) { L_INT nIndex; StackProp.nActiveSubCell = GetDlgItemInt(hWnd, IDC_STACKACTION_ACTV_EDT, NULL, TRUE); StackProp.nScrollValue = GetDlgItemInt(hWnd, IDC_STACKACTION_STACK_EDT, NULL, TRUE); if (nRet == 1) nIndex = -1; else nIndex = GetDlgItemInt(hWnd, IDC_ACTION_CELLINDEX_EDT, NULL, TRUE); L_DispContainerSetActionProperties(hCon, CONTAINER_ACTION_STACK, nIndex, 0, (LONG)&StackProp, CONTAINER_ACTION_CELLLEVEL); } nVk = GetVirtualKey(hWnd, GetDlgItem(hWnd, IDC_ACTION_UPKEY_COM)); L_DispContainerSetKeyboardAction(hCon, CONTAINER_ACTION_STACK, CONTAINER_MOUSEMOVE_UP, nVk, uState); nVk = GetVirtualKey(hWnd, GetDlgItem(hWnd, IDC_ACTION_DOWNKEY_COM)); L_DispContainerSetKeyboardAction(hCon, CONTAINER_ACTION_STACK, CONTAINER_MOUSEMOVE_DOWN, nVk, uState); if (nID == IDAPPLY) break; EndDialog(hWnd, 1); } break; case IDCANCEL: EndDialog(hWnd, 0); break; } return TRUE; } static L_BOOL StackWndProc_OnInitDialog (HWND hWnd, HWND hWndFocus, LPARAM lParam) { HDISPCONTAINER hCon = (HDISPCONTAINER)lParam; L_BOOL bEnable = FALSE; L_INT nIndex; L_INT nCount; HBITMAPLIST hBitmapList; MoveDialogToMiddle(hWnd); SetWindowLong(hWnd, GWL_USERDATA, (long)lParam); nIndex = SearchForFirstSelectedCell(hCon); nCellIndex = 0; nSubCellIndex = 0; nIndex = max(0, nIndex); StackProp.DispContainerActionProps.uStructSize = sizeof(DISPSTACKACTIONPROPS); L_DispContainerGetActionProperties(hCon, CONTAINER_ACTION_STACK, nIndex, 0, (LONG)&StackProp, CONTAINER_ACTION_CONTAINERLEVEL); L_DispContainerGetActionProperties(hCon, CONTAINER_ACTION_STACK, nIndex, 0, (LONG)&StackProp, CONTAINER_ACTION_CELLLEVEL); SetDlgItemText(hWnd, IDC_ACTION_SUBCELLINDEX_EDT, TEXT("0")); SetDlgItemInt(hWnd, IDC_ACTION_CELLINDEX_EDT, nIndex, TRUE); SetDlgItemInt(hWnd, IDC_STACKACTION_STACK_EDT, StackProp.nScrollValue, TRUE); SetDlgItemInt(hWnd, IDC_STACKACTION_ACTV_EDT , StackProp.nActiveSubCell, TRUE); nCount = L_DispContainerGetCellCount(hCon, 0); L_DispContainerGetCellBitmapList(hCon, nIndex, &hBitmapList, 0); SetNumericEditBox(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_EDT), -1, nCount - 1, 1, 0, 0); ComboBox_AddString(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_COM), TEXT("None")); ComboBox_AddString(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_COM), TEXT("All")); ComboBox_AddString(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_COM), TEXT("Custom")); ComboBox_SetCurSel(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_COM), 0); ComboBox_AddString(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM), TEXT("All")); ComboBox_AddString(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM), TEXT("Custom")); ComboBox_SetCurSel(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM), 0); nCount = L_DispContainerGetCellCount(hCon, 0); if (!nCount) { EnableWindow(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_COM), bEnable); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM), bEnable); } EnableWindow(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_COM), bEnable); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_CELLINDEX_EDT), bEnable); EnableWindow(GetDlgItem(hWnd, IDC_ACTION_SUBCELLINDEX_EDT), bEnable); EnableWindow(GetDlgItem(hWnd, IDC_STACKACTION_STACK_EDT), bEnable); EnableWindow(GetDlgItem(hWnd, IDC_STACKACTION_ACTV_EDT), bEnable); InitlizeVirtualKeyList(hWnd); AddSupString(GetDlgItem(hWnd, IDC_ACTION_MOD_COM)); AddVirtualKeyString(GetDlgItem(hWnd, IDC_ACTION_UPKEY_COM)); AddVirtualKeyString(GetDlgItem(hWnd, IDC_ACTION_DOWNKEY_COM)); GetKeyboardAction(GetDlgItem(hWnd, IDC_ACTION_UPKEY_COM), CONTAINER_ACTION_STACK, CONTAINER_MOUSEMOVE_UP); GetKeyboardAction(GetDlgItem(hWnd, IDC_ACTION_LEFTKEY_COM), CONTAINER_ACTION_STACK, CONTAINER_MOUSEMOVE_LEFT); GetKeyboardAction(GetDlgItem(hWnd, IDC_ACTION_RIGHTKEY_COM), CONTAINER_ACTION_STACK, CONTAINER_MOUSEMOVE_RIGHT); GetKeyboardAction(GetDlgItem(hWnd, IDC_ACTION_DOWNKEY_COM), CONTAINER_ACTION_STACK, CONTAINER_MOUSEMOVE_DOWN); CheckKeyValidity(GetDlgItem(hWnd, IDC_ACTION_MOD_COM), 0); Button_SetCheck(GetDlgItem(hWnd, IDC_ACTION_CIRCLE_CHK), StackProp.DispContainerActionProps.bCircularMouseMove); SetDlgItemInt(hWnd, IDC_ACTION_SEN_EDT, StackProp.DispContainerActionProps.nChange, FALSE); SendMessage(GetDlgItem(hWnd, IDC_ACTION_CUR_BTN), BM_SETIMAGE , IMAGE_CURSOR, (LPARAM)(HCURSOR)StackProp.DispContainerActionProps.hCursor); hOldCursor = StackProp.DispContainerActionProps.hCursor; return TRUE; }