Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7c352b96
Commit
7c352b96
authored
Jul 07, 2008
by
Dylan Smith
Committed by
Alexandre Julliard
Jul 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Implemented paragraph selection.
parent
abefc28f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
37 deletions
+69
-37
caret.c
dlls/riched20/caret.c
+66
-35
editor.h
dlls/riched20/editor.h
+1
-1
editstr.h
dlls/riched20/editstr.h
+2
-1
No files found.
dlls/riched20/caret.c
View file @
7c352b96
...
...
@@ -744,11 +744,54 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
void
ME_Select
Word
(
ME_TextEditor
*
editor
)
ME_Select
ByType
(
ME_TextEditor
*
editor
,
ME_SelectionType
selectionType
)
{
ME_MoveCursorWords
(
editor
,
&
editor
->
pCursors
[
1
],
+
1
);
editor
->
pCursors
[
0
]
=
editor
->
pCursors
[
1
];
ME_MoveCursorWords
(
editor
,
&
editor
->
pCursors
[
0
],
-
1
);
/* pCursor[0] will be the start of the selection
* pCursor[1] is the other end of the selection range
* pCursor[2] and [3] are the selection anchors that are backed up
* so they are kept when the selection changes for drag selection.
*/
editor
->
nSelectionType
=
selectionType
;
switch
(
selectionType
)
{
case
stPosition
:
break
;
case
stWord
:
ME_MoveCursorWords
(
editor
,
&
editor
->
pCursors
[
1
],
+
1
);
editor
->
pCursors
[
0
]
=
editor
->
pCursors
[
1
];
ME_MoveCursorWords
(
editor
,
&
editor
->
pCursors
[
0
],
-
1
);
break
;
case
stLine
:
case
stParagraph
:
{
ME_DisplayItem
*
pItem
;
ME_DIType
fwdSearchType
,
backSearchType
;
if
(
selectionType
==
stParagraph
)
{
backSearchType
=
diParagraph
;
fwdSearchType
=
diParagraphOrEnd
;
}
else
{
backSearchType
=
diStartRow
;
fwdSearchType
=
diStartRowOrParagraphOrEnd
;
}
pItem
=
ME_FindItemBack
(
editor
->
pCursors
[
0
].
pRun
,
backSearchType
);
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemFwd
(
pItem
,
diRun
);
editor
->
pCursors
[
0
].
nOffset
=
0
;
pItem
=
ME_FindItemFwd
(
editor
->
pCursors
[
0
].
pRun
,
fwdSearchType
);
assert
(
pItem
);
if
(
pItem
->
type
==
diTextEnd
)
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemBack
(
pItem
,
diRun
);
else
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemFwd
(
pItem
,
diRun
);
editor
->
pCursors
[
1
].
nOffset
=
0
;
break
;
}
default:
assert
(
0
);
}
/* Store the anchor positions for extending the selection. */
editor
->
pCursors
[
2
]
=
editor
->
pCursors
[
0
];
editor
->
pCursors
[
3
]
=
editor
->
pCursors
[
1
];
}
...
...
@@ -900,8 +943,9 @@ static void ME_ExtendAnchorSelection(ME_TextEditor *editor)
else
{
ME_DisplayItem
*
pItem
;
pItem
=
ME_FindItemBack
(
editor
->
pCursors
[
0
].
pRun
,
diStartRowOrParagraph
);
ME_DIType
searchType
=
((
editor
->
nSelectionType
==
stLine
)
?
diStartRowOrParagraph:
diParagraph
);
pItem
=
ME_FindItemBack
(
editor
->
pCursors
[
0
].
pRun
,
searchType
);
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemFwd
(
pItem
,
diRun
);
editor
->
pCursors
[
0
].
nOffset
=
0
;
}
...
...
@@ -915,8 +959,9 @@ static void ME_ExtendAnchorSelection(ME_TextEditor *editor)
else
{
ME_DisplayItem
*
pItem
;
pItem
=
ME_FindItemFwd
(
editor
->
pCursors
[
1
].
pRun
,
diStartRowOrParagraphOrEnd
);
ME_DIType
searchType
=
((
editor
->
nSelectionType
==
stLine
)
?
diStartRowOrParagraphOrEnd:
diParagraphOrEnd
);
pItem
=
ME_FindItemFwd
(
editor
->
pCursors
[
1
].
pRun
,
searchType
);
if
(
pItem
->
type
==
diTextEnd
)
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemBack
(
pItem
,
diRun
);
else
...
...
@@ -930,6 +975,7 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
{
ME_Cursor
tmp_cursor
;
int
is_selection
=
0
;
BOOL
is_shift
;
editor
->
nUDArrowX
=
-
1
;
...
...
@@ -937,23 +983,22 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
tmp_cursor
=
editor
->
pCursors
[
0
];
is_selection
=
ME_IsSelection
(
editor
);
is_shift
=
GetKeyState
(
VK_SHIFT
)
<
0
;
ME_FindPixelPos
(
editor
,
x
,
y
,
&
editor
->
pCursors
[
0
],
&
editor
->
bCaretAtEnd
);
if
(
x
>=
editor
->
selofs
||
GetKeyState
(
VK_SHIFT
)
<
0
)
if
(
x
>=
editor
->
selofs
||
is_shift
)
{
if
(
clickNum
>
1
)
{
editor
->
nSelectionType
=
stWord
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_SelectWord
(
editor
);
/* Store the anchor positions for extending the selection. */
e
ditor
->
pCursors
[
2
]
=
editor
->
pCursors
[
0
];
editor
->
pCursors
[
3
]
=
editor
->
pCursors
[
1
]
;
if
(
x
>=
editor
->
selofs
)
ME_SelectByType
(
editor
,
stWord
);
e
lse
ME_SelectByType
(
editor
,
stParagraph
)
;
}
else
if
(
GetKeyState
(
VK_SHIFT
)
>=
0
)
else
if
(
!
is_shift
)
{
/* Shift is not down */
editor
->
nSelectionType
=
stPosition
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
}
...
...
@@ -969,25 +1014,11 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
}
else
{
ME_DisplayItem
*
pItem
;
editor
->
nSelectionType
=
stLine
;
/* Set pCursors[0] to beginning of line */
/* Set pCursors[1] to end of line */
pItem
=
ME_FindItemFwd
(
editor
->
pCursors
[
0
].
pRun
,
diStartRowOrParagraphOrEnd
);
assert
(
pItem
);
if
(
pItem
->
type
==
diTextEnd
)
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemBack
(
pItem
,
diRun
);
else
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemFwd
(
pItem
,
diRun
);
editor
->
pCursors
[
1
].
nOffset
=
0
;
/* pCursor[0] is the position where the cursor will be drawn,
* pCursor[1] is the other end of the selection range
* pCursor[2] and [3] are the selection anchors that are backed up
* so they are kept when the selection changes for drag line selection.
*/
editor
->
pCursors
[
2
]
=
editor
->
pCursors
[
0
];
editor
->
pCursors
[
3
]
=
editor
->
pCursors
[
1
];
if
(
clickNum
<
2
)
{
ME_SelectByType
(
editor
,
stLine
);
}
else
{
ME_SelectByType
(
editor
,
stParagraph
);
}
}
ME_InvalidateSelection
(
editor
);
HideCaret
(
editor
->
hWnd
);
...
...
dlls/riched20/editor.h
View file @
7c352b96
...
...
@@ -176,7 +176,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod);
/* caret.c */
int
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
);
void
ME_Select
Word
(
ME_TextEditor
*
editor
);
void
ME_Select
ByType
(
ME_TextEditor
*
editor
,
ME_SelectionType
selectionType
);
void
ME_HideCaret
(
ME_TextEditor
*
ed
);
void
ME_ShowCaret
(
ME_TextEditor
*
ed
);
void
ME_MoveCaret
(
ME_TextEditor
*
ed
);
...
...
dlls/riched20/editstr.h
View file @
7c352b96
...
...
@@ -247,7 +247,8 @@ typedef enum {
typedef
enum
{
stPosition
=
0
,
stWord
,
stLine
stLine
,
stParagraph
}
ME_SelectionType
;
typedef
struct
tagME_FontTableItem
{
...
...
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