Пример #1
0
void FIF(g2_filled_para_5)(F_REAL *dev, F_REAL *N_pt, F_REAL *points)
{
    double *d;
    d=g2_floatp2doublep(points, dtoi(*N_pt)*2);
    g2_filled_para_5(dtoi(*dev), dtoi(*N_pt), d);
    g2_free(d);
}
Пример #2
0
void FIF(g2_polygon)(F_REAL *dev, F_REAL *N_pt, F_REAL *points)
{
    double *d;
    d=g2_floatp2doublep(points, dtoi(*N_pt)*2);
    g2_polygon(dtoi(*dev), dtoi(*N_pt), d);
    g2_free(d);
}
Пример #3
0
//////////////////////////////////////////////////////////////////////
// Transform a single point
void CAGMatrix::Transform(const POINT& Pt, long& x, long& y) const
{
    double fx = Pt.x;
    double fy = Pt.y;
    x = dtoi(fx * m_ax + fy * m_bx + m_cx);
    y = dtoi(fx * m_ay + fy * m_by + m_cy);
}
Пример #4
0
void FIF(g2_filled_b_spline)(F_REAL *dev, F_REAL *N_pt, F_REAL *points, F_REAL *o)
{
    double *d;
    d=g2_floatp2doublep(points, dtoi(*N_pt)*2);
    g2_filled_b_spline(dtoi(*dev), dtoi(*N_pt), d, dtoi(*o));
    g2_free(d);
}
Пример #5
0
//////////////////////////////////////////////////////////////////////
// Transform a single point
void CAGMatrix::Transform(POINT& Pt) const
{
    double fx = Pt.x;
    double fy = Pt.y;
    Pt.x = dtoi(fx * m_ax + fy * m_bx + m_cx);
    Pt.y = dtoi(fx * m_ay + fy * m_by + m_cy);
}
Пример #6
0
void FIF(g2_set_dash)(F_REAL *dev, F_REAL *N, F_REAL *dashes)
{
    double *d;
    d=g2_floatp2doublep(dashes, dtoi(*N));
    g2_set_dash(dtoi(*dev), dtoi(*N), d);
    g2_free(d);
}
Пример #7
0
void FIF(g2_filled_raspln)(F_REAL *dev, F_REAL *N_pt, F_REAL *points, F_REAL *tn)
{
    double *d;
    d=g2_floatp2doublep(points, dtoi(*N_pt)*2);
    g2_filled_raspln(dtoi(*dev), dtoi(*N_pt), d, *tn);
    g2_free(d);
}
Пример #8
0
/*
 *
 * Transform user size in phyisical device size (int)
 *
 */
void g2_us2pds_int(g2_physical_device *pd, double x, double y,
		   int *ix, int *iy)
{
    if(ix!=NULL)
	*ix=dtoi(x*fabs(pd->x_mul*pd->a11));
    if(iy!=NULL)
	*iy=dtoi(y*fabs(pd->y_mul*pd->a22));
}
Пример #9
0
/*
 *
 * Transform user coord. in phyisical device coord (int)
 *
 */
void g2_uc2pdc_int(g2_physical_device *pd, double x, double y,
		   int *ix, int *iy)
{
    double vx, vy;
    
    vx=pd->x_mul*x+pd->x_origin;
    vy=pd->y_mul*y+pd->y_origin;
    
    *ix = dtoi(pd->a11*vx + pd->b1);
    *iy = dtoi(pd->a22*vy + pd->b2);
}
Пример #10
0
//--------------------------------------------------------------------------//
// Transform the specified points.											//
//--------------------------------------------------------------------------//
void CAGMatrix::Transform(POINT* pPts, int nCount, bool bTranslate) const
{
	double dx = (bTranslate ? m_31 : 0.0);
	double dy = (bTranslate ? m_32 : 0.0);

	while (nCount--)
	{
		int x   = dtoi((double)pPts->x * m_11 + (double)pPts->y * m_21 + dx);
		pPts->y = dtoi((double)pPts->x * m_12 + (double)pPts->y * m_22 + dy);
		pPts->x = x;
		pPts++;
	}
}
Пример #11
0
//////////////////////////////////////////////////////////////////////
// Transform an array of points
void CAGMatrix::Transform(POINT* pPts, int nCount, bool bTranslate) const
{
    double dx = (bTranslate ? m_cx : 0.0);
    double dy = (bTranslate ? m_cy : 0.0);

    while (nCount--)
    {
        double fx = pPts->x;
        double fy = pPts->y;
        pPts->x = dtoi(fx * m_ax + fy * m_bx + dx);
        pPts->y = dtoi(fx * m_ay + fy * m_by + dy);
        pPts++;
    }
}
Пример #12
0
/* thanks to Yuri Sbitnev for contributing the g2_image code for FORTRAN */
void FIF(g2_image)(F_REAL *dev, F_REAL *x, F_REAL *y, F_REAL *x_size, F_REAL *y_size,
		   F_REAL *pens)
{
    int i, j, xs, ys;
    int *mypens;
    xs=dtoi(*x_size);
    ys=dtoi(*y_size);
    mypens=(int *) g2_malloc(xs*ys*sizeof(int));
    for(j=0;j<ys;j++) 
      for(i=0;i<xs;i++) 
        mypens[j*xs+i]=dtoi(pens[j*xs+i]);         /* pens[dtoi(*y_size)][dtoi(*x_size)] */
    g2_image(dtoi(*dev), *x, *y, xs, ys, mypens);
    g2_free(mypens);
}
Пример #13
0
F_REAL FIF(g2_open_ps)(F_CHAR *text, F_REAL *paper, F_REAL *orientation,
		       F_CHAR_LENGTH length)
{
    char *str;
    int rv;

    str=g2_malloc((length+1)*sizeof(char));
    strncpy(str, text, length);
    str[length]='\0';
    rv=g2_open_PS(str, dtoi(*paper), dtoi(*orientation));
    g2_free(str);
    
    return (F_REAL)rv;
}
Пример #14
0
void mmi_tuner_set(int argc, char *argv[])
{
    u16  intMask;
    int i;
    int res;
    u32 freq = 0;

    switch (argc)
    {
        case 2:
            freq = dtoi(argv[1]);

            print_log("Tuner is set channel freq = %d\n", freq);
            mtv_set_channel(hDevice, freq);

            res = mtv_lock_check(hDevice);
            if(res)
            {
                print_log("Lock Fail\n");
                //continue;
            }
            else
                print_log("Lock OK \n");

            break;

        default:
            print_log("Usage : %s [u1|ytn|kdmb|mbc|kbs|sbs]\n", argv[0]);
            break;
    }
}
Пример #15
0
void CColorCombo::InitDialog(HWND hWndCtrl, bool bDefaultColors, bool bAllowOffOption)
{
	if (!hWndCtrl)
		return;

	SubclassWindow(hWndCtrl);

	AddComboToList();

	long lWidth = GetDroppedWidth();
	long lRet = SetDroppedWidth(dtoi(2.75 * lWidth));

	// Stuff the combobox with colors
	
	// Add a place holder for the Custom option (the color picker)
	int nItem = AddString("");
	SetItemData(nItem, CLR_NONE);

	if (bAllowOffOption)
	{
		nItem = AddString("");
		SetItemData(nItem, CLR_DEFAULT);
	}

	if (bDefaultColors)
	{
		for (int i = 0; i < NDEFAULTCOLORS; i++)
		{
			nItem = AddString("");
			SetItemData(nItem, CColorCombo::m_DefaultColors[i].Color);
		}
	}
}
Пример #16
0
long CDocCommands::GetAngle()
{
	CImageObject* pObject = m_DocWindow.GetSelectedObject();
	if (!pObject)
		return 0;

	return dtoi(pObject->GetAngle());
}
Пример #17
0
void FIF(g2_set_coordinate_system)(F_REAL *dev,
				   F_REAL *x_origin, F_REAL *y_origin,
				   F_REAL *x_mul,    F_REAL *y_mul)
{
    g2_set_coordinate_system(dtoi(*dev),
			     *x_origin, *y_origin,
			     *x_mul,    *y_mul);
}
Пример #18
0
void FIF(g2_string)(F_REAL *dev, F_REAL *x, F_REAL *y, F_CHAR *text,
		    F_CHAR_LENGTH length)
{
    char *str;
    str=g2_malloc((length+1)*sizeof(char));
    strncpy(str, text, length);
    str[length]='\0';
    g2_string(dtoi(*dev), *x, *y, str);
    g2_free(str);
}
Пример #19
0
LRESULT CToolsCtlPanelText::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	InitToolCtrls();
	InitToolTips();

	SetFonts();

	m_ComboFonts.SetCurSel(-1);
	long lWidth = m_ComboFonts.GetDroppedWidth();
	long lRet = m_ComboFonts.SetDroppedWidth(dtoi(2.0 * lWidth));

	bHandled = true;
	return S_OK;
}
Пример #20
0
void CCalSupport::DrawRectangle(const RECT& Rect, const CAGMatrix& Matrix, COLORREF LineColor, int LineWidth, COLORREF FillColor, const CString& strText, const CAGSpec& Spec, int VertJust, int nLineWidth, int nLineHeight)
{
//j	#define RND (int)(255 * ((double)rand() / RAND_MAX))
//j	LineColor = RGB(RND, RND, RND);

	POINT pPoints[4];
	Matrix.TransformRectToPolygon(Rect, pPoints);

	HRGN hClipRegion = m_dc.SaveClipRegion();
	m_dc.SetClipRectangle(pPoints);

	// Draw the interior
	if (FillColor != CLR_NONE)
		m_dc.FillRectangle(pPoints, FillColor);

	// Draw the text
	if (!strText.IsEmpty())
	{
		CRect RectDeflated = Rect;
		RectDeflated.DeflateRect(nLineWidth, nLineHeight);
		Spec.DrawTextAligned(&m_dc, strText, NULL, RectDeflated, (eVertJust)VertJust);
	}

	// Draw the outline (non-hairline)
	if (LineWidth >= LT_Normal)
	{
		int iLineWidth = dtoi(m_dc.GetViewToDeviceMatrix().TransformDistance(2*LineWidth+1));
		m_dc.DrawRectangle(pPoints, LineColor, iLineWidth, CLR_NONE);
	}

	m_dc.RestoreClipRegion(hClipRegion);

	// Draw the outline (hairline)
	if (LineWidth == LT_Hairline)
		m_dc.DrawRectangle(pPoints, LineColor, LT_Hairline, CLR_NONE);
}
Пример #21
0
void FIF(g2_plot_qp)(F_REAL *dev, F_REAL *x, F_REAL *y)
{
    g2_plot_QP(dtoi(*dev), *x, *y);
}
Пример #22
0
void FIF(g2_reset_palette)(F_REAL *dev)
{
    g2_reset_palette(dtoi(*dev));
}
Пример #23
0
void FIF(g2_filled_rectangle)(F_REAL *dev,
			      F_REAL *x1, F_REAL *y1,
			      F_REAL *x2, F_REAL *y2)
{
    g2_filled_rectangle(dtoi(*dev), *x1, *y1, *x2, *y2);
}
Пример #24
0
void FIF(g2_set_font_size)(F_REAL *dev, F_REAL *size)
{
    g2_set_font_size(dtoi(*dev), *size);
}
Пример #25
0
void FIF(g2_set_background)(F_REAL *dev, F_REAL *color)
{
    g2_set_background(dtoi(*dev), dtoi(*color));
}
Пример #26
0
void FIF(g2_set_line_width)(F_REAL *dev, F_REAL *w)
{
    g2_set_line_width(dtoi(*dev), *w);
}
Пример #27
0
void FIF(g2_triangle)(F_REAL *dev, F_REAL *x1, F_REAL *y1,
		      F_REAL *x2, F_REAL *y2,
		      F_REAL *x3, F_REAL *y3)
{
    g2_triangle(dtoi(*dev), *x1, *y1, *x2, *y2, *x3, *y3);
}
Пример #28
0
void CDocWindow::SetupPageView(bool bSetScrollbars)
{
	#define OUTSIDE_PADDING_X 10
	#define OUTSIDE_PADDING_Y 10

	if (!m_hWnd)
		return;

	if (!m_pClientDC)
		return;

	if (m_PageRect.IsRectEmpty())
		return;
		
	// Suspend any selection tracking
	m_Select.SuspendTracking();

	// Clear the old page from the offscreen DC
	m_pClientDC->Clear();

	// Invalidate the old page rect (m_PageViewRect) before we change it
	InvalidatePage();

	// Now figure out how much window area we have for the document display
	CRect WndRect;
	GetClientRect(&WndRect);
	
	// Subtract the outside padding
	WndRect.bottom -= m_ShadowSize.cx;
	WndRect.right -= m_ShadowSize.cy;
	WndRect.InflateRect(-OUTSIDE_PADDING_X, -OUTSIDE_PADDING_Y);

	// Convert to Document coordinates
	m_pClientDC->GetDeviceMatrix().Inverse().Transform(WndRect);

	int xVisible = WndRect.Width();
	int yVisible = WndRect.Height();

	// Fit the extended page into the available window space
	int dxPage = m_PageRect.Width();
	int dyPage = m_PageRect.Height();
	if (!dxPage) dxPage = 1;
	if (!dyPage) dyPage = 1;
	double fxPageScale = (double)xVisible / dxPage;
	double fyPageScale = (double)yVisible / dyPage;
	double fFitInWindowScale = min(fxPageScale, fyPageScale);
	if (!fFitInWindowScale) fFitInWindowScale = 1.0;

	// Default the scroll position to the center of the current page
	int xPos = -1;
	int yPos = -1;

	// Special setting to indicate a zoom into the center of the SELECTED OBJECT
	if (m_fZoomScale == -1.0 && m_Select.GetSelected())
	{
		CRect DestRect = m_Select.GetSelected()->GetDestRectTransformed();
		int dxObject = DestRect.Width();
		int dyObject = DestRect.Height();
		if (!dxObject) dxObject = 1;
		if (!dyObject) dyObject = 1;
		double fxObjectScale = (double)xVisible / dxObject;
		double fyObjectScale = (double)yVisible / dyObject;
		double fFitScaleObject = min(fxObjectScale, fyObjectScale);
		m_fZoomScale = fFitScaleObject / fFitInWindowScale;
		m_iZoom = dtoi(m_fZoomScale - 1.0);
		
		// Set the (x,y) position to be the center of the object
		xPos = (DestRect.left + DestRect.right) / 2;
		yPos = (DestRect.top + DestRect.bottom) / 2;
	}
	
	// Special setting to indicate a zoom into the width of the FULL PAGE
	if (m_fZoomScale <= 0)
	{
		m_fZoomScale = fxPageScale / fFitInWindowScale;
		m_iZoom = dtoi(m_fZoomScale - 1.0);
	}

	// Compute the scale and adjust the visible area
	double fScale = fFitInWindowScale * m_fZoomScale;
	xVisible = dtoi((double)xVisible / fScale);
	yVisible = dtoi((double)yVisible / fScale);

	// If the (x,y) position was set to the object center, adjust it by 1/2 the visible area
	if (xPos >= 0 || yPos >= 0)
	{
		xPos -= xVisible / 2;
		yPos -= yVisible / 2;
	}

	// Setup the scrollbars
	if (bSetScrollbars)
		SetupScrollbars(xPos, yPos, dxPage, dyPage, xVisible, yVisible, true/*bRedraw*/);

	// Get the updated position
	xPos = GetScrollPos(SB_HORZ);
	yPos = GetScrollPos(SB_VERT);

	// Calculate a view matrix
	int xExcess = xVisible - dxPage; if (xExcess < 0) xExcess = 0;
	int yExcess = yVisible - dyPage; if (yExcess < 0) yExcess = 0;
	CAGMatrix ViewMatrix;
	ViewMatrix.Translate(xExcess/2 - xPos, yExcess/2 - yPos);
	ViewMatrix.Scale(fScale, fScale);
	ViewMatrix.Translate(WndRect.left, WndRect.top);
	m_pClientDC->SetViewingMatrix(ViewMatrix);

	// Compute the new page view rectangle (screen coordinates)
	CSize PageSize(m_PageRect.Width(), m_PageRect.Height());
	m_pClientDC->SetClipToView(PageSize, &m_PageViewRect, true/*bIncludeRawDC*/);

	// Invalidate the new page rect (m_PageViewRect) now that we've changed it
	InvalidatePage();

	// Resume any selection tracking
	m_Select.ResumeTracking();
}
Пример #29
0
LRESULT CCtlPanelText::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	bool bTextPanel = (m_nResID == IDD_PANEL_TEXT);
	if (bTextPanel)
	{
		CCtlPanel::InitLabels();
		CCtlPanel::InitLineCombos(true);

		m_ColorComboFill.InitDialog(GetDlgItem(IDC_FILL_COLOR));
		m_ColorComboFill2.InitDialog(GetDlgItem(IDC_FILL_COLOR2));

		m_ComboFillType.InitDialog(GetDlgItem(IDC_FILL_TYPE));
		LPCSTR szFillTypes[] = { "None", "Solid", "Sweep Right", "Sweep Down" };
		for (int i = 0; i < sizeof(szFillTypes)/sizeof(LPCSTR); i++)
			m_ComboFillType.AddString(szFillTypes[i]);
		m_ComboFillType.SetCurSel(0);

		m_ComboTextSize.InitDialog(GetDlgItem(IDC_TEXT_SIZE));
		m_ComboFonts.InitDialog(GetDlgItem(IDC_FONT));

		CString strText;
		int iIncrement = 1;
		for (int i = 1; i <= 72; i += iIncrement)
		{
			int iTextSize = i;
			strText.Format("%d", iTextSize);
			int nItem = m_ComboTextSize.AddString(strText);
			m_ComboTextSize.SetItemData(nItem, POINTUNITS(iTextSize));
			if (i == 12) iIncrement++;
		}

		m_ComboTextSize.SetCurSel(-1);

		m_ButtonBold.InitDialog(GetDlgItem(IDC_BOLD), IDB_BOLD);
		m_ButtonItalic.InitDialog(GetDlgItem(IDC_ITALIC), IDB_ITALIC);
		m_ButtonUnderline.InitDialog(GetDlgItem(IDC_UNDERLINE), IDB_UNDERLINE);

		m_ButtonLeft.InitDialog(GetDlgItem(IDC_LEFT), IDB_LEFT);
		m_ButtonCenter.InitDialog(GetDlgItem(IDC_CENTER), IDB_CENTER);
		m_ButtonRight.InitDialog(GetDlgItem(IDC_RIGHT), IDB_RIGHT);

		m_ButtonTop.InitDialog(GetDlgItem(IDC_TOP), IDB_TOP);
		m_ButtonMiddle.InitDialog(GetDlgItem(IDC_MIDDLE), IDB_MIDDLE);
		m_ButtonBottom.InitDialog(GetDlgItem(IDC_BOTTOM), IDB_BOTTOM);
		m_ButtonPrev.InitDialog(GetDlgItem(IDC_BACK), IDB_BACK);

#ifdef NOTUSED
		{
			m_ButtonPrev.SubclassWindow(GetDlgItem(IDC_BACK));
			CImage Image(_AtlBaseModule.GetResourceInstance(), IDB_BACK, "GIF");
			HBITMAP hBitmap = Image.GetBitmapHandle();
			BITMAP bm;

			::GetObject(hBitmap, sizeof(bm), &bm);
			int dx = bm.bmWidth/3;
			int dy = bm.bmHeight;

			m_ImageList.Create(dx, dy, ILC_COLOR24, 1, 1);
			m_ImageList.Add(hBitmap);
			m_ButtonPrev.SetImageList(m_ImageList.m_hImageList);
			m_ButtonPrev.SetImages(0, 1, 0, 0);
			m_ButtonPrev.SizeToImage();
			m_ButtonPrev.SetBitmapButtonExtendedStyle(BMPBTN_AUTO3D_DOUBLE);
		}
#endif NOTUSED

		SetFonts();

		m_ComboFonts.SetCurSel(-1);
		long lWidth = m_ComboFonts.GetDroppedWidth();
		long lRet = m_ComboFonts.SetDroppedWidth(dtoi(2.0 * lWidth));

		::ShowWindow(GetDlgItem(IDC_BACK), SW_HIDE);
	}

	bHandled = true;
	return S_OK;
}
Пример #30
0
void FIF(g2_set_qp)(F_REAL *dev, F_REAL *d, F_REAL *shape)
{
    g2_set_QP(dtoi(*dev), *d, dtoi(*shape));
}