| 160 | } |
| 161 | |
| 162 | void saveAs(const std::string& fileName, bool asCopy) { |
| 163 | commit(); |
| 164 | if (fileName.empty()) asCopy = false; |
| 165 | auto uiCtx = app::UIContext::instance(); |
| 166 | uiCtx->setActiveDocument(doc()); |
| 167 | auto commandName = asCopy ? app::CommandId::SaveFileCopyAs : app::CommandId::SaveFile; |
| 168 | auto saveCommand = app::CommandsModule::instance()->getCommandByName(commandName); |
| 169 | app::Params params; |
| 170 | if (asCopy) params.set("filename", fileName.c_str()); |
| 171 | else if(!fileName.empty()) doc()->setFilename(fileName); |
| 172 | uiCtx->executeCommand(saveCommand, params); |
| 173 | } |
| 174 | |
| 175 | void loadPalette(const std::string& fileName){ |
| 176 | auto palette = app::load_palette(fileName.c_str()); |
no test coverage detected