示例#1
0
void GraphicsContextDrawingTestCase::RunPluginsDrawingCase (
    const DrawingTestCase & testCase)
{
    if (!m_drawingPluginsLoaded)
    {
        m_drawingPluginsLoaded = true;

        wxString pluginsListStr;
        if (!wxGetEnv ("WX_TEST_SUITE_GC_DRAWING_PLUGINS", &pluginsListStr))
            return; // no plugins

        wxArrayString pluginsNameArray = wxSplit (pluginsListStr, ',', '\0');
        m_drawingPlugins.resize (pluginsNameArray.size());

        for (size_t idx=0; idx<pluginsNameArray.size(); ++idx)
        {
            PluginInfo &pluginBeingLoaded = m_drawingPlugins[idx];
            pluginBeingLoaded.library = new wxDynamicLibrary;
            if (!pluginBeingLoaded.library->Load (pluginsNameArray[idx]))
            {
                wxLogFatalError("could not load drawing plugin %s",
                    pluginsNameArray[idx]);
                return;
            }

            wxDYNLIB_FUNCTION(CreateDrawingTestLifeCycleFunction,
                CreateDrawingTestLifeCycle, *pluginBeingLoaded.library);
            wxDYNLIB_FUNCTION(DestroyDrawingTestLifeCycleFunction,
                DestroyDrawingTestLifeCycle, *pluginBeingLoaded.library);

            if (!pfnCreateDrawingTestLifeCycle ||
                !pfnDestroyDrawingTestLifeCycle)
            {
                wxLogFatalError("could not find function"
                    " CreateDrawingTestLifeCycle or "
                    "DestroyDrawingTestLifeCycle in %s", pluginsNameArray[idx]);
                return;
            }

            pluginBeingLoaded.destroy = pfnDestroyDrawingTestLifeCycle;
            pluginBeingLoaded.gcFactory = (*pfnCreateDrawingTestLifeCycle)();
            if (!pluginBeingLoaded.gcFactory)
            {
                wxLogFatalError("failed to create life-cycle object in %s",
                    pluginsNameArray[idx]);
                return;
            }
        }
    }

    // now execute the test case for each plugin
    for (size_t idxp=0; idxp<m_drawingPlugins.size(); ++idxp)
    {
        RunIndividualDrawingCase (*m_drawingPlugins[idxp].gcFactory, testCase);
    }
}
示例#2
0
void SjCol::AddRow(SjRow* row)
{
	wxASSERT(m_rowCount <= m_rowMaxCount);

	if( m_rowCount == m_rowMaxCount )
	{
		SjRow** oldRows = m_rows;

		m_rowMaxCount = m_rowMaxCount*2;
		if( m_rowMaxCount < 32 ) m_rowMaxCount = 32;
		m_rows = new SjRow*[m_rowMaxCount];
		if( m_rows == NULL )
		{
			wxLogFatalError("Out of memory on allocating rows.");
		}

		if( oldRows )
		{
			long i;
			for( i = 0; i < m_rowCount; i++ )
			{
				m_rows[i] = oldRows[i];
			}
			delete [] oldRows;
		}
	}

	row->m_col = this;
	m_rows[m_rowCount] = row;
	m_rowCount++;
}
示例#3
0
QueryThread::QueryThread(wxEvtHandler* EventHandler) : wxThread(wxTHREAD_JOINABLE), m_EventHandler(EventHandler)
{
	if(Create() != wxTHREAD_NO_ERROR)
		wxLogFatalError("Could not create worker thread!");

	wxThread::Run();
}
示例#4
0
void gravUtil::logFatalError( const char* str, ... )
{
    va_list args;
    va_start( args, str );
    wxLogFatalError( getWXStringFromArgs( str, args ) );
    va_end( args );
}
示例#5
0
/* static */
bool wxAppConsoleBase::CheckBuildOptions(const char *optionsSignature,
                                         const char *componentName)
{
#if 0 // can't use wxLogTrace, not up and running yet
    printf("checking build options object '%s' (ptr %p) in '%s'\n",
             optionsSignature, optionsSignature, componentName);
#endif

    if ( strcmp(optionsSignature, WX_BUILD_OPTIONS_SIGNATURE) != 0 )
    {
        wxString lib = wxString::FromAscii(WX_BUILD_OPTIONS_SIGNATURE);
        wxString prog = wxString::FromAscii(optionsSignature);
        wxString progName = wxString::FromAscii(componentName);
        wxString msg;

        msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
                   lib.c_str(), progName.c_str(), prog.c_str());

        wxLogFatalError(msg.c_str());

        // normally wxLogFatalError doesn't return
        return false;
    }

    return true;
}
示例#6
0
/** 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;
}
示例#7
0
KIFACE_I& Kiface()
{
    // This function should never be called.  It is only referenced from
    // EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
    // not to be actually called.
    wxLogFatalError( wxT( "Unexpected call to Kiface() in kicad/kicad.cpp" ) );

    return (KIFACE_I&) *(KIFACE_I*) 0;
}
bool muhkuh_wrap_xml::initialize(wxInputStream *pStream, size_t sizRepositoryIdx, size_t sizTestIdx)
{
	bool fOk;
	wxXmlDocument *xmldoc;


	// set the test ids
        m_sizRepositoryIdx = sizRepositoryIdx;
	m_sizTestIdx = sizTestIdx;

	// assume failure
	fOk = false;

	// create the new xml document
	xmldoc = new wxXmlDocument();
	if( xmldoc==NULL )
	{
		// failed to create the new xml document
		wxLogFatalError(_("could not create xml object"));
	}
	else
	{
		// xml document created -> load the xml file
		if( xmldoc->Load(*pStream)!=true )
		{
			// failed to load the xml file
			wxLogError(_("failed to load the test description from the input stream"));
			delete xmldoc;
		}
		else
		{
			// xml file loaded -> interpret the data
			if( readTestDescription(xmldoc)!=true )
			{
				// strange test description
				wxLogError(_("could not read test"));
				delete xmldoc;
			}
			else
			{
				// ok
				fOk = true;
				m_xml_doc = xmldoc;
			}
		}
	}

	return fOk;
}
示例#9
0
// CreateBox:
//  Creates a box in x, y, either taking it from the list
//  of available boxes, or allocating a new one.
//
LifeCellBox* Life::CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv)
{
    LifeCellBox *c;

    // if there are no available boxes, alloc a few more
    if (!m_available)
        for (int i = 1; i <= ALLOCBOXES; i++)
        {
            c = new LifeCellBox();

            if (!c)
            {
                // TODO: handle memory errors. Note that right now, if we
                // couldn't allocate at least one cellbox, we will crash
                // before leaving CreateBox(). Probably we should try to
                // allocate some boxes *before* the m_available list goes
                // empty, so that we have a margin to handle errors
                // gracefully.
                wxLogFatalError(_("Out of memory! Aborting..."));

                // NOTREACHED
            }

            c->m_next = m_available;
            m_available = c;
        }

    // take a cellbox from the list of available boxes
    c = m_available;
    m_available = c->m_next;

    // reset everything
    memset((void *) c, 0, sizeof(LifeCellBox));
    c->m_x = x;
    c->m_y = y;

    // insert c in the list
    c->m_next = m_head;
    m_head = c;
    if (c->m_next) c->m_next->m_prev = c;

    // insert c in the hash table
    c->m_hnext = m_boxes[hv];
    m_boxes[hv] = c;
    if (c->m_hnext) c->m_hnext->m_hprev = c;

    return c;
}
示例#10
0
void wxWindowMGL::Init()
{
    // First of all, make sure window manager is up and running. If it is
    // not the case, initialize it in default display mode
    if ( !g_winMng )
    {
        if ( !wxTheApp->SetDisplayMode(wxGetDefaultDisplayMode()) )
        {
            wxLogFatalError(_("Cannot initialize display."));
        }
    }

    // mgl specific:
    m_wnd = NULL;
    m_isShown = true;
    m_paintMGLDC = NULL;
    m_eraseBackground = -1;
}
示例#11
0
void FbMasterDatabase::UpgradeDatabase(int new_version)
{
	if (IsReadOnly()) return;

	FbSQLite3Transaction trans(this, WXSQLITE_TRANSACTION_IMMEDIATE);
	int version = GetVersion();
	while ( version < new_version ) {
		version++;
		wxLogVerbose(_("Upgrade database to version %d"), version);
		DoUpgrade(version);
		SetVersion(version);
	}
	trans.Commit();

	int old_version = GetVersion();
	if (old_version != new_version) {
		wxString msg = _("Database version mismatch");
		wxMessageBox(msg, MyRuLib::ProgramName(), wxOK | wxICON_ERROR);
		wxLogError(msg);
		wxLogFatalError(_("Need a new version %d, but used the old %d."), new_version, old_version);
	}
}
示例#12
0
void WBinaryPage::PageSaveData()
{
    if (needsave)
    {
        try {
            wmain->container.SetSubFileData(subfileid, bindata.GetData(), bindata.GetDataLen());
        }
        catch (Enctain::Exception& e)
        {
            wxLogFatalError(WCryptoTE::EnctainExceptionString(e));
            return;
        }

        wmain->container.SetSubFileProperty(subfileid, "MTime", strTimeStampNow());

        size_t savelen = wmain->container.GetSubFileStorageSize(subfileid);

        if (savelen != bindata.GetDataLen())
        {
            UpdateStatusBar(
                wxString::Format(_("Compressed %u bytes from buffer into %u bytes for encrypted storage."),
                                 bindata.GetDataLen(), savelen)
                );
        }
        else
        {
            UpdateStatusBar(
                wxString::Format(_("Saving %u bytes from buffer for encrypted storage."),
                                 bindata.GetDataLen())
                );
        }

        wmain->SetModified();
        wmain->filelistpane->UpdateItem(subfileid);

        needsave = false;
    }
}
示例#13
0
void GamessQFrame::CreateControls()
{    
////@begin GamessQFrame content construction
    GamessQFrame* itemFrame1 = this;

    wxMenuBar* menuBar = new wxMenuBar;
    AppMenu = new wxMenu;
    AppMenu->Append(wxID_PREFERENCES, _("&Preferences"), _("Change the way GamessQ behaves"), wxITEM_NORMAL);
    AppMenu->Append(ID_PAUSEALL, _("&Pause All"), _("Pause Everything"), wxITEM_CHECK);
    AppMenu->AppendSeparator();
    AppMenu->Append(wxID_EXIT, _("E&xit"), _("Exit GamessQ"), wxITEM_NORMAL);
    menuBar->Append(AppMenu, _("&Queue"));
    jobsMenu = new wxMenu;
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_ADD, _("&Add Jobs\tCtrl+A"), _("Add new GAMESS jobs to the end of the queue"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_REMOVE, _("Remove Jobs"), _("Remove the selected GAMESS jobs from the queue"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CANCEL, _("&Cancel Jobs"), _("Cancel the selected GAMESS jobs"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_PAUSE, _("&Pause Jobs\tCtrl+P"), _("Pause the selected GAMESS jobs"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_RESUME, _("&Resume Jobs\tCtrl+R"), _("Resume the selected paused GAMESS jobs"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEFOLDER, _("Save Output to Folder\tCtrl+S"), _("Save GAMESS output for selected jobs to a folder"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSave")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEAS, _("Save Output As..."), _("Save GAMESS output for this job"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSaveAs")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->Append(ID_MACMOLPLT, _("Open in wxMacMolPlt\tCtrl+O"), _T(""), wxITEM_NORMAL);
    jobsMenu->Append(ID_VIEWLOGS, _("View &Logs"), _("View the GAMESS log files for the selected jobs"), wxITEM_NORMAL);
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_REFRESH, _("Refresh\tAlt-R"), _("Refresh the display of the queue status"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CLEAR, _("Clean Up"), _("Clear all finished GAMESS jobs from the queue"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    menuBar->Append(jobsMenu, _("&Jobs"));
    
    //Yes this is a complete copy of the menu that was just added to the Menubar. At least in
    //wx 3.0 wx throws an assertion saying that a popupmenu is not supposed to be attached to
    //another menu or menubar. So after attaching the previous copy recreate it. The copy
    //attached to the menu is now "owned" by the Menu/window.
    
    jobsMenu = new wxMenu;
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_ADD, _("&Add Jobs\tCtrl+A"), _("Add new GAMESS jobs to the end of the queue"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_REMOVE, _("Remove Jobs"), _("Remove the selected GAMESS jobs from the queue"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CANCEL, _("&Cancel Jobs"), _("Cancel the selected GAMESS jobs"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_PAUSE, _("&Pause Jobs\tCtrl+P"), _("Pause the selected GAMESS jobs"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_RESUME, _("&Resume Jobs\tCtrl+R"), _("Resume the selected paused GAMESS jobs"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEFOLDER, _("Save Output to Folder\tCtrl+S"), _("Save GAMESS output for selected jobs to a folder"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSave")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEAS, _("Save Output As..."), _("Save GAMESS output for this job"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSaveAs")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->Append(ID_MACMOLPLT, _("Open in wxMacMolPlt\tCtrl+O"), _T(""), wxITEM_NORMAL);
    jobsMenu->Append(ID_VIEWLOGS, _("View &Logs"), _("View the GAMESS log files for the selected jobs"), wxITEM_NORMAL);
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_REFRESH, _("Refresh\tAlt-R"), _("Refresh the display of the queue status"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }
    jobsMenu->AppendSeparator();
    {
        wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CLEAR, _("Clean Up"), _("Clear all finished GAMESS jobs from the queue"), wxITEM_NORMAL);
        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-16.png")));
        menuItem->SetBitmap(bitmap);
        jobsMenu->Append(menuItem);
    }

    wxMenu* itemMenu24 = new wxMenu;
    itemMenu24->Append(wxID_ABOUT, _("&About"), _T(""), wxITEM_NORMAL);
    menuBar->Append(itemMenu24, _("&Help"));
    itemFrame1->SetMenuBar(menuBar);

    jobsToolbar = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL|wxTB_TEXT|wxTB_NODIVIDER, ID_TOOLBAR1 );
    jobsToolbar->SetToolBitmapSize(wxSize(24, 24));
    wxBitmap itemtool27Bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-24.png")));
    wxBitmap itemtool27BitmapDisabled;
    jobsToolbar->AddTool(wxID_ADD, _("Add"), itemtool27Bitmap, itemtool27BitmapDisabled, wxITEM_NORMAL, _T(""), _("Add a new GAMESS jobs to the end of the queue"));
    wxBitmap itemtool28Bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-24.png")));
    wxBitmap itemtool28BitmapDisabled;
    jobsToolbar->AddTool(wxID_REMOVE, _("Remove"), itemtool28Bitmap, itemtool28BitmapDisabled, wxITEM_NORMAL, _T(""), _("Remove the selected GAMESS jobs from the queue"));
    jobsToolbar->AddSeparator();
    wxBitmap itemtool30Bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-24.png")));
    wxBitmap itemtool30BitmapDisabled;
    jobsToolbar->AddTool(wxID_CANCEL, _("Cancel"), itemtool30Bitmap, itemtool30BitmapDisabled, wxITEM_NORMAL, _T(""), _("Cancel the selected GAMESS jobs"));
    wxBitmap itemtool31Bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-24.png")));
    wxBitmap itemtool31BitmapDisabled;
    jobsToolbar->AddTool(ID_PAUSE, _("Pause"), itemtool31Bitmap, itemtool31BitmapDisabled, wxITEM_NORMAL, _T(""), _("Pause the selected GAMESS jobs"));
    wxBitmap itemtool32Bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-24.png")));
    wxBitmap itemtool32BitmapDisabled;
    jobsToolbar->AddTool(ID_RESUME, _("Resume"), itemtool32Bitmap, itemtool32BitmapDisabled, wxITEM_NORMAL, _T(""), _("Resume the selected paused GAMESS jobs"));
    jobsToolbar->AddSeparator();
    wxBitmap itemtool34Bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-24.png")));
    wxBitmap itemtool34BitmapDisabled;
    jobsToolbar->AddTool(ID_REFRESH, _("Refresh"), itemtool34Bitmap, itemtool34BitmapDisabled, wxITEM_NORMAL, _T(""), _("Refresh the display of the queue status"));
    jobsToolbar->AddSeparator();
    wxBitmap itemtool36Bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-24.png")));
    wxBitmap itemtool36BitmapDisabled;
    jobsToolbar->AddTool(wxID_CLEAR, _("Clean Up"), itemtool36Bitmap, itemtool36BitmapDisabled, wxITEM_NORMAL, _T(""), _("Clear all finished GAMESS jobs from the queue"));
    jobsToolbar->Realize();
    itemFrame1->SetToolBar(jobsToolbar);

    wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL);
    itemFrame1->SetSizer(itemBoxSizer37);

    jobListCtrl = new wxListCtrl( itemFrame1, ID_JOBLISTCTRL, wxDefaultPosition, wxSize(590, 300), wxLC_REPORT|wxLC_EDIT_LABELS|wxLC_HRULES|wxLC_VRULES|wxSUNKEN_BORDER );
    itemBoxSizer37->Add(jobListCtrl, 1, wxGROW|wxALL, 0);

    wxStatusBar* itemStatusBar39 = new wxStatusBar( itemFrame1, ID_STATUSBAR1, wxNO_BORDER );
    itemStatusBar39->SetFieldsCount(1);
    itemFrame1->SetStatusBar(itemStatusBar39);

////@end GamessQFrame content construction

	// create the dialog objects
	mConfigDialog = new ConfigurationDialog(this);
	mJobOptionsDialog = new JobOptionsDialog(this);
	
	// initiate the queue manager, if this fails, we're toast
	if (! mQueueManager.Init()) {
		wxLogFatalError(wxT("Failed to start the backend!"));
	}
	mActive = mQueueManager.IsActive();
	AppMenu->Check(ID_PAUSEALL, ! mActive);

	// load settings
	mConfig = new wxConfig(WX_CONFIG_APPNAME);
	wxString stringFreq;
	long freq;
	if (mConfig->Read(wxT("Refresh Frequency"), &freq)) {
		mRefreshFrequency = freq;
	} else {
		mConfigDialog->SetRefreshFrequency(mRefreshFrequency / 1000);
		mConfigDialog->SetGamessPath(mQueueManager.GetGamessDir());
		mConfigDialog->SetSpoolDir(mQueueManager.GetSpoolDir());
		mConfigDialog->Show();
	}

	// start the timer
	mRefreshTimer = new wxTimer(this, ID_TIMER);
	mRefreshTimer->Start(mRefreshFrequency, wxTIMER_ONE_SHOT);

	// set up the queue list
	jobListCtrl->InsertColumn(0, wxT("Name"));
	jobListCtrl->InsertColumn(1, wxT("Processors"));
	jobListCtrl->InsertColumn(2, wxT("Status"));
	jobListCtrl->SetColumnWidth(0, 400);
	jobListCtrl->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER);
	jobListCtrl->SetColumnWidth(2, 80);

	RefreshList();
	RefreshButtons();
	SetDropTarget(new DropTarget(this));
}
示例#14
0
/** Thread body.  Accepts SSL connections and adds peers as they connect */
wxThread::ExitCode RAIN::ConnectionListener::Entry()
{
	BIO *listener, *client;
	SSL *client_ssl;
	SSL_CTX* ssl_ctx = globalCredentialManager->GetSSLContext();

	wxLogVerbose(wxT("starting up RAIN::ConnectionListener; ssl_ctx = %08x"), ssl_ctx);

	listener = BIO_new_accept(DEFAULT_ACCEPT_STR);

	if (!listener)
	{
		wxLogError("Server socket creation failed");
		return NULL;
	}

	/* set listener to be non blocking - needed for
	 * this thread's proper behaviour with timely exiting 
	 * 
	 * also set BIO_BIND_REUSEADDR */
	// broken in gcc severely
	const char a[] = "a";
	BIO_ctrl(listener, BIO_C_SET_ACCEPT, 1, (void*)a);
	BIO_set_bind_mode(listener, BIO_BIND_REUSEADDR);

	// now bind the port
	if (BIO_do_accept(listener) <= 0)
	{
		wxLogError("Server socket binding failed");
		BIO_free_all(listener);
		return NULL;
	}

	while (true)
	{
		if (this->GetThread()->TestDestroy())
		{
			wxLogVerbose("RAIN::ConnectionListener thread finishing");
			BIO_free_all(listener);
			return NULL;
		} else {
			//wxLogVerbose("RAIN::ConnectionListener thread continuing");
		}

		if (BIO_do_accept(listener) > 0)
		{
			// there's a connection waiting to be accepted
			client = BIO_pop(listener);

			if (!(client_ssl = SSL_new(ssl_ctx)))
			{
				wxLogFatalError("RAIN::ConnectionListener - Error creating new SSL connection from context");
				BIO_free_all(client);
				BIO_free_all(listener);
				return NULL;
			} else {
				SSL_set_bio(client_ssl, client, client);

				int sa_ret = SSL_accept(client_ssl);
				int SSLge = SSL_get_error(client_ssl, sa_ret);
				int runawayGuard = 15;

				while (runawayGuard-- && sa_ret == -1 && (SSLge == SSL_ERROR_SSL || SSLge == SSL_ERROR_WANT_READ || SSLge == SSL_ERROR_WANT_WRITE))
				{
					/* the handshaking occurs in a non-blocking way, the underlying bio 'client'
					 * inherits the listener's non-blockingness */
					sa_ret = SSL_accept(client_ssl);
					SSLge = SSL_get_error(client_ssl, sa_ret);
					wxThread::Sleep(1000);
				}

				if (runawayGuard < 1 || sa_ret <= 0)
				{
					SSL_free(client_ssl);

					if (runawayGuard < 1)
						wxLogError("RAIN::ConnectionListener - Timeout while handshaking for new SSL connection");
					else
						wxLogError("RAIN::ConnectionListener - Error accepting new SSL connection: ssl_accept returned %d; ssl_get_error returned %d", sa_ret, SSLge);
				} else {
					wxLogVerbose("RAIN::ConnectionListener - SSL_accept succeeded");

					RAIN::Connection *nc = new RAIN::Connection(client_ssl);
					this->connectionPool->AddServedPeer(nc);
				}
			}
		}

		wxThread::Sleep(2000);
	}
}
示例#15
0
bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
                                     wxNativeEncodingInfo *info,
                                     const wxString& facename,
                                     bool interactive)
{
#if wxUSE_GUI
    // we need a flag to prevent infinite recursion which happens, for
    // example, when GetAltForEncoding() is called from an OnPaint() handler:
    // in this case, wxYield() which is called from wxMessageBox() we use here
    // will lead to another call of OnPaint() and hence to another call of
    // GetAltForEncoding() -- and it is impossible to catch this from the user
    // code because we are called from wxFont ctor implicitly.

    // assume we're always called from the main thread, so that it is safe to
    // use a static var
    static bool s_inGetAltForEncoding = false;

    if ( interactive && s_inGetAltForEncoding )
        return false;

    ReentrancyBlocker blocker(s_inGetAltForEncoding);
#endif // wxUSE_GUI

    wxCHECK_MSG( info, false, wxT("bad pointer in GetAltForEncoding") );

    info->facename = facename;

    if ( encoding == wxFONTENCODING_DEFAULT )
    {
        encoding = wxFont::GetDefaultEncoding();
    }

    // if we failed to load the system default encoding, something is really
    // wrong and we'd better stop now -- otherwise we will go into endless
    // recursion trying to create the font in the msg box with the error
    // message
    if ( encoding == wxFONTENCODING_SYSTEM )
    {
        wxLogFatalError(_("can't load any font, aborting"));

        // wxLogFatalError doesn't return
    }

    wxString configEntry,
             encName = GetEncodingName(encoding);
    if ( !facename.empty() )
    {
        configEntry = facename + wxT("_");
    }
    configEntry += encName;

#if wxUSE_CONFIG && wxUSE_FILECONFIG
    // do we have a font spec for this encoding?
    wxString fontinfo;
    wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH);
    if ( path.IsOk() )
    {
        fontinfo = GetConfig()->Read(configEntry);
    }

    // this special value means that we don't know of fonts for this
    // encoding but, moreover, have already asked the user as well and he
    // didn't specify any font neither
    if ( fontinfo == FONTMAPPER_FONT_DONT_ASK )
    {
        interactive = false;
    }
    else // use the info entered the last time
    {
        if ( !fontinfo.empty() && !facename.empty() )
        {
            // we tried to find a match with facename -- now try without it
            fontinfo = GetConfig()->Read(encName);
        }

        if ( !fontinfo.empty() )
        {
            if ( info->FromString(fontinfo) )
            {
                if ( wxTestFontEncoding(*info) )
                {
                    // ok, got something
                    return true;
                }
                //else: no such fonts, look for something else
                //      (should we erase the outdated value?)
            }
            else
            {
                wxLogDebug(wxT("corrupted config data: string '%s' is not a valid font encoding info"),
                           fontinfo);
            }
        }
        //else: there is no information in config about this encoding
    }
#endif // wxUSE_CONFIG

    // now try to map this encoding to a compatible one which we have on this
    // system
    wxFontEncodingArray equiv = wxEncodingConverter::GetAllEquivalents(encoding);
    size_t count = equiv.GetCount();
    bool foundEquivEncoding = false;
    wxFontEncoding equivEncoding = wxFONTENCODING_SYSTEM;
    if ( count )
    {
        for ( size_t i = 0; i < count && !foundEquivEncoding; i++ )
        {
            // don't test for encoding itself, we already know we don't have it
            if ( equiv[i] == encoding )
                continue;

            if ( TestAltEncoding(configEntry, equiv[i], info) )
            {
                equivEncoding = equiv[i];

                foundEquivEncoding = true;
            }
        }
    }

    // ask the user
#if wxUSE_FONTDLG
    if ( interactive )
    {
        wxString title(m_titleDialog);
        if ( !title )
            title << wxTheApp->GetAppDisplayName() << _(": unknown encoding");

        // built the message
        wxString encDesc = GetEncodingDescription(encoding),
                 msg;
        if ( foundEquivEncoding )
        {
            // ask the user if he wants to override found alternative encoding
            msg.Printf(_("No font for displaying text in encoding '%s' found,\nbut an alternative encoding '%s' is available.\nDo you want to use this encoding (otherwise you will have to choose another one)?"),
                       encDesc, GetEncodingDescription(equivEncoding));
        }
        else
        {
            msg.Printf(_("No font for displaying text in encoding '%s' found.\nWould you like to select a font to be used for this encoding\n(otherwise the text in this encoding will not be shown correctly)?"),
                       encDesc);
        }

        // the question is different in 2 cases so the answer has to be
        // interpreted differently as well
        int answer = foundEquivEncoding ? wxNO : wxYES;

        if ( wxMessageBox(msg, title,
                          wxICON_QUESTION | wxYES_NO,
                          m_windowParent) == answer )
        {
            wxFontData data;
            data.SetEncoding(encoding);
            data.EncodingInfo() = *info;
            wxFontDialog dialog(m_windowParent, data);
            if ( dialog.ShowModal() == wxID_OK )
            {
                wxFontData retData = dialog.GetFontData();

                *info = retData.EncodingInfo();
                info->encoding = retData.GetEncoding();

#if wxUSE_CONFIG && wxUSE_FILECONFIG
                // remember this in the config
                wxFontMapperPathChanger path2(this,
                                              FONTMAPPER_FONT_FROM_ENCODING_PATH);
                if ( path2.IsOk() )
                {
                    GetConfig()->Write(configEntry, info->ToString());
                }
#endif // wxUSE_CONFIG

                return true;
            }
            //else: the user canceled the font selection dialog
        }
        else
        {
            // the user doesn't want to select a font for this encoding
            // or selected to use equivalent encoding
            //
            // remember it to avoid asking the same question again later
#if wxUSE_CONFIG && wxUSE_FILECONFIG
            wxFontMapperPathChanger path2(this,
                                          FONTMAPPER_FONT_FROM_ENCODING_PATH);
            if ( path2.IsOk() )
            {
                GetConfig()->Write
                             (
                                configEntry,
                                foundEquivEncoding
                                    ? (const wxChar*)info->ToString().c_str()
                                    : FONTMAPPER_FONT_DONT_ASK
                             );
            }
#endif // wxUSE_CONFIG
        }
    }
    //else: we're in non-interactive mode
#else
    wxUnusedVar(equivEncoding);
#endif // wxUSE_FONTDLG

    return foundEquivEncoding;
}
示例#16
0
int main(int argc, char *argv[])
{
	wxArrayString output;
	wxArrayString errors;

	printf("module wx.libs;\n"); 

	wxString wxConfig = wxT("wx-config");
	wxGetEnv(wxT("WX_CONFIG"), &wxConfig);

	wxString command = wxConfig.Append(wxT(" --libs"));
	long code = wxExecute(command, output, errors);

	if (code != 0)
		wxLogFatalError(errors[0]);
	
	// libraries
	printf("version (build) { pragma(link, \"wxc\""); 
	wxString libs = output[0];

	wxLogDebug(libs);
	wxRegEx reLib(wxT("\\-l([[:alnum:]\\_\\.\\-]+)"));
	size_t start, length;
	while (reLib.Matches(libs))
	{
		reLib.GetMatch(&start, &length, 1);
		wxString lib = libs.Mid(start, length);
		printf(", \"%s\"", (const char*) lib.mb_str());
		libs = libs.Mid(start + length);
		libs = libs.Trim(false);
	}

	wxString frameworks = output[0];
	wxRegEx reFw(wxT("\\-framework ([[:alnum:]\\-]+)"));
	while (reFw.Matches(frameworks))
	{
		reFw.GetMatch(&start, &length, 1);
		wxString fw = frameworks.Mid(start, length);
		printf(", \"System -framework %s\"", (const char*) fw.mb_str());
		frameworks = frameworks.Mid(start + length);
		frameworks = frameworks.Trim(false);
	}

	printf(", \"stdc++\"); }\n");

	// platform
	printf("version (build) { pragma(export_version, "); 
#if defined(__WXMSW__)
    printf("__WXMSW__");
#elif defined(__WXGTK__)
    printf("__WXGTK__");
#elif defined(__WXMAC__)
    printf("__WXMAC__");
#else
    #error unknown platform
#endif
	printf("); }\n");

	// encoding
	printf("version (build) { pragma(export_version, "); 
#if wxUSE_UNICODE
    printf("UNICODE");
#elif !wxUSE_UNICODE
    printf("ANSI");
#else
    #error unknown encoding
#endif
	printf("); }\n");

	// release
	printf("version (build) { pragma(export_version, "); 
    printf("wx%d%d", wxMAJOR_VERSION, wxMINOR_VERSION);
	printf("); }\n");

	return 0;
} 
示例#17
0
void bmx_wxlogfatalerror(BBString * message) {
	wxLogFatalError(_("%s"), wxStringFromBBString(message).c_str());
}
示例#18
0
// from pngerror.c
// so that the libpng doesn't send anything on stderr
    void
    PNGLINKAGEMODE wx_png_error(png_structp WXUNUSED(png_ptr), png_const_charp message)
    {
        wxLogFatalError( wxString::FromAscii(message) );
    }
示例#19
0
void CDVRPTRClientApp::OnAssertFailure(const wxChar* file, int line, const wxChar* func, const wxChar* cond, const wxChar* msg)
{
	wxLogFatalError(wxT("Assertion failed on line %d in file %s and function %s: %s %s"), line, file, func, cond, msg);
}
示例#20
0
wxSoundFormatBase *wxSoundFormatBase::Clone() const
{
    wxLogFatalError(wxT("In wxSoundFormatBase::Clone() but I should")
                    wxT(" not be there"));
    return NULL;
}
示例#21
0
void CDStarRepeaterApp::OnAssertFailure(const wxChar* file, int line, const wxChar* func, const wxChar* cond, const wxChar* msg)
{
	wxLogFatalError("Assertion failed on line %d in file %s and function %s: %s %s", line, file, func, cond, msg);
}
示例#22
0
EWXWEXPORT(void,LogFatalErrorMsg)(wxString* _msg)
{
	wxLogFatalError(*_msg);
}
示例#23
0
void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
{
	// Constraints are output as constraint1 = (...), constraint2 = (...), etc.
	int constraintNo = 1;
	wxChar m_constraintNameBuf[20];
	bool haveConstraints = TRUE;

	while (haveConstraints)
	{
		wxSprintf(m_constraintNameBuf, wxT("constraint%d"), constraintNo);
		wxExpr *constraintExpr = NULL;
		clause->GetAttributeValue(m_constraintNameBuf, &constraintExpr);
		if (!constraintExpr)
		{
			haveConstraints = FALSE;
			break;
		}
		wxString cName = wxEmptyString;
		wxShape *m_constrainingObject = NULL;
		wxList m_constrainedObjects;

		// Each constraint is stored in the form
		// (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList)

		wxExpr *typeExpr = constraintExpr->Nth(0);
		wxExpr *nameExpr = constraintExpr->Nth(1);
		wxExpr *idExpr = constraintExpr->Nth(2);
		wxExpr *xExpr = constraintExpr->Nth(3);
		wxExpr *yExpr = constraintExpr->Nth(4);
		wxExpr *constrainingExpr = constraintExpr->Nth(5);
		wxExpr *constrainedExpr = constraintExpr->Nth(6);

		int cType = (int)typeExpr->IntegerValue();
		double cXSpacing = xExpr->RealValue();
		double cYSpacing = yExpr->RealValue();
		cName = nameExpr->StringValue();
		long cId = idExpr->IntegerValue();

		wxExpr *objExpr1 = database->HashFind(wxT("node_image"), constrainingExpr->IntegerValue());
		if (objExpr1 && objExpr1->GetClientData())
			m_constrainingObject = (wxShape *)objExpr1->GetClientData();
		else
			wxLogFatalError(wxT("Object graphics error: Couldn't find constraining image of composite."));

		int i = 0;
		wxExpr *currentIdExpr = constrainedExpr->Nth(i);
		while (currentIdExpr)
		{
			long currentId = currentIdExpr->IntegerValue();
			wxExpr *objExpr2 = database->HashFind(wxT("node_image"), currentId);
			if (objExpr2 && objExpr2->GetClientData())
			{
				m_constrainedObjects.Append((wxShape *)objExpr2->GetClientData());
			}
			else
			{
				wxLogFatalError(wxT("Object graphics error: Couldn't find constrained image of composite."));
			}

			i ++;
			currentIdExpr = constrainedExpr->Nth(i);
		}
		wxOGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects);
		newConstraint->SetSpacing(cXSpacing, cYSpacing);
		newConstraint->m_constraintId = cId;
		newConstraint->m_constraintName = cName;
		constraintNo ++;
	}
}