⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 property.c

📁 国家ASIC工程中心使用的嵌入式操作系统
💻 C
📖 第 1 页 / 共 3 页
字号:
	{
		st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x,st_y[i],st_w,st_h,mainwin,0,NULL);
		st_y[i+1] = st_y[i] + 25;
	}
//	st_serial = CreateWindow(WNDCLASS_STATIC, "320001", WS_CHILD|SS_TEXT, (U16)(lb_x+24),st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	Index++;
	Int2Char( Index, caption );
	st_serial = CreateWindow(WNDCLASS_STATIC, caption, WS_CHILD|SS_TEXT, (U16)lb_x,st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	for( i = 0; i < 3; i++ )
		bt_sel[i] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[i+1],bt_w2,bt_h,mainwin,0,NULL);
	lb_terrain = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[4],lb_w,lb_h,mainwin,0,owner);

	str1[0] ='\0';
	str2[0] ='\0';

	while(!quit)
	{
		ASIXGetMessage(&msg, NULL, 0, 0);
		switch(msg.message)
		{
			case WM_COMMAND:
				if( msg.lparam == bt_ok )
				{
					// 确认
					record.index = Index;
					record.magic = 0x3;
					record.latitude = 0.0;
					record.longitude = 0.0;
					record.end_flag[0] = 'c';
					record.end_flag[1] = 'c';

					if ( Index == 320001 )//第一个数据
					{
						rootdir[DirPos].file_type = WBG_FILE;
//						*file_name = "G320102";
						memcpy( rootdir[DirPos].file_name, "G3201020000120020101.wbg", 22 );
						rootdir[DirPos].file_address = FileCurrentAddress;
						rootdir[DirPos].file_length += sizeof(MAP_BLOCK_INFO_S);
						DirPos++;
					}
					if ( cur_area + sizeof(MAP_BLOCK_INFO_S) < area + FLASH_LENGTH )
					{
//						WriteRecord( area, FileCurrentAddress, cur_area - area );//Julias
//						FileCurrentAddress += cur_area - area;
						cur_area = (BYTE *)area;
					}
					memcpy( cur_area, &record, sizeof(MAP_BLOCK_INFO_S) );
					cur_area += sizeof(MAP_BLOCK_INFO_S);

					quit = 1;					
				}
				else if( msg.lparam == bt_cancel )
				{
					// 取消
					Index--;
					quit = 1;
				}
				else if( msg.lparam == bt_sel[2] )	// 选择地类名称
				{
					S8	*str;

					str = SelectTerrainType( &code );

					if( str != NULL )
					{
						SetWindowText( bt_sel[2], str, NULL );
						Int2Char( code, record.terrain_name );
						Lfree( str );
					}

				}
				else if( msg.lparam == bt_sel[0] )	// 权属单位
				{
//					OpenSingleEditor( "输入", "单位名称:", str1, 20, KBS_PINGYING );
//					SetWindowText( bt_sel[0], str1, NULL );
					OpenSingleEditor( "输入", "单位名称:", record.owner, 20, KBS_PINGYING );
					SetWindowText( bt_sel[0], record.owner, NULL );
				}
				else if( msg.lparam == bt_sel[1] )	// 坐落单位
				{
//					OpenSingleEditor( "输入", "单位名称:", str2, 20, KBS_PINGYING );
//					SetWindowText( bt_sel[1], str2, NULL );
					OpenSingleEditor( "输入", "单位名称:", record.location_owner, 20, KBS_PINGYING );
					SetWindowText( bt_sel[1], record.location_owner, NULL );
				}
				break;
			case WM_LISTBOX:
				if ( msg.lparam == lb_terrain )//权属性质
					Int2Char( msg.wparam + 1, record.ter_char );

				break;
			case WM_QUIT:
				Index--;
				quit = 1;
				break;
		}
		DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam); 
	}
	
	DestroyWindow( mainwin );
}


void RecordAlterLine( void )
{
	MSG 	msg;
 	U32		mainwin;
 	U8		quit=0;
	U32		st_promt[9], st_serial;
	S8		*prompt[9] = { "变更线序号:", "左侧图斑", "权属单位:", "地类名称:", "权属性质:", 
							"右侧图斑", "权属单位:", "地类名称:", "权属性质:" };
	U32		bt_ok, bt_cancel;
	U32		lb_terrain[2];
	U32		bt_sel[4];//左侧权属单位,右侧权属单位,两个地类名称
	U8		i;
	U16		st_y[9];
	S8		str[20];
	unsigned long	code;
	char	caption[16];
	ALTER_LINE_INFO_S	record;

	const U16	bt_w = 40, bt_h = 18, bt_y = PHY_LCD_H - bt_h -10;
	const U16	st_w[9] = { 75, 60, 60, 60, 60, 60, 60, 60, 60 };
	const U16	st_h = 20, st_x = 5;
	const U16	lb_w = 75, lb_h = 16, lb_x = PHY_LCD_W - lb_w -5;
	const U16	bt_w2 = lb_w, bt_x2 = PHY_LCD_W - bt_w2 -5;

  	memset( caption, 0, 16 );

	mainwin = CreateWindow(	WNDCLASS_WIN,
							"零星地物信息",
							WS_OVERLAPPEDWINDOW,
							0,0,
							PHY_LCD_W,PHY_LCD_H,
							0,
							0,
							NULL);
	
	
	bt_ok = CreateWindow(WNDCLASS_BUTTON, "确认", WS_CHILD|BS_REGULAR, 27,bt_y,bt_w,bt_h + 5,mainwin,0,NULL);
	bt_cancel = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 93,bt_y,bt_w,bt_h + 5,mainwin,0,NULL);
	

	st_y[0] = 25;
	for( i = 0; i < 9; i++ )
	{
		if ( i == 0 || i == 1 || i == 5 )
			st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x,st_y[i],st_w[i],st_h,mainwin,0,NULL);
		else
			st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x + 15,st_y[i],st_w[i],st_h,mainwin,0,NULL);
		
		st_y[i+1] = st_y[i] + 20;
	}
//	st_serial = CreateWindow(WNDCLASS_STATIC, "320001", WS_CHILD|SS_TEXT, (U16)(lb_x+15),st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	Index++;
	Int2Char( Index, caption );
	st_serial = CreateWindow(WNDCLASS_STATIC, caption, WS_CHILD|SS_TEXT, (U16)lb_x,st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);

	bt_sel[0] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[2],bt_w2,bt_h,mainwin,0,NULL);
	bt_sel[1] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[6],bt_w2,bt_h,mainwin,0,NULL);
	bt_sel[2] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[3],bt_w2,bt_h,mainwin,0,NULL);
	bt_sel[3] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[7],bt_w2,bt_h,mainwin,0,NULL);

//	lb_terrain[0] = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[3],lb_w,lb_h,mainwin,0,name);
	lb_terrain[0] = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[4],lb_w,lb_h,mainwin,0,owner);
//	lb_terrain[2] = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[7],lb_w,lb_h,mainwin,0,name);
	lb_terrain[1] = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[8],lb_w,lb_h,mainwin,0,owner);

	str[0] = '\0';

	while(!quit)
	{
		ASIXGetMessage(&msg, NULL, 0, 0);
		switch(msg.message)
		{
			case WM_COMMAND:
				if( msg.lparam == bt_ok )
				{
					// 确认
					record.index = Index;
					record.magic = 0x6;
					record.latitude = 0.0;
					record.longitude = 0.0;
					record.end_flag[0] = 'f';
					record.end_flag[1] = 'f';

					if ( Index == 320001 )//第一个数据
					{
						rootdir[DirPos].file_type = WBG_FILE;
//						*file_name = "G320102";
						memcpy( rootdir[DirPos].file_name, "G3201020000120020101.wbg", 22 );
						rootdir[DirPos].file_address = FileCurrentAddress;
						rootdir[DirPos].file_length += sizeof(ALTER_LINE_INFO_S);
						DirPos++;
					}
					if ( cur_area + sizeof(ALTER_LINE_INFO_S) < area + FLASH_LENGTH )
					{
//						WriteRecord( area, FileCurrentAddress, cur_area - area );//Julias
//						FileCurrentAddress += cur_area - area;
						cur_area = (BYTE *)area;
					}
					memcpy( cur_area, &record, sizeof(ALTER_LINE_INFO_S) );
					cur_area += sizeof(ALTER_LINE_INFO_S);

					quit = 1;					
				}
				else if( msg.lparam == bt_cancel )
				{
					// 取消
					Index--;
					quit = 1;
				}
				else if( msg.lparam == bt_sel[0] )	// 左侧权属单位
				{
//					OpenSingleEditor( "输入", "单位名称:", str, 20, KBS_PINGYING );
//					SetWindowText( bt_sel[0], str, NULL );
					OpenSingleEditor( "输入", "单位名称:", record.left_owner, 20, KBS_PINGYING );
					SetWindowText( bt_sel[0], record.left_owner, NULL );
				}
				else if( msg.lparam == bt_sel[1] )	// 右侧权属单位
				{
//					OpenSingleEditor( "输入", "单位名称:", str, 20, KBS_PINGYING );
//					SetWindowText( bt_sel[1], str, NULL );
					OpenSingleEditor( "输入", "单位名称:", record.right_owner, 20, KBS_PINGYING );
					SetWindowText( bt_sel[1], record.right_owner, NULL );
				}
				else if ( msg.lparam == bt_sel[2] )//左侧图斑的地类名称
				{
					S8	*str;

					str = SelectTerrainType( &code );

					if( str != NULL )
					{
						SetWindowText( bt_sel[2], str, NULL );
						Int2Char( code, record.left_land_name );
						Lfree( str );
					}

				}
				else if ( msg.lparam == bt_sel[3] )//右侧图斑的地类名称
				{
					S8	*str;

					str = SelectTerrainType( &code );

					if( str != NULL )
					{
						SetWindowText( bt_sel[3], str, NULL );
						Int2Char( code, record.right_land_name );
						Lfree( str );
					}

				}
				break;
			case WM_LISTBOX:
				if ( msg.lparam == lb_terrain[0] )
					Int2Char( msg.wparam + 1, record.left_ter_char );
				else if ( msg.lparam == lb_terrain[1] )
					Int2Char( msg.wparam + 1, record.right_ter_char );
				break;
			case WM_QUIT:
				Index--;
				quit = 1;
				break;
		}
		DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam); 
	}
	
	DestroyWindow( mainwin );
}


char *SelectTerrainType( unsigned long *code )
{
	MSG 	msg;
 	U32		mainwin;
 	U8		quit=0;
	U32		st_promt[3];
	S8		*prompt[3] = { "一级类:", "二级类:", "三级类:" };
	U32		bt_ok, bt_cancel;
	U32		lb_sel[3];
	U8		i, j;
	U16		st_y[3];
	TERRAINTYPE	*terrain, *subtype;
	U8		num, select[3] = { 0, 0, 0 }, level;
	S8		*result = NULL;
	
	struct LBOX_ITEM	*lb_item[3] =
	{
		type_L1,
		type_L2,
		type_L3
	};

	const U16	bt_w = 40, bt_h = 20, bt_y = PHY_LCD_H - bt_h -5;
	const U16	st_w = 48;
	const U16	st_h = 20, st_x = 5;
	const U16	lb_w = 90, lb_h = 20, lb_x = PHY_LCD_W - lb_w -5;

 	mainwin = CreateWindow(	WNDCLASS_WIN,
							"地类信息选择",
							WS_OVERLAPPEDWINDOW,
							0,0,
							PHY_LCD_W,PHY_LCD_H,
							0,
							0,
							NULL);
	
	
	bt_ok = CreateWindow(WNDCLASS_BUTTON, "确认", WS_CHILD|BS_REGULAR, 27,bt_y,bt_w,bt_h,mainwin,0,NULL);
	bt_cancel = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 93,bt_y,bt_w,bt_h,mainwin,0,NULL);
	
	// initialize default choise
	terrain = &TerrainType[ParSelect.terrain];
	level = 3-ParSelect.terrain;
	for( i = 0; i < level; i++ )
	{
		if( terrain != NULL )
		{
			subtype = terrain[0].sub;
			num = terrain[0].subnum;
		}
		else
		{
			subtype = NULL;
			num = 0;
		}
		for( j = 0; j < num; j++ )
		{
			lb_item[i][j].item_status = ICON_ENABLE;
			lb_item[i][j].item_underline = UNUNDERLINE;
			lb_item[i][j].item_text = subtype[j].name;
		}
		lb_item[i][j].item_status = ICON_END;
		lb_item[i][j].item_underline = UNUNDERLINE;
		lb_item[i][j].item_text = NULL;
		terrain = subtype;
	}


	st_y[0] = 35;
	for( i = 0; i < level; i++ )
	{
		st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x,st_y[i],st_w,st_h,mainwin,0,NULL);
		st_y[i+1] = st_y[i] + 35;
	}
	for( i = 0; i < level; i++ )
		lb_sel[i] = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[i],lb_w,lb_h,mainwin,0,(struct LBOX_ITEM *)lb_item[i]);

	while(!quit)
	{
		ASIXGetMessage(&msg, NULL, 0, 0);
		switch(msg.message)
		{
			case WM_COMMAND:
				if( msg.lparam == bt_ok )
				{
					// 确认
					S8	*s;
					
					s = lb_item[level-1][select[2]].item_text;
					result = (S8 *)Lmalloc( strlen( s )+1 );
					if( result != NULL )
						strcpy( result, s );
					quit = 1;					
				}
				else if( msg.lparam == bt_cancel )
				{
					// 取消
//					Index--;
					quit = 1;
				}
				break;
			case WM_LISTBOX:
				terrain = TerrainType[ParSelect.terrain].sub;
				for( i = 0; i < level; i++ )
				{
					if( msg.lparam == lb_sel[i] )
					{
						U8	k;
						
						select[i] = (U8)msg.wparam;
						terrain = &terrain[msg.wparam];
						for( j = i+1; j < level; j++ )
						{
							if( terrain != NULL )
							{
								subtype = terrain[select[j]].sub;
								num = terrain[select[j]].subnum;
							}
							else
							{
								subtype = NULL;
								num = 0;
							}
							for( k = 0; k < num; k++ )
							{
								lb_item[j][k].item_status = ICON_ENABLE;
								lb_item[j][k].item_underline = UNUNDERLINE;
								lb_item[j][k].item_text = subtype[k].name;
							}
							lb_item[j][k].item_status = ICON_END;
							lb_item[j][k].item_underline = UNUNDERLINE;
							lb_item[j][k].item_text = NULL;
							terrain = subtype;
							RepaintWindow( lb_sel[j], 0 );
						}
						break;
					}
					terrain = terrain[select[i]].sub;
				}
				*code = terrain->code; //Julias
				break;
			case WM_QUIT:
				quit = 1;
				break;
		}
		DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam); 
	}
	
	DestroyWindow( mainwin );

	return result;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -