/* * OutputAction.cpp * * Created on: May 8, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Helpers/MemDebug.hpp" #include "Actions/WorldAction/OutputAction.hpp" #include "Actions/ActionRegistry.hpp" #include "Parser/ChangeTracker.hpp" #include "Helpers/Log.hpp" #include "Helpers/Verbose.hpp" #include "World.hpp" #include #include using namespace std; #include "UIElements/UIFactory.hpp" #include "UIElements/Dialog.hpp" #include "Actions/ValueStorage.hpp" const char WorldOutputAction::NAME[] = "output"; WorldOutputAction::WorldOutputAction() : Action(NAME) {} WorldOutputAction::~WorldOutputAction() {} void WorldOutput() { ActionRegistry::getInstance().getActionByName(WorldOutputAction::NAME)->call(Action::NonInteractive); }; Dialog* WorldOutputAction::fillDialog(Dialog *dialog) { ASSERT(dialog,"No Dialog given when filling action dialog"); dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME)); return dialog; } Action::state_ptr WorldOutputAction::performCall() { DoLog(0) && (Log() << Verbose(0) << "Saving world to files." << endl); ChangeTracker::getInstance().saveStatus(); return Action::success; } Action::state_ptr WorldOutputAction::performUndo(Action::state_ptr _state) { // ParserLoadXyzState *state = assert_cast(_state.get()); return Action::failure; // string newName = state->mol->getName(); // state->mol->setName(state->lastName); // // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); } Action::state_ptr WorldOutputAction::performRedo(Action::state_ptr _state){ return Action::failure; } bool WorldOutputAction::canUndo() { return false; } bool WorldOutputAction::shouldUndo() { return false; } const string WorldOutputAction::getName() { return NAME; }