// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 

// Copyright 2003 Liam Girdwood  

#ifndef _VSKY_DRUID_HH
#  define _VSKY_DRUID_HH

#include <gtkmm/dialog.h>
#include <gtkmm/tooltips.h>
#include <gdk/gdkkeysyms.h>
#include <gtkmm/accelgroup.h>
#include <gtkmm/label.h>
#include <gtkmm/entry.h>
#include <gtkmm/box.h>
#include <libgnomeuimm/druid-page-standard.h>
#include <libgnomeuimm/druid-page-edge.h>
#include <libgnomeuimm/file-entry.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/treeview.h>
#include <gtkmm/combo.h>
#include <gtkmm/table.h>
#include <gtkmm/checkbutton.h>
#include <libgnomeuimm/dateedit.h>
#include <time.h>
#include <libgnomeuimm/druid.h>
#include "virtual_sky.hh"
#include <libnova/libnova.h>

namespace GUI
{
	
/*! \class VSkyDruid
* \brief Virtual Sky Druid
*
* The Virtual Sky druid is responsible for gathering user input
* to initailly set up a virtual sky view. It is selected from the
* file->new->virtual_sky menu.
*/
class VSkyDruid : public Gtk::Dialog
{  
	public:
		
		/*! \fn VSkyDruid();
		* \brief Constructor
		*/
		VSkyDruid();
	
		/*! \fn ~VSkyDruid();
		* \brief Destructor
		*/
		~VSkyDruid();
	
		/*! \fn void set_vsky(Vega::VirtualSky* sky);
		* \brief Set the virtual sky to create
		*/
		void set_vsky(Vega::VirtualSky* sky);
	
	private:
		// druid creation methods
		void create_page_start (void);
		void create_page_location (void);
		void create_page_date (void);
		void create_page_zone (void);
		void create_page_finish (void);
	
		void refresh_date();
	
		// top level widgets
		Gnome::UI::Druid* m_druid;
	
		// druid start page widgets
		Gnome::UI::DruidPageEdge* m_vsky_druidpagestart;
	
		// location druid page widgets
		Gtk::VBox *m_location_vbox;
		Gtk::Label *m_location_label;
		Gtk::Label *m_name_label;
		Gtk::Entry *m_name_entry;
		Gtk::HBox *m_name_hbox;
		Gtk::Label *m_position_label;
		Gtk::Adjustment *m_lat_deg_spinbutton_adj;
		Gtk::SpinButton *m_lat_deg_spinbutton;
		Gtk::Label *m_lat_label1;
		Gtk::Adjustment *m_lat_min_spinbutton_adj;
		Gtk::SpinButton *m_lat_min_spinbutton;
		Gtk::Label *m_lat_label2;
		Gtk::Adjustment *m_lat_sec_spinbutton_adj;
		Gtk::SpinButton *m_lat_sec_spinbutton;
		Gtk::HBox *m_lat_hbox;
		Gtk::Adjustment *m_long_deg_spinbutton_adj;
		Gtk::SpinButton *m_long_deg_spinbutton;
		Gtk::Label *m_long_label1;
		Gtk::Adjustment *m_long_min_spinbutton_adj;
		Gtk::SpinButton *m_long_min_spinbutton;
		Gtk::Label *m_long_label2;
		Gtk::Adjustment *m_long_sec_spinbutton_adj;
		Gtk::SpinButton *m_long_sec_spinbutton;
		Gtk::HBox *m_long_hbox;
		Gtk::Adjustment *m_elevation_spinbutton_adj;
		Gtk::SpinButton *m_elevation_spinbutton;
		Gtk::Label *m_latitude_label;
		Gtk::Label *m_longitude_label;
		Gtk::Label *m_elevation_label;
		Gtk::Table *m_position_table;
		Gtk::VBox* m_druid_location_vbox;
		Gnome::UI::DruidPageStandard* m_posn_druidpage;
		
		// druid date page widgets
		Gtk::VBox *m_date_time_vbox;
		Gtk::Label *m_date_time_label;
		Gtk::RadioButton *m_sys_date_radiobutton;
		Gtk::RadioButton *m_another_date_radiobutton;
		Gtk::Table *m_date_time_table ;
		Gtk::Adjustment *m_day_spinbutton_adj;
		Gtk::SpinButton *m_day_spinbutton;
		Gtk::Label *m_date_label1;
		Gtk::Adjustment *m_month_spinbutton_adj;
		Gtk::SpinButton *m_month_spinbutton;
		Gtk::Label *m_date_label2;
		Gtk::Adjustment *m_year_spinbutton_adj;
		Gtk::SpinButton *m_year_spinbutton;
		Gtk::HBox *m_date_hbox;
		Gtk::Adjustment *m_hours_spinbutton_adj;
		Gtk::SpinButton *m_hours_spinbutton;
		Gtk::Label *m_time_label1;
		Gtk::Adjustment *m_minutes_spinbutton_adj;
		Gtk::SpinButton *m_minutes_spinbutton;
		Gtk::Label *m_time_label2;
		Gtk::Adjustment *m_seconds_spinbutton_adj;
		Gtk::SpinButton *m_seconds_spinbutton;
		Gtk::HBox *m_time_hbox;
		Gtk::Label *m_date_label;
		Gtk::Label *m_time_label;
		Gtk::RadioButton *m_julian_day_radiobutton;
		Gtk::Label *m_julian_label;
		Gtk::Adjustment *m_julian_spinbutton_adj;
		Gtk::SpinButton *m_julian_spinbutton;
		Gtk::HBox *m_julian_hbox;
		Gnome::UI::DruidPageStandard* m_date_time_druidpage;
		
		// druid time zone page widgets
		Gtk::VBox *m_zone_vbox;
		Gtk::Label *m_zone_label;
		Gtk::RadioButton *m_sys_zone_radiobutton;
		Gtk::RadioButton *m_another_zone_radiobutton;
		Gtk::Label *m_timezone_label;
		Gtk::Combo *m_zone_combo;
		Gtk::HBox *m_zone_hbox;
		Gnome::UI::DruidPageStandard* m_timezone_druidpage;
		
		// finish page widgets
		Gnome::UI::DruidPageEdge* m_vsky_druidpagefinish;
		
		// signal handlers
        void on_name_entry_changed();
        void on_lat_deg_spinbutton_changed();
        void on_lat_min_spinbutton_changed();
        void on_lat_sec_spinbutton_changed();
        void on_long_deg_spinbutton_changed();
		void on_long_min_spinbutton_changed();
		void on_long_sec_spinbutton_changed();
        void on_elevation_spinbutton_changed();
		void on_sys_date_radiobutton_toggled();
        void on_another_date_radiobutton_toggled();
   		void on_year_spinbutton_changed();
        void on_month_spinbutton_changed();
        void on_day_spinbutton_changed();
        void on_hours_spinbutton_changed();
        void on_minutes_spinbutton_changed();
        void on_seconds_spinbutton_changed();
        void on_julian_day_radiobutton_toggled();
        void on_julian_spinbutton_changed();
		void on_sys_zone_radiobutton_toggled();
        void on_another_zone_radiobutton_toggled();
        void on_zone_combo_entry_changed();
        void on_vsky_druidpagefinish_finish(Gtk::Widget& druid);
        void on_vsky_druid_cancel();
        void on_vsky_druid_help();

		SigC::Connection m_julian_changed;
		SigC::Connection m_years_changed;
		SigC::Connection m_months_changed;
		SigC::Connection m_days_changed;
		SigC::Connection m_hours_changed;
		SigC::Connection m_minutes_changed;
		SigC::Connection m_seconds_changed;

		Vega::VirtualSky* m_vsky; 		/*!< Virtual Sky View */
		bool m_is_location_complete;	/*!< True if location page is complete */
		bool m_is_date_complete;		/*!< True if date page is complete */
		bool m_is_zone_complete;		/*!< True if zone page is complete */
		bool m_use_sys_date;			/*!< Use the system date */
		bool m_use_another_date;		/*!< Use another date */
		bool m_use_julian_date;			/*!< Use julian date */
		
		struct ln_dms m_long;			/*!< observer longitude */
		struct ln_dms m_lat;			/*!< observer latitude */
		double m_JD;					/*!< Julian day */
		struct ln_date m_date;			/*!< Observing date */
};

};

#endif


syntax highlighted by Code2HTML, v. 0.9.1