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
027e1199
Commit
027e1199
authored
Dec 19, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rendering of <atom>
parent
7126b132
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
33 deletions
+47
-33
src/gui/value/text.cpp
src/gui/value/text.cpp
+0
-26
src/mse.vcproj
src/mse.vcproj
+3
-0
src/render/text/compound.cpp
src/render/text/compound.cpp
+32
-0
src/render/text/element.cpp
src/render/text/element.cpp
+5
-4
src/render/text/element.hpp
src/render/text/element.hpp
+1
-1
src/render/text/viewer.cpp
src/render/text/viewer.cpp
+1
-1
src/render/value/text.cpp
src/render/value/text.cpp
+5
-1
No files found.
src/gui/value/text.cpp
View file @
027e1199
...
...
@@ -235,24 +235,6 @@ void TextValueEditor::draw(RotatedDC& dc) {
fixSelection
();
showCaret
();
}
// DEBUG, TODO: REMOVEME
Rotater
r
(
dc
,
style
().
getRotation
());
/*dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetTextForeground(*wxGREEN);
dc.SetFont(wxFont(6,wxFONTFAMILY_SWISS,wxNORMAL,wxNORMAL));
for (size_t i = 0 ; i < value().value().size() ; i += 10) {
RealRect r = v.charRect(i);
r.width = max(r.width,1.);
dc.DrawRectangle(r);
dc.DrawText(String()<<(int)i, r.position()+RealSize(1,5));
}*/
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetBrush
(
*
wxWHITE_BRUSH
);
dc
.
SetTextForeground
(
*
wxBLUE
);
dc
.
SetFont
(
wxFont
(
6
,
wxFONTFAMILY_SWISS
,
wxNORMAL
,
wxNORMAL
));
dc
.
DrawRectangle
(
RealRect
(
style
().
width
-
50
,
style
().
height
-
10
,
50
,
10
));
dc
.
DrawText
(
String
::
Format
(
_
(
"%d - %d"
),
selection_start
,
selection_end
),
RealPoint
(
style
().
width
-
50
,
style
().
height
-
10
));
}
wxCursor
rotated_ibeam
;
...
...
@@ -512,14 +494,6 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
// }
showCaret
();
// TODO; DEBUG!!
Rotater
r
(
rdc
,
style
().
getRotation
());
rdc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
rdc
.
SetBrush
(
*
wxWHITE_BRUSH
);
rdc
.
SetTextForeground
(
*
wxBLUE
);
rdc
.
SetFont
(
wxFont
(
6
,
wxFONTFAMILY_SWISS
,
wxNORMAL
,
wxNORMAL
));
rdc
.
DrawRectangle
(
RealRect
(
style
().
width
-
50
,
style
().
height
-
10
,
50
,
10
));
rdc
.
DrawText
(
String
::
Format
(
_
(
"%d - %d"
),
selection_start
,
selection_end
),
RealPoint
(
style
().
width
-
50
,
style
().
height
-
10
));
}
void
TextValueEditor
::
moveSelectionNoRedraw
(
IndexType
t
,
size_t
new_end
,
bool
also_move_start
,
Movement
dir
)
{
...
...
src/mse.vcproj
View file @
027e1199
...
...
@@ -2507,6 +2507,9 @@
<Filter
Name=
"text"
Filter=
""
>
<File
RelativePath=
".\render\text\compound.cpp"
>
</File>
<File
RelativePath=
".\render\text\element.cpp"
>
</File>
...
...
src/render/text/compound.cpp
0 → 100644
View file @
027e1199
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <render/text/element.hpp>
// ----------------------------------------------------------------------------- : CompoundTextElement
void
CompoundTextElement
::
draw
(
RotatedDC
&
dc
,
double
scale
,
const
RealRect
&
rect
,
const
double
*
xs
,
DrawWhat
what
,
size_t
start
,
size_t
end
)
const
{
elements
.
draw
(
dc
,
scale
,
rect
,
xs
,
what
,
start
,
end
);
}
void
CompoundTextElement
::
getCharInfo
(
RotatedDC
&
dc
,
double
scale
,
vector
<
CharInfo
>&
out
)
const
{
elements
.
getCharInfo
(
dc
,
scale
,
start
,
end
,
out
);
}
double
CompoundTextElement
::
minScale
()
const
{
return
elements
.
minScale
();
}
// ----------------------------------------------------------------------------- : AtomTextElement
void
AtomTextElement
::
draw
(
RotatedDC
&
dc
,
double
scale
,
const
RealRect
&
rect
,
const
double
*
xs
,
DrawWhat
what
,
size_t
start
,
size_t
end
)
const
{
if
(
what
&
DRAW_ACTIVE
)
{
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetBrush
(
Color
(
210
,
210
,
210
));
dc
.
DrawRectangle
(
rect
);
}
CompoundTextElement
::
draw
(
dc
,
scale
,
rect
,
xs
,
what
,
start
,
end
);
}
src/render/text/element.cpp
View file @
027e1199
...
...
@@ -31,12 +31,12 @@ void TextElements::draw(RotatedDC& dc, double scale, const RealRect& rect, const
void
TextElements
::
getCharInfo
(
RotatedDC
&
dc
,
double
scale
,
size_t
start
,
size_t
end
,
vector
<
CharInfo
>&
out
)
const
{
FOR_EACH_CONST
(
e
,
elements
)
{
// characters before this element, after the previous
while
(
start
+
out
.
size
()
<
e
->
start
)
{
while
(
out
.
size
()
<
e
->
start
)
{
out
.
push_back
(
CharInfo
(
RealSize
(
0
,
0
),
BREAK_NO
));
}
e
->
getCharInfo
(
dc
,
scale
,
out
);
}
while
(
start
+
out
.
size
()
<
end
)
{
while
(
out
.
size
()
<
end
)
{
out
.
push_back
(
CharInfo
(
RealSize
(
0
,
0
),
BREAK_NO
));
}
}
...
...
@@ -86,13 +86,14 @@ struct TextElementsFromString {
shared_ptr<ErrorTextElement> e(new ErrorTextElement(text, pos, end));
fromString(e->elements, text, pos, end, style, ctx);
pos = skip_tag(text, end);
} else if (is_substr(text,
start, _("<atom"))) {
*/
}
else
if
(
is_substr
(
text
,
tag_
start
,
_
(
"<atom"
)))
{
// 'atomic' indicator
size_t
end
=
match_close_tag
(
text
,
tag_start
);
shared_ptr
<
AtomTextElement
>
e
(
new
AtomTextElement
(
text
,
pos
,
end
));
fromString
(
e
->
elements
,
text
,
pos
,
end
,
style
,
ctx
);
te
.
elements
.
push_back
(
e
);
pos
=
skip_tag
(
text
,
end
);
*/
}
else
{
}
else
{
// ignore other tags
}
}
else
{
...
...
src/render/text/element.hpp
View file @
027e1199
...
...
@@ -25,7 +25,7 @@ class SymbolFontRef;
enum
DrawWhat
{
DRAW_NOTHING
=
0x00
,
DRAW_NORMAL
=
0x01
// draw normal things, like the text
,
DRAW_
EDITOR
=
0x02
// draw editor stuff, such as borders/lines
,
DRAW_
BORDERS
=
0x02
// draw editor stuff, such as borders/lines
,
DRAW_ACTIVE
=
0x04
// draw active editor stuff, such as hidden separators and atom highlights
};
...
...
src/render/text/viewer.cpp
View file @
027e1199
...
...
@@ -67,7 +67,7 @@ TextViewer::~TextViewer() {}
void
TextViewer
::
draw
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
DrawWhat
what
)
{
assert
(
!
lines
.
empty
());
Rotater
r
(
dc
,
style
.
getRotation
());
// Draw the text
line by line
// Draw the text
,
line by line
FOR_EACH
(
l
,
lines
)
{
if
(
l
.
visible
(
dc
))
{
RealRect
rect
(
l
.
positions
.
front
(),
l
.
top
,
l
.
width
(),
l
.
line_height
);
...
...
src/render/value/text.cpp
View file @
027e1199
...
...
@@ -14,7 +14,11 @@
void
TextValueViewer
::
draw
(
RotatedDC
&
dc
)
{
drawFieldBorder
(
dc
);
v
.
prepare
(
dc
,
value
().
value
(),
style
(),
viewer
.
getContext
());
v
.
draw
(
dc
,
style
(),
DRAW_NORMAL
);
v
.
draw
(
dc
,
style
(),
(
DrawWhat
)(
DRAW_NORMAL
|
(
viewer
.
drawBorders
()
?
DRAW_BORDERS
:
0
)
|
(
viewer
.
drawEditing
()
&&
isCurrent
()
?
DRAW_ACTIVE
:
0
)
));
}
void
TextValueViewer
::
onValueChange
()
{
...
...
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