[patch] Clipboard (a/k/a "Copy and Paste")

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Clipboard (a/k/a "Copy and Paste")

Post by Kogut » 26 Jun 2013 17:12

"used the current trunk" - try with version that was used to create the patch (OpenTTD 1.3 assuming that you used patch from the previous post).

"But I have an error." - what kind of error? (related guide: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html - especially "It doesn't work." section)
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Clipboard (a/k/a "Copy and Paste")

Post by Eddi » 26 Jun 2013 19:46

you cannot simply apply a patch to current trunk version, you have to go back to the revision that the patch was written for.
You might not exactly be interested in Ferion, but if you are, have fun :)

bugmenotbaby
Engineer
Engineer
Posts: 10
Joined: 01 Jun 2012 11:49
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by bugmenotbaby » 26 Jun 2013 20:04

ok thank you for the informations

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 11 Jul 2013 10:36

Version 0.2.2 released - now the patch is up to trunk! Some minor bugs were fixed also. No binaries available, just source code (you can still download 0.2.1 binaries for OpenTTD 1.3.0).
:] don't worry, be happy and checkout my patches

bcmpinc
Engineer
Engineer
Posts: 19
Joined: 18 Nov 2008 00:10

Re: Clipboard (a/k/a "Copy and Paste")

Post by bcmpinc » 12 Jul 2013 22:17

I found a bug in clipboard version 0.2.1 (for openttd 1.3.0). In multiplayer (and not in singleplayer), when you paste within the copied region, the pasted content also becomes part of the clipboard. Depending on the direction of the offset, the new pasted content can then be pasted again.

So if you copy a 5x5 region with only a depot in the upper corner and paste it in the tile below, you are actually pasting 5 depots instead of the expected 1 depot.

Also, I frequently encounter failing 'not interrupted' assertions. I believe that these can be changed into warnings?

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 13 Jul 2013 09:44

bcmpinc wrote:In multiplayer (and not in singleplayer), when you paste within the copied region, the pasted content also becomes part of the clipboard. Depending on the direction of the offset, the new pasted content can then be pasted again.
Actually this is the way it works. It's a TODO to expose this difference by providing different graphics and text labels. I even drew some icons but they were ugly :P and I didn't include them, yet.

In multiplayer, the tool works like you said:
copy -> select area to copy/paste
paste -> copy current content of area selected previously with copy tool and paste it instantly at given location

There is no need to synchronize anything over the network. Otherwise each player would have to poses it's own copy of all other player clipboards. Another solution would be to send clipboard over the network while pasting which is also problematic. Current approach is really bug proof and functional. And enough for players IMO. Do you think otherwise?
Last edited by adf88 on 13 Jul 2013 10:30, edited 2 times in total.
:] don't worry, be happy and checkout my patches

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 13 Jul 2013 10:28

bcmpinc wrote:Also, I frequently encounter failing 'not interrupted' assertions. I believe that these can be changed into warnings?
Please, upload these files: crash.dmp, crash.sav, crash.log, crash.png. They can be found next to your openttd.cfg.
:] don't worry, be happy and checkout my patches

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 25 Jul 2013 13:56

New version available (0.2.3), minor bug fixes and refinements.

1.0.0 is coming, very soon!
:] don't worry, be happy and checkout my patches

User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by Vaulter » 01 Aug 2013 21:51

about svn.zip in first post:
got

Code: Select all

src/openttd/src/ai/../script/api/script_window.hpp:26:44: fatal error: ../../widgets/clipboard_widget.h: No such file or directory
clipboard_widget just absent in patch

will be nice to have plain attachments - not zipped. thanks!

update: hg patch gives me

Code: Select all

Message: Assertion failed at line 184 of /home/vaulter/src/openttd-hg/src/hotkeys.cpp: keycode < 128
on exit

Code: Select all

*** OpenTTD Crash Report ***

Crash at: Thu Aug  1 22:24:35 2013
In game date: 1950-01-01 (0)

Crash reason:
 Signal:  Aborted (6)
 Message: Assertion failed at line 184 of /home/vaulter/src/openttd-hg/src/hotkeys.cpp: keycode < 128

OpenTTD version:
 Version:    h7ce060ce-CLIPBOARD (0)
 NewGRF ver: 1400642c
 Bits:       64
 Endian:     little
 Dedicated:  no
 Build date: Aug  2 2013 02:21:03

Stacktrace:
 [00] bin/openttd(_ZNK12CrashLogUnix13LogStacktraceEPcPKc+0x37) [0x6fa4d7]
 [01] bin/openttd(_ZNK8CrashLog12FillCrashLogEPcPKc+0xeb) [0x5d43cb]
 [02] bin/openttd(_ZNK8CrashLog12MakeCrashLogEv+0x7c) [0x5d465c]
 [03] bin/openttd() [0x6fa445]
 [04] /lib/x86_64-linux-gnu/libc.so.6(+0x370b0) [0x7fde32ddc0b0]
 [05] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7fde32ddc037]
 [06] /lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7fde32ddf698]
 [07] bin/openttd() [0x6e5e5f]
 [08] bin/openttd(_Z12SaveKeycodesPK6Hotkey+0x26c) [0x63c85c]
 [09] bin/openttd(_ZNK10HotkeyList4SaveEP7IniFile+0x4c) [0x63ceac]
 [10] bin/openttd() [0x63cf25]
 [11] bin/openttd(_Z12openttd_mainiPPc+0x187a) [0x6e7aca]
 [12] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fde32dc6ea5]
 [13] bin/openttd() [0x525a01]

Operating system:
 Name:     Linux
 Release:  3.8.0-27-generic
 Version:  #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013
 Machine:  x86_64
 Compiler: GCC 4.7.3 "4.7.3"

Configuration:
 Blitter:      8bpp-optimized
 Graphics set: OpenGFX (1021)
 Language:     /home/vaulter/src/openttd-hg/bin/lang/russian.lng
 Music driver: extmidi
 Music set:    NoMusic (0)
 Network:      no
 Sound driver: sdl
 Sound set:    NoSound (2)
 Video driver: sdl

AI Configuration (local: 0):
  0: Human

Libraries:
 FontConfig: 2.10.2
 FreeType:   2.4.11
 ICU:        4.8.1.1
 LZMA:       5.1.0alpha
 LZO:        2.06
 PNG:        1.2.49
 SDL:        1.2.15
 Zlib:       1.2.7

---- gamelog start ----
Tick 0: new game started
     Revision text changed to h7ce060ce-CLIP, savegame version 185, not modified, _openttd_newgrf_version = 0x1400642c
     New game mode: 1 landscape: 0
---- gamelog end ----

*** End of OpenTTD Crash Report *** 

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 02 Aug 2013 06:33

Sorry for that broken svn package. I'll release new version soon. Maybe today.
Vaulter wrote:Assertion failed at line 184 of /home/vaulter/src/openttd-hg/src/hotkeys.cpp: keycode < 128
As a quick fix you can open your hotkeys.cfg and edit/add these entries:

[clipboard]
rotate_l = H
rotate_r = J
reflect_ne_sw = K
reflect_nw_se = L

HJKL keys are just an example, you can use other keys as well.
Vaulter wrote:will be nice to have plain attachments - not zipped
I'm not sure why you do think so. I think it's better to have all files grouped in a package. Besides this way I can fit into "max 3 attachments" limit on this forum.
:] don't worry, be happy and checkout my patches

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 06 Aug 2013 07:30

Milestone has bean reached - fully featured in-game clipboard for single and multi player vanilla games.
The Clipboard 1.0.0 is can be downloaded from usual place - the first page of this topic.
:] don't worry, be happy and checkout my patches

LukasTT
Engineer
Engineer
Posts: 4
Joined: 06 Aug 2013 10:49

Re: Clipboard (a/k/a "Copy and Paste")

Post by LukasTT » 06 Aug 2013 11:01

Hello,

I try to apply your patch to the given svn version 25647 as you suggested:

Code: Select all

svn update -r 25647
patch -p0 < the_clipboard_1.0.1-ottd_r25647-svn.patch
When compiling I get the following errors:

Code: Select all

/home/lukas/Software/openttd-svn/src/clipboard_gui.cpp: In member function 'void ClipboardToolbarWindow::UpdateButtons()':
/home/lukas/Software/openttd-svn/src/clipboard_gui.cpp:256:40: error: '_clipboard_copy_paste_mode' was not declared in this scope
Since I am using the same version as you supposed and applied the svn patch (omitting the hg version), I do not know, what I did wrong.

To deliver further information, I attached the log files for configure and make. I am using Ubuntu 13.04.

Thank you for your answer in advance.
Attachments
log_configure.txt
(3.37 KiB) Downloaded 168 times
log_make.txt
(1.82 KiB) Downloaded 188 times

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 06 Aug 2013 14:06

How the hell did it happen :? I built win32 binaries upon this patch and everything went fine.

Fixed in 1.0.2.
:] don't worry, be happy and checkout my patches

LukasTT
Engineer
Engineer
Posts: 4
Joined: 06 Aug 2013 10:49

Re: Clipboard (a/k/a "Copy and Paste")

Post by LukasTT » 06 Aug 2013 14:39

Thank you.

With your provided patch compiling works against 25650.

Lupurus
Engineer
Engineer
Posts: 3
Joined: 24 Oct 2011 13:06

Re: Clipboard (a/k/a "Copy and Paste")

Post by Lupurus » 11 Aug 2013 16:53

Hey, I love this patch! I used it a long time ago under Windows. But now I'm using Mac OS. Any chance to bring this patch to the official release or can anyone compile this for Mac?

Lupurus
Engineer
Engineer
Posts: 3
Joined: 24 Oct 2011 13:06

Re: Clipboard (a/k/a "Copy and Paste")

Post by Lupurus » 12 Aug 2013 13:58

Ok, I could compile it on my own.
But one question: It's not possible to save and load templates anymore, isn't it? Do you plan to bring back that feature? Would be great!

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 12 Aug 2013 15:26

It would be nice if you do that. Others may be happy with a Mac build. If you are not familiar with patching and compiling OpenTTD source code then just install development tools (there are several methods see OpenTTD Wiki::Compiling on Mac OS X#Installing required libraries) and I will provide you exact set of commands that you need to execute in terminal to do the rest.
Lupurus wrote:It's not possible to save and load templates anymore, isn't it? Do you plan to bring back that feature?
Save/loading is not implemented and I don't plan to "bring it back". "The Clipboard" is mostly a rewrite and save/loading wasn't ever implemented. I decided already at the design stage that there will be no save/loading. Previous patches ("Build Templates (Copy&Paste)" and "Copy & Paste patch, reworked") were strongly criticized - some thought that they are killing creativity. Hence my decision.
:] don't worry, be happy and checkout my patches

bcmpinc
Engineer
Engineer
Posts: 19
Joined: 18 Nov 2008 00:10

Re: Clipboard (a/k/a "Copy and Paste")

Post by bcmpinc » 12 Aug 2013 20:03

adf88 wrote:
bcmpinc wrote:In multiplayer (and not in singleplayer), when you paste within the copied region, the pasted content also becomes part of the clipboard. Depending on the direction of the offset, the new pasted content can then be pasted again.
Actually this is the way it works. It's a TODO to expose this difference by providing different graphics and text labels. I even drew some icons but they were ugly :P and I didn't include them, yet.

In multiplayer, the tool works like you said:
copy -> select area to copy/paste
paste -> copy current content of area selected previously with copy tool and paste it instantly at given location

There is no need to synchronize anything over the network. Otherwise each player would have to poses it's own copy of all other player clipboards. Another solution would be to send clipboard over the network while pasting which is also problematic. Current approach is really bug proof and functional. And enough for players IMO. Do you think otherwise?
My preferred solution would be to send the clipboard over the network while pasting, as this is required to implement save & load functionality for multiplayer games.

Furthermore, the current solution has at least two bugs. One is your TODO. The other is that pasting once inside the copied region (in a multiplayer game) can cause the contents of the region to be pasted multiple times.

For example, if you copy [1] ('.'=grass, 'D'=depot) and then paste it one tile to the right, you get [2] instead of [3], which is what I would expect. Furthermore, if you pasted it one tile to the left, you would get [4].

Code: Select all

1] .....D.....
2] .....DDDDDD
3] .....DD....
4] ....DD.....

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 13 Aug 2013 07:15

bcmpinc wrote:My preferred solution would be to send the clipboard over the network while pasting, as this is required to implement save & load functionality for multiplayer games.
What do you mean by that? What "save & load functionality"? You mean save/loading clipboard templates? See my previous post.
bcmpinc wrote:One is your TODO.
It's no more a TODO since v1.0.0.
bcmpinc wrote:The other is that pasting once inside the copied region (in a multiplayer game) can cause the contents of the region to be pasted multiple times...
. You are simply wrong and you didn't even bother to check how does it work. The tool works as intended. There is a "select" tool, you can pick a tile area with it. And There is a "copy & paste" tool which copies selected area into clipboard buffer and then pastes it instantly at a given location.
:] don't worry, be happy and checkout my patches

Lupurus
Engineer
Engineer
Posts: 3
Joined: 24 Oct 2011 13:06

Re: Clipboard (a/k/a "Copy and Paste")

Post by Lupurus » 13 Aug 2013 13:28

adf88 wrote:
Lupurus wrote:It's not possible to save and load templates anymore, isn't it? Do you plan to bring back that feature?
Save/loading is not implemented and I don't plan to "bring it back". "The Clipboard" is mostly a rewrite and save/loading wasn't ever implemented. I decided already at the design stage that there will be no save/loading. Previous patches ("Build Templates (Copy&Paste)" and "Copy & Paste patch, reworked") were strongly criticized - some thought that they are killing creativity. Hence my decision.
Isn't it the decision of the user, how much he wants to creative or not? I, for one, don't have the patience to build each cross with every signal from the start on. But am I really the only one, wo thinks like this?

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests