| 31 | } |
| 32 | |
| 33 | Document* Documents::add(int width, int height, ColorMode mode, int ncolors) |
| 34 | { |
| 35 | // Ask to observers to create the document (maybe a doc::Document or |
| 36 | // a derived class). |
| 37 | CreateDocumentArgs args; |
| 38 | notifyObservers(&DocumentsObserver::onCreateDocument, &args); |
| 39 | if (!args.document()) |
| 40 | args.setDocument(new Document()); |
| 41 | |
| 42 | std::unique_ptr<Document> doc(args.document()); |
| 43 | doc->sprites().add(width, height, mode, ncolors); |
| 44 | doc->setFilename("Sprite"); |
| 45 | doc->setContext(m_ctx); // Change the document context to add the doc in this collection |
| 46 | |
| 47 | return doc.release(); |
| 48 | } |
| 49 | |
| 50 | Document* Documents::add(Document* doc) |
| 51 | { |
nothing calls this directly
no test coverage detected