コード例 #1
0
void LWSlider::OnPaint(wxDC &dc, bool  WXUNUSED(selected))
{
   //thumbPos should be in pixels
   int thumbPos = ValueToPosition(mCurrentValue);
   int thumbOrtho; // position in axis orthogonal to mOrientation
   if (mOrientation == wxHORIZONTAL)
      thumbOrtho = mCenterY - (mThumbHeight/2);
   else
      thumbOrtho = mCenterX - (mThumbWidth/2);

#if defined(__WXMSW__)
   if( mHW )
   {
      dc.Clear();
   }
#endif
#if defined(__WXGTK__)
   if (mHW)
   {
      dc.SetBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
      dc.Clear();
   }
#endif

   dc.DrawBitmap(*mBitmap, mLeft, mTop, true);
   if (mOrientation == wxHORIZONTAL)
      dc.DrawBitmap(*mThumbBitmap, mLeft+thumbPos, mTop+thumbOrtho, true);
   else
      dc.DrawBitmap(*mThumbBitmap, mLeft+thumbOrtho, mTop+thumbPos, true);

   if (LWSlider::sharedTipPanel)
      LWSlider::sharedTipPanel->Refresh();
}
コード例 #2
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::InitialState()
{
    // Initial clipping box should be the same as the entire DC surface.
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
コード例 #3
0
void bmImage::render(wxDC& dc) {
	bitmap = wxBitmap(aswxImage);

	dc.Clear();

	// few variables to make life easier
	cv::Vec2f pScale = cv::Vec2f(((bmImageFrame*)this->GetParent())->scale);
	cv::Vec2f pVOffScale = cv::Vec2f(((bmImageFrame*)this->GetParent())->voff);
	cv::Vec2f pScroll = cv::Vec2f(((bmImageFrame*)this->GetParent())->scroll);

	wxPoint orgp = dc.GetLogicalOrigin();
	wxPoint trp(pScroll[0], pScroll[1]);
	if (asCvMat.cols * pScale[0] < this->GetSize().GetWidth()) {
		trp.x = -(this->GetSize().GetWidth() - asCvMat.cols * pScale[0]) / 2 / pScale[0];
	}
	if (asCvMat.rows * pScale[1] < this->GetSize().GetHeight()) {
		trp.y = -(this->GetSize().GetHeight() - asCvMat.rows * pScale[1]) / 2 / pScale[1];
	}/*
	trp += wxPoint(
		-(this->GetSize().GetWidth() - asCvMat.cols * pVOffScale[0]) / 2 / pVOffScale[0],
		-(this->GetSize().GetHeight() - asCvMat.rows * pVOffScale[1]) / 2 / pVOffScale[1]
		);*/
	trp += wxPoint(
		-asCvMat.cols * (pVOffScale[0] - 1.0f) / 2,
		-asCvMat.rows * (pVOffScale[1] - 1.0f) / 2
		);
	dc.SetLogicalOrigin(trp.x, trp.y);
	dc.SetUserScale(pScale[0], pScale[1]);
	dc.DrawBitmap(bitmap, wxPoint(0, 0), false);
	dc.SetLogicalOrigin(orgp.x, orgp.y);
}
コード例 #4
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneRegion()
{
    // Setting one clipping box inside DC area.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(10, 20, 80, 75);
}
コード例 #5
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneRegionNegDim()
{
    // Setting one clipping box with negative sizes values.
    // Final clipping box should have standard positive size values.
    m_dc->SetClippingRegion(10, 20, -80, -75);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 11, 21);
}
コード例 #6
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneOuterRegion()
{
    // Setting one clipping box entirely outside DC surface.
    // Final clipping box should be empty.
    m_dc->SetClippingRegion(-100, -80, 20, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 0, 0);
}
コード例 #7
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::TwoRegionsNonOverlapping()
{
    // Setting one clipping box and next another box (non-overlapping).
    // Final clipping box should be empty.
    m_dc->SetClippingRegion(10, 20, 30, 30);
    m_dc->SetClippingRegion(50, 60, 50, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 0, 0);
}
コード例 #8
0
ファイル: ClueListBox.cpp プロジェクト: brho/xword
void
ClueListBox::OnDrawBackground(wxDC & dc, const wxRect & rect, size_t n) const
{
    if (IsSelected(n))
        dc.SetBackground(GetSelectionBackground());
    else
        dc.SetBackground(GetBackgroundColour());

    dc.Clear();
}
コード例 #9
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::TwoRegionsOverlapping()
{
    // Setting one clipping box and next another box (partially overlapping).
    // Final clipping box should be an intersection of these two boxes.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->SetClippingRegion(50, 60, 50, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(50, 60, 40, 35);
}
コード例 #10
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneRegionAndEmpty()
{
    // Setting one clipping box and next an empty box.
    // Final clipping box should empty.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->SetClippingRegion(0, 0, 0, 0);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 0, 0);
}
コード例 #11
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneRegionAndReset()
{
    // Setting one clipping box and next destroy it.
    // Final clipping box should be the same as DC surface.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->DestroyClippingRegion();
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
コード例 #12
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneLargeRegion()
{
    // Setting one clipping box larger then DC surface.
    // Final clipping box should be limited to the DC extents.
    m_dc->SetClippingRegion(-10, -20,
                         s_dcSize.GetWidth()+30, s_dcSize.GetHeight()+50);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
コード例 #13
0
void PaintDrawPanel::Render(wxDC& dc)
{
	// Clear
	dc.SetBackground(*wxWHITE_BRUSH);
	dc.Clear();
	
	if (mModel)
	{
		mModel->DrawShapes(dc);
	}
}
コード例 #14
0
ファイル: CurvePane.cpp プロジェクト: butcherg/rawproc
void CurvePane::render(wxDC&  dc)
{
	double px = 0.0;
	double py = 0.0;
	double x=0, y=0;
	dc.Clear();
	int w, h;
	dc.GetSize(&w, &h);
	int m=10;
	int radius;
	wxConfigBase::Get()->Read("tool.curve.controlpointradius",&radius,5);
	
	//x axis:
	dc.DrawLine(m,h-m,m,h-m-255);
	//y axis:
	dc.DrawLine(m,h-m,m+255,h-m);

	//center lines:
	dc.SetPen(*wxLIGHT_GREY_PEN);
	dc.DrawLine(m+128,h-m,m+128,h-m-255);
	dc.DrawLine(m,h-m-128,m+255,h-m-128);
	//null curve:
	dc.DrawLine(m,h-m,m+255,h-m-255);
	//quarter lines:
	dc.SetPen(wxPen(wxColour(192,192,192), 1, wxPENSTYLE_DOT_DASH ));
	dc.DrawLine(m+64,h-m,m+64,h-m-255);
	dc.DrawLine(m,h-m-64,m+255,h-m-64);
	dc.DrawLine(m+192,h-m,m+192,h-m-255);
	dc.DrawLine(m,h-m-192,m+255,h-m-192);
	dc.SetPen(*wxBLACK_PEN);

	//double ax = ((double) w/x);
	//double ay = ((double) h/y)*z;


	for (double x=0.0; x<256.0; x++) {
		y=c.getpoint(x);
		if (y>255.0) y = 255.0; if (y<0.0) y=0.0;
		dc.DrawLine(m+px,h-m-py,m+x,h-m-y);
		px = x;
		py = y;
	}

	//if (mousemotion)dc.DrawCircle(pos,5);
	std::vector<cp> controlpts = c.getControlPoints();
	for (unsigned int i=0; i<controlpts.size(); i++) {
		if ((controlpts[i].x == selectedCP.x) & (controlpts[i].y == selectedCP.y)) {
			//dc.DrawText(wxString::Format("%d,%d",selectedCP.x,selectedCP.y),selectedCP.x-20,selectedCP.y-20);
			dc.SetPen(*wxRED_PEN);
		}
		dc.DrawCircle(m+controlpts[i].x,h-m-controlpts[i].y,radius);
		dc.SetPen(*wxBLACK_PEN);
	}
}
コード例 #15
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::InitialStateWithTransformedDC()
{
    // Initial clipping box with transformed DC.
    m_dc->SetDeviceOrigin(10, 15);
    m_dc->SetUserScale(0.5, 1.5);
    m_dc->SetLogicalScale(4.0, 2.0);
    m_dc->SetLogicalOrigin(-15, -20);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(-20, -25, 50, 40);
}
コード例 #16
0
ファイル: ZLauncherFrame.cpp プロジェクト: TheZoc/ZPatcher
void ZLauncherFrame::RenderFrame(wxDC& dc)
{
	if (m_backgroundImg.IsOk())
	{
		dc.DrawBitmap(m_backgroundImg, 0, 0);
	}
	else
	{
		dc.SetBackground( APPLICATION_BACKGROUND );
		dc.Clear();
	}
}
コード例 #17
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::TwoRegionsOverlappingNegDim()
{
    // Setting one clipping box with negative size values
    // and next another box (partially overlapping).
    // Final clipping box should be an intersection of these two boxes
    // with positive size values.
    m_dc->SetClippingRegion(90, 95, -80, -75);
    m_dc->SetClippingRegion(50, 60, 50, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(50, 60, 41, 36);
}
コード例 #18
0
void PreviewWindow::Render(wxDC& dc)
{
	dc.SetBackground(wxBrush(backgroundColour));
	dc.Clear();		
	DrawPath(dc);
	DrawTrajectory(dc);
	DrawOrigin(dc);
	wxString text;
	text << wxT("X: ") << offset.x << wxT("  Y: ") << offset.y
		<< wxT("  Z: ") << wheelPosition;
	dc.SetTextForeground(wxColour(255, 255, 255));
	dc.DrawText(text, 40, 10);
}
コード例 #19
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::OneRegionWithTransformedDC()
{
    // Setting one clipping box inside DC area
    // with applied some transformations.
    m_dc->SetDeviceOrigin(10, 15);
    m_dc->SetUserScale(0.5, 1.5);
    m_dc->SetLogicalScale(4.0, 2.0);
    m_dc->SetLogicalOrigin(-15, -20);
    m_dc->SetClippingRegion(-10, -20, 80, 75);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(-10, -20, 40, 35);
}
コード例 #20
0
ファイル: StateEvaluationTree.cpp プロジェクト: mheinsen/seec
void StateEvaluationTreePanel::render(wxDC &dc)
{
  if (Settings.m_ColourScheme == nullptr)
    return;
  
  PrepareDC(dc);
  auto const &Scheme = *(Settings.m_ColourScheme);
  
  dc.SetBackground(wxBrush{Scheme.getDefault().GetBackground()});
  dc.Clear();
  
  if (Statement.empty())
    return;
  
  auto const ActiveStmt = ActiveFn->getActiveStmt();
  if (!ActiveStmt)
    return;
  
  dc.SetFont(CodeFont);
  
  // Draw the sub-Stmts' nodes.
  for (auto const &Node : Nodes) {
    // Don't draw hovered nodes, they will be drawn later.
    if (&*HoverNodeIt == &Node || &*ReplayHoverNodeIt == &Node)
      continue;

    auto const DoHighlight =
      (HighlightedStmt && Node.Statement == HighlightedStmt)
      || (HighlightedValue && Node.Value.get() == HighlightedValue);

    if (DoHighlight)
      drawNode(dc, Scheme, Node, NodeDecoration::Highlighted);
    else if (Node.Statement == ActiveStmt)
      drawNode(dc, Scheme, Node, NodeDecoration::Active);
    else
      drawNode(dc, Scheme, Node, NodeDecoration::None);
  }
  
  // Redraw the hovered nodes, so that they outrank active node highlighting.
  if (HoverNodeIt != Nodes.end())
    drawNode(dc, Scheme, *HoverNodeIt, NodeDecoration::Highlighted);
  if (ReplayHoverNodeIt != Nodes.end())
    drawNode(dc, Scheme, *ReplayHoverNodeIt, NodeDecoration::Highlighted);
  
  // Draw the pretty-printed Stmt's string.
  dc.SetTextForeground(Scheme.getDefault().GetForeground());
  wxCoord const PageBorderH = dc.GetCharWidth() * Settings.PageBorderHorizontal;
  wxCoord const PageBorderV = dc.GetCharHeight() * Settings.PageBorderVertical;
  dc.DrawText(Statement, PageBorderH, PageBorderV);
}
コード例 #21
0
ファイル: canlua.cpp プロジェクト: Abyss116/luaplus51-all
void wxlCan::Render( wxDC& dc )
{
    int w,h;
    GetVirtualSize( &w, &h );

    dc.SetBackground( GetBackgroundColour() );
    dc.Clear();

    dc.SetBrush(m_backbrush);
    dc.SetPen( *wxTRANSPARENT_PEN );
    dc.DrawRectangle( 0, 0, w, h );

    //draw objects
    m_rootobject.Draw( dc, 0, 0 );
}
コード例 #22
0
static void DrawKDETheme(wxDC& dc,wxSize size)
{
    wxPen pen;
    pen.SetStyle(wxSOLID);
    wxBrush brush(kdetheme[13],wxSOLID);
    dc.SetBackground(brush);
    dc.Clear();
    for(int i=0;i<14;i++) {
	   pen.SetColour(kdetheme[i]);
	   dc.SetPen(pen);
	   dc.DrawLine(0,i,size.GetWidth()-1,i);
	   dc.DrawLine(0,size.GetHeight()-1-i,
				size.GetWidth()-1,size.GetHeight()-1-i);
    }
};
コード例 #23
0
ファイル: slider_bar.cpp プロジェクト: alcoheca/sooperlooper
void SliderBar::draw_area(wxDC & dc)
{
    wxCoord w,h;
    int pixw;

    dc.SetBackground(_bgbrush);
    dc.Clear();

    dc.SetBrush(_borderbrush);
    dc.SetPen(_borderpen);
    dc.DrawRectangle (0, 0, _width, _height);


    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetBrush(_barbrush);

    if (_bar_style == FromLeftStyle)
    {
        pixw = (int) ((_value - _lower_bound) / _val_scale);
        dc.DrawRectangle (1, 1, pixw-1, _height-2);

    }
    else if (_bar_style == FromRightStyle)
    {
        pixw = (int) ((_upper_bound - _value) / _val_scale);
        dc.DrawRectangle (pixw, 1, _width - pixw - 1, _height-2);

    }

    if (_bar_style != HiddenStyle)
    {
        dc.SetBrush(_linebrush);
        pixw = (int) ((_value - _lower_bound) / _val_scale);
        dc.DrawRectangle (pixw - 1, 1, 2, _height-2);
    }


    dc.SetTextForeground(_textcolor);
    dc.GetTextExtent(_label_str, &w, &h);
    dc.DrawText (_label_str, 3, _height - h - 3);

    if (_showval_flag) {
        dc.SetTextForeground(_valuecolor);
        dc.GetTextExtent(_value_str, &w, &h);
        dc.DrawText (_value_str, _width - w - 3, _height - h - 3);
    }

}
コード例 #24
0
void BasicDrawPane::renderTrue(wxDC& dc)
{
	dc.Clear();
	// draw a circle
	if (menu->number != 0)
	{
	dc.SetBrush(*wxGREEN_BRUSH); // green filling
    dc.SetPen( wxPen( wxColor(255,0,0), 3 ) ); // 5-pixels-thick red outline
    dc.DrawCircle( wxPoint(menu->pArray[0].x, menu->pArray[0].y), 10 /* radius */ );

	dc.SetBrush(*wxBLUE_BRUSH);
	dc.SetPen( wxPen( wxColor(255,255,0), 3 ) );
	for (int i = 1; i < menu->number; i++)
	{
		dc.DrawCircle( wxPoint(menu->pArray[i].x,menu->pArray[i].y), 5 /* radius */ );
	}
	}
}
コード例 #25
0
ファイル: main.cpp プロジェクト: Zhardas/gui
void BasicDrawPane::render(wxDC &dc) {
  static int frames = 0;
  frames++;
  static wxString draw_text = "";
  auto new_timestamp = std::chrono::high_resolution_clock::now();

  // Calculate framerate every second
  if (std::chrono::duration_cast<std::chrono::seconds>(new_timestamp - timestamp_).count() >= 1) {
    timestamp_ = new_timestamp;
    std::stringstream ss;
    ss << "FPS: " << frames;
    frames = 0;
    draw_text = ss.str();
  }

  dc.SetBackground(*wxWHITE_BRUSH);
  dc.Clear();
  dc.DrawText(draw_text, 0, 0);
}
コード例 #26
0
//////////////
// Draw image
void BaseGrid::DrawImage(wxDC &dc) {
	dc.BeginDrawing();

	// Get size and pos
	int w = 0;
	int h = 0;
	GetClientSize(&w,&h);

	// Set font
	dc.SetFont(font);

	// Clear background
	dc.SetBackground(wxBrush(Options.AsColour(_T("Grid Background"))));
	dc.Clear();

	// Draw labels
	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.SetBrush(wxBrush(Options.AsColour(_T("Grid left column"))));
	dc.DrawRectangle(0,lineHeight,colWidth[0],h-lineHeight);

	// Visible lines
	int drawPerScreen = h/lineHeight + 1;
	int nDraw = MID(0,drawPerScreen,GetRows()-yPos);
	int maxH = (nDraw+1) * lineHeight;

	// Row colors
	std::vector<wxBrush> rowColors;
	std::vector<wxColor> foreColors;
	rowColors.push_back(wxBrush(Options.AsColour(_T("Grid Background"))));					// 0 = Standard
	foreColors.push_back(Options.AsColour(_T("Grid standard foreground")));
	rowColors.push_back(wxBrush(Options.AsColour(_T("Grid Header"))));						// 1 = Header
	foreColors.push_back(Options.AsColour(_T("Grid standard foreground")));
	rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selection background"))));		// 2 = Selected
	foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
	rowColors.push_back(wxBrush(Options.AsColour(_T("Grid comment background"))));			// 3 = Commented
	foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
	rowColors.push_back(wxBrush(Options.AsColour(_T("Grid inframe background"))));			// 4 = Video Highlighted
	foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));
	rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selected comment background"))));	// 5 = Commented & selected
	foreColors.push_back(Options.AsColour(_T("Grid selection foreground")));

	// First grid row
	bool drawGrid = true;
	if (drawGrid) {
		dc.SetPen(wxPen(Options.AsColour(_T("Grid lines"))));
		dc.DrawLine(0,0,w,0);
		dc.SetPen(*wxTRANSPARENT_PEN);
	}

	// Draw rows
	int dx = 0;
	int dy = 0;
	int curColor = 0;
	AssDialogue *curDiag;
	for (int i=0;i<nDraw+1;i++) {
		// Prepare
		int curRow = i+yPos-1;
		curDiag = GetDialogue(curRow);
		dx = 0;
		dy = i*lineHeight;

		// Check for collisions
		bool collides = false;
		if (curDiag) {
			AssDialogue *sel = GetDialogue(editBox->linen);
			if (sel && sel != curDiag) {
				if (curDiag->CollidesWith(sel)) collides = true;
			}
		}

		// Text array
		wxArrayString strings;

		// Header
		if (i == 0) {
			strings.Add(_("#"));
			strings.Add(_("L"));
			strings.Add(_("Start"));
			strings.Add(_("End"));
			strings.Add(_("Style"));
			strings.Add(_("Actor"));
			strings.Add(_("Effect"));
			strings.Add(_("Left"));
			strings.Add(_("Right"));
			strings.Add(_("Vert"));
			strings.Add(_("Text"));
			curColor = 1;
		}

		// Lines
		else if (curDiag) {
			// Set fields
			strings.Add(wxString::Format(_T("%i"),curRow+1));
			strings.Add(wxString::Format(_T("%i"),curDiag->Layer));
			if (byFrame) {
				strings.Add(wxString::Format(_T("%i"),VFR_Output.GetFrameAtTime(curDiag->Start.GetMS(),true)));
				strings.Add(wxString::Format(_T("%i"),VFR_Output.GetFrameAtTime(curDiag->End.GetMS(),true)));
			}
			else {
				strings.Add(curDiag->Start.GetASSFormated());
				strings.Add(curDiag->End.GetASSFormated());
			}
			strings.Add(curDiag->Style);
			strings.Add(curDiag->Actor);
			strings.Add(curDiag->Effect);
			strings.Add(curDiag->GetMarginString(1));
			strings.Add(curDiag->GetMarginString(2));
			strings.Add(curDiag->GetMarginString(3));

			// Set text
			int mode = Options.AsInt(_T("Grid Hide Overrides"));
			wxString value = _T("");

			// Hidden overrides
			if (mode == 1 || mode == 2) {
				wxString replaceWith = Options.AsText(_T("Grid hide overrides char"));
				curDiag->ParseASSTags();
				size_t n = curDiag->Blocks.size();
				for (size_t i=0;i<n;i++) {
					AssDialogueBlock *block = curDiag->Blocks.at(i);
					AssDialogueBlockPlain *plain = AssDialogueBlock::GetAsPlain(block);
					if (plain) {
						value += plain->GetText();
					}
					else {
						if (mode == 1) {
							value += replaceWith;
						}
					}
				}
				curDiag->ClearBlocks();
			}

			// Show overrides
			else value = curDiag->Text;

			// Cap length and set text
			if (value.Length() > 512) value = value.Left(512) + _T("...");
			strings.Add(value);

			// Set color
			curColor = 0;
			bool inSel = IsInSelection(curRow,0);
			if (inSel && curDiag->Comment) curColor = 5;
			else if (inSel) curColor = 2;
			else if (curDiag->Comment) curColor = 3;
			else if (Options.AsBool(_T("Highlight subs in frame")) && IsDisplayed(curDiag)) curColor = 4;
		}

		else {
			for (int j=0;j<11;j++) strings.Add(_T("?"));
		}

		// Draw row background color
		if (curColor) {
			dc.SetBrush(rowColors[curColor]);
			dc.DrawRectangle((curColor == 1) ? 0 : colWidth[0],i*lineHeight+1,w,lineHeight);
		}

		// Set text color
		if (collides) dc.SetTextForeground(Options.AsColour(_T("Grid collision foreground")));
		else {
			dc.SetTextForeground(foreColors[curColor]);
		}

		// Draw text
		wxRect cur;
		bool isCenter;
		for (int j=0;j<11;j++) {
			// Is center?
			isCenter = !(j == 4 || j == 5 || j == 6 || j == 10);

			// Calculate clipping
			cur = wxRect(dx+4,dy,colWidth[j]-6,lineHeight);

			// Set clipping
			dc.DestroyClippingRegion();
			dc.SetClippingRegion(cur);

			// Draw
			dc.DrawLabel(strings[j],cur,isCenter ? wxALIGN_CENTER : (wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT));
			dx += colWidth[j];
		}
		//if (collides) dc.SetPen(wxPen(wxColour(255,0,0)));

		// Draw grid
		dc.DestroyClippingRegion();
		if (drawGrid) {
			dc.SetPen(wxPen(Options.AsColour(_T("Grid lines"))));
			dc.DrawLine(0,dy+lineHeight,w,dy+lineHeight);
			dc.SetPen(*wxTRANSPARENT_PEN);
		}
	}

	// Draw grid columns
	dx = 0;
	if (drawGrid) {
		dc.SetPen(wxPen(Options.AsColour(_T("Grid lines"))));
		for (int i=0;i<10;i++) {
			dx += colWidth[i];
			dc.DrawLine(dx,0,dx,maxH);
		}
		dc.DrawLine(0,0,0,maxH);
		dc.DrawLine(w-1,0,w-1,h);
	}

	// Draw currently active line border
	dc.SetPen(wxPen(Options.AsColour(_T("Grid Active border"))));
	dc.SetBrush(*wxTRANSPARENT_BRUSH);
	dy = (editBox->linen+1-yPos) * lineHeight;
	dc.DrawRectangle(0,dy,w,lineHeight+1);

	// Done
	dc.EndDrawing();
}
コード例 #27
0
void WSortView::paint(wxDC& dc, const wxSize& dcsize)
{
    dc.SetBackground(*wxBLACK_BRUSH);
    dc.Clear();

    if (size() == 0) return;

    size_t fwidth = dcsize.GetWidth();
    size_t fheight = dcsize.GetHeight();

    size_t width = fwidth - 20;
    size_t height = fheight - 20;

    dc.SetDeviceOrigin(10,10);

    // *** draw array element bars

    // draw | | | |  bars: each bar is width w, separation is w/2
    // thus n bars need n * w + (n-1) * w/2 width

    // 1st variant: space is 0.5 of bar size
    //double wbar = width / (size() + (size()-1) / 2.0);
    //double bstep = 1.5 * wbar;

    // 2nd variant: one pixel between bars
    double wbar = (width - (size()-1)) / (double)size();
    if (width <= (size()-1)) wbar = 0.0;

    double bstep = wbar + 1.0;

    // special case for bstep = 2 pixel -> draw 2 pixel bars instead of 1px
    // bar/1px gaps.
    if ( fabs(wbar - 1.0) < 0.1 && fabs(bstep - 2.0) < 0.1 ) wbar = 2, bstep = 2;

    static const wxPen pens[] = {
        *wxWHITE_PEN,
        *wxRED_PEN,
        *wxGREEN_PEN,
        *wxCYAN_PEN,
        wxPen(wxColour(255,255,0)),   //  4 yellow
        wxPen(wxColour(255,0,255)),   //  5 magenta
        wxPen(wxColour(255,192,128)), //  6 orange
        wxPen(wxColour(255,128,192)), //  7 pink
        wxPen(wxColour(128,192,255)), //  8 darker cyan
        wxPen(wxColour(192,255,128)), //  9 darker green
        wxPen(wxColour(192,128,255)), // 10 purple
        wxPen(wxColour(128,255,192)), // 11 light green
        wxPen(wxColour(128,128,255)), // 12 blue
        wxPen(wxColour(192,128,192)), // 13 dark purple
        wxPen(wxColour(128,192,192)), // 14 dark cyan
        wxPen(wxColour(192,192,128)), // 15 dark yellow
        wxPen(wxColour(0,128,255)),   // 16 blue/cyan mix
    };

    static const wxBrush brushes[] = {
        *wxWHITE_BRUSH,
        *wxRED_BRUSH,
        *wxGREEN_BRUSH,
        *wxCYAN_BRUSH,
        wxBrush(wxColour(255,255,0)),   //  4 yellow
        wxBrush(wxColour(255,0,255)),   //  5 magenta
        wxBrush(wxColour(255,192,128)), //  6 orange
        wxBrush(wxColour(255,128,192)), //  7 pink
        wxBrush(wxColour(128,192,255)), //  8 darker cyan
        wxBrush(wxColour(192,255,128)), //  9 darker green
        wxBrush(wxColour(192,128,255)), // 10 purple
        wxBrush(wxColour(128,255,192)), // 11 light green
        wxBrush(wxColour(128,128,255)), // 12 blue
        wxBrush(wxColour(192,128,192)), // 13 dark purple
        wxBrush(wxColour(128,192,192)), // 14 dark cyan
        wxBrush(wxColour(192,192,128)), // 15 dark yellow
        wxBrush(wxColour(0,128,255)),   // 16 blue/cyan mix
    };

    wxMutexLocker lock(m_mutex);
    ASSERT(lock.IsOk());

    for (size_t i = 0; i < size(); ++i)
    {
        int clr;

        // select color
        if (i == m_access1.index)
        {
            clr = m_access1.color;
        }
        else if (i == m_access2.index)
        {
            clr = m_access2.color;
        }
        else if ( (clr = InWatchList(i)) != 0 )
        {
            // clr already set
        }
        else if (m_mark[i] != 0)
        {
            clr = m_mark[i];
        }
        else if ( (clr = InAccessList(i)) >= 0 )
        {
        }
        else
        {
            clr = 0;
        }

        ASSERT(clr < (int)(sizeof(brushes) / sizeof(brushes[0])));
        dc.SetPen( pens[clr] );
        dc.SetBrush( brushes[clr] );

        dc.DrawRectangle(i*bstep, height,
                         wxMax(1, // draw at least 1 pixel
                               (wxCoord((i+1)*bstep) - wxCoord(i*bstep)) // integral gap to next bar
                               - (bstep - wbar)    // space between bars
                             ),
                         -(double)height * m_array[i].get_direct() / m_array_max);
    }
}
コード例 #28
0
	void OnDraw(wxDC& dc)
	{
		dc.SetBackground(m_view->GetBackgroundColour());
		dc.Clear();

		dc.SetFont(m_view->GetFont());

		wxRect updateRect = GetUpdateClientRect();
		updateRect.SetPosition(CalcUnscrolledPosition(updateRect.GetPosition()));

		int startRow = updateRect.GetTop() / m_rowHeight;
		int endRow = std::ceil(updateRect.GetBottom() / (double)m_rowHeight);
		if (endRow > m_view->m_dataSize / m_view->m_rowsize)
			endRow = m_view->m_dataSize / m_view->m_rowsize;

		wxSize offsetSize = dc.GetTextExtent("00000000");
		offsetSize.x += 4;
		wxSize byteSize = dc.GetTextExtent("00");
		byteSize.x += 2;

		wxRect visRect = GetClientSize();
		wxPoint viewStart = GetViewStart();

		for (int row = startRow; row <= endRow; ++row)
		{
			int offset = row * m_view->m_rowsize;
			wxPoint rowPos = wxPoint(2, (row * m_rowHeight) + 2);

			int rowsize = m_view->m_rowsize;
			if (offset + rowsize > m_view->m_dataSize)
				rowsize = m_view->m_dataSize - offset;

			// Draw offset
			dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
			dc.DrawText(wxString::Format("%.8X", offset), rowPos);
			rowPos.x += offsetSize.GetWidth();

			// Draw row values
			dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
			for (int i = 0; i < m_view->m_rowsize; ++i)
			{
				if (i < rowsize)
					dc.DrawText(wxString::Format("%.2X", m_view->m_data[offset + i]), rowPos);

				rowPos.x += byteSize.GetWidth();
			}

			rowPos.x += m_charWidth;

			// Draw row characters
			wxString str((const char*)&m_view->m_data[offset], rowsize);
			for (auto it = str.begin(); it != str.end(); ++it)
			{
				if (*it < 32)
					*it = '.';
			}

			dc.DrawText(str, rowPos);

			rowPos.y += m_rowHeight;
		}
	}
コード例 #29
0
ファイル: canvas.cpp プロジェクト: AnnaSkawinska/pgadmin3
// Draws the background
void wxShapeCanvas::DrawBackground(wxDC &dc, bool transformed)
{
	dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
	dc.Clear();
}
コード例 #30
0
ファイル: treelay.cpp プロジェクト: HackLinux/chandler-1
void wxTreeLayout::Draw(wxDC& dc)
{
    dc.Clear();
    DrawBranches(dc);
    DrawNodes(dc);
}