You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
#include "stdafx.h"
|
|
#include "SigmaView.h"
|
|
#include "SectionDoc.h"
|
|
#include "ItemGrid.h"
|
|
#include "MxnFormat\AxisLayout.h"
|
|
using namespace NItem;
|
|
|
|
static CItemEditGrid * GetItemEditGridFromView(CSigmaView * pView)
|
|
{
|
|
if (pView == NULL)
|
|
return 0;
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
if (pItem == NULL)
|
|
return 0;
|
|
|
|
CItemEditGrid * itemGrid = dynamic_cast<CItemEditGrid *>(pItem);
|
|
if (itemGrid == NULL)
|
|
return 0;
|
|
|
|
return itemGrid;
|
|
}
|
|
|
|
extern "C" __declspec(dllexport)
|
|
int RectangularCSGrid_GetStepAndRange(CSigmaView * pView, RectangularCSGridData * pData)
|
|
{
|
|
CItemEditGrid * pItem = GetItemEditGridFromView(pView);
|
|
if (pItem == NULL)
|
|
return -1;
|
|
|
|
return pItem->GetStepAndRange(pData);
|
|
}
|
|
|
|
extern "C" __declspec(dllexport)
|
|
int RectangularCSGrid_Create(CSigmaView * pView, RectangularCSGridData * pData, HDC hdcMem)
|
|
{
|
|
CItemEditGrid * pItem = GetItemEditGridFromView(pView);
|
|
if (pItem == NULL)
|
|
return -1;
|
|
CDC *pDC = CDC::FromHandle(hdcMem);
|
|
return pItem->Create(pData, pDC);
|
|
}
|
|
extern "C" __declspec(dllexport)
|
|
int GridGetStepAndRange(double left, double bottom, double right, double top, RectangularCSGridData * pData)
|
|
{
|
|
if (pData == NULL)
|
|
return -1;
|
|
|
|
pData->left = left;
|
|
pData->top = top;
|
|
pData->right = right;
|
|
pData->bottom = bottom;
|
|
|
|
//×Ô¶¯¼ÆËã²½³¤
|
|
CAxisLayout al(left, right, 1);
|
|
TIntervalStep<double> sx = al.sd;
|
|
double step = min(sx.step, al.sd.step);
|
|
pData->stepX = pData->stepY = step;
|
|
pData->textHeight = step / 40.0;
|
|
pData->borderThickness = pData->textHeight / 2.0;
|
|
return 1;
|
|
} |