Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AtomAction/ChangeElementAction.cpp

    rdddbfe rd74077  
    1212#include "atom.hpp"
    1313#include "element.hpp"
    14 #include "Helpers/Log.hpp"
    15 #include "LinearAlgebra/Vector.hpp"
    16 #include "Helpers/Verbose.hpp"
    17 #include "molecule.hpp"
     14#include "log.hpp"
     15#include "vector.hpp"
     16#include "verbose.hpp"
    1817#include "World.hpp"
    1918
     
    2524#include "UIElements/UIFactory.hpp"
    2625#include "UIElements/Dialog.hpp"
    27 #include "Actions/ValueStorage.hpp"
     26#include "UIElements/ValueStorage.hpp"
    2827
    2928const char AtomChangeElementAction::NAME[] = "change-element";
     
    4140};
    4241
    43 Dialog* AtomChangeElementAction::fillDialog(Dialog *dialog) {
    44   ASSERT(dialog,"No Dialog given when filling action dialog");
     42Dialog* AtomChangeElementAction::createDialog() {
     43  Dialog *dialog = UIFactory::getInstance().makeDialog();
    4544
    4645  dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
     
    5251  atom *first = NULL;
    5352  element *elemental = NULL;
    54   molecule *mol = NULL;
    5553
    5654  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
     
    5957    first = iter->second;
    6058    DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elemental->symbol << "." << endl);
    61     mol = first->getMolecule();
    62     first->removeFromMolecule(); // remove atom
    63     first->type = elemental;
    64     mol->AddAtom(first);  // add atom to ensure correctness of formula
     59    first->setType(elemental);
    6560  }
    6661  return Action::success;
Note: See TracChangeset for help on using the changeset viewer.