# HG changeset patch # User Santeri Piippo # Date 1373328271 -10800 # Node ID 436ceec98c4fff28182361622978208c207cb081 # Parent 3745caa5d87db9872bb3f14d923d008dd5a0d7ef Use system clipboard rather than an internal one diff -r 3745caa5d87d -r 436ceec98c4f changelog.txt --- a/changelog.txt Tue Jul 09 02:57:11 2013 +0300 +++ b/changelog.txt Tue Jul 09 03:04:31 2013 +0300 @@ -16,6 +16,8 @@ - Objects can now be edited by double-clicking on them. - When drawing, drawn vertices now display coordinate labels. - Added an action to quickly toggle BFC red/green view. +- Objects are now copied to the system clipboard as LDraw code, rather than to an internal clipboard not + accessible outside of LDForge. - Changed default keys for Y-axis moving from PgUp/PgDown to Home and End ala MLCAD. - Cleaned up the toolbars, removed clutter by removing most of the not-so-often-used items, though of course the functionality is still available through menus and keyboard shortcuts. diff -r 3745caa5d87d -r 436ceec98c4f src/gui_editactions.cpp --- a/src/gui_editactions.cpp Tue Jul 09 02:57:11 2013 +0300 +++ b/src/gui_editactions.cpp Tue Jul 09 03:04:31 2013 +0300 @@ -19,6 +19,7 @@ #include #include #include +#include #include "gui.h" #include "common.h" @@ -34,8 +35,6 @@ #include "ui_editraw.h" #include "ui_flip.h" -vector g_Clipboard; - cfg (bool, edit_schemanticinline, false); // ============================================================================= @@ -46,15 +45,17 @@ int num = 0; // Clear the clipboard first. - g_Clipboard.clear (); + qApp->clipboard()->clear(); // Now, copy the contents into the clipboard. - for (LDObject* obj : objs) - { - g_Clipboard << obj->raw (); + str data; + for (LDObject* obj : objs) { + data += ( obj->raw () + "\n" ); ++num; } + qApp->clipboard()->setText( data ); + return num; } @@ -80,11 +81,13 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.", CTRL (V)) { + const str clipboardText = qApp->clipboard()->text(); ulong idx = g_win->getInsertionPoint (); g_win->sel ().clear (); int num = 0; - for (str line : g_Clipboard) { + for( str line : clipboardText.split( "\n", QString::SkipEmptyParts )) + { LDObject* pasted = parseLine (line); g_curfile->insertObj (idx++, pasted); g_win->sel () << pasted;