| [bcf653] | 1 | /* | 
|---|
|  | 2 | * Project: MoleCuilder | 
|---|
|  | 3 | * Description: creates and alters molecular systems | 
|---|
|  | 4 | * Copyright (C)  2010 University of Bonn. All rights reserved. | 
|---|
|  | 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
| [4f7f34e] | 8 | /* | 
|---|
|  | 9 | * OutputAction.cpp | 
|---|
|  | 10 | * | 
|---|
|  | 11 | *  Created on: May 8, 2010 | 
|---|
|  | 12 | *      Author: heber | 
|---|
|  | 13 | */ | 
|---|
|  | 14 |  | 
|---|
| [bf3817] | 15 | // include config.h | 
|---|
|  | 16 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 17 | #include <config.h> | 
|---|
|  | 18 | #endif | 
|---|
|  | 19 |  | 
|---|
| [4f7f34e] | 20 | #include "Helpers/MemDebug.hpp" | 
|---|
|  | 21 |  | 
|---|
|  | 22 | #include "Actions/WorldAction/OutputAction.hpp" | 
|---|
| [0430e3] | 23 | #include "Actions/ActionRegistry.hpp" | 
|---|
| [4a611e] | 24 | #include "Parser/ChangeTracker.hpp" | 
|---|
| [952f38] | 25 | #include "Helpers/Log.hpp" | 
|---|
|  | 26 | #include "Helpers/Verbose.hpp" | 
|---|
| [4f7f34e] | 27 | #include "World.hpp" | 
|---|
|  | 28 |  | 
|---|
|  | 29 | #include <iostream> | 
|---|
|  | 30 | #include <string> | 
|---|
|  | 31 |  | 
|---|
|  | 32 | using namespace std; | 
|---|
|  | 33 |  | 
|---|
|  | 34 | #include "UIElements/UIFactory.hpp" | 
|---|
|  | 35 | #include "UIElements/Dialog.hpp" | 
|---|
| [861874] | 36 | #include "Actions/ValueStorage.hpp" | 
|---|
| [4f7f34e] | 37 |  | 
|---|
|  | 38 | const char WorldOutputAction::NAME[] = "output"; | 
|---|
|  | 39 |  | 
|---|
|  | 40 | WorldOutputAction::WorldOutputAction() : | 
|---|
|  | 41 | Action(NAME) | 
|---|
|  | 42 | {} | 
|---|
|  | 43 |  | 
|---|
|  | 44 | WorldOutputAction::~WorldOutputAction() | 
|---|
|  | 45 | {} | 
|---|
|  | 46 |  | 
|---|
| [a8f6ae] | 47 | void WorldOutput() { | 
|---|
|  | 48 | ActionRegistry::getInstance().getActionByName(WorldOutputAction::NAME)->call(Action::NonInteractive); | 
|---|
|  | 49 | }; | 
|---|
|  | 50 |  | 
|---|
| [047878] | 51 | Dialog* WorldOutputAction::fillDialog(Dialog *dialog) { | 
|---|
|  | 52 | ASSERT(dialog,"No Dialog given when filling action dialog"); | 
|---|
| [4f7f34e] | 53 |  | 
|---|
| [37c282] | 54 | dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME)); | 
|---|
|  | 55 |  | 
|---|
|  | 56 | return dialog; | 
|---|
|  | 57 | } | 
|---|
|  | 58 |  | 
|---|
|  | 59 | Action::state_ptr WorldOutputAction::performCall() { | 
|---|
|  | 60 |  | 
|---|
|  | 61 | DoLog(0) && (Log() << Verbose(0) << "Saving world to files." << endl); | 
|---|
|  | 62 | ChangeTracker::getInstance().saveStatus(); | 
|---|
|  | 63 | return Action::success; | 
|---|
| [4f7f34e] | 64 | } | 
|---|
|  | 65 |  | 
|---|
|  | 66 | Action::state_ptr WorldOutputAction::performUndo(Action::state_ptr _state) { | 
|---|
|  | 67 | //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); | 
|---|
|  | 68 |  | 
|---|
|  | 69 | return Action::failure; | 
|---|
|  | 70 | //  string newName = state->mol->getName(); | 
|---|
|  | 71 | //  state->mol->setName(state->lastName); | 
|---|
|  | 72 | // | 
|---|
|  | 73 | //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); | 
|---|
|  | 74 | } | 
|---|
|  | 75 |  | 
|---|
|  | 76 | Action::state_ptr WorldOutputAction::performRedo(Action::state_ptr _state){ | 
|---|
|  | 77 | return Action::failure; | 
|---|
|  | 78 | } | 
|---|
|  | 79 |  | 
|---|
|  | 80 | bool WorldOutputAction::canUndo() { | 
|---|
|  | 81 | return false; | 
|---|
|  | 82 | } | 
|---|
|  | 83 |  | 
|---|
|  | 84 | bool WorldOutputAction::shouldUndo() { | 
|---|
|  | 85 | return false; | 
|---|
|  | 86 | } | 
|---|
|  | 87 |  | 
|---|
|  | 88 | const string WorldOutputAction::getName() { | 
|---|
|  | 89 | return NAME; | 
|---|
|  | 90 | } | 
|---|