]> Shamusworld >> Repos - architektonas/blob - src/base/rs_clipboard.cpp
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / rs_clipboard.cpp
1 // rs_clipboard.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/28/2010  Added this text. :-)
15 //
16
17 #include "rs_clipboard.h"
18 #include "rs_block.h"
19 #include "rs_layer.h"
20 #include "rs_entity.h"
21
22 RS_Clipboard* RS_Clipboard::uniqueInstance = NULL;
23
24
25
26 void RS_Clipboard::clear() {
27         graphic.clear();
28         graphic.clearBlocks();
29         graphic.clearLayers();
30         graphic.clearVariables();
31 }
32
33
34
35
36
37 void RS_Clipboard::addBlock(RS_Block* b) {
38         if (b!=NULL) {
39                 graphic.addBlock(b, false);
40         }
41 }
42
43
44 bool RS_Clipboard::hasBlock(const QString& name) {
45         return (graphic.findBlock(name)!=NULL);
46 }
47
48
49 void RS_Clipboard::addLayer(RS_Layer* l) {
50         if (l!=NULL) {
51                 //graphic.addLayer(l->clone());
52                 graphic.addLayer(l);
53         }
54 }
55
56
57
58 bool RS_Clipboard::hasLayer(const QString& name) {
59         return (graphic.findLayer(name)!=NULL);
60 }
61
62
63
64 void RS_Clipboard::addEntity(RS_Entity* e) {
65         if (e!=NULL) {
66                 //graphic.addEntity(e->clone());
67                 graphic.addEntity(e);
68                 e->reparent(&graphic);
69         }
70 }
71
72 /**
73  * Dumps the clipboard contents to stdout.
74  */
75 std::ostream& operator << (std::ostream& os, RS_Clipboard& cb) {
76         os << "Clipboard: " << cb.graphic << "\n";
77
78         return os;
79 }
80