void HexEditLineBuffer::Draw( wxDC& dc, int x, int y, int fontX, int fontY, wxColour* foregrounds, wxColour* backgrounds )
{
    for ( char* ptr = m_Buffer; ptr < m_End; )
    {
        // Searching for continous block with same style
        wxString str;

        do
        {
            str += wxChar( ptr[ 0 ] );
            ptr += 2;
        }
        while ( ( ptr < m_End ) && ( ptr[1] == ptr[-1] ) );

        char style = ptr[-1];

        dc.SetBrush( backgrounds[ (int)style ] );
        dc.SetPen( backgrounds[ (int)style ] );

        dc.DrawRectangle( x, y, fontX * str.length(), fontY );

        dc.SetPen( foregrounds[ (int)style ] );
        dc.SetTextForeground( foregrounds[ (int)style ] );
        dc.SetTextBackground( backgrounds[ (int)style ] );

        dc.DrawText( str, x, y );
        x += fontX * str.length();
    }
}
Example #2
0
/**
 * Render the event in the bitmap
 */
void CppCodeEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
    const int titleTextHeight = 20;

    //Draw header rectangle
    wxRect headerRect(x, y, width, GetRenderedHeight(width, platform));
    renderingHelper->DrawNiceRectangle(dc, headerRect);

    //Header
    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    dc.DrawText( (displayedName.empty() ? _("C++ code") : _("C++ code:")) + displayedName, x + 4, y + 3 );

    if ( codeDisplayedInEditor )
    {
        dc.SetFont( renderingHelper->GetFont() );
        dc.SetBrush(renderingHelper->GetActionsRectangleFillBrush());
        dc.SetPen(renderingHelper->GetActionsRectangleOutlinePen());

        dc.DrawRectangle(wxRect(x + 4, y + 3 + titleTextHeight + 2, width-8, GetRenderedHeight(width, platform)-(3 + titleTextHeight + 5)));
        dc.DrawLabel( inlineCode, wxNullBitmap, wxRect(x + 4, y + 3 + titleTextHeight + 4, width-2, GetRenderedHeight(width, platform)));
    }
#endif
}
Example #3
0
void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;

    wxRect rect;
    GetFieldRect(i, rect);

    wxString text(GetStatusText(i));

    long x = 0, y = 0;

    dc.GetTextExtent(text, &x, &y);

    int xpos = rect.x + leftMargin;
    int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ;

#if defined( __WXGTK__ ) || defined(__WXMAC__)
    xpos++;
    ypos++;
#endif

    dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height);

    dc.DrawText(text, xpos, ypos);

    dc.DestroyClippingRegion();
}
Example #4
0
void
wxBannerWindow::DrawBannerTextLine(wxDC& dc,
                                   const wxString& str,
                                   const wxPoint& pos)
{
    switch ( m_direction )
    {
        case wxTOP:
        case wxBOTTOM:
            // The simple case: we just draw the text normally.
            dc.DrawText(str, pos);
            break;

        case wxLEFT:
            // We draw the text vertically and start from the lower left
            // corner and not the upper left one as usual.
            dc.DrawRotatedText(str, pos.y, GetClientSize().y - pos.x, 90);
            break;

        case wxRIGHT:
            // We also draw the text vertically but now we start from the upper
            // right corner and draw it from top to bottom.
            dc.DrawRotatedText(str, GetClientSize().x - pos.y, pos.x, -90);
            break;

        case wxALL:
            wxFAIL_MSG( wxS("Unreachable") );
    }
}
Example #5
0
void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;
    int w, h ;
    GetSize( &w , &h ) ;
    wxRect rect;
    GetFieldRect(i, rect);
    
    if ( !MacIsReallyHilited()  )
    {
        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
    }
    
    wxString text(GetStatusText(i));
    
    long x, y;
    
    dc.GetTextExtent(text, &x, &y);
    
    int xpos = rect.x + leftMargin + 1 ;
    int ypos = 1 ;
    
    if ( MacGetTopLevelWindow()->MacGetMetalAppearance()  )
        ypos++ ;
        
    dc.SetClippingRegion(rect.x, 0, rect.width, h);
    
    dc.DrawText(text, xpos, ypos);
    
    dc.DestroyClippingRegion();
}
Example #6
0
void oglDrawFormattedText(wxDC& dc, wxList *text_list,
                       double m_xpos, double m_ypos, double width, double height,
                       int formatMode)
{
  double xoffset, yoffset;
  if (formatMode & FORMAT_CENTRE_HORIZ)
    xoffset = m_xpos;
  else
    xoffset = (double)(m_xpos - (width / 2.0));

  if (formatMode & FORMAT_CENTRE_VERT)
    yoffset = m_ypos;
  else
    yoffset = (double)(m_ypos - (height / 2.0));

  dc.SetClippingRegion(
                    (long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0),
                    (long)width+1, (long)height+1); // +1 to allow for rounding errors

  wxObjectList::compatibility_iterator current = text_list->GetFirst();
  while (current)
  {
    wxShapeTextLine *line = (wxShapeTextLine *)current->GetData();

    dc.DrawText(line->GetText(), WXROUND(xoffset + line->GetX()), WXROUND(yoffset + line->GetY()));
    current = current->GetNext();
  }

  dc.DestroyClippingRegion();
}
Example #7
0
/**
 * Render the event in the bitmap
 */
void TimedEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
    gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
    int border = renderingHelper->instructionsListBorder;
    const int functionTextHeight = 20;

    //Draw header rectangle
    wxRect headerRect(x, y, width, functionTextHeight);
    renderingHelper->DrawNiceRectangle(dc, headerRect);

    //Name
    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    std::string nameTxt;
    if ( !name.empty() ) nameTxt = _T(" (Nom : "+name + ")");
    dc.DrawText( _("Delayed execution after ")+timeout.GetPlainString()+_(" seconds.")+" "+nameTxt, x + 4, y + 3 );

    //Draw conditions rectangle
    wxRect rect(x, y+functionTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-functionTextHeight);
    renderingHelper->DrawNiceRectangle(dc, rect);

    //Draw actions and conditions
    renderingHelper->DrawConditionsList(conditions, dc,
                                        x+border,
                                        y+functionTextHeight+border,
                                        renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
    renderingHelper->DrawActionsList(actions, dc,
                                     x+renderingHelper->GetConditionsColumnWidth()+border,
                                     y+functionTextHeight+border,
                                     width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
}
Example #8
0
void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;

    wxRect rect;
    GetFieldRect(i, rect);

    if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
    {
        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
    }

    wxString text(GetStatusText(i));

    long x, y;

    dc.GetTextExtent(text, &x, &y);

    int xpos = rect.x + leftMargin + 1 ;
    int ypos = 1 ;

    dc.SetClippingRegion(rect.x, 0, rect.width, m_height);

    dc.DrawText(text, xpos, ypos);

    dc.DestroyClippingRegion();
}
Example #9
0
void ScrubbingOverlay::Draw(OverlayPanel &, wxDC &dc)
{
   mLastScrubRect = mNextScrubRect;
   mLastScrubSpeedText = mNextScrubSpeedText;

   Scrubber &scrubber = GetScrubber();
   if (!scrubber.ShouldDrawScrubSpeed())
      return;

   static const wxFont labelFont(24, wxSWISS, wxNORMAL, wxNORMAL);
   dc.SetFont(labelFont);

   // These two colors were previously saturated red and green.  However
   // we have a rule to try to only use red for reserved purposes of
   //  (a) Recording
   //  (b) Error alerts
   // So they were changed to 'orange' and 'lime'.
   static const wxColour clrNoScroll(215, 162, 0), clrScroll(0, 204, 153);
   if (scrubber.IsScrollScrubbing())
      dc.SetTextForeground(clrScroll);
   else
      dc.SetTextForeground(clrNoScroll);

   dc.DrawText(mLastScrubSpeedText, mLastScrubRect.GetX(), mLastScrubRect.GetY());
}
void RectangleShape::draw(wxDC& dc)
{
	// The minimum size of the RectangleShape is the size of the title
	titleSize = dc.GetTextExtent(WXSTRING(title));
	if (size.x < (titleSize.x + 2 * spacing + 2 * borderWidth)) {
		size.x = titleSize.x + 2 * spacing + 2 * borderWidth;
	}
	if (size.y < (titleSize.y + 2 * spacing + 2 * borderWidth)) {
		size.y = titleSize.y + 2 * spacing + 2 * borderWidth;
	}
	// Draws a rectangle with the given top left corner, and with the given
	// size.
	dc.SetBrush(*wxWHITE_BRUSH);
	if (isSelected()) {
		dc.SetPen(wxPen(WXSTRING(getSelectionColour()), borderWidth, wxSOLID));
	} else {
		dc.SetPen(wxPen(WXSTRING(getNormalColour()), borderWidth, wxSOLID));
	}

	int x = centre.x - (size.x / 2);
	int y = centre.y - (size.y / 2);
	dc.DrawRectangle(x, y, size.x, size.y);

	dc.SetPen(wxPen(WXSTRING("BLACK"), borderWidth, wxSOLID));
	dc.DrawText(WXSTRING(title), centre.x - titleSize.x / 2, y + spacing + borderWidth);
}
void MyFrame::RenderRight(wxDC& dc)
{

	wxBitmap adrixright("/opt/extras.ubuntu.com/azpazeta/media/AdrixRight.png", wxBITMAP_TYPE_PNG);
#define adrixdown adrixright
	dc.DrawText("No se ha renderizado bien",wxPoint(-1,-1));
	//Dibujar fondo
	switch(city){
	case 0:{dc.DrawBitmap(adrixdown, wxPoint(adrx,adry),true);}
	case 1:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 2:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/INEM.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 3:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro1.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 4:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro2.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 5:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro3.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 6:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Hiper.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 7:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Golf.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 8:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 9:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}

	case 10:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	case 11:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Gorguez.png",wxBITMAP_TYPE_PNG);
		dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;}
	}
	
}
Example #12
0
/*
 * Here we do the actual rendering. I put it in a separate
 * method so that it can work no matter what type of DC
 * (e.g. wxPaintDC or wxClientDC) is used.
 */
void BasicDrawPane::Render(wxDC&  dc)
{

     int width, height;
     this->GetSize(&width, &height);

     if ( m_bgColor.IsOk() ) 
     {
	  dc.SetBrush(wxBrush(m_bgColor));
	  dc.DrawRectangle(0, 0, width, height);
     }

     if ( m_textForeGround.IsOk() )
     {
	  dc.SetTextForeground( m_textForeGround );
     }

     if ( !m_text.IsEmpty() )
     {
	  dc.SetBackgroundMode(wxTRANSPARENT);
	  dc.SetFont( m_font );

	  /*
	   * ちょうど中央表示できるよう調整
	   */
	  const int cHeight = dc.GetCharHeight();
	  const int cWidth  = dc.GetCharWidth();
	  const int textLen = m_text.Len();
	  const int textHalfSize = textLen * cWidth / 2;
	  dc.DrawText( m_text, width / 2 - textHalfSize, height / 2 - cHeight / 2 );
     }
}
Example #13
0
void ExplainShape::OnDraw(wxDC &dc)
{
	wxBitmap &bmp = GetBitmap();
	if (!bmp.Ok())
		return;

	// We do not draw the root shape
	if (m_rootShape)
		return;

	int x, y;
	x = WXROUND(m_xpos - bmp.GetWidth() / 2.0);
	y = WXROUND(m_ypos - GetHeight() / 2.0);

	dc.DrawBitmap(bmp, x, y, true);

	int w, h;
	dc.SetFont(GetCanvas()->GetFont());
	dc.GetTextExtent(label, &w, &h);

	x = WXROUND(m_xpos - w / 2.0);
	y += bmp.GetHeight() + BMP_BORDER;

	dc.DrawText(label, x, y);
}
Example #14
0
void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc,
                                       const wxRect& rect,
                                       int item,
                                       int flags ) const
{
    if ( flags & wxODCB_PAINTING_CONTROL )
    {
        dc.DrawText( GetValue(),
                     rect.x + GetTextIndent(),
                     (rect.height-dc.GetCharHeight())/2 + rect.y );
    }
    else
    {
        dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y );
    }
}
Example #15
0
// draw text centered around x (though still at y down)
void DrawCenteredText(wxDC& dc, const wxString& text, const wxPoint& pt)
{
    wxCoord w, h;
    dc.GetTextExtent(text, &w, &h);
    w = std::max(0, pt.x - w/2);
    dc.DrawText(text, w, pt.y);
}
Example #16
0
/**
 * Render the event in the bitmap
 */
void ForEachEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
    int border = renderingHelper->instructionsListBorder;
    const int forEachTextHeight = 20;

    //Draw header rectangle
    wxRect headerRect(x, y, width, forEachTextHeight);
    renderingHelper->DrawNiceRectangle(dc, headerRect);

    //For Each text
    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    dc.DrawText( _("For each object") + " " + objectsToPick.GetPlainString() + _(", repeat :"), x + 4, y + 3 );

    //Draw conditions rectangle
    wxRect rect(x, y+forEachTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-forEachTextHeight);
    renderingHelper->DrawNiceRectangle(dc, rect);

    //Draw actions and conditions
    renderingHelper->DrawConditionsList(conditions, dc,
                                        x+border,
                                        y+forEachTextHeight+border,
                                        renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
    renderingHelper->DrawActionsList(actions, dc,
                                     x+renderingHelper->GetConditionsColumnWidth()+border,
                                     y+forEachTextHeight+border,
                                     width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
#endif
}
Example #17
0
/**
 * Render the event in the bitmap
 */
void WhileEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
    int border = renderingHelper->instructionsListBorder;
    const int repeatHeight = 20;

    //Draw header rectangle
    int whileConditionsHeight = renderingHelper->GetRenderedConditionsListHeight(whileConditions, width-80-border*2, platform)+border*2;
    if (!infiniteLoopWarning && whileConditionsHeight < 32 ) whileConditionsHeight = 32;
    wxRect headerRect(x, y, width, whileConditionsHeight+repeatHeight);
    renderingHelper->DrawNiceRectangle(dc, headerRect);

    //While text
    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    dc.DrawText( _("While :"), x+5, y+5 );

    //Draw icon if infinite loop warning is deactivated.
    if (!infiniteLoopWarning)
    {
        if ( gd::CommonBitmapManager::Get()->noProtection.IsOk() )
            dc.DrawBitmap(gd::CommonBitmapManager::Get()->noProtection, wxPoint(x+5,y+5+18), /*useMask=*/true);
    }

    //Draw "while conditions"
    renderingHelper->DrawConditionsList(whileConditions, dc, x+80+border, y+border, width-80-border*2, this, areas, selection, platform);

    dc.SetFont( renderingHelper->GetNiceFont().Bold()  );
    dc.SetTextForeground(wxColour(0,0,0));
    dc.DrawText( _("Repeat :"), x+4, y+whileConditionsHeight+3);
    whileConditionsHeight += repeatHeight;

    //Draw conditions rectangle
    wxRect rect(x, y+whileConditionsHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-whileConditionsHeight);
    renderingHelper->DrawNiceRectangle(dc, rect);

    renderingHelper->DrawConditionsList(conditions, dc,
                                        x+border,
                                        y+whileConditionsHeight+border,
                                        renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
    renderingHelper->DrawActionsList(actions, dc,
                                     x+renderingHelper->GetConditionsColumnWidth()+border,
                                     y+whileConditionsHeight+border,
                                     width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
#endif
}
Example #18
0
void wxRibbonMetroArtProvider::DrawMinimisedPanelCommon(
                        wxDC& dc,
                        wxRibbonPanel* wnd,
                        const wxRect& true_rect,
                        wxRect* preview_rect)
{
    wxRect preview(0, 0, 32, 32);
    if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL)
    {
        preview.x = true_rect.x + 4;
        preview.y = true_rect.y + (true_rect.height - preview.height) / 2;
    }
    else
    {
        preview.x = true_rect.x + (true_rect.width - preview.width) / 2;
        preview.y = true_rect.y + 4;
    }
    if(preview_rect)
        *preview_rect = preview;

    wxCoord label_width, label_height;
    dc.SetFont(m_panel_label_font);
    dc.GetTextExtent(wnd->GetLabel(), &label_width, &label_height);

    int xpos = true_rect.x + (true_rect.width - label_width + 1) / 2;
    int ypos = preview.y + preview.height + 5;

    if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL)
    {
        xpos = preview.x + preview.width + 5;
        ypos = true_rect.y + (true_rect.height - label_height) / 2;
    }

    dc.SetTextForeground(m_panel_minimised_label_colour);
    dc.DrawText(wnd->GetLabel(), xpos, ypos);


    wxPoint arrow_points[3];
    if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL)
    {
        xpos += label_width;
        arrow_points[0] = wxPoint(xpos + 5, ypos + label_height / 2);
        arrow_points[1] = arrow_points[0] + wxPoint(-3,  3);
        arrow_points[2] = arrow_points[0] + wxPoint(-3, -3);
    }
    else
    {
        ypos += label_height;
        arrow_points[0] = wxPoint(true_rect.width / 2, ypos + 5);
        arrow_points[1] = arrow_points[0] + wxPoint(-3, -3);
        arrow_points[2] = arrow_points[0] + wxPoint( 3, -3);
    }

    dc.SetPen(*wxTRANSPARENT_PEN);
    wxBrush B(m_panel_minimised_label_colour);
    dc.SetBrush(B);
    dc.DrawPolygon(sizeof(arrow_points)/sizeof(wxPoint), arrow_points,
        true_rect.x, true_rect.y);
}
Example #19
0
//Disegna i tag impostati
void kwxLinearReg::DrawTags(wxDC &dc)
{	
	int ntag = 0 ;
	int w, h ;
	int tw,th;
	int scalval = 0 ;
	double tcoeff ;

	wxString text ;

	if(m_aTagsVal==NULL)
		return;
	GetClientSize(&w,&h);
	if((!(m_iStyle&STYLE_VERTICAL)))
		tcoeff = (w - 2) / (double)(m_iMax - m_iMin);
	else
		tcoeff = (h - 2) / (double)(m_iMax - m_iMin);

	dc.SetPen(*wxThePenList->FindOrCreatePen(m_cTagsColour, 1, wxSOLID));
	dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_cTagsColour,wxSOLID));
	dc.SetTextForeground(m_cTagsColour);

	while (ntag < m_iTagsCount)
	{
		scalval = (int)floor((m_aTagsVal[ ntag] - m_iMin) * tcoeff);// \todo: need floor ?
		text.Printf("%d", m_aTagsVal[ ntag]) ;		
		
		if(m_iStyle & STYLE_VERTICAL)
		{
			dc.DrawLine(w - 2, h - scalval , w - TAGS_LENGTH , h - scalval);
			if(m_iStyle & STYLE_DRAW_TAG_NUMBERS){
				dc.GetTextExtent(text, &tw, &th);
				dc.DrawText(text, w - TAGS_LENGTH - tw, h - scalval - (th / 2) );
			}
		}
		else
		{
			dc.DrawLine(scalval + 1, h - 2 , scalval + 1, h - TAGS_LENGTH);
			if(m_iStyle & STYLE_DRAW_TAG_NUMBERS){
				dc.GetTextExtent(text, &tw, &th);
				dc.DrawText(text, scalval + 1 - (tw / 2 ), h - TAGS_LENGTH - th);
			}
		}
		ntag++ ;
	}
}
void RectangleDrawer::DrawStats(wxDC& dc)
{
	char str[32];
	sprintf_s(str, "Time = %6.3fs", m_fTime);
	dc.DrawText(str, 5, 10);

	sprintf_s(str, "Fitness = %4.1f", m_fFitnress);
	dc.DrawText(str, 5, 25);

	const size_t HEIGHT = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_HEIGHT");
	sprintf_s(str, "Height = %d", HEIGHT);
	dc.DrawText(str, 5, 40);

	const size_t WIDTH = ConfigReader::GetInstance()->GetFileConfigIntValue("CANVAS_WIDTH");
	sprintf_s(str, "Width = %d", WIDTH);
	dc.DrawText(str, 5, 55);
}
Example #21
0
void CStatusLineCtrl::DrawRightAlignedText(wxDC& dc, wxString text, int x, int y)
{
	wxCoord w, h;
	dc.GetTextExtent(text, &w, &h);
	x -= w;

	dc.DrawText(text, x, y);
}
//Render
void BasicDrawPane::render(wxDC&  dc)
{
	pre_fractal = wxBitmap(fractal);
	dc.DrawBitmap(pre_fractal, 0, 0, false);
	// draw some text
	dc.DrawText(wxT("Testing Fractal"), 1, 1);
	
}
Example #23
0
void clRowEntry::RenderTextSimple(wxWindow* win, wxDC& dc, const clColours& colours, const wxString& text, int x, int y,
                                  size_t col)
{
    wxUnusedVar(win);
    wxUnusedVar(col);
#ifdef __WXMSW__
    if(m_tree->IsNativeTheme()) {
        dc.SetTextForeground(colours.GetItemTextColour());
        dc.DrawText(text, x, y);
    } else {
        dc.SetTextForeground(IsSelected() ? colours.GetSelItemTextColour() : colours.GetItemTextColour());
        dc.DrawText(text, x, y);
    }
#else
    dc.SetTextForeground(IsSelected() ? colours.GetSelItemTextColour() : colours.GetItemTextColour());
    dc.DrawText(text, x, y);
#endif
}
Example #24
0
void umlHistoryItem::DrawSign(wxDC& dc)
{
    wxFont font = *wxSWISS_FONT;
    font.SetPointSize(8);

    dc.SetFont(font);
    dc.DrawText(wxT("H"), Conv2Point(GetAbsolutePosition() + wxRealPoint(6, 4)));
    dc.SetFont(wxNullFont);
}
Example #25
0
void Game::DisplayScore(wxDC& dc)
{
    wxColour bgColour = FortyApp::BackgroundColour();
    wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
    dc.SetTextBackground(bgColour);
    dc.SetTextForeground(FortyApp::TextColour());
    dc.SetBrush(FortyApp::BackgroundBrush());
    dc.SetPen(* pen);

    // count the number of cards in foundations
    m_currentScore = 0;
    for (int i = 0; i < 8; i++)
    {
        m_currentScore += m_foundations[i]->GetNumCards();
    }

    int x, y;
    m_pack->GetTopCardPos(x, y);
    x += 12 * CardWidth - 105;

    wxCoord w, h;
    {
        wxCoord width, height;
        dc.GetTextExtent(wxT("Average score:m_x"), &width, &height);
        w = width;
        h = height;
    }
    dc.DrawRectangle(x + w, y, 20, 4 * h);

    wxString str;
    str.Printf(wxT("%d"), m_currentScore);
    dc.DrawText(wxT("Score:"), x, y);
    dc.DrawText(str, x + w, y);
    y += h;

    str.Printf(wxT("%d"), m_numGames);
    dc.DrawText(wxT("Games played:"), x, y);
    dc.DrawText(str, x + w, y);
    y += h;

    str.Printf(wxT("%d"), m_numWins);
    dc.DrawText(wxT("Games won:"), x, y);
    dc.DrawText(str, x + w, y);
    y += h;

    int average = 0;
    if (m_numGames > 0)
    {
        average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames);
    }
    str.Printf(wxT("%d"), average);
    dc.DrawText(wxT("Average score:"), x, y);
    dc.DrawText(str, x + w, y);
}
//----------------------------------------------------------------------------
void EffectEditTimeLineWindow::DrawOneTimeGrid (int index, std::string name, 
												wxDC &dc)
{
	wxSize winSize = GetClientSize();

	int xPos = 0;
	int yPos = index * sTimeGridHeight + sTimeLineHeight;
	//int yDst = (index+1) * sTimeGridHeight + sTimeLineHeight;
	int width = winSize.GetWidth()+2;

	if (mSelectIndex == index)
		dc.SetBrush(wxBrush(wxColor(0, 222, 0), wxSOLID));
	else
		dc.SetBrush(wxBrush(wxColor(222,222, 222), wxSOLID));
	dc.SetPen(wxPen(wxColor(222,222, 222)));
	dc.DrawRectangle(xPos+1, yPos+1, sTimeGridHeadWidth-1, sTimeGridHeight-1);
	dc.SetPen(wxPen(wxColor(128, 128, 128)));
	dc.DrawLine(xPos, yPos, width, yPos);
	dc.DrawLine(xPos, yPos+sTimeGridHeight, width, yPos+sTimeGridHeight);

	dc.SetFont(wxFont("宋体"));
	dc.DrawText(name.c_str(), xPos+10, yPos+2);

	// grid
	int girdNum = winSize.GetWidth()/sTimeGridWidth;

	for (int i=0; i<girdNum; i++)
	{
		int xPos = i*sTimeGridWidth + sTimeGridHeadWidth;

		if (i !=0 )
		{
			dc.SetPen(wxPen(wxColor(128, 128, 128)));
			dc.DrawLine(xPos, sTimeLineHeight+sTimeGridHeight*index, 
			xPos, sTimeLineHeight+sTimeGridHeight*(index+1));
		}

		if (index == mSelectIndex)
		{
			float insertingTime = EditSystem::GetSingleton().GetEffectEdit()
				->GetInsertingTime();
			float insertingIndex = insertingTime * 30.0f;
			int iInsertingIndex = (int)insertingIndex;
			float timeTemp = insertingIndex - iInsertingIndex;
			if (timeTemp > 0.99f)
				iInsertingIndex += 1;

			xPos = iInsertingIndex*sTimeGridWidth + sTimeGridHeadWidth;

			dc.SetBrush(wxBrush(wxColor(128, 0, 0), wxSOLID));
			dc.SetPen(wxPen(wxColor(128, 0, 0)));
			dc.DrawRectangle(xPos+1, sTimeLineHeight+sTimeGridHeight*index+1,
				sTimeGridWidth, sTimeGridHeight-1);
		}
	}
}
void TemplateLegend::OnDraw(wxDC& dc)
{
	if (!template_canvas) return;
    dc.SetFont(*GeoDaConst::small_font);
    dc.DrawText(template_canvas->GetCategoriesTitle(), px, 13);
	
	int time = template_canvas->GetCurrentCanvasTmStep();
    int cur_y = py;
	int numRect = template_canvas->GetNumCategories(time);
	
    dc.SetPen(*wxBLACK_PEN);
	for (int i=0; i<numRect; i++) {
		dc.SetBrush(template_canvas->GetCategoryColor(time, i));
		dc.DrawText(template_canvas->GetCategoryLabel(time, i),
					(px + m_l + 10), cur_y - (m_w / 2));
		dc.DrawRectangle(px, cur_y - 8, m_l, m_w);
		cur_y += d_rect;
	}
}
void PenStyleComboBox::OnDrawItem( wxDC& dc,
                                    const wxRect& rect,
                                    int item,
                                    int flags ) const
{
    if ( item == wxNOT_FOUND )
        return;

    wxRect r(rect);
    r.Deflate(3);
    r.height -= 2;

    int penStyle = wxSOLID;
//    if ( item == 1 )
//        penStyle = wxTRANSPARENT;
//    else if ( item == 2 )
//        penStyle = wxDOT;
//    else if ( item == 3 )
//        penStyle = wxLONG_DASH;
//    else if ( item == 4 )
//        penStyle = wxSHORT_DASH;
    if ( item == 0 )
        penStyle = wxDOT_DASH;
    else if ( item == 1 )
        penStyle = wxBDIAGONAL_HATCH;
    else if ( item == 2 )
        penStyle = wxCROSSDIAG_HATCH;
//    else if ( item == 8 )
//        penStyle = wxFDIAGONAL_HATCH;
//    else if ( item == 9 )
//        penStyle = wxCROSS_HATCH;
//    else if ( item == 10 )
//        penStyle = wxHORIZONTAL_HATCH;
//    else if ( item == 11 )
//        penStyle = wxVERTICAL_HATCH;

    wxPen pen( dc.GetTextForeground(), 3, penStyle );

    // Get text colour as pen colour
    dc.SetPen( pen );

    if ( !(flags & wxODCB_PAINTING_CONTROL) )
    {
        dc.DrawText(GetString( item ),
                    r.x + 3,
                    (r.y + 0) + ( (r.height/2) - dc.GetCharHeight() )/2
                   );

        dc.DrawLine( r.x+5, r.y+((r.height/4)*3), r.x+r.width - 5, r.y+((r.height/4)*3) );
    }
    else
    {
        dc.DrawLine( r.x+5, r.y+r.height/2, r.x+r.width - 5, r.y+r.height/2 );
    }
}
Example #29
0
    virtual void OnDrawItem( wxDC& dc,
                             const wxRect& rect,
                             int item,
                             int flags ) const
    {
        if ( item == wxNOT_FOUND )
            return;

        wxRect r(rect);
        r.Deflate(3);
        r.height -= 2;

        wxPenStyle penStyle = wxPENSTYLE_SOLID;
        if ( item == 1 )
            penStyle = wxPENSTYLE_TRANSPARENT;
        else if ( item == 2 )
            penStyle = wxPENSTYLE_DOT;
        else if ( item == 3 )
            penStyle = wxPENSTYLE_LONG_DASH;
        else if ( item == 4 )
            penStyle = wxPENSTYLE_SHORT_DASH;
        else if ( item == 5 )
            penStyle = wxPENSTYLE_DOT_DASH;
        else if ( item == 6 )
            penStyle = wxPENSTYLE_BDIAGONAL_HATCH;
        else if ( item == 7 )
            penStyle = wxPENSTYLE_CROSSDIAG_HATCH;
        else if ( item == 8 )
            penStyle = wxPENSTYLE_FDIAGONAL_HATCH;
        else if ( item == 9 )
            penStyle = wxPENSTYLE_CROSS_HATCH;
        else if ( item == 10 )
            penStyle = wxPENSTYLE_HORIZONTAL_HATCH;
        else if ( item == 11 )
            penStyle = wxPENSTYLE_VERTICAL_HATCH;

        wxPen pen( dc.GetTextForeground(), 3, penStyle );

        // Get text colour as pen colour
        dc.SetPen( pen );

        if ( !(flags & wxODCB_PAINTING_CONTROL) )
        {
            dc.DrawText(GetString( item ),
                        r.x + 3,
                        (r.y + 0) + ( (r.height/2) - dc.GetCharHeight() )/2
                       );

            dc.DrawLine( r.x+5, r.y+((r.height/4)*3), r.x+r.width - 5, r.y+((r.height/4)*3) );
        }
        else
        {
            dc.DrawLine( r.x+5, r.y+r.height/2, r.x+r.width - 5, r.y+r.height/2 );
        }
    }
Example #30
0
/**
 * Render the event in the bitmap
 */
void FunctionEvent::Render(wxDC& dc,
                           int x,
                           int y,
                           unsigned int width,
                           gd::EventsEditorItemsAreas& areas,
                           gd::EventsEditorSelection& selection,
                           const gd::Platform& platform) {
#if !defined(GD_NO_WX_GUI)
  gd::EventsRenderingHelper* renderingHelper = gd::EventsRenderingHelper::Get();
  int border = renderingHelper->instructionsListBorder;
  const int functionTextHeight = 20;

  // Draw header rectangle
  wxRect headerRect(x, y, width, functionTextHeight);
  renderingHelper->DrawNiceRectangle(dc, headerRect);

  // Name
  dc.SetFont(renderingHelper->GetNiceFont().Bold());
  dc.SetTextForeground(wxColour(0, 0, 0));
  wxString caption = _("Function") + " " + name;
  if (!objectsPassedAsArgument.empty())
    caption += " " + _("( Objects passed as parameters : ") +
               objectsPassedAsArgument + _(")");
  dc.DrawText(caption, x + 4, y + 3);

  // Draw conditions rectangle
  wxRect rect(x,
              y + functionTextHeight,
              renderingHelper->GetConditionsColumnWidth() + border,
              GetRenderedHeight(width, platform) - functionTextHeight);
  renderingHelper->DrawNiceRectangle(dc, rect);

  // Draw actions and conditions
  renderingHelper->DrawConditionsList(
      conditions,
      dc,
      x + border,
      y + functionTextHeight + border,
      renderingHelper->GetConditionsColumnWidth() - border,
      this,
      areas,
      selection,
      platform);
  renderingHelper->DrawActionsList(
      actions,
      dc,
      x + renderingHelper->GetConditionsColumnWidth() + border,
      y + functionTextHeight + border,
      width - renderingHelper->GetConditionsColumnWidth() - border * 2,
      this,
      areas,
      selection,
      platform);
#endif
}