Commit Graph

110 Commits

Author SHA1 Message Date
Gabriel Ivăncescu e95dc7e03e shell32/autocomplete: Use LBS_NODATA for the dropdown listbox.
This eliminates the overhead of populating the listbox completely and
simplifies the code.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Gabriel Ivăncescu 0cd95038af shell32/autocomplete: Use an owner-drawn listbox for the dropdown.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Gabriel Ivăncescu 6f3beaee37 shell32/autocomplete: Encapsulate the listbox into an owner window.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Gabriel Ivăncescu 3a3424280f shell32/autocomplete: Make the dropdown listbox a proper pop-up window.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Gabriel Ivăncescu df1c7c8aa7 shell32/autocomplete: Forward to the original listbox proc outside the switch.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Michael Stefaniuc c7e6fafa4c shell32: Remove unused return variables (coccinelle).
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-12 21:36:03 +01:00
Michael Stefaniuc 84459ba94b shell32: Avoid FALSE : TRUE conditional expressions.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-31 21:38:51 +01:00
Gabriel Ivăncescu 2007e17d77 shell32/autocomplete: Always expand if the enumerator was reset.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-24 17:33:38 +01:00
Gabriel Ivăncescu b9224c2184 shell32/autocomplete: Don't autoappend on Paste if ACO_AUTOAPPEND is off.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-24 17:33:38 +01:00
Gabriel Ivăncescu da2e51b3a6 shell32/autocomplete: Check the edit control in ResetEnumerator instead of whether the object is initialized.
An autocomplete object can be destroyed and detached from the edit control and
still survive, if there are still references to it (even though it's useless).

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-29 10:04:28 +01:00
Gabriel Ivăncescu 77b23a5e01 shell32/autocomplete: Implement ACO_FILTERPREFIXES.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-29 10:04:21 +01:00
Gabriel Ivăncescu d288d4dbd1 shell32/autocomplete: Sort the enumerated strings using a helper function.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-29 10:04:14 +01:00
Gabriel Ivăncescu 2c03e0c67d shell32/autocomplete: Move the auto-suggest listbox along with the edit control.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-19 22:42:41 +01:00
Gabriel Ivăncescu 7ac4c0ea8c shell32/autocomplete: Retrieve the count in show_listbox.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-19 22:42:40 +01:00
Gabriel Ivăncescu 4cac7da8b5 shell32/autocomplete: Hide the listbox when the text is changed programmatically.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-14 16:52:48 +01:00
Gabriel Ivăncescu 4234e597ef shell32/autocomplete: Pass the mouse wheel to the auto-suggest listbox, if visible.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-08 10:03:59 +01:00
Gabriel Ivăncescu 1649680bf9 shell32/autocomplete: Implement ACO_NOPREFIXFILTERING option.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-08 10:03:51 +01:00
Gabriel Ivăncescu 7348ffd9bd shell32/autocomplete: Implement ResetEnumerator.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-08 10:03:38 +01:00
Gabriel Ivăncescu 9a41584c49 shell32/autocomplete: Reset the enumerator when the text is empty even when auto-suggest is disabled.
This is needed for auto-append only AutoComplete controls.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-05 19:12:12 +01:00
Gabriel Ivăncescu 4f85424d58 shell32/autocomplete: Reset the enumerator when losing focus if the edit control is not visible anymore.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-05 19:12:12 +01:00
Gabriel Ivăncescu e1a7d6eeb1 shell32/autocomplete: Implement a cache and sort the enumerated strings for proper behavior.
Windows doesn't reset and re-enumerate it everytime autocompletion happens,
and it also sorts the strings. This matches it more closely and makes it
more useable on large lists as well.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-05 19:12:12 +01:00
Gabriel Ivăncescu 3d9da1a691 shell32/autocomplete: Use a helper function to show the listbox.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-30 14:05:49 +01:00
Gabriel Ivăncescu ec3b39fa22 shell32/autocomplete: Fill and display the auto-suggest listbox in a separate function.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-30 14:05:45 +01:00
Gabriel Ivăncescu ef25589922 shell32/autocomplete: Use the optional IACList interface and IACList::Expand, if available.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-17 10:01:32 +02:00
Gabriel Ivăncescu d3830fbd87 shell32/autocomplete: Implement ACO_USETAB option.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:53:21 +02:00
Gabriel Ivăncescu 51c5fb7817 shell32/autocomplete: Hide the AutoComplete listbox when auto-suggest is turned off.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:52:54 +02:00
Gabriel Ivăncescu 5aa7dbf4d8 shell32/autocomplete: Reset the contents of the AutoComplete listbox when hiding it.
There's no point to have it lingering around, since it's always recreated
before being shown again.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:52:49 +02:00
Gabriel Ivăncescu 5d5e84a0d8 shell32/autocomplete: Hide the auto-suggest listbox when ESC is pressed.
When the listbox is visible, ESC should hide it. Only when it's not visible
should it be forwarded to the edit control. This matches Windows behavior.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:52:42 +02:00
Gabriel Ivăncescu b3945207db shell32/autocomplete: Fix handling of Return key when an auto-suggestion item is selected.
When selecting an item from the AutoComplete's listbox, the Return key
should act the same as a left click on it (place the text, select it,
and hide the listbox).

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:52:38 +02:00
Gabriel Ivăncescu e3d57fe551 shell32/autocomplete: Implement PageDown and PageUp for the auto-suggest listbox.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-27 12:56:20 +02:00
Gabriel Ivăncescu 3f31afafc3 shell32/autocomplete: Don't auto-append unless the caret is at the end.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-27 12:56:10 +02:00
Gabriel Ivăncescu d8de5fe47d shell32/autocomplete: Use the same font for the AutoComplete listbox as the edit control.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-27 12:56:05 +02:00
Gabriel Ivăncescu 75ccf7537c shell32/autocomplete: Use 0 instead of CW_USEDEFAULT.
Clean the CreateWindowEx code of CW_USEDEFAULT since it's not valid for
a child window and ends up being 0 anyway. Even more, it's useless as the
actual size is given when the window is shown.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-26 16:51:11 +02:00
Gabriel Ivăncescu aaf0fb5292 shell32/autocomplete: Remove flicker while redrawing the AutoComplete listbox.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-26 16:51:01 +02:00
Gabriel Ivăncescu 38306f8f56 shell32/autocomplete: Pass hwnd for consistency with the other calls.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:30 +02:00
Gabriel Ivăncescu 03fe246897 shell32/autocomplete: Handle WM_SETTEXT for autocompletion.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:30 +02:00
Gabriel Ivăncescu 087c24dfdc shell32/autocomplete: Send some messages directly to the edit control's procedure.
Send some of the messages directly to the edit control's window procedure
to match Windows behavior and to be able to process WM_SETTEXT.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:29 +02:00
Gabriel Ivăncescu ce254b5f6d shell32/autocomplete: Don't autocomplete at all on most control characters.
Most control characters sent via some CTRL+key combination should not
autocomplete at all. ^C is one example, where just copying some text should
not show the auto-suggestion box (if not visible). ^V is another example,
where it is already handled in WM_PASTE, so it has to be a no-op here,
else auto-append from WM_PASTE would complete the text and then the ^V
autocompletion would remove every other suggestion in the listbox.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:29 +02:00
Gabriel Ivăncescu cefa84e5d9 shell32/autocomplete: Forward to the edit control outside of the switch to simplify the code.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-21 23:58:56 +02:00
Gabriel Ivăncescu a2cb1ab0b3 shell32/autocomplete: Handle more messages for autocompletion.
The user can right-click on the editbox control and choose one of these
operations, so they need to be handled separately regardless.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-21 23:58:56 +02:00
Gabriel Ivăncescu cb8bd825b9 shell32/autocomplete: Fix going up through the suggestion listbox.
When going up past the topmost item in the listbox, go through txtbackup
first before wrapping around, just like when going down. This matches
Windows behavior.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-21 23:58:56 +02:00
Gabriel Ivăncescu 644358bdf7 shell32/autocomplete: Remove the property after replacing the callback instead of before.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:20:24 +02:00
Gabriel Ivăncescu 2a8df60a8c shell32/autocomplete: Avoid another buffer overflow and handle arbitrary sizes for the auto-append string.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:19:41 +02:00
Gabriel Ivăncescu 72d8b7befd shell32/autocomplete: Simplify a calculation.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:19:32 +02:00
Gabriel Ivăncescu 9644205540 shell32/autocomplete: Don't auto-append on control characters.
We must not auto-append on control characters, most notably Backspace,
but also ^X (cut) and so on.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:19:20 +02:00
Gabriel Ivăncescu a118459adf shell32/autocomplete: Redesign the window proc to trigger on key presses instead of key release.
AutoComplete currently shows up when the user releases a key, which is
wrong. Windows does it when the user presses a key, so use both WM_KEYDOWN
and WM_CHAR and redesign it so that it matches Windows behavior.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-18 20:59:38 +02:00
Gabriel Ivăncescu 779c513462 shell32/autocomplete: Move the autocomplete processing and WM_KEYUP to separate functions.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-18 20:59:38 +02:00
Gabriel Ivăncescu cbbbb70cf2 shell32/autocomplete: Dynamically allocate hwndText so it can handle arbitrary sizes.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-13 12:54:38 +02:00
Gabriel Ivăncescu 7f659eb5f9 shell32/autocomplete: Get rid of control and filled BOOLs and simplify the code.
There's no need to have filled, since cpt can already provide the same
information.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:10:32 +02:00
Gabriel Ivăncescu cd8d3c6de6 shell32/autocomplete: Don't call ShowWindow unless auto-suggest listbox is enabled.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:10:23 +02:00