예제 #1
0
		bool Connection::check () {
		
			if (mysql_ping(get())==0) return true;
			
			auto guard=AtExit([&] () {	destroy();	});
			
			auto code=mysql_errno(get());
			if (
				(code==CR_SERVER_GONE_ERROR) ||
				//	The documentation for mysql_ping
				//	explicitly says that it doesn't cause
				//	CR_SERVER_LOST:
				//
				//	http://dev.mysql.com/doc/refman/5.7/en/mysql-ping.html
				//
				//	However, if you manually close all
				//	this data provider's connections on
				//	the server, and then watch as this
				//	function executes in the debugger,
				//	you'll discover that mysql_ping
				//	absolutely does cause CR_SERVER_LOST.
				(code==CR_SERVER_LOST)
			) return false;
			
			Raise();
		
		}
예제 #2
0
void XYDialog::OnDrawChange(wxCommandEvent &event) {
	DrawInfo **draw;
	wxButton *button;

	int i = event.GetId() - XY_XAXIS_BUTTON;
	draw = &m_di[i];

	button = wxDynamicCast(FindWindowById(event.GetId()), wxButton);

	if (m_draw_search->ShowModal() == wxID_CANCEL)
		return;
#ifdef __WXMSW__
	//hilarious...
	Raise();
#endif

	long previous = -1;
	DrawInfo *choosen = m_draw_search->GetDrawInfo(&previous);
	if (choosen == NULL)
		return;
	
	*draw = choosen;
	button->SetLabel(choosen->GetName());

}
void CVPCB_MAINFRAME::CreateScreenCmp()
{
    DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFootprintViewerFrame();

    if( !fpframe )
    {
        fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
        fpframe->Show( true );
    }
    else
    {
        if( fpframe->IsIconized() )
             fpframe->Iconize( false );

        // The display footprint window might be buried under some other
        // windows, so CreateScreenCmp() on an existing window would not
        // show any difference, leaving the user confused.
        // So we want to put it to front, second after our CVPCB_MAINFRAME.
        // We do this by a little dance of bringing it to front then the main
        // frame back.
        fpframe->Raise();   // Make sure that is visible.
        Raise();            // .. but still we want the focus.
    }

    fpframe->InitDisplay();
}
예제 #4
0
void NyqBench::OnGo(wxCommandEvent & e)
{
   // No need to delete...EffectManager will do it
   mEffect = new NyquistEffect(wxT("Nyquist Effect Workbench"));
   const PluginID & ID = EffectManager::Get().RegisterEffect(mEffect);

   mEffect->SetCommand(mScript->GetValue());
   mEffect->RedirectOutput();

   AudacityProject *p = GetActiveProject();
   wxASSERT(p != NULL);

   if (p) {
      wxWindowDisabler disable(this);
      NyqRedirector redir((NyqTextCtrl *)mOutput);

      mRunning = true;
      UpdateWindowUI();

      p->DoEffect(ID, CommandContext(*p), 0);

      mRunning = false;
      UpdateWindowUI();
   }

   Raise();

   EffectManager::Get().UnregisterEffect(ID);
}
예제 #5
0
파일: decomp.cpp 프로젝트: wheein/MiHaJong
void Data::decompress(int FileID_) {
#ifdef _WIN32
	DWORD size = 0;
#else /*_WIN32*/
	size_t size = 0;
#endif /*_WIN32*/
	const uint8_t* compressedBuf = nullptr;
	int result;
	LoadFileInResource(FileID_, LZMA_STREAM, size, compressedBuf);
	assert(size > 13);
	uint8_t* compressedData = (uint8_t *)malloc(size+1);
	memcpy(compressedData, compressedBuf, size);
	compressedData[size] = 0;
	decompressedSize = *((size_t *)(compressedData+5));
	DecompressedData = (uint8_t *)malloc(decompressedSize);
	result = LzmaUncompress(DecompressedData, &decompressedSize,
		(const uint8_t *)(compressedData+13),
		(SizeT *)&size, (const uint8_t *)compressedData, 5);
	free(compressedData); compressedData = nullptr;
	if (result != SZ_OK) {
		CodeConv::tostringstream o;
		o << _T("LZMAストリームのデコードに失敗しました。ファイルが壊れている虞があります。") <<
			_T("エラーコード: ") << result;
		Raise(EXCEPTION_MJCORE_DECOMPRESSION_FAILURE, o.str().c_str());
	}
	else {
		info(_T("LZMAストリームをデコードしました。"));
	}
	return;
}
예제 #6
0
tcGameOutcomePopup::tcGameOutcomePopup(const wxPoint& pos, const wxSize& size)
            : tc3DWindow2(parent, pos, size, "GameOutcome", parent)
{
    SetBaseRenderBin(parent->GetBaseRenderBin() + 10);
    Raise();
    birthCount = tcTime::Get()->Get30HzCount();

    SetBorderDraw(true);

    int w = 70;
    int h = 15;
    int x = (size.GetWidth() - w) / 2;
    int y = size.GetHeight() - 25;
    tcButton* exitButton = new tcButton(this, wxPoint(x - w, y), wxSize(w, h), "XBUTTON");
    exitButton->SetCaption("EXIT GAME");
    exitButton->SetFontSize(fontSize + 2.0f);
    exitButton->SetOffColor(Vec4(0.2f, 0.2f, 0.2f, 0.5f));
    exitButton->SetOverColor(Vec4(0.25f, 0.25f, 0.25f, 0.5f));
    exitButton->SetCommand(86);

    tcButton* continueButton = new tcButton(this, wxPoint(x + w, y), wxSize(w, h), "XBUTTON");
    continueButton->SetCaption("PLAY ON");
    continueButton->SetFontSize(fontSize + 2.0f);
    continueButton->SetOffColor(Vec4(0.2f, 0.2f, 0.2f, 0.5f));
    continueButton->SetOverColor(Vec4(0.25f, 0.25f, 0.25f, 0.5f));
    continueButton->SetCommand(123);

}
예제 #7
0
파일: zrcolafrm.cpp 프로젝트: Amebis/ZRCola
void wxZRColaFrame::OnTaskbarIconClick(wxTaskBarIconEvent& event)
{
    Iconize(false);
    Show(true);
    Raise();

    event.Skip();
}
예제 #8
0
void Console::UnsetHandler () {

    if (!SetConsoleCtrlHandler(
                handler_impl,
                false
            )) Raise();

}
예제 #9
0
int main(void)
{
	int m, n;
	while (scanf("%d%d", &m, &n) == 2) {
		printf("exp: %d\n", Raise(m, n));
	}
	return 0;
}
예제 #10
0
void ABoxDlg::onSelectFile( wxCommandEvent& event ) {
  wxFileDialog* fdlg = new wxFileDialog(this);
  if( fdlg->ShowModal() == wxID_OK ) {
    m_Filename->SetValue(fdlg->GetPath());
  }
  fdlg->Destroy();
  Raise();
}
예제 #11
0
bool wxPopupWindow::Show( bool show )
{
    bool ret = wxWindowX11::Show( show );

    Raise();

    return ret;
}
예제 #12
0
파일: connection.c 프로젝트: blakawk/Aio4c
Connection* ConnectionFactoryCreate(Connection* factory, Address* address, aio4c_socket_t socket) {
    ErrorCode code = AIO4C_ERROR_CODE_INITIALIZER;
    Connection* connection = NULL;
    void* data = NULL;

    connection = NewConnection(factory->pool, address, true);

    connection->socket = socket;

#ifndef AIO4C_WIN32
    if (fcntl(connection->socket, F_SETFL, O_NONBLOCK) == -1) {
        code.error = errno;
        code.connection = connection;
        Raise(AIO4C_LOG_LEVEL_ERROR, AIO4C_CONNECTION_ERROR_TYPE, AIO4C_FCNTL_ERROR, &code);
        shutdown(connection->socket, SHUT_RDWR);
        close(connection->socket);
#else /* AIO4C_WIN32 */
    unsigned long ioctl = 1;
    if (ioctlsocket(connection->socket, FIONBIO, &ioctl) != 0) {
        code.source = AIO4C_ERRNO_SOURCE_WSA;
        code.connection = connection;
        Raise(AIO4C_LOG_LEVEL_ERROR, AIO4C_CONNECTION_ERROR_TYPE, AIO4C_FCNTL_ERROR, &code);
        shutdown(connection->socket, SD_BOTH);
        closesocket(connection->socket);
#endif /* AIO4C_WIN32 */
        aio4c_free(connection);
        return NULL;
    }

    data = factory->dataFactory(connection, factory->dataFactoryArg);

    CopyEventQueue(connection->userHandlers, factory->userHandlers, data);
    CopyEventQueue(connection->systemHandlers, factory->systemHandlers, NULL);

    connection->closedBy[AIO4C_CONNECTION_OWNER_ACCEPTOR] = false;
    connection->closedBy[AIO4C_CONNECTION_OWNER_CLIENT] = true;

    return connection;
}

static void _ConnectionEventHandle(Connection* connection, Event event) {
    Log(AIO4C_LOG_LEVEL_DEBUG, "handling event %d for connection %s", event, connection->string);
    EventHandle(connection->systemHandlers, event, (EventSource)connection);
    EventHandle(connection->userHandlers, event, (EventSource)connection);
}
예제 #13
0
		void Connection::set (enum mysql_option option, const T & arg) {
		
			if (mysql_options(
				get(),
				option,
				&arg
			)!=0) Raise();
		
		}
예제 #14
0
 // Updates the controller block interface with this interface_version information
 void UpdateInterface()
 {
     // Nothing here, no interface updating exists yet
     // I hope this doesn't get needed at all :)
     // Here we should update the controller block interface to a newer version to the current in use
     // Maybe we'll not even need to reallocate some memory because CBM_DATA_SIZE is big enought, check data_size
     
     Raise();    // Raise an error, this should never be called for now
 }
예제 #15
0
inline void Console::do_output (ConsoleScreenBuffer & buffer) {

    //	The strings to write
    Vector<String> write;
    //	Whether or not we must
    //	lead with a clear
    bool clear=false;

    lock.Execute([&] () mutable {

        for (auto & str : queue) {

            if (str.IsNull()) {

                //	Clear

                clear=true;

                //	Don't even bother
                //	writing out these
                //	lines, they'll just
                //	get immediately cleared
                //	anyway
                write.Clear();

            } else {

                //	A string to write

                write.EmplaceBack(
                    std::move(*str)
                );

            }

        }

        //	We've dequeued everything,
        //	clear the queue
        queue.Clear();

        //	Wake waiting threads
        wait.WakeAll();

        //	Reset event so we don't
        //	loop infinitely
        if (!ResetEvent(queued)) Raise();

    });

    //	Clear console if necessary
    if (clear) buffer.Clear();

    //	Write strings
    buffer.WriteLines(std::move(write));

}
예제 #16
0
파일: worker.c 프로젝트: blakawk/Aio4c
Worker* NewWorker(char* pipeName, aio4c_size_t bufferSize) {
    Worker* worker = NULL;
    ErrorCode code = AIO4C_ERROR_CODE_INITIALIZER;

    if ((worker = aio4c_malloc(sizeof(Worker))) == NULL) {
#ifndef AIO4C_WIN32
        code.error = errno;
#else /* AIO4C_WIN32 */
        code.source = AIO4C_ERRNO_SOURCE_SYS;
#endif /* AIO4C_WIN32 */
        code.size = sizeof(Worker);
        code.type = "Worker";
        Raise(AIO4C_LOG_LEVEL_ERROR, AIO4C_ALLOC_ERROR_TYPE, AIO4C_ALLOC_ERROR, &code);
        return NULL;
    }

    worker->queue      = NULL;
    worker->pool       = NULL;
    worker->writer     = NULL;
    worker->bufferSize = bufferSize;

    if (pipeName != NULL) {
        worker->pipe       = pipeName;
        worker->name       = aio4c_malloc(strlen(pipeName) + 1 + 7);
        if (worker->name != NULL) {
            snprintf(worker->name, strlen(pipeName) + 1 + 7, "%s-worker", pipeName);
        }
    } else {
        worker->pipe = NULL;
        worker->name = NULL;
    }

    worker->thread = NewThread(
            worker->name,
            _WorkerInit,
            _WorkerRun,
            _WorkerExit,
            (ThreadData)worker);

    if (worker->thread == NULL) {
        if (worker->name != NULL) {
            aio4c_free(worker->name);
        }
        aio4c_free(worker);
        return NULL;
    }

    if (!ThreadStart(worker->thread)) {
        if (worker->name != NULL) {
            aio4c_free(worker->name);
        }
        aio4c_free(worker);
        return NULL;
    }

    return worker;
}
예제 #17
0
void Console::SetHandler (std::function<bool (InterruptType)> callback) {

    handler=std::move(callback);

    if (!SetConsoleCtrlHandler(
                handler_impl,
                true
            )) Raise();

}
예제 #18
0
파일: iocp.cpp 프로젝트: HalfDemon/MCPP
		void CompletionPort::Post () {
		
			if (!PostQueuedCompletionStatus(
				iocp,
				0,
				0,
				nullptr
			)) Raise();
		
		}
예제 #19
0
tcAircraftInfoPopup::tcAircraftInfoPopup(long platformId, const wxPoint& pos, const wxSize& size)
            : tc3DWindow2(parent, pos, size, "AircraftInfo", parent),
              id(platformId)
{
    SetBaseRenderBin(parent->GetBaseRenderBin() + 10);
    Raise();
    birthCount = tcTime::Get()->Get30HzCount();

    SetBorderDraw(true);
}
예제 #20
0
파일: iocp.cpp 프로젝트: HalfDemon/MCPP
		CompletionPort::CompletionPort () {
		
			//	Create the completion port
			if ((iocp=CreateIoCompletionPort(
				INVALID_HANDLE_VALUE,
				nullptr,
				0,
				0
			))==nullptr) Raise();
		
		}
예제 #21
0
파일: iocp.cpp 프로젝트: HalfDemon/MCPP
		void CompletionPort::Attach (SOCKET socket, void * ptr) {
		
			//	Attempt to attach to the completion port
			if (CreateIoCompletionPort(
				reinterpret_cast<HANDLE>(socket),
				iocp,
				reinterpret_cast<ULONG_PTR>(ptr),
				0
			)==nullptr) Raise();
		
		}
예제 #22
0
static inline HANDLE get_std_handle (DWORD handle) {

    HANDLE retr=GetStdHandle(handle);

    //	Failure
    if (retr==INVALID_HANDLE_VALUE) Raise();
    //	Handle does not exist/is unavailable
    if (retr==nullptr) throw std::runtime_error(std_unavail);

    return retr;

}
예제 #23
0
void WXAppBar::OnMove( wxMoveEvent& event )
{
#if defined(__WXMSW__)
	SetSize(m_X, m_Y, m_Width, m_Height, 0);
	Raise ();
#endif
	wxPoint p= event.GetPosition();
	
//	printf ("onMove: %d, %d, orig: %d, %d\n", p.x, p.y, m_X, m_Y);
//	wxDialog::OnMove (event);
	event.Skip();
}
예제 #24
0
void InfoPanel::OnSaveBannerImage(wxCommandEvent& WXUNUSED(event))
{
  wxFileDialog dialog(this, _("Save as..."), wxGetHomeDir(),
                      wxString::Format("%s.png", m_game_id->GetValue()), wxALL_FILES_PATTERN,
                      wxFD_SAVE | wxFD_OVERWRITE_PROMPT);

  if (dialog.ShowModal() == wxID_OK)
  {
    m_game_list_item.GetBannerImage().SaveFile(dialog.GetPath());
  }

  Raise();
}
예제 #25
0
void Console::enqueue_impl (Nullable<String> str) {

    lock.Execute([&] () mutable {

        //	Enqueue
        queue.EmplaceBack(std::move(str));

        //	Awaken worker
        if (!SetEvent(queued)) Raise();

    });

}
예제 #26
0
파일: log.cpp 프로젝트: JGRennison/retcon
void log_window::LWShow(bool shown) {
	isshown = shown;
	if (shown) {
		while (!pending.empty()) {
			txtct->AppendText(wxstrstd(pending.front()));
			pending.pop();
		}
	}
	Show(shown);
	if (shown) {
		Raise();
	}
}
예제 #27
0
void OperatorDlg::onLocoImage( wxCommandEvent& event ) {
  if( m_LocoID->GetSelection() != wxNOT_FOUND ) {
    iONode lc = (iONode)((wxItemContainer*)m_LocoID)->GetClientData(m_LocoID->GetSelection());
    if( lc != NULL ) {
      LocDialog* dlg = new LocDialog(this, lc, false );
      if( wxID_OK == dlg->ShowModal() ) {
        /* Notify Notebook. */
      }
      dlg->Destroy();
      Raise();
    }
  }
}
예제 #28
0
void InstConsoleWindow::OnProcessExit( bool killed, int status )
{
	m_timerIdleWakeUp.Stop();
	//FIXME: what are the exact semantics of this?
	if(killed)
		delete m_running;
	else
		m_running->Detach();
	m_running = nullptr;
	SetCloseIsHide(false);
	
	AppendMessage(wxString::Format(_("Minecraft exited with code %i."), status));

	bool keepOpen = CheckCommonProblems(consoleTextCtrl->GetValue());

	if (killed)
	{
		AppendMessage(_("Minecraft was killed."));
		SetState(STATE_BAD);
		Show();
		Raise();
	}
	else if (status != 0)
	{
		AppendMessage(_("Minecraft has crashed!"));
		SetState(STATE_BAD);
		Show();
		Raise();
	}
	else if ((settings->GetAutoCloseConsole() || !IsShown() ) && !crashReportIsOpen && !keepOpen)
	{
		Close();
	}
	else
	{
		Show();
		Raise();
	}
}
예제 #29
0
void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
{
    int selection = Patches->GetSelection();

    switch (event.GetId())
    {
    case ID_EDITPATCH:
    {
        CPatchAddEdit dlg(selection, &onFrame, this);
        dlg.ShowModal();
        Raise();
    }
    break;
    case ID_ADDPATCH:
    {
        CPatchAddEdit dlg(-1, &onFrame, this, 1, _("Add Patch"));
        int res = dlg.ShowModal();
        Raise();
        if (res == wxID_OK)
        {
            Patches->Append(StrToWxStr(onFrame.back().name));
            Patches->Check((unsigned int)(onFrame.size() - 1), onFrame.back().active);
        }
    }
    break;
    case ID_REMOVEPATCH:
        onFrame.erase(onFrame.begin() + Patches->GetSelection());
        Patches->Delete(Patches->GetSelection());
        break;
    }

    PatchList_Save();
    Patches->Clear();
    PatchList_Load();

    EditPatch->Disable();
    RemovePatch->Disable();
}
예제 #30
0
파일: viewer.cpp 프로젝트: poppeman/Pictus
	void Viewer::ViewportMode(ScreenMode newMode)
	{
		if (m_screenMode == newMode)
		{
			return;
		}

		m_screenMode = newMode;

		if (newMode == Viewer::SM_Fullscreen)
		{
			m_userInitiatedMove = false;
			wxDisplay mon(DisplayFromPointFallback(PositionScreen()));

			m_statusBar->Show(false);
			m_previousWindowStyle = GetWindowStyle();
			SetWindowStyleFlag(wxBORDER_NONE);
			m_previousWindowRegion = wxToRect(GetRect());
			auto monRegion = wxToRect(mon.GetClientArea());

			SetSize(monRegion.Left(), monRegion.Top(), monRegion.Width(), monRegion.Height());
			m_viewPort.ActiveCursorMode(ViewPort::CursorHideAutomatic);
			Raise();
			m_userInitiatedMove = true;
		}
		else
		{
			m_userInitiatedMove = false;
			SetWindowStyleFlag(m_previousWindowStyle);
			m_statusBar->Show(m_cfg.View.ShowStatusBar);
			SetSize(m_previousWindowRegion.Left(), m_previousWindowRegion.Top(), m_previousWindowRegion.Width(), m_previousWindowRegion.Height());
			m_viewPort.ActiveCursorMode(ViewPort::CursorShow);
			m_userInitiatedMove = true;
		}

		// Make sure that the settings and adjust dialogs are on top (if running)
		InitDialogs();
		if (m_settings->IsVisible())
		{
			ShowSettings();
		}

		if (m_adjust->IsVisible())
		{
			ShowAdjust();
		}

		ImageChanged();
		UpdateImageInformation();
	}