implemented clipboard handling for cards

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@83 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-11-20 18:51:11 +00:00
parent 3cbf2577c1
commit 23abbedcbd
46 changed files with 433 additions and 70 deletions
+22 -1
View File
@@ -190,7 +190,6 @@ template <> void Reader::handle(double& d) {
template <> void Reader::handle(bool& b) {
b = (value==_("true") || value==_("1") || value==_("yes"));
}
// ----------------------------------------------------------------------------- : Handling less basic util types
template <> void Reader::handle(Vector2D& vec) {
@@ -205,3 +204,25 @@ template <> void Reader::handle(Color& col) {
col.Set(r, g, b);
}
}
template <> void Reader::handle(FileName& f) {
if (clipboard_package()) {
String str; handle(str);
if (!str.empty()) {
// copy file into current package
try {
String packaged_name = clipboard_package()->newFileName(_("image"),_("")); // a new unique name in the package, assume it's an image
OutputStreamP out = clipboard_package()->openOut(packaged_name);
InputStreamP in = Package::openAbsoluteFile(str);
out->Write(*in); // copy
f.assign(packaged_name);
} catch (Error) {
// ignore errors
}
} else {
f.assign(str);
}
} else {
handle(static_cast<String&>(f));
}
}