void AboutFrame::OnClickUrl(wxMouseEvent& event) {
            if (IsBeingDeleted()) return;

            const wxVariant* var = static_cast<wxVariant*>(event.GetEventUserData());
            const wxString url = var->GetString();
            ::wxLaunchDefaultBrowser(url);
        }
Exemple #2
0
void GSFrame::OnActivate( wxActivateEvent& evt )
{
	if( IsBeingDeleted() ) return;

	evt.Skip();
	if( wxWindow* gsPanel = GetViewport() ) gsPanel->SetFocus();
}
Exemple #3
0
void MainEmuFrame::OnMoveAround( wxMoveEvent& evt )
{
	if( IsBeingDeleted() || !IsVisible() || IsIconized() ) return;

	// Uncomment this when doing logger stress testing (and then move the window around
	// while the logger spams itself)
	// ... makes for a good test of the message pump's responsiveness.
	if( EnableThreadedLoggingTest )
		Console.Warning( "Threaded Logging Test!  (a window move event)" );

	// evt.GetPosition() returns the client area position, not the window frame position.
	// So read the window's screen-relative position directly.
	g_Conf->MainGuiPosition = GetScreenPosition();

	// wxGTK note: X sends gratuitous amounts of OnMove messages for various crap actions
	// like selecting or deselecting a window, which muck up docking logic.  We filter them
	// out using 'lastpos' here. :)

	static wxPoint lastpos( wxDefaultCoord, wxDefaultCoord );
	if( lastpos == evt.GetPosition() ) return;
	lastpos = evt.GetPosition();

	if( g_Conf->ProgLogBox.AutoDock )
	{
		g_Conf->ProgLogBox.DisplayPosition = GetRect().GetTopRight();
		if( ConsoleLogFrame* proglog = wxGetApp().GetProgramLog() )
			proglog->SetPosition( g_Conf->ProgLogBox.DisplayPosition );
	}

	evt.Skip();
}
Exemple #4
0
void GSPanel::AppStatusEvent_OnSettingsApplied()
{
	if( IsBeingDeleted() ) return;
	DoResize();
	DoShowMouse();
	Show( !EmuConfig.GS.DisableOutput );
}
Exemple #5
0
void GSPanel::OnResize(wxSizeEvent& event)
{
	if( IsBeingDeleted() ) return;
	DoResize();
	//Console.Error( "Size? %d x %d", GetSize().x, GetSize().y );
	//event.
}
        void RotateObjectsToolPage::OnAngleChanged(SpinControlEvent& event) {
            if (IsBeingDeleted()) return;

            const double newAngleDegs = Math::correct(event.IsSpin() ? m_angle->GetValue() + event.GetValue() : event.GetValue());
            m_angle->SetValue(newAngleDegs);
            m_tool->setAngle(Math::radians(newAngleDegs));
        }
Exemple #7
0
// Close out the console log windows along with the main emu window.
// Note: This event only happens after a close event has occurred and was *not* veto'd.  Ie,
// it means it's time to provide an unconditional closure of said window.
//
void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
{
	if( IsBeingDeleted() ) return;

	CoreThread.Suspend();

	//bool isClosing = false;

	if( !evt.CanVeto() )
	{
		// Mandatory destruction...
		//isClosing = true;
	}
	else
	{
		// TODO : Add confirmation prior to exit here!
		// Problem: Suspend is often slow because it needs to wait until the current EE frame
		// has finished processing (if the GS or logging has incurred severe overhead this makes
		// closing PCSX2 difficult).  A non-blocking suspend with modal dialog might suffice
		// however. --air

		//evt.Veto( true );

	}

	sApp.OnMainFrameClosed( GetId() );

	RemoveCdvdMenu();

	RemoveEventHandler( &wxGetApp().GetRecentIsoManager() );
	wxGetApp().PostIdleAppMethod( &Pcsx2App::PrepForExit );

	evt.Skip();
}
        void MousePreferencePane::OnMoveSpeedChanged(wxScrollEvent& event) {
            if (IsBeingDeleted()) return;

            const float value = m_moveSpeedSlider->GetValue() / 100.0f;
            
            PreferenceManager& prefs = PreferenceManager::instance();
            prefs.set(Preferences::CameraMoveSpeed, value);
        }
        void MousePreferencePane::OnInvertPanVAxisChanged(wxCommandEvent& event) {
            if (IsBeingDeleted()) return;

            const bool value = event.GetInt() != 0;
            
            PreferenceManager& prefs = PreferenceManager::instance();
            prefs.set(Preferences::CameraPanInvertV, value);
        }
        void SplitterWindow2::OnSize(wxSizeEvent& event) {
            if (IsBeingDeleted()) return;

            updateSashPosition(m_oldSize, event.GetSize());
            sizeWindows();
            m_oldSize = event.GetSize();
            event.Skip();
        }
Exemple #11
0
void GSPanel::OnHideMouseTimeout( wxTimerEvent& evt )
{
	if( IsBeingDeleted() || !m_HasFocus ) return;
	if( CoreThread.GetExecutionMode() != SysThreadBase::ExecMode_Opened ) return;

	SetCursor( wxCursor( wxCURSOR_BLANK ) );
	m_CursorShown = false;
}
        void MousePreferencePane::OnMoveCameraInCursorDirChanged(wxCommandEvent& event) {
            if (IsBeingDeleted()) return;

            const bool value = event.GetInt() != 0;
            
            PreferenceManager& prefs = PreferenceManager::instance();
            prefs.set(Preferences::CameraMoveInCursorDir, value);
        }
        void RotateObjectsToolPage::OnRotate(wxCommandEvent& event) {
            if (IsBeingDeleted()) return;

            const Vec3 center = m_tool->rotationCenter();
            const Vec3 axis = getAxis();
            const FloatType angle = Math::radians(m_angle->GetValue());
            
            MapDocumentSPtr document = lock(m_document);
            document->rotateObjects(center, axis, angle);
        }
        void SplitterWindow2::OnIdle(wxIdleEvent& event) {
            if (IsBeingDeleted()) return;

            if (IsShownOnScreen()) {
                Unbind(wxEVT_IDLE, &SplitterWindow2::OnIdle, this);
                
                // if the initial sash position could not be set until now, then it probably cannot be set at all
                m_initialSplitRatio = -1.0;
            }
        }
        void FaceAttribsEditor::OnIdle(wxIdleEvent& event) {
            if (IsBeingDeleted()) return;

            MapDocumentSPtr document = lock(m_document);
            Grid& grid = document->grid();
            
            m_xOffsetEditor->SetIncrements(grid.actualSize(), 2.0 * grid.actualSize(), 1.0);
            m_yOffsetEditor->SetIncrements(grid.actualSize(), 2.0 * grid.actualSize(), 1.0);
            m_rotationEditor->SetIncrements(Math::degrees(grid.angle()), 90.0, 1.0);
        }
Exemple #16
0
void GSPanel::OnMouseEvent( wxMouseEvent& evt )
{
	if( IsBeingDeleted() ) return;

	// Do nothing for left-button event
	if (!evt.Button(wxMOUSE_BTN_LEFT)) {
		evt.Skip();
		DoShowMouse();
	}

#if defined(__unix__)
	// HACK2: In gsopen2 there is one event buffer read by both wx/gui and pad plugin. Wx deletes
	// the event before the pad see it. So you send key event directly to the pad.
	if( (PADWriteEvent != NULL) && (GSopen2 != NULL) ) {
		keyEvent event;
		// FIXME how to handle double click ???
		if (evt.ButtonDown()) {
			event.evt = 4; // X equivalent of ButtonPress
			event.key = evt.GetButton();
		} else if (evt.ButtonUp()) {
			event.evt = 5; // X equivalent of ButtonRelease
			event.key = evt.GetButton();
		} else if (evt.Moving() || evt.Dragging()) {
			event.evt = 6; // X equivalent of MotionNotify
			long x,y;
			evt.GetPosition(&x, &y);

			wxCoord w, h;
			wxWindowDC dc( this );
			dc.GetSize(&w, &h);

			// Special case to allow continuous mouvement near the border
			if (x < 10)
				x = 0;
			else if (x > (w-10))
				x = 0xFFFF;

			if (y < 10)
				y = 0;
			else if (y > (w-10))
				y = 0xFFFF;

			// For compatibility purpose with the existing structure. I decide to reduce
			// the position to 16 bits.
			event.key = ((y & 0xFFFF) << 16) | (x & 0xFFFF);

		} else {
			event.key = 0;
			event.evt = 0;
		}

		PADWriteEvent(event);
	}
#endif
}
        void BitmapToggleButton::OnPaint(wxPaintEvent& event) {
            if (IsBeingDeleted()) return;

            const wxSize size = GetClientSize();
            const wxSize bmpSize = bitmapSize();
            const wxSize delta = size - bmpSize;
            const wxPoint offset(delta.x / 2, delta.y / 2);
            
            wxPaintDC dc(this);
            dc.DrawBitmap(currentBitmap(), offset);
        }
        void SplitterWindow2::OnMouseButton(wxMouseEvent& event) {
            if (IsBeingDeleted()) return;

            assert(m_splitMode != SplitMode_Unset);
            
            if (event.LeftDown())
                m_sash->CaptureMouse();
            else if (event.LeftUp() && dragging())
                m_sash->ReleaseMouse();
			setSashCursor();
            Refresh();
        }
        void FaceAttribsEditor::OnContentFlagChanged(FlagChangedCommand& command) {
            if (IsBeingDeleted()) return;

            Model::ChangeBrushFaceAttributesRequest request;
            if (command.flagSet())
                request.setContentFlag(command.index());
            else
                request.unsetContentFlag(command.index());
            
            MapDocumentSPtr document = lock(m_document);
            if (!document->setFaceAttributes(request))
                command.Veto();
        }
        void FaceAttribsEditor::OnYOffsetChanged(SpinControlEvent& event) {
            if (IsBeingDeleted()) return;

            Model::ChangeBrushFaceAttributesRequest request;
            if (event.IsSpin())
                request.addYOffset(static_cast<float>(event.GetValue()));
            else
                request.setYOffset(static_cast<float>(event.GetValue()));
            
            MapDocumentSPtr document = lock(m_document);
            if (!document->setFaceAttributes(request) || event.IsSpin())
                event.Veto();
        }
        void SplitterWindow2::OnMouseMotion(wxMouseEvent& event) {
            if (IsBeingDeleted()) return;

            assert(m_splitMode != SplitMode_Unset);
            
            const wxPoint screenPos = wxGetMousePosition();
            const wxPoint clientPos = ScreenToClient(screenPos);
            
            if (dragging()) {
                setSashPosition(h(clientPos));
                sizeWindows();
            }
            setSashCursor();
        }
        void MousePreferencePane::OnRightKeyChanged(KeyboardShortcutEvent& event) {
            if (IsBeingDeleted()) return;

            PreferenceManager& prefs = PreferenceManager::instance();

            const KeyboardShortcut shortcut(event.key(), event.modifier1(), event.modifier2(), event.modifier3());
            if (prefs.get(Preferences::CameraFlyForward).hasKey() && prefs.get(Preferences::CameraFlyForward) == shortcut)
                event.Veto();
            else if (prefs.get(Preferences::CameraFlyBackward).hasKey() && prefs.get(Preferences::CameraFlyBackward) == shortcut)
                event.Veto();
            else if (prefs.get(Preferences::CameraFlyLeft).hasKey() && prefs.get(Preferences::CameraFlyLeft) == shortcut)
                event.Veto();
            else
                prefs.set(Preferences::CameraFlyRight, shortcut);
        }
        void BitmapToggleButton::OnMouseDown(wxMouseEvent& event) {
            if (IsBeingDeleted()) return;

            if (!IsEnabled())
                return;
            
            m_state = !m_state;
            Refresh();
            
            wxCommandEvent buttonEvent(wxEVT_BUTTON, GetId());
            buttonEvent.SetEventObject(this);
            buttonEvent.SetInt(static_cast<int>(m_state));
            
            ProcessEvent(buttonEvent);
        }
Exemple #24
0
void GSFrame::AppStatusEvent_OnSettingsApplied()
{
	if( IsBeingDeleted() ) return;

	SetWindowStyle((g_Conf->GSWindow.DisableResizeBorders ? 0 : wxRESIZE_BORDER) | wxCAPTION | wxCLIP_CHILDREN |
			wxSYSTEM_MENU | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX);
	if (!IsFullScreen() && !IsMaximized())
		SetClientSize(g_Conf->GSWindow.WindowSize);
	Refresh();

	if( g_Conf->GSWindow.CloseOnEsc )
	{
		if( IsShown() && !CorePlugins.IsOpen(PluginId_GS) )
			Show( false );
	}
}
Exemple #25
0
void CPickup::Callback_OnCollision ( CColShape& Shape, CElement& Element )
{
    if ( IS_PLAYER ( &Element ) )
    {
        CPlayer& Player = static_cast < CPlayer& > ( Element );

        // Is he alive?
        if ( !Player.IsDead () )
        {
            // Matching interior
            if ( GetInterior () == Element.GetInterior () )
            {
                // Matching dimension
                if ( GetDimension () == Element.GetDimension () )
                {
                    // Call the onPickupHit event
                    CLuaArguments Arguments;
                    Arguments.PushElement ( &Player );
                    bool bContinue1 = CallEvent ( "onPickupHit", Arguments );

                    CLuaArguments Arguments2;
                    Arguments2.PushElement ( this );       // pickup
                    bool bContinue2 = Element.CallEvent ( "onPlayerPickupHit", Arguments2 );

                    if ( bContinue1 && bContinue2 )
                    {
                        // Does it still exist?
                        if ( !IsBeingDeleted () )
                        {
                            // Can we USE the pickup?
                            if ( CanUse ( Player ) )
                            {
                                // USE the pickup
                                Use ( Player );
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemple #26
0
void GSFrame::OnMove( wxMoveEvent& evt )
{
	if( IsBeingDeleted() ) return;

	evt.Skip();

	g_Conf->GSWindow.IsMaximized = IsMaximized();

	// evt.GetPosition() returns the client area position, not the window frame position.
	if( !g_Conf->GSWindow.IsMaximized && !IsFullScreen() && !IsIconized() && IsVisible() )
		g_Conf->GSWindow.WindowPos = GetScreenPosition();

	// wxGTK note: X sends gratuitous amounts of OnMove messages for various crap actions
	// like selecting or deselecting a window, which muck up docking logic.  We filter them
	// out using 'lastpos' here. :)

	//static wxPoint lastpos( wxDefaultCoord, wxDefaultCoord );
	//if( lastpos == evt.GetPosition() ) return;
	//lastpos = evt.GetPosition();
}
Exemple #27
0
void GSFrame::OnResize( wxSizeEvent& evt )
{
	if( IsBeingDeleted() ) return;

	if( !IsFullScreen() && !IsMaximized() && IsVisible() )
	{
		g_Conf->GSWindow.WindowSize	= GetClientSize();
	}

	if( GSPanel* gsPanel = GetViewport() )
	{
		gsPanel->DoResize();
		gsPanel->SetFocus();
	}

	//wxPoint hudpos = wxPoint(-10,-10) + (GetClientSize() - m_hud->GetSize());
	//m_hud->SetPosition( hudpos ); //+ GetScreenPosition() + GetClientAreaOrigin() );

	// if we skip, the panel is auto-sized to fit our window anyway, which we do not want!
	//evt.Skip();
}
void CElementDeleter::Delete ( class CElement* pElement, bool bUnlink, bool bUpdatePerPlayerEntities, CResource* pDebugResource, const char* szDebugText )
{
    if ( pElement )
    {
        if ( !IsBeingDeleted ( pElement ) )
        {
            // Before we do anything, fire the on-destroy event
            CLuaArguments Arguments;
            if ( pDebugResource )
                Arguments.PushResource( pDebugResource );
            else
                Arguments.PushNil();
            Arguments.PushString( szDebugText );
            pElement->CallEvent ( "onElementDestroy", Arguments );

            // Add it to our list
            if ( !pElement->IsBeingDeleted () )
            {
                m_List.push_back ( pElement );
            }

            // Flag it as being deleted and unlink it from the tree/managers
            pElement->SetIsBeingDeleted ( true );
            pElement->ClearChildren ();
            pElement->SetParentObject ( NULL, bUpdatePerPlayerEntities );

            if ( bUnlink )
                pElement->Unlink ();
        }
        else
        {
            if ( pElement->GetType ( ) == CElement::PLAYER )
            {
                // Tell the console
                CLogger::LogPrint ( "URGENT: Report this error on bugs.mtasa.com error code: 6930-1\n" );
            }
        }
    }
}
void ConsoleLogFrame::OnMoveAround( wxMoveEvent& evt )
{
	if( IsBeingDeleted() || !IsVisible() || IsIconized() ) return;

	// Docking check!  If the window position is within some amount
	// of the main window, enable docking.

	if( wxWindow* main = GetParent() )
	{
		wxPoint topright( main->GetRect().GetTopRight() );
		wxRect snapzone( topright - wxSize( 8,8 ), wxSize( 16,16 ) );

		m_conf.AutoDock = snapzone.Contains( GetPosition() );
		//Console.WriteLn( "DockCheck: %d", g_Conf->ConLogBox.AutoDock );
		if( m_conf.AutoDock )
		{
			SetPosition( topright + wxSize( 1,0 ) );
			m_conf.AutoDock = true;
		}
	}
	m_conf.DisplayPosition = GetPosition();
	evt.Skip();
}
        void SplitterWindow2::OnMouseCaptureLost(wxMouseCaptureLostEvent& event) {
            if (IsBeingDeleted()) return;

            setSashCursor();
        }