| 1 | /*
|
|---|
| 2 | * OutputAction.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: May 8, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "Helpers/MemDebug.hpp"
|
|---|
| 9 |
|
|---|
| 10 | #include "Actions/WorldAction/OutputAction.hpp"
|
|---|
| 11 | #include "Actions/ActionRegistry.hpp"
|
|---|
| 12 | #include "Parser/ChangeTracker.hpp"
|
|---|
| 13 | #include "Helpers/Log.hpp"
|
|---|
| 14 | #include "Helpers/Verbose.hpp"
|
|---|
| 15 | #include "World.hpp"
|
|---|
| 16 |
|
|---|
| 17 | #include <iostream>
|
|---|
| 18 | #include <string>
|
|---|
| 19 |
|
|---|
| 20 | using namespace std;
|
|---|
| 21 |
|
|---|
| 22 | #include "UIElements/UIFactory.hpp"
|
|---|
| 23 | #include "UIElements/Dialog.hpp"
|
|---|
| 24 | #include "Actions/ValueStorage.hpp"
|
|---|
| 25 |
|
|---|
| 26 | const char WorldOutputAction::NAME[] = "output";
|
|---|
| 27 |
|
|---|
| 28 | WorldOutputAction::WorldOutputAction() :
|
|---|
| 29 | Action(NAME)
|
|---|
| 30 | {}
|
|---|
| 31 |
|
|---|
| 32 | WorldOutputAction::~WorldOutputAction()
|
|---|
| 33 | {}
|
|---|
| 34 |
|
|---|
| 35 | void WorldOutput() {
|
|---|
| 36 | ActionRegistry::getInstance().getActionByName(WorldOutputAction::NAME)->call(Action::NonInteractive);
|
|---|
| 37 | };
|
|---|
| 38 |
|
|---|
| 39 | Dialog* WorldOutputAction::fillDialog(Dialog *dialog) {
|
|---|
| 40 | ASSERT(dialog,"No Dialog given when filling action dialog");
|
|---|
| 41 |
|
|---|
| 42 | dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
|
|---|
| 43 |
|
|---|
| 44 | return dialog;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | Action::state_ptr WorldOutputAction::performCall() {
|
|---|
| 48 |
|
|---|
| 49 | DoLog(0) && (Log() << Verbose(0) << "Saving world to files." << endl);
|
|---|
| 50 | ChangeTracker::getInstance().saveStatus();
|
|---|
| 51 | return Action::success;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | Action::state_ptr WorldOutputAction::performUndo(Action::state_ptr _state) {
|
|---|
| 55 | // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
|
|---|
| 56 |
|
|---|
| 57 | return Action::failure;
|
|---|
| 58 | // string newName = state->mol->getName();
|
|---|
| 59 | // state->mol->setName(state->lastName);
|
|---|
| 60 | //
|
|---|
| 61 | // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | Action::state_ptr WorldOutputAction::performRedo(Action::state_ptr _state){
|
|---|
| 65 | return Action::failure;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | bool WorldOutputAction::canUndo() {
|
|---|
| 69 | return false;
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | bool WorldOutputAction::shouldUndo() {
|
|---|
| 73 | return false;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | const string WorldOutputAction::getName() {
|
|---|
| 77 | return NAME;
|
|---|
| 78 | }
|
|---|