Copy/Paste
Moderator: Committer
Copy/Paste
Copy/paste isn't working for me. There's some code in GUI.cpp that seems to be trying to implement an app-local copy-paste, but even that doesn't work. Does anyone know what's going on with this code? Is it working for anyone else?
Warning: Antarans in dimensional portal are closer than they appear.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Copy/Paste
It only works in specific GUI widgets, and not any time when hotkeys are disabled, including when modal Wnds are open.
Re: Copy/Paste
Ah, I see. I was only trying it in the "Rename Fleet" dialog, so that explains why it doesn't work.
I want to make copy-paste work on all dialogs and look at the system clipboard. I'll take a look at the code.
I want to make copy-paste work on all dialogs and look at the system clipboard. I'll take a look at the code.
Warning: Antarans in dimensional portal are closer than they appear.
Re: Copy/Paste
Pre or post 0.4.5?Bigjoe5 wrote:I want to make copy-paste work on all dialogs and look at the system clipboard.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Copy/Paste
One of many things on my to-do list is making a bunch of modal windows not modal, in part so that copy-paste and similar hotkeys can work in them.Bigjoe5 wrote:I want to make copy-paste work on all dialogs and look at the system clipboard. I'll take a look at the code.
Re: Copy/Paste
Post. I'll just make the branch of master and wait at least until the release branch is made to merge it.Vezzra wrote:Pre or post 0.4.5?Bigjoe5 wrote:I want to make copy-paste work on all dialogs and look at the system clipboard.
For now, I'll just work on making it pull from the system clipboard then. Making modal windows non-modal can be a separate modification.Geoff the Medio wrote:One of many things on my to-do list is making a bunch of modal windows not modal, in part so that copy-paste and similar hotkeys can work in them.Bigjoe5 wrote:I want to make copy-paste work on all dialogs and look at the system clipboard. I'll take a look at the code.
@Vezzra / Dilvish - I only have a working dev environment on Windows at the moment. This means I'm only going to be able to enable the system clipboard on windows, and will keep the functionality on Mac and Linux the same as it is now. I'll also have to get you guys to test my branch before I merge it into master, because I'll be making refactoring changes to sort out platform-specific clipboard code.
Warning: Antarans in dimensional portal are closer than they appear.
Re: Copy/Paste
Added Windows-specific clipboard functionality. https://github.com/freeorion/freeorion/pull/118
Warning: Antarans in dimensional portal are closer than they appear.
Re: Copy/Paste
New PR using the SDL2 clipboard API, as recommended by adrian_broher: https://github.com/freeorion/freeorion/pull/119
I can't really commit to fixing it before 0.4.5 release if something goes wrong, so you can hold off on merging it until after the release branch is made if you want.
I can't really commit to fixing it before 0.4.5 release if something goes wrong, so you can hold off on merging it until after the release branch is made if you want.
Warning: Antarans in dimensional portal are closer than they appear.
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: Copy/Paste
Just an unrelated side note:
Could you please create pull requests from your own repository next time? Whenever you create a branch on the freeorion/freeorion repository everybody who forks it or fetches it also clones/fetches any branch that is part of this repository even it is completely irrelevant to him.
Could you please create pull requests from your own repository next time? Whenever you create a branch on the freeorion/freeorion repository everybody who forks it or fetches it also clones/fetches any branch that is part of this repository even it is completely irrelevant to him.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Re: Copy/Paste
Did a quick test on OSX, seems to work.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Copy/Paste
For my own recently-added pull request and branch, I attempted to use a branch under my account instead of within the freeorion organization, but couldn't figure out how to do so in the time I was willing to spend on it. I can make a branch on GitHub, or locally, but linking everything together as would be needed wasn't happening.adrian_broher wrote:Could you please create pull requests from your own repository next time?
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: Copy/Paste
You have to do three steps to accomplish this.Geoff the Medio wrote:For my own recently-added pull request and branch, I attempted to use a branch under my account instead of within the freeorion organization, but couldn't figure out how to do so in the time I was willing to spend on it. I can make a branch on GitHub, or locally, but linking everything together as would be needed wasn't happening.
- Create a fork of the project on github to have a place where you could push changes to.
- Add a remote to your local repository so git know were it can push to. On CLI this can be achieved by calling . Under TortoiseGit this can be configured in the Settings editor. By convention the name the remote you cloned from (and usually push to) is 'origin'. I use upstream for the freeorion/freeorion repository and origin for the adrianbroher/freeorion repository.
Code: Select all
git remote add <remote-name> <remote-url>
- Tell git to which repository it should push to when pushing changes. On CLI this can be achieved by calling . In TortoiseGit you can set the target remote and the branch names in the push dialogue.
Code: Select all
git push <remote-name> <local-branch-name>:<branch-name-on-remote>
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Copy/Paste
In a related matter, does anyone know how to, perhaps with SDL, send a URL to the OS to be opened in whatever is the default browser? Would be nice to have links to freeorion.org or copyright text websites work from in-game. My brief attempts to google for a simple platform-independent solution were unproductive.Bigjoe5 wrote:New PR using the SDL2 clipboard API, as recommended by adrian_broher: https://github.com/freeorion/freeorion/pull/119
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: Copy/Paste
What about something like (based on http://stackoverflow.com/questions/1480 ... cation-for):Geoff the Medio wrote:In a related matter, does anyone know how to, perhaps with SDL, send a URL to the OS to be opened in whatever is the default browser? Would be nice to have links to freeorion.org or copyright text websites work from in-game. My brief attempts to google for a simple platform-independent solution were unproductive.
Code: Select all
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char** argv)
{
const char* url = "http://www.freeorion.org/";
char buffer[1024];
#ifdef _WIN32
const char* command = "start %s";
#elif __APPLE__
const char* command = "open %s";
#else
const char* command = "xdg-open %s";
#endif
sprintf(buffer, command, url);
system(buffer);
return 0;
}
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Copy/Paste
That looks a bit unsafe / exploitable... Something that can only take (interpret as) a URL seems preferable...