Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Legacy/oldmenu.cpp

    r97ebf8 r273382  
    3535#include "Menu/DisplayMenuItem.hpp"
    3636#include "Menu/SubMenuItem.hpp"
    37 #include "Actions/MapOfActions.hpp"
    3837#include "Actions/MethodAction.hpp"
    3938#include "Actions/ErrorAction.hpp"
     
    6261  char choice;  // menu choice char
    6362  bool valid;
    64   bool aborted;
    6563
    6664  Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
     
    8280      case 'a': // absolute coordinates of atom
    8381      {
     82        first = World::getInstance().createAtom();
    8483        Dialog *dialog = UIFactory::getInstance().makeDialog();
    85         first = World::getInstance().createAtom();
    86         dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false);
    87         dialog->queryElement("Please choose element: ",&first->type);
     84        dialog->queryVector("Enter absolute coordinates.",&first->x,mol->cell_size, false);
     85        dialog->queryElement("Choose element for this atom",&first->type);
    8886        if(dialog->display()){
    8987          mol->AddAtom(first);  // add to molecule
    9088        }
    9189        else{
     90          // dialog was canceled... destroy the atom that was used
    9291          World::getInstance().destroyAtom(first);
    9392        }
     93        delete dialog;
    9494      }
    9595      break;
     
    9898        first = World::getInstance().createAtom();
    9999        valid = true;
    100         aborted = false;
    101100        do {
     101          Dialog *dialog = UIFactory::getInstance().makeDialog();
    102102          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    103           auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    104           dialog->queryVector("Enter reference coordinates.",&x,World::getInstance().getDomain(), true);
    105           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
    106           if((aborted = !dialog->display())){
    107             continue;
    108           }
     103          dialog->queryVector("Enter reference coordinates.",&x,mol->cell_size,true);
     104          dialog->queryVector("Enter relative coordinates.",&first->x,mol->cell_size,false);
    109105          first->x += x;
    110         } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->x)));
    111         if(!aborted){
    112           first->type = periode->AskElement();  // give type
    113           mol->AddAtom(first);  // add to molecule
    114         }
    115         else{
    116           World::getInstance().destroyAtom(first);
    117         }
     106          dialog->display();
     107          delete dialog;
     108        } while (!(valid = mol->CheckBounds(&first->x)));
     109        first->type = periode->AskElement();  // give type
     110        mol->AddAtom(first);  // add to molecule
    118111        break;
    119112
     
    124117        do {
    125118          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    126           auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    127119          second = mol->AskAtom("Enter atom number: ");
    128           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     120          Dialog *dialog = UIFactory::getInstance().makeDialog();
     121          dialog->queryVector("Enter relative coordinates.",&first->x,mol->cell_size,false);
    129122          dialog->display();
    130123          for (int i=NDIM;i--;) {
     
    333326    {
    334327      Dialog *dialog = UIFactory::getInstance().makeDialog();
    335       dialog->queryVector("Enter normal vector of mirror plane.",&n,World::getInstance().getDomain(),false);
     328      dialog->queryVector("Enter normal vector of mirror plane.",&n,mol->cell_size,false);
    336329      dialog->display();
    337330      delete dialog;
     
    400393    {
    401394      Dialog *dialog = UIFactory::getInstance().makeDialog();
    402       dialog->queryVector("Enter normal vector of mirror plane.",&n,World::getInstance().getDomain(),false);
     395      dialog->queryVector("Enter normal vector of mirror plane.",&n,mol->cell_size,false);
    403396      dialog->display();
    404397      delete dialog;
     
    773766      x.Zero();
    774767      y.Zero();
    775       y[abs(axis)-1] = World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
     768      y[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
    776769      for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    777770        x += y; // per factor one cell width further
     
    794787        mol->Translate(&x);
    795788      }
    796       World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
     789      mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    797790    }
    798791  }
     
    887880        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    888881        Dialog *dialog = UIFactory::getInstance().makeDialog();
    889         dialog->queryVector("Enter translation vector.",&x,World::getInstance().getDomain(),false);
    890         if(dialog->display()){
    891           mol->Center += x;
    892         }
     882        dialog->queryVector("Enter translation vector.",&x,mol->cell_size,false);
     883        dialog->display();
    893884        delete dialog;
     885        mol->Center += x;
    894886     }
    895887     break;
     
    909901  molecule *srcmol = NULL, *destmol = NULL;
    910902  Dialog *dialog = UIFactory::getInstance().makeDialog();
    911   dialog->queryMolecule("molecule-by-id",&destmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    912   dialog->queryMolecule("molecule-by-id",&srcmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
     903  dialog->queryMolecule("Enter index of destination molecule: ",&destmol, molecules);
     904  dialog->queryMolecule("Enter index of source molecule to add from: ",&srcmol, molecules);
    913905  if(dialog->display()) {
    914906    molecules->SimpleAdd(srcmol, destmol);
     
    923915  molecule *srcmol = NULL, *destmol = NULL;
    924916  Dialog *dialog = UIFactory::getInstance().makeDialog();
    925   dialog->queryMolecule("molecule-by-id",&destmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    926   dialog->queryMolecule("molecule-by-id",&srcmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
     917  dialog->queryMolecule("Enter index of matrix molecule (the variable one): ",&srcmol,molecules);
     918  dialog->queryMolecule("Enter index of molecule to merge into (the fixed one): ",&destmol,molecules);
    927919  if(dialog->display()) {
    928920    molecules->EmbedMerge(destmol, srcmol);
Note: See TracChangeset for help on using the changeset viewer.