BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H 00006 #define BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H 00007 00008 #ifndef BALL_COMMON_GLOBAL_H 00009 # include <BALL/COMMON/global.h> 00010 #endif 00011 00012 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H 00013 # include <BALL/VIEW/KERNEL/modularWidget.h> 00014 #endif 00015 00016 #ifndef BALL_VIEW_KERNEL_COMMON_H 00017 # include <BALL/VIEW/KERNEL/common.h> 00018 #endif 00019 00020 class QMenu; 00021 00022 namespace BALL 00023 { 00024 class System; 00025 00026 namespace VIEW 00027 { 00028 00045 class BALL_VIEW_EXPORT MolecularFileDialog 00046 : public QWidget, 00047 public ModularWidget 00048 { 00049 Q_OBJECT 00050 public: 00051 BALL_EMBEDDABLE(MolecularFileDialog, ModularWidget) 00052 00053 00056 MolecularFileDialog(QWidget* parent = 0, const char* name = "MolecularFileDialog"); 00057 00059 virtual ~MolecularFileDialog(); 00060 00067 virtual void initializeWidget(MainControl& main_control); 00068 00074 virtual bool canHandle(const String& fileformat) const; 00075 00080 virtual bool openFile(const String& filename); 00081 00087 virtual System* openMolecularFile(const String& file); 00088 00093 virtual System* openMolecularFile(const String& filename, 00094 const String& filetype, 00095 const String& system_name); 00096 00097 00099 System* openPDBFile(); 00100 00102 System* openHINFile(); 00103 00105 System* openMOLFile(); 00106 00108 System* openMOL2File(); 00109 00111 System* openSDFile(); 00112 00114 System* openACFile(); 00115 00117 System* openXYZFile(); 00118 00121 System* readPDBFile(String filename, String system_name); 00122 00125 System* readHINFile(String filename, String system_name); 00126 00129 System* readMOLFile(String filename, String system_name); 00130 00133 System* readMOL2File(String filename, String system_name); 00134 00137 System* readSDFile(String filename, String system_name); 00138 00141 System* readACFile(String filename, String system_name); 00142 00145 System* readXYZFile(String filename, String system_name); 00146 00149 bool writePDBFile(String filename, const System& system); 00150 00153 bool writeHINFile(String filename, const System& system); 00154 00157 bool writeMOLFile(String filename, const System& system); 00158 00161 bool writeMOL2File(String filename, const System& system); 00162 00165 bool writeSDFile(String filename, const System& system); 00166 00169 bool writeACFile(String filename, const System& system); 00170 00173 bool writeXYZFile(String filename, const System& system); 00174 00176 virtual void checkMenu(MainControl& main_control); 00177 00179 virtual String getSupportedFileFormats() const; 00180 00182 virtual String getSupportedFileFormatsList() const; 00183 00184 void setReadPDBModels(bool read) { read_all_pdb_models_ = read; } 00185 00186 public slots: 00187 00195 virtual void readFiles(); 00196 00200 virtual bool writeFile(); 00201 00202 00203 protected: 00204 00205 virtual void onNotify(Message *message); 00206 00207 // Only for Python interface 00208 MolecularFileDialog(const MolecularFileDialog& mfd); 00209 00210 00211 virtual bool finish_(const String& filename, const String& system_name, System* system); 00212 00213 System* openFile_(String type); 00214 00215 enum FileFormats 00216 { 00217 PDB_FILE = 0, 00218 HIN_FILE, 00219 MOL_FILE, 00220 MOL2_FILE, 00221 SD_FILE, 00222 XYZ_FILE 00223 }; 00224 00225 QAction* save_id_, *open_id_; 00226 String file_format_; 00227 bool read_all_pdb_models_; 00228 }; 00229 00230 } // namespace VIEW 00231 } // namespace BALL 00232 00233 #endif // BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H