<commit_before>// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: mainframe.h,v 1.48 2003/09/07 21:56:20 oliver Exp $
//

#ifndef BALL_APPLICATIONS_MOLVIEW_MAINFRAME_H
#define BALL_APPLICATIONS_MOLVIEW_MAINFRAME_H

#ifndef BALL_VIEW_WIDGETS_LOGVIEW_H
#	include <BALL/VIEW/WIDGETS/logView.h>
#endif

#ifndef BALL_VIEW_KERNEL_MAINCONTROL_H
# include <BALL/VIEW/KERNEL/mainControl.h>
#endif

#ifndef BALL_VIEW_KERNEL_SERVER_H
# include <BALL/VIEW/KERNEL/server.h>
#endif

#ifndef BALL_VIEW_WIDGETS_SCENE_H
# include <BALL/VIEW/WIDGETS/scene.h>
#endif

#ifndef BALL_VIEW_DIALOGS_DISPLAYPROPERTIES_H
# include <BALL/VIEW/DIALOGS/displayProperties.h>
#endif

#ifndef BALL_VIEW_DIALOGS_LABELDIALOG_H
# include <BALL/VIEW/DIALOGS/labelDialog.h>
#endif

#ifndef BALL_VIEW_WIDGETS_MOLECULARCONTROL_H
# include <BALL/VIEW/WIDGETS/molecularControl.h>
#endif

#ifndef BALL_VIEW_WIDGETS_TRAJECTORY_CONTROL_H
# include <BALL/VIEW/WIDGETS/trajectoryControl.h>
#endif

#ifndef BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
# include <BALL/VIEW/WIDGETS/geometricControl.h>
#endif

#ifndef BALL_VIEW_WIDGETS_MOLECULARPROPERTIES_H
# include <BALL/VIEW/WIDGETS/molecularProperties.h>
#endif

#ifndef BALL_VIEW_RENDERING_POVRENDERER_H
# include <BALL/VIEW/RENDERING/POVRenderer.h>
#endif

#ifndef BALL_VIEW_DIALOGS_FDPBDIALOG_H
# include <BALL/VIEW/DIALOGS/FDPBDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_CONTOURSURFACEDIALOG_H
# include <BALL/VIEW/DIALOGS/contourSurfaceDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H
# include <BALL/VIEW/DIALOGS/molecularFileDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_AMBERMINIMIZATIONDIALOG_H
# include <BALL/VIEW/DIALOGS/amberMinimizationDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_MOLECULARDYNAMICSDIALOG_H
# include <BALL/VIEW/DIALOGS/molecularDynamicsDialog.h>
#endif

#include <qwidget.h>
#include <qsplitter.h>

class DockWidget
  : public QDockWindow,
		public BALL::VIEW::ModularWidget
{
  Q_OBJECT

  public:

  DockWidget(QWidget* parent, const char* title = 0, QWidget* guest = 0)
    : QDockWindow(QDockWindow::InDock, parent),
			ModularWidget()
  {
		if (title != 0) 
		{ 
			setCaption(title);
		}
		if (guest != 0)
		{
			QPoint p;
			guest->reparent(this, p, TRUE);
			setWidget(guest);
			setMinimumSize(20, 20);
			setCloseMode(QDockWindow::Always);
			setResizeEnabled(TRUE);

			ModularWidget* mod_wid = dynamic_cast<ModularWidget*>(guest);
			if (mod_wid != 0)
			{
				std::cout << "registering mod widget " << (title == 0 ? "''" : title) << std::endl;
				mod_wid->registerWidget(mod_wid);
			}
			else
			{
				std::cout << "no mod widget!" << std::endl;
			}
		}
	}

	virtual ~DockWidget() throw() {}
};

namespace BALL
{
	using namespace BALL::VIEW;
	class AmberFF;
	class SimulationThread;

	class Mainframe	
		: public BALL::VIEW::MainControl
	{
		Q_OBJECT

		public:
		BALL_EMBEDDABLE(Mainframe)

		/** This class is only intended for usage with multithreading.
				It notifies the Mainframe, that the thread for simulations has finished and can be deleted.
				This should only be used internaly.
		*/
		class SimulationThreadFinished: public QCustomEvent
		{
			public:
				SimulationThreadFinished()
					: QCustomEvent( 65431 ){}
		};

		class SimulationOutput: public QCustomEvent
		{
			public:
				SimulationOutput()
					: QCustomEvent( 65430 ){}

				void setMessage(const String& msg) {message_ = msg;}

				String getMessage() {return message_;}

			protected:
				String message_;
		};


		enum MenuKey
		{
			MENU__FILE_EXPORT_POVRAYFILE = 20000,
			
			MENU__BUILD_ASSIGN_CHARGES,
			MENU__BUILD_AMBER_ENERGY,
			MENU__BUILD_AMBER_MINIMIZATION,
			MENU__BUILD_AMBER_MDSIMULATION,
			MENU__BUILD_STOPSIMULATION,
			MENU__BUILD_PEPTIDE,
			MENU__BUILD_CALCULATE_HBONDS,

			MENU__DISPLAY_FULLSCREEN,
			MENU__DISPLAY_OPEN_SURFACE_DIALOG,

			MENU__HELP_ABOUT
		};


		Mainframe(QWidget* parent = 0, const char* name = 0);

		virtual ~Mainframe()
			throw();

		virtual void fetchPreferences(INIFile& inifile)
		throw();

		virtual void writePreferences(INIFile& inifile)
		throw();

		virtual void onNotify(Message *message)
		throw();
		
		bool stopedSimulation() { return stop_simulation_;}

		void printAmberResults(const AmberFF& amber)
			throw();
				
		public slots:
		// active the menu entries
		// (connected to aboutToShow())
		void checkMenuEntries();

		void exportPOVRay();

		// Build menu
		void assignCharges();
		void calculateAmberEnergy();
		void amberMinimization();
		void amberMDSimulation();
		void computeSurface();
		void buildPeptide();
		void calculateHBonds();
		void stopSimulation();

		void toggleFullScreen();
		// Help menu
		void about();

		virtual void customEvent( QCustomEvent * e );

		/** Open a file.
				Calls MolecularFileDialog::openFile
		*/
		void openFile(const String& file)
			throw();

		private:

		Scene*										scene_;
		MolecularControl*					control_;
		TrajectoryControl*				trajectory_control_;
		GeometricControl*					geometric_control_;
		DisplayProperties*    		display_properties_;
		AmberMinimizationDialog*	minimization_dialog_;
		MolecularDynamicsDialog*	md_dialog_;
		ContourSurfaceDialog* 		surface_dialog_;
		LabelDialog*	    				label_dialog_;
		MolecularProperties*  		molecular_properties_;
		MolecularFileDialog*  		file_dialog_;
		FDPBDialog*  							FDPB_dialog_;
		Server*   								server_;

		QSplitter*								hor_splitter_;
		QSplitter*								vert_splitter_;
		QSplitter*								vert_splitter2_;
		QSplitter*								vert_splitter3_;
		LogView*									logview_;
		SimulationThread* 				simulation_thread_;
		
		bool 											fullscreen_;
		bool 											stop_simulation_;
	};

}

#endif // BALL_APPLICATIONS_MOLVIEW_MAINFRAME_H
<commit_msg>moved DockWidget to its own file<commit_after>// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: mainframe.h,v 1.49 2003/09/08 16:49:46 amoll Exp $
//

#ifndef BALL_APPLICATIONS_MOLVIEW_MAINFRAME_H
#define BALL_APPLICATIONS_MOLVIEW_MAINFRAME_H

#ifndef BALL_VIEW_WIDGETS_LOGVIEW_H
#	include <BALL/VIEW/WIDGETS/logView.h>
#endif

#ifndef BALL_VIEW_KERNEL_MAINCONTROL_H
# include <BALL/VIEW/KERNEL/mainControl.h>
#endif

#ifndef BALL_VIEW_KERNEL_SERVER_H
# include <BALL/VIEW/KERNEL/server.h>
#endif

#ifndef BALL_VIEW_WIDGETS_SCENE_H
# include <BALL/VIEW/WIDGETS/scene.h>
#endif

#ifndef BALL_VIEW_DIALOGS_DISPLAYPROPERTIES_H
# include <BALL/VIEW/DIALOGS/displayProperties.h>
#endif

#ifndef BALL_VIEW_DIALOGS_LABELDIALOG_H
# include <BALL/VIEW/DIALOGS/labelDialog.h>
#endif

#ifndef BALL_VIEW_WIDGETS_MOLECULARCONTROL_H
# include <BALL/VIEW/WIDGETS/molecularControl.h>
#endif

#ifndef BALL_VIEW_WIDGETS_TRAJECTORY_CONTROL_H
# include <BALL/VIEW/WIDGETS/trajectoryControl.h>
#endif

#ifndef BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
# include <BALL/VIEW/WIDGETS/geometricControl.h>
#endif

#ifndef BALL_VIEW_WIDGETS_MOLECULARPROPERTIES_H
# include <BALL/VIEW/WIDGETS/molecularProperties.h>
#endif

#ifndef BALL_VIEW_RENDERING_POVRENDERER_H
# include <BALL/VIEW/RENDERING/POVRenderer.h>
#endif

#ifndef BALL_VIEW_DIALOGS_FDPBDIALOG_H
# include <BALL/VIEW/DIALOGS/FDPBDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_CONTOURSURFACEDIALOG_H
# include <BALL/VIEW/DIALOGS/contourSurfaceDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H
# include <BALL/VIEW/DIALOGS/molecularFileDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_AMBERMINIMIZATIONDIALOG_H
# include <BALL/VIEW/DIALOGS/amberMinimizationDialog.h>
#endif

#ifndef BALL_VIEW_DIALOGS_MOLECULARDYNAMICSDIALOG_H
# include <BALL/VIEW/DIALOGS/molecularDynamicsDialog.h>
#endif

#include <qwidget.h>
#include <qsplitter.h>

namespace BALL
{
	using namespace BALL::VIEW;
	class AmberFF;
	class SimulationThread;

	class Mainframe	
		: public BALL::VIEW::MainControl
	{
		Q_OBJECT

		public:
		BALL_EMBEDDABLE(Mainframe)

		/** This class is only intended for usage with multithreading.
				It notifies the Mainframe, that the thread for simulations has finished and can be deleted.
				This should only be used internaly.
		*/
		class SimulationThreadFinished: public QCustomEvent
		{
			public:
				SimulationThreadFinished()
					: QCustomEvent( 65431 ){}
		};

		class SimulationOutput: public QCustomEvent
		{
			public:
				SimulationOutput()
					: QCustomEvent( 65430 ){}

				void setMessage(const String& msg) {message_ = msg;}

				String getMessage() {return message_;}

			protected:
				String message_;
		};


		enum MenuKey
		{
			MENU__FILE_EXPORT_POVRAYFILE = 20000,
			
			MENU__BUILD_ASSIGN_CHARGES,
			MENU__BUILD_AMBER_ENERGY,
			MENU__BUILD_AMBER_MINIMIZATION,
			MENU__BUILD_AMBER_MDSIMULATION,
			MENU__BUILD_STOPSIMULATION,
			MENU__BUILD_PEPTIDE,
			MENU__BUILD_CALCULATE_HBONDS,

			MENU__DISPLAY_FULLSCREEN,
			MENU__DISPLAY_OPEN_SURFACE_DIALOG,

			MENU__HELP_ABOUT
		};


		Mainframe(QWidget* parent = 0, const char* name = 0);

		virtual ~Mainframe()
			throw();

		virtual void fetchPreferences(INIFile& inifile)
		throw();

		virtual void writePreferences(INIFile& inifile)
		throw();

		virtual void onNotify(Message *message)
		throw();
		
		bool stopedSimulation() { return stop_simulation_;}

		void printAmberResults(const AmberFF& amber)
			throw();
				
		public slots:
		// active the menu entries
		// (connected to aboutToShow())
		void checkMenuEntries();

		void exportPOVRay();

		// Build menu
		void assignCharges();
		void calculateAmberEnergy();
		void amberMinimization();
		void amberMDSimulation();
		void computeSurface();
		void buildPeptide();
		void calculateHBonds();
		void stopSimulation();

		void toggleFullScreen();
		// Help menu
		void about();

		virtual void customEvent( QCustomEvent * e );

		/** Open a file.
				Calls MolecularFileDialog::openFile
		*/
		void openFile(const String& file)
			throw();

		private:

		Scene*										scene_;
		MolecularControl*					control_;
		TrajectoryControl*				trajectory_control_;
		GeometricControl*					geometric_control_;
		DisplayProperties*    		display_properties_;
		AmberMinimizationDialog*	minimization_dialog_;
		MolecularDynamicsDialog*	md_dialog_;
		ContourSurfaceDialog* 		surface_dialog_;
		LabelDialog*	    				label_dialog_;
		MolecularProperties*  		molecular_properties_;
		MolecularFileDialog*  		file_dialog_;
		FDPBDialog*  							FDPB_dialog_;
		Server*   								server_;

		QSplitter*								hor_splitter_;
		QSplitter*								vert_splitter_;
		QSplitter*								vert_splitter2_;
		QSplitter*								vert_splitter3_;
		LogView*									logview_;
		SimulationThread* 				simulation_thread_;
		
		bool 											fullscreen_;
		bool 											stop_simulation_;
	};

}

#endif // BALL_APPLICATIONS_MOLVIEW_MAINFRAME_H

{'fraction_non_alphanumeric': 0.09260480452190296, 'fraction_numerical': 0.008101742816768724, 'mean_word_length': 4.329317269076305, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7306551', 'n_tokens_mistral': 4600, 'n_tokens_neox': 3922, 'n_words': 712}