X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fclipboard.cpp;fp=src%2Fbase%2Fclipboard.cpp;h=943781afafc5040591d7d7a2ca4ab5884c0a610e;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=783951ebeb75547305d7ead3e8bea33662378789;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/clipboard.cpp b/src/base/clipboard.cpp index 783951e..943781a 100644 --- a/src/base/clipboard.cpp +++ b/src/base/clipboard.cpp @@ -12,69 +12,122 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/28/2010 Added this text. :-) +// JLH 09/09/2010 Removed implementation from header (where it DOESN'T +// belong) and moved it here (where it DOES) // #include "clipboard.h" + #include "block.h" #include "layer.h" #include "entity.h" -RS_Clipboard* RS_Clipboard::uniqueInstance = NULL; - - +Clipboard * Clipboard::uniqueInstance = NULL; -void RS_Clipboard::clear() { +void Clipboard::clear() +{ graphic.clear(); graphic.clearBlocks(); graphic.clearLayers(); graphic.clearVariables(); } +void Clipboard::addBlock(Block * b) +{ + if (b) + graphic.addBlock(b, false); +} +bool Clipboard::hasBlock(const QString & name) +{ + return (graphic.findBlock(name) != NULL); +} +void Clipboard::addLayer(Layer * l) +{ + if (l) + graphic.addLayer(l); +} +bool Clipboard::hasLayer(const QString & name) +{ + return (graphic.findLayer(name) != NULL); +} -void RS_Clipboard::addBlock(RS_Block* b) { - if (b!=NULL) { - graphic.addBlock(b, false); +void Clipboard::addEntity(Entity * e) +{ + if (e) + { + graphic.addEntity(e); + e->reparent(&graphic); } } +/** + * Dumps the clipboard contents to stdout. + */ +std::ostream & operator<<(std::ostream & os, Clipboard & cb) +{ + os << "Clipboard: " << cb.graphic << "\n"; + return os; +} -bool RS_Clipboard::hasBlock(const QString& name) { - return (graphic.findBlock(name)!=NULL); +Clipboard::Clipboard() +{ } +/** + * @return Instance to the unique clipboard object. + */ +/*static*/ Clipboard * Clipboard::instance() +{ + if (uniqueInstance == NULL) + uniqueInstance = new Clipboard(); -void RS_Clipboard::addLayer(RS_Layer* l) { - if (l!=NULL) { - //graphic.addLayer(l->clone()); - graphic.addLayer(l); - } + return uniqueInstance; } +int Clipboard::countBlocks() +{ + return graphic.countBlocks(); +} +Block * Clipboard::blockAt(int i) +{ + return graphic.blockAt(i); +} -bool RS_Clipboard::hasLayer(const QString& name) { - return (graphic.findLayer(name)!=NULL); +int Clipboard::countLayers() +{ + return graphic.countLayers(); } +Layer * Clipboard::layerAt(int i) +{ + return graphic.layerAt(i); +} +uint Clipboard::count() +{ + return graphic.count(); +} -void RS_Clipboard::addEntity(RS_Entity* e) { - if (e!=NULL) { - //graphic.addEntity(e->clone()); - graphic.addEntity(e); - e->reparent(&graphic); - } +Entity * Clipboard::entityAt(uint i) +{ + return graphic.entityAt(i); } -/** - * Dumps the clipboard contents to stdout. - */ -std::ostream& operator << (std::ostream& os, RS_Clipboard& cb) { - os << "Clipboard: " << cb.graphic << "\n"; +Entity * Clipboard::firstEntity() +{ + return graphic.firstEntity(); +} - return os; +Entity * Clipboard::nextEntity() +{ + return graphic.nextEntity(); } +Drawing * Clipboard::getGraphic() +{ + return &graphic; +}