void CMissionHighscoresView::ChildViewDrawMethod()
{
	iGraphicsEngine->SetClearColour(KColourBlack);
	iGraphicsEngine->ClearScreen();

	//Background for Stats
	iDescriptionBackgroundTexture->DrawArrays();

	//draw Highscores
	iGraphicsFont->SetColour(KColourBlack);

	TPoint lTableLocation (70, 340 + iTableYOffset);
	DrawCategories(lTableLocation);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank1, 1);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank2, 2);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank3, 3);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank4, 4);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank5, 5);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank6, 6);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank7, 7);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank8, 8);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank9, 9);
	DrawRow(lTableLocation, iMission->HighscoreTable.Rank10, 10);


	//draw Background Texture
	iBackgroundTexture->DrawArrays();

	//draw Mission Status
	iGraphicsFont->SetFont(iFontForTitle);
	iGraphicsFont->SetColour(KColourDarkRed);
	DrawCenteredString(TPoint(0,610), iFontForTitle, iStringTitle, 1024, 50);

	//draw Mission Name
	iGraphicsFont->SetFont(iFontForMissionName);
	iGraphicsFont->SetColour(KColourDarkRed);
	DrawCenteredString(TPoint(200,420), iFontForMissionName, iStringMissionName, 625, 40);

	//draw Controls
	iButtonBack->Draw();
	iScrollBar->Draw();
	iTouchSurface->Draw();
}
Beispiel #2
0
void CRTabsCtrl::OnDraw(
			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
	if (m_bInit)
	{
		m_TabUpDC.CreateCompatibleDC(pdc);
		m_TabDownDC.CreateCompatibleDC(pdc);
		m_TabUp.LoadBitmap(IDB_TABUP);
		m_TabDown.LoadBitmap(IDB_TABDOWN);	
		m_TabUpDC.SelectObject(m_TabUp);
		m_TabDownDC.SelectObject(m_TabDown);
		BITMAP bitmap;
		m_TabUp.GetBitmap(&bitmap);
		m_TabUpWidth=bitmap.bmWidth;
		m_TabUpHeight=bitmap.bmHeight;
		m_TabDown.GetBitmap(&bitmap);
		m_TabDownWidth=bitmap.bmWidth;
		m_TabDownHeight=bitmap.bmHeight;
		m_bInit=FALSE;		   
	}
	int count=m_textList.GetCount();
	if (count==0) return;
//	*(char*)0=0;
	// TODO: Replace the following code with your own drawing code.
	CDC offscreenDC;
	VERIFY(offscreenDC.CreateCompatibleDC(pdc));
	CBitmap bitmap;
	CBitmap* pOldBitmap;
	VERIFY(bitmap.CreateCompatibleBitmap(pdc,rcBounds.Width(),rcBounds.Height()));
	pOldBitmap=offscreenDC.SelectObject(&bitmap);
//	offscreenDC.FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(BLACK_BRUSH)));
	// pre calculate the tab positions
	POSITION position = m_textList.GetHeadPosition();
	CRect rect;
	this->GetParent()->GetClientRect(rect);
	m_rectList.RemoveAll();
	m_tabList.RemoveAll();
	char* text;
    offscreenDC.SetTextAlign(TA_LEFT | TA_TOP);
    offscreenDC.SetBkMode(TRANSPARENT);
    offscreenDC.SetTextColor(TranslateColor(GetForeColor()));
    CFont* pOldFont;
	if (m_hWnd) pOldFont = offscreenDC.SelectObject((CFont*)this->GetParent()->SendMessage(WM_GETGLOBALFONT,m_FontNum,NULL));
	else pOldFont = offscreenDC.GetCurrentFont();
	int width;
	int start=0;
	if (m_bHorzAlign)
	{
		int finish;
		float seperation;
		int total=0;
		int laststart;
		int lastfinish;
		float lastseperation;
		BOOL lastrow=FALSE;
		BOOL notreallylastrow=FALSE;
		int row=0;
		for (int x=0;x<count;x++)
		{
			if (x==m_iCurrentSelection) lastrow=TRUE;
			text=m_textList.GetNext(position);
			width=offscreenDC.GetTextExtent(text).cx+15; // 15 is minimum seperation between text
			total+=width;
			if (total>rect.Width() || x==count-1)
			{
				// decide whether to put this tab on the next row...
				// doesnt happen if it is the only tab on the row
				if (x>start && total>rect.Width()) //|| (x-start)<3))
				{
//					finish=x-1;
//					total-=width;
					if (x==m_iCurrentSelection) notreallylastrow=TRUE;
					x--;
					if (position==NULL) position=m_textList.GetTailPosition();
					else m_textList.GetPrev(position);
					total-=width;
				}
//				else finish=x;
				finish=x;
				seperation=(float)(rect.Width()-total+(15*(finish-start+1)))/(float)(finish-start+1);
				if (lastrow==FALSE || notreallylastrow==TRUE)
					{
					DrawRow(seperation,start,finish,&offscreenDC,row,rect.Width(),FALSE);
					notreallylastrow=FALSE;
					}
				else
				{
					laststart=start;
					lastfinish=finish;
					lastseperation=seperation;
					lastrow=FALSE;
					row--;
				}
				total=0;
				start=x+1;
				row++;
			}
		}
		DrawRow(lastseperation,laststart,lastfinish,&offscreenDC,row,rect.Width(),TRUE);
	}
	else
	{
		// Draw vertical tabs.
		long widest;
		widest=CalcWidestWord();
		CRect rect2;
		this->GetClientRect(rect2);
//		widest=rect2.Width();
//		TRACE1("Measured Width: %d\n",widest);
		int y=0;
		char word[30];
		int startpos;
		BOOL NewTab;
		int oldy;
		int starty;
		for (int z=0;z<count;z++)
		{
			NewTab=TRUE;
			text=m_textList.GetNext(position);
			// split into component words
			start=0;
			startpos=2;
			starty=y;
			for (int x=0;x<(int)strlen(text)+1;x++) // includes terminating null character
			{
				if (text[x]==' ' || text[x]==NULL)
				{
					strncpy(word,text+start,min(x-start+1,30));
					word[min(x-start+1,30)]=NULL;
					start=x+1;
					width=offscreenDC.GetTextExtent(word).cx;
					if (NewTab)
					{
						if (z==m_iCurrentSelection)
						{
							DrawIconEx(offscreenDC.m_hDC,widest-400,y+2,m_hHighTabIcon,400,30,NULL,NULL,DI_NORMAL);
							offscreenDC.MoveTo(0,y);
							offscreenDC.LineTo(widest-15,y);
							offscreenDC.MoveTo(0,y+1);
							offscreenDC.LineTo(widest-10,y+1);
						}
						else DrawIconEx(offscreenDC.m_hDC,widest-402,y+2,m_hLowTabIcon,400,30,NULL,NULL,DI_NORMAL);
					}
					else
					{
						if (width+startpos>widest-15)
						{
							// Draw it at start of next line
							y+=30;
							startpos=2;
						}
						if (y!=oldy)
						{
							if (z==m_iCurrentSelection) DrawIconEx(offscreenDC.m_hDC,widest-400,y+2,m_hHighContinueIcon,400,30,NULL,NULL,DI_NORMAL);
							else DrawIconEx(offscreenDC.m_hDC,widest-402,y+2,m_hLowContinueIcon,400,30,NULL,NULL,DI_NORMAL);
						}
					}
					oldy=y; // oldy indicates that the background tab icon has been drawn for this line
					if (z==m_iCurrentSelection)
					{
						offscreenDC.ExtTextOut(startpos+2,y,ETO_CLIPPED,CRect(0,y,widest-15,y+30),word,NULL);
						if (width+startpos+2>widest-15) offscreenDC.TextOut(widest-12,y,"...");
					}
					else
					{
						offscreenDC.ExtTextOut(startpos,y+2,ETO_CLIPPED,CRect(0,y+2,widest-15,y+22),word,NULL);
						if (width+startpos>widest-15) offscreenDC.TextOut(widest-14,y+2,"...");
						offscreenDC.MoveTo(0,y+2);
						offscreenDC.LineTo(0,y+22);
						offscreenDC.MoveTo(1,y+2);
						offscreenDC.LineTo(1,y+22);
					}
					NewTab=FALSE;
					startpos+=width;
				}
			}
			y+=30;
			if (z<count-1) m_rectList.AddTail(CRect(0,starty,widest,y));
			else m_rectList.AddTail(CRect(0,starty,widest,INT_MAX));
			m_tabList.AddTail(z);
			if (z==count-1) // if at end fill remaining area with blank tab
			{
				while (y<rect2.Height())
				{
					if (z==m_iCurrentSelection) DrawIconEx(offscreenDC.m_hDC,widest-400,y+2,m_hHighContinueIcon,400,30,NULL,NULL,DI_NORMAL);
					else DrawIconEx(offscreenDC.m_hDC,widest-402,y+2,m_hLowContinueIcon,400,30,NULL,NULL,DI_NORMAL);
					y+=30;
				}
			}
		}
	}
	VERIFY(pdc->BitBlt(0,0,rcBounds.right-rcBounds.left,rcBounds.bottom-rcBounds.top,&offscreenDC,
					0,0,SRCCOPY)); // flips offscreen dc to real dc
	// select out any objects that were selected in
	offscreenDC.SelectObject(pOldFont);
    offscreenDC.SelectObject(pOldBitmap);
	// then delete the dc
	offscreenDC.DeleteDC();
}
// CashListView message handlers
void CashListView::OnPaint() {  
  CRect clientRect;
  GetClientRect(&clientRect);
  int clientWidth = clientRect.Width();

  BufferredPaintDC dc(this);

  dc.FillSolidRect(clientRect, RGB(255, 255, 255));

  CFont *oldFont = dc.SelectObject(GuiResources::GetInstance()->GetFont(GuiResources::FONT_NORMAL));
  dc.SetTextColor(RGB(0, 0, 0));
  dc.SetBkMode(TRANSPARENT);

  CString text[6];
  int width[6];
  text[0] = _T("序号"); // __XXXX__
  width[0] = 8 * clientWidth / 49;
  text[1] = _T("面额"); // __XXX__
  width[1] = 7 * clientWidth / 49;
  text[2] = _T("版本"); // __XX__
  width[2] = 6 * clientWidth / 49;
  text[3] = _T("结果"); // __XXX__
  width[3] = 7 * clientWidth / 49;
  text[4] = _T("方向"); // __X__
  width[4] = 5 * clientWidth / 49;
  text[5] = _T("冠字号"); // __XXXXXXXXXXXX__  
  width[5] = 16 * clientWidth / 49;

  int y = clientRect.top;
  CRect itemRect(clientRect.left, y, clientRect.right, y + itemHeight_);
  dc.FillSolidRect(itemRect, RGB(248, 248, 248));
  DrawRow(&dc, y, 0, text, width);

  if (monitor_ != NULL) {
    int count = monitor_->Freeze();
    for (int i = topItem_; i < count; i++) {
      y += itemHeight_;
      if (y > clientRect.bottom) {
        break;
      }
      itemRect.OffsetRect(0, itemHeight_);
      
      if (i == selectedItem_) {        
        dc.FillSolidRect(itemRect, GetFocus() == this ? RGB(54, 133, 214) : RGB(128, 128, 128));
        dc.SetTextColor(RGB(255, 255, 255));
      } else {
        if (((i + 1) & 1) == 0) {
          dc.FillSolidRect(itemRect, RGB(248, 248, 248));
        }
        dc.SetTextColor(RGB(0, 0, 0));
      }

      Cash *cash = monitor_->GetCash(i);
      if (cash->Valid(Cash::VALID_INFO)) {
        text[0].Format(_T("%d"), cash->Id());
        if (cash->GetDenomination() <= 0) {
          text[1] = _T("?");
        } else {
          text[1].Format(_T("%d"), cash->GetDenomination());
        }
        if (cash->GetVersion() <= 0) {
          text[2] = _T("?");
        } else {
          text[2].Format(_T("%02d"), cash->GetVersion());
        }
        text[3].Format(_T("%03d"), cash->GetError());
        if (cash->GetDirection() <= 0) {
          text[4] = _T("?");
        } else {
          text[4].Format(_T("%d"), cash->GetDirection());
        }
        text[5] = cash->GetSN();
        DrawRow(&dc, y, i + 1, text, width);
      }
    }
    monitor_->Unfreeze();
  }

  dc.SelectObject(oldFont);
}
Beispiel #4
0
unsigned long PrP0(HWND Window,HMSG Message,long Param1,long Param2)
{
    int i,saveI,j;
    int x0,y0,x1,y1,dx,dy;
    static int LastX,LastY;
    float Midf;
    /*
    x0=MouseXToWinX(Param1>>16);
    y0=MouseYToWinY(Param1&0xffff);
    x1=MouseXToWinX(Param2>>16);
    y1=MouseYToWinY(Param2&0xffff);
    */
    x0=(Param1>>16);
    y0=(Param1&0xffff);
    x1=(Param2>>16);
    y1=(Param2&0xffff);
    switch (Message)
    {
        case MOUSELEFTDOUBLE:
                i=IsCurrentPage(x0,y0);
                if (i>0)
                  switch(i)
                  {
                    case 13:
                    case 14:
                            x0=MouseXToWinX(x0);
                            ColLead[ColLeadNum++]=SCRscaleX*x0;
                            for (i=0;i<ColLeadNum-1;i++)
                              if (fabs(ColLead[i]-ColLead[ColLeadNum-1])<10.0f)
                                {
                                    ColLeadNum--;
                                    break;
                                }
                            REFLASH;
                            break;
                    case 11:
                    case 12:
                            y0=MouseYToWinY(y0);
                            RowLead[RowLeadNum++]=SCRscaleY*y0;
                            for (i=0;i<RowLeadNum-1;i++)
                              if (fabs(RowLead[i]-RowLead[RowLeadNum-1])<10.0f)
                                {
                                    RowLeadNum--;
                                    break;
                                }
                            REFLASH;
                            break;
                    case 21:                                  //Edit  Col
                            break;
                    case 22:                                  //Edit  Row
                            break;
                  }

                break;

        case MOUSERIGHTDOUBLE:
                i=IsCurrentPage(x0,y0);
                if (i>0)
                  switch(i)
                  {
                    case 21:                                  //Edit  Row
                            for (i=CurrRow;i<RowLeadNum-1;i++) RowLead[i]=RowLead[i+1];
                            RowLeadNum--;
                            REFLASH;
                            break;
                    case 22:                                  //Edit  Col
                            for (i=CurrCol;i<ColLeadNum-1;i++) ColLead[i]=ColLead[i+1];
                            ColLeadNum--;
                            REFLASH;
                            break;
                  }
                break;
        case MOUSEMOVE:
                i=IsCurrentPage(x0,y0);
                if (i>=0)
                 switch (i)
                    {
                        case 11:
                        case 12:
                        case 13:
                        case 14:
                                MouseSetGraph(FINGERMOUSE2);
                                MouseStat=0;
                                break;
                        case 0:
                                MouseSetGraph(MOVINGMOUSE);
                                MouseStat=5;
                                break;
                        case 1:
                        case 2:
                        case 22:
                                MouseSetGraph(HRESIZEMOUSE);
                                MouseStat=i;
                                break;
                        case 3:
                        case 4:
                        case 21:
                                MouseSetGraph(VRESIZEMOUSE);
                                MouseStat=i;
                                break;
                        default:
                                MouseSetGraph(ARRAWMOUSE);
                                MouseStat=0;
                    }
                else
                {
                 MouseSetGraph(ARRAWMOUSE);
                 MouseStat=0;
                }
                
                x0=MouseXToWinX(x0);
                y0=MouseYToWinY(y0);
                if (x0>=0&&y0>=0&&x0<=mXw&&y0<=mYw)
                {
                    char ss[30];
                    sprintf(ss,"(%6.1f ,%6.1f)",SCRscaleX*x0,SCRscaleY*y0);
                    Window=WindowGetFather(Window);
                    x0=WindowGetLeft(Window);
                    y0=WindowGetTop(Window);
                    //setwritemode(COPY_PUT);
                    DisplayString(ss,x0+360,y0+5,15,1);
                    //setwritemode(COPY_PUT);
                }

                break;

        case MOUSELEFTDROP:
                switch (MouseStat)
                 {
                    case 22:
                            dx=x1-LastX;
                            DrawCol(LEADCOLOR);
                            Midf=(float)dx*SCRscaleX;
                            ColLead[CurrCol] += Midf;
                            DrawCol(LEADCOLOR);
                            LastX=x1;
                            LastY=y1;
                            break;
                    case 21:
                            dy=y1-LastY;
                            DrawRow(LEADCOLOR);
                            Midf=(float)dy*SCRscaleY;
                            RowLead[CurrRow] += Midf;
                            DrawRow(LEADCOLOR);
                            LastX=x1;
                            LastY=y1;
                            break;
                    case 1:
                            dx=x1-LastX;
                            DrawCurr(CURRCOLOR);
                            Midf=(float)dx*SCRscaleX;
                            PG.PageBlock[CurrentBlock].Xoffset += Midf;

                            if (PG.PageBlock[CurrentBlock].Rotate&1)
                            PG.PageBlock[CurrentBlock].Yscale -= Midf/PageH;
                               else
                            PG.PageBlock[CurrentBlock].Xscale -= Midf/PageW;

                            DrawCurr(CURRCOLOR);
                            SetPrintPara1();
                            SetPrintPara2();
                            LastX=x1;
                            LastY=y1;
                            break;
                    case 2:
                            dx=x1-LastX;
                            DrawCurr(CURRCOLOR);
                            Midf=(float)dx*SCRscaleX;
                            //PG.PageBlock[CurrentBlock].Xoffset += Midf;

                            if (PG.PageBlock[CurrentBlock].Rotate&1)
                            PG.PageBlock[CurrentBlock].Yscale += Midf/PageH;
                               else
                            PG.PageBlock[CurrentBlock].Xscale += Midf/PageW;

                            DrawCurr(CURRCOLOR);
                            //SetPrintPara1();
                            SetPrintPara2();
                            LastX=x1;
                            LastY=y1;
                            break;
                    case 3:
                            dy=y1-LastY;
                            DrawCurr(CURRCOLOR);
                            Midf=(float)dy*SCRscaleY;
                            PG.PageBlock[CurrentBlock].Yoffset += Midf;

                            if (PG.PageBlock[CurrentBlock].Rotate&1)
                            PG.PageBlock[CurrentBlock].Xscale -= Midf/PageW;
                               else
                            PG.PageBlock[CurrentBlock].Yscale -= Midf/PageH;

                            DrawCurr(CURRCOLOR);
                            SetPrintPara1();
                            SetPrintPara2();
                            LastX=x1;
                            LastY=y1;
                            break;
                    case 4:
                            dy=y1-LastY;
                            DrawCurr(CURRCOLOR);
                            Midf=(float)dy*SCRscaleY;
                            //PG.PageBlock[CurrentBlock].Yoffset += Midf;

                            if (PG.PageBlock[CurrentBlock].Rotate&1)
                            PG.PageBlock[CurrentBlock].Xscale += Midf/PageW;
                               else
                            PG.PageBlock[CurrentBlock].Yscale += Midf/PageH;

                            DrawCurr(CURRCOLOR);
                            //SetPrintPara1();
                            SetPrintPara2();
                            LastX=x1;
                            LastY=y1;
                            break;
                    case 5:
                            dx=x1-LastX;
                            dy=y1-LastY;
                            DrawCurr(CURRCOLOR);
                            PG.PageBlock[CurrentBlock].Xoffset += (float)dx*SCRscaleX;
                            PG.PageBlock[CurrentBlock].Yoffset += (float)dy*SCRscaleY;
                            DrawCurr(CURRCOLOR);
                            SetPrintPara1();
                            LastX=x1;
                            LastY=y1;
                            break;
                 }

                x0=MouseXToWinX(x1);
                y0=MouseYToWinY(y1);
                if (x0>=0&&y0>=0&&x0<=mXw&&y0<=mYw)
                {
                    char ss[30];
                    sprintf(ss,"(%6.1f ,%6.1f)",SCRscaleX*x0,SCRscaleY*y0);
                    Window=WindowGetFather(Window);
                    x0=WindowGetLeft(Window);
                    y0=WindowGetTop(Window);
                    //setwritemode(COPY_PUT);
                    DisplayString(ss,x0+360,y0+5,15,1);
                    //setwritemode(COPY_PUT);
                }
                break;
        case MOUSELEFTUP:
                /*
                if (MouseStat)
                {
                  MouseStat=0;
                  REFLASH;
                }
                */
                break;
        case WINDOWINIT:
                PrintCutWin[0]=Window;
                //InitPrintCut();
                break;
        case MOUSELEFTDOWN:
                
                GetPrintPara();
                SetPrintPara();

                DrawCurr(0);

                if (PG.Blocks>0)
                {
                  saveI=CurrentBlock;
                  for (i=0;i<PG.Blocks;i++)
                  {
                    if (i==saveI) continue;
                    CurrentBlock=i;
                    DrawCurr(EXISTCOLOR);
                  }

                  CurrentBlock=saveI;
                  DrawCurr(CURRCOLOR);
                }

                if (Param1==-1l&&Param2==-1l) break;     //REFLASH
                LastX=x0;
                LastY=y0;
                i=IsCurrentPage(x0,y0);
                if (i<0||i>5)
                 {
                    GetPrintPara();
                    saveI=CurrentBlock;
                    for (i=0;i<PG.Blocks;i++)
                      {
                        CurrentBlock=i;
                        j=IsCurrentPage(x0,y0);
                        if (j>=0&&j<=5)
                        {
                            MouseStat=5;
                            MouseSetGraph(MOVINGMOUSE);
                            SetPrintPara();
                            ListSetCurrent(WindowList(PrintCutWin[wPAGEADDWIN]),i);
                            MessageGo(PrintCutWin[wPAGEADDWIN],ITEMSELECT,0l,0l);
                            //REFLASH;
                            break;
                        }
                        else
                            CurrentBlock=saveI;
                      }
                 }
               break;
       default:
               return (ListBoxDefaultProcedure(Window,Message,Param1,Param2));
    }
    return TRUE;
}