/*------------------------------------------------ initialize --------------------------------------------------*/ void OnInit(HWND hDlg) { int i, count, index; HFONT hfont; hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if(hfont) { SendDlgItemMessage(hDlg, IDC_COMBOAUTOEXEC, WM_SETFONT, (WPARAM)hfont, 0); SendDlgItemMessage(hDlg, IDC_FILEAUTOEXEC, WM_SETFONT, (WPARAM)hfont, 0); } index = CBAddString(hDlg, IDC_COMBOAUTOEXEC, (LPARAM)MyString(IDS_ADDALARM)); CBSetItemData(hDlg, IDC_COMBOAUTOEXEC, index, 0); count = GetMyRegLong("", "AutoExecNum", 0); if(count < 1) count = 0; for(i = 0; i < count; i++) { PAUTOEXECSTRUCT pAS; pAS = malloc(sizeof(AUTOEXECSTRUCT)); ReadAutoExecFromReg(pAS, i); index = CBAddString(hDlg, IDC_COMBOAUTOEXEC, (LPARAM)pAS->name); CBSetItemData(hDlg, IDC_COMBOAUTOEXEC, index, (LPARAM)pAS); if(i == 0) SetAutoExecToDlg(hDlg, pAS); } //リスト項目の表示数を指定 AdjustDlgConboBoxDropDown(hDlg, IDC_COMBOAUTOEXEC, 7); if(count > 0) { CBSetCurSel(hDlg, IDC_COMBOAUTOEXEC, 1); curAutoExec = 1; } else { AUTOEXECSTRUCT as; CBSetCurSel(hDlg, IDC_COMBOAUTOEXEC, 0); curAutoExec = -1; memset(&as, 0, sizeof(as)); as.hour = 12; as.days = 0x7f; SetAutoExecToDlg(hDlg, &as); } SendDlgItemMessage(hDlg, IDC_TESTAUTOEXEC, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconPlay); OnFileChange(hDlg, IDC_FILEAUTOEXEC); SendDlgItemMessage(hDlg, IDC_DELAUTOEXEC, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconDel); OnAutoExec(hDlg, IDC_AUTOEXEC); bPlaying = FALSE; }
/*------------------------------------------------ "Add" button --------------------------------------------------*/ void OnAdd(HWND hDlg) { PTIMERSTRUCT pitem; int count, index; count = CBGetCount(hDlg, IDC_TIMERNAME); if(count < 0) return; OnNameDropDown(hDlg); GetTimerFromDlg(hDlg, get_listitem(m_pTimer, m_nCurrent)); pitem = malloc(sizeof(TIMERSTRUCT)); memset(pitem, 0, sizeof(TIMERSTRUCT)); wsprintf(pitem->name, "Timer%d", count + 1); pitem->minute = 3; pitem->nDispType = 1; // common/list.c m_pTimer = add_listitem(m_pTimer, pitem); index = CBAddString(hDlg, IDC_TIMERNAME, (LPARAM)pitem->name); CBSetCurSel(hDlg, IDC_TIMERNAME, index); if(count == 0) EnableTimerDlgItems(hDlg); SetTimerToDlg(hDlg, pitem); m_nCurrent = index; PostMessage(hDlg, WM_NEXTDLGCTL, 1, FALSE); }
/*------------------------------------------------ "Add" --------------------------------------------------*/ void OnAdd(HWND hDlg) { PMOUSESTRUCT pitem; int count, index; count = CBGetCount(hDlg, IDC_NAMECLICK); if(count < 0) return; OnNameDropDown(hDlg); GetMouseCommandFromDlg(hDlg, get_listitem(m_pMouseCommand, m_nCurrent)); pitem = malloc(sizeof(MOUSESTRUCT)); memset(pitem, 0, sizeof(MOUSESTRUCT)); wsprintf(pitem->name, "Mouse%d", count+1); pitem->nClick = 1; pitem->nCommand = 0; // common/list.c m_pMouseCommand = add_listitem(m_pMouseCommand, pitem); index = CBAddString(hDlg, IDC_NAMECLICK, (LPARAM)pitem->name); CBSetCurSel(hDlg, IDC_NAMECLICK, index); m_nCurrent = index; if(count == 0) EnableMousePageItems(hDlg); SetMouseCommandToDlg(hDlg, pitem); OnFunction(hDlg, FALSE); #if TC_ENABLE_WHEEL OnMouseButton(hDlg); #endif PostMessage(hDlg, WM_NEXTDLGCTL, 1, FALSE); }
/*------------------------------------------------ apply - save settings --------------------------------------------------*/ void OnApply(HWND hDlg) { int i, count, n_autoexec; PAUTOEXECSTRUCT pAS; n_autoexec = 0; if(curAutoExec < 0) { char name[40]; GetDlgItemText(hDlg, IDC_COMBOAUTOEXEC, name, 40); if(name[0] && IsDlgButtonChecked(hDlg, IDC_AUTOEXEC)) { pAS = malloc(sizeof(AUTOEXECSTRUCT)); if(pAS) { int index; GetAutoExecFromDlg(hDlg, pAS); index = CBAddString(hDlg, IDC_COMBOAUTOEXEC, (LPARAM)pAS->name); CBSetItemData(hDlg, IDC_COMBOAUTOEXEC, index, (LPARAM)pAS); curAutoExec = index; CBSetCurSel(hDlg, IDC_COMBOAUTOEXEC, index); EnableDlgItem(hDlg, IDC_DELAUTOEXEC, TRUE); } } } else { pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, curAutoExec); if(pAS) GetAutoExecFromDlg(hDlg, pAS); } count = CBGetCount(hDlg, IDC_COMBOAUTOEXEC); for(i = 0; i < count; i++) { PAUTOEXECSTRUCT pAS; pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, i); if(pAS) { SaveAutoExecToReg(pAS, n_autoexec); n_autoexec++; } } for(i = n_autoexec; ; i++) { char subkey[20]; wsprintf(subkey, "AutoExec%d", i + 1); if(GetMyRegLong(subkey, "Hour", -1) >= 0) DelMyRegKey(subkey); else break; } SetMyRegLong("", "AutoExecNum", n_autoexec); InitAlarm(); // alarm.c }
void InitFunction(HWND hDlg, int id) { int index; int i; for(i = 0; i < MAX_MOUSEFUNC; i++) { index = CBAddString(hDlg, id, (LPARAM)MyString(m_mousefunc[i].idStr, m_mousefunc[i].entry)); CBSetItemData(hDlg, id, index, m_mousefunc[i].nCommand); } }
/*------------------------------------------------ selected an alarm name by combobox --------------------------------------------------*/ void OnChangeAutoExec(HWND hDlg) { PAUTOEXECSTRUCT pAS; int index; index = CBGetCurSel(hDlg, IDC_COMBOAUTOEXEC); if(curAutoExec >= 0 && index == curAutoExec) return; if(curAutoExec < 0) { char name[40]; GetDlgItemText(hDlg, IDC_COMBOAUTOEXEC, name, 40); if(name[0] && IsDlgButtonChecked(hDlg, IDC_AUTOEXEC)) { pAS = malloc(sizeof(AUTOEXECSTRUCT)); if(pAS) { int index; GetAutoExecFromDlg(hDlg, pAS); index = CBAddString(hDlg, IDC_COMBOAUTOEXEC, (LPARAM)pAS->name); CBSetItemData(hDlg, IDC_COMBOAUTOEXEC, index, (LPARAM)pAS); curAutoExec = index; //リスト項目の表示数を指定 AdjustDlgConboBoxDropDown(hDlg, IDC_COMBOAUTOEXEC, 7); } } } else { pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, curAutoExec); if(pAS) GetAutoExecFromDlg(hDlg, pAS); } pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, index); if(pAS) { SetAutoExecToDlg(hDlg, pAS); EnableDlgItem(hDlg, IDC_DELAUTOEXEC, TRUE); curAutoExec = index; } else { AUTOEXECSTRUCT as; memset(&as, 0, sizeof(as)); as.hour = 0xffffff; as.days = 0x7f; SetAutoExecToDlg(hDlg, &as); EnableDlgItem(hDlg, IDC_DELAUTOEXEC, FALSE); curAutoExec = -1; } }
/*------------------------------------------- initialize main dialog ---------------------------------------------*/ void OnInit(HWND hDlg) { HICON hIcon; char section[20]; int i, count; TIMERSTRUCT item; PTIMERSTRUCT pitem; // common/tclang.c SetDialogLanguage(hDlg, "Timer", g_hfontDialog); hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_TCLOCK)); SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); // ../common/dialog.c SetMyDialgPos(hDlg, 32, 32); SendDlgItemMessage(hDlg, IDC_TIMERTEST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconPlay); UpDown_SetBuddy(hDlg, IDC_TIMERSPIN1, IDC_TIMERMINUTE); UpDown_SetBuddy(hDlg, IDC_TIMERSPIN2, IDC_TIMERSECOND); UpDown_SetRange(hDlg, IDC_TIMERSPIN1, 1440, 0); UpDown_SetRange(hDlg, IDC_TIMERSPIN2, 59, 0); count = GetMyRegLong(NULL, "TimerNum", 0); m_pTimer = NULL; if(count > 0) { for(i = 0; i < count; i++) { memset(&item, 0, sizeof(TIMERSTRUCT)); wsprintf(section, "Timer%d", i + 1); GetMyRegStr(section, "Name", item.name, BUFSIZE_NAME, section); item.minute = GetMyRegLong(section, "Minute", 3); item.second = GetMyRegLong(section, "Second", 0); GetMyRegStr(section, "File", item.fname, MAX_PATH, ""); item.bRepeat = GetMyRegLong(section, "Repeat", FALSE); item.bBlink = GetMyRegLong(section, "Blink", FALSE); item.bDisp = GetMyRegLong(section, "Disp", FALSE); item.nDispType = GetMyRegLong(section, "DispType", 1); item.nUserStr = GetMyRegLong(section, "UserStr", 0); m_pTimer = copy_listitem(m_pTimer, &item, sizeof(TIMERSTRUCT)); // common/list.c } } else { memset(&item, 0, sizeof(TIMERSTRUCT)); strcpy(item.name, "Timer1"); item.minute = 3; item.nDispType = 1; m_pTimer = copy_listitem(m_pTimer, &item, sizeof(TIMERSTRUCT)); } pitem = m_pTimer; while(pitem) { CBAddString(hDlg, IDC_TIMERNAME, (LPARAM)pitem->name); pitem = pitem->next; } m_nCurrent = -1; CBSetCurSel(hDlg, IDC_TIMERNAME, 0); OnName(hDlg); }
/*------------------------------------------------ initialize --------------------------------------------------*/ void OnInit(HWND hDlg) { PMOUSESTRUCT pitem; RECT rc; BOOL b; m_bInit = FALSE; if(GetMyRegLong(m_section, "ver031031", 0) == 0) { SetMyRegLong(m_section, "ver031031", 1); ImportOldMouseFunc(); // common/mousestruct.c } // common/mousestruct.c m_pMouseCommand = LoadMouseFunc(); // common/tclang.c SetDialogLanguage(hDlg, "Mouse", g_hfontDialog); GetWindowRect(GetDlgItem(hDlg, IDC_MOUSEOPT), &rc); m_widthOpt = rc.right - rc.left; CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_LEFTBUTTON, "LButton")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_RIGHTBUTTONM, "RButton")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_MIDDLEBUTTONM, "MButton")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_XBUTTON1, "XButton1")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_XBUTTON2, "XButton2")); #if TC_ENABLE_WHEEL CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_WHEELUP, "WheelUp")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_WHEELDOWN, "WheelDown")); #endif InitFunction(hDlg, IDC_MOUSEFUNC); pitem = m_pMouseCommand; while(pitem) { CBAddString(hDlg, IDC_NAMECLICK, (LPARAM)pitem->name); pitem = pitem->next; } m_nCurrent = -1; CBSetCurSel(hDlg, IDC_NAMECLICK, 0); OnName(hDlg); CheckDlgButton(hDlg, IDC_LMOUSEPASSTHRU, GetMyRegLong(m_section, "LeftMousePassThrough", (g_winver&WIN10RS1) != 0)); b = GetMyRegLong(NULL, "RightClickMenu", TRUE); b = GetMyRegLong(m_section, "RightClickMenu", b); CheckDlgButton(hDlg, IDC_RCLICKMENU, b); m_bInit = TRUE; }