📄 magictrainappview.cpp
字号:
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);
TRgb color1(0,0,0);
gc.SetPenColor(color1);
}
TPoint starttimepoint,stationnamepoint,mileagepoint,stoptimepoint;
switch (iWidth)
{
case 176:
starttimepoint.SetXY(4,base + j*18);
stationnamepoint.SetXY(37,base + j*18);
mileagepoint.SetXY(103,base + j*18);
stoptimepoint.SetXY(139,base + j*18);
break;
case 320:
starttimepoint.SetXY(4,base + j*18);
stationnamepoint.SetXY(37,base + j*18);
mileagepoint.SetXY(103,base + j*18);
stoptimepoint.SetXY(139,base + j*18);
break;
case 240:
starttimepoint.SetXY(5,base + j*28);
stationnamepoint.SetXY(50,base + j*28);
mileagepoint.SetXY(140,base + j*28);
stoptimepoint.SetXY(189,base + j*28);
break;
case 352:
starttimepoint.SetXY(8,base + j*36);
stationnamepoint.SetXY(74,base + j*36);
mileagepoint.SetXY(206,base + j*36);
stoptimepoint.SetXY(278,base + j*36);
break;
}
des16.SetLength(0);
if (iOTResult->operator [](i)->iStartTime == 9900)
des16.Append(r_stopstation->Des());
else {
TInt time = iOTResult->operator [](i)->iStartTime / 100;
if (time < 10)
des16.AppendNum(0);
des16.AppendNum(iOTResult->operator [](i)->iStartTime / 100);
des16.Append(_L(":"));
time = iOTResult->operator [](i)->iStartTime % 100;
if (time < 10)
des16.AppendNum(0);
des16.AppendNum(iOTResult->operator [](i)->iStartTime % 100);
}
gc.DrawText(des16,stoptimepoint);
gc.DrawText(iAppUi->iEngine->GetStationByStationID(iOTResult->operator [](i)->iStationID)->iName->Des(),stationnamepoint);
des16.SetLength(0);
des16.AppendNum(iOTResult->operator [](i)->iMileAge);
gc.DrawText(des16,mileagepoint);
des16.SetLength(0);
if (iOTResult->operator [](i)->iArriveTime == 8800)
des16.Append(r_startstation->Des());
else {
TInt time = iOTResult->operator [](i)->iArriveTime / 100;
if (time < 10)
des16.AppendNum(0);
des16.AppendNum(iOTResult->operator [](i)->iArriveTime / 100);
des16.Append(_L(":"));
time = iOTResult->operator [](i)->iArriveTime % 100;
if (time < 10)
des16.AppendNum(0);
des16.AppendNum(iOTResult->operator [](i)->iArriveTime % 100);
}
gc.DrawText(des16,starttimepoint);
}
CleanupStack::PopAndDestroy(7);
gc.DiscardFont();
}else if (iStatus == EAboutStatus) {
}
}
void CMagicTrainAppView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,const TDesC8& /*aCustomMessage*/ )
{
// No implementation required
}
// ----------------------------------------------------------------------------
// CRegistrationView::DoDeactivate()
// ----------------------------------------------------------------------------
//
void CMagicTrainAppView::DoDeactivate()
{
// No implementation required
}
// -----------------------------------------------------------------------------
// CMagicTrainAppView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CMagicTrainAppView::SizeChanged()
{
DrawNow();
}
TKeyResponse CMagicTrainAppView::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
{
if (aType == EEventKey)
{
switch(aKeyEvent.iCode)
{
case EKeyUpArrow:
if (iStatus == ETrainResultStatus)
{
TrainResultUp();
} else if (iStatus == EStationResultStatus)
{
StationResultUp();
}
else if (iStatus == EOneStationResultStatus)
{
OneStationResultUp();
}
return EKeyWasConsumed;
case EKeyDownArrow:
if (iStatus == ETrainResultStatus)
{
TrainResultDown();
} else if (iStatus == EStationResultStatus)
{
StationResultDown();
}else if (iStatus == EOneStationResultStatus)
{
OneStationResultDown();
}
return EKeyWasConsumed;
case EKeyDevice3:
if (iStatus == ETrainResultStatus) {
ShowTrainResultDetail();
return EKeyWasConsumed;
} else if (iStatus == EStationResultStatus) {
iAppUi->HandleCommandL(EStationTrainResult);
// ShowStationResultDetail();
return EKeyWasConsumed;
} else if (iStatus == EOneStationResultStatus)
{
iAppUi->HandleCommandL(EOneStationTrainResult);
return EKeyWasConsumed;
}else if (iStatus == EInitStatus) {
iAppUi->SetMenuBar(EShowMenu);
}
}
}
return EKeyWasNotConsumed;
}
void CMagicTrainAppView::ShowTrainResultDetail()
{
TBuf<256> head;
head.Append(iTrain->Des());
head.Append(_L(" "));
head.Append(iAppUi->iEngine->GetStationByStationID(iOTResult->operator [](0)->iStationID)->iName->Des());
head.Append(_L("-"));
head.Append(iAppUi->iEngine->GetStationByStationID(iOTResult->operator [](iOTResult->Count()-1)->iStationID)->iName->Des());
TBuf<256> msg;
HBufC* r_hardseat = StringLoader::LoadLC( R_HARDSEAT );
HBufC* r_softseat = StringLoader::LoadLC( R_SOFTSEAT );
HBufC* r_hardberth = StringLoader::LoadLC( R_HARDBERTH );
HBufC* r_softberth = StringLoader::LoadLC( R_SOFTBERTH );
msg.Append(r_hardseat->Des());
msg.Append(_L(":"));
msg.AppendNum(iOTResult->operator [](iTrainResultIndex)->iHardSeat);
msg.Append(_L(" "));
msg.Append(r_softseat->Des());
msg.Append(_L(":"));
msg.AppendNum(iOTResult->operator [](iTrainResultIndex)->iSoftSeat);
msg.Append(_L(" "));
msg.Append(r_hardberth->Des());
msg.Append(_L(":"));
msg.AppendNum(iOTResult->operator [](iTrainResultIndex)->iHardBerth);
msg.Append(_L(" "));
msg.Append(r_softberth->Des());
msg.Append(_L(":"));
msg.AppendNum(iOTResult->operator [](iTrainResultIndex)->iSoftBerth);
msg.Append(_L(" "));
CleanupStack::PopAndDestroy(4);
iAppUi->ShowTrainMsg(head,msg);
}
TBuf<20> CMagicTrainAppView::GetOneStationSelectTrain()
{
TInt i = 0;
TInt j = 0;
for (i =0;i<iOSResult->Count();i++)
{
if (j == iOneStationResultIndex)
{
break;
}
j = j +1;
}
return (iOSResult->operator [](i)->iTrain->iName->Des());
}
TBuf<20> CMagicTrainAppView::GetNowSelectTrain()
{
TInt i = 0;
TInt j = 0;
for (i =0;i<iTSSResult->Count();i++)
{
if (iTSSResult->operator [](i)->iDirection == iTSSResultDirection)
{
if (j == iStationResultIndex)
{
break;
}
j = j +1;
}
}
return (iTSSResult->operator [](i)->iTrain->iName->Des());
}
void CMagicTrainAppView::ShowStationResultDetail()
{
TBuf<256> head;
TBuf<256> msg;
TBuf<50> des16;
TInt i = 0;
TInt j = 0;
for (i =0;i<iTSSResult->Count();i++)
{
if (iTSSResult->operator [](i)->iDirection == iTSSResultDirection)
{
if (j == iStationResultIndex)
{
break;
}
j = j +1;
}
}
head.Append(iTSSResult->operator [](i)->iTrain->iName->Des());
head.Append(_L(" "));
head.Append(iAppUi->iEngine->GetStationByStationID(iTSSResult->operator [](i)->iStartOTResult->iStationID)->iName->Des());
head.Append(_L("-"));
head.Append(iAppUi->iEngine->GetStationByStationID(iTSSResult->operator [](i)->iArriveOTResult->iStationID)->iName->Des());
HBufC* r_shortstarttime = StringLoader::LoadLC( R_SHORTSTARTTIME );
HBufC* r_shortstoptime = StringLoader::LoadLC( R_SHORTSTOPTIME );
HBufC* r_mileage = StringLoader::LoadLC( R_MILEAGE );
HBufC* r_hardseat = StringLoader::LoadLC( R_HARDSEAT );
HBufC* r_softseat = StringLoader::LoadLC( R_SOFTSEAT );
HBufC* r_hardberth = StringLoader::LoadLC( R_HARDBERTH );
HBufC* r_softberth = StringLoader::LoadLC( R_SOFTBERTH );
msg.Append(r_shortstarttime->Des());
msg.Append(_L(" "));
des16.SetLength(0);
des16.AppendNum(iTSSResult->operator [](i)->iStartOTResult->iStartTime/100);
des16.Append(_L(":"));
des16.AppendNum(iTSSResult->operator [](i)->iStartOTResult->iStartTime%100);
msg.Append(des16);
msg.Append(_L(" "));
msg.Append(r_shortstoptime->Des());
msg.Append(_L(" "));
des16.SetLength(0);
des16.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iArriveTime/100);
des16.Append(_L(":"));
des16.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iArriveTime%100);
msg.Append(des16);
msg.Append(_L(" "));
msg.Append(r_mileage->Des());
msg.Append(_L(" "));
msg.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iMileAge -
iTSSResult->operator [](i)->iStartOTResult->iMileAge);
msg.Append(_L(" "));
msg.Append(r_hardseat->Des());
msg.Append(_L(" "));
msg.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iHardSeat -
iTSSResult->operator [](i)->iStartOTResult->iHardSeat);
msg.Append(_L(" "));
msg.Append(r_softseat->Des());
msg.Append(_L(" "));
msg.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iSoftSeat -
iTSSResult->operator [](i)->iStartOTResult->iSoftSeat);
msg.Append(_L(" "));
msg.Append(r_hardberth->Des());
msg.Append(_L(" "));
msg.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iHardBerth -
iTSSResult->operator [](i)->iStartOTResult->iHardBerth);
msg.Append(_L(" "));
msg.Append(r_softberth->Des());
msg.Append(_L(" "));
msg.AppendNum(iTSSResult->operator [](i)->iArriveOTResult->iSoftBerth -
iTSSResult->operator [](i)->iStartOTResult->iSoftBerth);
msg.Append(_L(" "));
CleanupStack::PopAndDestroy(7);
iAppUi->ShowTrainMsg(head,msg);
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -