Copy & Paste
Moderator: Forum Moderators
Copy & Paste
I'm implementing clipboard access, so that it'll be possible to copy-paste from the system clipboard to textboxes in Wesnoth and vice-versa.
I've added a pair of files, clipboard.cpp/.hpp which contain the following functions:
The usage of these functions should be fairly self-explanatory. I've implemented these functions for Windows.
If users of other OSes would like to write implementations for their OSes, and post patches, that'd be great
David
I've added a pair of files, clipboard.cpp/.hpp which contain the following functions:
Code: Select all
void copy_to_clipboard(const std::string& text);
std::string copy_from_clipboard();
If users of other OSes would like to write implementations for their OSes, and post patches, that'd be great
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
-
- Posts: 79
- Joined: February 6th, 2004, 12:41 pm
- Location: Warszawa, Polska
Re: Copy & Paste
I've added code for BeOS, but i need to be sure about one thing before i'll post it:Dave wrote:I'm implementing clipboard access, so that it'll be possible to copy-paste from the system clipboard to textboxes in Wesnoth and vice-versa.
[...]
If users of other OSes would like to write implementations for their OSes, and post patches, that'd be great
What encoding is used for text in wesnoth? i suspect it's UNICODE (not UTF-8 )... but i want to be 100%. If it's not UTF-8 than i'll have to add conversion because on BeOS UTF-8 is "default", and if we want to be compatible with other BeOS apps it would be better to keep the same encoding .
--edit--
hehe, UTF-8 closed in () creates emoticon, had to add space
Yeah I plan to eventually change it over to UTF-8.Ayin wrote:Wesnoth uses UTF-8 internally. except in textboxes where text is converted to a wide_string. So, in textboxes, where cut&paste is to be made, it is Unicode.
However, the functions wstring_to_string and string_to_wstring, located in language.cpp, do the trick.
Now it just kinda uses truncated Unicode
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
-
- Posts: 79
- Joined: February 6th, 2004, 12:41 pm
- Location: Warszawa, Polska
X11 support
For those using X11, there is a patch for X clipboard support in Savannah, so you may want to not start on any new implementations for that platform, unless mine gives you nightmares