-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDrawMarks.cpp
More file actions
126 lines (101 loc) · 3.57 KB
/
DrawMarks.cpp
File metadata and controls
126 lines (101 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*-----------------------------------------------------------------------------
6502 Macroassembler and Simulator
Copyright (C) 1995-2003 Michal Kowalski
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------*/
#include "StdAfx.h"
#include "DrawMarks.h"
// Funkcje kreœl¹ce strza³kê, miejsce przerwania i b³êdu
// Wykorzystane w klasach ...View
COLORREF CMarks::m_rgbPointer= RGB(255,255,0);
COLORREF CMarks::m_rgbBreakpoint= RGB(0,0,255);
COLORREF CMarks::m_rgbError= RGB(255,0,0);
//-----------------------------------------------------------------------------
void CMarks::draw_pointer(CDC &dc, int x, int y, int h)
{
static const POINT shape[]=
{ {-4,-3}, {0,-3}, {0,-7}, {7,0}, {0,7}, {0,3}, {-4,3}, {-4,-3} };
const int size= sizeof shape / sizeof(POINT);
POINT coords[size];
x += (6 * h) / 15;
y += (7 * h) / 15;
for (int i=0; i<size; i++)
{
coords[i].x = x + (shape[i].x * h) / 15; // przeskalowanie i przesuniêcie
coords[i].y = y + (shape[i].y * h) / 15;
}
CPen *pOldPen, pen(PS_SOLID,0,::GetSysColor(COLOR_WINDOWTEXT));
pOldPen = dc.SelectObject(&pen);
if (pOldPen==NULL)
return;
CBrush brush(m_rgbPointer);
CBrush *pOldBrush= dc.SelectObject(&brush);
if (pOldBrush==NULL)
{
dc.SelectObject(pOldPen);
return;
}
dc.SetPolyFillMode(ALTERNATE);
dc.Polygon(coords,size);
dc.SelectObject(pOldPen);
dc.SelectObject(pOldBrush);
}
//-----------------------------------------------------------------------------
void CMarks::draw_breakpoint(CDC &dc, int x, int y, int h, bool active)
{
CPen *pOldPen, pen(PS_SOLID,0,::GetSysColor(COLOR_WINDOWTEXT));
pOldPen = dc.SelectObject(&pen);
if (pOldPen==NULL)
return;
CBrush brush(active ? m_rgbBreakpoint : dc.GetBkColor());
CBrush *pOldBrush= dc.SelectObject(&brush);
if (pOldBrush==NULL)
{
dc.SelectObject(pOldPen);
return;
}
dc.Ellipse(x,y,x+h,y+h);
dc.SelectObject(pOldPen);
dc.SelectObject(pOldBrush);
}
//-----------------------------------------------------------------------------
void CMarks::draw_mark(CDC &dc, int x, int y, int h)
{
static const POINT shape[]=
{ {-1,-7}, {0,-7}, {7,0}, {0,7}, {-1,7}, {-1,-7} };
// { {0,0}, {1,0}, {8,7}, {1,14}, {0,14}, {0,0} };
const int size= sizeof shape / sizeof(POINT);
POINT coords[size];
x += (3 * h) / 15;
y += (7 * h) / 15;
for (int i=0; i<size; i++)
{
coords[i].x = x + (shape[i].x * h) / 15;
coords[i].y = y + (shape[i].y * h) / 15;
}
CPen *pOldPen, pen(PS_SOLID,0,::GetSysColor(COLOR_WINDOWTEXT));
pOldPen = dc.SelectObject(&pen);
if (pOldPen==NULL)
return;
CBrush brush(m_rgbError), *pOldBrush= dc.SelectObject(&brush);
if (pOldBrush==NULL)
{
dc.SelectObject(pOldPen);
return;
}
dc.SetPolyFillMode(ALTERNATE);
dc.Polygon(coords,size);
dc.SelectObject(pOldPen);
dc.SelectObject(pOldBrush);
}
//-----------------------------------------------------------------------------