Skip to content
Snippets Groups Projects
moldyn.h 1.49 KiB
Newer Older
  • Learn to ignore specific revisions
  • Tobias WEBER's avatar
    Tobias WEBER committed
     * atom dynamics
    
     * @author Tobias Weber <tweber@ill.fr>
     * @date Dec-2019
     * @license GPLv3, see 'LICENSE' file
     */
    
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #ifndef __MOLDYN_GUI_H__
    #define __MOLDYN_GUI_H__
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #include <QtWidgets/QMainWindow>
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #include <QtWidgets/QMenu>
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #include <QtWidgets/QMenuBar>
    #include <QtWidgets/QStatusBar>
    
    #include <QtWidgets/QSlider>
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #include <QtCore/QSettings>
    
    
    #include <vector>
    
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #include "libs/_cxx20/glplot.h"
    #include "libs/_cxx20/math_algos.h"
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    #include "moldyn-loader.h"
    
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    using t_real = double;
    using t_vec = std::vector<t_real>;
    using t_mat = m::mat<t_real, std::vector>;
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    class MolDynDlg : public QMainWindow
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    public:
    	MolDynDlg(QWidget* pParent = nullptr);
    	~MolDynDlg() = default;
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    protected:
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	MolDyn<t_real, t_vec> m_mol;
    
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	QSettings *m_sett = nullptr;
    	QMenuBar *m_menu = nullptr;
    	QStatusBar *m_status = nullptr;
    
    	QSlider *m_slider = nullptr;
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	GlPlot *m_plot = nullptr;
    	std::size_t m_sphere = 0;
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    protected:
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	void Add3DItem(const t_vec& vec, const t_vec& col, t_real scale, const std::string& label);
    	void SetStatusMsg(const std::string& msg);
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	void New();
    	void Load();
    	void Save();
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	void PlotMouseDown(bool left, bool mid, bool right);
    	void PlotMouseUp(bool left, bool mid, bool right);
    	void PickerIntersection(const t_vec3_gl* pos, std::size_t objIdx, const t_vec3_gl* posSphere);
    	void AfterGLInitialisation();
    
    	void SliderValueChanged(int val);
    
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	virtual void closeEvent(QCloseEvent *evt) override;
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    private:
    	long m_curPickedObj = -1;
    	bool m_ignoreChanges = 1;
    
    Tobias WEBER's avatar
    Tobias WEBER committed
    	bool m_ignoreCalc = 1;