<commit_before>//
// Name:	 frame.cpp
// Purpose:  The frame class for the wxEnviro application.
//
// Copyright (c) 2001-2004 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif

// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/image.h"

#ifdef UNIX
#include <unistd.h>
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "vtlib/vtlib.h"
#include "vtlib/core/Terrain.h"
#include "vtlib/core/TerrainScene.h"
#include "vtlib/core/NavEngines.h"
#include "vtlib/core/DynTerrain.h"
#include "vtlib/core/SkyDome.h"
#include "vtlib/core/Building3d.h"
#include "vtlib/core/Globe.h"
#include "vtlib/core/Contours.h"
#include "vtdata/vtLog.h"

#include "frame.h"
#include "StatusBar.h"

// dialogs
#include "SceneGraphDlg.h"
#include "PlantDlg.h"
#include "LinearStructDlg3d.h"
#include "UtilDlg.h"
#include "CameraDlg.h"
#include "LocationDlg.h"
#include "BuildingDlg3d.h"
#include "LayerDlg.h"
#include "vtui/InstanceDlg.h"
#include "vtui/DistanceDlg.h"
#include "TimeDlg.h"

#include "../Engines.h"
#include "../Options.h"
#include "EnviroGUI.h"	// for GetCurrentTerrain

#include "app.h"
#include "canvas.h"
#include "menu_id.h"
#include "StatusBar.h"

#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
#  include "axes.xpm"
#  include "camera.xpm"
#  include "distance.xpm"
#  include "faster.xpm"
#  include "fence.xpm"
#  include "instances.xpm"
#  include "layers.xpm"
#  include "loc.xpm"
#  include "maintain.xpm"
#  include "move.xpm"
#  include "nav.xpm"
#  include "nav_fast.xpm"
#  include "nav_set.xpm"
#  include "nav_slow.xpm"
#  include "navroute.xpm"
#  include "points.xpm"
#  include "route.xpm"
#  include "select.xpm"
#  include "sgraph.xpm"
#  include "snap.xpm"
#  include "snap_num.xpm"
#  include "space.xpm"
#  include "stop.xpm"
#  include "sun.xpm"
#  include "terrain.xpm"
#  include "tilt.xpm"
#  include "time.xpm"
#  include "tree.xpm"
#  include "unfold.xpm"
#endif

#if VTLIB_OSG
#include <osgDB/Registry>
#endif

DECLARE_APP(vtApp);

BEGIN_EVENT_TABLE(vtFrame, wxFrame)
EVT_CHAR(vtFrame::OnChar)
EVT_MENU(ID_FILE_LAYERS,		vtFrame::OnFileLayers)
EVT_MENU(wxID_EXIT, vtFrame::OnExit)
EVT_CLOSE(vtFrame::OnClose)
EVT_IDLE(vtFrame::OnIdle)

EVT_MENU(ID_TOOLS_SELECT,			vtFrame::OnToolsSelect)
EVT_UPDATE_UI(ID_TOOLS_SELECT,		vtFrame::OnUpdateToolsSelect)
EVT_MENU(ID_TOOLS_FENCES,			vtFrame::OnToolsFences)
EVT_UPDATE_UI(ID_TOOLS_FENCES,		vtFrame::OnUpdateToolsFences)
EVT_MENU(ID_TOOLS_ROUTES,			vtFrame::OnToolsRoutes)
EVT_UPDATE_UI(ID_TOOLS_ROUTES,		vtFrame::OnUpdateToolsRoutes)
EVT_MENU(ID_TOOLS_PLANTS,			vtFrame::OnToolsPlants)
EVT_UPDATE_UI(ID_TOOLS_PLANTS,		vtFrame::OnUpdateToolsPlants)
EVT_MENU(ID_TOOLS_INSTANCES,		vtFrame::OnToolsInstances)
EVT_UPDATE_UI(ID_TOOLS_INSTANCES,	vtFrame::OnUpdateToolsInstances)
//EVT_MENU(ID_TOOLS_MOVE,			vtFrame::OnToolsMove)
//EVT_UPDATE_UI(ID_TOOLS_MOVE,		vtFrame::OnUpdateToolsMove)
EVT_MENU(ID_TOOLS_NAVIGATE,			vtFrame::OnToolsNavigate)
EVT_UPDATE_UI(ID_TOOLS_NAVIGATE,	vtFrame::OnUpdateToolsNavigate)
EVT_MENU(ID_TOOLS_MEASURE,			vtFrame::OnToolsMeasure)
EVT_UPDATE_UI(ID_TOOLS_MEASURE,		vtFrame::OnUpdateToolsMeasure)

EVT_MENU(ID_VIEW_MAINTAIN,			vtFrame::OnViewMaintain)
EVT_UPDATE_UI(ID_VIEW_MAINTAIN,		vtFrame::OnUpdateViewMaintain)
EVT_MENU(ID_VIEW_WIREFRAME,			vtFrame::OnViewWireframe)
EVT_UPDATE_UI(ID_VIEW_WIREFRAME,	vtFrame::OnUpdateViewWireframe)
EVT_MENU(ID_VIEW_FULLSCREEN,		vtFrame::OnViewFullscreen)
EVT_UPDATE_UI(ID_VIEW_FULLSCREEN,	vtFrame::OnUpdateViewFullscreen)
EVT_MENU(ID_VIEW_TOPDOWN,			vtFrame::OnViewTopDown)
EVT_UPDATE_UI(ID_VIEW_TOPDOWN,		vtFrame::OnUpdateViewTopDown)
EVT_MENU(ID_VIEW_FRAMERATE,			vtFrame::OnViewFramerate)
EVT_UPDATE_UI(ID_VIEW_FRAMERATE,	vtFrame::OnUpdateViewFramerate)
EVT_MENU(ID_VIEW_ELEV_LEGEND,		vtFrame::OnViewElevLegend)
EVT_UPDATE_UI(ID_VIEW_ELEV_LEGEND,	vtFrame::OnUpdateViewElevLegend)
EVT_MENU(ID_VIEW_SETTINGS,			vtFrame::OnViewSettings)
EVT_MENU(ID_VIEW_FOLLOW_ROUTE,		vtFrame::OnViewFollowRoute)
EVT_UPDATE_UI(ID_VIEW_FOLLOW_ROUTE, vtFrame::OnUpdateViewFollowRoute)
EVT_MENU(ID_VIEW_LOCATIONS,			vtFrame::OnViewLocations)
EVT_UPDATE_UI(ID_VIEW_LOCATIONS,	vtFrame::OnUpdateViewLocations)
EVT_MENU(ID_VIEW_SNAPSHOT,			vtFrame::OnViewSnapshot)
EVT_MENU(ID_VIEW_SNAP_AGAIN,		vtFrame::OnViewSnapAgain)
EVT_MENU(ID_VIEW_STATUSBAR,			vtFrame::OnViewStatusBar)
EVT_UPDATE_UI(ID_VIEW_STATUSBAR,	vtFrame::OnUpdateViewStatusBar)

EVT_MENU(ID_VIEW_SLOWER,		vtFrame::OnViewSlower)
EVT_UPDATE_UI(ID_VIEW_SLOWER,	vtFrame::OnUpdateViewSlower)
EVT_MENU(ID_VIEW_FASTER,		vtFrame::OnViewFaster)
EVT_UPDATE_UI(ID_VIEW_FASTER,	vtFrame::OnUpdateViewFaster)
EVT_MENU(ID_NAV_NORMAL,			vtFrame::OnNavNormal)
EVT_UPDATE_UI(ID_NAV_NORMAL,	vtFrame::OnUpdateNavNormal)
EVT_MENU(ID_NAV_VELO,			vtFrame::OnNavVelo)
EVT_UPDATE_UI(ID_NAV_VELO,		vtFrame::OnUpdateNavVelo)
EVT_MENU(ID_NAV_GRAB_PIVOT,		vtFrame::OnNavGrabPivot)
EVT_UPDATE_UI(ID_NAV_GRAB_PIVOT,vtFrame::OnUpdateNavGrabPivot)
EVT_MENU(ID_NAV_PANO,			vtFrame::OnNavPano)
EVT_UPDATE_UI(ID_NAV_PANO,		vtFrame::OnUpdateNavPano)

EVT_MENU(ID_SCENE_SCENEGRAPH,	vtFrame::OnSceneGraph)
EVT_MENU(ID_SCENE_TERRAIN,		vtFrame::OnSceneTerrain)
EVT_UPDATE_UI(ID_SCENE_TERRAIN,	vtFrame::OnUpdateSceneTerrain)
EVT_MENU(ID_SCENE_SPACE,		vtFrame::OnSceneSpace)
EVT_UPDATE_UI(ID_SCENE_SPACE,	vtFrame::OnUpdateSceneSpace)
#if VTLIB_OSG
EVT_MENU(ID_SCENE_SAVE,			vtFrame::OnSceneSave)
#endif
EVT_MENU(ID_TIME_DIALOG,		vtFrame::OnTimeDialog)
EVT_MENU(ID_TIME_STOP,			vtFrame::OnTimeStop)
EVT_MENU(ID_TIME_FASTER,		vtFrame::OnTimeFaster)

EVT_UPDATE_UI(ID_TIME_DIALOG,	vtFrame::OnUpdateInOrbitOrTerrain)
EVT_UPDATE_UI(ID_TIME_STOP,		vtFrame::OnUpdateInOrbitOrTerrain)
EVT_UPDATE_UI(ID_TIME_FASTER,	vtFrame::OnUpdateInOrbitOrTerrain)

EVT_MENU(ID_TERRAIN_DYNAMIC,	vtFrame::OnDynamic)
EVT_MENU(ID_TERRAIN_CULLEVERY,	vtFrame::OnCullEvery)
EVT_MENU(ID_TERRAIN_CULLONCE,	vtFrame::OnCullOnce)
EVT_MENU(ID_TERRAIN_SKY,		vtFrame::OnSky)
EVT_MENU(ID_TERRAIN_OCEAN,		vtFrame::OnOcean)
EVT_MENU(ID_TERRAIN_PLANTS,		vtFrame::OnPlants)
EVT_MENU(ID_TERRAIN_STRUCTURES,	vtFrame::OnStructures)
EVT_MENU(ID_TERRAIN_ROADS,		vtFrame::OnRoads)
EVT_MENU(ID_TERRAIN_FOG,		vtFrame::OnFog)
EVT_MENU(ID_TERRAIN_INCREASE,	vtFrame::OnIncrease)
EVT_MENU(ID_TERRAIN_DECREASE,	vtFrame::OnDecrease)
EVT_MENU(ID_TERRAIN_SAVEVEG,	vtFrame::OnSaveVeg)
EVT_MENU(ID_TERRAIN_SAVESTRUCT,	vtFrame::OnSaveStruct)
EVT_MENU(ID_TERRAIN_FOUNDATIONS, vtFrame::OnToggleFoundations)
EVT_MENU(ID_TERRAIN_RESHADE,	vtFrame::OnTerrainReshade)

EVT_UPDATE_UI(ID_TERRAIN_DYNAMIC,	vtFrame::OnUpdateDynamic)
EVT_UPDATE_UI(ID_TERRAIN_CULLEVERY, vtFrame::OnUpdateCullEvery)
EVT_UPDATE_UI(ID_TERRAIN_SKY,		vtFrame::OnUpdateSky)
EVT_UPDATE_UI(ID_TERRAIN_OCEAN,		vtFrame::OnUpdateOcean)
EVT_UPDATE_UI(ID_TERRAIN_PLANTS,	vtFrame::OnUpdatePlants)
EVT_UPDATE_UI(ID_TERRAIN_STRUCTURES, vtFrame::OnUpdateStructures)
EVT_UPDATE_UI(ID_TERRAIN_ROADS,		vtFrame::OnUpdateRoads)
EVT_UPDATE_UI(ID_TERRAIN_FOG,		vtFrame::OnUpdateFog)
EVT_UPDATE_UI(ID_TERRAIN_FOUNDATIONS, vtFrame::OnUpdateFoundations)

EVT_MENU(ID_EARTH_SHOWSHADING,	vtFrame::OnEarthShowShading)
EVT_MENU(ID_EARTH_SHOWAXES,		vtFrame::OnEarthShowAxes)
EVT_MENU(ID_EARTH_TILT,			vtFrame::OnEarthTilt)
EVT_MENU(ID_EARTH_FLATTEN,		vtFrame::OnEarthFlatten)
EVT_MENU(ID_EARTH_UNFOLD,		vtFrame::OnEarthUnfold)
EVT_MENU(ID_EARTH_POINTS,		vtFrame::OnEarthPoints)

EVT_UPDATE_UI(ID_EARTH_SHOWSHADING, vtFrame::OnUpdateEarthShowShading)
EVT_UPDATE_UI(ID_EARTH_SHOWAXES, vtFrame::OnUpdateEarthShowAxes)
EVT_UPDATE_UI(ID_EARTH_TILT,	vtFrame::OnUpdateEarthTilt)
EVT_UPDATE_UI(ID_EARTH_FLATTEN, vtFrame::OnUpdateEarthFlatten)
EVT_UPDATE_UI(ID_EARTH_UNFOLD,	vtFrame::OnUpdateEarthUnfold)
EVT_UPDATE_UI(ID_EARTH_POINTS,	vtFrame::OnUpdateInOrbit)

EVT_MENU(ID_HELP_ABOUT, vtFrame::OnHelpAbout)

// Popup
EVT_MENU(ID_POPUP_PROPERTIES, vtFrame::OnPopupProperties)
EVT_MENU(ID_POPUP_FLIP, vtFrame::OnPopupFlip)
EVT_MENU(ID_POPUP_RELOAD, vtFrame::OnPopupReload)
EVT_MENU(ID_POPUP_DELETE, vtFrame::OnPopupDelete)
END_EVENT_TABLE()


//
// Frame constructor
//
vtFrame::vtFrame(wxFrame *parent, const wxString& title, const wxPoint& pos,
	const wxSize& size, long style, bool bVerticalToolbar, bool bEnableEarth):
		wxFrame(parent, -1, title, pos, size, style)
{
	m_bCloseOnIdle = false;

	// Give it an icon
	SetIcon(wxIcon(_T(ICON_NAME)));

	m_bCulleveryframe = true;
	m_bAlwaysMove = false;
	m_bFullscreen = false;
	m_bTopDown = false;
	m_ToggledMode = MM_SELECT;
	m_bEnableEarth = bEnableEarth;
	m_bEarthLines = false;

	m_pStatusBar = NULL;
	m_pToolbar = NULL;

	VTLOG("Frame window: creating menus and toolbars.\n");
	CreateMenus();
	CreateToolbar(bVerticalToolbar);	// argument: vertical

	// Create StatusBar
	m_pStatusBar = new MyStatusBar(this);
	SetStatusBar(m_pStatusBar);
	m_pStatusBar->Show();
	m_pStatusBar->UpdateText();
	PositionStatusBar();

	// We definitely want full color and a 24-bit Z-buffer!
	int gl_attrib[7] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER,
		WX_GL_BUFFER_SIZE, 24, WX_GL_DEPTH_SIZE, 24, 0	};

	VTLOG("Frame window: creating view canvas.\n");
	m_canvas = new vtGLCanvas(this, -1, wxPoint(0, 0), wxSize(-1, -1), 0,
			_T("vtGLCanvas"), gl_attrib);

	// Show the frame
	Show(true);

	m_pSceneGraphDlg = new SceneGraphDlg(this, -1, _("Scene Graph"),
			wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pSceneGraphDlg->SetSize(450, 600);

	m_pPlantDlg = new PlantDlg(this, -1, _("Plants"));
	m_pPlantDlg->ShowOnlyAvailableSpecies(g_Options.m_bOnlyAvailableSpecies);

	m_pFenceDlg = new LinearStructureDlg3d(this, -1, _("Linear Structures"));
	m_pUtilDlg = new UtilDlg(this, -1, _("Utility"));
	m_pCameraDlg = new CameraDlg(this, -1, _("Camera-View"));
	m_pLocationDlg = new LocationDlg(this, -1, _("Locations"),
			wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pBuildingDlg = new BuildingDlg3d(this, -1, _("Building Properties"));
	m_pLayerDlg = new LayerDlg(this, -1, _("Layers"), wxDefaultPosition,
		wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pLayerDlg->SetSize(600, 250);
	m_pInstanceDlg = new InstanceDlg(this, -1, _("Instances"), wxDefaultPosition,
		wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pDistanceDlg = new DistanceDlg(this, -1, _("Distance"));
	m_pTimeDlg = new TimeDlg(this, -1, _("Time"));

	m_canvas->SetCurrent();
}

vtFrame::~vtFrame()
{<commit_msg>rename Utility dialog to Routes to match menu items<commit_after>//
// Name:	 frame.cpp
// Purpose:  The frame class for the wxEnviro application.
//
// Copyright (c) 2001-2004 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif

// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/image.h"

#ifdef UNIX
#include <unistd.h>
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "vtlib/vtlib.h"
#include "vtlib/core/Terrain.h"
#include "vtlib/core/TerrainScene.h"
#include "vtlib/core/NavEngines.h"
#include "vtlib/core/DynTerrain.h"
#include "vtlib/core/SkyDome.h"
#include "vtlib/core/Building3d.h"
#include "vtlib/core/Globe.h"
#include "vtlib/core/Contours.h"
#include "vtdata/vtLog.h"

#include "frame.h"
#include "StatusBar.h"

// dialogs
#include "SceneGraphDlg.h"
#include "PlantDlg.h"
#include "LinearStructDlg3d.h"
#include "UtilDlg.h"
#include "CameraDlg.h"
#include "LocationDlg.h"
#include "BuildingDlg3d.h"
#include "LayerDlg.h"
#include "vtui/InstanceDlg.h"
#include "vtui/DistanceDlg.h"
#include "TimeDlg.h"

#include "../Engines.h"
#include "../Options.h"
#include "EnviroGUI.h"	// for GetCurrentTerrain

#include "app.h"
#include "canvas.h"
#include "menu_id.h"
#include "StatusBar.h"

#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
#  include "axes.xpm"
#  include "camera.xpm"
#  include "distance.xpm"
#  include "faster.xpm"
#  include "fence.xpm"
#  include "instances.xpm"
#  include "layers.xpm"
#  include "loc.xpm"
#  include "maintain.xpm"
#  include "move.xpm"
#  include "nav.xpm"
#  include "nav_fast.xpm"
#  include "nav_set.xpm"
#  include "nav_slow.xpm"
#  include "navroute.xpm"
#  include "points.xpm"
#  include "route.xpm"
#  include "select.xpm"
#  include "sgraph.xpm"
#  include "snap.xpm"
#  include "snap_num.xpm"
#  include "space.xpm"
#  include "stop.xpm"
#  include "sun.xpm"
#  include "terrain.xpm"
#  include "tilt.xpm"
#  include "time.xpm"
#  include "tree.xpm"
#  include "unfold.xpm"
#endif

#if VTLIB_OSG
#include <osgDB/Registry>
#endif

DECLARE_APP(vtApp);

BEGIN_EVENT_TABLE(vtFrame, wxFrame)
EVT_CHAR(vtFrame::OnChar)
EVT_MENU(ID_FILE_LAYERS,		vtFrame::OnFileLayers)
EVT_MENU(wxID_EXIT, vtFrame::OnExit)
EVT_CLOSE(vtFrame::OnClose)
EVT_IDLE(vtFrame::OnIdle)

EVT_MENU(ID_TOOLS_SELECT,			vtFrame::OnToolsSelect)
EVT_UPDATE_UI(ID_TOOLS_SELECT,		vtFrame::OnUpdateToolsSelect)
EVT_MENU(ID_TOOLS_FENCES,			vtFrame::OnToolsFences)
EVT_UPDATE_UI(ID_TOOLS_FENCES,		vtFrame::OnUpdateToolsFences)
EVT_MENU(ID_TOOLS_ROUTES,			vtFrame::OnToolsRoutes)
EVT_UPDATE_UI(ID_TOOLS_ROUTES,		vtFrame::OnUpdateToolsRoutes)
EVT_MENU(ID_TOOLS_PLANTS,			vtFrame::OnToolsPlants)
EVT_UPDATE_UI(ID_TOOLS_PLANTS,		vtFrame::OnUpdateToolsPlants)
EVT_MENU(ID_TOOLS_INSTANCES,		vtFrame::OnToolsInstances)
EVT_UPDATE_UI(ID_TOOLS_INSTANCES,	vtFrame::OnUpdateToolsInstances)
//EVT_MENU(ID_TOOLS_MOVE,			vtFrame::OnToolsMove)
//EVT_UPDATE_UI(ID_TOOLS_MOVE,		vtFrame::OnUpdateToolsMove)
EVT_MENU(ID_TOOLS_NAVIGATE,			vtFrame::OnToolsNavigate)
EVT_UPDATE_UI(ID_TOOLS_NAVIGATE,	vtFrame::OnUpdateToolsNavigate)
EVT_MENU(ID_TOOLS_MEASURE,			vtFrame::OnToolsMeasure)
EVT_UPDATE_UI(ID_TOOLS_MEASURE,		vtFrame::OnUpdateToolsMeasure)

EVT_MENU(ID_VIEW_MAINTAIN,			vtFrame::OnViewMaintain)
EVT_UPDATE_UI(ID_VIEW_MAINTAIN,		vtFrame::OnUpdateViewMaintain)
EVT_MENU(ID_VIEW_WIREFRAME,			vtFrame::OnViewWireframe)
EVT_UPDATE_UI(ID_VIEW_WIREFRAME,	vtFrame::OnUpdateViewWireframe)
EVT_MENU(ID_VIEW_FULLSCREEN,		vtFrame::OnViewFullscreen)
EVT_UPDATE_UI(ID_VIEW_FULLSCREEN,	vtFrame::OnUpdateViewFullscreen)
EVT_MENU(ID_VIEW_TOPDOWN,			vtFrame::OnViewTopDown)
EVT_UPDATE_UI(ID_VIEW_TOPDOWN,		vtFrame::OnUpdateViewTopDown)
EVT_MENU(ID_VIEW_FRAMERATE,			vtFrame::OnViewFramerate)
EVT_UPDATE_UI(ID_VIEW_FRAMERATE,	vtFrame::OnUpdateViewFramerate)
EVT_MENU(ID_VIEW_ELEV_LEGEND,		vtFrame::OnViewElevLegend)
EVT_UPDATE_UI(ID_VIEW_ELEV_LEGEND,	vtFrame::OnUpdateViewElevLegend)
EVT_MENU(ID_VIEW_SETTINGS,			vtFrame::OnViewSettings)
EVT_MENU(ID_VIEW_FOLLOW_ROUTE,		vtFrame::OnViewFollowRoute)
EVT_UPDATE_UI(ID_VIEW_FOLLOW_ROUTE, vtFrame::OnUpdateViewFollowRoute)
EVT_MENU(ID_VIEW_LOCATIONS,			vtFrame::OnViewLocations)
EVT_UPDATE_UI(ID_VIEW_LOCATIONS,	vtFrame::OnUpdateViewLocations)
EVT_MENU(ID_VIEW_SNAPSHOT,			vtFrame::OnViewSnapshot)
EVT_MENU(ID_VIEW_SNAP_AGAIN,		vtFrame::OnViewSnapAgain)
EVT_MENU(ID_VIEW_STATUSBAR,			vtFrame::OnViewStatusBar)
EVT_UPDATE_UI(ID_VIEW_STATUSBAR,	vtFrame::OnUpdateViewStatusBar)

EVT_MENU(ID_VIEW_SLOWER,		vtFrame::OnViewSlower)
EVT_UPDATE_UI(ID_VIEW_SLOWER,	vtFrame::OnUpdateViewSlower)
EVT_MENU(ID_VIEW_FASTER,		vtFrame::OnViewFaster)
EVT_UPDATE_UI(ID_VIEW_FASTER,	vtFrame::OnUpdateViewFaster)
EVT_MENU(ID_NAV_NORMAL,			vtFrame::OnNavNormal)
EVT_UPDATE_UI(ID_NAV_NORMAL,	vtFrame::OnUpdateNavNormal)
EVT_MENU(ID_NAV_VELO,			vtFrame::OnNavVelo)
EVT_UPDATE_UI(ID_NAV_VELO,		vtFrame::OnUpdateNavVelo)
EVT_MENU(ID_NAV_GRAB_PIVOT,		vtFrame::OnNavGrabPivot)
EVT_UPDATE_UI(ID_NAV_GRAB_PIVOT,vtFrame::OnUpdateNavGrabPivot)
EVT_MENU(ID_NAV_PANO,			vtFrame::OnNavPano)
EVT_UPDATE_UI(ID_NAV_PANO,		vtFrame::OnUpdateNavPano)

EVT_MENU(ID_SCENE_SCENEGRAPH,	vtFrame::OnSceneGraph)
EVT_MENU(ID_SCENE_TERRAIN,		vtFrame::OnSceneTerrain)
EVT_UPDATE_UI(ID_SCENE_TERRAIN,	vtFrame::OnUpdateSceneTerrain)
EVT_MENU(ID_SCENE_SPACE,		vtFrame::OnSceneSpace)
EVT_UPDATE_UI(ID_SCENE_SPACE,	vtFrame::OnUpdateSceneSpace)
#if VTLIB_OSG
EVT_MENU(ID_SCENE_SAVE,			vtFrame::OnSceneSave)
#endif
EVT_MENU(ID_TIME_DIALOG,		vtFrame::OnTimeDialog)
EVT_MENU(ID_TIME_STOP,			vtFrame::OnTimeStop)
EVT_MENU(ID_TIME_FASTER,		vtFrame::OnTimeFaster)

EVT_UPDATE_UI(ID_TIME_DIALOG,	vtFrame::OnUpdateInOrbitOrTerrain)
EVT_UPDATE_UI(ID_TIME_STOP,		vtFrame::OnUpdateInOrbitOrTerrain)
EVT_UPDATE_UI(ID_TIME_FASTER,	vtFrame::OnUpdateInOrbitOrTerrain)

EVT_MENU(ID_TERRAIN_DYNAMIC,	vtFrame::OnDynamic)
EVT_MENU(ID_TERRAIN_CULLEVERY,	vtFrame::OnCullEvery)
EVT_MENU(ID_TERRAIN_CULLONCE,	vtFrame::OnCullOnce)
EVT_MENU(ID_TERRAIN_SKY,		vtFrame::OnSky)
EVT_MENU(ID_TERRAIN_OCEAN,		vtFrame::OnOcean)
EVT_MENU(ID_TERRAIN_PLANTS,		vtFrame::OnPlants)
EVT_MENU(ID_TERRAIN_STRUCTURES,	vtFrame::OnStructures)
EVT_MENU(ID_TERRAIN_ROADS,		vtFrame::OnRoads)
EVT_MENU(ID_TERRAIN_FOG,		vtFrame::OnFog)
EVT_MENU(ID_TERRAIN_INCREASE,	vtFrame::OnIncrease)
EVT_MENU(ID_TERRAIN_DECREASE,	vtFrame::OnDecrease)
EVT_MENU(ID_TERRAIN_SAVEVEG,	vtFrame::OnSaveVeg)
EVT_MENU(ID_TERRAIN_SAVESTRUCT,	vtFrame::OnSaveStruct)
EVT_MENU(ID_TERRAIN_FOUNDATIONS, vtFrame::OnToggleFoundations)
EVT_MENU(ID_TERRAIN_RESHADE,	vtFrame::OnTerrainReshade)

EVT_UPDATE_UI(ID_TERRAIN_DYNAMIC,	vtFrame::OnUpdateDynamic)
EVT_UPDATE_UI(ID_TERRAIN_CULLEVERY, vtFrame::OnUpdateCullEvery)
EVT_UPDATE_UI(ID_TERRAIN_SKY,		vtFrame::OnUpdateSky)
EVT_UPDATE_UI(ID_TERRAIN_OCEAN,		vtFrame::OnUpdateOcean)
EVT_UPDATE_UI(ID_TERRAIN_PLANTS,	vtFrame::OnUpdatePlants)
EVT_UPDATE_UI(ID_TERRAIN_STRUCTURES, vtFrame::OnUpdateStructures)
EVT_UPDATE_UI(ID_TERRAIN_ROADS,		vtFrame::OnUpdateRoads)
EVT_UPDATE_UI(ID_TERRAIN_FOG,		vtFrame::OnUpdateFog)
EVT_UPDATE_UI(ID_TERRAIN_FOUNDATIONS, vtFrame::OnUpdateFoundations)

EVT_MENU(ID_EARTH_SHOWSHADING,	vtFrame::OnEarthShowShading)
EVT_MENU(ID_EARTH_SHOWAXES,		vtFrame::OnEarthShowAxes)
EVT_MENU(ID_EARTH_TILT,			vtFrame::OnEarthTilt)
EVT_MENU(ID_EARTH_FLATTEN,		vtFrame::OnEarthFlatten)
EVT_MENU(ID_EARTH_UNFOLD,		vtFrame::OnEarthUnfold)
EVT_MENU(ID_EARTH_POINTS,		vtFrame::OnEarthPoints)

EVT_UPDATE_UI(ID_EARTH_SHOWSHADING, vtFrame::OnUpdateEarthShowShading)
EVT_UPDATE_UI(ID_EARTH_SHOWAXES, vtFrame::OnUpdateEarthShowAxes)
EVT_UPDATE_UI(ID_EARTH_TILT,	vtFrame::OnUpdateEarthTilt)
EVT_UPDATE_UI(ID_EARTH_FLATTEN, vtFrame::OnUpdateEarthFlatten)
EVT_UPDATE_UI(ID_EARTH_UNFOLD,	vtFrame::OnUpdateEarthUnfold)
EVT_UPDATE_UI(ID_EARTH_POINTS,	vtFrame::OnUpdateInOrbit)

EVT_MENU(ID_HELP_ABOUT, vtFrame::OnHelpAbout)

// Popup
EVT_MENU(ID_POPUP_PROPERTIES, vtFrame::OnPopupProperties)
EVT_MENU(ID_POPUP_FLIP, vtFrame::OnPopupFlip)
EVT_MENU(ID_POPUP_RELOAD, vtFrame::OnPopupReload)
EVT_MENU(ID_POPUP_DELETE, vtFrame::OnPopupDelete)
END_EVENT_TABLE()


//
// Frame constructor
//
vtFrame::vtFrame(wxFrame *parent, const wxString& title, const wxPoint& pos,
	const wxSize& size, long style, bool bVerticalToolbar, bool bEnableEarth):
		wxFrame(parent, -1, title, pos, size, style)
{
	m_bCloseOnIdle = false;

	// Give it an icon
	SetIcon(wxIcon(_T(ICON_NAME)));

	m_bCulleveryframe = true;
	m_bAlwaysMove = false;
	m_bFullscreen = false;
	m_bTopDown = false;
	m_ToggledMode = MM_SELECT;
	m_bEnableEarth = bEnableEarth;
	m_bEarthLines = false;

	m_pStatusBar = NULL;
	m_pToolbar = NULL;

	VTLOG("Frame window: creating menus and toolbars.\n");
	CreateMenus();
	CreateToolbar(bVerticalToolbar);	// argument: vertical

	// Create StatusBar
	m_pStatusBar = new MyStatusBar(this);
	SetStatusBar(m_pStatusBar);
	m_pStatusBar->Show();
	m_pStatusBar->UpdateText();
	PositionStatusBar();

	// We definitely want full color and a 24-bit Z-buffer!
	int gl_attrib[7] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER,
		WX_GL_BUFFER_SIZE, 24, WX_GL_DEPTH_SIZE, 24, 0	};

	VTLOG("Frame window: creating view canvas.\n");
	m_canvas = new vtGLCanvas(this, -1, wxPoint(0, 0), wxSize(-1, -1), 0,
			_T("vtGLCanvas"), gl_attrib);

	// Show the frame
	Show(true);

	m_pSceneGraphDlg = new SceneGraphDlg(this, -1, _("Scene Graph"),
			wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pSceneGraphDlg->SetSize(450, 600);

	m_pPlantDlg = new PlantDlg(this, -1, _("Plants"));
	m_pPlantDlg->ShowOnlyAvailableSpecies(g_Options.m_bOnlyAvailableSpecies);

	m_pFenceDlg = new LinearStructureDlg3d(this, -1, _("Linear Structures"));
	m_pUtilDlg = new UtilDlg(this, -1, _("Routes"));
	m_pCameraDlg = new CameraDlg(this, -1, _("Camera-View"));
	m_pLocationDlg = new LocationDlg(this, -1, _("Locations"),
			wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pBuildingDlg = new BuildingDlg3d(this, -1, _("Building Properties"));
	m_pLayerDlg = new LayerDlg(this, -1, _("Layers"), wxDefaultPosition,
		wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pLayerDlg->SetSize(600, 250);
	m_pInstanceDlg = new InstanceDlg(this, -1, _("Instances"), wxDefaultPosition,
		wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
	m_pDistanceDlg = new DistanceDlg(this, -1, _("Distance"));
	m_pTimeDlg = new TimeDlg(this, -1, _("Time"));

	m_canvas->SetCurrent();
}

vtFrame::~vtFrame()
{
{'fraction_non_alphanumeric': 0.11547806202658283, 'fraction_numerical': 0.004859225382306703, 'mean_word_length': 8.944102321174798, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '1054701', 'n_tokens_mistral': 9600, 'n_tokens_neox': 9280, 'n_words': 1188}