]> Shamusworld >> Repos - architektonas/blob - src/base/rs_clipboard.cpp
Final round of dialogs/forms needing to be converted from Qt3 to 4
[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 // (C) 2010 Underground Software
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  05/28/2010  Added this text. :-)
13 //
14
15 #include "rs_clipboard.h"
16 #include "rs_block.h"
17 #include "rs_layer.h"
18 #include "rs_entity.h"
19
20 RS_Clipboard* RS_Clipboard::uniqueInstance = NULL;
21
22
23
24 void RS_Clipboard::clear() {
25         graphic.clear();
26         graphic.clearBlocks();
27         graphic.clearLayers();
28         graphic.clearVariables();
29 }
30
31
32
33
34
35 void RS_Clipboard::addBlock(RS_Block* b) {
36         if (b!=NULL) {
37                 graphic.addBlock(b, false);
38         }
39 }
40
41
42 bool RS_Clipboard::hasBlock(const QString& name) {
43         return (graphic.findBlock(name)!=NULL);
44 }
45
46
47 void RS_Clipboard::addLayer(RS_Layer* l) {
48         if (l!=NULL) {
49                 //graphic.addLayer(l->clone());
50                 graphic.addLayer(l);
51         }
52 }
53
54
55
56 bool RS_Clipboard::hasLayer(const QString& name) {
57         return (graphic.findLayer(name)!=NULL);
58 }
59
60
61
62 void RS_Clipboard::addEntity(RS_Entity* e) {
63         if (e!=NULL) {
64                 //graphic.addEntity(e->clone());
65                 graphic.addEntity(e);
66                 e->reparent(&graphic);
67         }
68 }
69
70 /**
71  * Dumps the clipboard contents to stdout.
72  */
73 std::ostream& operator << (std::ostream& os, RS_Clipboard& cb) {
74         os << "Clipboard: " << cb.graphic << "\n";
75
76         return os;
77 }
78