Changeset b918031
- Timestamp:
- May 9, 2010, 11:59:35 AM (16 years ago)
- Children:
- e62daa
- Parents:
- c93262
- git-author:
- Frederik Heber <heber@…> (05/09/10 11:15:17)
- git-committer:
- Frederik Heber <heber@…> (05/09/10 11:59:35)
- Location:
- molecuilder/src
- Files:
-
- 8 edited
-
Actions/CmdAction/HelpAction.cpp (modified) (1 diff)
-
UIElements/CommandLineDialog.cpp (modified) (6 diffs)
-
UIElements/CommandLineDialog.hpp (modified) (1 diff)
-
UIElements/CommandLineUIFactory.cpp (modified) (1 diff)
-
UIElements/Dialog.cpp (modified) (1 diff)
-
UIElements/Dialog.hpp (modified) (2 diffs)
-
UIElements/TextDialog.cpp (modified) (2 diffs)
-
UIElements/TextDialog.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Actions/CmdAction/HelpAction.cpp
rc93262 rb918031 27 27 28 28 Action::state_ptr CommandLineHelpAction::performCall() { 29 ostringstream usage; 29 30 Dialog *dialog = UIFactory::getInstance().makeDialog(); 30 31 31 cout << CommandLineParser::getInstance().visible << endl; 32 usage << CommandLineParser::getInstance().visible << endl; 33 dialog->queryEmpty(NAME, usage.str()); 32 34 33 delete dialog; 34 return Action::failure; 35 if(dialog->display()) { 36 delete dialog; 37 return Action::success; 38 } else { 39 delete dialog; 40 return Action::failure; 41 } 35 42 } 36 43 -
molecuilder/src/UIElements/CommandLineDialog.cpp
rc93262 rb918031 35 35 36 36 37 void CommandLineDialog::query Int(const char* title, int* target){38 registerQuery(new IntTextQuery(title,target));37 void CommandLineDialog::queryEmpty(const char* title, string _description){ 38 registerQuery(new EmptyCommandLineQuery(title, _description)); 39 39 } 40 40 41 void CommandLineDialog::query Double(const char* title, double* target){42 registerQuery(new DoubleTextQuery(title,target));41 void CommandLineDialog::queryInt(const char* title, int* target, string _description){ 42 registerQuery(new IntCommandLineQuery(title,target, _description)); 43 43 } 44 44 45 void CommandLineDialog::query String(const char* title, string* target){46 registerQuery(new StringTextQuery(title,target));45 void CommandLineDialog::queryDouble(const char* title, double* target, string _description){ 46 registerQuery(new DoubleCommandLineQuery(title,target, _description)); 47 47 } 48 48 49 void CommandLineDialog::query Molecule(const char* title, molecule **target, MoleculeListClass *molecules){50 registerQuery(new MoleculeTextQuery(title,target,molecules));49 void CommandLineDialog::queryString(const char* title, string* target, string _description){ 50 registerQuery(new StringCommandLineQuery(title,target, _description)); 51 51 } 52 52 53 void CommandLineDialog::query Vector(const char* title, Vector *target,const double *const cellSize, bool check) {54 registerQuery(new VectorTextQuery(title,target,cellSize,check));53 void CommandLineDialog::queryMolecule(const char* title, molecule **target, MoleculeListClass *molecules, string _description) { 54 registerQuery(new MoleculeCommandLineQuery(title,target,molecules, _description)); 55 55 } 56 56 57 void CommandLineDialog::queryElement(const char* title, const element **target){ 58 registerQuery(new ElementTextQuery(title,target)); 57 void CommandLineDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string _description) { 58 registerQuery(new VectorCommandLineQuery(title,target,cellSize,check, _description)); 59 } 60 61 void CommandLineDialog::queryElement(const char* title, const element **target, string _description){ 62 registerQuery(new ElementCommandLineQuery(title,target, _description)); 59 63 } 60 64 61 65 /************************** Query Infrastructure ************************/ 62 66 63 CommandLineDialog:: IntTextQuery::IntTextQuery(string title,int *_target) :64 Dialog:: IntQuery(title,_target)67 CommandLineDialog::EmptyCommandLineQuery::EmptyCommandLineQuery(string title, string _description) : 68 Dialog::EmptyQuery(title, _description) 65 69 {} 66 70 67 CommandLineDialog:: IntTextQuery::~IntTextQuery() {}71 CommandLineDialog::EmptyCommandLineQuery::~EmptyCommandLineQuery() {} 68 72 69 bool CommandLineDialog::IntTextQuery::handle() { 73 bool CommandLineDialog::EmptyCommandLineQuery::handle() { 74 cout << "Message of " << getTitle() << ":\n" << getDescription() << "\n"; 75 return true; 76 } 77 78 CommandLineDialog::IntCommandLineQuery::IntCommandLineQuery(string title,int *_target, string _description) : 79 Dialog::IntQuery(title,_target, _description) 80 {} 81 82 CommandLineDialog::IntCommandLineQuery::~IntCommandLineQuery() {} 83 84 bool CommandLineDialog::IntCommandLineQuery::handle() { 70 85 if (CommandLineParser::getInstance().vm.count(getTitle())) { 71 86 tmp = CommandLineParser::getInstance().vm[getTitle()].as<int>(); … … 75 90 } 76 91 77 CommandLineDialog::String TextQuery::StringTextQuery(string title,string *_target) :78 Dialog::StringQuery(title,_target )92 CommandLineDialog::StringCommandLineQuery::StringCommandLineQuery(string title,string *_target, string _description) : 93 Dialog::StringQuery(title,_target, _description) 79 94 {} 80 95 81 CommandLineDialog::String TextQuery::~StringTextQuery() {}96 CommandLineDialog::StringCommandLineQuery::~StringCommandLineQuery() {} 82 97 83 bool CommandLineDialog::String TextQuery::handle() {98 bool CommandLineDialog::StringCommandLineQuery::handle() { 84 99 if (CommandLineParser::getInstance().vm.count(getTitle())) { 85 tmp = CommandLineParser::getInstance().vm[getTitle()].as<st d::string>();100 tmp = CommandLineParser::getInstance().vm[getTitle()].as<string>(); 86 101 return true; 87 102 } else … … 89 104 } 90 105 91 CommandLineDialog::Double TextQuery::DoubleTextQuery(string title,double *_target) :92 Dialog::DoubleQuery(title,_target )106 CommandLineDialog::DoubleCommandLineQuery::DoubleCommandLineQuery(string title,double *_target, string _description) : 107 Dialog::DoubleQuery(title,_target, _description) 93 108 {} 94 109 95 CommandLineDialog::Double TextQuery::~DoubleTextQuery() {}110 CommandLineDialog::DoubleCommandLineQuery::~DoubleCommandLineQuery() {} 96 111 97 bool CommandLineDialog::Double TextQuery::handle() {112 bool CommandLineDialog::DoubleCommandLineQuery::handle() { 98 113 if (CommandLineParser::getInstance().vm.count(getTitle())) { 99 114 tmp = CommandLineParser::getInstance().vm[getTitle()].as<double>(); … … 103 118 } 104 119 105 CommandLineDialog::Molecule TextQuery::MoleculeTextQuery(string title, molecule **_target, MoleculeListClass *_molecules) :106 Dialog::MoleculeQuery(title,_target,_molecules )120 CommandLineDialog::MoleculeCommandLineQuery::MoleculeCommandLineQuery(string title, molecule **_target, MoleculeListClass *_molecules, string _description) : 121 Dialog::MoleculeQuery(title,_target,_molecules, _description) 107 122 {} 108 123 109 CommandLineDialog::Molecule TextQuery::~MoleculeTextQuery() {}124 CommandLineDialog::MoleculeCommandLineQuery::~MoleculeCommandLineQuery() {} 110 125 111 bool CommandLineDialog::Molecule TextQuery::handle() {126 bool CommandLineDialog::MoleculeCommandLineQuery::handle() { 112 127 int IdxOfMol = -1; 113 128 if (CommandLineParser::getInstance().vm.count(getTitle())) { … … 119 134 } 120 135 121 CommandLineDialog::Vector TextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check) :122 Dialog::VectorQuery(title,_target,_cellSize,_check )136 CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, const double *const _cellSize, bool _check, string _description) : 137 Dialog::VectorQuery(title,_target,_cellSize,_check, _description) 123 138 {} 124 139 125 CommandLineDialog::Vector TextQuery::~VectorTextQuery()140 CommandLineDialog::VectorCommandLineQuery::~VectorCommandLineQuery() 126 141 {} 127 142 128 bool CommandLineDialog::Vector TextQuery::handle() {143 bool CommandLineDialog::VectorCommandLineQuery::handle() { 129 144 vector<double> temp; 130 145 if (CommandLineParser::getInstance().vm.count(getTitle())) { … … 140 155 141 156 142 CommandLineDialog::Element TextQuery::ElementTextQuery(std::string title, const element **target) :143 Dialog::ElementQuery(title,target )157 CommandLineDialog::ElementCommandLineQuery::ElementCommandLineQuery(string title, const element **target, string _description) : 158 Dialog::ElementQuery(title,target, _description) 144 159 {} 145 160 146 CommandLineDialog::Element TextQuery::~ElementTextQuery()161 CommandLineDialog::ElementCommandLineQuery::~ElementCommandLineQuery() 147 162 {} 148 163 149 bool CommandLineDialog::Element TextQuery::handle() {164 bool CommandLineDialog::ElementCommandLineQuery::handle() { 150 165 int Z = -1; 151 166 if (CommandLineParser::getInstance().vm.count(getTitle())) { -
molecuilder/src/UIElements/CommandLineDialog.hpp
rc93262 rb918031 22 22 virtual ~CommandLineDialog(); 23 23 24 virtual void queryInt(const char *, int *); 25 virtual void queryString(const char*, std::string *); 26 virtual void queryDouble(const char*, double*); 27 virtual void queryMolecule(const char*,molecule**,MoleculeListClass*); 28 virtual void queryVector(const char*,Vector *,const double * const,bool); 29 virtual void queryElement(const char*,const element **); 24 virtual void queryEmpty(const char *, std::string = ""); 25 virtual void queryInt(const char *, int *, std::string = ""); 26 virtual void queryString(const char*, std::string *, std::string = ""); 27 virtual void queryDouble(const char*, double*, std::string = ""); 28 virtual void queryMolecule(const char*,molecule**,MoleculeListClass*, std::string = ""); 29 virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = ""); 30 virtual void queryElement(const char*,const element **, std::string = ""); 30 31 31 32 protected: 32 33 // specialized stuff for text queries 33 class IntTextQuery : public Dialog::IntQuery {34 class EmptyCommandLineQuery : public Dialog::EmptyQuery { 34 35 public: 35 IntTextQuery(std::string title, int *_target);36 virtual ~ IntTextQuery();36 EmptyCommandLineQuery(std::string title, std::string _description = ""); 37 virtual ~EmptyCommandLineQuery(); 37 38 virtual bool handle(); 38 39 }; 39 40 40 class DoubleTextQuery : public Dialog::DoubleQuery {41 class IntCommandLineQuery : public Dialog::IntQuery { 41 42 public: 42 DoubleTextQuery(std::string title, double *_target);43 virtual ~ DoubleTextQuery();43 IntCommandLineQuery(std::string title, int *_target, std::string _description = ""); 44 virtual ~IntCommandLineQuery(); 44 45 virtual bool handle(); 45 46 }; 46 47 47 class StringTextQuery : public Dialog::StringQuery {48 class DoubleCommandLineQuery : public Dialog::DoubleQuery { 48 49 public: 49 StringTextQuery(std::string title, std::string *_target);50 virtual ~ StringTextQuery();50 DoubleCommandLineQuery(std::string title, double *_target, std::string _description = ""); 51 virtual ~DoubleCommandLineQuery(); 51 52 virtual bool handle(); 52 53 }; 53 54 54 class MoleculeTextQuery : public Dialog::MoleculeQuery {55 class StringCommandLineQuery : public Dialog::StringQuery { 55 56 public: 56 MoleculeTextQuery(std::string title, molecule **_target, MoleculeListClass *_molecules);57 virtual ~ MoleculeTextQuery();57 StringCommandLineQuery(std::string title, std::string *_target, std::string _description = ""); 58 virtual ~StringCommandLineQuery(); 58 59 virtual bool handle(); 59 60 }; 60 61 61 class VectorTextQuery : public Dialog::VectorQuery {62 class MoleculeCommandLineQuery : public Dialog::MoleculeQuery { 62 63 public: 63 VectorTextQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check);64 virtual ~ VectorTextQuery();64 MoleculeCommandLineQuery(std::string title, molecule **_target, MoleculeListClass *_molecules, std::string _description = ""); 65 virtual ~MoleculeCommandLineQuery(); 65 66 virtual bool handle(); 66 67 }; 67 68 68 class ElementTextQuery : public Dialog::ElementQuery {69 class VectorCommandLineQuery : public Dialog::VectorQuery { 69 70 public: 70 ElementTextQuery(std::string title, const element **_target); 71 virtual ~ElementTextQuery(); 71 VectorCommandLineQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = ""); 72 virtual ~VectorCommandLineQuery(); 73 virtual bool handle(); 74 }; 75 76 class ElementCommandLineQuery : public Dialog::ElementQuery { 77 public: 78 ElementCommandLineQuery(std::string title, const element **_target, std::string _description = ""); 79 virtual ~ElementCommandLineQuery(); 72 80 virtual bool handle(); 73 81 }; -
molecuilder/src/UIElements/CommandLineUIFactory.cpp
rc93262 rb918031 25 25 26 26 Dialog* CommandLineUIFactory::makeDialog() { 27 return NULL;27 return new CommandLineDialog(); 28 28 } 29 29 -
molecuilder/src/UIElements/Dialog.cpp
rc93262 rb918031 65 65 return description; 66 66 } 67 // empty Queries 68 69 Dialog::EmptyQuery::EmptyQuery(string title, std::string description) : 70 Query(title, description) 71 {} 72 73 Dialog::EmptyQuery::~EmptyQuery() {} 74 75 void Dialog::EmptyQuery::setResult() { 76 } 77 67 78 // Int Queries 68 79 -
molecuilder/src/UIElements/Dialog.hpp
rc93262 rb918031 23 23 virtual ~Dialog(); 24 24 25 virtual void queryEmpty(const char *, std::string = "")=0; 25 26 virtual void queryInt(const char *, int *, std::string = "")=0; 26 27 virtual void queryDouble(const char*,double *, std::string = "")=0; … … 56 57 std::string title; //!< short title of the query 57 58 std::string description; //!< longer description for tooltips or for help 59 }; 60 61 // Empty Query is just meant for showing text, such as version, help, initial message or alike 62 class EmptyQuery : public Query { 63 public: 64 EmptyQuery(std::string title, std::string _description = ""); 65 virtual ~EmptyQuery(); 66 virtual bool handle()=0; 67 virtual void setResult(); 58 68 }; 59 69 -
molecuilder/src/UIElements/TextDialog.cpp
rc93262 rb918031 29 29 30 30 31 void TextDialog::queryEmpty(const char* title, string description){ 32 registerQuery(new EmptyTextQuery(title,description)); 33 } 34 31 35 void TextDialog::queryInt(const char* title, int* target, string description){ 32 36 registerQuery(new IntTextQuery(title,target,description)); … … 55 59 /************************** Query Infrastructure ************************/ 56 60 57 TextDialog::IntTextQuery::IntTextQuery(string title,int *_target, std::string _description) : 61 TextDialog::EmptyTextQuery::EmptyTextQuery(string title, std::string _description) : 62 Dialog::EmptyQuery(title,_description) 63 {} 64 65 TextDialog::EmptyTextQuery::~EmptyTextQuery() {} 66 67 bool TextDialog::EmptyTextQuery::handle() { 68 cout << "Message of " << getTitle() << ":\n" << getDescription() << "\n"; 69 return true; 70 } 71 72 TextDialog::IntTextQuery::IntTextQuery(string title, int * _target, std::string _description) : 58 73 Dialog::IntQuery(title,_target,_description) 59 74 {} -
molecuilder/src/UIElements/TextDialog.hpp
rc93262 rb918031 19 19 virtual ~TextDialog(); 20 20 21 virtual void queryEmpty(const char *, std::string = ""); 21 22 virtual void queryInt(const char *, int *, std::string = ""); 22 23 virtual void queryString(const char*, std::string *, std::string = ""); … … 28 29 protected: 29 30 // specialized stuff for text queries 31 class EmptyTextQuery : public Dialog::EmptyQuery { 32 public: 33 EmptyTextQuery(std::string title, std::string _description = NULL); 34 virtual ~EmptyTextQuery(); 35 virtual bool handle(); 36 }; 37 30 38 class IntTextQuery : public Dialog::IntQuery { 31 39 public:
Note:
See TracChangeset
for help on using the changeset viewer.
