Changes in src/Legacy/oldmenu.cpp [97ebf8:273382]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Legacy/oldmenu.cpp
r97ebf8 r273382 35 35 #include "Menu/DisplayMenuItem.hpp" 36 36 #include "Menu/SubMenuItem.hpp" 37 #include "Actions/MapOfActions.hpp"38 37 #include "Actions/MethodAction.hpp" 39 38 #include "Actions/ErrorAction.hpp" … … 62 61 char choice; // menu choice char 63 62 bool valid; 64 bool aborted;65 63 66 64 Log() << Verbose(0) << "===========ADD ATOM============================" << endl; … … 82 80 case 'a': // absolute coordinates of atom 83 81 { 82 first = World::getInstance().createAtom(); 84 83 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); 88 86 if(dialog->display()){ 89 87 mol->AddAtom(first); // add to molecule 90 88 } 91 89 else{ 90 // dialog was canceled... destroy the atom that was used 92 91 World::getInstance().destroyAtom(first); 93 92 } 93 delete dialog; 94 94 } 95 95 break; … … 98 98 first = World::getInstance().createAtom(); 99 99 valid = true; 100 aborted = false;101 100 do { 101 Dialog *dialog = UIFactory::getInstance().makeDialog(); 102 102 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); 109 105 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 118 111 break; 119 112 … … 124 117 do { 125 118 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl; 126 auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());127 119 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); 129 122 dialog->display(); 130 123 for (int i=NDIM;i--;) { … … 333 326 { 334 327 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); 336 329 dialog->display(); 337 330 delete dialog; … … 400 393 { 401 394 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); 403 396 dialog->display(); 404 397 delete dialog; … … 773 766 x.Zero(); 774 767 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 magnitude768 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 776 769 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 777 770 x += y; // per factor one cell width further … … 794 787 mol->Translate(&x); 795 788 } 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; 797 790 } 798 791 } … … 887 880 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 888 881 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(); 893 884 delete dialog; 885 mol->Center += x; 894 886 } 895 887 break; … … 909 901 molecule *srcmol = NULL, *destmol = NULL; 910 902 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); 913 905 if(dialog->display()) { 914 906 molecules->SimpleAdd(srcmol, destmol); … … 923 915 molecule *srcmol = NULL, *destmol = NULL; 924 916 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); 927 919 if(dialog->display()) { 928 920 molecules->EmbedMerge(destmol, srcmol);
Note:
See TracChangeset
for help on using the changeset viewer.