static VOID InitInputLangPropDlg(HWND hDlg) { HKEY hKey, hSubKey; LVITEM item; INT LayoutNum; TCHAR szLayoutNum[10 + 1], szPreload[CCH_LAYOUT_ID + 1], szTmp[CCH_LAYOUT_ID + 1], szName[MAX_PATH]; DWORD dwSize; LANGID langid; ZeroMemory(&item, sizeof(LVITEM)); item.mask = LVIF_PARAM; item.iItem = IsLayoutSelected(); (VOID) ListView_GetItem(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), &item); LayoutNum = (INT) item.lParam; OldLayoutNum = LayoutNum; if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) { _ultot(LayoutNum, szLayoutNum, 10); dwSize = sizeof(szPreload); RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize); langid = (LANGID)_tcstoul(szPreload, NULL, 16); GetLocaleInfo(langid, LOCALE_SLANGUAGE, (LPTSTR)szName, sizeof(szName) / sizeof(TCHAR)); SetWindowText(GetDlgItem(hDlg, IDC_INPUT_LANG_STR), szName); if (szPreload[0] == 'd') { if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS) { if (RegQueryValueEx(hSubKey, szPreload, NULL, NULL, (LPBYTE)szTmp, &dwSize) != ERROR_SUCCESS) { RegCloseKey(hSubKey); RegCloseKey(hKey); return; } lstrcpy(szPreload, szTmp); RegCloseKey(hSubKey); } } if (GetLayoutName(szPreload, szName)) { SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO), CB_SELECTSTRING, (WPARAM)-1, (LPARAM)szName); } } RegCloseKey(hKey); }
static VOID SelectLayoutByLang(VOID) { TCHAR Layout[MAX_PATH], Lang[MAX_PATH], LangID[CCH_LAYOUT_ID + 1]; INT iIndex; LCID Lcid; iIndex = SendMessage(hLangList, CB_GETCURSEL, 0, 0); Lcid = SendMessage(hLangList, CB_GETITEMDATA, iIndex, 0); GetLocaleInfo(MAKELCID(Lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Lang, sizeof(Lang) / sizeof(TCHAR)); wsprintf(LangID, _T("0000%s"), Lang); if (GetLayoutName(LangID, Layout)) { SendMessage(hLayoutList, CB_SELECTSTRING, (WPARAM) -1, (LPARAM)Layout); } }
VOID CreateKeyboardLayoutList(HWND hItemsList) { HKEY hKey; PTSTR pstrLayoutID; TCHAR szLayoutID[CCH_LAYOUT_ID + 1], KeyName[MAX_PATH]; DWORD dwIndex = 0; DWORD dwSize; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\Keyboard Layouts"), 0, KEY_ENUMERATE_SUB_KEYS, &hKey) == ERROR_SUCCESS) { dwSize = sizeof(szLayoutID) / sizeof(TCHAR); while (RegEnumKeyEx(hKey, dwIndex, szLayoutID, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { INT iIndex; GetLayoutName(szLayoutID, KeyName); iIndex = (INT) SendMessage(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName); pstrLayoutID = (PTSTR)HeapAlloc(hProcessHeap, 0, sizeof(szLayoutID)); lstrcpy(pstrLayoutID, szLayoutID); SendMessage(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)pstrLayoutID); // FIXME! if (_tcscmp(szLayoutID, _T("00000409")) == 0) { SendMessage(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0); } dwIndex++; dwSize = sizeof(szLayoutID) / sizeof(TCHAR); } RegCloseKey(hKey); } }
void TextureBrowseControl::OnInitialise(Control* _parent, MyGUI::Widget* _place, const std::string& _layoutName) { Control::OnInitialise(_parent, _place, GetLayoutName(this)); InitialiseByAttributes(this); setDialogRoot(mMainWidget); assignBase(mTextures, "Textures"); mOk->eventMouseButtonClick += MyGUI::newDelegate(this, &TextureBrowseControl::notifyMouseButtonClickOk); mCancel->eventMouseButtonClick += MyGUI::newDelegate(this, &TextureBrowseControl::notifyMouseButtonClickCancel); MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false); if (window != nullptr) window->eventWindowButtonPressed += MyGUI::newDelegate(this, &TextureBrowseControl::notifyWindowButtonPressed); MyGUI::ItemBox* box = mTextures->getItemBox(); box->eventChangeItemPosition += MyGUI::newDelegate(this, &TextureBrowseControl::notifyChangeItemPosition); box->eventSelectItemAccept += MyGUI::newDelegate(this, &TextureBrowseControl::notifySelectItemAccept); mMainWidget->setVisible(false); }
static VOID AddNewLayout(HWND hwndDlg) { TCHAR NewLayout[CCH_ULONG_DEC + 1], Lang[MAX_PATH], LangID[CCH_LAYOUT_ID + 1], Layout[MAX_PATH], SubPath[CCH_LAYOUT_ID + 1], szMessage[MAX_PATH]; INT iLayout, iLang; HKEY hKey, hSubKey; DWORD cValues; PTSTR pts; LCID lcid; iLayout = SendMessage(hLayoutList, CB_GETCURSEL, 0, 0); if (iLayout == CB_ERR) return; if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) { if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &cValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { _ultot(cValues + 1, NewLayout, 10); iLang = SendMessage(hLangList, CB_GETCURSEL, 0, 0); lcid = SendMessage(hLangList, CB_GETITEMDATA, iLang, 0); pts = (PTSTR) SendMessage(hLayoutList, CB_GETITEMDATA, iLayout, 0); GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Lang, sizeof(Lang) / sizeof(TCHAR)); wsprintf(LangID, _T("0000%s"), Lang); if (IsLayoutExists(pts, LangID)) { LoadString(hApplet, IDS_LAYOUT_EXISTS2, szMessage, sizeof(szMessage) / sizeof(TCHAR)); MessageBox(hwndDlg, szMessage, NULL, MB_OK | MB_ICONINFORMATION); RegCloseKey(hKey); return; } if (_tcscmp(LangID, pts) != 0) { if (!GetLayoutName(pts, Layout)) { RegCloseKey(hKey); return; } } else { if (!GetLayoutName(LangID, Layout)) { RegCloseKey(hKey); return; } } if (SendMessage(hLayoutList, CB_SELECTSTRING, (WPARAM) -1, (LPARAM)Layout) != CB_ERR) { if (GetLayoutCount(Lang) >= 1) { wsprintf(SubPath, _T("d%03d%s"), GetLayoutCount(Lang), Lang); } else if ((_tcscmp(LangID, pts) != 0) && (GetLayoutCount(Lang) == 0)) { wsprintf(SubPath, _T("d%03d%s"), 0, Lang); } else SubPath[0] = '\0'; } else { RegCloseKey(hKey); return; } if (_tcslen(SubPath) != 0) { if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hSubKey, NULL) == ERROR_SUCCESS) { if (RegSetValueEx(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)pts, (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))) != ERROR_SUCCESS) { RegCloseKey(hSubKey); RegCloseKey(hKey); return; } RegCloseKey(hSubKey); } lstrcpy(pts, SubPath); } if (RegSetValueEx(hKey, NewLayout, 0, REG_SZ, (LPBYTE)pts, (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))) == ERROR_SUCCESS) { UpdateLayoutsList(); } } RegCloseKey(hKey); } }
int Controls_Handle_Keyboard(unsigned char key, int x, int y) { /* According to zoom factor we will use a desired_step matching it in order to have smooth movement over the image RefreshDesiredStep_AccordingToPosition calculates it and loads it in frame.desired_step variable */ // RefreshDesiredStep_AccordingToPosition(); /*---------------------------------------------------------------------------------------------------------------*/ char label[256]={0}; int nokey=0; if (PrintDevMsg()) fprintf(stderr,"Key %u \n",key); switch (key) { case 1 : /* UP */ MoveToPicture(D_UP); break; case 2 : /* DOWN */ MoveToPicture(D_DOWN); break; case 3 : /* LEFT */ MoveToPicture(D_LEFT); break; case 4 : /* RIGHT */ MoveToPicture(D_RIGHT); break; case 9 : /* TAB */ frame.show_information=550; /* 550 is the time !*/ break; case '`' : /*Tilda button*/ frame.show_time=550; break; case 13 : /* ENTER */ ToggleAutomaticSlideshow(); break; case ' ' : /* SPACE */ ToggleAutomaticSlideshow(); break; //Buttons 0 - 9 , directory transactions case 48+0 : /*Number 0*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),0)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+1 : /*Number 1*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),1)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+2 : /*Number 2*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),2)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+3 : /*Number 3*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),3)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+4 : /*Number 4*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),4)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+5 : /*Number 5*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),5)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+6 : /*Number 6*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),6)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+7 : /*Number 7*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),7)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+8 : /*Number 8*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),8)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 48+9 : /*Number 9*/ if (PerformDirectoryTransaction(GetPictureDirectoryListIndex(frame.active_image_place),9)>0) {TriggerNextPictureSlideShow(); usleep(10000); return 0; } break; case 'o': ResetCameraOrientation(); NewLabel(frame.desired_x,frame.desired_y,(char *) "Reset Camera to center..!"); break; case 'u': CreateObjectFountain(2); /*"PARTICLE" EFFECT*/ break; case 'i': CreateObjectFountain(3); /*"PARTICLE" EFFECT*/ break; case 'k': CreateObjectFountain(6); /*"PARTICLE" EFFECT*/ break; case 'j': return 1; /*This key is reserved for fullscreen*/ break; //case 'j': CreateObjectFountain(5); /*"PARTICLE" EFFECT*/ break; case 'q': RotatePictureLeft(); break; case 'e': RotatePictureRight(); break; case 'r': MoveDestinationCenter(D_OUT); /*frame.desired_z+=frame.desired_step;*/ break; case 'f': MoveDestinationCenter(D_IN); /*frame.desired_z-=frame.desired_step;*/ break; case 'a': MoveDestinationCenter(D_LEFT); /*frame.desired_x+=frame.desired_step;*/ break; case 'd': MoveDestinationCenter(D_RIGHT); /*frame.desired_x-=frame.desired_step;*/ break; case 's': MoveDestinationCenter(D_UP); /*frame.desired_y+=frame.desired_step;*/ break; case 'w': MoveDestinationCenter(D_DOWN); /*frame.desired_y-=frame.desired_step;*/ break; case '-': if ( frame.time_ms_between_two_transitions >= 100 ) { SetTransitionTime(frame.time_ms_between_two_transitions-100); } break; case '+': SetTransitionTime(frame.time_ms_between_two_transitions+100); break; case 'z': frame.angle_x-=0.5; break; case 'c': frame.angle_x+=0.5; break; case 't': frame.angle_y-=0.5; break; case 'g': frame.angle_y+=0.5; break; case 'y': frame.angle_z-=0.5; break; case 'h': frame.angle_z+=0.5; break; case 'n': ChangeLayout(); sprintf(label," Layout set to %s (%u)",GetLayoutName(),frame.layout.layout_mode); NewLabel(frame.desired_x,frame.desired_y,(char *) label); break; //if (ENABLE_WIGGLING) {ENABLE_WIGGLING=0;} else {ENABLE_WIGGLING=1;} case 'm': ToggleTransitionMode(); break; case 153: MoveToPicture(D_UP); MoveToPicture(D_UP); MoveToPicture(D_UP); MoveToPicture(D_UP); sprintf(label," Go To %u/%u",frame.active_image_place,frame.total_images); NewLabel(frame.desired_x,frame.desired_y,(char *) label); break; //PAGE UP case 161: MoveToPicture(D_DOWN); MoveToPicture(D_DOWN); MoveToPicture(D_DOWN); MoveToPicture(D_DOWN); sprintf(label," Go To %u/%u",frame.active_image_place,frame.total_images); NewLabel(frame.desired_x,frame.desired_y,(char *) label); break; //PAGE DOWN case 'b': break; default : nokey=1; break; } return nokey; }
static VOID InitLangList(HWND hWnd, HIMAGELIST hImgList) { HKEY hKey, hSubKey; TCHAR szBuf[MAX_PATH], szPreload[CCH_LAYOUT_ID + 1], szSub[CCH_LAYOUT_ID + 1]; LAYOUT_ITEM lItem; DWORD dwIndex = 0, dwType, dwSize; LV_ITEM item = {0}; HWND hList = GetDlgItem(hWnd, IDC_KEYLAYOUT_LIST); INT i, imgIndex; item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { dwSize = sizeof(lItem.ValName); while (RegEnumValue(hKey, dwIndex, lItem.ValName, &dwSize, NULL, &dwType, NULL, NULL) == ERROR_SUCCESS) { dwSize = sizeof(szPreload); RegQueryValueEx(hKey, lItem.ValName, NULL, NULL, (LPBYTE)szPreload, &dwSize); lItem.LangId = (LANGID)_tcstoul(szPreload, NULL, 16); GetLocaleInfo(lItem.LangId, LOCALE_SISO639LANGNAME, (LPTSTR)szBuf, sizeof(szBuf) / sizeof(TCHAR)); lstrcpy(lItem.IndName, _tcsupr(szBuf)); imgIndex = ImageList_AddIcon(hImgList, CreateLayoutIcon(lItem.IndName)); GetLocaleInfo(lItem.LangId, LOCALE_SLANGUAGE, (LPTSTR)szBuf, sizeof(szBuf) / sizeof(TCHAR)); lstrcpy(lItem.LangName, szBuf); // Does this keyboard layout have a substitute? // Then add the substitute instead of the Layout ID if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS) { dwSize = sizeof(szSub); if (RegQueryValueEx(hSubKey, szPreload, NULL, NULL, (LPBYTE)szSub, &dwSize) == ERROR_SUCCESS) { lstrcpy(szPreload, szSub); } RegCloseKey(hSubKey); } GetLayoutName(szPreload, lItem.LayoutName); item.pszText = lItem.LangName; item.iItem = (INT) dwIndex; item.lParam = (LPARAM)_ttoi(lItem.ValName); item.iImage = imgIndex; i = ListView_InsertItem(hList, &item); ListView_SetItemText(hList, i, 1, lItem.LayoutName); dwIndex++; if (lstrcmp(lItem.ValName, _T("1")) == 0) { (VOID) ListView_SetHotItem(hList, i); } } RegCloseKey(hKey); } }