예제 #1
0
MenuWindow::MenuWindow(int x, int y, int w, int h, LineStyle *linestyle)
: Window(x, y, w, h, NULL)
{
	const gchar *context = "menuwindow";

	border = new Panel(*this, 0, 0, w, h, linestyle);
	listbox = new ListBox(*this, 1, 1, w-2, h-2);
	SetFocusChild(listbox);
	Window::AddWidget(border);
	Window::AddWidget(listbox);

	//ClearBindables();

	//DeclareBindable(context, "focus-previous", sigc::mem_fun(listbox, &Container::FocusCyclePrevious),
	//	_("Focusses the previous menu item"), InputProcessor::Bindable_Normal);
	//DeclareBindable(context, "focus-next", sigc::mem_fun(listbox, &Container::FocusCycleNext),
	//	_("Focusses the next menu item"), InputProcessor::Bindable_Normal);
	DeclareBindable(context, "close-window", sigc::mem_fun(this, &Window::Close),
		_("Close the window"), InputProcessor::Bindable_Normal);

	//TODO get real binding from config
	//BindAction(context, "focus-previous", Keys::Instance()->Key_up(), false);
	//BindAction(context, "focus-next", Keys::Instance()->Key_down(), false);
	BindAction(context, "close-window", Keys::Instance()->Key_esc(), false);
}
예제 #2
0
파일: finddialog.cpp 프로젝트: PyroOS/Pyro
void FindDialog::SetTabs()
{
	text->SetTabOrder(NEXT_TAB_ORDER);
	findButton->SetTabOrder(NEXT_TAB_ORDER);
	closeButton->SetTabOrder(NEXT_TAB_ORDER);
	SetFocusChild(text);
	SetDefaultButton(findButton);
}
예제 #3
0
SelectWin::SelectWin( os::Rect cFrame )
    : os::Window( cFrame, "cf_select_win", MSG_PLAYLISTWND_TITLE,
                  os::WND_NOT_V_RESIZABLE )
{
    /* Create file input field */
    m_pcFileLabel = new os::StringView( os::Rect( 0, 0, 1, 1 ), "file_label", MSG_PLAYLISTWND_FILE );
    m_pcFileLabel->SetFrame( os::Rect( 5, 10, m_pcFileLabel->GetPreferredSize( false ).x + 5,
                                       m_pcFileLabel->GetPreferredSize( false ).y + 10 ) );

    m_pcFileInput = new os::TextView( os::Rect( 0, 0, 1, 1 ), "file_input", "", os::CF_FOLLOW_LEFT | os::CF_FOLLOW_TOP |
                                      os::CF_FOLLOW_RIGHT );
    m_pcFileInput->SetFrame( os::Rect( m_pcFileLabel->GetPreferredSize( false ).x + 10, 5, 205,
                                       m_pcFileInput->GetPreferredSize( false ).y + 5 ) );
    m_pcFileInput->SetMultiLine( false );

    m_pcFileButton = new os::Button( os::Rect( 207, 5, 225, m_pcFileInput->GetPreferredSize( false ).y + 5 ),
                                     "file_button", "..", new os::Message( CF_GUI_PLAYLIST_SELECTOR ), os::CF_FOLLOW_RIGHT | os::CF_FOLLOW_TOP );

    /* Create open button */
    m_pcOpenButton = new os::Button( os::Rect( 0, 0, 1, 1 ),
                                     "open_button", MSG_PLAYLISTWND_OPEN, new os::Message( CF_GUI_PLAYLIST_OPEN ), os::CF_FOLLOW_RIGHT | os::CF_FOLLOW_BOTTOM );
    m_pcOpenButton->SetFrame( os::Rect( 185, 30, 225, m_pcOpenButton->GetPreferredSize( false ).y + 30 ) );

    /* Create information */
    m_pcInfo = new os::StringView( os::Rect( 0, 0, 1, 1 ), "info", os::String("\33c") + MSG_PLAYLISTWND_NOTE,
                                   os::ALIGN_CENTER, os::CF_FOLLOW_LEFT | os::CF_FOLLOW_RIGHT | os::CF_FOLLOW_TOP );
    m_pcInfo->SetFrame( os::Rect( 0, m_pcOpenButton->GetPreferredSize( false ).y + 40,
                                  GetBounds().Width(), m_pcOpenButton->GetPreferredSize( false ).y +
                                  m_pcInfo->GetPreferredSize( false ).y + 40 ) );

    /* Create file selector */
    m_pcFileDialog = new os::FileRequester( os::FileRequester::LOAD_REQ, new os::Messenger( this ), "", os::FileRequester::NODE_FILE, false );
    m_pcFileDialog->Lock();
    m_pcFileDialog->Start();
    m_pcFileDialog->Unlock();

    AddChild( m_pcFileLabel );
    AddChild( m_pcFileInput );
    AddChild( m_pcFileButton );
    AddChild( m_pcOpenButton );
    AddChild( m_pcInfo );

    SetFocusChild( m_pcFileInput );

}
예제 #4
0
static int procverifychoose(HWND hWnd)
{
	TUser myuser;
	char myacchar[24];
	
	memset(&myuser,0,sizeof(TUser));
	memset(myacchar,0,24);
	GetWindowText(editacno3,myacchar,PINLIMITLEN);
	if (strlen(myacchar))
		memcpy(myuser.PIN2,myacchar,strlen(myacchar));
	if ((strlen(myacchar)==0)||(NULL==FDB_GetUserByCharPIN2(myacchar,&myuser)))
        {
                myMessageBox1(hWnd,MB_OK | MB_ICONSTOP,"SSR",LoadStrByID(HID_NOTENROLLED));
                SetFocusChild(editacno3);
                return 0;
        }
	SendMessage(temptemp, MSG_TYPE_CMD, News_VerifiedByPIN, myuser.PIN);
	PostMessage (hWnd, MSG_CLOSE, 0, 0L);

	return 1;

}
예제 #5
0
static int SaveNewWiFiSetting(HWND hWnd)
{
	char tmpstring[128];
	//int idx=0;

	memset(tmpstring, 0, sizeof(tmpstring));
	GetWindowText(WifiWnd[0], tmpstring, sizeof(tmpstring));
	if(tmpstring && strlen(tmpstring)>0){
		SaveStr("SSID", tmpstring, 1);
	} else {
		MessageBox1(hWnd, LoadStrByID(MID_WIFI_ERR1), LoadStrByID(HIT_RUN), MB_OK | MB_ICONSTOP);
		curFocusWnd = 0;
		SetFocusChild(WifiWnd[curFocusWnd]);	
		return 0;
	}

	//wifipasswd
	memset(tmpstring, 0, sizeof(tmpstring));
	GetWindowText(WifiWnd[1], tmpstring, sizeof(tmpstring));
	if (tmpstring[0]) {
		SaveStr("wifipasswd", tmpstring, 1);
		printf("wifi passwd:%s\n", tmpstring);
	}

	//ip assign mode: dhcp or fix
	if (wifidhcpflag != gOptions.wifidhcpfunon) {
		gOptions.wifidhcpfunon = wifidhcpflag;
		SaveInteger("wifidhcp", wifidhcpflag);
	}

	SaveStr("wifiip", (char*)newip[0], 1);
	SaveStr("wifimask", (char*)newip[1], 1);
	SaveStr("wifigateway", (char*)newip[2], 1);

	wireless_load_configuration();
	wireless_request_reconnect();
	return 1;
}
예제 #6
0
static void SelectNext(WPARAM wParam)
{
	//int i;
	if(wParam==SCANCODE_CURSORBLOCKUP)
	{
		if(--curCtlidx<0)
			curCtlidx=ControlCnt-1;
	}
	else if(wParam==SCANCODE_CURSORBLOCKDOWN)
	{
		if(++curCtlidx>ControlCnt-1) curCtlidx=0;
	}	
	if(pwdmode==0)
	{
		while((curCtlidx>=2 && curCtlidx<=5) && ((curCtlidx-2)!=curpwdidx))
		{
			if(wParam==SCANCODE_CURSORBLOCKUP)
				curCtlidx--;
			else if(wParam==SCANCODE_CURSORBLOCKDOWN)
				curCtlidx++;
		}
	}	
	SetFocusChild(WifiPWDWnd[curCtlidx]);
}
예제 #7
0
static int ProcessFindLog(HWND hWnd,int findpin,time_t st1, time_t ed1)
{
	PAttLog logs=(PAttLog)tmplogbuf;
	TTime tt;
	TUser uuser;

	int c=gRecordCnt;
	int i=0,j=0;
	char line[20];
	char line1[100];
	char *logdata[5];
	memset(&uuser,0,sizeof(TUser));
	memset(line1,0,sizeof(line1));
	logdata[0]=NULL;
	logdata[1]=NULL;
	logdata[2]=NULL;
	logdata[3]=NULL;
	logdata[4]=NULL;
	if (findpin>0) {
		uuser.PIN=findpin;
		FDB_GetUser(findpin,&uuser);
	}

	if (findpin){
		c=FDB_GetAttLog(findpin,st1,ed1,logs,c);
	} else {
		c=FDB_GetAttLog(0,st1,ed1,logs,c);
	}
	if (c==0) {
		findret=0;
		SendMessage(hWnd,MSG_CLOSE,0,0);
		return 0;
	}
	mylogcount=c;
	i=c-1;
	if (i >= 0){
		CreateLogListView(hWnd);
	}
	SendMessage (hOneLogWnd, MSG_FREEZECTRL, TRUE, 0);
	while(i>=0 && i<c)
	{
		OldDecodeTime(logs[i].time_second, &tt);
		//zsliu add
		if(gOptions.isUseHejiraCalendar){
			ChrisToHejiraTTime(&tt);
		}
		//zsliu add end ... ...

		if(logs[i].PIN>0){
			memset(line,0,20);
			memset(&uuser,0,sizeof(TUser));
			uuser.PIN = logs[i].PIN;
			FDB_GetUserByCharPIN2((char *)logs[i].PIN2,&uuser);
			sprintf(line, "%02d-%02d %02d:%02d", tt.tm_mon+1, tt.tm_mday,tt.tm_hour, tt.tm_min);
#if 0
			//Liaozz 20081014, change attlog diaplay model
			if(gOptions.AntiPassbackFunOn)
			{
				if(logs[i].status==0)
					logs[i].status=2;
			}
#endif
			logdata[0]=(char *)logs[i].PIN2;

			char mynamename[100];		//modify by jazzy 2008.07.26
			memset(mynamename,0,sizeof(mynamename));
			Str2UTF8(tftlocaleid,(unsigned char *)uuser.Name,(unsigned char *) mynamename);
			logdata[1]=mynamename;
			//logdata[1]=uuser.Name;

			logdata[2]=line;
			if(gOptions.UserExtendFormat){
				logdata[3]=FormatExtendVerified(logs[i].verified);
			} else {
				logdata[3]=FormatVerified(logs[i].verified);
			}
			logdata[4]=(char *)&(logs[i].status);//FormatStatus(logs[i].status);	liming
			//printf("logs[i].status:%s logdata:%s\n", logs[i].status,logdata[4]);
			SetListViewLog(hOneLogWnd,j,logdata);
			j++;
		}
		i--;
	}
	SendMessage (hOneLogWnd, MSG_FREEZECTRL, FALSE, 0);
	if(gImageBuffer != NULL) {
		memset(gImageBuffer, 0, c);
	}
	SetFocusChild(hOneLogWnd);
	return 0;
}
예제 #8
0
static int ModemWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;

	switch (message){
		case MSG_CREATE:
			InitModemWin(hWnd);
			ModemCurWnd = 0;
			SetFocusChild(ModemWnd[ModemCurWnd]);
			UpdateWindow(hWnd, TRUE);
			break;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*)lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;
				if(hdc == 0){
					hdc = GetClientDC(hWnd);
					fGetDC = TRUE;
				}

				if(clip){
					rcTemp = *clip;
					ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
					ScreenToClient(hWnd, &rcTemp.right, &rcTemp.bottom);
					IncludeClipRect(hdc, &rcTemp);
				}

				FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, gOptions.LCDHeight, &ModemBkg);
				if(fGetDC){
					ReleaseDC(hdc);
				}

				return 0;
			}

		case MSG_PAINT:
			hdc = BeginPaint(hWnd);
			EndPaint(hWnd, hdc);
			return 0;

		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(gOptions.KeyPadBeep)
				ExKeyBeep();

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN){
				if (ModemCurWnd == 11) {
					ModemCurWnd = 0;
				} else if (ModemCurWnd == 0 && module_type == MODEM_MODULE_EM660) {
					ModemCurWnd += 2;
				} else if (4 < ModemCurWnd && ModemCurWnd < 9) {
					ModemCurWnd = 9;
				} else {
					ModemCurWnd++;
				}
				SetFocusChild(ModemWnd[ModemCurWnd]);
				return 0;
			}

			if (LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT || LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT ||
					(gOptions.TFTKeyLayout == 3 && LOWORD(wParam)  == SCANCODE_BACKSPACE)){
				if (ModemCurWnd == 0){
					if (SendMessage(ModemWnd[ModemCurWnd], CB_GETCURSEL, 0, 0)==0)
						SendMessage(ModemWnd[ModemCurWnd], CB_SETCURSEL, 1, 0);
					else
						SendMessage(ModemWnd[ModemCurWnd], CB_SETCURSEL, 0, 0);
					return 0;
				}

				if (4 < ModemCurWnd && ModemCurWnd < 8 && LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT){
					ModemCurWnd += 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
				}

				if (5 < ModemCurWnd && ModemCurWnd < 9 && LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT){
					ModemCurWnd -= 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
				}

				if ((ModemCurWnd == 9 || ModemCurWnd == 10) && LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT){
					ModemCurWnd += 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}

				if ((ModemCurWnd == 10 || ModemCurWnd == 11) && LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT){
					ModemCurWnd -= 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}
				if (ModemCurWnd == 9 && LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT){
					ModemCurWnd = 11;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}
				if (ModemCurWnd == 11 && LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT){
					ModemCurWnd = 9;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}
			}

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP){
				if (ModemCurWnd == 0) {
					ModemCurWnd = 11;
				} else if (ModemCurWnd == 2 && module_type == MODEM_MODULE_EM660) {
					ModemCurWnd -= 2;
				} else if(ModemCurWnd == 9) {
					ModemCurWnd = 5;
				} else if (4 < ModemCurWnd && ModemCurWnd < 9) {
					ModemCurWnd = 4;
				} else {
					ModemCurWnd--;
				}
				SetFocusChild(ModemWnd[ModemCurWnd]);
				return 0;
			}


			if (LOWORD(wParam)==SCANCODE_F9 || ((gOptions.TFTKeyLayout == 0 || 
							gOptions.TFTKeyLayout == 4) && (LOWORD(wParam) == SCANCODE_F11))) {
				if ((ModemCurWnd > 1 && ModemCurWnd < 5) || (module_type != MODEM_MODULE_EM660 && ModemCurWnd == 1)) {
					T9IMEWindow(hWnd, 0, 200,gOptions.LCDWidth, gOptions.LCDHeight, 0);
				}
				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_F8){
				CreateModemInfoWindow(hWnd);
				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_ENTER){
				if (ModemCurWnd == 9){
					PostMessage(hWnd, MSG_COMMAND, IDOK, 0);
				}

				if (ModemCurWnd == 10){
					PostMessage(hWnd, MSG_COMMAND, IDCANCEL, 0);
				}

				if (ModemCurWnd == 11){
					CreateModemInfoWindow(hWnd);
				}

				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_ESCAPE){
				PostMessage(hWnd, MSG_COMMAND, IDCANCEL, 0);
			}

			if (LOWORD(wParam)==SCANCODE_MENU){
				PostMessage(hWnd, MSG_COMMAND, IDOK, 0);
				return 0;
			}

			break;

		case MSG_COMMAND:
			switch(LOWORD(wParam)){
				case IDOK:
					if(isModemSettingChanged()){
						if(!ismenutimeout){
							SaveModemSetting(hWnd);
							PostMessage(hWnd, MSG_CLOSE, 0, 0);
						}
					}else{
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					}
					break;

				case IDCANCEL:
					if(isModemSettingChanged()){
						if(MessageBox1(hWnd, LoadStrByID(MID_SAVEDATA), LoadStrByID(MID_APPNAME),MB_OKCANCEL | MB_ICONQUESTION | MB_BASEDONPARENT) == IDOK)
						{
							if(!ismenutimeout){
								SaveModemSetting(hWnd);
								PostMessage(hWnd, MSG_CLOSE, 0, 0);
							}
						}
						else
						{
							if(!ismenutimeout)
								PostMessage(hWnd, MSG_CLOSE, 0, 0);
						}
					}else{
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					}
					break;

			}
			break;

		case MSG_CLOSE:
			UnloadBitmap(&ModemBkg);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;
	}

	return DefaultMainWinProc(hWnd, message, wParam, lParam);

}
예제 #9
0
static int Delwinproc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int id, nc;
	int mcard = 0;
	int posX1;
	static char keyupFlag=0;
	int focus = 0;
	int tmpvalue=0;

	switch (message)
	{
		case MSG_CREATE:
			//LoadBitmap(HDC_SCREEN,&delbmp,GetBmpPath("submenubg.jpg"));
			LoadBitmap(HDC_SCREEN,&delhintbmp,GetBmpPath("delhint.gif"));
			InitWindow(hWnd);
			UpdateWindow(hWnd,TRUE);
			//SetFocusChild(btndelall);

			/*dsl 2012.4.17*/
			//if (TEST_ONLY_ENROLL_PRIVILLEGE) {
			//	SendMessage(btndelall, MSG_ENABLE, 0, 0);
			//} else {
			//	focus = 1;
			//	SetFocusChild(btndelall);
			//}
			//change by zxz 2013-04-19
			focus = 1;
			SetFocusChild(btndelall);

			if (deluser.Password[0]){
				nopwd=0;
			} else {
				nopwd=1;
			}
			if (nopwd) {
				SendMessage(btndelpwd,MSG_ENABLE,0,0);
			} else if (focus==0){
				focus = 1;
				SetFocusChild(btndelpwd);
			}

			if(!gOptions.IsOnlyRFMachine) {
				if(FDB_GetTmpCnt(deluser.PIN)>0){
					nofp=0;
				} else {
					nofp=1;
				}
				if (nofp) {
					SendMessage(btndelfp,MSG_ENABLE,0,0);
				} else if (focus==0){
					focus = 1;
					SetFocusChild(btndelfp);
				}

			}
#ifdef FACE
			if(gOptions.FaceFunOn) {
				if(FDB_GetFaceTmp(deluser.PIN,0,NULL)) {
					noface=0;
				} else {
					noface=1;
				}

				if(noface) {
					SendMessage(btndelface,MSG_ENABLE,0,0);
				} else if (focus==0){
					focus = 1;
					SetFocusChild(btndelface);
				}
			}
#endif

			if(gOptions.RFCardFunOn) {
				memcpy(&mcard,deluser.Card,4);
				if(mcard) {
					nohid = 0;
				} else {
					nohid = 1;
				}
				if (nohid) {
					SendMessage(btndelhid,MSG_ENABLE,0,0);
				}else if (focus==0){
					focus = 1;
					SetFocusChild(btndelhid);
				}

			}

			if (gOptions.CameraOpen)
			{
				int ret;
				dellist = FDB_GetPhotoToList(0, 0, deluser.PIN2, 1, &ret, 0);
				if (ret) {
					nophoto = 0;
				} else {
					nophoto = 1;
				}
				if (nophoto) {
					SendMessage(btndelphoto, MSG_ENABLE, 0, 0);
				} else if (focus==0){
					focus = 1;
					SetFocusChild(btndelphoto);
				}
			}
			break;

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);
			EndPaint(hWnd,hdc);
			return 0;
		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout)
			{
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout)
			{
				if(1 ==keyupFlag)
				{
					keyupFlag=0;
				}
				else
					break;
			}
			if (gOptions.KeyPadBeep)
				ExKeyBeep();

			if((LOWORD(wParam)==SCANCODE_CURSORBLOCKUP) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN))
			{
				SelectNext(hWnd,wParam);
				return 0;
			}
			else if (LOWORD(wParam)==SCANCODE_ESCAPE)
			{
				PostMessage (hWnd, MSG_CLOSE, 0, 0L);
				return 0;
			}
			break;

		case MSG_CLOSE:
			//UnloadBitmap(&delbmp);
			UnloadBitmap(&delhintbmp);
			DestroyMainWindow(hWnd);
			//MainWindowCleanup(hWnd);
			return 0;

		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			switch (id) {
				case ID_EXIT:
					SendMessage (hWnd, MSG_CLOSE, 0, 0L);
					break;
				case ID_CKBASE:
					if (!ProcessDeluser(delpin,hWnd,0))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKFP:
					if (!ProcessDeluser(delpin,hWnd,1))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKPWD:
					if (!ProcessDeluser(delpin,hWnd,2))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKHID:
					if (!ProcessDeluser(delpin,hWnd,3))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKPHOTO:
					if (!ProcessDeluser(delpin, hWnd, 4))	UpdateWindow(hWnd,TRUE);
					break;
#ifdef FACE
				case ID_CKFACE:
					if (!ProcessDeluser(delpin,hWnd,5))     
					{
						UpdateWindow(hWnd,TRUE);
					}
					break;
#endif
			}
			break;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*) lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;
				char textstr[100];

				if (hdc == 0) {
					hdc = GetClientDC (hWnd);
					fGetDC = TRUE;
				}

				if (clip) {
					rcTemp = *clip;
					ScreenToClient (hWnd, &rcTemp.left, &rcTemp.top);
					ScreenToClient (hWnd, &rcTemp.right, &rcTemp.bottom);
					IncludeClipRect (hdc, &rcTemp);
				}

				FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, gOptions.LCDHeight, get_submenubg_jgp());
				FillBoxWithBitmap (hdc, 250+gOptions.ControlOffset, 0, 0, 0, &delhintbmp);

				if (deluser.Name[0])		//modify by jazzy 2008.07.26
				{
					unsigned char mynamename[100];

					memset(mynamename,0,100);
					Str2UTF8(tftlocaleid,(unsigned char *)deluser.Name, mynamename);

					sprintf(textstr,"%s:%s   %s:%s",LoadStrByID(MID_ACNO),deluser.PIN2,
							LoadStrByID(MID_NAME),mynamename);
				}
				else
					sprintf(textstr,"%s:%s", LoadStrByID(MID_ACNO), deluser.PIN2);

				tmpvalue=SetBkMode(hdc,BM_TRANSPARENT);
				SetTextColor(hdc,PIXEL_lightwhite);

				if (fromRight==1)
				{
					TextOut(hdc, 50+gOptions.ControlOffset, 10, textstr);
					posX1=10+gOptions.ControlOffset;
				}
				else
				{
					TextOut(hdc, 10+gOptions.ControlOffset, 10, textstr);
					posX1=220+gOptions.ControlOffset;
				}
				if (delret==2)
				{
					TextOut(hdc, posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					if (pwddelhint) TextOut(hdc, posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					//For face
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					//end face
					if (hiddelhint)	TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					if (photodelhint) TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;	hiddelhint=0;	photodelhint=0;	fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==3)
				{
					if (fpdelhint) TextOut(hdc, posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					TextOut(hdc, posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					if (hiddelhint)	TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					if (photodelhint) TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;   hiddelhint=0;   photodelhint=0; fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==4)
				{
					if (fpdelhint) TextOut(hdc, posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					if (pwddelhint)	TextOut(hdc, posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					if (photodelhint) TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;   hiddelhint=0;   photodelhint=0; fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==5)
				{
					if (fpdelhint) TextOut(hdc,posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					if (pwddelhint) TextOut(hdc,posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					if (hiddelhint) TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;   hiddelhint=0;   photodelhint=0; fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==6)
				{
					if (fpdelhint)
					{
						TextOut(hdc,posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					}
					if(pwddelhint)
					{
						TextOut(hdc,posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					}
					TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					if (hiddelhint)
					{
						TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					}
					if (photodelhint)
					{
						TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					}
					pwddelhint=0;
					hiddelhint=0;
					photodelhint=0;
					fpdelhint=0;
					facedelhint=0;
				}
				ReleaseDC (hdc);
				return 0;
			}
	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);
}
예제 #10
0
static int AttPhotoProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	static char keyupFlag=0;
	switch (message)
	{
		case MSG_CREATE:
			InitAttPhotoWindow(hWnd);
			UpdateWindow(hWnd, TRUE);
			SetFocusChild(AttPhotoItemWnd[0]);
			break;

		case MSG_PAINT:
			hdc = BeginPaint(hWnd);
			EndPaint(hWnd, hdc);
			return 0;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*) lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;

				if (hdc == 0) {
					hdc = GetClientDC(hWnd);
					fGetDC = TRUE;
				}

				if (clip) {
					rcTemp = *clip;
					ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
					ScreenToClient(hWnd, &rcTemp.right, &rcTemp.bottom);
					IncludeClipRect(hdc, &rcTemp);
				}

				FillBoxWithBitmap(hdc, 0, 0, gOptions.LCDWidth, 0, get_submenubg_jgp());

				if (fGetDC)
					ReleaseDC(hdc);
				return 0;
			}
		case MSG_KEYUP:
			{
				if(gOptions.TFTKeyLayout==3)
				{
					keyupFlag=1;
				}
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(gOptions.TFTKeyLayout==3)
			{
				if(keyupFlag==1)
				{
					keyupFlag=0;
				}
				else
					break;
			}
			if(gOptions.KeyPadBeep)
				ExKeyBeep();

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)
			{
				if (++AttPhotoItem>9)
				{
					AttPhotoItem = 0;
				}

				SetFocus(AttPhotoItemWnd[AttPhotoItem]);
				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
			{
				if (--AttPhotoItem < 0)
				{
					AttPhotoItem=9; 
				}

				SetFocus(AttPhotoItemWnd[AttPhotoItem]);
				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
			{

			}

			if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (gOptions.TFTKeyLayout==3 && LOWORD(wParam)==SCANCODE_BACKSPACE))
			{
			}

			if ((LOWORD(wParam)==SCANCODE_MENU)||(LOWORD(wParam)==SCANCODE_F10))
			{
				if (isChangedPhotoOpt())
				{
					if(PhotoOptOK(hWnd, AttPhotoItemWnd, 8) && !ismenutimeout)
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					else
						return 0;
				}
				else
					PostMessage(hWnd, MSG_CLOSE, 0, 0);

				return 0;
			}

			if(LOWORD(wParam) == SCANCODE_ENTER)
			{
				if(AttPhotoItem == 9)
				{
					PostMessage(hWnd, MSG_COMMAND, IDCANCEL, 0);
					return 0;
				}
				if(AttPhotoItem != 6)
				{
					PostMessage(hWnd, MSG_COMMAND, IDOK, 0);
					return 0;
				}
			}

			if (LOWORD(wParam)==SCANCODE_ESCAPE)
			{
				PostMessage(hWnd, MSG_COMMAND, IDCANCEL, 0);
				return 0;
			}
			break;
		case MSG_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDOK:
					if(PhotoOptOK(hWnd, AttPhotoItemWnd, 8) && !ismenutimeout)
					{
						MessageBox1 (hWnd, LoadStrByID(HIT_RIGHT),LoadStrByID(HIT_RUN), MB_OK| MB_ICONINFORMATION);
						PostMessage(hWnd, MSG_CLOSE,0,0);
					}
					else
					{
						PostMessage(hWnd, MSG_CLOSE,0,0);
					}
					break;
				case IDCANCEL:
					if(isChangedPhotoOpt())
					{
						if(MessageBox1(hWnd, LoadStrByID(MID_SAVEDATA), LoadStrByID(MID_APPNAME),
									MB_OKCANCEL | MB_ICONQUESTION | MB_BASEDONPARENT) == IDOK)
						{
							if(PhotoOptOK(hWnd, AttPhotoItemWnd, 8))
							{
								MessageBox1 (hWnd, LoadStrByID(HIT_RIGHT),LoadStrByID(HIT_RUN), MB_OK| MB_ICONINFORMATION);
								PostMessage(hWnd, MSG_CLOSE,0,0);
							}
							else
							{
								MessageBox1 (hWnd, LoadStrByID(HIT_ERR),LoadStrByID(HIT_RUN), MB_OK| MB_ICONINFORMATION);
								PostMessage(hWnd, MSG_CLOSE,0,0);
							}
						}
						else
						{
							if(!ismenutimeout)
								PostMessage(hWnd, MSG_CLOSE, 0, 0);
						}
					}
					else
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					break;
				case IDC_ATT_DEL:
					if(DelAttPhoto() == 0)
					{
						MessageBox1 (hWnd, LoadStrByID(HIT_RIGHT),LoadStrByID(HIT_RUN), MB_OK| MB_ICONINFORMATION);
					}
					else
					{
						MessageBox1 (hWnd, LoadStrByID(HIT_ERROR0),LoadStrByID(HIT_RUN), MB_OK| MB_ICONINFORMATION);
					}
					break;
			}
			break;

		case MSG_CLOSE:
			//UnloadBitmap(&system1bk);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;
	}

	return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
예제 #11
0
파일: Dialogs.cpp 프로젝트: PyroOS/Pyro
ReplaceDialog::ReplaceDialog(const Rect& cFrame, Window* pcParent) : Window(cFrame, "replace_dialog", "Replace", WND_NO_ZOOM_BUT | WND_NO_DEPTH_BUT | WND_NOT_RESIZABLE)
{
    pcParentWindow=pcParent;		// We need to know the parent window so we can send messages back to it

    // Create the Layoutviews
    pcMainLayoutView=new LayoutView(GetBounds(),"", NULL,CF_FOLLOW_NONE);

    // Make the base Vertical LayoutNode
    pcHLayoutNode= new HLayoutNode("main_layout_node");

    // Create the InputNode
    pcInputNode= new VLayoutNode("input_layout_node");

    pcInputNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcInputNode, 1.0f));

    pcFindLabel=new StringView(Rect(0,0,0,0),"find_label","Find",ALIGN_LEFT,CF_FOLLOW_NONE,WID_WILL_DRAW);
    pcInputNode->AddChild(pcFindLabel);

    pcFindTextView= new TextView(Rect(0,0,0,0), "find_text_view", NULL, CF_FOLLOW_NONE);
    pcInputNode->AddChild(pcFindTextView);

    pcInputNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcInputNode, 1.0f));

    pcReplaceLabel=new StringView(Rect(0,0,0,0),"replace_label","Replace with",ALIGN_LEFT,CF_FOLLOW_NONE,WID_WILL_DRAW);
    pcInputNode->AddChild(pcReplaceLabel);

    pcReplaceTextView= new TextView(Rect(0,0,0,0), "replace_text_view", NULL, CF_FOLLOW_NONE);
    pcInputNode->AddChild(pcReplaceTextView);

    pcInputNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcInputNode, 1.0f));

    pcCaseCheckBox=new os::CheckBox(Rect(0,0,0,0),"case_checkbox", "Case Sensitive Search", new Message(M_VOID), CF_FOLLOW_NONE, WID_WILL_DRAW);
    pcInputNode->AddChild(pcCaseCheckBox);

    pcInputNode->SameWidth("find_label","find_text_view","replace_label","replace_text_view","case_checkbox",NULL);

    // Add a spacer to force the edit box to the top
    pcInputNode->AddChild(new VLayoutSpacer("spacer", 1));

    // Add a spacer on the far left
    pcHLayoutNode->AddChild(new HLayoutSpacer("spacer", 5.0f, 5.0f, pcHLayoutNode, 1.0f));
    pcHLayoutNode->AddChild(pcInputNode);

    // Add a spacer between the Edit box & the Buttons
    pcHLayoutNode->AddChild(new HLayoutSpacer("spacer", 5.0f, 5.0f, pcHLayoutNode, 1.0f));

    // Create the ButtonNode
    pcButtonNode= new VLayoutNode("button_layout_node");

    pcFindButton=new Button(Rect(0,0,0,0), "find_button", "Find", new Message(M_BUT_FIND_GO), CF_FOLLOW_NONE);
    pcButtonNode->AddChild(pcFindButton);
    pcButtonNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcButtonNode, 1.0f ) );

    pcNextButton=new Button(Rect(0,0,0,0), "find_next_button", "Find Next", new Message(M_BUT_FIND_NEXT), CF_FOLLOW_NONE);
    pcButtonNode->AddChild(pcNextButton);
    pcButtonNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcButtonNode, 1.0f ) );

    pcReplaceButton=new Button(Rect(0,0,0,0), "replace_button", "Replace", new Message(M_BUT_REPLACE_DO), CF_FOLLOW_NONE);
    pcButtonNode->AddChild(pcReplaceButton);
    pcButtonNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcButtonNode, 1.0f ) );

    pcCloseButton=new Button(Rect(0,0,0,0), "close_button", "Close", new Message(M_BUT_REPLACE_CLOSE), CF_FOLLOW_NONE);
    pcButtonNode->AddChild(pcCloseButton);
    pcButtonNode->AddChild(new VLayoutSpacer("spacer", 5.0f, 5.0f, pcButtonNode, 1.0f ) );

    pcButtonNode->SameWidth("find_button","find_next_button","replace_button","close_button", NULL);

    pcHLayoutNode->AddChild(pcButtonNode);

    // Add a spacer on the far right
    pcHLayoutNode->AddChild(new HLayoutSpacer("spacer", 5.0f, 5.0f, pcHLayoutNode, 1.0f));

    // Add the LayoutNodes to the layoutview
    pcMainLayoutView->SetRoot(pcHLayoutNode);

    // Add the View to the Window
    AddChild(pcMainLayoutView);

    // Set the focus
    SetFocusChild(pcFindTextView);
    SetDefaultButton(pcFindButton);
}
예제 #12
0
static int SaveWifiPWDSetting(HWND hWnd)
{
        int i;
        char schar[255];
	int noerr=1;
	int slen;

        if(pwdmode==0)
        {
		curpwdidx=SendMessage(WifiPWDWnd[0], CB_GETCURSEL, 0, 0);			//password index
		tmppwdmode[curpwdidx]=SendMessage(WifiPWDWnd[1], CB_GETCURSEL, 0, 0);		//password type
		GetWindowText(WifiPWDWnd[2+curpwdidx], schar, 255);				//password string
		if(ispwdstrerr(schar, tmppwdmode[curpwdidx]))		//字符类型不正确
		{
			MessageBox1(hWnd, LoadStrByID(MID_WIFI_ERR3), LoadStrByID(HIT_RUN), MB_OK | MB_ICONSTOP);
	                if(!ismenutimeout) SetFocusChild(WifiPWDWnd[2+curpwdidx]);
			return 0;
		}

		slen=strlen(schar);
		if(slen==lenValue[tmppwdmode[curpwdidx]])
		{
			memset(newpwdid, 0, 2);
			sprintf(newpwdid, "%d", curpwdidx+1);
			
			for(i=0;i<4;i++)	//清除原密码(08.01.10)
			{
				memset(&(newpwd[i]), 0, sizeof(WifiPWD));
			}
//			memset(newpwd[curpwdidx].pwdchar, 0, 30);
			memcpy(newpwd[curpwdidx].pwdchar, schar, slen);

			sprintf((char*)newpwd[curpwdidx].pwdtype, "%d", getPasswordMode(tmppwdmode[curpwdidx]));
		}
		else
			noerr=0;
        }
        else
        {
                GetWindowText(WifiPWDWnd[0], schar, 255);
		int slen = strlen(schar);
		if(slen>=8 && slen<=64)
		{
			memset(newwpapsk, 0, 255);
			memcpy(newwpapsk, schar, slen);
		}
		else
			noerr=0;
        }

	if(!noerr)
	{
		MessageBox1(hWnd, LoadStrByID(MID_WIFI_ERR2), LoadStrByID(HIT_RUN), MB_OK | MB_ICONSTOP);
		if(!ismenutimeout)
		{
			if(pwdmode==0)
				SetFocusChild(WifiPWDWnd[2+curpwdidx]);
			else
				SetFocusChild(WifiPWDWnd[0]);
		}
	}
	else
	{
		MessageBox1(hWnd ,LoadStrByID(HIT_RIGHT) ,LoadStrByID(HIT_RUN),MB_OK| MB_ICONINFORMATION);
	}

	return (noerr);
}
예제 #13
0
static int duressparawinproc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    int id,nc;
    char sstr[10];
    int tmpvalue;
    static char keyupFlag=0;
    switch (message)
    {
    case MSG_CREATE:
        //if (LoadBitmap(HDC_SCREEN,&gpmngbk1,GetBmpPath("submenubg.jpg")))
        //        return 0;

        InitWindow(hWnd);		//add controls
        InitWindowText(hWnd);
        UpdateWindow(hWnd,TRUE);
        actindex=0;
        SetFocusChild(EdDAM[actindex]);
        break;

    case MSG_ERASEBKGND:
    {
        HDC hdc = (HDC)wParam;
        const RECT* clip = (const RECT*)lParam;
        BOOL fGetDC = FALSE;
        RECT rcTemp;
        if(hdc == 0)
        {
            hdc = GetClientDC(hWnd);
            fGetDC = TRUE;
        }

        if(clip)
        {
            rcTemp = *clip;
            ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
            ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
            IncludeClipRect(hdc, &rcTemp);
        }

        FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, gOptions.LCDHeight, get_submenubg_jgp());
        if(fGetDC) ReleaseDC (hdc);
        return 0;
    }

    case MSG_PAINT:
        hdc=BeginPaint(hWnd);
        EndPaint(hWnd,hdc);
        return 0;

    case MSG_KEYUP:
        if(3 == gOptions.TFTKeyLayout)
        {
            keyupFlag=1;
        }
        break;
    case MSG_KEYDOWN:
        SetMenuTimeOut(time(NULL));
        if(3 == gOptions.TFTKeyLayout)
        {
            if(1==keyupFlag)
                keyupFlag=0;
            else
                break;
        }
        if (gOptions.KeyPadBeep)
            ExKeyBeep();

        if ((LOWORD(wParam)==SCANCODE_ESCAPE))
        {
            PostMessage(hWnd, MSG_COMMAND, ID_EXIT, 0L);
        }

        if(LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)
        {
            if(actindex==4)
            {
                memset(sstr,0,10);
                GetWindowText(EdDAM[actindex],sstr,3);
                if(strlen(sstr)==0)
                    return 0;
            }
            if(++actindex > 6) actindex = 0;
            //Liaozz 20081008 fix bug third 6
            if (gOptions.IsOnlyRFMachine) {
                if (actindex == 1 || actindex == 2)
                    actindex = 3;
            }
            //Liaozz end
            SetFocusChild(EdDAM[actindex]);
            return 0;
        }

        if( LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
        {
            if(actindex==4)
            {
                memset(sstr,0,10);
                GetWindowText(EdDAM[actindex],sstr,3);
                if(strlen(sstr)==0)
                    return 0;
            }
            if(--actindex < 0) actindex = 6;
            //Liaozz 20081008 fix bug third 6
            if (gOptions.IsOnlyRFMachine) {
                if (actindex == 1 || actindex == 2)
                    actindex = 0;
            }
            //Liaozz end
            SetFocusChild(EdDAM[actindex]);
            return 0;
        }

        if(LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT || (gOptions.TFTKeyLayout == 3 && LOWORD(wParam) == SCANCODE_BACKSPACE))
        {
            if(actindex<4)
            {
                tmpvalue=SendMessage(EdDAM[actindex], CB_GETCURSEL, 0, 0);
                if(--tmpvalue < 0) tmpvalue = 1;
                SendMessage(EdDAM[actindex], CB_SETCURSEL, tmpvalue, 0);
                return 0;
            }
            else if(actindex>4)
            {
                if(--actindex < 0) actindex = 6;
                SetFocusChild(EdDAM[actindex]);
                return 0;
            }
        }

        if(LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
        {
            if(actindex<4)
            {
                tmpvalue=SendMessage(EdDAM[actindex], CB_GETCURSEL, 0, 0);
                if(++tmpvalue > 1) tmpvalue = 0;
                SendMessage(EdDAM[actindex], CB_SETCURSEL, tmpvalue, 0);
                return 0;
            }
            else if(actindex>4)
            {
                if(++actindex > 6) actindex = 0;
                SetFocusChild(EdDAM[actindex]);
                return 0;
            }
        }

        if(LOWORD(wParam)==SCANCODE_ENTER)
        {
            if(actindex<5)
                PostMessage(hWnd,MSG_COMMAND,(WPARAM)ID_SAVE,0);
        }

        if(LOWORD(wParam)==SCANCODE_F10)
        {
            if(actindex!=6)
                PostMessage(hWnd, MSG_COMMAND, (WPARAM)ID_SAVE, 0L);
            else
                PostMessage(hWnd, MSG_COMMAND, (WPARAM)ID_EXIT, 0L);
        }

        if(LOWORD(wParam)==SCANCODE_MENU)
            PostMessage (hWnd, MSG_COMMAND, (WPARAM)ID_SAVE, 0L);

        break;

    case MSG_COMMAND:
        id = LOWORD(wParam);
        nc = HIWORD(wParam);
        if(nc==EN_CHANGE)
        {
            if(id == DAM_ID+4)
            {
                memset(sstr,0,5);
                GetWindowText(EdDAM[actindex],sstr,3);
                tmpvalue = atoi(sstr);
                if(tmpvalue>255)
                {
                    SetWindowText(EdDAM[actindex],"0");
                    SendMessage(EdDAM[actindex],EM_SETCARETPOS,0,1);
                }
            }
        }

        switch(id)
        {
        case ID_SAVE:
            SaveDuressParameter(hWnd);
            LoadOptions(&gOptions);
            MessageBox1(hWnd ,LoadStrByID(HIT_RIGHT) ,LoadStrByID(HIT_RUN),MB_OK| MB_ICONINFORMATION);
            if(!ismenutimeout) PostMessage(hWnd,MSG_CLOSE,0,0);
            break;

        case ID_EXIT:
            if(ismodified() && MessageBox1(hWnd,LoadStrByID(MID_SAVEDATA), LoadStrByID(MID_APPNAME),
                                           MB_OKCANCEL | MB_ICONQUESTION | MB_BASEDONPARENT) == IDOK)
                SendMessage(hWnd, MSG_COMMAND, ID_SAVE, 0);
            if(!ismenutimeout) PostMessage(hWnd,MSG_CLOSE,0,0L);
            break;
        }

        break;

    case MSG_CLOSE:
        //UnloadBitmap(&gpmngbk1);
        //MainWindowCleanup(hWnd);
        DestroyMainWindow(hWnd);
        return 0;
    }

    return DefaultMainWinProc(hWnd,message,wParam,lParam);

}
예제 #14
0
static int Verifywinproc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int id,nc, tmpvalue = 0;
	static char keyupFlag=0;
	switch (message)	
	{
		case MSG_CREATE:

			InitWindow(hWnd);
			SetFocusChild(editacno3);			
			SetWindowText(editacno3,propin);
			SendMessage(editacno3,EM_SETCARETPOS,0,1);
			return 0;
		case MSG_PAINT:
			hdc=BeginPaint(hWnd);
		    tmpvalue= SetBkMode(hdc,BM_TRANSPARENT);
		    SetTextColor(hdc,PIXEL_lightwhite);		
			TextOut(hdc,60,70,LoadStrByID(HID_PLACEFINGER));			     
			EndPaint(hWnd,hdc);
			return 0;
		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout)
			{
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout)
			{
				if(1==keyupFlag)
					keyupFlag=0;
				else
					break;
			}
			if ((GetFocusChild(hWnd)==editacno3)&&((LOWORD(wParam)==SCANCODE_ENTER)
				||(LOWORD(wParam)==SCANCODE_F10)))
				procverifychoose(hWnd);		
			if ((LOWORD(wParam)==SCANCODE_ESCAPE))		
				PostMessage (hWnd, MSG_CLOSE, 0, 0L);
			break;		
	    case MSG_DESTROY:
        	DestroyAllControls (hWnd);
	        hMainWnd1 = HWND_INVALID;
        	return 0;
		case MSG_CLOSE:
			DestroyMainWindow(hWnd);
			MainWindowThreadCleanup (hWnd);
			return 0;
		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			if (id==ID_ACNO)
			{
				if (nc==EN_CHANGE)
				{
					memset(propin,0,24);
                    GetWindowText (editacno3, propin, 24);
					printf("keybuffer:%s\n",propin);
				}
			}
			break;

	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);
}
예제 #15
0
static int ControlOneLogWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{

	HDC hdc;
	HWND statushWnd;
	static char keyupFlag=0;
	switch (message)
	{
		case MSG_CREATE:
			{
				LoadBitmap(HDC_SCREEN,&onequerybmp,GetBmpPath("warningsmall.gif"));

				if (gfont1==NULL) {
					logqyfont = CreateLogFont (NULL,"fixed","GB2312",FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, 
							FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE,12, 0);
					logqyfont1 = CreateLogFont (NULL,"fixed","GB2312",FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, 
							FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE,12, 0);
				} else {
					logqyfont1=gfont1;
					logqyfont=gfont1;
				}
				if (gOptions.ShowState){
					g_celcount=5;
				} else {
					g_celcount=4;
				}
				statushWnd = createStatusWin1(hWnd , 250 , 50 , LoadStrByID(MID_APPNAME) , LoadStrByID(MID_WAIT));
				ProcessFindLog(hWnd,oneuserpin,onesttm,oneedtm);
				destroyStatusWin1(statushWnd);
				SetFocusChild(hOneLogWnd);
				SendMessage(hOneLogWnd,LVM_CHOOSEITEM,0,0);
				processlogstateandvf(hWnd);
				return 0;
			}
			/*
			   case MSG_ERASEBKGND:
			   {
			   HDC hdc = (HDC)wParam;
			   const RECT* clip = (const RECT*) lParam;
			   BOOL fGetDC = FALSE;
			   RECT rcTemp;

			   if (hdc == 0) {
			   hdc = GetClientDC (hWnd);
			   fGetDC = TRUE;
			   }

			   if (clip) {
			   rcTemp = *clip;
			   ScreenToClient (hWnd, &rcTemp.left, &rcTemp.top);
			   ScreenToClient (hWnd, &rcTemp.right, &rcTemp.bottom);
			   IncludeClipRect (hdc, &rcTemp);
			   }

			   FillBoxWithBitmap (hdc, 0, 210, 32, 32, &onequerybmp);
			   if (fGetDC)
			   ReleaseDC (hdc);
			   return 0;
			   }
			   */
		case MSG_PAINT:
			SetMenuTimeOut(time(NULL));
			hdc=BeginPaint(hWnd);
			//FillBoxWithBitmap (hdc, 10, 217, 24, 24, &onequerybmp);
			FillBoxWithBitmap (hdc, 10+gOptions.GridWidth, 215, 24, 24, &onequerybmp);
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_COMMAND:
			if (wParam == IDCANCEL){
				SendMessage (hWnd, MSG_CLOSE, 0, 0L);
				break;
			}

			if ((LOWORD(wParam)==IDC_LISTVIEW) &&(HIWORD(wParam)==LVN_SELCHANGE)){
				processlogstateandvf(hWnd);
			}
			break;

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout) {
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout) {
				if(1==keyupFlag) {
					keyupFlag=0;
				} else {
					break;
				}
			}

			if (gOptions.KeyPadBeep) {
				ExKeyBeep();
			}

			if ( LOWORD(wParam)==SCANCODE_ESCAPE ) {
				SendMessage (hWnd, MSG_CLOSE, 0, 0L);
			}

			if(LOWORD(wParam)==SCANCODE_F12) {
				SendMessage(hOneLogWnd,MSG_KEYDOWN,SCANCODE_PAGEDOWN,0);
				processscrollview(hOneLogWnd,1,10);
			}

			if(LOWORD(wParam)==SCANCODE_F11) {
				SendMessage(hOneLogWnd,MSG_KEYDOWN,SCANCODE_PAGEUP,0);
				processscrollview(hOneLogWnd,0,10);
			}
			break;
		case MSG_CLOSE:
			UnloadBitmap(&onequerybmp);
			if (gfont==NULL) {
				DestroyLogFont(logqyfont);
				DestroyLogFont(logqyfont1);
			}
			DestroyMainWindow(hWnd);
			return TRUE;

	}
	return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
예제 #16
0
static int WiFiPWDWinProc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int nc, id;
	static char keyupFlag=0;
	switch (message)
	{
		case MSG_CREATE:
			InitWindow(hWnd);		//add controls
			InitPWDSetting();
			UpdateWindow(hWnd,TRUE);
			curCtlidx=0;
			SetFocusChild(WifiPWDWnd[curCtlidx]);
			break;

		case MSG_ERASEBKGND:
		{
	            	HDC hdc = (HDC)wParam;
			const RECT* clip = (const RECT*)lParam;
			BOOL fGetDC = FALSE;
			RECT rcTemp;
			if(hdc == 0)
			{
				hdc = GetClientDC(hWnd);
				fGetDC = TRUE;
			}

			if(clip)
			{
				rcTemp = *clip;
				ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
				ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
				IncludeClipRect(hdc, &rcTemp);
			}

			FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, 0, get_submenubg_jgp());
			if(fGetDC) ReleaseDC (hdc);
			return 0;
		}

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);	
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout)
			{
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout)
			{
				if(1==keyupFlag)
					keyupFlag=0;
				else
					break;
			}
			if (gOptions.KeyPadBeep)
				ExKeyBeep();

			if ((LOWORD(wParam)==SCANCODE_ESCAPE))
			{
				PostMessage(hWnd, MSG_COMMAND, WIFI_PWDEXIT, 0);
			}
			else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP))
			{
                                if(hIMEWnd!=HWND_INVALID)
                                {
                                        SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
                                        hIMEWnd=HWND_INVALID;
                                }

				SelectNext(wParam);
				return 0;
			}
			else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
				|| ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE))
			{
				if(pwdmode==0)
				{
					if(curCtlidx==0 || curCtlidx==1)
					{
						int curidx = SendMessage(WifiPWDWnd[curCtlidx], CB_GETCURSEL, 0, 0);
						if(LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT  || ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE))
						{
							if(--curidx<0) curidx=3;
						}
						else if(LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
						{
							if(++curidx>3) curidx=0;
						}
						SendMessage(WifiPWDWnd[curCtlidx], CB_SETCURSEL, curidx, 0);
						
						if(curCtlidx==0)
						{
							curpwdidx=curidx;
							RefreshPWDWindow(curpwdidx);
						}
						else
						{
							tmppwdmode[curpwdidx]=curidx;
//							SetWindowText(WifiPWDWnd[2+curpwdidx],"");
							SendMessage(WifiPWDWnd[2+curpwdidx], EM_LIMITTEXT, lenValue[curidx], 0L);
						}
						return 0;
					}
					 else if((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) &&(curCtlidx>=2 && curCtlidx<=5)&&
					    gOptions.IMEFunOn==1&&gOptions.TFTKeyLayout==3)
					{
                        T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);	//不支持中文输入
						return 0;
					}
					else if(curCtlidx>=6 && curCtlidx<=7)
					{
						if(curCtlidx==6) curCtlidx=7;
						else curCtlidx=6;
						SetFocusChild(WifiPWDWnd[curCtlidx]);
						return 0;
					}
				}
				else
				{
					if(curCtlidx>=1 && curCtlidx<=2)
					{
						if(curCtlidx==1) curCtlidx=2;
						else curCtlidx=1;
						SetFocusChild(WifiPWDWnd[curCtlidx]);
						return 0;
					}
					else if((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) && curCtlidx==0 &&
					    gOptions.IMEFunOn==1 && gOptions.TFTKeyLayout==3)
					{
                        T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);	//不支持中文输入
					}
				}
			}
			else if(LOWORD(wParam)==SCANCODE_ENTER) 
			{
				if((pwdmode==0 && curCtlidx<6) || (pwdmode==1 && curCtlidx<1))
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0L);
			}
			else if(LOWORD(wParam)==SCANCODE_F10)
			{
				if((pwdmode==0 && curCtlidx==7)||(pwdmode==1 && curCtlidx==2))
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDEXIT, 0L);
				else
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0L);
			}
			else if(LOWORD(wParam)==SCANCODE_MENU)
			{
				PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0);
			}
//			else if (LOWORD(wParam) == gOptions.IMESwitchKey)
			else if((LOWORD(wParam)==SCANCODE_F9) || 
				(LOWORD(wParam)==SCANCODE_F11 && (gOptions.TFTKeyLayout==0 || gOptions.TFTKeyLayout==4)))
                        {
                                if(((pwdmode==0 && curCtlidx>=2 && curCtlidx<=5) || (pwdmode==1 && curCtlidx==0)) && gOptions.IMEFunOn==1)
                                        T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);	//不支持中文输入
                                break;
                        }
			break;
//Liaozz 20080928 fix bug second 43
		case MSG_CHAR:
		{
			char schar[255];
			int slen;
//			printf("*************char=======l:%d,,,w:%d===\n",lParam, wParam);
			HWND Edtmp = GetFocusChild(hWnd);
			if(pwdmode==0)
			{
				curpwdidx=SendMessage(WifiPWDWnd[0], CB_GETCURSEL, 0, 0);			//password index
				tmppwdmode[curpwdidx]=SendMessage(WifiPWDWnd[1], CB_GETCURSEL, 0, 0);		//password type
				GetWindowText(WifiPWDWnd[2+curpwdidx], schar, 255);				//password string
				slen=strlen(schar);
				//13:Enter; 27:ESC; 127:Backspace
				if(slen==lenValue[tmppwdmode[curpwdidx]] && Edtmp == WifiPWDWnd[2+curpwdidx]
				         && wParam != 127 && wParam != 27 && wParam != 13) {
						ExBeep(1);
					}
			} else {//Liaozz 20081009 fix bug second 43
				 GetWindowText(WifiPWDWnd[0], schar, 255);
					int slen = strlen(schar);
					if (slen == 64 && Edtmp == WifiPWDWnd[0]
					               && wParam != 127 && wParam != 27 && wParam != 13)
						ExBeep(1);
			}
			break;
		}
		//Liaozz end
		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			if(id==WIFI_PWDSAVE)
			{
				if(beModified())
				{
					if(SaveWifiPWDSetting(hWnd) && !ismenutimeout)
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
				else
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
					
			}
			else if(id==WIFI_PWDEXIT)
			{
				if(beModified() && MessageBox1(hWnd,LoadStrByID(MID_SAVEDATA),LoadStrByID(MID_APPNAME),
									MB_OKCANCEL|MB_ICONQUESTION|MB_BASEDONPARENT)==IDOK)
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0);
				else
				{
					if(!ismenutimeout) PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			}
			break;

		case MSG_CLOSE:
			//UnloadBitmap(&wifipwdbkg);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;

	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);

}
예제 #17
0
static int  ProcessDeluser(U16 pin, HWND hWnd, int delupass)
{
	int fpcheck=0, pwdcheck=0, basecheck=0;
	int hidcheck=0;		//liming
	int photocheck=0;

	char delhintbuff[100];
	int delcount=0;
	TUser duser;

	delret=0;
	memset(delhintbuff,0,100);

	//delall
	if (delupass==0)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(MID_USEBASE));
		basecheck=1;
	}

	//delfp
	if (delupass==1)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(HID_DEL_FP));
		fpcheck=1;
	}

	//delpwd
	if (delupass==2)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(HID_DEL_PWD));
		pwdcheck=1;
	}

	//delhid
	if (delupass==3)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(MID_DEL_CARD));
		hidcheck=1;
	}

	//delphoto
	if (delupass==4)
	{
		sprintf(delhintbuff,"%s?", LoadStrByID(MID_QUERY_SET1));
		photocheck=1;
	}

	//For face
#ifdef FACE
	int facecheck=0;
	if (delupass==5)
	{
		sprintf(delhintbuff,"%s%s?", LoadStrByID(MID_REMOVEHINT), LoadStrByID(MID_DEL_FACE));
		facecheck=1;
	}
#endif
	//end face

	if (MessageBox1 (hWnd,delhintbuff, LoadStrByID(MID_APPNAME), MB_OKCANCEL | MB_ICONQUESTION | MB_BASEDONPARENT) != IDOK)
	{
		delret=0;
		return 0;
	}

	//提示清除管理员权限
	memset(&duser, 0, sizeof(TUser));
	FDB_GetUser(pin, &duser);
	if(delupass>0 && ((nopwd && nofp)||(nopwd && nohid)||(nofp && nohid)) && duser.Privilege==(BYTE)PRIVILLEGE3)
	{
		if(MessageBox1(hWnd,LoadStrByID(MID_ADUSER_HINT),LoadStrByID(MID_APPNAME),MB_OKCANCEL|MB_ICONINFORMATION|MB_BASEDONPARENT)==IDOK)
		{
			int j=0;
			duser.Privilege=0;
			j=FDB_ChgUser(&duser);
			FDB_AddOPLog(ADMINPIN, OP_CLEAR_ADMIN,duser.PIN,j,0,0);
		}
		else
			return 0;
	}
	//
	//delete photo
	if (photocheck)
	{
		HWND statushWnd;

		statushWnd=createStatusWin1(hWnd, 250, 50, LoadStrByID(MID_APPNAME), LoadStrByID(MID_PHOTO_HINT1));
		busyflag = 1;
		ProcDeleteUserPhoto();
		FDB_AddOPLog(ADMINPIN, OP_DEL_ATTPHOTO,ADMINPIN,0,0,0);
		destroyStatusWin1(statushWnd);
		nophoto=1;
		delret=5;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelphoto, MSG_ENABLE, 0, 0);
		photodelhint=1;
		SetMenuTimeOut(time(NULL));
		SetFocusChild(btnexit2);
	}

	//delete hid
	if (hidcheck)
	{
		TUser uh;
		memset(&uh,0,sizeof(TUser));
		if(FDB_GetUser(pin,&uh)!=NULL)
		{
			int j;
			memset(uh.Card,0,4);
			j=FDB_ChgUser(&uh);
			FDB_AddOPLog(ADMINPIN, OP_DEL_RFCARD,uh.PIN,j,0,0);
			delret=4;		//
			hiddelhint=1;
			InvalidateRect(hWnd,NULL,TRUE);
			SendMessage(btndelhid,MSG_ENABLE,0,0);
			nohid=1;
			SetFocusChild(btnexit2);
		}
	}

	//delete fp
	if (fpcheck)
	{	//dellfp
		int j=FDB_DeleteTmps(pin);
		FDB_AddOPLog(ADMINPIN, OP_DEL_FP,pin,j,0,0);
		delcount++;
		SendMessage(btndelfp,MSG_ENABLE,0,0);
		delret=2;
		fpdelhint=1;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelfp,MSG_ENABLE,0,0);
		nofp=1;
		SetFocusChild(btnexit2);
	}

	if (pwdcheck)
	{
		TUser u1;
		int j;

		memset(&u1,0,sizeof(u1));
		FDB_GetUser(pin,&u1);
		nmemset((BYTE*)u1.Password, 0, sizeof(u1.Password));
		j=FDB_ChgUser(&u1);
		FDB_AddOPLog(ADMINPIN, OP_DEL_PWD,u1.PIN,j,0,0);
		delret=3;
		pwddelhint=1;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelpwd,MSG_ENABLE,0,0);
		nopwd=1;
		SetFocusChild(btnexit2);

	}

	if (basecheck)
	{
		int j = FDB_DelUser(pin);
		FDB_AddOPLog(ADMINPIN, OP_DEL_USER,pin,j,0,0);
		if(FDB_OK==j)
		{
			if(gOptions.IsSupportSMS)
			{
				TUData tudt;
				U16 smsID;
				TSms tsms;

				if(FDB_GetUData(pin,&tudt)!=NULL)
				{
					smsID=tudt.SmsID;
					FDB_DelUData(pin,0);
					memset(&tudt,0,sizeof(TUData));
					if(FDB_GetUDataBySmsID(smsID,(PUData)&tudt)==0)
					{
						memset(&tsms,0,sizeof(TSms));
						if(FDB_GetSms(smsID,&tsms)!=NULL)
						{
							tsms.Tag=UDATA_TAG_TEMP;
							FDB_ChgSms(&tsms);
						}
					}
				}
			}

			if(gOptions.UserExtendFormat)
				FDB_DelExtUser(pin);

			if (gOptions.CameraOpen && !nophoto)
			{
				busyflag = 1;
				ProcDeleteUserPhoto();
				SetMenuTimeOut(time(NULL));
			}
			delcount++;
		}
		delret=1;
	}

#ifdef FACE
	if (facecheck)
	{
		FDB_DeleteFaceTmps(pin);
		delcount++;
		delret=6;
		facedelhint=1;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelface,MSG_ENABLE,0,0);
		noface=1;
		SetFocusChild(btnexit2);
	}
#endif
	if (delcount>0)
	{
		sync();
		FPDBInit();
	}

	if (basecheck)
	{
		SendMessage(hWnd,MSG_CLOSE,0,0);
	}
	return 1;
}
예제 #18
0
static int  SelectNext(WPARAM wParam)
{
	if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)
	{
		if (Edtmp == EdGpID)
		{
			if(gOptions.UserExtendFormat)
				focuswnd = CbGpVerify;
			else
				focuswnd = CbHDValid;
		}
		else if (Edtmp == CbGpVerify)
			focuswnd = CbHDValid;
		else if (Edtmp == CbHDValid)
			focuswnd = EdGpTZ[0];
		else if (Edtmp == EdGpTZ[0])
			focuswnd = EdGpTZ[1];
		else if (Edtmp == EdGpTZ[1])
			focuswnd = EdGpTZ[2];
		else if (Edtmp == EdGpTZ[2])
			focuswnd = BtSave;
		else if (Edtmp == BtSave)
			focuswnd = BtExit;
		else if (Edtmp == BtExit)
		{
			if(gpOptFlag)
			{
				if(gOptions.UserExtendFormat)
					focuswnd = CbGpVerify;
				else
					focuswnd = CbHDValid;
			}
			else
				focuswnd = EdGpID;
		}
	}

	if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
	{
		if (Edtmp == EdGpID)
			focuswnd = BtExit;
		else if (Edtmp == BtExit)
			focuswnd = BtSave;
		else if (Edtmp == BtSave)
			focuswnd = EdGpTZ[2];
		else if (Edtmp == EdGpTZ[2])
			focuswnd = EdGpTZ[1];
		else if (Edtmp == EdGpTZ[1])
			focuswnd = EdGpTZ[0];
		else if (Edtmp == EdGpTZ[0])
			focuswnd = CbHDValid;
		else if (Edtmp == CbHDValid)
		{
			if(gOptions.UserExtendFormat)
				focuswnd = CbGpVerify;
			else
				focuswnd = (gpOptFlag)?BtExit:EdGpID;
		}
		else if (Edtmp == CbGpVerify)
			focuswnd = (gpOptFlag)?BtExit:EdGpID;
	}

	SetFocusChild(focuswnd);
	return 1;
}
예제 #19
0
static void SelectNext(HWND hWnd,WPARAM wParam)
{
	Edtmp  = GetFocusChild(hWnd);
	if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)
	{
		if (Edtmp ==btndelall)
		{
			if(nofp)
			{
				if(nopwd)
				{
					if(noface)
					{
						if (nohid)
						{
							if (nophoto)
								focuswnd = btnexit2;
							else
								focuswnd = btndelphoto;
						}
						else
							focuswnd = btndelhid;
					}
					else
					{
						focuswnd = btndelface;
					}
				}
				else
					focuswnd = btndelpwd;
			}
			else
				focuswnd = btndelfp;
		}
		else if (Edtmp == btndelfp)
		{
			if (nopwd)
			{
				if(noface)
				{
					if(nohid)
					{
						if (nophoto)
							focuswnd = btnexit2;
						else
							focuswnd = btndelphoto;
					}
					else
						focuswnd = btndelhid;
				}
				else
				{
					focuswnd = btndelface;
				}
			}
			else
				focuswnd = btndelpwd;
		}
		else if (Edtmp == btndelpwd)
		{
			if(noface)
			{
				if(nohid)
				{
					if (nophoto)
						focuswnd = btnexit2;
					else
						focuswnd = btndelphoto;
				}
				else
					focuswnd = btndelhid;
			}
			else
			{
				focuswnd = btndelface;
			}
		}
		else if (Edtmp == btndelface)
		{
			if(nohid)
			{
				if(nophoto)
				{
					focuswnd = btnexit2;
				}
				else
				{
					focuswnd = btndelphoto;
				}
			}
			else
			{
				focuswnd = btndelhid;
			}
		}
		else if (Edtmp == btndelhid)
		{
			if (nophoto)
				focuswnd = btnexit2;
			else
				focuswnd = btndelphoto;
		}
		else if (Edtmp == btndelphoto)
			focuswnd = btnexit2;
		else if (Edtmp == btnexit2)
			focuswnd = btndelall;
		SetFocusChild(focuswnd);
	}
	if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
	{
		if (Edtmp == btndelall)
			focuswnd = btnexit2;
		else if (Edtmp == btndelfp)
			focuswnd = btndelall;
		else if (Edtmp == btndelpwd)
		{
			if (nofp)
				focuswnd = btndelall;
			else
				focuswnd=btndelfp;
		}
		else if(Edtmp == btndelface)
		{
			if(nopwd)
			{
				if (nofp)
				{
					focuswnd = btndelall;
				}
				else
				{
					focuswnd = btndelfp;
				}
			}
			else
			{
				focuswnd = btndelpwd;
			}
		}
		else if (Edtmp == btnexit2)
		{
			if (nophoto)
			{
				if (nohid)
				{
					if(noface)
					{
						if (nopwd)
						{
							if (nofp)
								focuswnd = btndelall;
							else
								focuswnd=btndelfp;
						}
						else
							focuswnd = btndelpwd;
					}
					else
					{
						focuswnd = btndelface;
					}
				}
				else
					focuswnd = btndelhid;
			}
			else
				focuswnd = btndelphoto;
		}
		else if (Edtmp == btndelphoto)
		{
			if (nohid)
			{
				if(noface)
				{
					if (nopwd)
					{
						if (nofp)
							focuswnd = btndelall;
						else
							focuswnd=btndelfp;
					}
					else
						focuswnd = btndelpwd;
				}
				else
				{
					focuswnd = btndelface;
				}
			}
			else
				focuswnd = btndelhid;
		}
		else if(Edtmp == btndelhid)
		{
			if(noface)
			{
				if(nopwd)
				{
					if(nofp)
						focuswnd = btndelall;
					else
						focuswnd = btndelfp;
				}
				else
					focuswnd = btndelpwd;
			}
			else
			{
				focuswnd = btndelface;
			}
		}
		SetFocusChild(focuswnd);
	}
}
예제 #20
0
static int NewWiFiWinProc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int id,nc;
	static char keyupFlag=0;

	switch (message)
	{
		case MSG_CREATE:
			wifidhcpflag = gOptions.wifidhcpfunon;
			InitWifiWindow(hWnd);		//add controls
			InitParameters();

			curFocusWnd =0;
			SetFocusChild(WifiWnd[curFocusWnd]);
			UpdateWindow(hWnd,TRUE);
			break;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*)lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;
				if(hdc == 0) {
					hdc = GetClientDC(hWnd);
					fGetDC = TRUE;
				}

				if(clip) {
					rcTemp = *clip;
					ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
					ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
					IncludeClipRect(hdc, &rcTemp);
				}

				FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, 0, &wifibkg);
				if(fGetDC) {
					ReleaseDC (hdc);
				}
				return 0;
			}

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);	
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout){
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if (3 == gOptions.TFTKeyLayout) {
				if (1==keyupFlag) {
					keyupFlag=0;
				} else {
					break;
				}
			}
			if (gOptions.KeyPadBeep){
				ExKeyBeep();
			}

			if ((LOWORD(wParam)==SCANCODE_ESCAPE)){
				PostMessage(hWnd, MSG_COMMAND, WIFI_EXIT, 0);
			} else 	if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN) {
				char tmpssid[128];
				if (curFocusWnd==0) {
					GetWindowText(WifiWnd[0], tmpssid, sizeof(tmpssid));
					if(tmpssid && strlen(tmpssid)>0) {
						if(hIMEWnd!=HWND_INVALID){
							SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
							hIMEWnd=HWND_INVALID;
						}
						curFocusWnd++;
					}
				} else if (curFocusWnd==1) {
					if(hIMEWnd!=HWND_INVALID){
						SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
						hIMEWnd=HWND_INVALID;
					}
					curFocusWnd++;
				} else if(++curFocusWnd>16) {
					curFocusWnd=0;
				}

				if (wifidhcpflag == 1 && curFocusWnd == 3) {
					curFocusWnd=15;
				}
				if (curFocusWnd == 4 || curFocusWnd == 5 ||curFocusWnd == 6 ){
					curFocusWnd = 7;
				}
				if (curFocusWnd == 8 || curFocusWnd == 9 || curFocusWnd == 10){
					curFocusWnd = 11;
				}
				if (curFocusWnd == 12 || curFocusWnd == 13 || curFocusWnd == 14){
					curFocusWnd = 15;
				}
				SetFocusChild(WifiWnd[curFocusWnd]);		
				return 0;
			} else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP){
				char tmpssid[128];
				if(curFocusWnd==0){
					GetWindowText(WifiWnd[0], tmpssid, sizeof(tmpssid));
					if(tmpssid && strlen(tmpssid)>0){
						if(hIMEWnd!=HWND_INVALID){
							SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
							hIMEWnd=HWND_INVALID;
						}
						curFocusWnd--;
					}
				} else if (curFocusWnd==1) {
					if(hIMEWnd!=HWND_INVALID){
						SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
						hIMEWnd=HWND_INVALID;
					}
					curFocusWnd--;
				
				} else if(--curFocusWnd<0){
					curFocusWnd=16;
				}

				if (wifidhcpflag == 1 && curFocusWnd == 14) {
					curFocusWnd= 2;
				}

				if (curFocusWnd == 10|| curFocusWnd == 11|| curFocusWnd == 12 ||curFocusWnd == 13 ){
					curFocusWnd = 7;
				} else if (curFocusWnd == 6|| curFocusWnd == 7|| curFocusWnd == 8 || curFocusWnd == 9){
					curFocusWnd = 3;
				} else if (curFocusWnd == 3 || curFocusWnd == 4 || curFocusWnd == 5){
					curFocusWnd = 2;
				} else if(curFocusWnd == 14){
					curFocusWnd = 11;
				}

				SetFocusChild(WifiWnd[curFocusWnd]);
				return 0;

			} else if(LOWORD(wParam)==SCANCODE_F9 || 
					((gOptions.TFTKeyLayout==0 || gOptions.TFTKeyLayout==4) && (LOWORD(wParam)==SCANCODE_F11))) {
				if((curFocusWnd==0 || curFocusWnd==1) && (gOptions.IMEFunOn==1 && gOptions.TFTKeyLayout!=3))
				{
					T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight,gOptions.HzImeOn);
				}
			} else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
				|| ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE)) {

				if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) && gOptions.IMEFunOn==1 
						&& gOptions.TFTKeyLayout==3 && (curFocusWnd==0 || curFocusWnd==1)) {
					T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);
					return 0;
				}

				if(curFocusWnd==2 && ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT || ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE))
					||LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)) {

					int tmpsel = SendMessage(WifiWnd[curFocusWnd], CB_GETCURSEL, 0, 0);		
					if (tmpsel == 0) {
						SendMessage(WifiWnd[curFocusWnd], CB_SETCURSEL, 1, 0);
						dhcpswitch(1);
						UpdateWindow(hWnd,TRUE);
						wifidhcpflag =1;
					} else {
						SendMessage(WifiWnd[curFocusWnd], CB_SETCURSEL, 0, 0);
						dhcpswitch(0);
						UpdateWindow(hWnd,TRUE);
						wifidhcpflag = 0;
					}
				}
				if (curFocusWnd >2 && curFocusWnd<15 && wifidhcpflag ==0) {
					if (LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT ){
						curFocusWnd --;
						if (curFocusWnd == 2){
							curFocusWnd =14;
						}
					}else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT){
						curFocusWnd ++;
						if (curFocusWnd ==15){
							curFocusWnd = 3;
						}
					}
					SetFocusChild(WifiWnd[curFocusWnd]);
				}
				return 0;	
			} else if ((LOWORD(wParam)==SCANCODE_ENTER) || (LOWORD(wParam)==SCANCODE_F10)) {
				char tmpssid[128];
				switch(curFocusWnd)
				{
					case 0:
						GetWindowText(WifiWnd[0], tmpssid, sizeof(tmpssid));
						if(tmpssid && strlen(tmpssid)>0)
							SendMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
						else
							MessageBox1(hWnd ,LoadStrByID(HIT_ERROR0) ,LoadStrByID(HIT_ERR),MB_OK | MB_ICONINFORMATION);
						break;
					case 16:		//exit
						SendMessage(hWnd, MSG_COMMAND, WIFI_EXIT, 0);
						break;
					default:
						SendMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
				}
				return 0;
			} else if(LOWORD(wParam)==SCANCODE_MENU) {
				SendMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
				return 0;
			}
			break;

		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			if(id==WIFI_SAVE) {
				if(isModified() && SaveNewWiFiSetting(hWnd)) {
					MessageBox1(hWnd ,LoadStrByID(HIT_RIGHT) ,LoadStrByID(HIT_RUN),MB_OK| MB_ICONINFORMATION);
					if(!ismenutimeout) {
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					}
				} else if(!ismenutimeout) {
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			} else if (id==WIFI_EXIT) {
				if(isModified() && MessageBox1(hWnd,LoadStrByID(MID_SAVEDATA),LoadStrByID(MID_APPNAME),
					MB_OKCANCEL|MB_ICONQUESTION|MB_BASEDONPARENT)==IDOK) {
					PostMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
				} else if(!ismenutimeout) {
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			}
			break;

		case MSG_CLOSE:
			if(hIMEWnd!=HWND_INVALID){
				SendMessage(hIMEWnd,MSG_CLOSE,0,0);
				hIMEWnd=HWND_INVALID;
			}

			UnloadBitmap(&wifibkg);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;

	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);
}
예제 #21
0
static int WiegandWinProc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int id,nc;
	//int i;
	static char keyupFlag=0;
	
	switch (message)
	{
		case MSG_CREATE:
			//if (LoadBitmap(HDC_SCREEN, &WGbkgbmp, GetBmpPath("submenubg.jpg")))
	                //        return 0;

			InitWGWindow(hWnd);		//add controls
			curindex = 0;
			SetFocusChild(WGWnd[curindex]);
			UpdateWindow(hWnd,TRUE);
			break;

		case MSG_ERASEBKGND:
		{
	            	HDC hdc = (HDC)wParam;
			const RECT* clip = (const RECT*)lParam;
			BOOL fGetDC = FALSE;
			RECT rcTemp;
			if(hdc == 0)
			{
				hdc = GetClientDC(hWnd);
				fGetDC = TRUE;
			}

			if(clip)
			{
				rcTemp = *clip;
				ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
				ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
				IncludeClipRect(hdc, &rcTemp);
			}

			FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, 0, get_submenubg_jgp());
			if(fGetDC) ReleaseDC (hdc);
			return 0;
		}

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);	
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout)
			{
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout)
			{
				if(1==keyupFlag)
					keyupFlag=0;
				else
					break;
			}
			if (gOptions.KeyPadBeep)
				ExKeyBeep();

			if ((LOWORD(wParam)==SCANCODE_ESCAPE))
				PostMessage(hWnd, MSG_CLOSE, 0, 0);

			else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)
			{
				if (++curindex > 2)
				{
					curindex = 0;
				}
				SetFocusChild(WGWnd[curindex]);
				return 0;
			}
			else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
			{
				if (--curindex < 0)
				{
					curindex = 2;
				}
				SetFocusChild(WGWnd[curindex]);
				return 0;
			}
			else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT))
			{
				return 0;
			}
			else if (LOWORD(wParam)==SCANCODE_F10)
			{
				if (curindex == 0)
				{
					PostMessage(hWnd, MSG_COMMAND, WG_SETIN, 0);
				}
				else if (curindex == 1)
				{
					PostMessage(hWnd, MSG_COMMAND, WG_SETOUT, 0);
				}
				else if (curindex == 2)
				{
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			}

			break;

		case MSG_COMMAND:
			id = LOWORD(wParam);
                        nc = HIWORD(wParam);

			if (id == WG_SETIN)
			{
				CreateWiegandInWindow(hWnd);
				//CreateWiegandOutWindow(hWnd, WG_IN_MODE);
				return 0;
			}
			else if (id == WG_SETOUT)
			{
				CreateWiegandOutWindow(hWnd, WG_OUT_MODE);
				return 0;
			}
			else if (id == WG_EXIT)
			{
				PostMessage(hWnd, MSG_CLOSE, 0, 0);
			}
			break;
	
		case MSG_CLOSE:
			//UnloadBitmap(&WGbkgbmp);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;

	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);

}