Beispiel #1
0
int
set_menu_grey(MENU *m, chtype attr)
{
	/*LINTED [E_CONST_PROMOTED_UNSIGNED_LONG]*/
	if (InvalidAttr(attr)) {
		return (E_BAD_ARGUMENT);
	}
	if (m) {
		Grey(m) = attr;
		if (Posted(m)) {
			_draw(m);		/* Redraw the menu */
			_show(m);		/* Redisplay menu */
		}
	} else {
		Grey(Dfl_Menu) = attr;
	}
	return (E_OK);
}
Beispiel #2
0
void TargetClient::OnPaint(wxPaintEvent& WXUNUSED(evt))
{
    wxAutoBufferedPaintDC dc(this);

    dc.SetBackground(*wxBLACK_BRUSH);
    //dc.SetBackground(wxColour(10,0,0));
    dc.Clear();

    wxColour Grey(128,128,128);
    wxPen GreySolidPen = wxPen(Grey,1, wxSOLID);
    wxPen GreyDashPen = wxPen(Grey,1, wxDOT);

    dc.SetTextForeground(wxColour(200,200,200));
    dc.SetFont(wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL));
    dc.SetPen(GreySolidPen);
    dc.SetBrush(*wxTRANSPARENT_BRUSH);

    wxSize size = GetClientSize();
    wxPoint center(size.x/2, size.y/2);
    int radius_max = ((size.x < size.y ? size.x : size.y) - 6) / 2;

    int leftEdge = center.x - radius_max;
    int topEdge = center.y - radius_max;
    radius_max -= 18;

    if (radius_max < 10)
        radius_max = 10;

    const double sampling = pFrame ? pFrame->GetCameraPixelScale() : 1.0;
    double scale = radius_max / 2 * sampling;

    // Draw reference circle
    if (m_refCircleRadius > 0.0)
    {
        wxDCBrushChanger b(dc, wxBrush(wxColor(55,55,55)));
        wxDCPenChanger p(dc, *wxTRANSPARENT_PEN);
        dc.DrawCircle(center, m_refCircleRadius * scale * m_zoom / sampling);
    }

    // Draw circles

    for (int i = 1 ; i <= 4 ; i++)
    {
        int rr = radius_max * i / 4;
        dc.DrawCircle(center, rr);
        wxString l = wxString::Format(_T("%g%s"), i/2.0 / m_zoom, sampling != 1.0 ? "''" : "");
        wxSize sl = dc.GetTextExtent(l);
        dc.DrawText(l, center.x - sl.x - 1, center.y - rr - sl.y);
    }

    // Draw axes
    dc.DrawLine(3, center.y , size.x - 3, center.y);
    dc.DrawLine(center.x, 3, center.x, size.y - 3);

    double r = radius_max / (2 / m_zoom);
    int g = size.x / 100;
    for (double x = 0 ; x < size.x ; x += r/4)
    {
        if (x != radius_max && x != r)
        {
            dc.DrawLine(center.x + x, center.y - g, center.x + x, center.y + g);
            dc.DrawLine(center.x - x, center.y - g, center.x - x, center.y + g);
        }
    }
    for (double y = 0 ; y < size.y ; y += r/4)
    {
        if (y != radius_max && y != r)
        {
            dc.DrawLine(center.x - g, center.y + y, center.x + g, center.y + y);
            dc.DrawLine(center.x - g, center.y - y, center.x + g, center.y - y);
        }
    }

    // Draw labels
    dc.DrawText(_("RA"), leftEdge, center.y - 15);
    dc.DrawText(_("Dec"), center.x - 35, topEdge - 3);

    // Draw impacts
    unsigned int startPoint = m_maxHistorySize - m_length;

    if (m_nItems < m_length)
    {
        startPoint = m_maxHistorySize - m_nItems;
    }

    // plot guide star offsets in mount coordinates:
    //   RA offset is distance W of lock pos
    //        => plot -dRA for East = positive
    //   Dec offset is distance S of lock pos
    //        => plot -dDec for North = positive
    double const raSign = -1.0;
    double const decSign = -1.0;

    // label sky coordinate directions

    GuideParity raParity = pMount ? pMount->RAParity() : GUIDE_PARITY_UNKNOWN;
    if (raParity == GUIDE_PARITY_EVEN)
        dc.DrawText(_("SkyE"), size.x - 30, center.y + 5);  // sky E = mount E
    else if (raParity == GUIDE_PARITY_ODD)
        dc.DrawText(_("SkyE"), leftEdge, center.y + 5);     // sky E = mount W

    GuideParity decParity = pMount ? pMount->DecParity() : GUIDE_PARITY_UNKNOWN;
    if (decParity == GUIDE_PARITY_EVEN)
        dc.DrawText(_("SkyN"), center.x + 5, topEdge - 3);  // sky N = mount N
    else if (decParity == GUIDE_PARITY_ODD)
        dc.DrawText(_("SkyN"), center.x + 5, size.y - 15);  // sky N = mount S

    dc.SetPen(wxPen(wxColour(127, 127, 255), 1, wxSOLID));
    for (unsigned int i = startPoint; i < m_maxHistorySize; i++)
    {
        int ximpact = center.x + m_history[i].ra * scale * m_zoom * raSign;
        int yimpact = center.y - m_history[i].dec * scale * m_zoom * decSign;
        if (i == m_maxHistorySize - 1)
        {
            const int lcrux = 4;
            dc.SetPen(*wxRED_PEN);
            dc.DrawLine(ximpact + lcrux, yimpact + lcrux, ximpact - lcrux - 1, yimpact - lcrux - 1);
            dc.DrawLine(ximpact + lcrux, yimpact - lcrux, ximpact - lcrux - 1, yimpact + lcrux + 1);
        }
        else
            dc.DrawCircle(ximpact, yimpact, 1);
    }
}
Beispiel #3
0
chtype
menu_grey(MENU *m)
{
	return (Grey(m ? m : Dfl_Menu));
}
Beispiel #4
0
void RenderDemoDlg::RenderControl(ReDrawInfoType* ExtraInfo)
{
	// Go get a render region
	DocRect VirtualSize(-ExtraInfo->dx/2, -ExtraInfo->dy/2, ExtraInfo->dx/2, ExtraInfo->dy/2);
	RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo);
	if (pRender!=NULL)
	{
		DialogColourInfo RedrawColours;		// Get a supplier for default dlg colours

		// Render stuff in here
		// Build a Linear fill attribute
		LinearFillAttribute MyGradFill;
		MyGradFill.Colour = DocColour(255, 255, 0);
		MyGradFill.EndColour = DocColour(0, 255, 255);
		MyGradFill.StartPoint = DocCoord(0, ExtraInfo->dy);
		MyGradFill.EndPoint = DocCoord(ExtraInfo->dx, 0);

		// Build a path
		Path InkPath;
		InkPath.Initialise(12,12);
		InkPath.FindStartOfPath();

		// Get the coords used to build a shape
		INT32 dx = ExtraInfo->dx / 2;
		INT32 dy = ExtraInfo->dy / 2;
		INT32 Midx = ExtraInfo->dx / 4;
		INT32 Midy = ExtraInfo->dy / 4;

		// build a circle in the middle of the control
		InkPath.InsertMoveTo(DocCoord(Midx, dy));
		InkPath.InsertCurveTo(DocCoord(Midx+Midx/2, dy), DocCoord(dx, Midy+Midy/2), DocCoord(dx, Midy));
		InkPath.InsertCurveTo(DocCoord(dx, Midy-Midy/2), DocCoord(Midx+Midx/2, 0), DocCoord(Midx, 0));
		InkPath.InsertCurveTo(DocCoord(Midx-Midx/2, 0), DocCoord(0, Midy-Midy/2), DocCoord(0, Midy));
		InkPath.InsertCurveTo(DocCoord(0, Midy+Midy/2), DocCoord(Midx-Midx/2, dy), DocCoord(Midx, dy));
		InkPath.IsFilled = TRUE;
		
		// A Grey colour [...hmmm, it's not a very grey grey any more... oragnge more like]
		DocColour Grey(255,200,0);

		// Render the attributes and the a rectangle
		pRender->SaveContext();
		pRender->SetLineColour(Grey);

		// Draw a rectangle to fill in the background - Fill with Dialogue Background colour
		DocRect DrawMe(0, 0, ExtraInfo->dx, ExtraInfo->dy);
		pRender->SetFillColour(RedrawColours.DialogBack());
		pRender->DrawRect(&VirtualSize);

		// Draw some shapes and stuff
		pRender->SetFillGeometry(&MyGradFill, FALSE);
		pRender->DrawPath(&InkPath);

		// Build a path
		Path TriPath;
		TriPath.Initialise(12,12);
		TriPath.FindStartOfPath();

		// build a circle in the middle of the control
		TriPath.InsertMoveTo(VirtualSize.lo);
		TriPath.InsertLineTo(DocCoord(VirtualSize.hi.x, VirtualSize.lo.y));
		TriPath.InsertLineTo(DocCoord(0, VirtualSize.hi.y));
		TriPath.InsertLineTo(VirtualSize.lo);
		TriPath.IsFilled = TRUE;

		LinearFillAttribute MyTriFill;
		MyTriFill.Colour = ShowFirst ? First : Second;
		MyTriFill.EndColour = DocColour(0,0,0);
		MyTriFill.StartPoint = DocCoord(ExtraInfo->dx, 0);
		MyTriFill.EndPoint = DocCoord(0, ExtraInfo->dy);

		pRender->SetFillGeometry(&MyTriFill, FALSE);
		pRender->DrawPath(&TriPath);

		pRender->RestoreContext();

		// Get rid of the render region
		DestroyGRenderRegion(pRender);
	}

	// and animate it!
	if (ShowFirst)
	{
		INT32 Red, Green, Blue;
		First.GetRGBValue(&Red, &Green, &Blue);

		if (Blue>0)
		{
			// Set the colour back again
			Blue -= 10;
			First.SetRGBValue(Red, Green, Blue);

			// redraw it
			InvalidateGadget(_R(IDC_REDRAW_ME));
		}
	}
	else
	{
		// Set the colour back to how it was
		First.SetRGBValue(255, 0, 250);
	}
}