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
fe82334a
Commit
fe82334a
authored
Dec 22, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed flickering cursor in text control
parent
3cd40a7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
34 deletions
+39
-34
src/gui/control/text_ctrl.cpp
src/gui/control/text_ctrl.cpp
+9
-12
src/gui/value/text.cpp
src/gui/value/text.cpp
+30
-22
No files found.
src/gui/control/text_ctrl.cpp
View file @
fe82334a
...
@@ -26,15 +26,16 @@ Rotation TextCtrl::getRotation() const {
...
@@ -26,15 +26,16 @@ Rotation TextCtrl::getRotation() const {
}
}
void
TextCtrl
::
draw
(
DC
&
dc
)
{
void
TextCtrl
::
draw
(
DC
&
dc
)
{
if
(
!
viewers
.
empty
())
{
wxSize
cs
=
GetClientSize
();
Style
&
style
=
*
viewers
.
front
()
->
getStyle
();
style
.
width
=
cs
.
GetWidth
()
-
2
;
style
.
height
=
cs
.
GetHeight
()
-
2
;
}
RotatedDC
rdc
(
dc
,
getRotation
(),
false
);
RotatedDC
rdc
(
dc
,
getRotation
(),
false
);
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_
3DFACE
));
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_
WINDOW
));
}
}
void
TextCtrl
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
void
TextCtrl
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
// draw background
Style
&
s
=
*
v
.
getStyle
();
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetBrush
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
));
dc
.
DrawRectangle
(
s
.
getRect
().
grow
(
1
));
// draw viewer
// draw viewer
v
.
draw
(
dc
);
v
.
draw
(
dc
);
}
}
...
@@ -49,6 +50,7 @@ void TextCtrl::setValue(String* value) {
...
@@ -49,6 +50,7 @@ void TextCtrl::setValue(String* value) {
TextValueP
value
(
new
TextValue
(
field
));
TextValueP
value
(
new
TextValue
(
field
));
// set stuff
// set stuff
field
->
index
=
0
;
field
->
index
=
0
;
field
->
multi_line
=
true
;
style
->
width
=
100
;
style
->
width
=
100
;
style
->
height
=
20
;
style
->
height
=
20
;
style
->
left
=
style
->
top
=
1
;
style
->
left
=
style
->
top
=
1
;
...
@@ -95,12 +97,7 @@ void TextCtrl::onInit() {
...
@@ -95,12 +97,7 @@ void TextCtrl::onInit() {
}
}
void
TextCtrl
::
onSize
(
wxSizeEvent
&
)
{
void
TextCtrl
::
onSize
(
wxSizeEvent
&
)
{
if
(
!
viewers
.
empty
())
{
Refresh
(
false
);
wxSize
cs
=
GetClientSize
();
Style
&
style
=
*
viewers
.
front
()
->
getStyle
();
style
.
width
=
cs
.
GetWidth
()
-
2
;
style
.
height
=
cs
.
GetHeight
()
-
2
;
}
}
}
BEGIN_EVENT_TABLE
(
TextCtrl
,
DataEditor
)
BEGIN_EVENT_TABLE
(
TextCtrl
,
DataEditor
)
...
...
src/gui/value/text.cpp
View file @
fe82334a
...
@@ -78,8 +78,13 @@ void TextValueEditor::onMotion(const RealPoint& pos, wxMouseEvent& ev) {
...
@@ -78,8 +78,13 @@ void TextValueEditor::onMotion(const RealPoint& pos, wxMouseEvent& ev) {
if
(
ev
.
LeftIsDown
())
{
if
(
ev
.
LeftIsDown
())
{
size_t
index
=
v
.
indexAt
(
style
().
getRotation
().
trInv
(
pos
));
size_t
index
=
v
.
indexAt
(
style
().
getRotation
().
trInv
(
pos
));
if
(
select_words
)
{
if
(
select_words
)
{
// TODO: on the left, swap start and end
// on the left, swap start and end
moveSelection
(
TYPE_INDEX
,
index
<
selection_start_i
?
prevWordBoundry
(
index
)
:
nextWordBoundry
(
index
),
false
,
MOVE_MID
);
bool
left
=
index
<
max
(
selection_start_i
,
selection_end_i
);
if
(
left
!=
(
selection_end_i
<
selection_start_i
))
{
swap
(
selection_start_i
,
selection_end_i
);
}
// //if (left && selection_end_i < selection_start_i
moveSelection
(
TYPE_INDEX
,
left
?
prevWordBoundry
(
index
)
:
nextWordBoundry
(
index
),
false
,
MOVE_MID
);
}
else
{
}
else
{
moveSelection
(
TYPE_INDEX
,
index
,
false
,
MOVE_MID
);
moveSelection
(
TYPE_INDEX
,
index
,
false
,
MOVE_MID
);
}
}
...
@@ -472,27 +477,30 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
...
@@ -472,27 +477,30 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
// Hide caret
// Hide caret
wxCaret
*
caret
=
editor
().
GetCaret
();
wxCaret
*
caret
=
editor
().
GetCaret
();
if
(
caret
->
IsVisible
())
caret
->
Hide
();
if
(
caret
->
IsVisible
())
caret
->
Hide
();
// Move selection
// Destroy the clientDC before reshowing the caret, prevent flicker on MSW
shared_ptr
<
DC
>
dc
=
editor
().
overdrawDC
();
{
RotatedDC
rdc
(
*
dc
,
viewer
.
getRotation
(),
false
);
// Move selection
if
(
nativeLook
())
{
shared_ptr
<
DC
>
dc
=
editor
().
overdrawDC
();
// clip the dc to the region of this control
RotatedDC
rdc
(
*
dc
,
viewer
.
getRotation
(),
false
);
rdc
.
SetClippingRegion
(
style
().
getRect
());
if
(
nativeLook
())
{
}
// clip the dc to the region of this control
// clear old selection by drawing it again
rdc
.
SetClippingRegion
(
style
().
getRect
());
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
}
// move
// clear old selection by drawing it again
moveSelectionNoRedraw
(
t
,
new_end
,
also_move_start
,
dir
);
// scroll?
// scrollWithCursor = true;
// if (onMove()) {
// // we can't redraw just the selection because we must scroll
// updateScrollbar();
// editor.refreshEditor();
// } else {
// draw new selection
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
// }
// move
moveSelectionNoRedraw
(
t
,
new_end
,
also_move_start
,
dir
);
// scroll?
// scrollWithCursor = true;
// if (onMove()) {
// // we can't redraw just the selection because we must scroll
// updateScrollbar();
// editor.refreshEditor();
// } else {
// draw new selection
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
// }
}
showCaret
();
showCaret
();
}
}
...
...
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