| 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 |
|
|---|
| 8 | /*
|
|---|
| 9 | * OutputAction.cpp
|
|---|
| 10 | *
|
|---|
| 11 | * Created on: May 8, 2010
|
|---|
| 12 | * Author: heber
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | // include config.h
|
|---|
| 16 | #ifdef HAVE_CONFIG_H
|
|---|
| 17 | #include <config.h>
|
|---|
| 18 | #endif
|
|---|
| 19 |
|
|---|
| 20 | #include "Helpers/MemDebug.hpp"
|
|---|
| 21 |
|
|---|
| 22 | #include "Actions/WorldAction/OutputAction.hpp"
|
|---|
| 23 | #include "Actions/ActionRegistry.hpp"
|
|---|
| 24 | #include "Parser/ChangeTracker.hpp"
|
|---|
| 25 | #include "Helpers/Log.hpp"
|
|---|
| 26 | #include "Helpers/Verbose.hpp"
|
|---|
| 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"
|
|---|
| 36 | #include "Actions/ValueStorage.hpp"
|
|---|
| 37 |
|
|---|
| 38 | const char WorldOutputAction::NAME[] = "output";
|
|---|
| 39 |
|
|---|
| 40 | WorldOutputAction::WorldOutputAction() :
|
|---|
| 41 | Action(NAME)
|
|---|
| 42 | {}
|
|---|
| 43 |
|
|---|
| 44 | WorldOutputAction::~WorldOutputAction()
|
|---|
| 45 | {}
|
|---|
| 46 |
|
|---|
| 47 | void WorldOutput() {
|
|---|
| 48 | ActionRegistry::getInstance().getActionByName(WorldOutputAction::NAME)->call(Action::NonInteractive);
|
|---|
| 49 | };
|
|---|
| 50 |
|
|---|
| 51 | Dialog* WorldOutputAction::fillDialog(Dialog *dialog) {
|
|---|
| 52 | ASSERT(dialog,"No Dialog given when filling action dialog");
|
|---|
| 53 |
|
|---|
| 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;
|
|---|
| 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 | }
|
|---|