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

📄 magictrainappview.cpp

📁 SYMBIAN S60 2ND列车时刻表软件
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    		
    		HBufC* r_normalslow = StringLoader::LoadLC( R_NORMALSLOW);
			HBufC* r_normalfast = StringLoader::LoadLC( R_NORMALFAST);
			HBufC* r_fast = StringLoader::LoadLC( R_FAST);
			HBufC* r_airnormal = StringLoader::LoadLC( R_AIRNORMAL);
			HBufC* r_airfast = StringLoader::LoadLC( R_AIRFAST) ;
			HBufC* r_airveryfast = StringLoader::LoadLC( R_AIRVERYFAST) ;
			HBufC* r_airnormalslow = StringLoader::LoadLC( R_AIRNORMALSLOW) ;
			HBufC* r_dongchezu = StringLoader::LoadLC(R_DONGCHEZU);
			
			HBufC* r_totalfind = StringLoader::LoadLC( R_TOTALFIND);
			HBufC* r_train = StringLoader::LoadLC( R_TRAIN);
			HBufC* r_type = StringLoader::LoadLC( R_TYPE) ;
			HBufC* r_starttime = StringLoader::LoadLC( R_STARTTIME) ;
			HBufC* r_stoptime = StringLoader::LoadLC( R_STOPTIME) ;
			
    		
    		TInt k = 0;
    		TBuf<100> str;
			for (TInt i=0;i<iTSSResult->Count();i++) {
				if (iTSSResult->operator [](i)->iDirection == iTSSResultDirection) {
					k=k+1;
				}
			}
    		des16.SetLength(0);
    		des16.AppendNum(k);
    		gc.DrawText(des16,trainsumpoint);
    		
    		gc.DrawText(iStation1->Des(),station1point);
		    gc.DrawText(iStation2->Des(),station2point);
		    
		    gc.DrawText(r_totalfind->Des(),totolfindpoint);
		    gc.DrawText(r_train->Des(),trainfpoint);
		    gc.DrawText(r_train->Des(),trainpoint);
		    gc.DrawText(r_type->Des(),typepoint);
		    gc.DrawText(r_starttime->Des(),starttimepoint);
		    gc.DrawText(r_stoptime->Des(),stoptimepoint);
		    
			TRgb color(153,255,255);
			TRgb color1(0,0,0);
			TRgb color2(255,255,255);
			TInt sum = 0;
			
			
    		for (TInt i=0;i<iTSSResult->Count();i++) {
//    			CnvUtfConverter::ConvertToUnicodeFromUtf8(des16,iTrainWay->iTrainStationArray->operator [](i).iStartTime->Des());
				if (iTSSResult->operator [](i)->iDirection == iTSSResultDirection) {

					TInt j = sum - iStationResultStart;
					if ( j > 6 ) break;
					if ( j < 0 ) {
						sum = sum +1;
						continue;
					} 
					if (sum == iStationResultIndex) {
						
						
						gc.SetBrushColor(color);
						CWindowGc::TBrushStyle brushstyle = CWindowGc::ESolidBrush;
						gc.SetBrushStyle(brushstyle);
						gc.SetPenColor(color);
						TRect rect1,rect2,rect3,rect4;
						switch (iWidth) {
							case 176:
								rect1.SetRect(TPoint(3,59+18*j),TSize(32,17));
								rect2.SetRect(TPoint(36,59+18*j),TSize(65,17));
								rect3.SetRect(TPoint(102,59+18*j),TSize(34,17));
								rect4.SetRect(TPoint(137,59+18*j),TSize(36,17));
								break;
							case 320:
								rect1.SetRect(TPoint(3,59+18*j),TSize(32,17));
								rect2.SetRect(TPoint(36,59+18*j),TSize(65,17));
								rect3.SetRect(TPoint(102,59+18*j),TSize(34,17));
								rect4.SetRect(TPoint(137,59+18*j),TSize(36,17));
								break;
							case 240:
								rect1.SetRect(TPoint(4,89+28*j),TSize(44,28));
								rect2.SetRect(TPoint(49,89+28*j),TSize(88,28));
								rect3.SetRect(TPoint(139,89+28*j),TSize(46,28));
								rect4.SetRect(TPoint(187,89+28*j),TSize(49,28));
								break;
							case 352:
								rect1.SetRect(TPoint(6,118+36*j),TSize(64,34));
								rect2.SetRect(TPoint(72,118+36*j),TSize(130,34));
								rect3.SetRect(TPoint(204,118+36*j),TSize(68,34));
								rect4.SetRect(TPoint(274,118+36*j),TSize(71,34));
								break;
						}
						gc.DrawRect(rect1);
						gc.DrawRect(rect2);
						gc.DrawRect(rect3);						
						gc.DrawRect(rect4);						
						gc.SetPenColor(color1);
						
					}
					
					TBuf<50> trainname;
					//des16.SetLength(0);
					trainname.Append(iTSSResult->operator [](i)->iTrain->iName->Des());
					if (trainname.Length()<6) {
						switch (iWidth) {
							case 176:
								gc.DrawText(trainname,TPoint(4,base + j*18));
								break;
							case 320:
								gc.DrawText(trainname,TPoint(4,base + j*18));
								break;
							case 240:
								gc.DrawText(trainname,TPoint(6,base + j*28));
								break;
							case 352:
								gc.DrawText(trainname,TPoint(8,base + j*36));
								break;
						}
					}else {
						TInt t = trainname.Locate('/');
						if (t>0) {
							TBuf<10> tmp1 = trainname.Left(t);
							TBuf<10> tmp2 = trainname.Right(trainname.Length()-t-1);
						//	gc.SetBrushColor(color1);
							gc.DiscardFont();
							gc.UseFont(font1);
							switch (iWidth) {
								case 176:
									gc.DrawText(tmp1,TRect(TPoint(4,base + j*18 -14),TSize(28,8)),7);
									gc.DrawText(tmp2,TRect(TPoint(4,base + j*18 - 6),TSize(28,8)),7);
									break;
								case 320:
									gc.DrawText(tmp1,TRect(TPoint(4,base + j*18 -14),TSize(28,8)),7);
									gc.DrawText(tmp2,TRect(TPoint(4,base + j*18 - 6),TSize(28,8)),7);
									break;
								case 240:
									gc.DrawText(tmp1,TRect(TPoint(6,base + j*28 -19),TSize(38,11)),10);
									gc.DrawText(tmp2,TRect(TPoint(6,base + j*28 - 8),TSize(38,11)),10);
									break;
								case 352:
									gc.DrawText(tmp1,TRect(TPoint(8,base + j*36 -23),TSize(56,16)),12);
									gc.DrawText(tmp2,TRect(TPoint(8,base + j*36 - 10),TSize(56,16)),12);
									break;
							}
							gc.UseFont(font);
						}
					}
					if (sum == iStationResultIndex) {
						gc.SetBrushColor(color2);
					}
					TPoint typepoint,starttimepoint,endtimepoint;
					switch (iWidth)
					{
						case 176:
							typepoint.SetXY(37,base + j*18);
							starttimepoint.SetXY(103,base + j*18);
							endtimepoint.SetXY(139,base + j*18);
							break;
						case 320:
							typepoint.SetXY(37,base + j*18);
							starttimepoint.SetXY(103,base + j*18);
							endtimepoint.SetXY(139,base + j*18);
							break;
						case 240:
							typepoint.SetXY(50,base + j*28);
							starttimepoint.SetXY(140,base + j*28);
							endtimepoint.SetXY(189,base + j*28);
							break;
						case 352:
							typepoint.SetXY(74,base + j*36);
							starttimepoint.SetXY(206,base + j*36);
							endtimepoint.SetXY(278,base + j*36);
							break;
					}
					switch (iTSSResult->operator [](i)->iTrain->iType) {
						case 1 :
							gc.DrawText(r_normalslow->Des(),typepoint);
							break;
						case 2 :
							gc.DrawText(r_airnormalslow->Des(),typepoint);
							break;
						case 3 :
							gc.DrawText(r_normalfast->Des(),typepoint);
							break;
						case 4 :
							gc.DrawText(r_airnormal->Des(),typepoint);
							break;
						case 5 :
							gc.DrawText(r_fast->Des(),typepoint);
							break;
						case 6 :
							gc.DrawText(r_airfast->Des(),typepoint);
							break;
						case 7 :
							gc.DrawText(r_airveryfast->Des(),typepoint);
							break;
						case 8 :
							gc.DrawText(r_dongchezu->Des(),typepoint);
							break;
					}
	    			//gc.DrawText(iStationWay->operator [](i).iStationName->Des(),TPoint(37,base + j*18));
	    			
					des16.SetLength(0);
					TInt time = iTSSResult->operator [](i)->iStartOTResult->iStartTime / 100;
					if (time < 10)
						des16.AppendNum(0);
					des16.AppendNum(iTSSResult->operator [](i)->iStartOTResult->iStartTime / 100);
					des16.Append(_L(":"));
					time = iTSSResult->operator [](i)->iStartOTResult->iStartTime % 100;
					if (time < 10)
						des16.AppendNum(0);
					des16.AppendNum(iTSSResult->operator [](i)->iStartOTResult->iStartTime % 100);
	    			gc.DrawText(des16,starttimepoint);
					des16.SetLength(0);
					time = iTSSResult->operator [](i)->iStartOTResult->iArriveTime / 100;
					if (time < 10)
						des16.AppendNum(0);
					des16.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iArriveTime / 100);
					des16.Append(_L(":"));
					time = iTSSResult->operator [](i)->iStartOTResult->iArriveTime % 100;
					if (time < 10)
						des16.AppendNum(0);
					des16.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iArriveTime % 100);
	    			gc.DrawText(des16,endtimepoint);
 					sum = sum +1;
    			}
    		}
  			
    		CleanupStack::PopAndDestroy(13);
    		gc.DiscardFont();
    	}else if (iStatus == ETrainResultStatus) {
    		
    		gc.BitBlt(TPoint(0,0),iBg2);
    		CFont* font;
//    		font = iCoeEnv->NormalFont();
    		MGraphicsDeviceMap* devicemap;
			TZoomFactor zoomfactor;		    
			zoomfactor.SetGraphicsDeviceMap(iCoeEnv->ScreenDevice());
			zoomfactor.SetZoomFactor(TZoomFactor::EZoomOneToOne);
			devicemap = &zoomfactor;
    		TFontSpec fontSpec;
			TFontSpec fontSpec1;
			switch (iWidth) {
				case 176:
		    		fontSpec = TFontSpec::TFontSpec(_L("CombinedChinesePlain12"),FontUtils::TwipsFromPoints(7));
					devicemap->GetNearestFontInTwips(font,fontSpec);
					break;
				case 320:
		    		fontSpec = TFontSpec::TFontSpec(_L("CombinedChinesePlain12"),FontUtils::TwipsFromPoints(5));
					devicemap->GetNearestFontInTwips(font,fontSpec);
					break;					
				case 240:
					fontSpec = TFontSpec::TFontSpec(_L("CombinedChinesePlain12"),FontUtils::TwipsFromPoints(7));
					devicemap->GetNearestFontInTwips(font,fontSpec);
					break;
				case 352:
					fontSpec = TFontSpec::TFontSpec(_L("CombinedChinesePlain12"),FontUtils::TwipsFromPoints(7));
					devicemap->GetNearestFontInTwips(font,fontSpec);
					break;
			}
			
    		//gc.UseFont(iCoeEnv->NormalFont());
    		gc.UseFont(font);
    		TBuf<50> des16;
    		//CnvUtfConverter::ConvertToUnicodeFromUtf8(des16,iTrainWay->iTrainName->Des());
    		TInt base;
    		TPoint traintpoint,trainsumpoint,station1point,station2point,station1tpoint,station2tpoint;
    		TPoint starttimepoint,stoptimepoint,milagepoint,stationpoint;
			switch (iWidth) {
    			case 176:
    				base = 73;
    				traintpoint.SetXY(55,17);
    				station1tpoint.SetXY(4,36);
    				station1point.SetXY(28,36);
    				station2tpoint.SetXY(80,36);
    				station2point.SetXY(111,36);
    				trainsumpoint.SetXY(80,17);
    				starttimepoint.SetXY(144,54);
    				stoptimepoint.SetXY(7,54);
    				milagepoint.SetXY(105,54);
    				stationpoint.SetXY(54,54);
    				break;
    			case 320:
    				base = 73;
    				traintpoint.SetXY(50,17);
    				station1tpoint.SetXY(4,36);
    				station1point.SetXY(28,36);
    				station2tpoint.SetXY(89,36);
    				station2point.SetXY(115,36);
    				trainsumpoint.SetXY(75,17);
    				starttimepoint.SetXY(144,54);
    				stoptimepoint.SetXY(7,54);
    				milagepoint.SetXY(105,54);
    				stationpoint.SetXY(54,54);
    				break;
    			case 240:
    				base = 112; 
    				traintpoint.SetXY(60,23);
    				station1tpoint.SetXY(5,55);
    				station1point.SetXY(44,55);
    				station2tpoint.SetXY(120,55);
    				station2point.SetXY(156,55);
    				trainsumpoint.SetXY(100,23);
    				starttimepoint.SetXY(196,80);
    				stoptimepoint.SetXY(9,80);
    				milagepoint.SetXY(140,80);
    				stationpoint.SetXY(74,80);    				
    				break;
    			case 352:
    				base = 146;
    				traintpoint.SetXY(90,34);
    				station1tpoint.SetXY(8,72);
    				station1point.SetXY(56,72);
    				station2tpoint.SetXY(170,72);
    				station2point.SetXY(222,72);
					trainsumpoint.SetXY(140,34);
					starttimepoint.SetXY(288,108);
    				stoptimepoint.SetXY(14,108);
    				milagepoint.SetXY(210,108);
    				stationpoint.SetXY(90,108);
    				break;
    		}
  			HBufC* r_startstation = StringLoader::LoadLC( R_STARTSTATION );
			HBufC* r_stopstation = StringLoader::LoadLC( R_STOPSTATION );
			HBufC* r_train = StringLoader::LoadLC( R_TRAIN );
			HBufC* r_starttime = StringLoader::LoadLC( R_STARTTIME );
			HBufC* r_stoptime = StringLoader::LoadLC( R_STOPTIME );
			HBufC* r_station = StringLoader::LoadLC( R_STATION );
			HBufC* r_mileage = StringLoader::LoadLC( R_MILEAGE );
			
    		gc.DrawText(iTrain->Des(),trainsumpoint);
    		gc.DrawText(r_startstation->Des(),station1tpoint);
    		gc.DrawText(r_stopstation->Des(),station2tpoint);
    		gc.DrawText(r_train->Des(),traintpoint);
    		
    		gc.DrawText(r_starttime->Des(),starttimepoint);
    		gc.DrawText(r_stoptime->Des(),stoptimepoint);
    		gc.DrawText(r_station->Des(),stationpoint);
    		gc.DrawText(r_mileage->Des(),milagepoint);
    		
    		gc.DrawText(iAppUi->iEngine->GetStationByStationID(iOTResult->operator [](0)->iStationID)->iName->Des(),station1point);
    		gc.DrawText(iAppUi->iEngine->GetStationByStationID(iOTResult->operator [](iOTResult->Count()-1)->iStationID)->iName->Des(),station2point);
    		
    		
    		for (TInt i=iTrainResultStart;i<iOTResult->Count();i++) {
//    			CnvUtfConverter::ConvertToUnicodeFromUtf8(des16,iTrainWay->iTrainStationArray->operator [](i).iStartTime->Des());
				TInt j = i - iTrainResultStart;
				if ( i - iTrainResultStart > 6 ) break;
				if (i == iTrainResultIndex) {
					
					TRgb color(153,255,255);

⌨️ 快捷键说明

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