BOOL CLCView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
m_pViewWnd=pWnd;
switch (m_dToolBox.CursorValue){
case AND:
lhCursor=AfxGetApp()->LoadCursor(IDC_AND);
SetCursor(lhCursor);
ShowFlag=TRUE;
break;
case NAND:
lhCursor=AfxGetApp()->LoadCursor(IDC_NAND);
SetCursor(lhCursor);
...........
}
void CLCView::ShowBitmap(int x,int y,int kind)
{
CDocument* pDoc = GetDocument();
CClientDC dc(this);
CBitmap bitmap;
CDC dcMemory;
BITMAP bm;
switch (kind) {
case AND :
bitmap.LoadMappedBitmap(IDB_AND,0);
break;
case NAND :
bitmap.LoadMappedBitmap(IDB_NAND,0);
void CLCView::OnCalc()
{
m_dToolBox.UpdateData(TRUE);
if (m_dToolBox.m_rOption==0)
FastTrace=TRUE;
else
FastTrace=FALSE;
m_dToolBox.UpdateData(FALSE);
Calc();
}
boolean CLCView::Snaper(int x, int y,int kind)
{
x=(x/32)*32;
y=(y/32)*32;
if(ShowFlag==TRUE)
{
ShowBitmap(x,y,m_dToolBox.CursorValue);
ScreenMap(x,y,m_dToolBox.CursorValue);
}
else
if (kind==_DEL)
{
ShowBitmap(x,y,m_dToolBox.CursorValue);
.....
.....
}
...
}
boolean CLCView::ScreenMap(int x, int y,int kind)
{
int xMem,yMem;
xMem=x/32;
yMem=y/32;
switch (kind) {
case AND :
screen[xMem][yMem].Gate=AND;
screen[xMem][yMem].SGate="AND";
screen[xMem][yMem].Group=1;
screen[xMem][yMem].lunched=1;
break;
case NAND :
screen[xMem][yMem].Gate=NAND
...
...
void CLCView::Calc()
{
for (int i=0;i<32;i++)
for (int j=0;j<24;j++)
if (screen[i][j].lunched==1)
{
UpdateData(FALSE);
switch (screen[i][j].Gate)
{
case AND :
{
switch (screen[i-1][j].Gate)
{
case DLR :
screen[i][j].inValue1=screen[i-1][j].outValue1;
...........
.............
..............
}