Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
0f33f760
Commit
0f33f760
authored
Dec 19, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drawing <line> borders
parent
027e1199
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
src/render/text/viewer.cpp
src/render/text/viewer.cpp
+25
-0
src/render/text/viewer.hpp
src/render/text/viewer.hpp
+2
-0
No files found.
src/render/text/viewer.cpp
View file @
0f33f760
...
...
@@ -67,6 +67,11 @@ TextViewer::~TextViewer() {}
void
TextViewer
::
draw
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
DrawWhat
what
)
{
assert
(
!
lines
.
empty
());
Rotater
r
(
dc
,
style
.
getRotation
());
// separator lines?
// do this first, so pen is still set from drawing the field border
if
(
what
&
DRAW_BORDERS
)
{
drawSeparators
(
dc
);
}
// Draw the text, line by line
FOR_EACH
(
l
,
lines
)
{
if
(
l
.
visible
(
dc
))
{
...
...
@@ -98,6 +103,26 @@ void TextViewer::Line::drawSelection(RotatedDC& dc, size_t sel_start, size_t sel
}
}
void
TextViewer
::
drawSeparators
(
RotatedDC
&
dc
)
{
// separator lines
bool
separator
=
false
;
double
y
=
0
;
FOR_EACH
(
l
,
lines
)
{
double
y2
=
l
.
top
+
l
.
line_height
;
if
(
separator
&&
l
.
visible
(
dc
))
{
// between the two lines
y
=
(
y
+
l
.
top
)
/
2
;
dc
.
DrawLine
(
RealPoint
(
0
,
y
),
RealPoint
(
dc
.
getInternalRect
().
width
,
y
));
}
separator
=
l
.
separator_after
;
y
=
y2
;
}
// separator at the end?
if
(
separator
)
{
dc
.
DrawLine
(
RealPoint
(
0
,
y
),
RealPoint
(
dc
.
getInternalRect
().
width
,
y
));
}
}
void
TextViewer
::
prepare
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
ctx
)
{
if
(
lines
.
empty
())
{
// not prepared yet
...
...
src/render/text/viewer.hpp
View file @
0f33f760
...
...
@@ -50,6 +50,8 @@ class TextViewer {
void
draw
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
DrawWhat
what
);
/// Draw an indicator for selected text
void
drawSelection
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
size_t
sel_start
,
size_t
sel_end
);
/// Draw separators for <line> tags
void
drawSeparators
(
RotatedDC
&
dc
);
/// Prepare the text for drawing, if it is not already prepared
void
prepare
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment