コード例 #1
0
ファイル: main.cpp プロジェクト: renemilk/springlobby
bool Springsettings::OnInit()
{
	wxSetEnv( _T("UBUNTU_MENUPROXY"), _T("0") );
    //this triggers the Cli Parser amongst other stuff
    if (!wxApp::OnInit())
        return false;

	SetAppName(_T("SpringSettings"));
	const wxString configdir = TowxString(SlPaths::GetConfigfileDir());
	if ( !wxDirExists(configdir) )
		wxMkdir(configdir);

	if (!m_crash_handle_disable) {
	#if wxUSE_ON_FATAL_EXCEPTION
		wxHandleFatalExceptions( true );
	#endif
	#if defined(__WXMSW__) && defined(ENABLE_DEBUG_REPORT)
		//this undocumented function acts as a workaround for the dysfunctional
		// wxUSE_ON_FATAL_EXCEPTION on msw when mingw is used (or any other non SEH-capable compiler )
		SetUnhandledExceptionFilter(filter);
	#endif
	}

    //initialize all loggers
	//TODO non-constant parameters
	wxLogChain* logchain  = 0;
	wxLogWindow* loggerwin = InitializeLoggingTargets( 0, m_log_console, m_log_file_path, m_log_window_show, m_log_verbosity, logchain );
	//this needs to called _before_ mainwindow instance is created

#ifdef __WXMSW__
	wxString path = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + wxFileName::GetPathSeparator() + _T("locale");
#else
	#if defined(LOCALE_INSTALL_DIR)
		wxString path ( _T(LOCALE_INSTALL_DIR) );
	#else
		// use a dummy name here, we're only interested in the base path
		wxString path = wxStandardPaths::Get().GetLocalizedResourcesDir(_T("noneWH"),wxStandardPaths::ResourceCat_Messages);
		path = path.Left( path.First(_T("noneWH") ) );
	#endif
#endif
	m_translationhelper = new wxTranslationHelper( GetAppName().Lower(), path );

    SetSettingsStandAlone( true );

	// configure unitsync paths before trying to load
	SlPaths::ReconfigureUnitsync();

	//unitsync first load, NEEDS to be blocking
	LSL::usync().ReloadUnitSyncLib();

	settings_frame* frame = new settings_frame(NULL,GetAppName());
    SetTopWindow(frame);
    frame->Show();

    if ( loggerwin ) { // we got a logwindow, lets set proper parent win
        loggerwin->GetFrame()->SetParent( frame );
    }

    return true;
}
コード例 #2
0
ファイル: uifapp.cpp プロジェクト: tanganam/gimu
void GmUifApp::RemoveById (ubyte4 LogId)
{
	wxString tmpfile = GetTmpFile (GetAppName ());
	try {
		GmUnitedIndexFile uif (tmpfile, 0);
		const vector<GmUifRootEntry*> & roots = m_app.GetAllRootEntries ();
		GmSetDeleteFlagHandler handler (LogId);
		for (size_t index = 0; index < roots.size (); ++index) {
			GmUifRootPairT tree;
			GmAutoClearRootPairTree act (tree);
			m_app.GetUifRootTree (*roots[index], tree);
			for (size_t tindex = 0; tindex < tree.second->size (); ++tindex) {
				GmUifSourcePairT * pNode = (*tree.second)[tindex];
				TraverseTree (pNode->second, &handler, pNode->first->SourceName, GmUifAppHanldeFileType ());
			}

			ClearEmptyRootTreePair (tree);
			const GmUifRootEntry & entry = *tree.first;
			AddTheseTreeToUifFile (*tree.second, uif, (GmRootEntryType)entry.EntryType
									, entry.EntryDataType, entry.TraverseMtd, entry.EntryTime);
		}

		uif.Close ();
		m_app.Close ();
		if (wxRemoveFile (GetAppName ()))
			wxRenameFile (tmpfile, GetAppName ());
	}
	catch (...) {
		wxRemoveFile (tmpfile);
		throw;
	}
}
コード例 #3
0
// constructor supports creation of wxFileConfig objects of any type
wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
                           const wxString& strLocal, const wxString& strGlobal,
                           long style)
            : wxConfigBase(::GetAppName(appName), vendorName,
                           strLocal, strGlobal,
                           style),
              m_strLocalFile(strLocal), m_strGlobalFile(strGlobal)
{
  // Make up names for files if empty
  if ( m_strLocalFile.IsEmpty() && (style & wxCONFIG_USE_LOCAL_FILE) )
  {
    m_strLocalFile = GetLocalFileName(GetAppName());
  }

  if ( m_strGlobalFile.IsEmpty() && (style & wxCONFIG_USE_GLOBAL_FILE) )
  {
    m_strGlobalFile = GetGlobalFileName(GetAppName());
  }

  // Check if styles are not supplied, but filenames are, in which case
  // add the correct styles.
  if ( !m_strLocalFile.IsEmpty() )
    SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE);

  if ( !m_strGlobalFile.IsEmpty() )
    SetStyle(GetStyle() | wxCONFIG_USE_GLOBAL_FILE);

  // if the path is not absolute, prepend the standard directory to it
  // UNLESS wxCONFIG_USE_RELATIVE_PATH style is set
  if ( !(style & wxCONFIG_USE_RELATIVE_PATH) )
  {
      if ( !m_strLocalFile.IsEmpty() && !wxIsAbsolutePath(m_strLocalFile) )
      {
          wxString strLocal = m_strLocalFile;
          m_strLocalFile = GetLocalDir();
          m_strLocalFile << strLocal;
      }

      if ( !m_strGlobalFile.IsEmpty() && !wxIsAbsolutePath(m_strGlobalFile) )
      {
          wxString strGlobal = m_strGlobalFile;
          m_strGlobalFile = GetGlobalDir();
          m_strGlobalFile << strGlobal;
      }
  }

  SetUmask(-1);

  Init();
}
コード例 #4
0
ファイル: GSTitle.cpp プロジェクト: jason-amju/amjulib
void GSTitle::Draw2d()
{
  GSGui::Draw2d();

#ifdef SHOW_ENV_INFO
  // Draw env info, etc.
  static GuiText t;

  t.SetSize(Vec2f(1.0f, 0.1f));
  t.SetJust(GuiText::AMJU_JUST_LEFT);
  t.SetDrawBg(true);

  t.SetLocalPos(Vec2f(-1.0f, 0.8f));
  std::string s = "SaveDir: " + GetAppName();
  t.SetText(s);
  t.Draw();

  t.SetLocalPos(Vec2f(-1.0f, 0.7f));
  s = "Server: " + GetServer();
  t.SetText(s);
  t.Draw();

  t.SetLocalPos(Vec2f(-1.0f, 0.6f));
  s = "Env: " + GetEnv();
  t.SetText(s);
  t.Draw();
#endif
}
コード例 #5
0
bool WallFollowing::OnStartUp()
{
	setlocale(LC_ALL, "C");
	list<string> sParams;
	m_MissionReader.EnableVerbatimQuoting(false);
	if(m_MissionReader.GetConfiguration(GetAppName(), sParams))
	{
		list<string>::iterator p;
		for(p = sParams.begin() ; p != sParams.end() ; p++)
		{
			string original_line = *p;
			string param = stripBlankEnds(toupper(biteString(*p, '=')));
			string value = stripBlankEnds(*p);

			if(param == "FOO")
			{
				//handled
			}
			
			else if(param == "BAR")
			{
				//handled
			}
		}
	}

	m_timewarp = GetMOOSTimeWarp();
	RegisterVariables();
	
	return(true);
}
コード例 #6
0
ファイル: AppUserMode.cpp プロジェクト: adi6190/pcsx2
wxConfigBase* Pcsx2App::OpenInstallSettingsFile()
{
	// Implementation Notes:
	//
	// As of 0.9.8 and beyond, PCSX2's versioning should be strong enough to base ini and
	// plugin compatibility on version information alone.  This in turn allows us to ditch
	// the old system (CWD-based ini file mess) in favor of a system that simply stores
	// most core application-level settings in the registry.

	ScopedPtr<wxConfigBase> conf_install;

#ifdef __WXMSW__
	conf_install = new wxRegConfig();
#else
	// FIXME!!  Linux / Mac
	// Where the heck should this information be stored?

	wxDirName usrlocaldir( PathDefs::GetUserLocalDataDir() );
	//wxDirName usrlocaldir( wxStandardPaths::Get().GetDataDir() );
	if( !usrlocaldir.Exists() )
	{
		Console.WriteLn( L"Creating UserLocalData folder: " + usrlocaldir.ToString() );
		usrlocaldir.Mkdir();
	}

	wxFileName usermodefile( GetAppName() + L"-reg.ini" );
	usermodefile.SetPath( usrlocaldir.ToString() );
	conf_install = OpenFileConfig( usermodefile.GetFullPath() );
#endif

	return conf_install.DetachPtr();
}
コード例 #7
0
ファイル: SimGPS.cpp プロジェクト: liampaull/AUVCSLAM
bool SimGPS::OnStartUp()
{
  list<string> sParams;
  m_MissionReader.EnableVerbatimQuoting(false);
  if(m_MissionReader.GetConfiguration(GetAppName(), sParams)) {
    list<string>::iterator p;
    for(p=sParams.begin(); p!=sParams.end(); p++) {
      string original_line = *p;
      string param = stripBlankEnds(toupper(biteString(*p, '=')));
      string value = stripBlankEnds(*p);
      
      if(param == "GPS_COVARIANCE") {
        GPS_covariance = read_matrix(value);
      }
      if(param == "MAX_DEPTH"){
	max_depth = atof(value.c_str());
      }
      if(param == "ADD_NOISE"){
	add_noise = (tolower(value) == "true");
      }
      if(param == "BACKGROUND_MODE"){
	if (tolower(value) == "true")
	  in_prefix = "NAV";
	else
	  in_prefix = "SIM";
      }
    }
  }
  
  distribution = normal_distribution<double>(0.0,sqrt(GPS_covariance(0,0)));

  RegisterVariables();	
  return(true);
}
コード例 #8
0
ファイル: TestApp.cpp プロジェクト: bretthuff22/Animation
void TestApp::OnInitialize(u32 width, u32 height)
{
	mWindow.Initialize(GetInstance(), GetAppName(), width, height);
	HookWindow(mWindow.GetWindowHandle());

	mTimer.Initialize();

	mGraphicsSystem.Initialize(mWindow.GetWindowHandle(), false);
	SimpleDraw::Initialize(mGraphicsSystem);
	
	const u32 windowWidth = mGraphicsSystem.GetWidth();
	const u32 windowHeight = mGraphicsSystem.GetHeight();

	mCamera.Setup(Math::kPiByTwo, (f32)windowWidth / (f32)windowHeight, 0.01f, 1000.0f);
	mCamera.SetPosition(Math::Vector3(0.0f, 2.0f, 1.0f));
	mCamera.SetLookAt(Math::Vector3(0.0f, 1.0f, 0.0f));

	mRenderer.Initialize(mGraphicsSystem);

	mModel.Load(mGraphicsSystem, "../Data/Models/soldier1.txt");
	
	mAnimationController.Initialize(mModel);
	//AnimationClip clip;
	//mAnimationController.StartClip(clip, true);
	mAnimationController.StartClip(*mModel.mAnimations[0], true);
}
コード例 #9
0
void MusikApp::OnFatalException ()
{
    wxDebugReportCompress report;

    // add all standard files: currently this means just a minidump and an
    // XML file with system info and stack trace
    report.AddAll(wxDebugReport::Context_Exception);
 
    // create a copy of our preferences file to include it in the report
    wxFileName destfn(report.GetDirectory(), _T("musik.ini"));
    wxCopyFile(wxFileConfig::GetLocalFileName(CONFIG_NAME),destfn.GetFullPath());

    report.AddFile(destfn.GetFullName(), _T("Current Preferences Settings"));

    // calling Show() is not mandatory, but is more polite
    if ( wxDebugReportPreviewStd().Show(report) )
    {
        if ( report.Process() )
        {
#ifdef USE_WXEMAIL
            wxMailMessage mail(GetAppName() +  _T(" Crash-Report"),_T("*****@*****.**"),
                MUSIKAPPNAME_VERSION wxT("crashed."),
                wxEmptyString,report.GetCompressedFileName(),_T("CrashReportZip"));
            if(!wxEmail::Send(mail))
                wxMessageBox(_T("Sending email failed!"));
#endif                
        }
    }
    //else: user cancelled the report
}
コード例 #10
0
ファイル: TEAMS.CPP プロジェクト: tkellaway/f1gp-utils
TeamsWindow::TeamsWindow(
     HINSTANCE      hInst,
     HWND           hWndParent,
     unsigned short usWidth,
     unsigned short usHeight
) : ChildWindow(hInst, TEAMS_CLASS_NAME, GetAppName(), WS_CHILD, CHILD_ID_TEAMS, hWndParent) {
     unsigned short i;

     fInBitmap      = FALSE;
     usSelectedTeam = 0;

     usClientWidth  = usWidth;
     usClientHeight = usHeight;

     usMiniCarWidth  = usClientWidth / TEAMS_NUM_X;
     usMiniCarHeight = usClientHeight / TEAMS_NUM_Y;

     pClientBitmap = new Bitmap(pF1CarBitmap, usClientWidth, usClientHeight);
     ASSERT(pClientBitmap != NULL);

     pCursorTeamCar = new Cursor(Instance(), APP_CURSOR_TEAMCAR);
     ASSERT(pCursorTeamCar != NULL);


     CAR_REGIONS    *pCR = car_regions;
     for (i = 0; i < NUM_ELEMENTS(car_regions); i++, pCR++) {
          pCR->hRgn = CreatePolygonRgn(pCR->points, pCR->usPoints, ALTERNATE);
          ASSERT(pCR->hRgn != NULL);
     }

     UpdateMemoryImage();
     DragAcceptFiles(Handle(), TRUE);
}
コード例 #11
0
ファイル: iniconf.cpp プロジェクト: erwincoumans/wxWidgets
wxIniConfig::wxIniConfig(const wxString& strAppName,
                         const wxString& strVendor,
                         const wxString& localFilename,
                         const wxString& globalFilename,
                         long style)
           : wxConfigBase(!strAppName && wxTheApp ? wxTheApp->GetAppName()
                                               : strAppName,
                          !strVendor ? (wxTheApp ? wxTheApp->GetVendorName()
                                                  : strAppName)
                                      : strVendor,
                          localFilename, globalFilename, style)
{
    m_strLocalFilename = localFilename;
    if (m_strLocalFilename.empty())
    {
        m_strLocalFilename = GetAppName() + wxT(".ini");
    }

    // append the extension if none given and it's not an absolute file name
    // (otherwise we assume that they know what they're doing)
    if ( !wxIsPathSeparator(m_strLocalFilename[(size_t) 0]) &&
        m_strLocalFilename.Find('.') == wxNOT_FOUND )
    {
        m_strLocalFilename << wxT(".ini");
    }

    // set root path
    SetPath(wxEmptyString);
}
コード例 #12
0
ファイル: flexdisk.cpp プロジェクト: aladur/flexemu
/*------------------------------------------------------
 FLEXplorer implementation (The Application class)
--------------------------------------------------------*/
bool FLEXplorer::OnInit()
{
    wxLocale::AddCatalogLookupPathPrefix(".");
    wxLocale::AddCatalogLookupPathPrefix("./locale");

    m_locale.Init();
    m_locale.AddCatalog("flexemu");

    ReadDefaultOptions();
    SetAppName(_("FLEXplorer"));
#ifdef wxUSE_DRAG_AND_DROP
    wxTheClipboard->UsePrimarySelection();
#endif

    int width = 820;

    // Create the main frame window
    FlexParentFrame *frame =
        new FlexParentFrame((wxFrame *)nullptr, -1, GetAppName(),
                            wxPoint(-1, -1), wxSize(width, 700),
                            wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
    frame->Show(true);
    SetTopWindow(frame);

    for (int i = 1; i < argc; ++i)
    {
        if (!frame->OpenContainer(argv[i].ToUTF8()))
        {
            break;
        }
    }

    return true;
}
コード例 #13
0
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	g_hMenuGroup = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_GROUP ) );
	g_hMenuGroup = GetSubMenu( g_hMenuGroup, 0 );
	g_hMenuColor = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_COLOR ) );
	g_hMenuColor = GetSubMenu( g_hMenuColor, 0 );

	CMainWnd wndMain;
	char szTitle[256] = { 0 };
	sprintf( szTitle, "%s %s", GetAppName(), GetAppVer() );
	if( NULL == wndMain.Create( NULL, CWindow::rcDefault, szTitle, WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX ) )
	{
		ATLTRACE( _T("Main window creation failed!\n") );
		return( 0 );
	}
	wndMain.ShowWindow( nCmdShow );

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #14
0
bool wxGISApplicationBase::CreateApp(void)
{

    wxGISAppConfig oConfig = GetConfig();
	if(!oConfig.IsOk())
		return false;

    //load GDAL defaults
    wxString sGDALCacheMax = oConfig.Read(enumGISHKCU, wxString(wxT("wxGISCommon/GDAL/cachemax")), wxString(wxT("128")));
    CPLSetConfigOption("GTIFF_REPORT_COMPD_CS", "YES");
    CPLSetConfigOption("GTIFF_ESRI_CITATION", "YES");

    CPLSetConfigOption("GDAL_CACHEMAX", sGDALCacheMax.mb_str());
    CPLSetConfigOption("LIBKML_USE_DOC.KML", "no");
    CPLSetConfigOption("GDAL_USE_SOURCE_OVERVIEWS", "ON");
    CPLSetConfigOption("OSR_USE_CT_GRAMMAR", "FALSE");

    //GDAL_MAX_DATASET_POOL_SIZE
    //OGR_ARC_STEPSIZE


    //load commands
	wxXmlNode* pCommandsNode = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/commands")));

    if(pCommandsNode)
		LoadCommands(pCommandsNode);

    return true;
}
コード例 #15
0
ファイル: platform.cpp プロジェクト: tizbac/springlobby
wxString GetConfigfileDir()
{
	#ifdef __WXMSW__
		return GetUserDataDir();
	#else
		return wxFormat( _T("%s/.%s") ) % wxStandardPaths::Get().GetUserConfigDir() % GetAppName(true);
	#endif //__WXMSW__
}
コード例 #16
0
void wxGxObjectDialog::OnInit()
{
    long nStyle = wxLC_LIST | wxLC_EDIT_LABELS | wxLC_SORT_ASCENDING | wxBORDER_THEME;
	if(!m_bAllowMultiSelect)
		nStyle |= wxLC_SINGLE_SEL;
   	m_pwxGxContentView = new wxGxDialogContentView(this, LISTCTRLID, wxDefaultPosition, wxDefaultSize, nStyle);
	wxGISAppConfig oConfig = GetConfig();
	if(oConfig.IsOk())
	{
	    wxXmlNode* pContentViewConf = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/views/contentsview")));
	    m_pwxGxContentView->Activate(this, pContentViewConf);
	}
    RegisterChildWindow(m_pwxGxContentView->GetId());

	bMainSizer->Insert(1, m_pwxGxContentView, 1, wxALL|wxEXPAND, 5 );
	//m_pwxGxContentView->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( wxGxObjectDialog::OnItemSelected ), NULL, this );
	//m_pwxGxContentView->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( wxGxObjectDialog::OnItemSelected ), NULL, this );
	m_pwxGxContentView->Bind( wxEVT_COMMAND_LIST_ITEM_SELECTED, &wxGxObjectDialog::OnItemSelected, this );
	m_pwxGxContentView->Bind( wxEVT_COMMAND_LIST_ITEM_DESELECTED, &wxGxObjectDialog::OnItemSelected, this );

	for(size_t i = 0; i < m_FilterArray.size(); ++i)
		m_WildcardCombo->AppendString(m_FilterArray[i]->GetName());
	if(m_FilterArray.size() > 1 && m_bAllFilters)
		m_WildcardCombo->AppendString(_("All listed filters"));
	if(m_FilterArray.size() == 0)
		m_WildcardCombo->AppendString(_("All items"));
	m_WildcardCombo->Select(m_nDefaultFilter);

	m_pwxGxContentView->SetCurrentFilter(m_nDefaultFilter);
	m_pwxGxContentView->SetFilters(m_FilterArray);

    wxString sLastPath = m_sStartPath;
	if(sLastPath.IsEmpty())
	{
		if(oConfig.IsOk())
			sLastPath = oConfig.Read(enumGISHKCU, GetAppName() + wxString(wxT("/lastpath/path")), m_pCatalog->GetName());
		else
			sLastPath = m_pCatalog->GetName();
	}

    SetLocation(sLastPath);

    m_NameTextCtrl->SetFocus();

    SerializeFramePos(false);
}
コード例 #17
0
// Get a name suitable for the configuration file on all platforms:
// e.g. eCos Configuration Tool on Windows, .eCosConfigTool on Unix
wxString ecSettings::GetConfigAppName() const
{
#ifdef __WXGTK__
    return wxString(wxT("eCosConfigTool"));
#else
    return GetAppName();
#endif
}
コード例 #18
0
bool Camera::OnStartUp()
{
	setlocale(LC_ALL, "C");
	int identifiant_camera = -1;
	list<string> sParams;
	m_MissionReader.EnableVerbatimQuoting(false);
	
	if(m_MissionReader.GetConfiguration(GetAppName(), sParams))
	{
		list<string>::iterator p;
		for(p = sParams.begin() ; p != sParams.end() ; p++)
		{
			string original_line = *p;
			string param = stripBlankEnds(toupper(biteString(*p, '=')));
			string value = stripBlankEnds(*p);

			if(param == "IDENTIFIANT_CV_CAMERA")
				identifiant_camera = atoi((char*)value.c_str());

			if(param == "VARIABLE_IMAGE_NAME")
			{
				m_image_name = value;
				m_display_name = m_image_name;
			}
				
			if(param == "DISPLAY_IMAGE")
				m_affichage_image = (value == "true");
				
			if(param == "INVERT_IMAGE")
				m_inverser_image = (value == "true");
		}
	}

	m_timewarp = GetMOOSTimeWarp();

//	SetAppFreq(20, 400);
//	SetIterateMode(REGULAR_ITERATE_AND_COMMS_DRIVEN_MAIL);

	if(identifiant_camera == -1)
	{
		cout << "Aucun identifiant de caméra reconnu" << endl;
		return false;
	}

	char buff[100];
	sprintf(buff, "/dev/video%d", identifiant_camera);
	string device_name = buff;

	if(!m_vc_v4l2.open(device_name, LARGEUR_IMAGE_CAMERA, HAUTEUR_IMAGE_CAMERA))
		return false;

	if(m_affichage_image)
		namedWindow(m_display_name, CV_WINDOW_NORMAL);
		
	RegisterVariables();
	setlocale(LC_ALL, "");
	return(true);
}
コード例 #19
0
ファイル: StillImage.cpp プロジェクト: ZacWalk/ImageWalker
bool StillImage::RegisterApplication(HINSTANCE hInstace)
{
	CComPtr<IStillImage> pSti = GetStillImage(hInstace);

	if (pSti == 0)
		return false;

    return pSti->RegisterLaunchApplication(CT2W(GetAppName()), CT2W(GetExePath())) == S_OK;
}
コード例 #20
0
/*
    $(prefix)/share/doc/mmex
*/
const wxFileName mmex::GetDocDir()
{
    static wxFileName fname;

    if (!fname.IsOk()) 
    {
        fname = GetSharedDir();

        const wxArrayString &dirs = fname.GetDirs();
        if (dirs.Last().Lower() == GetAppName())
            fname.RemoveLastDir(); // mmex folder

        fname.AppendDir("doc");
        fname.AppendDir(GetAppName());
    }

    return fname;
}
コード例 #21
0
ファイル: ProcessLauncher.cpp プロジェクト: iceberry/flyffsf
bool CProcessLauncher::CreateMyProcess()
{
	if( m_lProcessCount > 0 )
	{
		puts("Process is running." );
		return false;
	}

	bool bOK = false;
	if( m_pi.hProcess == NULL )
	{
		if( ::RunProcess( &m_pi, (char *)GetAppName(), GetAppDirectory(), false, NORMAL_PRIORITY_CLASS ) )
		{
			printf( "Process[%s - %d] created.\n", GetAppName(), m_pi.hProcess );

			DWORD dwResult = WAIT_OBJECT_0;
			if( GetStartWait() )
				dwResult = WaitForSingleObject( GetEvent(), 1000 * 120 );	// 실행 후의 데이타 로딩을 최대 2분 기다린다.
			else
				WaitForInputIdle( m_pi.hProcess, 3000 );		

			bOK = ( dwResult == WAIT_OBJECT_0 );

			printf( "Process[%s - %d] wait result:%d\n", GetAppName(), m_pi.hProcess, dwResult );
		}
	}

	if( bOK )
	{
		InterlockedIncrement( &m_lProcessCount );
		BeginMonitor();
	}
	
	if( m_pPeer )
	{
		BEFORESEND( ar, PACKETTYPE_PROCESS_CREATED2 );
		ar << (BYTE)bOK;
		ar << (DWORD)( bOK ? 0 : GetLastError() );
		SEND( ar, m_pPeer, DPID_SERVERPLAYER );
	}

	return bOK;
}
コード例 #22
0
ファイル: ex1010.cpp プロジェクト: kyrofa/moos-snap
	bool OnProcessCommandLine(){
		pinger_ = m_CommandLineParser.GetFlag("--ping");

		burstsize_ =1000;
		m_CommandLineParser.GetVariable("--burst_size",burstsize_);

		SetMOOSName(GetAppName()+ std::string((pinger_ ? "ping":"pong")));

		return true;
	}
コード例 #23
0
void EDA_APP::WriteProjectConfig( const wxString&  fileName,
                                  const wxString&  GroupName,
                                  PARAM_CFG_BASE** List )
{
    PARAM_CFG_BASE* pt_cfg;
    wxString        msg;

    ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );

    /* Write time (especially to avoid bug wxFileConfig that writes the
     * wrong item if declaration [xx] in first line (If empty group)
     */
    m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );

    msg = DateAndTime();
    m_projectSettings->Write( wxT( "update" ), msg );

    msg = GetAppName();
    m_projectSettings->Write( wxT( "last_client" ), msg );

    /* Save parameters */
    m_projectSettings->DeleteGroup( GroupName );   // Erase all data
    m_projectSettings->Flush();

    m_projectSettings->SetPath( GroupName );
    m_projectSettings->Write( wxT( "version" ), CONFIG_VERSION );
    m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );

    for( ; List != NULL && *List != NULL; List++ )
    {
        pt_cfg = *List;

        if( pt_cfg->m_Group )
            m_projectSettings->SetPath( pt_cfg->m_Group );
        else
            m_projectSettings->SetPath( GroupName );

        if( pt_cfg->m_Setup )
            continue;

        if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE )    // Erase all data
        {
            if( pt_cfg->m_Ident )
                m_projectSettings->DeleteGroup( pt_cfg->m_Ident );
        }
        else
        {
            pt_cfg->SaveParam( m_projectSettings );
        }
    }

    m_projectSettings->SetPath( UNIX_STRING_DIR_SEP );
    delete m_projectSettings;
    m_projectSettings = NULL;
}
コード例 #24
0
ファイル: PALETTE.CPP プロジェクト: tkellaway/f1gp-utils
PaletteWindow::PaletteWindow(
     HINSTANCE      hInst,
     HWND           hWndParent,
     unsigned short usWidth,
     unsigned short usHeight
) : ChildWindow(hInst, PALETTE_CLASS_NAME, GetAppName(), WS_CHILD, CHILD_ID_PALETTE, hWndParent) {
     pClientBitmap = new Bitmap(pF1CarBitmap, usWidth, usHeight);
     ASSERT(pClientBitmap != NULL);

     pCursorPalette  = new Cursor(Instance(), APP_CURSOR_PALETTE);
     ASSERT(pCursorPalette != NULL);

     /*
     ** Build palette image once only in memory.
     */
     PaintWindowUpdate        pwu(Handle());
     PaintCompatibleWindow    pcw(pwu.DC());
     HPALETTE                 hOldPalette;
     unsigned short           i, x, y, w;
     RECT                     rect;

     hOldPalette = SelectPalette(pcw.DC(), hPalette, FALSE);
     (void) RealizePalette(pcw.DC());

     ASSERT(pClientBitmap != NULL);
     pcw.SelectBitmap(pClientBitmap);
     {
          /*
          ** Draw palette in client bitmap.
          */
          w = usWidth / PALETTE_BOX_ITEMS_PER_LINE;
          for (i = 0, x = 0, y = 0; i < NUM_COLOURS_IN_PALETTE; i++, x += w) {
               SolidBrush     brush(PALETTEINDEX(i));

               if (i % PALETTE_BOX_ITEMS_PER_LINE == 0 && i != 0) {
                    x = 0;
                    y += PALETTE_BOX_ITEM_HEIGHT;
               }

               rect.bottom    = y;
               rect.top       = y + PALETTE_BOX_ITEM_HEIGHT;
               rect.left      = x;
               rect.right     = x + w;
               pcw.FillRect(&rect, &brush);
               pcw.MoveTo(rect.left,  rect.bottom);
               pcw.LineTo(rect.left,  rect.top);
               pcw.LineTo(rect.right, rect.top);
               pcw.LineTo(rect.right, rect.bottom);
               pcw.LineTo(rect.left,  rect.bottom);
          }
     }
     pcw.DeselectBitmap();
     (void) SelectPalette(pcw.DC(), hOldPalette, FALSE);
}
コード例 #25
0
bool CTestRegApp::TestApp_Init(void)
{
    // Initialize the C logging API with default MT locking imlementation
    NcbiLog_InitMT(GetAppName().c_str());
    // Set output to files in current directory
    NcbiLog_SetDestination(eNcbiLog_Cwd);
    // Start application
    NcbiLog_AppStart(NULL);
    NcbiLog_AppRun();
    return true;
}
コード例 #26
0
ファイル: StillImage.cpp プロジェクト: ZacWalk/ImageWalker
bool StillImage::UnregisterApplication(HINSTANCE hInstace)
{
    CComPtr<IStillImage> pSti = GetStillImage(hInstace);

	if (pSti == 0)
		return false;

	USES_CONVERSION;

    return pSti->UnregisterLaunchApplication(CT2W(GetAppName())) == S_OK;
}
コード例 #27
0
void showAbout()
{
    wxAboutDialogInfo info;
	if ( IsSettingsStandAlone() )
	{
		wxString name ( GetAppName() );
		if ( GetAppName() != _T("SpringSettings") )
			name += _T(" (SpringSettings)");
		info.SetName(name);
		info.SetVersion(_T("0.2.2"));
	}
	else
	{
		info.SetName( GetAppName() );
		info.SetVersion(GetSpringLobbyVersion());
	}
    info.SetDescription(_("SpringSettings is a graphical frontend to the Settings of the Spring engine"));
	info.SetCopyright(_T("(C) 2007-2011 koshi <*****@*****.**>"));
    info.SetIcon(wxIcon(springsettings_xpm));
    wxAboutBox(info);
}
コード例 #28
0
void CTest::RunTest(CTempString name, FTestCase testcase)
{
    cout << name;

    string basename = "clog-test." + (string)name;
    string log_path = basename + ".out";

    // Redirect stderr to file
    ::fflush(stderr);
    int saved_stderr = ::dup(fileno(stderr));
    if (!::freopen(log_path.c_str(), "w", stderr)) {
        _TROUBLE;
    }

    // Initialize API (single-threaded mode)
    NcbiLogP_ReInit();
    NcbiLog_InitST(GetAppName().c_str());
    // Set CLog to use stderr for output, that will be redirected
    // to the file specified above.
    NcbiLog_SetDestination(eNcbiLog_Stderr);
    NcbiLog_SetPostLevel(eNcbiLog_Info);

    // Default initialization
    NcbiLog_SetHost("TESTHOST");

    // Run specified test case
    testcase();

    // Done logging
    NcbiLog_Destroy();
    
    // Restore original stderr
    ::fflush(stderr);
    if (::dup2(saved_stderr, fileno(stderr)) < 0) {
        _TROUBLE;
    }
    close(saved_stderr);
    clearerr(stderr);

    // Compare output
    string template_path = CDir::ConcatPath(kTemplatesDir, basename + ".tpl");
    try {
        CRegexpTemplateTester tester(CRegexpTemplateTester::fSkipEmptyTemplateLines);
        tester.Compare(log_path, template_path);
        cout << ": OK" << endl;
        m_Passed++;
    }
    catch (CRegexpTemplateTesterException& e) {
        cout << e.what() << endl;
        m_Failed++;
    }
    return;
}
コード例 #29
0
ファイル: wxgl_main.cpp プロジェクト: matus-chochlik/oglplus
 bool OnInit() {
     bool result = false;
     try {
         SetTopWindow(new MainFrame(*this, GetAppName()));
         result = true;
     } catch(oglplus::Error& err) {
         HandleError(err);
     } catch(const std::exception& se) {
         HandleError(se);
     }
     return result;
 }
コード例 #30
0
ファイル: statusbar.cpp プロジェクト: jamerlan/springlobby
Statusbar::Statusbar( wxWindow* parent )
	:wxStatusBar( parent, wxNewId() ),
	m_addMessageSink( this, &GetStatusEventSender(UiEvents::addStatusMessage) ),
	m_removeMessageSink( this, &GetStatusEventSender(UiEvents::removeStatusMessage) )

{
	int w[3] = {-1,-1,120};
	SetFieldsCount( 3, w );
	PushStatusText( wxFormat( _T("%s %s") )
									  % GetAppName()
									  % GetSpringLobbyVersion(),
					1 );
}