Esempio n. 1
0
bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
    wxTabEvent event(wxEVT_NULL, m_windowId);
    wxEventType eventType wxDUMMY_INITIALIZE(wxEVT_NULL);
    NMHDR* hdr1 = (NMHDR*) lParam;
    switch ( hdr1->code )
    {
        case TCN_SELCHANGE:
            eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
            break;

        case TCN_SELCHANGING:
            eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
            break;

#ifndef __WXWINCE__
        case TTN_NEEDTEXT:
        {
            // TODO
//            if (!tool->m_shortHelpString.empty())
//                ttText->lpszText = (char *) (const char *)tool->m_shortHelpString;
        }
#endif
        default :
            return wxControl::MSWOnNotify(idCtrl, lParam, result);
    }

    event.SetEventObject( this );
    event.SetEventType(eventType);
    event.SetInt(idCtrl) ;
    event.SetSelection(idCtrl);

    return ProcessEvent(event);
}
Esempio n. 2
0
bool
InputEvents::ProcessKey(Mode mode, unsigned key_code)
{
  if (IsAltair() && key_code == 0xF5) {
    UIActions::SignalShutdown(false);
    return true;
  }

  if (!global_running)
    return false;

#ifdef KOBO
#ifdef ENABLE_SDL
  if (key_code == SDLK_POWER)
    /* the Kobo power button opens the main menu */
    key_code = KEY_MENU;
#else
  // TODO: check the console key code
#endif
#endif

  // Which key - can be defined locally or at default (fall back to default)
  unsigned event_id = key_to_event(mode, overlay_mode, key_code);
  if (event_id == 0)
    return false;

  ProcessEvent(event_id);
  return true;
}
//
// Event_OnProjectileLaunch()
//
void hhHarvesterSimple::Event_OnProjectileLaunch(hhProjectile *proj) {
	
	// Can't launch again yet
	float min = spawnArgs.GetFloat( "dda_delay_min" );
	float max = spawnArgs.GetFloat( "dda_delay_max" );
	float delay = min + (max - min) * (1.0f - gameLocal.GetDDAValue());

	if(gameLocal.GetTime() - lastAntiProjectileAttack < delay)
		return;	
	
	// The person who launched this projectile wasn't someone to worry about
	if(proj->GetOwner() && !(ReactionTo(proj->GetOwner()) & (ATTACK_ON_SIGHT | ATTACK_ON_DAMAGE)))
		return;
	
	// TODO: more intelligent checks for if we should launch the anti-projectile chaff
	idVec3 fw		= viewAxis[0];
	idVec3 projFw	= proj->GetAxis()[0]; 
	if(proj->GetOwner())
		projFw = proj->GetOwner()->GetAxis()[0];
	float dot = fw * projFw;
	if(dot > -.7f)
		return;

	ProcessEvent(&MA_AntiProjectileAttack, proj);
}
Esempio n. 4
0
void
SbModel::fireSbModelChanged(void)
{
	wxCommandEvent event(anEVT_ROW_SIZECHANGE);
	event.SetInt(entries_.size());
	ProcessEvent(event);
}
Esempio n. 5
0
/*
================
idMoveable::Event_SetOwnerFromSpawnArgs
================
*/
void idMoveable::Event_SetOwnerFromSpawnArgs( void ) {
	idStr owner;

	if ( spawnArgs.GetString( "owner", "", owner ) ) {
		ProcessEvent( &EV_SetOwner, gameLocal.FindEntity( owner ) );
	}
}
Esempio n. 6
0
void wxRibbonToolBar::OnMouseUp(wxMouseEvent& WXUNUSED(evt))
{
    if(m_active_tool)
    {
        if(m_active_tool->state & wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK)
        {
            wxEventType evt_type = wxEVT_COMMAND_RIBBONTOOL_CLICKED;
            if(m_active_tool->state & wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE)
                evt_type = wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED;
            wxRibbonToolBarEvent notification(evt_type, m_active_tool->id);
            if(m_active_tool->kind == wxRIBBON_BUTTON_TOGGLE)
            {
                m_active_tool->state ^=
                    wxRIBBON_BUTTONBAR_BUTTON_TOGGLED;
                notification.SetInt(m_active_tool->state &
                    wxRIBBON_BUTTONBAR_BUTTON_TOGGLED);
            }
            notification.SetEventObject(this);
            notification.SetBar(this);
            ProcessEvent(notification);
        }

        // Notice that m_active_tool could have been reset by the event handler
        // above so we need to test it again.
        if (m_active_tool)
        {
            m_active_tool->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
            m_active_tool = NULL;
            Refresh(false);
        }
    }
}
Esempio n. 7
0
// ----------------------------------------------------------------------------
bool ThreadSearchFrame::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& files)
// ----------------------------------------------------------------------------
{
    bool success = true; // Safe case initialisation

    // first check to see if a workspace is passed. If so, only this will be loaded
    wxString foundWorkspace;
    for (unsigned int i = 0; i < files.GetCount(); ++i)
    {
        FileType ft = FileTypeOf(files[i]);
        if (ft == ftCodeBlocksWorkspace || ft == ftMSVC6Workspace || ft == ftMSVC7Workspace)
        {
            foundWorkspace = files[i];
            break;
        }
    }

    if (!foundWorkspace.IsEmpty())
      success &= OpenGeneric(foundWorkspace);
    else
    {
        wxBusyCursor useless;
        wxPaintEvent e;
        ProcessEvent(e);

        Freeze();
        for (unsigned int i = 0; i < files.GetCount(); ++i)
          success &= OpenGeneric(files[i]);
        Thaw();
    }
    return success;
}
Esempio n. 8
0
/*
===============
idEventLoop::RunEventLoop
===============
*/
int idEventLoop::RunEventLoop( bool commandExecution )
{
	sysEvent_t	ev;
	
	while( 1 )
	{
	
		if( commandExecution )
		{
			// execute any bound commands before processing another event
			cmdSystem->ExecuteCommandBuffer();
		}
		
		ev = GetEvent();
		
		// if no more events are available
		if( ev.evType == SE_NONE )
		{
			return 0;
		}
		ProcessEvent( ev );
	}
	
	return 0;	// never reached
}
Esempio n. 9
0
void KIWAY::ExpressMail( FRAME_T aDestination,
                MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource )
{
    KIWAY_EXPRESS   mail( aDestination, aCommand, aPayload, aSource );

    ProcessEvent( mail );
}
Esempio n. 10
0
/*
 * Starting point for the module.  We do not use main since it would
 * collide with main in libppapi_cpp.
 */
int example_main(int argc, char *argv[]) {
  fprintf(stdout,"Started main.\n");
  g_pCore = (PPB_Core*)PSGetInterface(PPB_CORE_INTERFACE);
  g_pFullscreen = (PPB_Fullscreen*)PSGetInterface(PPB_FULLSCREEN_INTERFACE);
  g_pGraphics2D = (PPB_Graphics2D*)PSGetInterface(PPB_GRAPHICS_2D_INTERFACE);
  g_pInstance = (PPB_Instance*)PSGetInterface(PPB_INSTANCE_INTERFACE);
  g_pImageData = (PPB_ImageData*)PSGetInterface(PPB_IMAGEDATA_INTERFACE);
  g_pView = (PPB_View*)PSGetInterface(PPB_VIEW_INTERFACE);

  g_pInputEvent =
      (PPB_InputEvent*) PSGetInterface(PPB_INPUT_EVENT_INTERFACE);
  g_pKeyboardInput = (PPB_KeyboardInputEvent*)
      PSGetInterface(PPB_KEYBOARD_INPUT_EVENT_INTERFACE);
  g_pMouseInput =
      (PPB_MouseInputEvent*) PSGetInterface(PPB_MOUSE_INPUT_EVENT_INTERFACE);
  g_pTouchInput =
      (PPB_TouchInputEvent*) PSGetInterface(PPB_TOUCH_INPUT_EVENT_INTERFACE);

  PSEventSetFilter(PSE_ALL);
  while (1) {
    /* Process all waiting events without blocking */
    PSEvent* event;
    while ((event = PSEventTryAcquire()) != NULL) {
      ProcessEvent(event);
      PSEventRelease(event);
    }

    /* Render a frame, blocking until complete. */
    if (g_Context.bound) {
      Render();
    }
  }
  return 0;
}
Esempio n. 11
0
/*
================
rvEffect::Event_EarthQuake
================
*/
void rvEffect::Event_EarthQuake ( float requiresLOS ) {
    float quakeChance;

    if ( !spawnArgs.GetFloat("quakeChance", "0", quakeChance) ) {
        return;
    }

    if ( rvRandom::flrand(0, 1.0f) > quakeChance ) {
        // failed its activation roll
        return;
    }

    if ( requiresLOS ) {
        // if the player doesn't have line of sight to this fx, don't do anything
        trace_t		trace;
        idPlayer	*player = gameLocal.GetLocalPlayer();
        idVec3		viewOrigin;
        idMat3		viewAxis;

        player->GetViewPos(viewOrigin, viewAxis);
// RAVEN BEGIN
// ddynerman: multiple collision worlds
        gameLocal.TracePoint( this, trace, viewOrigin, GetPhysics()->GetOrigin(), MASK_OPAQUE, player );
// RAVEN END
        if (trace.fraction < 1.0f)
        {
            // something blocked LOS
            return;
        }
    }

    // activate this effect now
    ProcessEvent ( &EV_Activate, gameLocal.entities[ENTITYNUM_WORLD] );
}
    void ReplicatedStore::StateMachine::PostChangeRoleEvent(
        ::FABRIC_REPLICA_ROLE newRole, 
        StateMachineCallback const & callback,
        ComponentRootSPtr const & root)
    {
        ReplicatedStoreEvent::Enum event;
        switch (newRole)
        {
            case ::FABRIC_REPLICA_ROLE_PRIMARY:
                event = ReplicatedStoreEvent::ChangePrimary;
                break;

            case ::FABRIC_REPLICA_ROLE_IDLE_SECONDARY:
            case ::FABRIC_REPLICA_ROLE_ACTIVE_SECONDARY:
                event = ReplicatedStoreEvent::ChangeSecondary;
                break;

            default:
                Assert::CodingError(
                    "{0} unrecognized ::FABRIC_REPLICA_ROLE = {1}", 
                    this->TraceId, 
                    static_cast<int>(newRole));
        }

        Threadpool::Post([this, root, event, callback]{ ProcessEvent(event, callback); });
    }
        void KeyboardShortcutEditor::OnKeyUp(wxKeyEvent& event) {
            if (m_key == WXK_NONE) {
                const int key = event.GetKeyCode();
                switch (key) {
                    case WXK_SHIFT:
                    case WXK_ALT:
                    case WXK_CONTROL:
                        if (m_modifierKey1 == key)
                            m_modifierKey1 = WXK_NONE;
                        else if (m_modifierKey2 == key)
                            m_modifierKey2 = WXK_NONE;
                        else if (m_modifierKey3 == key)
                            m_modifierKey3 = WXK_NONE;
                        break;
#if defined __APPLE__
                    case WXK_RAW_CONTROL:
                        // not supported
                        break;
#endif
                    default:
                        break;
                }
                update();
            } else {
                KeyboardShortcutEvent shortcutEvent(m_modifierKey1, m_modifierKey2, m_modifierKey3, m_key);
                shortcutEvent.SetEventType(EVT_KEYBOARD_SHORTCUT_EVENT);
                shortcutEvent.SetEventObject(this);
                shortcutEvent.SetId(GetId());
                ProcessEvent(shortcutEvent);
            }
        }
Esempio n. 14
0
void LLDBConnector::DeleteAllBreakpoints()
{
    if ( !IsRunning() ) {
        m_pendingDeletionBreakpoints.clear();
        m_breakpoints.clear();
        
        LLDBEvent event(wxEVT_LLDB_BREAKPOINTS_UPDATED);
        event.SetBreakpoints( GetAllBreakpoints() );
        ProcessEvent( event );
        return;
     }

    // mark all breakpoints for deletion
    CL_DEBUGS(wxString () << "codelite: DeleteAllBreakpoints called");
    m_pendingDeletionBreakpoints.swap( m_breakpoints );
    
    if ( !IsCanInteract() ) {
        Interrupt( kInterruptReasonDeleteAllBreakpoints );
        
    } else {
        LLDBCommand command;
        command.SetCommandType(kCommandDeleteAllBreakpoints);
        SendCommand( command );
        m_pendingDeletionBreakpoints.clear();

    }
}
Esempio n. 15
0
i32 xwl_pollevent( xwl_event_t *event )
{
#ifdef _WIN32
	MSG msg;

	while ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) )
	{
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
#endif

#if LINUX
    XEvent ev;
    i32 i;
    xwl_window_handle_t *wh = 0;
    XEvent lastKeyReleaseEvent;

    for( i = 0; i < XWL_MAX_WINDOW_HANDLES; ++i )
    {
        wh = &xwl_windowHandles[i];
        if ( wh->handle.handle != 0 )
        {
            while (XCheckIfEvent( currentDisplay, &ev, &CheckEvent, wh->handle.handle) )
            {
                if ((ev.type == KeyPress) || (ev.type == KeyRelease) )
                {
                    if ( ev.xkey.keycode < 256 )
                    {
                        // To detect if it is a repeated key event, we check the current state of the key.
                        // - If the state is "down", KeyReleased events must obviously be discarded.
                        // - KeyPress events are a little bit harder to handle: they depend on the EnableKeyRepeat state,
                        //   and we need to properly forward the first one.
                        char keys[32];
                        XQueryKeymap(currentDisplay, keys);
                        if (keys[ev.xkey.keycode >> 3] & (1 << (ev.xkey.keycode % 8)))
                        {
                            // KeyRelease event + key down = repeated event --> discard
                            if (ev.type == KeyRelease)
                            {
                                lastKeyReleaseEvent = ev;
                                continue;
                            }

                            // KeyPress event + key repeat disabled + matching KeyRelease event = repeated event --> discard
                            if ((ev.type == KeyPress) &&
                                (lastKeyReleaseEvent.xkey.keycode == ev.xkey.keycode) &&
                                (lastKeyReleaseEvent.xkey.time == ev.xkey.time))
                            {
                                continue;
                            }
                        }
                    }
                }

                ProcessEvent( ev, wh );
            }
        }
    }
Esempio n. 16
0
void CMusikPlayer::FinalizePause()
{
	m_SndEngine.SetPlayState( MUSIKEngine::Paused );
	m_Paused = true;
    MusikPlayerEvent ev_pause(this,wxEVT_MUSIKPLAYER_PLAY_PAUSE);
    ProcessEvent(ev_pause);

}
Esempio n. 17
0
void TrackList::ResizedEvent(const TrackListNode *node)
{
   if (node) {
      wxCommandEvent e(EVT_TRACKLIST_RESIZED);
      e.SetClientData(node->t);
      ProcessEvent(e);
   }
}
void CardViewer::onChangeSize() {
	wxSize ws = GetSize(), cs = GetClientSize();
	wxSize desired_cs = (wxSize)getRotation().getExternalSize() + ws - cs;
	if (desired_cs != cs) {
		wxCommandEvent ev(EVENT_SIZE_CHANGE, GetId());
		ProcessEvent(ev);
	}
}
//Devsound initialization is completed.Configure devsound capabilities.
void CAudioOutputControlTestClass::InitializeComplete(TInt aError)
{
    FTRACE(FPrint(_L("CAudioOutputControlTestClass::InitializeComplete")));

    iLog->Log(_L("InitializeComplete, return code =%d!!!"),aError);
    ProcessEvent(EInitializeComplete, aError);

}
Esempio n. 20
0
void InterfaceConfigPane::OnThemeSelected(wxCommandEvent& event)
{
  SConfig::GetInstance().theme_name = WxStrToStr(m_theme_choice->GetStringSelection());

  wxCommandEvent theme_event{DOLPHIN_EVT_RELOAD_THEME_BITMAPS};
  theme_event.SetEventObject(this);
  ProcessEvent(theme_event);
}
Esempio n. 21
0
void ButcherView::DoChangedEvent(ButcherViewChangedEvent::change_t change, long movex, long movey)
{
    ButcherViewChangedEvent event(change);
    event.SetMove(movex, movey);
    event.SetEventObject(this);

    ProcessEvent(event);
}
Esempio n. 22
0
void EventNotifier::NotifyWorkspaceReloadStartEvet(const wxString& workspaceFile)
{
    if(_eventsDiabled)
        return;
    clCommandEvent event(wxEVT_WORKSPACE_RELOAD_STARTED);
    event.SetFileName( workspaceFile );
    ProcessEvent( event );
}
Esempio n. 23
0
void TrackList::ResizedEvent(TrackNodePointer node)
{
   if (!isNull(node)) {
      wxCommandEvent e(EVT_TRACKLIST_RESIZED);
      e.SetClientData(node->get());
      ProcessEvent(e);
   }
}
Esempio n. 24
0
bool wxApp::OSXOnShouldTerminate()
{
    wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY);
    event.SetEventObject(this);
    event.SetCanVeto(true);
    ProcessEvent(event);
    return !event.GetVeto();
}
Esempio n. 25
0
void
ZMLE::MLENUpdate( )
{
#ifdef DEBUG_ALL
   TraceLineS( "ZMLE::MLENUpdate: ", *m_pzsTag );
#endif
   ProcessEvent( this, 2048 );
   Default( );             // pass it along to parent
}
Esempio n. 26
0
void wxCustomHeightListCtrl::OnMouseEvent(wxMouseEvent& event)
{
	bool changed = false;
	if (event.ButtonDown() && m_allow_selection) {
		wxPoint pos = event.GetPosition();
		int x, y;
		CalcUnscrolledPosition(pos.x, pos.y, &x, &y);
		if (y < 0 || y > static_cast<int>(m_lineHeight * m_rows.size())) {
			m_focusedLine = npos;
			m_selectedLines.clear();
			changed = true;
		}
		else {
			size_t line = static_cast<size_t>(y / m_lineHeight);

			if (event.ShiftDown()) {
				if (m_focusedLine == npos) {
					changed |= m_selectedLines.insert(line).second;
				}
				else if (line < m_focusedLine) {
					for (size_t i = line; i <= m_focusedLine; ++i) {
						changed |= m_selectedLines.insert(i).second;
					}
				}
				else {
					for (size_t i = line; i >= m_focusedLine && i != npos; --i) {
						changed |= m_selectedLines.insert(i).second;
					}
				}
			}
			else if (event.ControlDown()) {
				if (m_selectedLines.find(line) == m_selectedLines.end()) {
					m_selectedLines.insert(line);
				}
				else {
					m_selectedLines.erase(line);
				}
				changed = true;
			}
			else {
				m_selectedLines.clear();
				m_selectedLines.insert(line);
				changed = true;
			}

			m_focusedLine = line;
		}
		Refresh();
	}

	event.Skip();

	if (changed) {
		wxCommandEvent evt(wxEVT_COMMAND_LISTBOX_SELECTED, GetId());
		ProcessEvent(evt);
	}
}
Esempio n. 27
0
void wxProcess::OnTerminate(int pid, int status)
{
    wxProcessEvent event(m_id, pid, status);

    if ( !ProcessEvent(event) )
        delete this;
    //else: the object which processed the event is responsible for deleting
    //      us!
}
Esempio n. 28
0
bool EventNotifier::SendCommandEvent(int eventId, void* clientData)
{
    if(_eventsDiabled)
        return false;

    wxCommandEvent evt(eventId);
    evt.SetClientData(clientData);
    return ProcessEvent(evt);
}
Esempio n. 29
0
 void Application::Run()
 {
     while (theApplicationMeta->windowCount > 0)
     {
         XEvent event;
         XNextEvent(theApplicationMeta->display, &event);
         ProcessEvent(event);
     }
 }
Esempio n. 30
0
void Rune::respawnAtOriginalOrigin( Event * )
{
	if ( _originalOriginSet )
	{
		NoLerpThisFrame();
		setOrigin( _originalOrigin );
		ProcessEvent( EV_Item_DropToFloor );
	}
}