コード例 #1
0
void wxJigsawInputParameter::GetSize(wxDC & dc, wxCoord * w, wxCoord * h, double scale)
{
	wxCoord shapeWidth(0), shapeHeight(0);
	if(m_NeedCalcLabelSize)
	{
		dc.GetTextExtent(m_Label, &m_LabelSize.x, &m_LabelSize.y, 0, 0, (wxFont *)&dc.GetFont());
		m_NeedCalcLabelSize = false;
	}
	if(m_Shape)
	{
		m_Shape->GetSize(dc, &shapeWidth, &shapeHeight, scale);
	}
	else
	{
		wxSize defaultSize = wxJigsawInputParameter::GetDefaultParameterSize();
		shapeWidth = defaultSize.GetWidth()*scale;
		shapeHeight = defaultSize.GetHeight()*scale;
	}
	if(w)
	{
		*w = m_LabelSize.GetWidth() + wxJigsawInputParameter::ParameterSpacing*scale + shapeWidth;
	}
	if(h)
	{
		*h = wxMax(m_LabelSize.GetHeight(), shapeHeight);
	}
}
コード例 #2
0
ファイル: audio_display.cpp プロジェクト: Gpower2/Aegisub
void AudioDisplay::PaintLabels(wxDC &dc, TimeRange updtime)
{
	std::vector<AudioLabelProvider::AudioLabel> labels;
	controller->GetTimingController()->GetLabels(updtime, labels);
	if (labels.empty()) return;

	wxDCFontChanger fc(dc);
	wxFont font = dc.GetFont();
	font.SetWeight(wxFONTWEIGHT_BOLD);
	dc.SetFont(font);
	dc.SetTextForeground(*wxWHITE);
	for (auto const& label : labels)
	{
		wxSize extent = dc.GetTextExtent(label.text);
		int left = RelativeXFromTime(label.range.begin());
		int width = AbsoluteXFromTime(label.range.length());

		// If it doesn't fit, truncate
		if (width < extent.GetWidth())
		{
			dc.SetClippingRegion(left, audio_top + 4, width, extent.GetHeight());
			dc.DrawText(label.text, left, audio_top + 4);
			dc.DestroyClippingRegion();
		}
		// Otherwise center in the range
		else
		{
			dc.DrawText(label.text, left + (width - extent.GetWidth()) / 2, audio_top + 4);
		}
	}
}
コード例 #3
0
void wxJigsawInputParameter::RecalculateLabelSizes(wxDC & dc)
{
	dc.GetTextExtent(m_Label, &m_LabelSize.x, &m_LabelSize.y, 0, 0, (wxFont *)&dc.GetFont());
	if(m_Shape)
	{
		m_Shape->RecalculateLabelSizes(dc);
	}
}
コード例 #4
0
void wxJigsawInputParameter::Draw(wxDC & dc, const wxPoint & pos, const wxSize & offset, double scale, wxColour color)
{
	wxPoint realPosition(
		pos.x + offset.GetWidth(), 
		pos.y /*+ offset.GetHeight()*/);
	/*wxLogTrace(wxTraceMask(), _("ParameterPos = %i,%i; Offset=%i, %i"),
		realPosition.x, realPosition.y, offset.x, offset.y);*/
	wxSize labelSize;
	wxSize size = GetSize(dc, scale);
	dc.GetTextExtent(m_Label, &labelSize.x, &labelSize.y, 0, 0, (wxFont *)&dc.GetFont());

	//Draw the text with bevel
	wxRect rectText(realPosition, size);
	rectText.x++;
	rectText.y++;
	dc.SetTextForeground(*wxBLACK);
	dc.DrawLabel(m_Label, rectText, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);

	rectText.x--;
	rectText.y--;
	dc.SetTextForeground(*wxWHITE);
	dc.DrawLabel(m_Label, rectText, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);

	
	wxPoint shapePos;
	wxSize shapeSize;
	if(m_Shape)
	{
		shapeSize = m_Shape->GetSize(dc, scale);
		shapePos = wxPoint(
			pos.x + labelSize.x + wxJigsawInputParameter::ParameterSpacing*scale, 
			pos.y + (size.GetHeight()-shapeSize.GetHeight())/2);
		m_Shape->SetPosition(shapePos.x, 
			shapePos.y + (size.GetHeight()-shapeSize.GetHeight())*scale/2 - offset.GetHeight());
		m_Shape->Draw(dc, offset, scale);
	}
	else
	{
		dc.SetPen(*wxBLACK_PEN);

		wxBrush paramBrush(wxColour(color.Red()*.9,color.Green()*.9,color.Blue()*.9)); 
		dc.SetBrush(paramBrush);
		//dc.SetBrush(*wxWHITE_BRUSH);

		shapeSize = wxJigsawInputParameter::GetDefaultParameterSize();
		shapeSize.x *= scale;
		shapeSize.y *= scale;
		shapePos = wxPoint(
			realPosition.x + labelSize.x + wxJigsawInputParameter::ParameterSpacing*scale, 
			realPosition.y + (size.GetHeight()-shapeSize.GetHeight())/2);
		wxJigsawShape::DrawShapeHeader(dc, shapePos, 
			shapeSize, GetStyle());
	}
	//dc.SetBrush(*wxTRANSPARENT_BRUSH);
	//dc.SetPen(*wxBLACK_PEN);
	//dc.DrawRectangle(realPosition, size);
}
コード例 #5
0
void UICalculateDistance::render(wxDC& dc)
{
	int client_h = 0;
	int client_w = 0;
	GetClientSize (&client_w, &client_h);

	if (!(ApplicationConfiguration::GetInstance()->IsThemed()))
	  {
	    wxString str(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
	    wxColour c_pen   = (wxColour)str;
	    wxString str2(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);
	    wxColour c_backg = (wxColour)str2;
	    wxString str3(ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
	    wxColour c_brush = (wxColour)str3;
	    wxString str4(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8);
	    dc.SetTextForeground((wxColour)str4);
	    dc.SetPen(wxPen(c_pen));
	    dc.SetBrush(wxBrush(c_brush));
	    dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
	}

	std::ostringstream wop,wop2,wop3,wop4; 
	wop << std::fixed << std::setprecision(3) << (distance*factor);  
	
	double aux = 0.000;
	Position_x_Edit->GetValue().Trim().ToDouble(&aux);
	wop2 << std::fixed << std::setprecision (3) << aux;
	Position_y_Edit->GetValue().Trim().ToDouble(&aux);
	wop3 << std::fixed << std::setprecision (3) << aux;
	Position_z_Edit->GetValue().Trim().ToDouble(&aux);
	wop4 << std::fixed << std::setprecision (3) << aux;

	
	wxPoint box1_first(20-2,45-9);
	wxPoint box1_last(368,45+22);
	dc.DrawRoundedRectangle(box1_first.x, box1_first.y, box1_last.x-box1_first.x, box1_last.y-box1_first.y,3.1f);
	dc.DrawRotatedText(wxString(wop2.str().c_str(),wxConvUTF8),89+10-30-5,45, 0);
	dc.DrawRotatedText(wxString(wop3.str().c_str(),wxConvUTF8),89+10-30-5+92+10+15-3,45, 0);
	dc.DrawRotatedText(wxString(wop4.str().c_str(),wxConvUTF8),89+10-30-5+184+20+15+10-2,45, 0);

	wxFont font(10, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma"));
	wxFont font_ = dc.GetFont();
	dc.SetFont(font);
	dc.DrawRotatedText(_T("Distance:"),20,12, 0);
	dc.DrawRotatedText(wxString(wop.str().c_str(),wxConvUTF8),20+65,12, 0);
	dc.SetFont(font_);
}
コード例 #6
0
void wxSheetCellRendererRefData::Draw( wxSheet& sheet,
                                       const wxSheetCellAttr& attr,
                                       wxDC& dc,
                                       const wxRect& rect,
                                       const wxSheetCoords& UNUSE(coords),
                                       bool isSelected )
{
    dc.SetBackgroundMode( wxSOLID );

    // grey out fields if the sheet is disabled
    if ( sheet.IsEnabled() )
    {
        if ( isSelected )
            dc.SetBrush( wxBrush(sheet.GetSelectionBackground(), wxSOLID) );
        else
            dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
    }
    else
        dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID));

    dc.SetPen( *wxTRANSPARENT_PEN );
    dc.DrawRectangle(rect);

#ifdef TEST_SELECTION_BLOCKS // colouring for identifying different blocks
    if (isSelected)
    {
        int i = sheet.GetSelection()->Index(coords);
        wxColour c(GetRainbow(i*10));
        dc.SetBrush( wxBrush(c, wxSOLID) );
        dc.DrawRectangle(rect);

        wxFont font = dc.GetFont();
        dc.SetFont(*wxSMALL_FONT);
        dc.DrawText(wxString::Format(wxT("%d"), i), rect.x, rect.y);
    }
#endif // TEST_SELECTION_BLOCKS

    //FIXME - border drawing code, maybe it goes here?
    //dc.SetPen( wxPen(sheet.GetGridLineColour(), 1, wxSOLID) );
    //dc.DrawRectangle(rect.x-1, rect.y-1, rect.width+2, rect.height+2);
}
コード例 #7
0
ファイル: audio_display.cpp プロジェクト: Gpower2/Aegisub
void AudioDisplay::PaintTrackCursor(wxDC &dc) {
	wxDCPenChanger penchanger(dc, wxPen(*wxWHITE));
	dc.DrawLine(track_cursor_pos-scroll_left, audio_top, track_cursor_pos-scroll_left, audio_top+audio_height);

	if (track_cursor_label.empty()) return;

	wxDCFontChanger fc(dc);
	wxFont font = dc.GetFont();
	font.SetWeight(wxFONTWEIGHT_BOLD);
	dc.SetFont(font);

	wxSize label_size(dc.GetTextExtent(track_cursor_label));
	wxPoint label_pos(track_cursor_pos - scroll_left - label_size.x/2, audio_top + 2);
	label_pos.x = mid(2, label_pos.x, GetClientSize().GetWidth() - label_size.x - 2);

	int old_bg_mode = dc.GetBackgroundMode();
	dc.SetBackgroundMode(wxTRANSPARENT);

	// Draw border
	dc.SetTextForeground(wxColour(64, 64, 64));
	dc.DrawText(track_cursor_label, label_pos.x+1, label_pos.y+1);
	dc.DrawText(track_cursor_label, label_pos.x+1, label_pos.y-1);
	dc.DrawText(track_cursor_label, label_pos.x-1, label_pos.y+1);
	dc.DrawText(track_cursor_label, label_pos.x-1, label_pos.y-1);

	// Draw fill
	dc.SetTextForeground(*wxWHITE);
	dc.DrawText(track_cursor_label, label_pos.x, label_pos.y);
	dc.SetBackgroundMode(old_bg_mode);

	label_pos.x -= 2;
	label_pos.y -= 2;
	label_size.IncBy(4, 4);
	// If the rendered text changes size we have to draw it an extra time to make sure the entire thing was drawn
	bool need_extra_redraw = track_cursor_label_rect.GetSize() != label_size;
	track_cursor_label_rect.SetPosition(label_pos);
	track_cursor_label_rect.SetSize(label_size);
	if (need_extra_redraw)
		RefreshRect(track_cursor_label_rect, false);
}
コード例 #8
0
ファイル: pathctrl.cpp プロジェクト: sqba/floopy
void CPathItem::DrawFore(wxDC &dc, wxRect &rc)
{
	dc.SetTextForeground(*wxBLACK);

	wxString csName(_T("mixer"));
	if(NULL != m_pInput)
	{
		const char *nname = m_pInput->GetName();
		const char *dname = m_pInput->GetDisplayName();
		csName = (wxChar*)(strlen(nname) > strlen(dname) ? dname : nname);
	}

	int width = rc.GetWidth();
	if(!m_bFirst)
		width -= CORNER_LENGTH;

	wxFont oldFont = dc.GetFont();
	wxFont font(7, wxSWISS, wxNORMAL, wxNORMAL);
	font.SetWeight(IsSelected() ? wxBOLD : wxNORMAL);
	font.SetStyle(IsSelected() ? wxITALIC : wxNORMAL );
	font.SetPointSize( 7 );
	dc.SetFont( font );

	int w=0, h=0;
	dc.GetTextExtent(csName, &w, &h);
	if(h<rc.GetHeight())
	{
		if(w>width)
		{
			csName.Printf(_T("%c"),csName[0]);
			dc.GetTextExtent(csName, &w, &h);
		}
		int x = rc.GetX() + width/2 - w/2 + (m_bFirst ? 0 : CORNER_LENGTH);
		int y = rc.GetY() + rc.GetHeight()/2 - h/2;
		dc.DrawText( csName, x, y );
	}

	dc.SetFont( oldFont );
}
コード例 #9
0
ファイル: label.cpp プロジェクト: sqba/floopy
void CLabel::DrawBG(wxDC& dc, wxRect& rc)
{
	CTrack *track = getTrack();
	m_rcLabel = rc;

	wxBrush oldBrush = dc.GetBrush();
	wxPen oldpen = dc.GetPen();

	wxPen pen( *wxMEDIUM_GREY_PEN );
	pen.SetWidth(1);
	dc.SetPen( pen );

	//wxBrush brush(m_color, (IsSelected() ? wxCROSSDIAG_HATCH : wxSOLID));
	wxBrush brush(track->GetBGColor(), wxSOLID);
	dc.SetBrush(brush);

	int left, top, width, height;

	if(m_bDrawAquaBG)
	{
		// Draw aqua background
		left   = 0;
		top    = rc.GetTop();
		width  = rc.GetWidth()-left;
		height = rc.GetHeight();
		//dc.DrawRectangle(left, top, width, height);
		wxRect rc(left+1, top+1, width-2, height-2);
		DrawAquaRect(dc, rc, 4);
	}
	else
	{
		// Draw background
		left   = 1;//m_nLevel*4+2;
		top    = rc.GetTop()+1;
		width  = rc.GetWidth()-1;//left-3;
		height = rc.GetHeight()-2;
		//dc.DrawRoundedRectangle(left, top, width, height, 4);
		//DrawRect3D(dc, wxRect(left, top, width, height));
		DrawRect3D(dc, rc);
	}

	dc.SetTextForeground( track->GetForeColor() );
	wxFont oldFont = dc.GetFont();
	wxFont font(9, wxSWISS, wxNORMAL, wxBOLD);
	//wxFont font = oldFont;
	//font.SetWeight(IsSelected() ? wxBOLD : wxNORMAL);
	//font.SetPointSize(GetHeight() / 4);
	font.SetPointSize( 9 );
	dc.SetFont(font);
	//wxFont font(12, wxDEFAULT, wxITALIC, (IsSelected() ? wxBOLD : wxNORMAL));
	//dc.SetFont(font);
	////dc.SetFont((IsSelected() ? *wxITALIC_FONT : *wxNORMAL_FONT));

	// Get text dimensions
	wxCoord w=0, h=0;
	wxString csName;
	track->GetName(csName);
	dc.GetTextExtent(csName, &w, &h);

	/*int ptSize = GetHeight() / 2;
	// Get text dimensions
	wxCoord w=0, h=0;
	do {
		font.SetPointSize(ptSize);
		dc.GetTextExtent(m_name, &w, &h);
		ptSize--;
	} while (w>width && ptSize > 5);*/


	// Draw text
	int x = left + 5;//width/2 - w/2;
	int y = (rc.GetTop() + (rc.GetHeight()/4) - h/2);
	dc.DrawText( csName, x, y );
	m_rcLabel.SetHeight(rc.GetHeight());

/*
	int n = rc.GetHeight()/2-2;
	if(n > 20)
		n = 20;
	drawLoopSign(dc,  wxRect(5, top+height-n-2, n, n));
	drawCacheSign(dc, wxRect(n+5+1, top+height-n-2, n, n));
*/
	wxRect rcTmp = getPathRect(rc);
	m_pPathCtrl->DrawBG(dc, rcTmp);


	dc.SetFont(oldFont);
	dc.SetPen(oldpen);
	dc.SetBrush( oldBrush );
}
コード例 #10
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
void CWKSP_Layer_Legend::_Draw_Continuum_V(wxDC &dc, int y, double yToDC, double zMin, double zMax, double zFactor, double dz, int dyFont)
{
	int		i, iy, jy;
	double	z;

	//-----------------------------------------------------
	for(i=0, z=y+METRIC_HEIGHT; i<m_pClassify->Get_Class_Count(); i++, z-=yToDC)
	{
		Draw_FillRect(dc, Get_Color_asWX(m_pClassify->Get_Class_Color(i)), m_xBox, (int)(z), m_xTick, (int)(z - yToDC));
	}

	Draw_Edge(dc, EDGE_STYLE_SIMPLE, m_xBox, y, m_xTick, y + METRIC_HEIGHT);

	//-----------------------------------------------------
	switch( m_pClassify->Get_Metric_Mode() )
	{
	case METRIC_MODE_NORMAL:	default:
		z	= dz * floor(zMin / dz);
		if( z < zMin )	z	+= dz;

		for(; z<=zMax; z+=dz)
		{
			iy	= METRIC_POS_V(z);
			dc.DrawLine(m_xTick, iy, m_xText, iy);

			_Draw_Label(dc, iy, METRIC_GET_STRING(z, dz), TEXTALIGN_YCENTER);
		}
		break;

	case METRIC_MODE_LOGUP:
		jy	= METRIC_POS_V(zMax) + (1 + dyFont);
		z	= dz * floor(zMax / dz);
		if( z > zMax )	z	-= dz;

		for(; z>=zMin; z-=dz)
		{
			iy	= METRIC_POS_V(z);
			dc.DrawLine(m_xTick, iy, m_xText, iy);

			if( abs(jy - iy) >= (int)(0.75 * dyFont) )
			{
				jy	= iy;
				_Draw_Label(dc, iy, METRIC_GET_STRING(z, dz), TEXTALIGN_YCENTER);
			}

			while( abs(iy - METRIC_POS_V(z - dz)) > 2 * dyFont )
				dz	*= 0.1;
		}
		break;

	case METRIC_MODE_LOGDOWN:
		jy	= METRIC_POS_V(zMin) - (1 + dyFont);
		z	= dz * floor(zMin / dz);
		if( z < zMin )	z	+= dz;

		for(; z<=zMax; z+=dz)
		{
			iy	= METRIC_POS_V(z);
			dc.DrawLine(m_xTick, iy, m_xText, iy);

			if( abs(jy - iy) >= (int)(0.75 * dyFont) )
			{
				jy	= iy;
				_Draw_Label(dc, iy, METRIC_GET_STRING(z, dz), TEXTALIGN_YCENTER);
			}

			while( abs(iy - METRIC_POS_V(z + dz)) > 2 * dyFont )
				dz	*= 0.1;
		}
		break;
	}

	//-----------------------------------------------------
	_Set_Size(0, METRIC_HEIGHT + dc.GetFont().GetPointSize());
}
コード例 #11
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
void CWKSP_Layer_Legend::_Draw_Point(wxDC &dc, CWKSP_Shapes_Point *pLayer)
{
	bool		bSize;
	int			min_Size, max_Size;
	double		min_Value, d_Value;
	wxString	Name, Name_Size;
	wxPen		Pen;
	wxBrush		Brush;

	//-----------------------------------------------------
	m_BoxStyle		= BOXSTYLE_CIRCLE;
	m_Box_bFill		= true;

	//-----------------------------------------------------
	bSize	= pLayer->Get_Style_Size(min_Size, max_Size, min_Value, d_Value, &Name_Size);

	pLayer->Get_Style(Pen, Brush, m_Box_bOutline, &Name);

	if( m_pClassify->Get_Mode() != CLASSIFY_UNIQUE || !bSize )
	{
		dc.SetBrush(Brush);
		dc.SetPen(Pen);

		if( Name.Length() > 0 )
		{
			_Draw_Title(dc, FONT_SUBTITLE, Name);
		}

	//	_Draw_Boxes(dc, m_Position.y);
		for(int i=m_pClassify->Get_Class_Count()-1, y=m_Position.y; i>=0; i--, y+=BOX_HEIGHT)
		{
	//		_Draw_Box	(dc, y, BOX_HEIGHT, Get_Color_asWX(m_pClassify->Get_Class_Color(i)));
			_Set_Size(0, BOX_HEIGHT);

			if( m_Box_bOutline == false )
			{
				Pen		= dc.GetPen();
				Pen.SetColour(Get_Color_asWX(m_pClassify->Get_Class_Color(i)));
				dc.SetPen(Pen);
			}

			if( m_Box_bFill )
			{
				Brush	= dc.GetBrush();
				Brush.SetColour(Get_Color_asWX(m_pClassify->Get_Class_Color(i)));
				dc.SetBrush(Brush);
			}

			pLayer->Draw_Symbol(dc, m_xBox + m_dxBox / 2, y + (BOX_HEIGHT - BOX_SPACE) / 2, (BOX_HEIGHT - BOX_SPACE) / 2);

			_Draw_Label(dc, y, m_pClassify->Get_Class_Name(i), TEXTALIGN_TOP);
		}
	}

	//-----------------------------------------------------
	if( bSize )
	{
		dc.SetBrush(Brush);
		dc.SetPen(Pen);

		_Draw_Title(dc, FONT_SUBTITLE, Name_Size);
		_Draw_Point_Sizes(dc, pLayer, min_Size, max_Size, min_Value, d_Value);
		_Set_Size(0, SIZE_HEIGHT + dc.GetFont().GetPointSize());
	}
}
コード例 #12
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
void CWKSP_Layer_Legend::Draw(wxDC &dc, double Zoom, double Zoom_Map, wxPoint Position, wxSize *pSize, bool bVertical)
{
	//-----------------------------------------------------
	m_Zoom		= Zoom > 0.0 ? Zoom : 1.0;
	m_Position	= Position;
	m_Size		= wxSize(BOX_WIDTH, 0);

	m_Zoom_Map	= Zoom_Map;
	m_bVertical	= bVertical;

	//-----------------------------------------------------
	m_oldPen	= dc.GetPen();
	m_oldBrush	= dc.GetBrush();
	m_oldFont	= dc.GetFont();

	//-----------------------------------------------------
	m_xBox		= m_Position.x;
	m_dxBox		= BOX_WIDTH;
	m_xTick		= m_xBox	+ m_dxBox;
	m_dxTick	= TICK_WIDTH;
	m_xText		= m_xTick	+ m_dxTick;

	//-----------------------------------------------------
	_Draw_Title(dc, FONT_TITLE, m_pLayer->Get_Object()->Get_Name());

	//-----------------------------------------------------
	switch( m_pLayer->Get_Type() )
	{
	case WKSP_ITEM_Shapes:
		switch( ((CWKSP_Shapes *)m_pLayer)->Get_Shapes()->Get_Type() )
		{
		case SHAPE_TYPE_Point:
		case SHAPE_TYPE_Points:
			_Draw_Point		(dc, (CWKSP_Shapes_Point   *)m_pLayer);
			break;

		case SHAPE_TYPE_Line:
			_Draw_Line		(dc, (CWKSP_Shapes_Line    *)m_pLayer);
			break;

		case SHAPE_TYPE_Polygon:
			_Draw_Polygon	(dc, (CWKSP_Shapes_Polygon *)m_pLayer);
			break;

		default:
			break;
		}
		break;

	case WKSP_ITEM_TIN:
		_Draw_TIN	(dc, (CWKSP_TIN        *)m_pLayer);
		break;

	case WKSP_ITEM_PointCloud:
//		_Draw_TIN	(dc, (CWKSP_PointCloud *)m_pLayer);
		break;

	case WKSP_ITEM_Grid:
		_Draw_Grid	(dc, (CWKSP_Grid       *)m_pLayer);
		break;

	default:
		break;
	}

	//-----------------------------------------------------
	dc.SetPen	(m_oldPen);
	dc.SetBrush	(m_oldBrush);
	dc.SetFont	(m_oldFont);

	//-----------------------------------------------------
	if( pSize )
	{
		*pSize	= m_Size;
	}
}
コード例 #13
0
void SeqPlot::showPlot ( wxDC &dc , int b , int tx , int ty , int lx , int ph )
    {    
	mylog ( "SeqPlot::showPlot" , "1" ) ;
    if ( !can->isMiniDisplay() ) return ;
    if ( ((int)data_h) == 0 ) data_h = 1 ;//return ; // Flat data or something...
	mylog ( "SeqPlot::showPlot" , "2" ) ;
    int ch = can->charheight ;
    int cw = can->charwidth ;
    int bottom = ty + lines * can->charheight ;
    int u ;
    
    if ( can->isMiniDisplay() )
        {
	mylog ( "SeqPlot::showPlot" , "2a" ) ;
        if ( b == 0 ) plotr = wxRect ( lx , bottom - ph , 0 , ph ) ;
        plotr.SetWidth ( tx + cw - plotr.GetLeft() ) ;
        }
    
	mylog ( "SeqPlot::showPlot" , "3" ) ;
    // Dotted lines
    dc.SetPen ( *wxBLACK_PEN ) ;
    for ( float j = data_min + data_step ; j + data_step <= data_max ; j += data_step )
        {
			myass ( ((int)data_h) != 0 , "SeqPlot::showPlot divides by 0!" ) ;
        int k = bottom - ( (int)(j - data_min) ) * ph / ((int)data_h) ;
        drawDottedLine ( dc , lx , k , tx + cw , k ) ;
        }
        
	mylog ( "SeqPlot::showPlot" , "4" ) ;
    if ( can->isMiniDisplay() && b > 0 && b % 50 == 0 )
        {
        drawDottedLine ( dc , lx , bottom - ph , lx , bottom + ch/2 ) ;
        dc.SetFont ( *can->smallFont ) ;
        int qx , qy ;
        wxString ws ;
        ws = wxString::Format ( _T("%d") , b ) ;
        dc.GetTextExtent ( ws , &qx , &qy ) ;
        dc.DrawText ( ws , lx - qx/2 , bottom + ch/2 ) ;
        }
    
    // Colored curves
	mylog ( "SeqPlot::showPlot" , "5" ) ;
    for ( u = 0 ; u < prop[b].data.size() ; u++ )
        {
        wxPen *pen = wxRED_PEN ;
        if ( can->isPrinting() ) pen = wxBLACK_PEN ;
        else if ( u == 1 ) pen = wxGREEN_PEN ;
        else if ( u == 2 ) pen = MYPEN(_T("BLUE")) ;
        dc.SetPen(*pen);
        float ny = prop[b].data[u] ;
        float oy = b==0?ny:prop[b-1].data[u] ;
        fixMinMax ( ny ) ;
        fixMinMax ( oy ) ;
           
        ny = bottom - ( ny - data_min ) * ph / data_h ;
        oy = bottom - ( oy - data_min )  * ph / data_h ;
        dc.DrawLine ( lx , (int)oy , tx + cw , (int)ny ) ;
        }
        
    // Border lines
	mylog ( "SeqPlot::showPlot" , "6" ) ;
    dc.SetPen ( *wxBLACK_PEN ) ;
    dc.DrawLine ( lx , bottom , tx + cw , bottom ) ;
    dc.DrawLine ( lx , bottom - ph , tx + cw , bottom - ph ) ;
    if ( startOfLine )
        {
        wxFont cf = dc.GetFont () ;
        dc.SetFont ( *can->smallFont ) ;
        dc.DrawLine ( tx , bottom - ph , tx , bottom ) ;
        int qx , qy ;
        wxString ws ;
        ws = wxString::Format ( _T("%.1f") , data_max ) ;
        dc.GetTextExtent ( ws , &qx , &qy ) ;
        dc.DrawText ( ws , tx - qx - cw/3 , bottom - ph - qy/2 ) ;
        dc.DrawLine ( tx - cw/3 , bottom - ph , tx , bottom - ph ) ;
        ws = wxString::Format ( _T("%.1f") , data_min ) ;
        dc.GetTextExtent ( ws , &qx , &qy ) ;
        dc.DrawText ( ws , tx - qx - cw/3 , bottom - qy/2 ) ;
        dc.DrawLine ( tx - cw/3 , bottom , tx , bottom ) ;
        dc.SetFont ( cf ) ;
        }

	mylog ( "SeqPlot::showPlot" , "7" ) ;
    if ( b + 1 == s.length () )
        {
        dc.DrawLine ( tx+cw , bottom - ph , tx+cw , bottom ) ;
        }
	mylog ( "SeqPlot::showPlot" , "8" ) ;
    }