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
488aa15d
Commit
488aa15d
authored
Dec 11, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct cursor movement after typing
parent
7090b6cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
11 deletions
+26
-11
src/gui/value/text.cpp
src/gui/value/text.cpp
+11
-3
src/render/text/viewer.cpp
src/render/text/viewer.cpp
+10
-6
src/render/text/viewer.hpp
src/render/text/viewer.hpp
+3
-1
src/render/value/text.cpp
src/render/value/text.cpp
+2
-1
No files found.
src/gui/value/text.cpp
View file @
488aa15d
...
@@ -224,7 +224,15 @@ void TextValueEditor::onMenu(wxCommandEvent& ev) {
...
@@ -224,7 +224,15 @@ void TextValueEditor::onMenu(wxCommandEvent& ev) {
void
TextValueEditor
::
draw
(
RotatedDC
&
dc
)
{
void
TextValueEditor
::
draw
(
RotatedDC
&
dc
)
{
TextValueViewer
::
draw
(
dc
);
TextValueViewer
::
draw
(
dc
);
v
.
drawSelection
(
dc
,
style
(),
selection_start
,
selection_end
);
if
(
isCurrent
())
{
v
.
drawSelection
(
dc
,
style
(),
selection_start
,
selection_end
);
// show caret, onAction() would be a better place
// but it has to be done after the viewer has updated the TextViewer
// we could do that ourselfs, but we need a dc for that
fixSelection
();
showCaret
();
}
// DEBUG, TODO: REMOVEME
// DEBUG, TODO: REMOVEME
Rotater
r
(
dc
,
style
().
getRotation
());
Rotater
r
(
dc
,
style
().
getRotation
());
/*dc.SetPen(*wxRED_PEN);
/*dc.SetPen(*wxRED_PEN);
...
@@ -269,8 +277,6 @@ void TextValueEditor::onAction(const ValueAction& action, bool undone) {
...
@@ -269,8 +277,6 @@ void TextValueEditor::onAction(const ValueAction& action, bool undone) {
TYPE_CASE
(
action
,
TextValueAction
)
{
TYPE_CASE
(
action
,
TextValueAction
)
{
selection_start
=
action
.
selection_start
;
selection_start
=
action
.
selection_start
;
selection_end
=
action
.
selection_end
;
selection_end
=
action
.
selection_end
;
fixSelection
();
if
(
isCurrent
())
showCaret
();
}
}
}
}
...
@@ -437,6 +443,8 @@ void TextValueEditor::replaceSelection(const String& replacement, const String&
...
@@ -437,6 +443,8 @@ void TextValueEditor::replaceSelection(const String& replacement, const String&
moveSelection
(
selection_start
);
moveSelection
(
selection_start
);
return
;
return
;
}
}
// perform the action
// NOTE: this calls our onAction, invalidating the text viewer and moving the selection around the new text
getSet
().
actions
.
add
(
action
);
getSet
().
actions
.
add
(
action
);
// move cursor
// move cursor
if
(
field
().
move_cursor_with_sort
&&
replacement
.
size
()
==
1
)
{
if
(
field
().
move_cursor_with_sort
&&
replacement
.
size
()
==
1
)
{
...
...
src/render/text/viewer.cpp
View file @
488aa15d
...
@@ -64,13 +64,9 @@ TextViewer::~TextViewer() {}
...
@@ -64,13 +64,9 @@ TextViewer::~TextViewer() {}
// ----------------------------------------------------------------------------- : Drawing
// ----------------------------------------------------------------------------- : Drawing
void
TextViewer
::
draw
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
ctx
,
DrawWhat
what
)
{
void
TextViewer
::
draw
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
DrawWhat
what
)
{
assert
(
!
lines
.
empty
());
Rotater
r
(
dc
,
style
.
getRotation
());
Rotater
r
(
dc
,
style
.
getRotation
());
if
(
lines
.
empty
())
{
// not prepared yet
prepareElements
(
text
,
style
,
ctx
);
prepareLines
(
dc
,
text
,
style
);
}
// Draw the text line by line
// Draw the text line by line
FOR_EACH
(
l
,
lines
)
{
FOR_EACH
(
l
,
lines
)
{
if
(
l
.
visible
(
dc
))
{
if
(
l
.
visible
(
dc
))
{
...
@@ -102,6 +98,14 @@ void TextViewer::Line::drawSelection(RotatedDC& dc, size_t sel_start, size_t sel
...
@@ -102,6 +98,14 @@ void TextViewer::Line::drawSelection(RotatedDC& dc, size_t sel_start, size_t sel
}
}
}
}
void
TextViewer
::
prepare
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
ctx
)
{
if
(
lines
.
empty
())
{
// not prepared yet
Rotater
r
(
dc
,
style
.
getRotation
());
prepareElements
(
text
,
style
,
ctx
);
prepareLines
(
dc
,
text
,
style
);
}
}
void
TextViewer
::
reset
()
{
void
TextViewer
::
reset
()
{
elements
.
clear
();
elements
.
clear
();
lines
.
clear
();
lines
.
clear
();
...
...
src/render/text/viewer.hpp
View file @
488aa15d
...
@@ -47,10 +47,12 @@ class TextViewer {
...
@@ -47,10 +47,12 @@ class TextViewer {
/** The drawing information is cached,
/** The drawing information is cached,
* before calling draw again with different text/style reset() should be called
* before calling draw again with different text/style reset() should be called
*/
*/
void
draw
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
,
DrawW
hat
);
void
draw
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
DrawWhat
w
hat
);
/// Draw an indicator for selected text
/// Draw an indicator for selected text
void
drawSelection
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
size_t
sel_start
,
size_t
sel_end
);
void
drawSelection
(
RotatedDC
&
dc
,
const
TextStyle
&
style
,
size_t
sel_start
,
size_t
sel_end
);
/// Prepare the text for drawing, if it is not already prepared
void
prepare
(
RotatedDC
&
dc
,
const
String
&
text
,
const
TextStyle
&
style
,
Context
&
);
/// Reset the cached data, at a new call to draw it will be recalculated
/// Reset the cached data, at a new call to draw it will be recalculated
void
reset
();
void
reset
();
...
...
src/render/value/text.cpp
View file @
488aa15d
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
void
TextValueViewer
::
draw
(
RotatedDC
&
dc
)
{
void
TextValueViewer
::
draw
(
RotatedDC
&
dc
)
{
drawFieldBorder
(
dc
);
drawFieldBorder
(
dc
);
v
.
draw
(
dc
,
value
().
value
(),
style
(),
viewer
.
getContext
(),
DRAW_NORMAL
);
v
.
prepare
(
dc
,
value
().
value
(),
style
(),
viewer
.
getContext
());
v
.
draw
(
dc
,
style
(),
DRAW_NORMAL
);
}
}
void
TextValueViewer
::
onValueChange
()
{
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