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