Beispiel #1
0
bool App::OnInit() {
   SetAppName(u8"flutterrust");
   SetAppDisplayName(u8"flutterrust");

   const wxFileName exeFileName{wxStandardPaths::Get().GetExecutablePath()};
   const std::string exePath = exeFileName.GetPath().ToStdString();
   try {
      Creature::loadTypes(exePath + static_cast<char>(wxFileName::GetPathSeparator()) +
                          u8"CreatureTable.txt");
      mainFrame = new MainFrame{exePath};
   } catch (const std::exception& e) {
      wxMessageDialog dialog{nullptr, u8"Exception caught.  Terminating.\n",
                             u8"Fatal error", wxICON_ERROR | wxOK};
      dialog.SetExtendedMessage(std::string{typeid(e).name()} + ": \"" + e.what() + '"');
      dialog.ShowModal();
      return false;  // Exit the application immediately.
   } catch (...) {
      wxMessageDialog(nullptr, u8"Unknown exception caught.  Terminating.",
                      u8"Fatal error", wxICON_ERROR | wxOK)
          .ShowModal();
      return false;
   }

   mainFrame->Show(true);
   SetTopWindow(mainFrame);

   return true;  // Continue processing.
}
Beispiel #2
0
bool App::OnInit()
{
    bool ok = wxApp::OnInit();

    if (ok)
    {
        wxLocaleHelper::Init(&m_locale, STE_APPNAME, m_cmdLine.m_lang);
        ::wxInitAllImageHandlers();

        // Fill in the application information fields before creating wxConfig.
        SetVendorName(wxT("wxWidgets"));
        SetAppName(APP_NAME_SHORT);
    #if (wxVERSION_NUMBER >= 2900)
        SetAppDisplayName(APP_NAME_DISPLAY);
    #endif

        // Create a document manager
        wxDocManager* docManager = CreateDocManager();

        // create the main frame window
        MainFrame* frame = new MainFrame();
        
        ok = frame->Create(docManager, GetAppDisplayName());
        if (ok)
        {
            frame->Show();
            OpenDocuments(docManager);
        }
        else
        {
            delete frame;
        }
    }
    return ok;
}
Beispiel #3
0
bool App::OnInit()
{
   SetAppName(u8"TrackHack");
   SetAppDisplayName(u8"TrackHack");

   wxFileName localFileName = wxFileConfig::GetLocalFile("track_hack.ini",
      wxCONFIG_USE_SUBDIR);
   if (!localFileName.FileExists() && // Does the user-specific configuration file exist?
       !localFileName.DirExists())    // If not, does the directory where it would have
                                      // been not exist either?
   {
      // Create that directory.
      bool success = wxFileName::Mkdir(localFileName.GetPath(), wxS_DIR_DEFAULT,
         wxPATH_MKDIR_FULL);

      if (!success) { // Assert success in creating it; otherwise terminate.
         ::wxLogFatalError("Failed to create local configuration directory: "
            "%s\n\nTerminating.", localFileName.GetPath());
      }
   }

   wxConfigBase::Set(new wxFileConfig{u8"TrackHack", wxEmptyString, u8"track_hack.ini",
      u8"track_hack.ini", wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE |
      wxCONFIG_USE_SUBDIR});

   // No wxInitAllImageHandlers() as for now, only the BMP/DIB file format is supported.

   mainFrame = new MainFrame(wxDefaultPosition, wxSize(640, 720));

   mainFrame->Show(true);
   SetTopWindow(mainFrame);

   return true;
}
bool CModelViewerApp::OnInit()
{
	SetAppDisplayName( HLMV_TITLE );
	SetLogFilename( HLMV_TITLE );

	return CBaseWXToolApp::OnInit();
}
Beispiel #5
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    // This will be used in the title of the preferences dialog under some
    // platforms, don't leave it as default "Preferences" because this would
    // result in rather strange "Preferences Preferences" title.
    SetAppDisplayName("wxWidgets Sample");

    MyFrame *frame = new MyFrame();
    frame->Show(true);

    return true;
}
Beispiel #6
0
	virtual bool OnInit()
	{
		wxHandleFatalExceptions();

		wxImage::AddHandler(new wxPNGHandler());
		wxImage::AddHandler(new wxJPEGHandler());
		wxImage::AddHandler(new wxGIFHandler());

		m_locale.Init();

		SetAppName("RLReplayManager");
		SetAppDisplayName("RL Replay Manager");

		ManagerFrame* frame = new ManagerFrame(NULL);
		frame->Show();

		return true;
	}
Beispiel #7
0
void PWUpdaterApp::Init()
{
    /* application information */
    SetVendorName(wxT("delta"));
    SetVendorDisplayName(wxT("Delta Electronics, Inc."));
    SetAppName(wxT("PWUpdater"));
    SetAppDisplayName(wxT("PixelWorks Ruby Platform Updater"));

    /* database */
    m_pOpt = new AppOptions;

    /* network adapter list */
    m_adapterList.clear();

    /* usb key state */
    m_keyFound = false;

    /* threads management */
    m_serverCS.Enter();
    m_pTftpdServerThread = NULL;
    m_serverCS.Leave();

    m_transmissionCS.Enter();
    m_tftpdTransmissionThreads.clear();
    m_transmissionCS.Leave();

    m_rockeyCS.Enter();
    m_pRockeyThread = NULL;
    m_rockeyCS.Leave();

    m_uartCS.Enter();
    m_pUartThread = NULL;
    m_uartCS.Leave();

    /* thread queue */
    m_pUartQueue = new ThreadSafeQueue<UartMessage>;

    /* create supported language map */
    AddSupportedLanguages();
}
Beispiel #8
0
// Main program equivalent, creating windows and returning main app frame
bool Regard3DApp::OnInit()
{
	wxString appName(wxT(REGARD3D_NAME));
	wxString vendorName(wxT(REGARD3D_VENDOR_NAME));

#if wxCHECK_VERSION(2, 9, 0)
	SetAppDisplayName(appName);
	SetVendorDisplayName(vendorName);
#endif
	appName.Replace(wxT(" "), wxEmptyString, true);
	SetAppName(appName);
	SetVendorName(vendorName);

#if wxUSE_IMAGE
	wxInitAllImageHandlers();
#endif

	Eigen::initParallel();

#if defined(R3D_HAVE_OPENMP)
	//omp_set_num_threads(1);	// omp_get_num_procs() + 1);	// +1 to fill delays in file I/O
#endif

	CameraDBLookup::getInstance().initialize();
	UserCameraDB::getInstance().initialize();
	R3DExternalPrograms::getInstance().initialize();
	R3DFontHandler::getInstance().initialize();

	pMainFrame_ = new Regard3DMainFrame(NULL);

	// Show the frame
	pMainFrame_->Show(true);

	SetTopWindow(pMainFrame_);

	return true;
}
Beispiel #9
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    ::wxInitAllImageHandlers();

    // Fill in the application information fields before creating wxConfig.
    SetVendorName("wxWidgets");
    SetAppName("wx_docview_sample");
    SetAppDisplayName("wxWidgets DocView Sample");

    //// Create a document manager
    wxDocManager *docManager = new wxDocManager;

    //// Create a template relating drawing documents to their views
    new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw",
                      "Drawing Doc", "Drawing View",
                      CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
#if defined( __WXMAC__ )  && wxOSX_USE_CARBON
    wxFileName::MacRegisterDefaultTypeAndCreator("drw" , 'WXMB' , 'WXMA');
#endif

    if ( m_mode == Mode_Single )
    {
        // If we've only got one window, we only get to edit one document at a
        // time. Therefore no text editing, just doodling.
        docManager->SetMaxDocsOpen(1);
    }
    else // multiple documents mode: allow documents of different types
    {
        // Create a template relating text documents to their views
        new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text",
                          "Text Doc", "Text View",
                          CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
#if defined( __WXMAC__ ) && wxOSX_USE_CARBON
        wxFileName::MacRegisterDefaultTypeAndCreator("txt" , 'TEXT' , 'WXMA');
#endif
        // Create a template relating image documents to their views
        new wxDocTemplate(docManager, "Image", "*.png;*.jpg", "", "png;jpg",
                          "Image Doc", "Image View",
                          CLASSINFO(ImageDocument), CLASSINFO(ImageView));
    }

    // create the main frame window
    wxFrame *frame;
#if wxUSE_MDI_ARCHITECTURE
    if ( m_mode == Mode_MDI )
    {
        frame = new wxDocMDIParentFrame(docManager, NULL, wxID_ANY,
                                        GetAppDisplayName(),
                                        wxDefaultPosition,
                                        wxSize(500, 400));
    }
    else
#endif // wxUSE_MDI_ARCHITECTURE
    {
        frame = new wxDocParentFrame(docManager, NULL, wxID_ANY,
                                     GetAppDisplayName(),
                                     wxDefaultPosition,
                                     wxSize(500, 400));
    }

    // and its menu bar
    wxMenu *menuFile = new wxMenu;

    menuFile->Append(wxID_NEW);
    menuFile->Append(wxID_OPEN);

    if ( m_mode == Mode_Single )
        AppendDocumentFileCommands(menuFile, true);

    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT);

    // A nice touch: a history of files visited. Use this menu.
    docManager->FileHistoryUseMenu(menuFile);
#if wxUSE_CONFIG
    docManager->FileHistoryLoad(*wxConfig::Get());
#endif // wxUSE_CONFIG


    if ( m_mode == Mode_Single )
    {
        m_canvas = new MyCanvas(NULL, frame);
        m_menuEdit = CreateDrawingEditMenu();
    }

    CreateMenuBarForFrame(frame, menuFile, m_menuEdit);

    frame->SetIcon(wxICON(doc));
    frame->Centre();
    frame->Show();

    if ( m_filesFromCmdLine.empty() )
    {
        docManager->CreateNewDocument();
    }
    else // we have files to open on command line
    {
        for ( size_t i = 0; i != m_filesFromCmdLine.size(); ++i )
            docManager->CreateDocument(m_filesFromCmdLine[i], wxDOC_SILENT);
    }

    return true;
}
Beispiel #10
0
bool wxvbamApp::OnInit()
{
	// use consistent names for config
	SetAppName(_("vbam"));
#if (wxMAJOR_VERSION >= 3)
	SetAppDisplayName(_T("VisualBoyAdvance-M"));
#endif
	// load system default locale, if available
	locale.Init();
	locale.AddCatalog(_T("wxvbam"));
	// make built-in xrc file available
	// this has to be done before parent OnInit() so xrc dump works
	wxFileSystem::AddHandler(new wxMemoryFSHandler);
	wxFileSystem::AddHandler(new wxArchiveFSHandler);
	wxMemoryFSHandler::AddFileWithMimeType(wxT("wxvbam.xrs"), builtin_xrs, sizeof(builtin_xrs), wxT("application/zip"));

	if (!wxApp::OnInit())
		return false;

	// prepare for loading xrc files
	wxXmlResource* xr = wxXmlResource::Get();
	// note: if linking statically, next 2 pull in lot of unused code
	// maybe in future if not wxSHARED, load only builtin-needed handlers
	xr->InitAllHandlers();
	wxInitAllImageHandlers();
	get_config_path(config_path);
	// first, load override xrcs
	// this can only override entire root nodes
	// 2.9 has LoadAllFiles(), but this is 2.8, so we'll do it manually
	wxString cwd = wxGetCwd();

	for (int i = 0; i < config_path.size(); i++)
		if (wxDirExists(config_path[i]) && wxSetWorkingDirectory(config_path[i]))
		{
			// *.xr[cs] doesn't work (double the number of scans)
			// 2.9 gives errors for no files found, so manual precheck needed
			// (yet another double the number of scans)
			if (!wxFindFirstFile(wxT("*.xrc")).empty())
				xr->Load(wxT("*.xrc"));

			if (!wxFindFirstFile(wxT("*.xrs")).empty())
				xr->Load(wxT("*.xrs"));
		}

	wxFileName xrcDir(GetConfigurationPath() + wxT("//xrc"), wxEmptyString);

	if (xrcDir.DirExists() && wxSetWorkingDirectory(xrcDir.GetFullPath()) && !wxFindFirstFile(wxT("*.xrc")).empty())
	{
		xr->Load(wxT("*.xrc"));
	}
	else
	{
		// finally, load built-in xrc
		xr->Load(wxT("memory:wxvbam.xrs"));
	}

	wxSetWorkingDirectory(cwd);
	// set up config file
	// this needs to be in a subdir to support other config as well
	// but subdir flag behaves differently 2.8 vs. 2.9.  Oh well.
	// NOTE: this does not support XDG (freedesktop.org) paths
#if defined(__WXMSW__) || defined(__APPLE__)
	wxFileName vbamconf(GetConfigurationPath(), _T("vbam.ini"));
	cfg = new wxFileConfig(wxT("vbam"), wxEmptyString,
	                       vbamconf.GetFullPath(),
	                       wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
#else
	cfg = new wxFileConfig(wxEmptyString, wxEmptyString, wxEmptyString,
	                       wxEmptyString,
	                       // style =
	                       wxCONFIG_USE_GLOBAL_FILE | wxCONFIG_USE_LOCAL_FILE |
	                       wxCONFIG_USE_SUBDIR);
#endif
	// set global config for e.g. Windows font mapping
	wxFileConfig::Set(cfg);
	// yet another bug/deficiency in wxConfig: dirs are not created if needed
	// since a default config is always written, dirs are always needed
	// Can't figure out statically if using wxFileConfig w/o duplicating wx's
	// logic, so do it at run-time
	// wxFileConfig *f = wxDynamicCast(cfg, wxFileConfig);
	// wxConfigBase does not derive from wxObject!!! so no wxDynamicCast
	wxFileConfig* fc = dynamic_cast<wxFileConfig*>(cfg);

	if (fc)
	{
		wxFileName s(wxFileConfig::GetLocalFileName(GetAppName()));
		// at least up to 2.8.12, GetLocalFileName returns the dir if
		// SUBDIR is specified instead of actual file name
		// and SUBDIR only affects UNIX
#if defined(__UNIX__) && !wxCHECK_VERSION(2,9,0)
		s.AppendDir(s.GetFullName());
#endif
		// only the path part gets created
		// note that 0777 is default (assumes umask will do og-w)
		s.Mkdir(0777, wxPATH_MKDIR_FULL);
		s = wxFileName::DirName(GetConfigurationPath());
		s.Mkdir(0777, wxPATH_MKDIR_FULL);
	}

	load_opts();

	// process command-line options
	for (int i = 0; i < pending_optset.size(); i++)
	{
		wxString p = pending_optset[i];
		size_t eqat = p.find(wxT('='));
		p[eqat] = 0;
		opt_set(p.c_str(), p.c_str() + eqat + 1);
	}

	pending_optset.clear();
	wxFileName vba_over(GetConfigurationPath(), wxT("vba-over.ini"));
	wxFileName rdb(GetConfigurationPath(), wxT("Nintendo - Game Boy Advance*.dat"));
	wxFileName scene_rdb(GetConfigurationPath(), wxT("Nintendo - Game Boy Advance (Scene)*.dat"));
	wxFileName nointro_rdb(GetConfigurationPath(), wxT("Official No-Intro Nintendo Gameboy Advance Number (Date).xml"));
	wxString f = wxFindFirstFile(nointro_rdb.GetFullPath(), wxFILE);

	if (!f.empty() && wxFileName(f).IsFileReadable())
		rom_database_nointro = f;

	f = wxFindFirstFile(scene_rdb.GetFullPath(), wxFILE);

	if (!f.empty() && wxFileName(f).IsFileReadable())
		rom_database_scene = f;

	f = wxFindFirstFile(rdb.GetFullPath(), wxFILE);

	while (!f.empty())
	{
		if (f == rom_database_scene.GetFullPath())
		{
			f = wxFindNextFile();
		}
		else if (wxFileName(f).IsFileReadable())
		{
			rom_database = f;
			break;
		}
	}

	// load vba-over.ini
	// rather than dealing with wxConfig's broken search path, just use
	// the same one that the xrc overrides use
	// this also allows us to override a group at a time, add commments, and
	// add the file from which the group came
	wxMemoryInputStream mis(builtin_over, sizeof(builtin_over));
	overrides = new wxFileConfig(mis);
	wxRegEx cmtre;
	// not the most efficient thing to do: read entire file into a string
	// just to parse the comments out
	wxString bovs((const char*)builtin_over, wxConvUTF8, sizeof(builtin_over));
	bool cont;
	wxString s;
	long grp_idx;
#define CMT_RE_START wxT("(^|[\n\r])# ?([^\n\r]*)(\r?\n|\r)\\[")

	for (cont = overrides->GetFirstGroup(s, grp_idx); cont;
	        cont = overrides->GetNextGroup(s, grp_idx))
	{
		// apparently even MacOSX sometimes uses the old \r by itself
		wxString cmt(CMT_RE_START);
		cmt += s + wxT("\\]");

		if (cmtre.Compile(cmt) && cmtre.Matches(bovs))
			cmt = cmtre.GetMatch(bovs, 2);
		else
			cmt = wxEmptyString;

		overrides->Write(s + wxT("/comment"), cmt);
	}

	if (vba_over.FileExists())
	{
		wxStringOutputStream sos;
		wxFileInputStream fis(vba_over.GetFullPath());
		// not the most efficient thing to do: read entire file into a string
		// just to parse the comments out
		fis.Read(sos);
		// rather than assuming the file is seekable, use the string we just
		// read as an input stream
		wxStringInputStream sis(sos.GetString());
		wxFileConfig ov(sis);

		for (cont = ov.GetFirstGroup(s, grp_idx); cont;
		        cont = ov.GetNextGroup(s, grp_idx))
		{
			overrides->DeleteGroup(s);
			overrides->SetPath(s);
			ov.SetPath(s);
			overrides->Write(wxT("path"), GetConfigurationPath());
			// apparently even MacOSX sometimes uses \r by itself
			wxString cmt(CMT_RE_START);
			cmt += s + wxT("\\]");

			if (cmtre.Compile(cmt) && cmtre.Matches(sos.GetString()))
				cmt = cmtre.GetMatch(sos.GetString(), 2);
			else
				cmt = wxEmptyString;

			overrides->Write(wxT("comment"), cmt);
			long ent_idx;

			for (cont = ov.GetFirstEntry(s, ent_idx); cont;
			        cont = ov.GetNextEntry(s, ent_idx))
				overrides->Write(s, ov.Read(s, wxEmptyString));

			ov.SetPath(wxT("/"));
			overrides->SetPath(wxT("/"));
		}
	}

	// create the main window
	frame = wxDynamicCast(xr->LoadFrame(NULL, wxT("MainFrame")), MainFrame);

	if (!frame)
	{
		wxLogError(_("Could not create main window"));
		return false;
	}

	// Create() cannot be overridden easily
	if (!frame->BindControls())
		return false;

	frame->Show(true);
	return true;
}
Beispiel #11
0
bool wxStEditApp::OnInit()
{
    if (!wxApp::OnInit()) // parse command line
        return false;

#ifdef _WX_DOCH__
    wxDocManager* docManager = new wxDocManager();
    wxSTEditorDocTemplate::Create(docManager);
    // now wxWidgets tracks all the files opened (wxDocManager::GetDocuments())
#endif

    SetAppName(STE_APPNAME);
#if (wxVERSION_NUMBER >= 2900)
    SetAppDisplayName(STE_APPDISPLAYNAME);
#endif
    wxLocaleHelper::Init(&m_locale, STE_APPNAME, m_lang);
    wxSTEditorOptions::SetGlobalDefaultFileName(wxString(_("unnamed")) + wxT(".txt")); // translated

    // Create a set of wxSTEditorOptions for your editing "system."
    // These options control what components will be automatically
    //  created and/or managed for you.
    // Every STE window created will have its virtual function CreateOptions() called.
    // You can start with all the options "turned off" by using
    //  the default constructor.

    // For this simple editor we'll basicly use the defaults for everything.
    // Note that we set it up in the wxStEditApp constructor since we adjust
    //  it in OnCmdLineParsed() to use either a single editor or notebook.

    //m_steOptions = wxSTEditorOptions(STE_DEFAULT_OPTIONS, STS_DEFAULT_OPTIONS,
    //                                 STN_DEFAULT_OPTIONS, STF_DEFAULT_OPTIONS);

    wxSTEditorOptions::RegisterIds();

    // =======================================================================
    // A sample of things that you might do to change the behavior

    // no bookmark items in menus or toolbar
    //m_steOptions.GetMenuManager()->SetMenuItemType(STE_MENU_BOOKMARK, false);
    //m_steOptions.GetMenuManager()->SetToolbarToolType(STE_MENU_BOOKMARK, false);

    // don't create a toolbar
    //m_steOptions.SetFrameOption(STF_TOOLBAR, false);
    // allow notebook to not have any pages
    //m_steOptions.SetNotebookOption(STN_ALLOW_NO_PAGES, true);
    // don't ask the user to save a modified document, close silently
    //m_steOptions.SetEditorOption(STE_QUERY_SAVE_MODIFIED, false);

    // Maybe we're editing only python files, set global initializers
    // wxSTEditorOptions::SetGlobalDefaultFileName(wxT("newfile.py"));
    // wxSTEditorOptions::SetGlobalDefaultFileExtensions(wxT("Python file (*.py)|*.py"));

    // maybe the editors that use these options are only for your ini files
    // m_steOptions.SetDefaultFileName(wxT("MyProgram.ini"));

    // Maybe you want your own special menu for the splitter?
    //  it'll delete the old one (if there was one) and replace it with yours.
    // m_steOptions.SetSplitterPopupMenu(myMenu, false);

    // Maybe you want this editor to not use the global preferences,
    //  create a new one, set it up the way you like it and push it onto the
    //  options so that every new editor sharing these options will use it.
    //  Remember, you can later detach a single editors to have them
    //  use some other prefs/styles/langs with STE::RegisterXXX(otherXXX)
    // wxSTEditorPrefs myPrefs(true);
    // myPrefs.SetPrefBool(STE_PREF_VIEW_EOL, true);
    // m_steOptions.SetEditorPrefs(myPrefs);

    // You can do the same for the styles and langs, though the languages
    //  are pretty generic and it probably won't be necessary.

    // Remember, the global versions are created to be used by a set of editors
    //  they are created because if a user likes their editor a
    //  certain way, you might as well make all of them look that way.
    //  There is nothing special about them and if you want to see what the
    //  defaults are just create a wxSTEditorPrefs/Styles/Langs(true).

    // etc... Ok, we set things up the way we like.

    // end sample code
    // =======================================================================

    // Create a notebook to show the find results in
    m_steOptions.SetFrameOption(STF_CREATE_RESULT_NOTEBOOK, true);

    // Remove the Help menu since wxMac will pull out the wxID_ABOUT to add to
    // the system menu and then hide the Help menu. Later on when we add items
    // to the help menu, they'll be hidden too.
    m_steOptions.GetMenuManager()->SetMenuItems(STE_MENU_HELP_MENU, 0);

    // create with the readonly menuitem, not set by default since I don't think
    //  it's generally useful, but good for debugging.
    m_steOptions.GetMenuManager()->SetMenuItemType(STE_MENU_EDIT_MENU, STE_MENU_EDIT_READONLY, true);
    m_steOptions.GetMenuManager()->SetToolbarToolType(STE_TOOLBAR_PRINT, true);
    m_steOptions.GetMenuManager()->SetToolbarToolType(STE_TOOLBAR_EDIT_SEARCH_CTRL, true);
    m_steOptions.SetNotebookOption(STN_ALPHABETICAL_TABS, false); // Ctrl+N -> append tabs to the right always
    m_steOptions.GetMenuManager()->GetAcceleratorArray()->Add(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_HELP, ID_SHOW_HELP)); // adding 'custom' accelerator
    m_steOptions.GetMenuManager()->GetAcceleratorArray()->Add(wxAcceleratorHelper::GetStockAccelerator(wxID_ABOUT)); // adding 'custom' accelerator

    // ------------------------------------------------------------------------
    m_frame = CreateMainFrame();

    // ------------------------------------------------------------------------
    // handle loading the files
    size_t n;
    wxArrayFileName badFileNames;
    wxArrayFileName fileNames = m_fileNames;

    // handle recursive file loading
    if (m_recurse_dirs && m_frame->GetEditorNotebook())
    {
        size_t max_page_count = m_frame->GetEditorNotebook()->GetMaxPageCount();

        wxArrayString recurseFileNames;
        for (n = 0; n < fileNames.GetCount(); n++)
        {
            wxFileName fN(fileNames[n]);
            fN.MakeAbsolute();
            //wxPrintf(wxT("Loading file '%s' to '%s'\n"), fileNames[n].wx_str(), fN.GetFullPath().wx_str()); fflush(stdout);
            wxDir::GetAllFiles(fN.GetPath(), &recurseFileNames, fN.GetFullName());

            // if they did wxstedit /r c:\*.* stop the insanity...
            if (recurseFileNames.GetCount() >= max_page_count)
            {
                wxString msg = wxString::Format(_("Opening %d files, unable to open any more."), (int)max_page_count);
                wxMessageBox(msg, _("Maximum number of files"), wxOK|wxICON_ERROR, m_frame);
                recurseFileNames.RemoveAt(max_page_count - 1, recurseFileNames.GetCount() - max_page_count);
                break;
            }
        }

        //for (n=0; n < recurseFileNames.GetCount(); n++)
        //  { wxPrintf(wxT("Loading file '%s'\n"), recurseFileNames[n].wx_str()); fflush(stdout); }

        // delete all wildcards and replace them with the new files
        fileNames.Clear();

        for (n = 0; n < recurseFileNames.GetCount(); n++)
        {
            fileNames.Add(wxFileName(recurseFileNames.Item(n))); // these are really the files to open
        }
    }

    // if the files have *, ? or are directories, don't try to load them
    for (n = 0; n < fileNames.GetCount(); n++)
    {
        if (wxIsWild(fileNames[n].GetFullPath()))
        {
            badFileNames.Add(fileNames[n]);
            fileNames.RemoveAt(n);
            n--;
        }
        else if (wxDirExists(fileNames[n].GetFullPath()))
        {
            fileNames.RemoveAt(n);
            n--;
        }
    }

    // If there are any good files left, try to load them
    if (fileNames.GetCount() > 0u)
    {
        if (fileNames[0].FileExists())
            m_frame->GetEditor()->LoadFile( fileNames[0] );
        else
        {
            // fix the path to the new file using the command line path
            wxFileName fn(fileNames[0]);
            fn.Normalize();
            m_frame->GetEditor()->NewFile( fn.GetFullPath() );
        }

        fileNames.RemoveAt(0);
        if (m_steOptions.HasFrameOption(STF_CREATE_NOTEBOOK) && fileNames.GetCount())
            m_frame->GetEditorNotebook()->LoadFiles( &fileNames );
    }

    //frame->ShowSidebar(false);
    //wxSTEditorOptions::m_path_display_format = wxPATH_UNIX; // trac.wxwidgets.org/ticket/11947
    m_frame->Show();
    m_frame->GetEditor()->SetFocus();

    // filenames had *, ? or other junk so we didn't load them
    if (badFileNames.GetCount())
    {
        wxString msg(_("There was a problem trying to load file(s):\n"));
        for (n = 0; n < badFileNames.GetCount(); n++)
        {
            msg += wxT("'") + badFileNames[n].GetFullPath() + wxT("'\n");

            if ((n > 4) && (n < badFileNames.GetCount()-1))
            {
                msg += wxT("...");
                break;
            }
        }

        wxMessageBox(msg, _("Unable to load file(s)"), wxOK|wxICON_ERROR, m_frame);
    }

    return true;
}