Ejemplo n.º 1
0
/*------------------------------------------------
  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;
}
Ejemplo n.º 2
0
/*------------------------------------------------
  set MOUSESTRUCT data to dialog
--------------------------------------------------*/
void SetMouseCommandToDlg(HWND hDlg, PMOUSESTRUCT pitem)
{
	MOUSESTRUCT item;
	int i, count;
	
	m_prevcommand = -1;
	
	if(!pitem)
	{
		memset(&item, 0, sizeof(item));
		item.nClick = 1;
		pitem = &item;
	}
	
	CBSetCurSel(hDlg, IDC_MOUSEBUTTON, pitem->nButton);
	
	CheckRadioButton(hDlg, IDC_RADSINGLE, IDC_RADQUADRUPLE,
		IDC_RADSINGLE + pitem->nClick - 1);
	
	CheckDlgButton(hDlg, IDC_MOUSECTRL,  pitem->bCtrl);
	CheckDlgButton(hDlg, IDC_MOUSESHIFT, pitem->bShift);
	CheckDlgButton(hDlg, IDC_MOUSEALT,   pitem->bAlt);
	
	CBSetCurSel(hDlg, IDC_MOUSEFUNC, 0);
	count = CBGetCount(hDlg, IDC_MOUSEFUNC);
	for(i = 0; i < count; i++)
	{
		if(CBGetItemData(hDlg, IDC_MOUSEFUNC, i) == pitem->nCommand)
		{
			CBSetCurSel(hDlg, IDC_MOUSEFUNC, i);
			m_prevcommand = pitem->nCommand;
			break;
		}
	}
	if(i == count && pitem->nCommand > 100)
	{
		wsprintf(pitem->option, "%d", pitem->nCommand);
		pitem->nCommand = IDC_COMMAND;
		for(i = 0; i < count; i++)
		{
			if(CBGetItemData(hDlg, IDC_MOUSEFUNC, i) == IDC_COMMAND)
			{
				CBSetCurSel(hDlg, IDC_MOUSEFUNC, i);
				m_prevcommand = IDC_COMMAND;
				break;
			}
		}
	}
	
	SetDlgItemText(hDlg, IDC_MOUSEOPT, pitem->option);
}
Ejemplo n.º 3
0
/*------------------------------------------------
  delete a timer
--------------------------------------------------*/
void OnDelete(HWND hDlg)
{
	int count, index;
	PTIMERSTRUCT pitem;
	
	count = CBGetCount(hDlg, IDC_TIMERNAME);
	if(count < 1) return;
	
	index = CBGetCurSel(hDlg, IDC_TIMERNAME);
	if(index < 0) return;
	
	pitem = get_listitem(m_pTimer, index);
	if(pitem == NULL) return;
	// common/list.c
	m_pTimer = del_listitem(m_pTimer, pitem);
	
	CBDeleteString(hDlg, IDC_TIMERNAME, index);
	
	if(count > 1)
	{
		if(index == count - 1) index--;
		CBSetCurSel(hDlg, IDC_TIMERNAME, index);
	}
	else
	{
		index = -1;
		EnableTimerDlgItems(hDlg);
	}
	
	SetTimerToDlg(hDlg, get_listitem(m_pTimer, index));
	m_nCurrent = index;
	
	PostMessage(hDlg, WM_NEXTDLGCTL, 1, FALSE);
}
Ejemplo n.º 4
0
/*------------------------------------------------
  "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);
}
Ejemplo n.º 5
0
/*------------------------------------------------
  delete an alarm
--------------------------------------------------*/
void OnDelAutoExec(HWND hDlg)
{
	PAUTOEXECSTRUCT pAS;

	if(curAutoExec < 0) return;

	pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
	if(pAS)
	{
		PostMessage(hDlg, WM_NEXTDLGCTL, 1, FALSE);
		CBDeleteString(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
		free(pAS);
		if(curAutoExec > 0) curAutoExec--;
		CBSetCurSel(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
		pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
		if(pAS) SetAutoExecToDlg(hDlg, pAS);
		else
		{
			AUTOEXECSTRUCT as;
			memset(&as, 0, sizeof(as));
			as.hour = 0xffffff;
			as.days = 0x7f;
			SetAutoExecToDlg(hDlg, &as);
			EnableDlgItem(hDlg, IDC_DELAUTOEXEC, FALSE);
			curAutoExec = -1;
		}
	}
}
Ejemplo n.º 6
0
/*------------------------------------------------
  "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);
}
Ejemplo n.º 7
0
/*------------------------------------------------
   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
}
Ejemplo n.º 8
0
/*------------------------------------------------
  combo box is about to be made visible
--------------------------------------------------*/
void OnDropDownAutoExec(HWND hDlg)
{
	PAUTOEXECSTRUCT pAS;
	char name[40];
	int index;

	if(curAutoExec < 0) return;
	pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
	if(pAS == 0) return;
	GetDlgItemText(hDlg, IDC_COMBOAUTOEXEC, name, 40);
	if(strcmp(name, pAS->name) != 0)
	{
		strcpy(pAS->name, name);
		CBDeleteString(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
		index = CBInsertString(hDlg, IDC_COMBOAUTOEXEC, curAutoExec, name);
		CBSetItemData(hDlg, IDC_COMBOAUTOEXEC, index, (LPARAM)pAS);
		CBSetCurSel(hDlg, IDC_COMBOAUTOEXEC, index);
		curAutoExec = index;
	}
}
Ejemplo n.º 9
0
/*------------------------------------------------
  "Delete"
--------------------------------------------------*/
void OnDelete(HWND hDlg)
{
	int count, index;
	PMOUSESTRUCT pitem;
	
	count = CBGetCount(hDlg, IDC_NAMECLICK);
	if(count < 1) return;
	
	index = CBGetCurSel(hDlg, IDC_NAMECLICK);
	if(index < 0) return;
	
	pitem = get_listitem(m_pMouseCommand, index);
	if(pitem == NULL) return;
	// common/list.c
	m_pMouseCommand = del_listitem(m_pMouseCommand, pitem);
	
	CBDeleteString(hDlg, IDC_NAMECLICK, index);
	
	if(count > 0)
	{
		if(index == count - 1) index--;
		CBSetCurSel(hDlg, IDC_NAMECLICK, index);
		
		SetMouseCommandToDlg(hDlg, get_listitem(m_pMouseCommand, index));
		OnFunction(hDlg, TRUE);
	}
	else
	{
		index = -1;
		
		EnableMousePageItems(hDlg);
		SetMouseCommandToDlg(hDlg, NULL);
		OnFunction(hDlg, FALSE);
#if TC_ENABLE_WHEEL
		OnMouseButton(hDlg);
#endif
	}
	m_nCurrent = index;
	
	PostMessage(hDlg, WM_NEXTDLGCTL, 1, FALSE);
}
Ejemplo n.º 10
0
/*------------------------------------------------
   set sizes to "Font Size" combo box
--------------------------------------------------*/
void OnFont(HWND hDlg, BOOL bInit)
{
	char s[160], size[10];
	int charset;
	int index;
	
	if(bInit) // WM_INITDIALOG
		GetMyRegStr(NULL, "FontSize", size, 10, "9");
	else     // WM_COMMAND
		GetDlgItemText(hDlg, IDC_FONTSIZE, size, 10);
	
	CBGetLBText(hDlg, IDC_FONT, CBGetCurSel(hDlg, IDC_FONT), (LPARAM)s);
	charset = CBGetItemData(hDlg, IDC_FONT, CBGetCurSel(hDlg, IDC_FONT));
	
	// common/combobox.c
	InitFontSizeCombo(hDlg, IDC_FONTSIZE, s, charset);
	
	index = CBFindStringExact(hDlg, IDC_FONTSIZE, size);
	if(index == CB_ERR)
		SetDlgItemText(hDlg, IDC_FONTSIZE, size);
	else CBSetCurSel(hDlg, IDC_FONTSIZE, index);
}
Ejemplo n.º 11
0
/*-------------------------------------------
  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);
}
Ejemplo n.º 12
0
/*------------------------------------------------
  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;
}