///////////////////////////////////////////////////////////////////////////

// C++ code generated with wxFormBuilder (version Sep  8 2010)

// http://www.wxformbuilder.org/

//

// PLEASE DO "NOT" EDIT THIS FILE!

///////////////////////////////////////////////////////////////////////////



#include "LogbookDialog.h"
#include "Logbook.h"

#include <wx/string.h>
#include <wx/button.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statline.h>
#include <wx/grid.h>
#include "wx/generic/gridctrl.h"
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/textctrl.h>
#include <wx/html/htmlwin.h>
#include <wx/dialog.h>
#include <wx/splitter.h>

#include "wx/stdpaths.h"
#include "wx/fileconf.h"
#include <wx/image.h>
#include <wx/fs_inet.h>
#include "wx/grid.h"
#include <wx/msgdlg.h>
#include <wx/textctrl.h>
#include "wx/generic/gridctrl.h"
#include <wx/dir.h> 
#include <wx/filefn.h>
#include <wx/msgdlg.h> 
#include <wx/textfile.h>
#include <wx/tokenzr.h>
#include <wx/mimetype.h>

///////////////////////////////////////////////////////////////////////////



LogbookDialog::LogbookDialog(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )

{

	//logbook = l;



	this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );

	

	wxBoxSizer* bSizer2;

	bSizer2 = new wxBoxSizer( wxVERTICAL );

	

	m_logbook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );

	m_panel2 = new wxPanel( m_logbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxFlexGridSizer* fgSizer6;

	fgSizer6 = new wxFlexGridSizer( 2, 1, 0, 0 );

	fgSizer6->SetFlexibleDirection( wxBOTH );

	fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	wxBoxSizer* bSizer5;

	bSizer5 = new wxBoxSizer( wxVERTICAL );

	

	wxBoxSizer* bSizer6;

	bSizer6 = new wxBoxSizer( wxHORIZONTAL );

	

	m_button4 = new wxButton( m_panel2, wxID_ANY, wxT("logbook entry"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer6->Add( m_button4, 0, wxALL, 5 );

	

	logSaveCSV = new wxButton( m_panel2, wxID_ANY, wxT("SaveCSV"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer6->Add( logSaveCSV, 0, wxALL, 5 );

	

	m_staticline6 = new wxStaticLine( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL|wxLI_VERTICAL );

	bSizer6->Add( m_staticline6, 0, wxEXPAND | wxALL, 5 );

	

	wxArrayString logbookChoiceChoices;

	logbookChoice = new wxChoice( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, logbookChoiceChoices, 0 );

	logbookChoice->SetSelection( 0 );

	bSizer6->Add( logbookChoice, 0, wxALL, 5 );

	

	logSaveHTML = new wxButton( m_panel2, wxID_ANY, wxT("SaveHTML"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer6->Add( logSaveHTML, 0, wxALL, 5 );

	

	logView = new wxButton( m_panel2, wxID_ANY, wxT("View"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer6->Add( logView, 0, wxALL, 5 );

	

	m_staticline7 = new wxStaticLine( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );

	bSizer6->Add( m_staticline7, 0, wxEXPAND | wxALL, 5 );

	

	newLogbook = new wxButton( m_panel2, wxID_ANY, wxT("New Logbook"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer6->Add( newLogbook, 0, wxALL, 5 );

	

	selLogbook = new wxButton( m_panel2, wxID_ANY, wxT("Select Logbook"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer6->Add( selLogbook, 0, wxALL, 5 );

	

	bSizer5->Add( bSizer6, 1, wxEXPAND, 5 );

	

	fgSizer6->Add( bSizer5, 1, wxEXPAND, 5 );

	

	m_staticline1 = new wxStaticLine( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );

	fgSizer6->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );

	

	m_notebook8 = new wxNotebook( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	m_panel6 = new wxPanel( m_notebook8, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxFlexGridSizer* fgSizer9;

	fgSizer9 = new wxFlexGridSizer( 1, 1, 0, 0 );

	fgSizer9->AddGrowableCol( 0 );

	fgSizer9->AddGrowableRow( 0 );

	fgSizer9->SetFlexibleDirection( wxBOTH );

	fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	fgSizer9->SetMinSize( wxSize( -1,400 ) ); 

	m_gridGlobal = new wxGrid( m_panel6, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	

	// Grid

	m_gridGlobal->CreateGrid( 0, 13 );

	m_gridGlobal->EnableEditing( true );

	m_gridGlobal->EnableGridLines( true );

	m_gridGlobal->EnableDragGridSize( false );

	m_gridGlobal->SetMargins( 0, 0 );

	

	// Columns

	m_gridGlobal->SetColSize( 0, 144 );

	m_gridGlobal->SetColSize( 1, 68 );

	m_gridGlobal->SetColSize( 2, 63 );

	m_gridGlobal->SetColSize( 3, 34 );

	m_gridGlobal->SetColSize( 4, 157 );

	m_gridGlobal->SetColSize( 5, 58 );

	m_gridGlobal->SetColSize( 6, 106 );

	m_gridGlobal->SetColSize( 7, 43 );

	m_gridGlobal->SetColSize( 8, 47 );

	m_gridGlobal->SetColSize( 9, 43 );

	m_gridGlobal->SetColSize( 10, 50 );

	m_gridGlobal->SetColSize( 11, 80 );

	m_gridGlobal->SetColSize( 12, 168 );

	m_gridGlobal->EnableDragColMove( false );

	m_gridGlobal->EnableDragColSize( true );

	m_gridGlobal->SetColLabelSize( 30 );

	m_gridGlobal->SetColLabelValue( 0, wxT("Route") );

	m_gridGlobal->SetColLabelValue( 1, wxT("Date") );

	m_gridGlobal->SetColLabelValue( 2, wxT("Time") );

	m_gridGlobal->SetColLabelValue( 3, wxT("Sign") );

	m_gridGlobal->SetColLabelValue( 4, wxT("Wake") );

	m_gridGlobal->SetColLabelValue( 5, wxT("Distance") );

	m_gridGlobal->SetColLabelValue( 6, wxT("Position") );

	m_gridGlobal->SetColLabelValue( 7, wxT("COG") );

	m_gridGlobal->SetColLabelValue( 8, wxT("COW") );

	m_gridGlobal->SetColLabelValue( 9, wxT("SOG") );

	m_gridGlobal->SetColLabelValue( 10, wxT("SOW") );

	m_gridGlobal->SetColLabelValue( 11, wxT("Depth") );

	m_gridGlobal->SetColLabelValue( 12, wxT("Remarks") );

	m_gridGlobal->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Rows

	m_gridGlobal->AutoSizeRows();

	m_gridGlobal->EnableDragRowSize( true );

	m_gridGlobal->SetRowLabelSize( 30 );

	m_gridGlobal->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Label Appearance

	

	// Cell Defaults

	m_gridGlobal->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

	m_menu1 = new wxMenu();

	wxMenuItem* m_menuItem1;

	m_menuItem1 = new wxMenuItem( m_menu1, wxID_ANY, wxString( wxT("Delete Row") ) , wxEmptyString, wxITEM_NORMAL );

	m_menu1->Append( m_menuItem1 );

	

	m_gridGlobal->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( LogbookDialog::m_gridGlobalOnContextMenu ), NULL, this ); 

	

	fgSizer9->Add( m_gridGlobal, 1, wxALL|wxEXPAND, 5 );

	

	m_panel6->SetSizer( fgSizer9 );

	m_panel6->Layout();

	fgSizer9->Fit( m_panel6 );

	m_notebook8->AddPage( m_panel6, wxT("Globals"), true );

	m_panel7 = new wxPanel( m_notebook8, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxBoxSizer* bSizer11;

	bSizer11 = new wxBoxSizer( wxVERTICAL );

	

	m_gridWeather = new wxGrid( m_panel7, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	

	// Grid

	m_gridWeather->CreateGrid( 0, 13 );

	m_gridWeather->EnableEditing( true );

	m_gridWeather->EnableGridLines( true );

	m_gridWeather->EnableDragGridSize( false );

	m_gridWeather->SetMargins( 0, 0 );

	

	// Columns

	m_gridWeather->SetColSize( 0, 144 );

	m_gridWeather->SetColSize( 1, 68 );

	m_gridWeather->SetColSize( 2, 63 );

	m_gridWeather->SetColSize( 3, 66 );

	m_gridWeather->SetColSize( 4, 63 );

	m_gridWeather->SetColSize( 5, 76 );

	m_gridWeather->SetColSize( 6, 53 );

	m_gridWeather->SetColSize( 7, 70 );

	m_gridWeather->SetColSize( 8, 53 );

	m_gridWeather->SetColSize( 9, 43 );

	m_gridWeather->SetColSize( 10, 112 );

	m_gridWeather->SetColSize( 11, 129 );

	m_gridWeather->SetColSize( 12, 80 );

	m_gridWeather->EnableDragColMove( false );

	m_gridWeather->EnableDragColSize( true );

	m_gridWeather->SetColLabelSize( 30 );

	m_gridWeather->SetColLabelValue( 0, wxT("Route") );

	m_gridWeather->SetColLabelValue( 1, wxT("Date") );

	m_gridWeather->SetColLabelValue( 2, wxT("Time") );

	m_gridWeather->SetColLabelValue( 3, wxT("Barograph") );

	m_gridWeather->SetColLabelValue( 4, wxT("Wind") );

	m_gridWeather->SetColLabelValue( 5, wxT("W/Strength") );

	m_gridWeather->SetColLabelValue( 6, wxT("Current") );

	m_gridWeather->SetColLabelValue( 7, wxT("C/Strength") );

	m_gridWeather->SetColLabelValue( 8, wxT("Wave") );

	m_gridWeather->SetColLabelValue( 9, wxT("Swell") );

	m_gridWeather->SetColLabelValue( 10, wxT("Weather") );

	m_gridWeather->SetColLabelValue( 11, wxT("Clouds") );

	m_gridWeather->SetColLabelValue( 12, wxT("Visibility") );

	m_gridWeather->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Rows

	m_gridWeather->EnableDragRowSize( true );

	m_gridWeather->SetRowLabelSize( 30 );

	m_gridWeather->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Label Appearance

	

	// Cell Defaults

	m_gridWeather->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

	bSizer11->Add( m_gridWeather, 1, wxEXPAND|wxALL, 5 );

	

	m_panel7->SetSizer( bSizer11 );

	m_panel7->Layout();

	bSizer11->Fit( m_panel7 );

	m_notebook8->AddPage( m_panel7, wxT("Weather"), false );

	m_panel71 = new wxPanel( m_notebook8, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxBoxSizer* bSizer111;

	bSizer111 = new wxBoxSizer( wxVERTICAL );

	

	m_gridMotorSails = new wxGrid( m_panel71, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	

	// Grid

	m_gridMotorSails->CreateGrid( 0, 11 );

	m_gridMotorSails->EnableEditing( true );

	m_gridMotorSails->EnableGridLines( true );

	m_gridMotorSails->EnableDragGridSize( false );

	m_gridMotorSails->SetMargins( 0, 0 );

	

	// Columns

	m_gridMotorSails->SetColSize( 0, 144 );

	m_gridMotorSails->SetColSize( 1, 68 );

	m_gridMotorSails->SetColSize( 2, 63 );

	m_gridMotorSails->SetColSize( 3, 66 );

	m_gridMotorSails->SetColSize( 4, 63 );

	m_gridMotorSails->SetColSize( 5, 76 );

	m_gridMotorSails->SetColSize( 6, 107 );

	m_gridMotorSails->SetColSize( 7, 53 );

	m_gridMotorSails->SetColSize( 8, 64 );

	m_gridMotorSails->SetColSize( 9, 88 );

	m_gridMotorSails->SetColSize( 10, 244 );

	m_gridMotorSails->EnableDragColMove( false );

	m_gridMotorSails->EnableDragColSize( true );

	m_gridMotorSails->SetColLabelSize( 30 );

	m_gridMotorSails->SetColLabelValue( 0, wxT("Route") );

	m_gridMotorSails->SetColLabelValue( 1, wxT("Date") );

	m_gridMotorSails->SetColLabelValue( 2, wxT("Time") );

	m_gridMotorSails->SetColLabelValue( 3, wxT("Motor") );

	m_gridMotorSails->SetColLabelValue( 4, wxT("Fuel") );

	m_gridMotorSails->SetColLabelValue( 5, wxT("F/Total") );

	m_gridMotorSails->SetColLabelValue( 6, wxT("Sails") );

	m_gridMotorSails->SetColLabelValue( 7, wxT("Reef") );

	m_gridMotorSails->SetColLabelValue( 8, wxT("Water") );

	m_gridMotorSails->SetColLabelValue( 9, wxT("W/Total") );

	m_gridMotorSails->SetColLabelValue( 10, wxT("Remarks") );

	m_gridMotorSails->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Rows

	m_gridMotorSails->EnableDragRowSize( true );

	m_gridMotorSails->SetRowLabelSize( 30 );

	m_gridMotorSails->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Label Appearance

	

	// Cell Defaults

	m_gridMotorSails->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

	bSizer111->Add( m_gridMotorSails, 1, wxEXPAND|wxALL, 5 );

	

	m_panel71->SetSizer( bSizer111 );

	m_panel71->Layout();

	bSizer111->Fit( m_panel71 );

	m_notebook8->AddPage( m_panel71, wxT("Motor/Sails"), false );

	

	fgSizer6->Add( m_notebook8, 1, wxEXPAND | wxALL, 5 );

	

	m_panel2->SetSizer( fgSizer6 );

	m_panel2->Layout();

	fgSizer6->Fit( m_panel2 );

	m_logbook->AddPage( m_panel2, wxT("Logbook"), true );

	m_panel21 = new wxPanel( m_logbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxFlexGridSizer* fgSizer7;

	fgSizer7 = new wxFlexGridSizer( 3, 1, 0, 0 );

	fgSizer7->SetFlexibleDirection( wxBOTH );

	fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	wxBoxSizer* bSizer7;

	bSizer7 = new wxBoxSizer( wxVERTICAL );

	

	wxBoxSizer* bSizer3;

	bSizer3 = new wxBoxSizer( wxHORIZONTAL );

	

	crewAdd = new wxButton( m_panel21, wxID_ANY, wxT("Add Crew"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer3->Add( crewAdd, 0, wxALL, 5 );

	

	crewSaveCSV = new wxButton( m_panel21, wxID_ANY, wxT("Save CSV"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer3->Add( crewSaveCSV, 0, wxALL, 5 );

	

	m_staticline5 = new wxStaticLine( m_panel21, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL|wxLI_VERTICAL );

	bSizer3->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );

	

	wxArrayString crewChoiceChoices;

	crewChoice = new wxChoice( m_panel21, wxID_ANY, wxDefaultPosition, wxDefaultSize, crewChoiceChoices, 0 );

	crewChoice->SetSelection( 0 );

	bSizer3->Add( crewChoice, 0, wxALL, 5 );

	

	crewSaveHTML = new wxButton( m_panel21, wxID_ANY, wxT("Save HTML"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer3->Add( crewSaveHTML, 0, wxALL, 5 );

	

	crewView = new wxButton( m_panel21, wxID_ANY, wxT("View"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer3->Add( crewView, 0, wxALL, 5 );

	

	bSizer7->Add( bSizer3, 1, wxEXPAND, 5 );

	

	m_staticline2 = new wxStaticLine( m_panel21, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );

	bSizer7->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );

	

	fgSizer7->Add( bSizer7, 1, wxEXPAND, 5 );

	

	wxStaticBoxSizer* sbSizer1;

	sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_panel21, wxID_ANY, wxEmptyString ), wxVERTICAL );

	

	sbSizer1->SetMinSize( wxSize( -1,450 ) ); 

	m_gridCrew = new wxGrid( m_panel21, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	

	// Grid

	m_gridCrew->CreateGrid( 0, 11 );

	m_gridCrew->EnableEditing( true );

	m_gridCrew->EnableGridLines( true );

	m_gridCrew->EnableDragGridSize( false );

	m_gridCrew->SetMargins( 0, 0 );

	

	// Columns

	m_gridCrew->SetColSize( 0, 154 );

	m_gridCrew->SetColSize( 1, 116 );

	m_gridCrew->SetColSize( 2, 125 );

	m_gridCrew->SetColSize( 3, 50 );

	m_gridCrew->SetColSize( 4, 66 );

	m_gridCrew->SetColSize( 5, 97 );

	m_gridCrew->SetColSize( 6, 102 );

	m_gridCrew->SetColSize( 7, 80 );

	m_gridCrew->SetColSize( 8, 45 );

	m_gridCrew->SetColSize( 9, 180 );

	m_gridCrew->SetColSize( 10, 208 );

	m_gridCrew->EnableDragColMove( false );

	m_gridCrew->EnableDragColSize( true );

	m_gridCrew->SetColLabelSize( 30 );

	m_gridCrew->SetColLabelValue( 0, wxT("Name") );

	m_gridCrew->SetColLabelValue( 1, wxT("Birthname") );

	m_gridCrew->SetColLabelValue( 2, wxT("Firstname") );

	m_gridCrew->SetColLabelValue( 3, wxT("Title") );

	m_gridCrew->SetColLabelValue( 4, wxT("Birthdate") );

	m_gridCrew->SetColLabelValue( 5, wxT("Birthplace") );

	m_gridCrew->SetColLabelValue( 6, wxT("Nationality") );

	m_gridCrew->SetColLabelValue( 7, wxT("Passport-Nr") );

	m_gridCrew->SetColLabelValue( 8, wxT("Zip") );

	m_gridCrew->SetColLabelValue( 9, wxT("Town") );

	m_gridCrew->SetColLabelValue( 10, wxT("Street") );

	m_gridCrew->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Rows

	m_gridCrew->EnableDragRowSize( true );

	m_gridCrew->SetRowLabelSize( 30 );

	m_gridCrew->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Label Appearance

	

	// Cell Defaults

	m_gridCrew->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

	m_menu2 = new wxMenu();

	wxMenuItem* m_menuItem2;

	m_menuItem2 = new wxMenuItem( m_menu2, wxID_ANY, wxString( wxT("Delete Row") ) , wxEmptyString, wxITEM_NORMAL );

	m_menu2->Append( m_menuItem2 );

	

	

	sbSizer1->Add( m_gridCrew, 1, wxALL|wxEXPAND, 5 );

	

	m_gridCrewWake = new wxGrid( m_panel21, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	

	// Grid

	m_gridCrewWake->CreateGrid( 0, 4 );

	m_gridCrewWake->EnableEditing( true );

	m_gridCrewWake->EnableGridLines( true );

	m_gridCrewWake->EnableDragGridSize( false );

	m_gridCrewWake->SetMargins( 0, 0 );

	

	// Columns

	m_gridCrewWake->SetColSize( 0, 158 );

	m_gridCrewWake->SetColSize( 1, 157 );

	m_gridCrewWake->SetColSize( 2, 141 );

	m_gridCrewWake->SetColSize( 3, 131 );

	m_gridCrewWake->EnableDragColMove( false );

	m_gridCrewWake->EnableDragColSize( true );

	m_gridCrewWake->SetColLabelSize( 30 );

	m_gridCrewWake->SetColLabelValue( 0, wxT("Name") );

	m_gridCrewWake->SetColLabelValue( 1, wxT("Firstname") );

	m_gridCrewWake->SetColLabelValue( 2, wxT("Start Wake") );

	m_gridCrewWake->SetColLabelValue( 3, wxT("End Wake") );

	m_gridCrewWake->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Rows

	m_gridCrewWake->EnableDragRowSize( true );

	m_gridCrewWake->SetRowLabelSize( 30 );

	m_gridCrewWake->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Label Appearance

	

	// Cell Defaults

	m_gridCrewWake->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

	sbSizer1->Add( m_gridCrewWake, 1, wxALL|wxEXPAND, 5 );

	

	fgSizer7->Add( sbSizer1, 1, wxEXPAND, 5 );

	

	m_panel21->SetSizer( fgSizer7 );

	m_panel21->Layout();

	fgSizer7->Fit( m_panel21 );

	m_logbook->AddPage( m_panel21, wxT("Crewlist"), false );

	m_panel3 = new wxPanel( m_logbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxFlexGridSizer* fgSizer1;

	fgSizer1 = new wxFlexGridSizer( 1, 1, 0, 0 );

	fgSizer1->SetFlexibleDirection( wxBOTH );

	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	wxBoxSizer* bSizer9;

	bSizer9 = new wxBoxSizer( wxVERTICAL );

	

	wxBoxSizer* bSizer10;

	bSizer10 = new wxBoxSizer( wxHORIZONTAL );

	

	addEquipmentButton = new wxButton( m_panel3, wxID_ANY, wxT("Add Equipment"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer10->Add( addEquipmentButton, 0, wxALL, 5 );

	

	boatSaveCSV = new wxButton( m_panel3, wxID_ANY, wxT("Save CSV"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer10->Add( boatSaveCSV, 0, wxALL, 5 );

	

	m_staticline4 = new wxStaticLine( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL|wxLI_VERTICAL );

	bSizer10->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 );

	

	wxArrayString boatChoiceChoices;

	boatChoice = new wxChoice( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, boatChoiceChoices, 0 );

	boatChoice->SetSelection( 0 );

	bSizer10->Add( boatChoice, 0, wxALL, 5 );

	

	boatSaveHTML = new wxButton( m_panel3, wxID_ANY, wxT("Save HTML"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer10->Add( boatSaveHTML, 0, wxALL, 5 );

	

	boatView = new wxButton( m_panel3, wxID_ANY, wxT("View"), wxDefaultPosition, wxDefaultSize, 0 );

	bSizer10->Add( boatView, 0, wxALL, 5 );

	

	bSizer9->Add( bSizer10, 1, wxEXPAND, 5 );

	

	m_staticline3 = new wxStaticLine( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );

	bSizer9->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );

	

	fgSizer1->Add( bSizer9, 1, wxEXPAND, 5 );

	

	m_splitter1 = new wxSplitterWindow( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );

	m_splitter1->Connect( wxEVT_IDLE, wxIdleEventHandler( LogbookDialog::m_splitter1OnIdle ), NULL, this );

	m_splitter1->SetMinimumPaneSize( 15 );

	

	m_panel72 = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

	wxFlexGridSizer* fgSizer34;

	fgSizer34 = new wxFlexGridSizer( 3, 1, 0, 0 );

	fgSizer34->SetFlexibleDirection( wxBOTH );

	fgSizer34->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	wxStaticBoxSizer* sbSizer11;

	sbSizer11 = new wxStaticBoxSizer( new wxStaticBox( m_panel72, wxID_ANY, wxT("Boat") ), wxHORIZONTAL );

	

	wxFlexGridSizer* fgSizer38;

	fgSizer38 = new wxFlexGridSizer( 1, 12, 0, 0 );

	fgSizer38->SetFlexibleDirection( wxBOTH );

	fgSizer38->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	bname = new wxStaticText( m_panel72, wxID_ANY, wxT("Name"), wxDefaultPosition, wxDefaultSize, 0 );

	bname->Wrap( -1 );

	fgSizer38->Add( bname, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	boatName = new wxTextCtrl( m_panel72, 1, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), wxTE_PROCESS_ENTER );

	fgSizer38->Add( boatName, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	m_staticText114 = new wxStaticText( m_panel72, wxID_ANY, wxT("Homeport"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText114->Wrap( -1 );

	fgSizer38->Add( m_staticText114, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	homeport = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer38->Add( homeport, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	m_staticText115 = new wxStaticText( m_panel72, wxID_ANY, wxT("Callsign"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText115->Wrap( -1 );

	fgSizer38->Add( m_staticText115, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	callsign = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer38->Add( callsign, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	m_staticText116 = new wxStaticText( m_panel72, wxID_ANY, wxT("HIN-Nr."), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText116->Wrap( -1 );

	fgSizer38->Add( m_staticText116, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	mmsi = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer38->Add( mmsi, 0, wxALL, 5 );

	

	m_staticText117 = new wxStaticText( m_panel72, wxID_ANY, wxT("Sail-Nr."), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText117->Wrap( -1 );

	fgSizer38->Add( m_staticText117, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	sailno = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer38->Add( sailno, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	

	fgSizer38->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer38->Add( 0, 0, 1, wxEXPAND, 5 );

	

	m_staticText119 = new wxStaticText( m_panel72, wxID_ANY, wxT("Insurance"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText119->Wrap( -1 );

	fgSizer38->Add( m_staticText119, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	insurance = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );

	fgSizer38->Add( insurance, 0, wxALL, 5 );

	

	m_staticText118 = new wxStaticText( m_panel72, wxID_ANY, wxT("Registration"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText118->Wrap( -1 );

	fgSizer38->Add( m_staticText118, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	registration = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer38->Add( registration, 0, wxALL, 5 );

	

	m_staticText120 = new wxStaticText( m_panel72, wxID_ANY, wxT("Policy"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText120->Wrap( -1 );

	fgSizer38->Add( m_staticText120, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	policy = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer38->Add( policy, 0, wxALL, 5 );

	

	sbSizer11->Add( fgSizer38, 1, wxEXPAND, 5 );

	

	fgSizer34->Add( sbSizer11, 1, wxEXPAND, 5 );

	

	wxStaticBoxSizer* sbSizer6;

	sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( m_panel72, wxID_ANY, wxT("Owner") ), wxHORIZONTAL );

	

	wxFlexGridSizer* fgSizer39;

	fgSizer39 = new wxFlexGridSizer( 2, 10, 0, 0 );

	fgSizer39->SetFlexibleDirection( wxBOTH );

	fgSizer39->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	m_staticText90 = new wxStaticText( m_panel72, wxID_ANY, wxT("Name      "), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText90->Wrap( -1 );

	fgSizer39->Add( m_staticText90, 0, wxALL, 5 );

	

	ownerName = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );

	fgSizer39->Add( ownerName, 0, wxALL, 5 );

	

	m_staticText91 = new wxStaticText( m_panel72, wxID_ANY, wxT("Firstname"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText91->Wrap( -1 );

	fgSizer39->Add( m_staticText91, 0, wxALL, 5 );

	

	ownerFirstname = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer39->Add( ownerFirstname, 0, wxALL, 5 );

	

	m_staticText95 = new wxStaticText( m_panel72, wxID_ANY, wxT("Telephone"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText95->Wrap( -1 );

	fgSizer39->Add( m_staticText95, 0, wxALL, 5 );

	

	ownerPhone = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );

	fgSizer39->Add( ownerPhone, 0, wxALL, 5 );

	

	

	fgSizer39->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer39->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer39->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer39->Add( 0, 0, 1, wxEXPAND, 5 );

	

	m_staticText92 = new wxStaticText( m_panel72, wxID_ANY, wxT("Street"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText92->Wrap( -1 );

	fgSizer39->Add( m_staticText92, 0, wxALL, 5 );

	

	ownerStreet = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );

	fgSizer39->Add( ownerStreet, 0, wxALL, 5 );

	

	m_staticText93 = new wxStaticText( m_panel72, wxID_ANY, wxT("Zip"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText93->Wrap( -1 );

	fgSizer39->Add( m_staticText93, 0, wxALL, 5 );

	

	owenerZip = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer39->Add( owenerZip, 0, wxALL, 5 );

	

	m_staticText94 = new wxStaticText( m_panel72, wxID_ANY, wxT("Town"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText94->Wrap( -1 );

	fgSizer39->Add( m_staticText94, 0, wxALL, 5 );

	

	ownerTown = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );

	fgSizer39->Add( ownerTown, 0, wxALL, 5 );

	

	sbSizer6->Add( fgSizer39, 1, wxEXPAND, 5 );

	

	fgSizer34->Add( sbSizer6, 1, wxEXPAND, 5 );

	

	wxStaticBoxSizer* sbSizer8;

	sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( m_panel72, wxID_ANY, wxT("Details") ), wxVERTICAL );

	

	wxFlexGridSizer* fgSizer33;

	fgSizer33 = new wxFlexGridSizer( 1, 10, 0, 0 );

	fgSizer33->SetFlexibleDirection( wxBOTH );

	fgSizer33->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	

	m_staticText128 = new wxStaticText( m_panel72, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText128->Wrap( -1 );

	fgSizer33->Add( m_staticText128, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	boatType = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer33->Add( boatType, 0, wxALL, 5 );

	

	m_staticText125 = new wxStaticText( m_panel72, wxID_ANY, wxT("Builder"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText125->Wrap( -1 );

	fgSizer33->Add( m_staticText125, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	builder = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer33->Add( builder, 0, wxALL, 5 );

	

	m_staticText124 = new wxStaticText( m_panel72, wxID_ANY, wxT("Hull"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText124->Wrap( -1 );

	fgSizer33->Add( m_staticText124, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	hull = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer33->Add( hull, 0, wxALL, 5 );

	

	m_staticText126 = new wxStaticText( m_panel72, wxID_ANY, wxT("Date Launched"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText126->Wrap( -1 );

	fgSizer33->Add( m_staticText126, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	dateLaunched = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer33->Add( dateLaunched, 0, wxALL, 5 );

	

	m_staticText127 = new wxStaticText( m_panel72, wxID_ANY, wxT("Yard-Nr."), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText127->Wrap( -1 );

	fgSizer33->Add( m_staticText127, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	yardNr = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

	fgSizer33->Add( yardNr, 0, wxALL, 5 );

	

	m_staticText123 = new wxStaticText( m_panel72, wxID_ANY, wxT("Designer"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText123->Wrap( -1 );

	fgSizer33->Add( m_staticText123, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	designer = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer33->Add( designer, 0, wxALL, 5 );

	

	m_staticText129 = new wxStaticText( m_panel72, wxID_ANY, wxT("Construction"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText129->Wrap( -1 );

	fgSizer33->Add( m_staticText129, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	construction = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 150,-1 ), 0 );

	fgSizer33->Add( construction, 0, wxALL, 5 );

	

	

	fgSizer33->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer33->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer33->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer33->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer33->Add( 0, 0, 1, wxEXPAND, 5 );

	

	

	fgSizer33->Add( 0, 0, 1, wxEXPAND, 5 );

	

	m_staticText106 = new wxStaticText( m_panel72, wxID_ANY, wxT("LOA"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText106->Wrap( -1 );

	fgSizer33->Add( m_staticText106, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	LOA = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( LOA, 0, wxALL, 5 );

	

	m_staticText107 = new wxStaticText( m_panel72, wxID_ANY, wxT("LOD"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText107->Wrap( -1 );

	fgSizer33->Add( m_staticText107, 0, wxALL, 5 );

	

	LOD = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( LOD, 0, wxALL, 5 );

	

	m_staticText108 = new wxStaticText( m_panel72, wxID_ANY, wxT("LWL"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText108->Wrap( -1 );

	fgSizer33->Add( m_staticText108, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	LWL = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( LWL, 0, wxALL, 5 );

	

	m_staticText109 = new wxStaticText( m_panel72, wxID_ANY, wxT("Beam"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText109->Wrap( -1 );

	fgSizer33->Add( m_staticText109, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	beam = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( beam, 0, wxALL, 5 );

	

	m_staticText110 = new wxStaticText( m_panel72, wxID_ANY, wxT("Draft"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText110->Wrap( -1 );

	fgSizer33->Add( m_staticText110, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	draft = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( draft, 0, wxALL, 5 );

	

	m_staticText111 = new wxStaticText( m_panel72, wxID_ANY, wxT("GRT"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText111->Wrap( -1 );

	fgSizer33->Add( m_staticText111, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	GRT = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( GRT, 0, wxALL, 5 );

	

	m_staticText113 = new wxStaticText( m_panel72, wxID_ANY, wxT("NRT"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText113->Wrap( -1 );

	fgSizer33->Add( m_staticText113, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	NRT = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( NRT, 0, wxALL, 5 );

	

	m_staticText121 = new wxStaticText( m_panel72, wxID_ANY, wxT("Thames"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText121->Wrap( -1 );

	fgSizer33->Add( m_staticText121, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	thames = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( thames, 0, wxALL, 5 );

	

	m_staticText122 = new wxStaticText( m_panel72, wxID_ANY, wxT("Displacement"), wxDefaultPosition, wxDefaultSize, 0 );

	m_staticText122->Wrap( -1 );

	fgSizer33->Add( m_staticText122, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	

	displacement = new wxTextCtrl( m_panel72, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80,-1 ), 0 );

	fgSizer33->Add( displacement, 0, wxALL, 5 );

	

	sbSizer8->Add( fgSizer33, 1, wxEXPAND, 5 );

	

	fgSizer34->Add( sbSizer8, 1, wxEXPAND, 5 );

	

	m_panel72->SetSizer( fgSizer34 );

	m_panel72->Layout();

	fgSizer34->Fit( m_panel72 );

	m_panel8 = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxTAB_TRAVERSAL );

	wxStaticBoxSizer* sbSizer12;

	sbSizer12 = new wxStaticBoxSizer( new wxStaticBox( m_panel8, wxID_ANY, wxT("Equipment") ), wxVERTICAL );

	

	sbSizer12->SetMinSize( wxSize( -1,100 ) ); 

	m_gridEquipment = new wxGrid( m_panel8, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	

	// Grid

	m_gridEquipment->CreateGrid( 0, 4 );

	m_gridEquipment->EnableEditing( true );

	m_gridEquipment->EnableGridLines( true );

	m_gridEquipment->EnableDragGridSize( false );

	m_gridEquipment->SetMargins( 0, 0 );

	

	// Columns

	m_gridEquipment->SetColSize( 0, 120 );

	m_gridEquipment->SetColSize( 1, 296 );

	m_gridEquipment->SetColSize( 2, 151 );

	m_gridEquipment->SetColSize( 3, 297 );

	m_gridEquipment->EnableDragColMove( false );

	m_gridEquipment->EnableDragColSize( true );

	m_gridEquipment->SetColLabelSize( 30 );

	m_gridEquipment->SetColLabelValue( 0, wxT("Type") );

	m_gridEquipment->SetColLabelValue( 1, wxT("Description") );

	m_gridEquipment->SetColLabelValue( 2, wxT("Serial-Nr.") );

	m_gridEquipment->SetColLabelValue( 3, wxT("Remarks") );

	m_gridEquipment->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Rows

	m_gridEquipment->EnableDragRowSize( true );

	m_gridEquipment->SetRowLabelSize( 30 );

	m_gridEquipment->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );

	

	// Label Appearance

	

	// Cell Defaults

	m_gridEquipment->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

	sbSizer12->Add( m_gridEquipment, 1, wxALL|wxEXPAND, 5 );

	

	m_panel8->SetSizer( sbSizer12 );

	m_panel8->Layout();

	sbSizer12->Fit( m_panel8 );

	m_splitter1->SplitHorizontally( m_panel72, m_panel8, 320 );

	fgSizer1->Add( m_splitter1, 1, wxEXPAND, 5 );

	

	m_panel3->SetSizer( fgSizer1 );

	m_panel3->Layout();

	fgSizer1->Fit( m_panel3 );

	m_logbook->AddPage( m_panel3, wxT("Boat"), false );

	

	bSizer2->Add( m_logbook, 1, wxEXPAND | wxALL, 5 );

	

	this->SetSizer( bSizer2 );

	this->Layout();

	

	this->Centre( wxBOTH );

	

	// Connect Events

//	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( LogbookDialog::LogbookDialogOnClose ) );

	this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( LogbookDialog::LogbookDialogOnInitDialog ) );

	m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::m_button4OnButtonClick ), NULL, this );

	logSaveCSV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::logSaveCSVOnButtonClick ), NULL, this );

	logSaveHTML->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::logSaveHTMLOnButtonClick ), NULL, this );

	logView->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::logViewOnButtonClick ), NULL, this );

	newLogbook->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::newLogbookOnButtonClick ), NULL, this );

	selLogbook->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::selLogbookOnButtonClick ), NULL, this );

	m_gridGlobal->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridCellRightClick ), NULL, this );

	m_gridGlobal->Connect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridCmdCellChange ), NULL, this );

	m_gridGlobal->Connect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridEditorShown ), NULL, this );

	m_gridGlobal->Connect( wxEVT_GRID_ROW_SIZE, wxGridSizeEventHandler( LogbookDialog::m_gridGlobalOnGridRowSize ), NULL, this );

	m_gridGlobal->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridSelectCell ), NULL, this );

	m_gridGlobal->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridGlobalOnKeyDown ), NULL, this );

	this->Connect( m_menuItem1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( LogbookDialog::m_menuItem1OnMenuSelection ) );

	m_gridWeather->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridWeatherOnGridCellRightClick ), NULL, this );

	m_gridWeather->Connect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridWeatherOnGridCmdCellChange ), NULL, this );

	m_gridWeather->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridWeatherOnGridSelectCell ), NULL, this );

	m_gridWeather->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridWeatherOnKeyDown ), NULL, this );

	m_gridMotorSails->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridMotorSailsOnGridCellRightClick ), NULL, this );

	m_gridMotorSails->Connect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridMotorSailsOnGridCmdCellChange ), NULL, this );

	m_gridMotorSails->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridMotorSailsOnGridSelectCell ), NULL, this );

	m_gridMotorSails->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridMotorSailsOnKeyDown ), NULL, this );

	crewAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewAddOnButtonClick ), NULL, this );

	crewSaveCSV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewSaveCSVOnButtonClick ), NULL, this );

	crewSaveHTML->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewSaveHTMLOnButtonClick ), NULL, this );

	crewView->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewViewOnButtonClick ), NULL, this );

	m_gridCrew->Connect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridCrewOnGridCellChange ), NULL, this );

	m_gridCrew->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridCrewOnGridCellRightClick ), NULL, this );

	this->Connect( m_menuItem2->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( LogbookDialog::m_menuItem2OnMenuSelection ) );

	m_gridCrewWake->Connect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridCrewWakeOnGridCellChange ), NULL, this );

	addEquipmentButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boataddEquipmentButtonOnButtonClick ), NULL, this );

	boatSaveCSV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boatSaveCSVOnButtonClick ), NULL, this );

	boatSaveHTML->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boatSaveHTMLOnButtonClick ), NULL, this );

	boatView->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boatViewOnButtonClick ), NULL, this );

	boatName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( LogbookDialog::boatNameOnText ), NULL, this );

	boatName->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( LogbookDialog::boatNameOnTextEnter ), NULL, this );

	m_gridEquipment->Connect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridEquipmentOnGridCellChange ), NULL, this );

	m_gridEquipment->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridEquipmentOnGridCellRightClick ), NULL, this );

	m_gridEquipment->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridEquipmentOnKeyDown ), NULL, this );



	m_gridGlobal->Connect( ::wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler( LogbookDialog::gridGlobalScrolled ), NULL, this );

	m_gridWeather->Connect( ::wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler( LogbookDialog::gridWeatherScrolled ), NULL, this );

	m_gridMotorSails->Connect( ::wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler( LogbookDialog::gridMotorSailsScrolled ), NULL, this );

}



LogbookDialog::~LogbookDialog()

{

	// Disconnect Events

//	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( LogbookDialog::LogbookDialogOnClose ) );

	this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( LogbookDialog::LogbookDialogOnInitDialog ) );

	m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::m_button4OnButtonClick ), NULL, this );

	logSaveCSV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::logSaveCSVOnButtonClick ), NULL, this );

	logSaveHTML->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::logSaveHTMLOnButtonClick ), NULL, this );

	logView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::logViewOnButtonClick ), NULL, this );

	newLogbook->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::newLogbookOnButtonClick ), NULL, this );

	selLogbook->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::selLogbookOnButtonClick ), NULL, this );

	m_gridGlobal->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridCellRightClick ), NULL, this );

	m_gridGlobal->Disconnect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridCmdCellChange ), NULL, this );

	m_gridGlobal->Disconnect( wxEVT_GRID_EDITOR_SHOWN, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridEditorShown ), NULL, this );

	m_gridGlobal->Disconnect( wxEVT_GRID_ROW_SIZE, wxGridSizeEventHandler( LogbookDialog::m_gridGlobalOnGridRowSize ), NULL, this );

	m_gridGlobal->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridSelectCell ), NULL, this );

	m_gridGlobal->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridGlobalOnKeyDown ), NULL, this );

	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( LogbookDialog::m_menuItem1OnMenuSelection ) );

	m_gridWeather->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridWeatherOnGridCellRightClick ), NULL, this );

	m_gridWeather->Disconnect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridWeatherOnGridCmdCellChange ), NULL, this );

	m_gridWeather->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridWeatherOnGridSelectCell ), NULL, this );

	m_gridWeather->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridWeatherOnKeyDown ), NULL, this );

	m_gridMotorSails->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridMotorSailsOnGridCellRightClick ), NULL, this );

	m_gridMotorSails->Disconnect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridMotorSailsOnGridCmdCellChange ), NULL, this );

	m_gridMotorSails->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridMotorSailsOnGridSelectCell ), NULL, this );

	m_gridMotorSails->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridMotorSailsOnKeyDown ), NULL, this );

	crewAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewAddOnButtonClick ), NULL, this );

	crewSaveCSV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewSaveCSVOnButtonClick ), NULL, this );

	crewSaveHTML->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewSaveHTMLOnButtonClick ), NULL, this );

	crewView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::crewViewOnButtonClick ), NULL, this );

	m_gridCrew->Disconnect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridCrewOnGridCellChange ), NULL, this );

	m_gridCrew->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridCrewOnGridCellRightClick ), NULL, this );

	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( LogbookDialog::m_menuItem2OnMenuSelection ) );

	m_gridCrewWake->Disconnect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridCrewWakeOnGridCellChange ), NULL, this );

	addEquipmentButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boataddEquipmentButtonOnButtonClick ), NULL, this );

	boatSaveCSV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boatSaveCSVOnButtonClick ), NULL, this );

	boatSaveHTML->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boatSaveHTMLOnButtonClick ), NULL, this );

	boatView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogbookDialog::boatViewOnButtonClick ), NULL, this );

	boatName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( LogbookDialog::boatNameOnText ), NULL, this );

	boatName->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( LogbookDialog::boatNameOnTextEnter ), NULL, this );

	m_gridEquipment->Disconnect( wxEVT_GRID_CELL_CHANGE, wxGridEventHandler( LogbookDialog::m_gridEquipmentOnGridCellChange ), NULL, this );

	m_gridEquipment->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( LogbookDialog::m_gridEquipmentOnGridCellRightClick ), NULL, this );

	m_gridEquipment->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( LogbookDialog::m_gridEquipmentOnKeyDown ), NULL, this );

	

	delete m_menu1; 

	delete m_menu2;  

}



void LogbookDialog::m_gridGlobalOnKeyDown( wxKeyEvent& ev )

{

	if (ev.ShiftDown() && ev.GetKeyCode() == WXK_RETURN)

	{	

		if(ev.GetEventObject()->IsKindOf(CLASSINFO(wxTextCtrl)))	

			((wxTextCtrl*)ev.GetEventObject())->WriteText( wxT("\n") );

	}

    else 

	{

		logbook->setEqualRowHeight(selGridRow);

/*	  int max = 0;

      for(int i = 0; i < LOGGRIDS; i++)

      {

		  logGrids[i]->AutoSizeRow(this->selGridRow);

		  if( logGrids[i]->GetRowHeight(this->selGridRow) > max)

			  max = logGrids[i]->GetRowHeight(this->selGridRow);

      }

      for(int i = 0; i < LOGGRIDS; i++)

      {

		 logGrids[i]->SetRowHeight(this->selGridRow,max);

		 logGrids[i]->Refresh();

      }	  

	  */

      ev.Skip () ;

	}

}



void LogbookDialog::gridGlobalScrolled( wxScrollWinEvent& ev )

{

	m_gridWeather->HandleOnScroll(ev);

	m_gridMotorSails->HandleOnScroll(ev);

}



void LogbookDialog::gridWeatherScrolled( wxScrollWinEvent& ev )

{

	m_gridGlobal->HandleOnScroll(ev);

	m_gridMotorSails->HandleOnScroll(ev);

}



void LogbookDialog::gridMotorSailsScrolled( wxScrollWinEvent& ev )

{

	m_gridWeather->HandleOnScroll(ev);

	m_gridGlobal->HandleOnScroll(ev);

}



void LogbookDialog::m_gridMotorSailsOnKeyDown( wxKeyEvent& ev )

{

	m_gridGlobalOnKeyDown( ev );

}



void LogbookDialog::m_gridWeatherOnKeyDown( wxKeyEvent& ev )

{

	m_gridGlobalOnKeyDown( ev );

}



void LogbookDialog::newLogbookOnButtonClick( wxCommandEvent& ev )

{

	logbook->newLogbook();

}



void LogbookDialog::selLogbookOnButtonClick( wxCommandEvent& ev )

{

	logbook->selectLogbook();

}





void LogbookDialog::m_gridGlobalOnGridEditorShown( wxGridEvent& event )

{



}



void LogbookDialog::m_gridGlobalOnGridSelectCell( wxGridEvent& ev )

{

	gridGlobalCol = ev.GetCol();

	selGridRow = ev.GetRow();



	m_gridWeather->MakeCellVisible(ev.GetRow(),ev.GetCol());

	m_gridMotorSails->MakeCellVisible(ev.GetRow(),ev.GetCol());



	ev.Skip();

}



void LogbookDialog::m_gridMotorSailsOnGridSelectCell( wxGridEvent& ev )

{

	gridMotorSailsCol = ev.GetCol();

	selGridRow = ev.GetRow();



	m_gridWeather->MakeCellVisible(ev.GetRow(),ev.GetCol());

	m_gridGlobal->MakeCellVisible(ev.GetRow(),ev.GetCol());



	ev.Skip();

}



void LogbookDialog::m_gridWeatherOnGridSelectCell( wxGridEvent& ev )

{

	gridWeatherCol = ev.GetCol();

	selGridRow = ev.GetRow();



	m_gridGlobal->MakeCellVisible(ev.GetRow(),ev.GetCol());

	m_gridMotorSails->MakeCellVisible(ev.GetRow(),ev.GetCol());



	ev.Skip();

}



void LogbookDialog::LogbookDialogOnInitDialog( wxInitDialogEvent& e )

{

	numPages = 0;

	totalColumns = 0;

	//   m_gridGlobal->SetDefaultRenderer(new wxGridCellAutoWrapStringRenderer);

	//	wxGridCellAutoWrapStringEditor ed = new wxGridCellAutoWrapStringEditor;ed.GetControl()->geti

	//wxGridCellAutoWrapStringEditor::conn( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( LogbookDialog::m_gridGlobalOnGridSelectCell ), NULL, this );



	logGrids[0] = m_gridGlobal;

	logGrids[1] = m_gridWeather;

	logGrids[2] = m_gridMotorSails;



	numPages = m_notebook8->GetPageCount();



	for(int i = 0; i < LOGGRIDS; i ++)

	{

		logGrids[i]->SetDefaultEditor(new wxGridCellAutoWrapStringEditor);

		totalColumns += logGrids[i]->GetNumberCols();

	}



	wxStandardPathsBase& std_path = wxStandardPathsBase::Get();

	//std_path.Get();



	pHome_Locn = new wxString();

	pHome_Locn->Append(std_path.GetUserConfigDir());// on w98, produces "/windows/Application Data"

	appendOSDirSlash(pHome_Locn) ;



if defined( __WXMAC__) || defined ( __WXMSW__ )

	pHome_Locn->Append(_T("opencpn"));

	appendOSDirSlash(pHome_Locn) ;

endif



	pHome_Locn->Append(_T("logbook"));

	appendOSDirSlash(pHome_Locn) ;

	if(!wxDir::Exists(*pHome_Locn))

		wxMkdir(*pHome_Locn);



	wxString t = *pHome_Locn;

	t.Append(_T("data"));

	appendOSDirSlash(&t) ;

	if(!wxDir::Exists(t))

		wxMkdir(t);

	t.Append(_T("crewlist.txt"));

	wxFileName wxHomeFiledir(t) ;

	if(true != wxHomeFiledir.FileExists())

	{

		crewListFile = new wxTextFile(t);				

		crewListFile->Create();

	}

	else

		crewListFile = new wxTextFile(t);



	t = *pHome_Locn;

	t.Append(_T("data"));

	appendOSDirSlash(&t);

	wxString data = t;

	t.Append(_T("logbook.txt"));

	wxHomeFiledir = t ;

	if(true != wxHomeFiledir.FileExists())

	{

		logbookFile = new wxTextFile(t);				

		logbookFile->Create();

	}

	else

		logbookFile = new wxTextFile(t);



	wxString lay = *pHome_Locn;

	lay.Append(_T("layout"));

	appendOSDirSlash(&lay);

	lay.Append(_T("logbook"));

	appendOSDirSlash(&lay);



	if(!wxDir::Exists(lay))

		wxMkdir(lay);



	logbook = new Logbook(this,data,lay);

	loadLayoutChoice(lay,logbookChoice);



	lay = *pHome_Locn;

	lay.Append(_T("layout"));

	appendOSDirSlash(&lay);

	lay.Append(_T("crew"));

	appendOSDirSlash(&lay);



	if(!wxDir::Exists(lay))

		wxMkdir(lay);



	crewList = new CrewList(this,data,lay);

	loadLayoutChoice(lay,crewChoice);



	boat=new Boat(this);

	loadLayoutChoice(lay,boatChoice);



	m_notebook8->SetSelection(0);

}



void LogbookDialog::m_menuItem1OnMenuSelection( wxCommandEvent& event )

{

	logbook->deleteRow(selGridRow);

}



void LogbookDialog::m_gridGlobalOnGridRowSize( wxGridSizeEvent& event )

{



}



void LogbookDialog::m_gridGlobalOnGridCellRightClick( wxGridEvent& ev )

{

	gridGlobalCol = ev.GetCol();

	selGridRow = ev.GetRow();

	m_gridGlobal->PopupMenu( m_menu1, ev.GetPosition() );

}



void LogbookDialog::m_gridWeatherOnGridCellRightClick( wxGridEvent& ev )

{

	gridWeatherCol = ev.GetCol();

	selGridRow = ev.GetRow();

	m_gridGlobalOnGridCellRightClick( ev );

}



void LogbookDialog::m_gridMotorSailsOnGridCellRightClick( wxGridEvent& ev )

{

	gridMotorSailsCol = ev.GetCol();

	selGridRow = ev.GetRow();

	m_gridGlobalOnGridCellRightClick( ev );

}



void LogbookDialog::m_gridGlobalOnGridCmdCellChange( wxGridEvent& ev )

{

	logbook->changeCellValue(ev.GetRow(),0);

}



void LogbookDialog::m_gridWeatherOnGridCmdCellChange( wxGridEvent& ev )

{

	logbook->changeCellValue(ev.GetRow(),0);

}



void LogbookDialog::m_gridMotorSailsOnGridCmdCellChange( wxGridEvent& ev )

{

	logbook->changeCellValue(ev.GetRow(),0);

}



void LogbookDialog::logSaveHTMLOnButtonClick( wxCommandEvent& ev )

{



	logbook->toHTML(logbookChoice->GetString(logbookChoice->GetSelection()),true);

}



void LogbookDialog::logSaveCSVOnButtonClick( wxCommandEvent& ev )

{

	logbook->toCSV();

}



void LogbookDialog::logViewOnButtonClick( wxCommandEvent& ev )

{

	logbook->viewHTML(logbookChoice->GetString(logbookChoice->GetSelection()),false);

}



void LogbookDialog::m_button4OnButtonClick( wxCommandEvent& event )

{

	logbook->appendRow();

}

/*

void LogbookDialog::LogbookDialogOnClose( wxCloseEvent& event )

{



}

*/



void LogbookDialog::writeToLogbook()

{



}



void LogbookDialog::loadLayoutChoice(wxString path, wxChoice* choice)

{

	wxArrayString files;

	int i = wxDir::GetAllFiles(path,&files);

	for(int n = 0; n < i; n++)

	{

		choice->Append(wxFileName(files[n]).GetName());

	}

	choice->SetSelection(0);



}



void LogbookDialog::appendOSDirSlash(wxString* pString)

{

	wxChar sep = wxFileName::GetPathSeparator();

	if (pString->Last() != sep)

		pString->Append(sep);

}



wxString LogbookDialog::replaceDangerChar(wxString s)

{

	s.Replace(wxT(","),wxT("�"));

	s.Replace(wxT("\n"),wxT("\\n"));

	s.Replace(wxT("\r"),wxT("\\r"));

	return s;

}



wxString LogbookDialog::restoreDangerChar(wxString s)

{

	s.Replace(wxT("�"),wxT(","));

	s.Replace(wxT("\\n"),wxT("\n"));

	s.Replace(wxT("\\r"),wxT("\r"));

	return s;

}



void LogbookDialog::startBrowser(wxString filename)

{

	wxMimeTypesManager mime_manager;

	filename.Replace(wxT("/"),wxT("\\"));

//	filename.Replace(wxT("txt"),wxT("html"));

	

	wxFileType *filetype = mime_manager.GetFileTypeFromExtension("html");

	wxString cmd = filetype->GetOpenCommand(wxT("file:///")+filename);

	if(cmd.Contains(wxT("IEXPLORE")))

		wxExecute(wxString::Format(wxT("explorer.exe ")+filename));

	else

		wxExecute(cmd);

}



//////////////////////////////////////////////////////////

//				CrewList Events

//////////////////////////////////////////////////////////



void LogbookDialog::crewAddOnButtonClick( wxCommandEvent& ev )

{

	m_gridCrew->AppendRows();

	m_gridCrew->SetRowHeight(m_gridCrew->GetNumberRows()-1,25);

	m_gridCrewWake->AppendRows();

	m_gridCrewWake->SetRowHeight(m_gridCrewWake->GetNumberRows()-1,25);

	crewList->addCrew(crewListFile,m_gridCrew,m_gridCrewWake);

}



void LogbookDialog::crewSaveHTMLOnButtonClick( wxCommandEvent& ev )

{

	crewList->saveHTML(crewListFile,

						crewChoice->GetString(crewChoice->GetSelection()),

						false);

}



void LogbookDialog::crewSaveCSVOnButtonClick( wxCommandEvent& ev )

{

	crewList->saveCSV(crewListFile);

}



void LogbookDialog::crewViewOnButtonClick( wxCommandEvent& ev )

{

	crewList->viewHTML(crewListFile,

						crewChoice->GetString(crewChoice->GetSelection()),

						false);

}



void LogbookDialog::m_gridCrewOnGridCellChange( wxGridEvent& ev )

{

	crewList->changeCrew(crewListFile, m_gridCrew,ev.GetRow(),ev.GetCol(),0);

}



void LogbookDialog::m_gridCrewWakeOnGridCellChange( wxGridEvent& ev )

{

	crewList->changeCrew(crewListFile, m_gridCrewWake,ev.GetRow(),ev.GetCol(),2);

}



void LogbookDialog::m_gridCrewOnGridCellRightClick( wxGridEvent& ev )

{

	m_gridCrew->PopupMenu( m_menu2, ev.GetPosition() );

	crewList->deleteRow(ev.GetRow(),crewListFile);

}



void LogbookDialog::m_menuItem2OnMenuSelection( wxCommandEvent& ev )

{



}





/////////////////////////////////////////////////////////////

//				Boat Events

/////////////////////////////////////////////////////////////



void LogbookDialog::boataddEquipmentButtonOnButtonClick( wxCommandEvent& ev )

{

	boat->addEquip();

}



void LogbookDialog::boatSaveHTMLOnButtonClick( wxCommandEvent& ev )

{

	boat->saveData();

	boat->toHTML(boatChoice->GetString(boatChoice->GetSelection()), true);

}



void LogbookDialog::boatSaveCSVOnButtonClick( wxCommandEvent& ev )

{

	boat->toCSV();

}



void LogbookDialog::boatViewOnButtonClick( wxCommandEvent& ev )

{

	boat->viewHTML(boatChoice->GetString(boatChoice->GetSelection()),false);

}



void LogbookDialog::m_gridEquipmentOnGridCellChange( wxGridEvent& ev )

{

	boat->cellChanged(ev.GetRow(),ev.GetCol());

}



void LogbookDialog::m_gridEquipmentOnGridCellRightClick( wxGridEvent& ev )

{



}



void LogbookDialog::boatNameOnText( wxCommandEvent& event )

{

	//wxTextCtrl * t = (wxTextCtrl)event.GetEventObject();

	

}



void LogbookDialog::boatNameOnTextEnter( wxCommandEvent& event )

{



}



void LogbookDialog::m_gridEquipmentOnKeyDown( wxKeyEvent& event )

{



}
