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
767b8611
Commit
767b8611
authored
Dec 19, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reading alignments
parent
3583a8f5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
src/util/alignment.cpp
src/util/alignment.cpp
+16
-6
No files found.
src/util/alignment.cpp
View file @
767b8611
...
@@ -34,13 +34,23 @@ RealPoint align_in_rect(Alignment align, const RealSize& to_align, const RealRec
...
@@ -34,13 +34,23 @@ RealPoint align_in_rect(Alignment align, const RealSize& to_align, const RealRec
// ----------------------------------------------------------------------------- : Reflection stuff
// ----------------------------------------------------------------------------- : Reflection stuff
/// Convert a String to an Alignment
/// Convert a String to an Alignment
Alignment
fromString
(
const
String
&
str
)
{
Alignment
from_string
(
const
String
&
s
)
{
int
al
=
0
;
int
al
=
ALIGN_TOP_LEFT
;
if
(
s
.
find
(
_
(
"left"
))
!=
String
::
npos
)
al
=
ALIGN_LEFT
|
(
al
&
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"center"
))
!=
String
::
npos
)
al
=
ALIGN_CENTER
|
(
al
&
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"right"
))
!=
String
::
npos
)
al
=
ALIGN_RIGHT
|
(
al
&
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"justify"
))
!=
String
::
npos
)
al
=
ALIGN_JUSTIFY
|
(
al
&
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"justify-words"
))
!=
String
::
npos
)
al
=
ALIGN_JUSTIFY_WORDS
|
(
al
&
ALIGN_VERTICAL
);
if
(
s
.
find
(
_
(
"shrink-overflow"
))
!=
String
::
npos
)
al
=
ALIGN_JUSTIFY_OVERFLOW
|
(
al
&
~
ALIGN_JUSTIFY_OVERFLOW
);
if
(
s
.
find
(
_
(
"top"
))
!=
String
::
npos
)
al
=
ALIGN_TOP
|
(
al
&
ALIGN_HORIZONTAL
);
if
(
s
.
find
(
_
(
"middle"
))
!=
String
::
npos
)
al
=
ALIGN_MIDDLE
|
(
al
&
ALIGN_HORIZONTAL
);
if
(
s
.
find
(
_
(
"bottom"
))
!=
String
::
npos
)
al
=
ALIGN_BOTTOM
|
(
al
&
ALIGN_HORIZONTAL
);
if
(
s
.
find
(
_
(
"stretch"
))
!=
String
::
npos
)
al
=
ALIGN_STRETCH
;
return
static_cast
<
Alignment
>
(
al
);
return
static_cast
<
Alignment
>
(
al
);
}
}
/// Convert an Alignment to a String
/// Convert an Alignment to a String
String
to
S
tring
(
Alignment
align
)
{
String
to
_s
tring
(
Alignment
align
)
{
String
ret
;
String
ret
;
// vertical
// vertical
if
(
align
&
ALIGN_TOP
)
ret
+=
_
(
" top"
);
if
(
align
&
ALIGN_TOP
)
ret
+=
_
(
" top"
);
...
@@ -61,11 +71,11 @@ String toString(Alignment align) {
...
@@ -61,11 +71,11 @@ String toString(Alignment align) {
// we need custom io, because there can be both a horizontal and a vertical component
// we need custom io, because there can be both a horizontal and a vertical component
template
<>
void
Reader
::
handle
(
Alignment
&
align
)
{
template
<>
void
Reader
::
handle
(
Alignment
&
align
)
{
align
=
from
S
tring
(
value
);
align
=
from
_s
tring
(
value
);
}
}
template
<>
void
Writer
::
handle
(
const
Alignment
&
align
)
{
template
<>
void
Writer
::
handle
(
const
Alignment
&
align
)
{
handle
(
to
S
tring
(
align
));
handle
(
to
_s
tring
(
align
));
}
}
template
<>
void
GetDefaultMember
::
handle
(
const
Alignment
&
align
)
{
template
<>
void
GetDefaultMember
::
handle
(
const
Alignment
&
align
)
{
handle
(
to
S
tring
(
align
));
handle
(
to
_s
tring
(
align
));
}
}
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