The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Yona-TYT on June 24, 2018, 01:51:15 PM

Title: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on June 24, 2018, 01:51:15 PM

I can think of a small button in the title bar that allows to copy the text in the window, it is useful for example to translate some text in Japanese.
I think this is very useful.
(https://www.mediafire.com/convkey/541e/0vzkmm6s58q4eic6g.jpg)
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on June 24, 2018, 03:04:06 PM
While not too difficult to code, why? For that purpose there is the simutranslator.
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on June 24, 2018, 03:07:51 PM
While not too difficult to code, why? For that purpose there is the simutranslator.
I think it's easier to use google translator, I have no idea how to use simutranslator.  :o

I think A rookie player would say the same thing.   :P


 
Title: Re: [Idea] Button to copy the text in the chat
Post by: An_dz on June 24, 2018, 09:38:54 PM
Simutranslator won't help here, those are chat messages. And I think it's a good idea to offer a way for people to copy the contents of the messages.
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on June 24, 2018, 10:12:19 PM
Simutranslator won't help here, those are chat messages. And I think it's a good idea to offer a way for people to copy the contents of the messages.
Exactly, especially if it is some text in Japanese (it has already happened to me), there is no easy way to translate it.
Unfortunately, for linux users the clipboard does not work, but Windows has no problems with that.  :-[
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on June 25, 2018, 02:04:25 AM
Ok, I seem. Well I could send it directly to google translate, if wished for. It is just a http request ...
Title: Re: [Idea] Button to copy the text in the chat
Post by: DrSuperGood on June 25, 2018, 04:54:06 AM
How does the clipboard in Linux work? Windows is using a specific Windows implementation for it to work.

One should be able to copy chat messages to clipboard. A lot of games offer this functionality. Very useful for hyperlinks and such.

I would say the solution would be that when one clicks the chat message the resulting window has the text in a read only editable form. One can then drag select the desired content from the message and use the standard copy and paste features.
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on June 25, 2018, 02:41:17 PM
Linux does not have an universal clipboard. There are some window-manager specific implementations and a X11 clipboard for text only content, which ususally clashes with the backends. That is why there is no general Linux support.

But I see that SDL has clipboard support.
Title: Re: [Idea] Button to copy the text in the chat
Post by: Ters on June 25, 2018, 03:36:09 PM
Simutrans only ever copies text, so the X11 clipboard ought to be enough. How does this clash with he backends? clipboard_w32.cc is backend independent (as is simsys_w32_png.cc, sort of).
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on June 26, 2018, 02:06:32 AM
The X11 clipboard requires a hidden window and will no work with wayland and may clash with fullscreen SDL using framebuffer. So I am rather in favour of the SDL clipboard.
Title: Re: [Idea] Button to copy the text in the chat
Post by: DrSuperGood on June 26, 2018, 08:17:31 AM
SDL has clipboard for text which should be fully multi platform. It even takes UTF-8 input and on windows I imagine it implicitly converting to UTF-16 and using the native windows API.

In this case the current windows clipboard implementation would then be placed with the windows GDI front end. The SDL front end would then provide clipboard support via SDL.
Title: Re: [Idea] Button to copy the text in the chat
Post by: Ters on June 26, 2018, 08:38:36 AM
The X11 clipboard requires a hidden window and will no work with wayland and may clash with fullscreen SDL using framebuffer.
Well, that's what SDL2 uses anyway. Saves us from maintaining that window.

SDL has clipboard for text which should be fully multi platform. It even takes UTF-8 input and on windows I imagine it implicitly converting to UTF-16 and using the native windows API.

In this case the current windows clipboard implementation would then be placed with the windows GDI front end. The SDL front end would then provide clipboard support via SDL.
Are we ditching SDL1 support then? As far as I can tell, there is no clipboard support there. And Allegro? Who is maintaining that anyway?
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on June 26, 2018, 11:34:18 AM
I am not sure allgro works. It was needed form BeOS and DOS, so it may be ok to officially ditch it. It may work out of the box. It had slightly better performance on Windows, but I am not sure that this is relevant any more.

And SDL still has no cliboard, so no change there ...
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on July 01, 2018, 02:28:11 AM
Hello, what is that?
Any progress with the clipboard in linux?
And what about the idea of the button to copy the text? Regards!.  ;D
edit.
Well it works fine, I've just edited the makefile.  :P
Code: [Select]
ifeq ($(OSTYPE),mingw)
  SOURCES += clipboard_w32.cc
else
  SOURCES += clipboard_s2.cc
endif
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on July 28, 2018, 05:32:45 PM
I wonder what happened to this, any progress? or it has been forgotten.  ::'(
Title: Re: [Idea] Button to copy the text in the chat
Post by: Ters on July 28, 2018, 06:20:52 PM
Simutrans isn't made by order. It is made by those who want it, who then share their work free of charge. If nobody who wants it makes it, it has next to no chance of being made.

And developers do so in their limited free time, so they might avoid promising something to avoid being pestered about it until they find the time.
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on November 28, 2018, 11:59:07 PM
@Prissi
The SDL2 clipboard is not in use, could you modify the linux makefile to use "clipboard_s2.cc"?.  ???
Title: Re: [Idea] Button to copy the text in the chat
Post by: Ters on November 29, 2018, 06:25:34 AM
@Prissi
The SDL2 clipboard is not in use, could you modify the linux makefile to use "clipboard_s2.cc"?.  ???
Actually, it is just a typo or two. The makefile tries to use clipboard_s.cc, which doesn't exist, so it shouldn't build at all. However, it may build because case sensitiveness means that SDL2 does not match sdl2, causing the internal clipboard to be used.
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on November 29, 2018, 10:34:24 AM
Interesting. 8)
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on December 01, 2018, 01:59:25 PM
Should be used now ... (r8640)
Title: Re: [Idea] Button to copy the text in the chat
Post by: Yona-TYT on February 24, 2020, 01:50:20 PM
Should be used now ... (r8640)

[]Sorry, I didn't see your message (problems with my Gmail). :(

Does it mean we need a new button in the title bar?.
Title: Re: [Idea] Button to copy the text in the chat
Post by: prissi on February 25, 2020, 01:47:51 AM
Not, this is only for chat window.