コード例 #1
0
ファイル: Logger.cpp プロジェクト: asarium/wxlauncher
/** Constructor. */
Logger::Logger() {
	wxFileName outFileName(wxStandardPaths::Get().GetUserDataDir(), wxT_2("wxLauncher.log"));
	if (!outFileName.DirExists() && 
		!wxFileName::Mkdir(outFileName.GetPath(), 0700, wxPATH_MKDIR_FULL) ) {
			wxLogFatalError(_("Unable to create folder to place log in. (%s)"), outFileName.GetPath().c_str());
	}

	this->outFile = new wxFFile(outFileName.GetFullPath(), wxT_2("wb"));
	if (!outFile->IsOpened()) {
		wxLogFatalError(_("Unable to open log output file. (%s)"), outFileName.GetFullPath().c_str());
	}
	this->out = new wxFFileOutputStream(*outFile);
	wxASSERT_MSG(out->IsOk(), wxT_2("Log output file is not valid!"));
	this->out->Write("\357\273\277", 3);

	this->statusBar = NULL;
}
コード例 #2
0
bool navlog_viewer_GUI_designApp::OnInit()
{
	// Starting in wxWidgets 2.9.0, we must reset numerics locale to "C",
	//  if we want numbers to use "." in all countries. The App::OnInit() is a perfect place to undo
	//  the default wxWidgets settings. (JL @ Sep-2009)
	wxSetlocale(LC_NUMERIC,wxString(wxT("C")));

	static const wxCmdLineEntryDesc cmdLineDesc[] =
	{
#ifdef MRPT_OS_LINUX
		{wxCMD_LINE_OPTION, wxT_2("l"), wxT_2("load"), wxT_2("load a library"), wxCMD_LINE_VAL_STRING, 0},
#endif
		{wxCMD_LINE_PARAM, nullptr, nullptr, wxT_2("Input File"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL},
		{wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0}
	};

	wxCmdLineParser parser(cmdLineDesc, argc, argv);
	parser.Parse(true);
#ifdef MRPT_OS_LINUX
        wxString libraryPath;
        if(parser.Found(wxT_2("l"), &libraryPath))
		dlopen(libraryPath.mb_str(), RTLD_LAZY);
#endif
	if(parser.GetParamCount() == 1)
		global_fileToOpen = parser.GetParam().mb_str();


	//(*AppInitialize
	bool wxsOK = true;
	wxInitAllImageHandlers();
	if ( wxsOK )
	{
		navlog_viewer_GUI_designDialog* Frame = new navlog_viewer_GUI_designDialog (NULL);
		Frame->Show();
		SetTopWindow(Frame);
		wxsOK = true;
	}
	//*)
	return wxsOK;
}
コード例 #3
0
ファイル: Logger.cpp プロジェクト: asarium/wxlauncher
void Logger::DoLog(
		wxLogLevel level,
		const wxChar *msg,
		time_t time)
{
	wxString timestr = wxDateTime(time).Format(
		wxT_2("%y%j%H%M%S"),
		wxDateTime::GMT0);
#else
void Logger::DoLogRecord(
	wxLogLevel level,
	const wxString& msg,
	const wxLogRecordInfo& info)
{
	wxString timestr = wxDateTime(info.timestamp).Format(
		wxT_2("%y%j%H%M%S"),
		wxDateTime::GMT0);
#endif
	wxString str = wxString::Format(
    wxT_2("%s:%s:"), timestr.c_str(), levels[level].c_str());
	wxString buf(msg);
	out->Write(str.mb_str(wxConvUTF8), str.size());
	out->Write(buf.mb_str(wxConvUTF8), buf.size());
	out->Write("\n", 1);

	if ( this->statusBar != NULL ) {
		if ( level == 1 ) { // error
			this->statusBar->SetMainStatusText(buf, ID_SB_ERROR);
		} else if ( level == 2 ) { // warning
			this->statusBar->SetMainStatusText(buf, ID_SB_WARNING);
		} else if ( level == 3 || level == 4 ) { // message, statubar
			this->statusBar->SetMainStatusText(buf, ID_SB_OK);
		} else if ( level == 5 ) { // info
			this->statusBar->SetMainStatusText(buf, ID_SB_INFO);
		}
	}		
}
コード例 #4
0
ファイル: mmex.cpp プロジェクト: mek-x/moneymanagerex
#include "model/Model_Setting.h"
#include "model/Model_Usage.h"

#include <wx/cmdline.h>
#include <wx/fs_arc.h>
#include <wx/fs_filter.h>
#include <wx/fs_mem.h>

//----------------------------------------------------------------------------
wxIMPLEMENT_APP(mmGUIApp);
//----------------------------------------------------------------------------

static const wxCmdLineEntryDesc g_cmdLineDesc [] =
{
    { wxCMD_LINE_PARAM, nullptr, nullptr, wxT_2("database file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
    { wxCMD_LINE_NONE }
};

//----------------------------------------------------------------------------

mmGUIApp::mmGUIApp(): m_frame(0), m_setting_db(0), m_optParam("")
{
#if wxUSE_ON_FATAL_EXCEPTION
    // catch fatal exceptions
    wxHandleFatalExceptions(true);
#endif
}

wxLocale& mmGUIApp::getLocale()
{
コード例 #5
0
ファイル: app.cpp プロジェクト: Abyss116/luaplus51-all
    }
}

int App::OnExit()
{
    wxDocManager* docManager = wxDocManager::GetDocumentManager();

    docManager->FileHistorySave(*wxConfig::Get());
    delete docManager;
    wxTheClipboard->Flush();
    return wxApp::OnExit();
}

static const wxCmdLineEntryDesc cmdLineDesc[] =
{
    { wxCMD_LINE_PARAM,  wxT_2(""),  wxT_2(""), _("input filename(s)"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_PARAM_MULTIPLE },
    { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 },
};

void App::OnInitCmdLine(wxCmdLineParser& parser)
{
   parser.SetDesc(cmdLineDesc);
   wxApp::OnInitCmdLine(parser);
}

bool App::OnCmdLineParsed(wxCmdLineParser& parser)
{
   for (size_t i = 0; i < parser.GetParamCount(); i++)
   {
      m_cmdLine.m_fileNames.Add(wxFileName(parser.GetParam(i)));
   }
コード例 #6
0
ファイル: eviacamapp.cpp プロジェクト: LocutusOfBorg/eviacam
	// http://www.litwindow.com/knowhow/knowhow.html for more details.
	wxSocketBase::Initialize();

	m_pController= new CViacamController();
	assert (m_pController);
	if (!m_pController->Initialize()) 
	{
		OnExit();
		return false;
	}
	else return true;
}

static const wxCmdLineEntryDesc g_cmdLineDesc [] =
{
     { wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"), wxT_2("displays help on the command line parameters."),
          wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
     { wxCMD_LINE_SWITCH, wxT_2("d"), wxT_2("debug"), wxT_2("debug mode. Print debug messages to the console."),
          wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
      
     { wxCMD_LINE_NONE }
};

void EViacamApp::OnInitCmdLine(wxCmdLineParser& parser)
{
    parser.SetDesc (g_cmdLineDesc);
    // must refuse '/' as parameter starter or cannot use "/path" style paths
    parser.SetSwitchChars (wxT("-"));
}
 
bool EViacamApp::OnCmdLineParsed(wxCmdLineParser& parser)
コード例 #7
0
ファイル: eviacamapp.cpp プロジェクト: BrainTech/eviacam
	wxXmlResource::Get()->InitAllHandlers();
	wxXmlResource::Get()->LoadAllFiles(eviacam::GetDataDir() + wxT("/resources"));

	// Start main controller
	m_pController= new CViacamController();
	if (!m_pController->Initialize()) {
		OnExit();
		return false;
	}
	else
		return true;
}

static const wxCmdLineEntryDesc g_cmdLineDesc [] =
{
     { wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"), wxT_2("displays help on the command line parameters."),
          wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
     { wxCMD_LINE_SWITCH, wxT_2("d"), wxT_2("debug"), wxT_2("debug mode. Print debug messages to the console."),
          wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
     { wxCMD_LINE_OPTION, wxT_2("c"), wxT_2("custom-config"), wxT_2("Use custom configuration file."),
          wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
      
     { wxCMD_LINE_NONE }
};

void EViacamApp::OnInitCmdLine(wxCmdLineParser& parser)
{
    parser.SetDesc (g_cmdLineDesc);
    // must refuse '/' as parameter starter or cannot use "/path" style paths
    parser.SetSwitchChars (wxT("-"));
}
コード例 #8
0
ファイル: Logger.cpp プロジェクト: asarium/wxlauncher
#include <wx/wx.h>
#include <wx/wfstream.h>
#include <wx/datetime.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>

#include <wchar.h>

#include "controls/Logger.h"
#include "controls/StatusBar.h"

#include "global/MemoryDebugging.h"

////// Logger
const wxString levels[] = {
	wxT_2("FATAL"),
	wxT_2("ERROR"),
	wxT_2("WARN "),
	wxT_2("MSG  "),
	wxT_2("STSBR"),
	wxT_2("INFO "),
	wxT_2("DEBUG"),
};
/** Constructor. */
Logger::Logger() {
	wxFileName outFileName(wxStandardPaths::Get().GetUserDataDir(), wxT_2("wxLauncher.log"));
	if (!outFileName.DirExists() && 
		!wxFileName::Mkdir(outFileName.GetPath(), 0700, wxPATH_MKDIR_FULL) ) {
			wxLogFatalError(_("Unable to create folder to place log in. (%s)"), outFileName.GetPath().c_str());
	}
コード例 #9
0
ファイル: main.cpp プロジェクト: srjek/dcpu16
#include <wx/cmdline.h>
#include "wx/wx.h"

#include "freeglut.h"
#include "emulation.h"
#include "cpus/cpus.h"
#include "devices/devices.h"

#include <wx/cmdline.h>
#include "wx/wx.h"
#include "main.h"

static const wxCmdLineEntryDesc g_cmdLineDesc [] =
{
    {   wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"), wxT_2("displays help on the command line parameters"),
        wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
    },
    { wxCMD_LINE_SWITCH, NULL, wxT_2("image"), wxT_2("Disables a cpu's boot sequence, instead loading the specified image into ram directly.")},
    { wxCMD_LINE_SWITCH, NULL, wxT_2("debug"), wxT_2("May enable debug options on the last specified cpu or device")},
    { wxCMD_LINE_SWITCH, NULL, wxT_2("gdb"), wxT_2("Last cpu will host a gdb remote server.")},
    CPUS_CMDLINE_HELP
    DEVICES_CMDLINE_HELP
    { wxCMD_LINE_PARAM, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE },
    { wxCMD_LINE_NONE }
};

class masterWindow: public wxFrame {
    emulatorApp* app;
public:
    masterWindow(emulatorApp* app, const wxPoint& pos);
コード例 #10
0
ファイル: CslApp.cpp プロジェクト: aurhat/cubelister
bool CslApp::OnInit()
{
    SetAppName(wxString(CSL_NAME_SHORT_STR).Lower());

#if defined(__WXMSW__)
    wxCrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif

#if CSL_DEBUG < 1
#if wxUSE_DEBUGREPORT && wxUSE_ON_FATAL_EXCEPTION
    ::wxHandleFatalExceptions(true);
#endif
#endif

    wxString ipcCmd;
    const wxString cwd = ::DirName(::wxPathOnly(argv[0]));

    static const wxCmdLineEntryDesc cmdLineDesc[] =
    {
        { wxCMD_LINE_SWITCH, NULL,       wxT_2("version"),   wxTRANSLATE("show version"),   wxCMD_LINE_VAL_NONE,   0                         },
        { wxCMD_LINE_SWITCH, wxT_2("h"), wxT_2("help"),      wxTRANSLATE("show this help"), wxCMD_LINE_VAL_NONE,   wxCMD_LINE_OPTION_HELP    },
        { wxCMD_LINE_OPTION, wxT_2("d"), wxT_2("datadir"),   wxTRANSLATE("add data dir"),   wxCMD_LINE_VAL_STRING, 0                         },
        { wxCMD_LINE_OPTION, wxT_2("p"), wxT_2("plugindir"), wxTRANSLATE("add plugin dir"), wxCMD_LINE_VAL_STRING, 0                         },
        { wxCMD_LINE_OPTION, wxT_2("q"), wxT_2("homedir"),   wxTRANSLATE("set home dir"),   wxCMD_LINE_VAL_STRING, 0                         },
        { wxCMD_LINE_PARAM,  NULL,       NULL,               wxTRANSLATE("IPC command"),    wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_NONE                                                                                                                    }
    };

    wxString sOpt;
    wxCmdLineParser parser(cmdLineDesc, argc, argv);

    switch (parser.Parse())
    {
        case -1: // help
            return true;

        case 0:
            if (parser.Found(wxT("version")))
            {
                wxPrintf(wxT("%s\n"), CSL_VERSION_STR);
                return true;
            }
            if (parser.Found(wxT("q"), &sOpt))
                m_home = ::DirName(sOpt, cwd);
            if (parser.Found(wxT("d"), &sOpt))
                AddDataDir(sOpt, cwd);
            if (parser.Found(wxT("p"), &sOpt))
                AddPluginDir(sOpt, cwd);
            break;

        default: // syntax error
            return true;
    }

    if (parser.GetParamCount())
        ipcCmd = parser.GetParam(0);

    if (m_home.IsEmpty())
        m_home = ::DirName(wxStandardPaths::Get().GetUserDataDir());

    if (!wxFileName::DirExists(m_home))
    {
        if (!wxFileName::Mkdir(m_home, 0700, wxPATH_MKDIR_FULL))
        {
            wxMessageBox(wxString::Format(_("Failed to create the home dir '%s'."),
                                          m_home.c_str()),
                         _("Fatal error!"), wxICON_ERROR);
            return false;
        }
    }
    else if (!wxFileName::IsDirWritable(m_home))
    {
        wxMessageBox(wxString::Format(_("Home dir '%s' isn't writable."),
                                      m_home.c_str()),
                     _("Fatal error!"), wxICON_ERROR);
        return false;
    }

    CSL_LOG_DEBUG("using home dir: %s\n", U2C(m_home));

    AddDataDir(m_home, cwd);
#ifdef PROJECTDIR
    if (::wxDirExists(wxT(PROJECTDIR)))
        AddDataDir(wxT(PROJECTDIR), cwd);
#endif
#ifdef __WXMAC__
    AddDataDir(wxT("../Resources"), cwd);
#else
    AddDataDir(cwd);
#endif
#ifdef DATADIR
    if (cwd!=m_home)
        AddDataDir(wxT(DATADIR), cwd);
#endif

    AddPluginDir(m_home, cwd);
#ifdef __WXMAC__
    AddPluginDir(wxT(".."), cwd);
#else
    AddPluginDir(cwd);
#endif
#ifdef BUILDDIR
    if (::wxDirExists(wxT(BUILDDIR)))
        AddPluginDir(wxT(BUILDDIR), cwd);
#endif
#ifdef PKGLIBDIR
    if (cwd!=m_home)
        AddPluginDir(wxT(PKGLIBDIR));
#endif

    m_locale.Init(wxLANGUAGE_DEFAULT,
#if wxCHECK_VERSION(2, 9, 0)
                  wxLOCALE_LOAD_DEFAULT
#else
                  wxLOCALE_CONV_ENCODING
#endif //wxCHECK_VERSION
                 );

#ifndef LOCALEDIR
#ifdef __WXMSW__
    m_locale.AddCatalogLookupPathPrefix(cwd+wxT("\\locale"));
#else
#ifdef __WXMAC__
    m_locale.AddCatalogLookupPathPrefix(cwd+wxT("../Resources"));
#endif //__WXMAC__
#endif //__WXMSW__
#else
    m_locale.AddCatalogLookupPathPrefix(wxT(LOCALEDIR));
#endif //LOCALEDIR

    if (m_locale.AddCatalog(wxString(CSL_NAME_SHORT_STR).Lower()))
        m_lang=m_locale.GetCanonicalName();

#ifdef __WXMAC__
    wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), 1);

    // enables Command-H, Command-M and Command-Q at least when not in fullscreen
    wxSetEnv(wxT("SDL_SINGLEDISPLAY"),wxT("1"));
    wxSetEnv(wxT("SDL_ENABLEAPPEVENTS"),wxT("1"));

    // TODO wxApp::SetExitOnFrameDelete(false);

    // register event handler for URI schemes
    AEInstallEventHandler(kInternetEventClass, kAEGetURL,
                          NewAEEventHandlerUPP((AEEventHandlerProcPtr)MacCallbackGetUrl),
                          0, false);
#endif //__WXMAC__

    m_single = new wxSingleInstanceChecker;

    wxString lock = wxString::Format(wxT("%s-%s.%s"), CSL_NAME_SHORT_STR, wxGetUserId().c_str(),
#ifdef __WXMSW__
                                     GetHomeDir(wxPATH_UNIX).c_str()
#else
                                     wxT("lock")
#endif
                                    ).Lower();

    if (m_single->Create(lock, m_home) && m_single->IsAnotherRunning())
    {
        IpcCall(ipcCmd.IsEmpty() ? wxT("show") : ipcCmd);
        return true;
    }

    m_engine = new CslEngine;

    wxInitAllImageHandlers();

    CslFrame* frame = new CslFrame;

    if (m_shutdown!=CSL_SHUTDOWN_NONE)
        return true;

    SetTopWindow(frame);
    frame->Show();

    if (!ipcCmd.IsEmpty())
        IpcCall(ipcCmd, frame);

    return true;
}
コード例 #11
0
ファイル: wxstedit.cpp プロジェクト: brkpt/luaplus51-all
enum wxCmdLineEntries_Type
{
    CMDLINE_PARAM_SINGLE,
    CMDLINE_PARAM_RECURSE,
    CMDLINE_PARAM_CONFIG,
    CMDLINE_PARAM_FILENAMES,
    CMDLINE_PARAM_LANG,
    CMDLINE_PARAM_LANGDIALOG,
    CMDLINE_PARAM__COUNT
};


static const wxCmdLineEntryDesc cmdLineDesc[] =
{
    { wxCMD_LINE_SWITCH, wxT_2("1"), wxT_2("single"), wxT_2("Single file mode"),
        wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },

    { wxCMD_LINE_SWITCH, wxT_2("r"), wxT_2("recurse"), wxT_2("Recursively open the given file patterns, quote wildcards \"*.txt\""),
        wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },

    { wxCMD_LINE_OPTION, wxT_2("c"), wxT_2("config"), wxT_2("Use the wxStEdit configuration file"),
        wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_NEEDS_SEPARATOR },

    { wxCMD_LINE_PARAM,  wxT_2(""),  wxT_2(""),       wxT_2("Input filename(s)"),
        wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_PARAM_MULTIPLE },

    { wxCMD_LINE_OPTION, wxT_2("l"), wxT_2("lang"),      wxT_2("Specify language"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
    { wxCMD_LINE_SWITCH, NULL,       wxT_2("langdialog"), wxT_2("Language dialog"), wxCMD_LINE_VAL_NONE,   wxCMD_LINE_PARAM_OPTIONAL },

    { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 },