Example #1
0
    bool ProcessEvent(wxEvent& evt)
    {
        if (evt.GetEventType() == wxEVT_COMMAND_MENU_SELECTED)
        {
            m_last_id = evt.GetId();
            return true;
        }

        if (GetNextHandler())
            return GetNextHandler()->ProcessEvent(evt);

        return false;
    }
Example #2
0
    bool ProcessEvent(wxEvent& evt)
    {
        if (evt.GetEventType() == wxEVT_MENU)
        {
            m_lastId = evt.GetId();
            return true;
        }

        if (GetNextHandler())
            return GetNextHandler()->ProcessEvent(evt);

        return false;
    }
Example #3
0
void cbRowDragPlugin::OnDrawPaneBackground ( cbDrawPaneDecorEvent& event )
{
    mpPane = event.mpPane;

    // FIXME:: this may harm operation of other plugins

    if ( GetNextHandler() && mpPane->GetRowList().GetCount() )
    {
        // first, let other plugins add their decorations now
    
        GetNextHandler()->ProcessEvent( event );
        event.Skip(false);
    }

    wxClientDC dc( &mpLayout->GetParentFrame() );

    dc.SetClippingRegion( mpPane->mBoundsInParent.x,
                          mpPane->mBoundsInParent.y,
                          mpPane->mBoundsInParent.width,
                          mpPane->mBoundsInParent.height );

    int cnt = GetHRowsCountForPane( event.mpPane );

    if ( cnt > 0 ) 

        DrawCollapsedRowsBorder( dc );

    if ( mpPane->GetRowList().GetCount() )
    
        DrawRowsDragHintsBorder( dc );

    cbRowInfo* pRow = GetFirstRow();

    while( pRow )
    {
        DrawRowDragHint( pRow, dc, false );
        pRow = pRow->mpNext;
    }

    for( int i = 0; i != cnt; ++i )

        DrawCollapsedRowIcon(i, dc, false );
}
Example #4
0
/// If thread isn't running, immediately sends an event confirming this controller can be deleted.
/// Otherwise, signals to the thread to tell it to die, which will (at its leisure) generate the above event and exit, and the event will be passed on once the thread has exited.
/// This allows the controller to be deleted without waiting for a pending CORBA command.
/// Once this function has been called, the controller should be considered unusable.
void Controller::Destroy()
{
	wxDELETE(mPollingTimer); //stops it too!
	if (IsAlive()) { //won't be if initialisation failed
		Signal(DIE);
	}
	else { //write a suicide note now
		ControllerThreadEvent event(wxEVT_CONTROLLER_THREAD);
		mMutex.Lock();
		event.SetName(mName);
		mMutex.Unlock();
		event.SetCommand(DIE);
		GetNextHandler()->AddPendingEvent(event);
	}
}
    virtual bool ProcessEvent(wxEvent& event)
    {
        // we intercept the command events from radio buttons
        if ( event.GetEventType() == wxEVT_COMMAND_RADIOBUTTON_SELECTED )
        {
            m_radio->OnRadioButton(event);
        }
        else if ( event.GetEventType() == wxEVT_KEY_DOWN )
        {
            if ( m_radio->OnKeyDown((wxKeyEvent &)event) )
            {
                return true;
            }
        }

        // just pass it on
        return GetNextHandler()->ProcessEvent(event);
    }
    virtual bool ProcessEvent(wxEvent& ev) {
        int t = ev.GetEventType();
        if ( t == wxEVT_LEFT_DOWN      || t == wxEVT_RIGHT_DOWN
                || t == wxEVT_MOVE           || t == wxEVT_SIZE
                || t == wxEVT_MENU_HIGHLIGHT || t == wxEVT_MENU_OPEN    || t == wxEVT_MENU_OPEN
                || t == wxEVT_ACTIVATE       || t == wxEVT_CLOSE_WINDOW || t == wxEVT_KILL_FOCUS
                || t == wxEVT_COMMAND_TOOL_CLICKED)
        {
            // close the list, and pass on the event
            // don't just use ev.Skip(), because this event handler will be removed by hiding,
            // so there will be no next handler to skip to
            wxEvtHandler* nh = GetNextHandler();
            if (nh) nh->ProcessEvent(ev);
            list.hide(false);
            return false;
        } else {
//			if (t !=10093 && t !=10098 && t !=10097 && t !=10099 && t !=10004 && t !=10062
//			 && t !=10025 && t !=10035 && t !=10034 && t !=10036 && t !=10042 && t !=10119)
//			{
//				t=t;//DEBUG
//			}
            return wxEvtHandler::ProcessEvent(ev);
        }
    }
Example #7
0
/// Respond to a thread event.
/// Passes event on if appropriate and starts the timer or sends another command depending on the circumstances.
/// @param event The thread event.
void Controller::OnThreadEvent(ControllerThreadEvent & event)
{
	mReconnecting = COMM_FAILURE == event.GetResult();
	if (DIE == event.GetCommand()) { //the thread is on its last legs
		Wait(); //on the offchance the thread is still running
//std::cerr << "die notification" << std::endl;
		GetNextHandler()->AddPendingEvent(event); //NB don't use Skip() because the next event handler can delete this controller, leading to a hang
	}
	else if (mPollingTimer) { //not waiting to die
		if ((CONNECT == event.GetCommand() && SUCCESS != event.GetResult()) //failure to connect
		   || (RECONNECT == event.GetCommand() && FAILURE == event.GetResult())) { //failure to reconnect
			//let the parent know - parent will delete this controller
//std::cerr << "connect/reconnect failure notification" << std::endl;
			GetNextHandler()->AddPendingEvent(event); //NB don't use Skip() because the next event handler can delete this controller, leading to a hang
		}
		else if (FAILURE == event.GetResult()) {
			if (event.GetCommand() != mPrevCommand) {
				mMutex.Lock();
				mStartTimecode.undefined = true; //in case we're recording and the start time requested is no longer in the buffer
				mStopTimecode.undefined = true; //in case we're stopping and the stop time requested is no longer in the buffer
				mMutex.Unlock();
				//let the parent know
//std::cerr << "command failure notification" << std::endl;
				GetNextHandler()->AddPendingEvent(event);
			}
			if (event.GetCommand() == mPendingCommand || NONE == mPendingCommand) { //this isn't the result of a previous command which has been superceded
				//try again
//std::cerr << "retrying failed command" << std::endl;
				mCommandOnTimer = event.GetCommand();
				mPollingTimer->Start(POLLING_INTERVAL, wxTIMER_ONE_SHOT);
			}
		}
		else if (COMM_FAILURE == event.GetResult()) {
			if (RECONNECT != event.GetCommand()) { //not already reconnecting
				//start reconnecting
//std::cerr << "reconnect starting notification: setting timecodes undefined" << std::endl;
				//if trying to record or stop, the requested frame might not be available by the time we succeed so record/stop "now"
				mMutex.Lock();
				mStartTimecode.undefined = true; //in case we're recording and the start time requested is no longer in the buffer
				mStopTimecode.undefined = true; //in case we're stopping and the stop time requested is no longer in the buffer
				mMutex.Unlock();
				//let the parent know
				GetNextHandler()->AddPendingEvent(event);
				//buffer the failed command
				if ((RECORD == event.GetCommand() || STOP == event.GetCommand() || ADD_PROJECT_NAMES == event.GetCommand()) && NONE == mPendingCommand) { //make sure the event doesn't override a command received while waiting for a response
//std::cerr << "new pending command" << std::endl;
					//execute command when reconnected
					mPendingCommand = event.GetCommand();
					mPendingCommandSent = false; //needs to be sent again when communication re-established
				}
			}
			mCommandOnTimer = RECONNECT;
			mPollingTimer->Start(POLLING_INTERVAL, wxTIMER_ONE_SHOT);
		}
		else if (RECONNECT == event.GetCommand()) { //just reconnected
			//set tape IDs as may be a restarted recorder which won't have this information
//std::cerr << "successful reconnect notification" << std::endl;
			GetNextHandler()->AddPendingEvent(event);
			Signal(SET_TAPE_IDS);
		}
		else if (event.GetCommand() == mPendingCommand) { //pending command successfully sent
//std::cerr << "pending command successfully sent" << std::endl;
			mPendingCommand = NONE;
			mPendingCommandSent = false; //default state
			GetNextHandler()->AddPendingEvent(event);
			mPollingTimer->Start(POLLING_INTERVAL, wxTIMER_ONE_SHOT); //back to normal
		}
		else if (NONE != mPendingCommand) { //not in idle state
			if (!mPendingCommandSent) {
				//Send the pending command again immediately, with updated parameters
//std::cerr << "pending command being sent" << std::endl;
				Signal(mPendingCommand);
				mPendingCommandSent = true;
			}
		}
		else { //idle state
//std::cerr << "ordinary notification" << std::endl;
			GetNextHandler()->AddPendingEvent(event);
			mCommandOnTimer = STATUS;
			mPollingTimer->Start(POLLING_INTERVAL, wxTIMER_ONE_SHOT);
		}
	}
	mPrevCommand = event.GetCommand();
}