示例#1
0
文件: set.c 项目: justid/Zoolu
int Input_Regcode()
{
	unsigned int key ;
	
	BYTE pos = 0 ; 
	BYTE str_flag = FALSE ;
	int x = 58 ;
	int y = 26 ;
	int ptr = -1 ;

	PopUpWin(3) ;
	locatestr(15,22);
	printf("机器码%s",(unsigned char*)m_id) ;

	GetKey(&key) ;
	Bdisp_AllClr_DDVRAM() ;
	PopUpWin(3) ;
	printf("注册码 ") ;
	DrawRect(56,23,12,53) ;
	while(str_flag != TRUE)
	{
		GetKey(&key) ;
		switch (key) {
		case KEY_CTRL_EXE: 
			regstr[pos] = '\0' ;
			str_flag =TRUE ;
			break ;
		case  KEY_CTRL_ALPHA:
			break ;
		case KEY_CTRL_DEL:
			if (pos)  regstr[--pos] = '\0' ; 
			PrintXY(x, y, (unsigned char *)"        ", 0) ;
			break ;
		default: break ;
		}
		/* Numbers and characters */
		if ( (pos < 8) &&
		     ((key >= KEY_CHAR_0 && key <= KEY_CHAR_9) || 
		      (key >= KEY_CHAR_A && key <= KEY_CHAR_Z)) ) {
			regstr[pos] = (char)key ;
			++pos ;
		}
		PrintXY(x, y, (unsigned char *)regstr, 0) ;
	}
	

	return ;
}
示例#2
0
void memory_error(char *from, char *func, int val)
{
  unsigned int key;
  char info[20];
  if(!memory_errors) return;  

  sprintf(info,"%d",val);
  PopUpWin(6);

  locate(4,2); Print((unsigned char *)"Memory ERROR !!");
  locate(3,4); Print((unsigned char *)"FROM:");
  locate(8,4); Print((unsigned char *)from);
  locate(3,5); Print((unsigned char *)"FUNC:");
  locate(8,5); Print((unsigned char *)func);
  locate(3,6); Print((unsigned char *)"INFO:");
  locate(8,6); Print((unsigned char *)info);
  locate(3,7); Print((unsigned char *)"META:");
  locate(8,7);

  switch(val)
  {
    case  1:  Print((unsigned char *)"NotEnoughRAM"); break;
    case -1:  Print((unsigned char *)"Nonexisting");  break;
    case -5:  Print((unsigned char *)"WrongDevice");  break;
    case -8:  Print((unsigned char *)"AccessDenied"); break;
    case -14: Print((unsigned char *)"ReadOnly");     break;
    case -31: Print((unsigned char *)"DeviceError");  break;
    case -35: Print((unsigned char *)"NotEmpty");     break;
    default:  Print((unsigned char *)"Other");        break;
  }
  GetKey(&key);
}
示例#3
0
int WheterSavaASPM()
{
	char str[13]="";
	int suc,enter,i;
	for (i=0;i<13 && setup_data.jdfroute_name[i] != '.';++i)
		str[i] = setup_data.jdfroute_name[i];
	str[i>=13 ? 12 : i] = 0;
	PopUpWin(4);
	DispStr(24,8,"\xce\xc4\xbc\xfe\xc3\xfb(*.pm)");//file_name
	do
	{
		suc = InputString(24,24,str,1,8);
		if (suc==KEY_CTRL_EXIT) break;
		if (! str[0]) continue;
	}while(suc!=KEY_CTRL_EXE);
	if(suc!=KEY_CTRL_EXIT)
	{
		enter = 1;
		strcat(str,".pm");
		if (TestPMFile(str))
		{
			enter = WhetherCoverPM();
		}
		if (enter)
		{
			SavePMFile(str);
			strcpy(setup_data.pmroute_name,str);
		}
	}
}
示例#4
0
文件: fileopen.c 项目: justid/Zoolu
int SelectRoot(void)
{
	unsigned int key ;
	int ret = 0 ;

	SaveDisp(SAVEDISP_PAGE3) ;	
	PopUpWin(4) ;
	Print_zh("1.内置闪存 ", 14, 11, 0) ;
	Print_zh("2.SD卡 ", 14, 25, 0) ;

	GetKey(&key) ;
	switch (key)
	{
	case KEY_CHAR_1: 
		Fls_F = TRUE ; SDcard_F = FALSE ;
		break ;
	case KEY_CHAR_2:
		SDcard_F = TRUE ; Fls_F = FALSE ;
		break ;
	default:
		ret = 1 ;
		break ;
	}
	RestoreDisp(SAVEDISP_PAGE3) ;
	return ret ;
}
示例#5
0
int WhetherCoverPM()
{
	int enter;
	PopUpWin(5);
	DispStr(48,12,"覆盖?"); //fugai
	locate(7,5);Print("Yes : [F1]");
	locate(7,6);Print("No  : [F6]");
	do{
		GetKey(&key);
		if (key==KEY_CTRL_F6 || key==KEY_CTRL_EXIT){enter =0 ;break;}
		else if (KEY_CTRL_F1) {enter = 1;break;}
	}while(1);
	return enter;
}
示例#6
0
文件: suidao.c 项目: justid/Zoolu
int Suidao_DM(void)
{
	int display = 0;
	double sd_pj = 0.0 ;	/*	测点与中线的距离	*/
	double sd_gc = 0.0 ;	/*	测点与设计线的高差	*/
	unsigned int key = 0 ;
	unsigned int back_key ;
	BYTE exit_flag = FALSE;
	BYTE xyrow = 0 ;
	int shuaxin = TRUE;		/*	刷新	*/

	while (exit_flag != TRUE)  {
		
		switch(key) {
 		case KEY_CTRL_F1:	default: 
 			if (key == KEY_CTRL_F1)	shuaxin == TRUE;
			if (shuaxin){
				Bdisp_AllClr_DDVRAM() ; 
				Print_zh("隧道断面 ", 0, 1, VERT_REV) ;
				PrintIcon (0,"Home",0);
				PrintIcon (1,"Set",0);
				PrintIcon (2,"SQX",0);
				PrintIcon (3,"DM",0);
				(R_L > 0) ? PrintIcon (4,"YOU",0) : PrintIcon (4,"ZUO",1);
				PrintIcon (5,"Help",0);
				shuaxin = FALSE;
			}
			back_key = key ;
			Bdisp_AreaClr_DDVRAM(&clear_area) ;
			Print_zh("X坐标 ", 20, 6, 0) ;
			Print_zh("Y坐标 ", 20, 22, 0) ;
			Print_zh("Z坐标 ", 20, 38, 0) ;
			
			
			 if (xyrow > 2) {
			 		if (!sd_flag)	{
						Warning("未载入断面 ",2);
						//exit_flag = TRUE ;	//强制退出以解决卡在载入数据界面的问题 fix by 龙之冰点
						xyrow = 0; /*	把焦点设置在TOP		*/
						key = KEY_CTRL_F4;
					break ;
				}
 				xyrow = 0 ;
 				x = sd_x ;
 				y = sd_y ;
 				SaveDisp(SAVEDISP_PAGE2) ;
 				if (InputStake(FS_NOPOPUP) == FSOK){
 					number = fs_zh ;
 					if (!GC_JS(number)) break ;
 					RestoreDisp(SAVEDISP_PAGE2) ;
				 	Bdisp_AreaClr_DDVRAM(&clear_area) ;
				 	
				 	sd_gc = sd_z -  DesignGC;
					 				 	
				 	if (!yanxin(fs_pj, sd_gc)){
				 		Warning("断面计算失败 ",2);
				 		key == KEY_CTRL_F1; 
	 					break ;
	 				}
					Print_zh("桩号K ", 20, 0, 0) ;
					Print_zh("偏距D ", 20, 13, 0) ;
					Print_zh("高差H ", 20, 26, 0) ;
					if (sd_cqw < 0)	Print_zh("欠挖W ", 20, 39, 0) ;
					else			Print_zh("超挖T ", 20, 39, 0) ;
					Print_C(120, 4, CA = fs_zh, 3) ;
					Print_C(120, 17, CA = fs_pj, 3) ;
					Print_C(120, 30, CA = sd_gc, 3) ;
					Print_C(120, 43, CA = sd_cqw, 3) ;
					key = 0 ;
					while(key != KEY_CTRL_EXE && key != KEY_CTRL_EXIT)	GetKey(&key) ;
					key = KEY_CTRL_F1 ;
					break ;
				 }
 				RestoreDisp(SAVEDISP_PAGE2) ;
 			}
			Print_C(112, 10, CA = sd_x, 3) ;
			Print_C(112, 26, CA = sd_y, 3) ;
			Print_C(112, 42, CA = sd_z, 3) ;
			key = InputVal(59, 8+xyrow*16) ;
			switch (xyrow) {	
				case 0:   sd_x = number ? number : sd_x ; break ; 
				case 1:   sd_y = number ? number : sd_y; break ; 
				case 2:   sd_z = number ? number : sd_z; break ; 
				default:  break ;
			}
			if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) xyrow = 0 ;
			break ;
		case KEY_CTRL_F2:
			back_key = key ;
			Bdisp_AreaClr_DDVRAM(&clear_area) ;
			Print_zh("修正H ", 20, 6, 0) ;
			Print_zh("修正D ", 20, 22, 0) ;
			Print_zh("修正R ", 20, 38, 0) ;
			if (xyrow > 2) { 	/* 返回上一个菜单  */
				key = KEY_CTRL_F1 ; 
				xyrow = 0 ; 
				break ;
			 }
			Print_C(112, 10, CA = sd_h, 3) ;
			Print_C(112, 26, CA = sd_d, 3) ;
			Print_C(112, 42, CA = sd_r, 3) ;
			key = InputValP(59, 8+xyrow*16) ;
			switch (xyrow) {	
				case 0:   sd_h = number ? number : sd_h ; break ; 
				case 1:   sd_d = number ? number : sd_d ;break ; 
				case 2:   sd_r = number ? number : sd_r ; break ; 
				default:  break ;
			}
			if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) xyrow = 0 ;
			break ;

		case KEY_CTRL_F3:
			SaveDisp(SAVEDISP_PAGE2) ;

			if (sqx_flag == TRUE)	 {
				if ( InputSQstake() == TRUE) {
					if (InputSQpj() == TRUE) {	/* 输入偏距	*/
						DesignGC = Cut_3(DesignGC) ;
						PopUpWin(3);
						locatestr(12,22) ;
						printf("高程:%.3f",DesignGC ) ;
						GetKey(&key);
					}
				}		
			}
			else  DebugS("未载入竖曲线 ") ;
			key =  back_key ;
			RestoreDisp(SAVEDISP_PAGE2) ;
			break ;
			
		case KEY_CTRL_F4:
			sd_flag = load_SD_data(sd_flag) ;
			key =  KEY_CTRL_F1 ;
			shuaxin = TRUE;
			break ;
			
		case KEY_CTRL_F5:
			if (R_L == -1){
				R_L = 1; 
				Warning("应用在右幅 ",2);
			}	
			else{
				R_L = -1;
				Warning("应用在左幅 ",2);
			}
			key =  KEY_CTRL_F1 ;
			shuaxin = TRUE;
			break ;
			
			case KEY_CTRL_F6:
			Bdisp_AllClr_DDVRAM() ;
			Print_zh("Home=刷新页面 ", 1, 2, 0) ;
			Print_zh("Set =断面数据修正 ", 1, 16, 0) ;
			Print_zh("SQX =竖曲线高程 ", 1, 30, 0) ;
			Print_zh("DM  =选择断面文件 ", 1, 44, 0) ;
			GetKey(&key);
			Bdisp_AllClr_DDVRAM() ;
			Print_zh("ZUO =应用在左幅 ", 1, 2, 0) ;
			Print_zh("YOU =应用在右幅 ", 1, 16, 0) ;
			Print_zh("修正H=改变圆心高差 ", 1, 30, 0) ;
			Print_zh("     (+上移 -下移)", 1, 44, 0) ;
			GetKey(&key);
			Bdisp_AllClr_DDVRAM() ;
			Print_zh("修正D=改变圆心偏距 ", 1, 2, 0) ;
			Print_zh("     (+右移 -左移) ", 1, 16, 0) ;
			Print_zh("修正R=改变设计半径 ", 1, 30, 0) ;
			Print_zh("     (+变长 -变短)", 1, 44, 0) ;
			GetKey(&key);
			key =  KEY_CTRL_F1 ;
			shuaxin = TRUE;
			break ;

		case KEY_CTRL_UP:  
			if (xyrow > 0)  --xyrow ;  
			key = back_key ;
			break ;
		case KEY_CTRL_DOWN: 
		case KEY_CTRL_EXE:
			++xyrow ; 
			key = back_key ;
			break ;
		case KEY_CTRL_DEL:
			key = back_key ;
			break ;
		case KEY_CTRL_EXIT :
			exit_flag = TRUE ;	
			break ;
		}
	}
	return ;
}
示例#7
0
int SelectfilePM()
{
	
	index = 0;
	need_redraw = REDRAW_PART;
	SetMyFont(&stHz12x12,&stAsc6x12);
	while(1)
	{
		if (need_redraw == REDRAW_PART)
		{
			PopUpWin(6);
			DrawPicture(32,9,	16,	10,	G_ICON_SAVE);	DispStr(48,8,"保存为 ");
			DrawPicture(32,25,	16,	10,	G_ICON_OPEN);	DispStr(48,24,"打开 ");
			DrawPicture(32,41,	16,	10,	G_ICON_OTHER);	DispStr(48,40,"新建 ");
			
			Bdisp_AreaReverseVRAM(14,8+16*index,112,20+index*16);
		}
		GetKey(&key);
		if (key==KEY_CTRL_UP) 	{if(--index<0) index = 2;need_redraw = REDRAW_PART;}
		if (key==KEY_CTRL_DOWN)	{if(++index>2) index = 0;need_redraw = REDRAW_PART;}
		if (key==KEY_CTRL_EXIT)	break;
		if (key==KEY_CTRL_EXE)
		{
			char str[13]="";
			int suc,enter,i;
			switch(index)
			{
				case 0:
					
					for (i=0;i<13 && setup_data.pmroute_name[i] != '.';++i)
						str[i] = setup_data.pmroute_name[i];
					str[i>=13 ? 12 : i] = 0;
					PopUpWin(4);
					DispStr(24,8,"\xce\xc4\xbc\xfe\xc3\xfb(*.pm)");//file_name
					do
					{
						suc = InputString(24,24,str,1,8);
						if (suc==KEY_CTRL_EXIT) break;
						if (! str[0]) continue;
					}while(suc!=KEY_CTRL_EXE);
					if(suc!=KEY_CTRL_EXIT)
					{
						enter = 1;
						strcat(str,".pm");
						if (TestJDFFile(str))
						{
							PopUpWin(5);
							DispStr(48,12,"覆盖?"); //fugai
							locate(7,5);Print("Yes : [F1]");
							locate(7,6);Print("No  : [F6]");
							do{
								GetKey(&key);
								if (key==KEY_CTRL_F6 || key==KEY_CTRL_EXIT){enter =0 ;break;}
								else if (KEY_CTRL_F1) {enter = 1;break;}
							}while(1);
						}
						if (enter)
						{
							SavePMFile(str);
							strcpy(setup_data.pmroute_name,str);
						}
					}     
					break;
				case 1:
					suc = SelectPMFile (str);
					if (suc==-1)
					{
						PopUpWin(1);
						locate(7,4);Print("No File!");
						GetKey(&key);
					}
					if(suc==1)
					{
						LoadPMFile  (str);
						strcpy(setup_data.pmroute_name,str);
						if(LoadPMFile  (setup_data.pmroute_name)==1)
						SaveIniPMFile();
						goto EXIT;
					}
					
				case 2:
					PopUpWin(5);
				    DispStr(48,12,"新建?"); 
				    locate(7,5);Print("Yes : [F1]");
					locate(7,6);Print("No  : [F6]");
					GetKey(&key);
					if (key==KEY_CTRL_F1){
						PopUpWin(5);
				        DispStr(40,12,"保存数据?"); 
				        locate(7,5);Print("Yes : [F1]");
					    locate(7,6);Print("No  : [F6]");
					    GetKey(&key);
						if(key==KEY_CTRL_F1)
						{
							if(setup_data.pmroute_name[0]==0)
				            {
					            WheterSavaASPM();
				            }
				            else
				            {
					            SavePMFile(setup_data.pmroute_name);
				            }
						}						
						setup_data.pmroute_name[0]=0;
				        pmroute_initial(&pmroute);
	                    pmroute_push_back(&pmroute);
						goto EXIT;
			        }   
				    break;
					
				default:break;
			}
			need_redraw = REDRAW_PART;
		}
	}
	EXIT:
	return 0;
}
示例#8
0
int PM_parameter()
{
	
	char * table_label[]= {"DH","QDZH","ZDZH","X","Y","FWJ","ZX","QDBJ","ZDBJ"};
	char * icons[]		= {"","","","",""};
	char * ch_text[]	= {"\xb5\xe3\xc3\xfb",
	                        "起点桩号",
							"终点桩号",
							"X坐标 ", 
							"Y坐标 ",
							"方位角 ",
							"转向 ",
							"起点半径",
							"终点半径"};
							
	int x = 0,y = 0,i,j,t;
	int left = 0,top = 0;
	int refresh = REDRAW_ALL;
	int enter,suc;
	char str[13]="";
	char c;
	

	PMproduce(); //打开交点参数转换平面参数
	InsertLine(l_pqx.length,&y,&refresh);
	GetListq();  //取链表链表线元参数

	while(1){
		if (refresh==REDRAW_ALL){
			Bdisp_AllClr_VRAM();
			for (i=0;i<4;++i)
			PrintTablesPM(i,0,table_label[left+i],1,1);
			t = pmroute.size<= 1 ? 2 : 5; //如果交点个数小于等于1 那么T=2 否则等于5
			if 	(t>=2){
			SetMyFont(&stHz8x8,&stAsc6x12);
			DispStr(2,56,"\xCE\xC4\xBC\xFE");
		    DispStr(23,56,"添加");
			}
			if 	(t>2){
			SetMyFont(&stHz8x8,&stAsc6x12);
			DispStr(45,56,"插入 ");
		    DispStr(65,56,"删行 ");
			DispStr(86,56,"清空 ");
			}
			for (i=0;i< t;++i) // i<2 或  i<5
			PrintIcon(i,icons[i],0);  //打印下标 
			PrintIcon(5,"?",0);  //固定打印下标
			refresh = REDRAW_PART; // 重画部分
		}
		if (refresh==REDRAW_PART){  //如果画部分 
			double * sd;
			for (i=top;i<top+4 && i<pmroute.size;++i){ 
				sd =  & (pmroute.set[i].pm_qk);
				for (j=(left==0 ? 1:0);j<4;++j){
					//if (i==0 && j+left>3)  //////////////////////////////////////////
					//PrintTablesPM(j,i+1-top,"",y==i && x-left==j,0);///////////////
					//else/////////
						PrintTableFormatPM(j,i+1-top,y==i && x-left==j,0,"%lf",sd[j+left-1]);
				}
				if (left==0)
					PrintTableFormatPM(0,i+1-top,y==i && x-left==0,0,"%s",pmroute.set[i].name);
				    PrintTableIndexPM(i-top+1,i);
			}
			SetMyFont(&stHz12x12,&stAsc6x12);
			if(x>0){
				//if (!(y==0 && x>2)){
					sd =  & (pmroute.set[y].pm_qk); //取地址的值***************
					DispStr(0,42,ch_text[x]);
					PrintFloat(sd[x-1],49,42,0,setup_data.point); //打印 
				//}
			}else{
				DispStr(0,42,ch_text[x]);
				PrintXY(51,44,pmroute.set[y].name,0);
			}
			refresh = 0;
		}
		GetKey(&key);
		switch (key){
		case KEY_CTRL_UP:
			y--;refresh = REDRAW_ALL;break;
		case KEY_CTRL_DOWN:
			y++;refresh = REDRAW_ALL;break;
		case KEY_CTRL_LEFT:
			x--;refresh = REDRAW_ALL;break;
		case KEY_CTRL_RIGHT:
			x++;refresh = REDRAW_ALL;break;
		case KEY_CTRL_EXIT:
			pmroute_initial(&pmroute);
		    InitList(&l_pqx);
			return 0 ;
			
		case KEY_CTRL_F1:					/* Set */
			refresh = REDRAW_ALL;
			SelectfilePM();
			break;
			
		case KEY_CTRL_F2:					/* Add */
		    pmroute_push_back (&pmroute);
			y = pmroute.size - 1;
			refresh = REDRAW_ALL;
			break;
			
		case KEY_CTRL_F3:					/* ins */
			//if (y==0) break;
			pmroute_insert (&pmroute,y);
			y++;
			refresh = REDRAW_ALL;
			break;
		case KEY_CTRL_F4:					/* Del a point */
			//if (y==0) break;
			refresh = REDRAW_ALL;
			PopUpWin(4);DispStr(25,10,"删 除 一 行?");
			locate(3,5);Print("[F1]Yes   [F6]No");
			GetKey(&key);
			if (key==KEY_CTRL_F1){
				pmroute_del(&pmroute,y);y--;
			}
			break;
			
		 case KEY_CTRL_F5:					/* Del All */
			refresh = REDRAW_ALL;
			PopUpWin(4);DispStr(25,10,"清 空 所 有 ?");
			locate(3,5);Print("[F1]Yes   [F6]No");
			GetKey(&key);
			if (key==KEY_CTRL_F1){
				pmroute_initial(&pmroute);
	            pmroute_push_back(&pmroute);
			}
			break;
			

         case KEY_CTRL_F6:
		    refresh = REDRAW_ALL;
			//PrintfXY (70,30,0,"%.3f",route.set[0].xy_zr);  
			//DispStr(15,10,"线路名称");
			//if(setup_data.pmroute_name[0]==0)
			//{
			 //DispStr(25,27,"请保存线路文件 ");
			//}
			 //else
			//{
             //DispStr(25,27,setup_data.zdmroute_name);
			//}
          	break;	
		default:							/*other things*/
			if (x>0 && (c=GetPressNumChar(key))!=0){
				char buffer[14];
				int r;
				//if (y==0 && x > 3)break;
				buffer[0] = c;
				buffer[1] = '\0';
				r = InputString(49,42,buffer,0,12);
				if (r!=KEY_CTRL_EXIT){
					double * sd;
					sd =  (double*)&(pmroute.set[y].pm_qk);
					sd[x-1] = atof(buffer);
					switch(r){
					case KEY_CTRL_UP:	y--;break;
					case KEY_CTRL_DOWN:	y++;break;
					case KEY_CTRL_EXE:	x++;break;
					}
				}
				refresh = REDRAW_ALL;
			}
			else if (x==0 && (c=GetPressChar(key))!=0){
				char buffer[14];
				int r;
				buffer[0] = c;
				buffer[1] = '\0';
				r = InputString(49,42,buffer,1,12);
				if (r!=KEY_CTRL_EXIT){
					strncpy(pmroute.set[y].name,buffer,12);
					switch(r){
					case KEY_CTRL_UP:	y--;break;
					case KEY_CTRL_DOWN:	y++;break;
					case KEY_CTRL_EXE:	x++;break;
					}
				}
				refresh = REDRAW_ALL;
			}
			break;
		}
		if (x<0) x = 8,y--;
		if (x>8) x = 0,y++;
		if (y<0) y = 0;
		if (y>=pmroute.size) y = pmroute.size - 1;
		if (y>top + 3) top = y - 3;
		if (y<top) top = y;
		if (x>left +3) left = x - 3;
		if (x<left) left = x;
	}
}