コード例 #1
0
ファイル: Application.cpp プロジェクト: indaco/envyMyCar
CApplication::CApplication() : CMessageHandler(NULL) {
    //set the application
    SetApplication(this);
    //initialize SDL
    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        std::cerr << "Failed to Init SDL:" << SDL_GetError() << std::endl;
        exit(1);
    }
    //set up SDL_Quit to be called during exit
    atexit(SDL_Quit);
}
コード例 #2
0
ファイル: application.cpp プロジェクト: Mileslee/wxgis
bool wxGISApplication::CreateApp(void)
{
	CreateStatusBar();
	wxFrame::GetStatusBar()->SetStatusText(_("Ready"));

    if(!wxGISApplicationBase::CreateApp())
        return false;
    //load commandbars
	SerializeCommandBars();

	//load accelerators
    m_pGISAcceleratorTable = new wxGISAcceleratorTable(this);


    wxGISAppConfig oConfig = GetConfig();
	if(!oConfig.IsOk())
		return false;
    // create MenuBar
	wxXmlNode* pMenuBarNode = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/menubar")));

    m_pMenuBar = new wxGISMenuBar(wxMB_DOCKABLE, this, pMenuBarNode); //wxMB_DOCKABLE
    SetMenuBar(static_cast<wxMenuBar*>(m_pMenuBar));

	//mark menues from menu bar as enumGISTAMMenubar
	for(size_t i = 0; i < m_CommandBarArray.GetCount(); ++i)
		if(m_pMenuBar->IsMenuBarMenu(m_CommandBarArray[i]->GetName()))
			m_CommandBarArray[i]->SetType(enumGISCBMenubar);

    // min size for the frame itself isn't completely done.
    // see the end up wxAuiManager::Update() for the test
    // code. For now, just hard code a frame minimum size
    SetMinSize(wxSize(800,480));

	SerializeFramePos(false);
	SetAcceleratorTable(m_pGISAcceleratorTable->GetAcceleratorTable());
    SetApplication( this );

//    wxHtmlWindow *pHtmlText = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_DEFAULT_STYLE | wxBORDER_THEME);
//    pHtmlText->SetPage(wxT("<html><body><h1>Error</h1>Some error occurred :-H)</body></hmtl>"));
//    pHtmlText->Show(false);
//    RegisterChildWindow(pHtmlText->GetId());
//
//#ifdef __WXGTK__
// //   wxGISToolBarMenu* pToolBarMenu =  dynamic_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME));
//	//if(pToolBarMenu)
//	//    PushEventHandler(pToolBarMenu);
////	m_pMenuBar->PushEventHandler(this);
//#endif
    return true;
}
コード例 #3
0
int wxGISServerApp::OnExit()
{
    if(m_pServer)
        m_pServer->Exit();
    SetApplication(NULL);

#ifdef __WXMSW__
    wxSocketBase::Shutdown();
#endif

	SerializeLibs();

	GDALDestroyDriverManager();
	OGRCleanupAll();

	UnLoadLibs();

#ifdef wxUSE_SNGLINST_CHECKER
    wxDELETE( m_pChecker ); 
#endif

    return wxAppConsole::OnExit();//success == true ? EXIT_SUCCESS : EXIT_FAILURE;
}
コード例 #4
0
bool wxGISServerApp::OnInit()
{

#ifdef wxUSE_SNGLINST_CHECKER
    m_pChecker = new wxSingleInstanceChecker(wxT("wxgisserverapp"));
    if ( m_pChecker->IsAnotherRunning() )
    {
        wxLogError(_("Another program instance is already running, aborting."));

        wxDELETE( m_pChecker ); // OnExit() won't be called if we return false

        return false;
    }
#endif

    m_oConfig = GetConfig();
	if(!m_oConfig.IsOk())
		return false;

    //create application
    m_pServer = new wxGISServer();
    SetApplication(m_pServer);

	//setup loging
	wxString sLogDir = m_oConfig.GetLogDir();
    //if(!m_pServer->SetupLog(sLogDir))
    //    return;

	//setup locale
	wxString sLocale = m_oConfig.GetLocale();
	wxString sLocaleDir = m_oConfig.GetLocaleDir();
    if(!m_pServer->SetupLoc(sLocale, sLocaleDir))
        return false;

   	//setup sys
    wxString sSysDir = m_oConfig.GetSysDir();
    //if(!m_pServer->SetupSys(sSysDir))
    //    return;

   	//setup debug
	bool bDebugMode = m_oConfig.GetDebugMode();
    //m_pServer->SetDebugMode(bDebugMode);

    //some default GDAL
	wxString sGDALCacheMax = m_oConfig.Read(enumGISHKCU, wxString(wxT("wxGISCommon/GDAL/cachemax")), wxString(wxT("128")));
	CPLSetConfigOption( "GDAL_CACHEMAX", sGDALCacheMax.mb_str() );
    CPLSetConfigOption ( "LIBKML_USE_DOC.KML", "no" );
    //GDAL_MAX_DATASET_POOL_SIZE
    //OGR_ARC_STEPSIZE

	OGRRegisterAll();
	GDALAllRegister();

#ifdef __WXMSW__
	wxLogDebug(wxT("wxSocketBase::Initialize"));
    wxSocketBase::Initialize();
#endif

	//store values

	m_oConfig.SetLogDir(sLogDir);
	m_oConfig.SetLocale(sLocale);
	m_oConfig.SetLocaleDir(sLocaleDir);
	m_oConfig.SetSysDir(sSysDir);
	m_oConfig.SetDebugMode(bDebugMode);

	//gdal
	m_oConfig.Write(enumGISHKCU, wxString(wxT("wxGISCommon/GDAL/cachemax")), sGDALCacheMax);

    wxString sKey(wxT("wxGISCommon/libs"));
    //load libs
	wxXmlNode* pLibsNode = m_oConfig.GetConfigNode(enumGISHKCU, sKey);
	if(pLibsNode)
		LoadLibs(pLibsNode);
	pLibsNode = m_oConfig.GetConfigNode(enumGISHKLM, sKey);
	if(pLibsNode)
		LoadLibs(pLibsNode);

    //send interesting things to console
    return wxAppConsole::OnInit();
	//return true;
}
コード例 #5
0
ファイル: mainmenu.cpp プロジェクト: billfm/billfm
void miApplication(GtkObject *object, gpointer user_data)
{
	ClassString app=Panels[ActivePanel]->GetSelectedFile();
	ClassString filename=Panels[1-ActivePanel]->GetSelectedFile();
	if(SetApplication(app.s,filename.s)) SetApplication(filename.s,app.s);
}