void on_preview_change(void)
{
int enable;
       if(update_ui) return;
        HandleAction(ACT_PreviewChanged);

}
/*
========================
idMenuWidget_DevList::NavigateBack
========================
*/
void idMenuWidget_DevList::NavigateBack() {
	assert( devMapListInfos.Num() != 0 );
	if ( devMapListInfos.Num() == 1 ) {
		// Important that this goes through as a DIRECT event, since more than likely the list
		// widget will have the parent's focus, so a standard ReceiveEvent() here would turn
		// into an infinite recursion.
		idWidgetEvent event( WIDGET_EVENT_BACK, 0, NULL, idSWFParmList() );
		
		idWidgetAction action;
		action.Set( WIDGET_ACTION_GO_BACK, MENU_ROOT );
		HandleAction( action, event );
		
		return;
	}

	// NOTE: we need a copy here, since it's about to be removed from the list
	const indexInfo_t indexes = devMapListInfos[ devMapListInfos.Num() - 1 ];
	assert( indexes.focusIndex < GetChildren().Num() );
	assert( ( indexes.viewIndex - indexes.viewOffset ) < GetNumVisibleOptions() );
	devMapListInfos.RemoveIndex( devMapListInfos.Num() - 1 );

	RecalculateDevMenu();

	SetViewIndex( indexes.viewIndex );
	SetViewOffset( indexes.viewOffset );

	Update();

	// NOTE: This must be done AFTER Update() because so that it is sure to refer to the proper sprite
	GetChildByIndex( indexes.focusIndex ).SetState( WIDGET_STATE_SELECTED );
	ForceFocusIndex( indexes.focusIndex );
	SetFocusIndex( indexes.focusIndex );

	gameLocal->GetMainMenu()->ClearWidgetActionRepeater();
}
static gboolean on_PlayButtonHackTimer (gpointer data)
{
    gdk_threads_enter();
    HandleAction (ACT_PlayAvi);
    gdk_threads_leave();
    return FALSE;
}
void wxGenericFileDialog::OnSelected( wxListEvent &event )
{
    static bool inSelected = false;

    if (inSelected)
        return;

    inSelected = true;
    wxString filename( event.m_item.m_text );

#ifdef __WXWINCE__
    // No double-click on most WinCE devices, so do action immediately.
    HandleAction( filename );
#else
    if (filename == wxT("..")) return;

    wxString dir = m_list->GetDir();
    if (!IsTopMostDir(dir))
        dir += wxFILE_SEP_PATH;
    dir += filename;
    if (wxDirExists(dir)) return;

    ignoreChanges = true;
    m_text->SetValue( filename );
    ignoreChanges = false;
#endif
    inSelected = false;
}
void jogButton (void *, unsigned short /* raw_button */, Action gui_action)
{
    // hack alert: see comment for on_PlayButtonHackTimer(), above
    if (gui_action == ACT_PlayAvi)
        g_timeout_add (10, on_PlayButtonHackTimer, NULL);
    else if (gui_action != ACT_INVALID)
        HandleAction (gui_action);
}
gboolean destroyCallback(GtkWidget * widget,
				  GdkEvent * event, gpointer user_data)
{
    UNUSED_ARG(widget);
    UNUSED_ARG(event);
    UNUSED_ARG(user_data);
    HandleAction(ACT_Exit);
    return 1;
}
///
///	This is a relay function to do UI events -> gtk_gui.cpp
///
void guiCallback(GtkMenuItem * menuitem, gpointer user_data)
{
    UNUSED_ARG(menuitem);
    Action act;
    uint32_t aint;

    aint = (long int) user_data;
    act = (Action) aint;
    if(act==ACT_Scale)
    {
    	if( _upd_in_progres) return;
	_upd_in_progres++;
   	 HandleAction(act);
	_upd_in_progres--;
   	return;
    }
     HandleAction(act);
}
/*
========================
idMenuWidget_CommandBar::ReceiveEvent
========================
*/
bool idMenuWidget_CommandBar::ExecuteEvent( const idWidgetEvent & event ) {
	if ( event.type == WIDGET_EVENT_COMMAND ) {
		if ( verify( event.arg >= 0 && event.arg < buttons.Num() ) ) {
			HandleAction( buttons[ event.arg ].action, event, this );
		}
		return true;
	} else {
		return idMenuWidget::ExecuteEvent( event );
	}
}
Exemple #9
0
bool Connection::handleAction (Action * a, E_ActionHandleType sync)
{
	if (a->type() == e_Close)
	{
		m_main_window->markConnectionForClose(this);
		return true;
	}

	recurse(m_data, HandleAction(a, sync));
	return true;
}
Exemple #10
0
L1ParserStatusType L1ParserParse(L1Parser* self, L1LexerTokenType tokenType, const char* tokenString, size_t tokenStringLength)
{
	self->currentTokenIndex ++;
	assert(L1ArrayGetElementCount(& self->symbolStack) > 0);
	unsigned short top;
	L1ArrayPeek(& self->symbolStack, & top, sizeof(unsigned short));

	while (top >= NonterminalOffset)
	{
		assert (L1ArrayGetElementCount(& self->symbolStack) > 0);
		L1ArrayPop(& self->symbolStack, & top, sizeof(unsigned short));
		if (top < ActionOffset)
		{
			const unsigned char ruleIndex = ParseTable[top - NonterminalOffset][(size_t) tokenType];
			if (not ruleIndex)
			{
				return L1ParserStatusTypeUnexpectedSymbol;
			}
			const unsigned char* symbols = RuleTable[ruleIndex - 1];
			size_t symbolCount = 0;
			for (; symbols[symbolCount] not_eq RuleTerminationID; symbolCount++);
			for (size_t i = symbolCount; i-- > 0;)
			{
				unsigned short symbol = symbols[i];
				L1ArrayPush(& self->symbolStack, & symbol, sizeof(unsigned short));
			}
		}
		else
		{
			HandleAction(self, top, tokenString, tokenStringLength);
		}
		
		assert (L1ArrayGetElementCount(& self->symbolStack) > 0);
		L1ArrayPeek(& self->symbolStack, & top, sizeof(unsigned short));
	}
	
	{
		if (top == (unsigned short) tokenType)
		{
			assert (L1ArrayGetElementCount(& self->symbolStack) > 0);
			L1ArrayPop(& self->symbolStack, NULL, sizeof(unsigned short));
			if (tokenType == L1LexerTokenTypeDone)
				return L1ParserStatusTypeDone;
			else
				return L1ParserStatusTypeNone;
		}
		else
		{
			return L1ParserStatusTypeUnexpectedSymbol;
		}
	}
	
	return L1ParserStatusTypeNone;
}
Exemple #11
0
 /* virtual */
 void ICreature::HandleTick(TimeStep dt)
 {
   Base::HandleTick(dt);
   HandleAction(dt);
   if(m_StarsView.CheckActive())
   {
     m_StarsView.HandleTick(dt);
   }
   
   if(m_SensorModeRequested)
   {
     SetSensorMode(true);
   }
 }
void on_audio_change(void)
{
int enable;
       if(update_ui) return;
        if(!UI_getCurrentACodec()) // copy ?
        {
                enable=0;
        }
        else enable=1;
        gtk_widget_set_sensitive(lookup_widget(guiRootWindow,"buttonConfA"),enable);        
        gtk_widget_set_sensitive(lookup_widget(guiRootWindow,"buttonAudioFilter"),enable);        
        HandleAction(ACT_AudioCodecChanged);

}
JSBool ADM_JSAvidemuxAudio::ScanVBR(JSContext *cx, JSObject *obj, uintN argc, 
                                      jsval *argv, jsval *rval)
{// begin ScanVBR
        ADM_JSAvidemuxAudio *p = (ADM_JSAvidemuxAudio *)JS_GetPrivate(cx, obj);
        // default return value
        *rval = BOOLEAN_TO_JSVAL(false);
        if(argc != 0)
                return JS_FALSE;
        printf("Scaning Audio... \n");
        enterLock();
        HandleAction(ACT_AudioMap);
        leaveLock()
        *rval = BOOLEAN_TO_JSVAL(true);
        return JS_TRUE;
}// end ScanVBR
void UI_focusAfterActivate(GtkMenuItem * menuitem, gpointer user_data)
{
	// return focus to window once Enter has been pressed
	UNUSED_ARG(menuitem);
    Action act;
    uint32_t aint;
    if(update_ui) return; // no event sent

    aint = (long int) user_data;
    act = (Action) aint;

	HandleAction(act);

	gtk_widget_grab_focus(lookup_widget(guiRootWindow, "menuBar"));
}
Exemple #15
0
void wxGenericFileCtrl::OnSelected( wxListEvent &event )
{
    if ( m_ignoreChanges )
        return;

    if ( m_inSelected )
        return;

    m_inSelected = true;
    const wxString filename( event.m_item.m_text );

#ifdef __WXWINCE__
    // No double-click on most WinCE devices, so do action immediately.
    HandleAction( filename );
#else
    if ( filename == wxT( ".." ) )
    {
        m_inSelected = false;
        return;
    }

    wxString dir = m_list->GetDir();
    if ( !IsTopMostDir( dir ) )
        dir += wxFILE_SEP_PATH;
    dir += filename;
    if ( wxDirExists( dir ) )
    {
        m_inSelected = false;

        return;
    }


    m_ignoreChanges = true;
    m_text->SetValue( filename );

    if ( m_list->GetSelectedItemCount() > 1 )
    {
        m_text->Clear();
    }

    if ( !m_noSelChgEvent )
        GenerateSelectionChangedEvent( this, this );

    m_ignoreChanges = false;
#endif
    m_inSelected = false;
}
/*
========================
idMenuWidget::ExecuteEvent

Handles the event directly, and doesn't pass it through the focus chain.

This should only be used in very specific circumstances!  Most events should go to the focus.
========================
*/
bool idMenuWidget::ExecuteEvent( const idWidgetEvent& event )
{
	idList< idWidgetAction, TAG_IDLIB_LIST_MENU >* const actions = GetEventActions( event.type );
	
	if( actions != NULL )
	{
		for( int actionIndex = 0; actionIndex < actions->Num(); ++actionIndex )
		{
			HandleAction( ( *actions )[ actionIndex ], event, this );
		}
	}
	
	SendEventToObservers( event );
	
	return actions != NULL && actions->Num() > 0;
}
void on_video_change(void)
{
int enable;
        if(update_ui)
        {
                printf("Updating\n");
                 return;
        }

        if(!UI_getCurrentVCodec()) // copy ?
        {
                enable=0;
        }
        else enable=1;
        gtk_widget_set_sensitive(lookup_widget(guiRootWindow,"buttonConfV"),enable);        
        gtk_widget_set_sensitive(lookup_widget(guiRootWindow,"buttonFilters"),enable);        
        HandleAction(ACT_VideoCodecChanged);
}
BOOL CollectionNavigationPane::OnInputAction(OpInputAction* action)
{
	switch (action->GetAction())
	{
		case OpInputAction::ACTION_LOWLEVEL_PREFILTER_ACTION:
		{
			OpInputAction* child_action = action->GetChildAction();
			if (child_action->GetAction() != OpInputAction::ACTION_LOWLEVEL_KEY_PRESSED)
				return FALSE;

			switch(child_action->GetActionData())
			{
				case OP_KEY_ENTER:
				{
					OpTreeView* tv = m_tree_view->GetOpWidget();
					BOOL state = g_op_system_info->GetShiftKeyState();
					if (state == 0 && child_action->GetFirstInputContext() == tv && tv->GetEditPos() == -1)
					{
						int pos = tv->GetSelectedItemPos();
						BOOL is_folder_open = tv->IsItemOpen(pos);
						tv->OpenItem(pos, !is_folder_open);
						if (!is_folder_open)
							m_container->OpenSelectedFolder((NavigationItem*)tv->GetSelectedItem());
						return TRUE;
					}
				}
			}
		}
		return FALSE;

		case OpInputAction::ACTION_GET_ACTION_STATE:
			 return GetActionGetState(action->GetChildAction());
	}

	if (m_tree_view->GetOpWidget()->OnInputAction(action))
		return TRUE;

	BOOL handled = FALSE;
	if (CanHandleAction(action) && !DisablesAction(action))
		handled =  OpStatus::IsSuccess(HandleAction(action));

	return handled;
}
void wxGenericFileDialog::OnActivated( wxListEvent &event )
{
    HandleAction( event.m_item.m_text );
}
Exemple #20
0
void wxGenericFileCtrl::OnTextEnter( wxCommandEvent &WXUNUSED( event ) )
{
    HandleAction( m_text->GetValue() );
}
static gboolean         cb_next(GtkButton * button, gpointer user_data)
{
        HandleAction(ACT_NextFrame);
        return FALSE;
}
void UI_on_key_press(GtkWidget *widget, GdkEventKey* event, gpointer user_data)
{
    UNUSED_ARG(widget);
    UNUSED_ARG(user_data);
	gboolean shift = FALSE;
	gboolean ctrl = FALSE;
	gboolean alt = FALSE;
	Action action;

	//printf("key : %d (%c) \n",event->keyval,event->keyval);
	
	if (event->state & GDK_CONTROL_MASK)
	{
		ctrl = TRUE;
	}
	if (event->state & GDK_SHIFT_MASK)
	{
		shift = TRUE;
	}
	if(event->state & GDK_MOD1_MASK)
	{
		alt = TRUE;
	}
	// ALT+x
	//_____________
	if(alt)
	{
	
		switch(event->keyval)
		{
			case GDK_l:
			case GDK_L: action=ACT_OpenAvi;break;
			case GDK_s:
			case GDK_S: action=ACT_SaveWork;break;
				
			// repeat Keyboard stuff
			case GDK_B:
			
				if(shift)
					action=ACT_GotoMarkA;
				else
					action=ACT_MarkA;
				break;
			case GDK_E:
			
				if(shift)
					action=ACT_GotoMarkB;
				else
					action=ACT_MarkB;
				break;
			default:
				return;		
		}
		HandleAction(action);
		return;
	
	}
	action=ACT_DUMMY;
	// CTRL+x
	//_____________
	if(TRUE==ctrl)
	{
	  switch (event->keyval)
	  {
	  	case GDK_A:
		case GDK_a:
					action=ACT_AppendAvi;break;
					
	  	case GDK_c:
		case GDK_C:	action=ACT_Copy;break;
		
				
	  	case GDK_bracketleft:
					action = ACT_GotoMarkA;break;
		case GDK_bracketright:
					action = ACT_GotoMarkB;break;
					
		case GDK_F:
		case GDK_f:
					action=ACT_VideoParameter;break;					
					
	  	case GDK_G:
		case GDK_g:
					action=ACT_Goto;break;

	  	
		case GDK_M:
		case GDK_m:
					action=ACT_SaveImg;break;
		
		case GDK_O:
		case GDK_o:
					action=ACT_OpenAvi;break;
		case GDK_P:
		case GDK_p:
					action=ACT_DecoderOption;break;					
		
		case GDK_S:
		case GDK_s:
					action=ACT_SaveAvi;break;
		case GDK_u:
		case GDK_U:
					action=ACT_SetMuxParam;break;
		case GDK_v:
		case GDK_V:		action=ACT_Paste;break;		
		
		case GDK_X:
		case GDK_x:
					action=ACT_Delete;break;					
					
		default:
			break;

	  }
	}

	if(action!=ACT_DUMMY)
	{
		HandleAction(action);
		return;
	}

    switch (event->keyval)
	{
	case GDK_F1:
		action=ACT_VideoModeToggle;break;
	case GDK_F2:
		action=ACT_AudioModeToggle;break;
			
	case GDK_space:
		action=ACT_PlayAvi;
		break;
	case GDK_X:
		action=ACT_Delete;
		break;
	
	case GDK_Up:
		action=ACT_NextKFrame;
		break;
	case GDK_Down:
		action=ACT_PreviousKFrame;
		break;
			
		// Position advance
       	case GDK_Left: case GDK_KP_Left:

		// One frame
		if((shift == FALSE) && (ctrl == FALSE))
		{
			action = ACT_PreviousFrame;
		}
		// 50 frames
		else if(ctrl == TRUE)
		{
			action = ACT_Back50Frames;
		}
		// 25 frames
		else
		{
			action = ACT_Back25Frames;
		}
		break;

		// Position reverse
	case GDK_Right: case GDK_KP_Right:
		if((shift == FALSE) && (ctrl == FALSE))
		{
			action = ACT_NextFrame;
		}
		else if(ctrl == TRUE)
		{
			action = ACT_Forward50Frames;
		}
		else
		{
			action = ACT_Forward25Frames;
		}
		break;
		
		// Delete A-B section
	case GDK_Delete: case GDK_KP_Delete:
		action = ACT_Delete;
		break;
		
		// Go to first frame
	case GDK_Home: case GDK_KP_Home:
		//case GDK_Page_Up:  case GDK_KP_Page_Up:
		action = ACT_Begin;
		break;

		// Go to last frame
	case GDK_End: case GDK_KP_End:
		//case GDK_Page_Down: case GDK_KP_Page_Down:
		action = ACT_End;
		break;

		// Set A marker
	case GDK_bracketleft:
		action = ACT_MarkA;
		break;

		// Set B marker
		case GDK_bracketright:
	action = ACT_MarkB;
		break;

		default:
			printf("Key : %x not handled\n",event->keyval);
		return;
		break;
	}

	HandleAction(action);
}
void psClientCharManager::HandleMessage ( MsgEntry* me )
{
    switch ( me->GetType() )
    {
        case MSGTYPE_CHANGE_TRAIT:
        {
            ChangeTrait(me);
            break;
        }

        case MSGTYPE_USERACTION:
        {
            HandleAction( me );
            break;
        }
        case MSGTYPE_CHARREJECT:
        {
            HandleRejectCharMessage( me );
            break;
        }

        case MSGTYPE_EQUIPMENT:
        {
            HandleEquipment(me);
            return;
        }

        case MSGTYPE_EFFECT:
        {
            HandleEffect(me);
            return;
        }

        case MSGTYPE_EFFECT_STOP:
        {
            HandleEffectStop(me);
            return;
        }

        case MSGTYPE_PLAYSOUND:
        {
            if(psengine->GetSoundStatus())
            {
                HandlePlaySound(me);
            }
            return;
        }

        case MSGTYPE_GUITARGETUPDATE:
        {
            HandleTargetUpdate(me);
            return;
        }

        default:
        {
            ready = true;
            return;
        }
    }
}
Exemple #24
0
	void VideoFindProxy::handleDownload ()
	{
		Type_ = PTDownload;
		HandleAction ();
	}
void call_buildtimemap(char *p) { UNUSED_ARG(p); aprintf("timemap\n");HandleAction(ACT_AudioMap);         }
Exemple #26
0
/* ParseInput() - parse input text, create data structures
 */
void    TGrammar::ParseTokens()
    {
    TToken  Token = TToken::Null;
    TToken  LhsToken;

    ParseDeclarations();

    /* for each production (including alternatives) */
    while(Token.Type != TToken::TKEOF)
        {
        TSymbol*    LHS;
        TRule*      Rule;
        int         iSymbol;
        int         LastTokenWasAction = FALSE;
        
        if(Token.Type != TK_NONTERM)
            Token   = InputGetNext();
        if(Token.Type == TK_EOF || Token.Type == TK_SECTION)
            break;
        else if(Token.Type != TK_NONTERM && Token.Type != TK_IDENT)
            SyntaxError(ERROR_EXPECTING_NONTERM, Token,
                        "Expecting a non-terminal to start a production.");
        LHS     = AcceptLhs(Token);
        if(SymbolStart() == NULL)
            SymbolAddStart(LHS);

        LhsToken    = Token;
        Token       = InputGetNext();
        if(Token.Type != ':')
            SyntaxError(ERROR_EXPECTING_COLON, Token,
                        "Expecting ':' after non-terminal.");
        if(Token.Type == '^')
            {
            LHS->Operand            = TRUE;
            LHS->OperatorTrigger    = TRUE;
            }

        /* guarantee a rule, even if it's null */
        Rule    = SymbolNewRule(LHS);
        /* for each alternative (including action) */
        while(Token.Type != ';' && Token.Type != TK_NONTERM)
            {
            TSymbol*    Symbol = NULL;

            Token   = InputGetNext();
            LastTokenWasAction  = (Token.Type == TK_ACTION);

            /* while not at end-of-rule */
            for(iSymbol=0; Token.Type != ';' && Token.Type != '|'; ++iSymbol)
                {
                /* if it's a terminal or non-terminal */
                if(Token.Type == TK_IDENT || Token.Type == TK_QUOTED)
                    Symbol = AcceptRhs(LhsToken, Token, Rule);
                /* if it's the lookahead operator (syntactic predicate) */
                else if(Token.Type == '/')
                    {
                    if(iSymbol == 0)
                        SyntaxError(ERROR_NO_SYMBOL_BEFORE_SLASH, Token,
                            "In production for '%.*s': '/' must come after some symbol.");
                    /* ???TODO: check for multiple predicates even of different types */
                    assert(Symbol != NULL);
                    Symbol->PredicateEnd    = TRUE;
                    Rule->Predicate = TRUE;
                    }
                else if(Token.Type == TK_ACTION)
                    HandleAction(LhsToken, FakeActionToken(), Rule);
                else
                    SyntaxError(ERROR_EXPECTING_OR_SEMI, Token,
                                "In production for '%.*s': expecting non-terminal, "
                                "action, '|', '/', or ';'\n", LHS->Name.TextLen, LHS->Name.Text);
                Token   = InputGetNext();
                }
            if(!LastTokenWasAction)
                HandleAction(LhsToken, DefActToken, Rule);

            if(Token.Type == '|')
                Rule    = SymbolNewRule(LHS);
            }

        if(Token.Type != ';')
            SyntaxError(ERROR_EXPECTING_SEMICOLON, Token,
                        "Expecting ';' to terminate production list.");
        }
    if(Token.Type == TK_SECTION)
        Token   = InputGetNext();

    if(Token.Type == TK_PROGRAM)
        Globals.ProgramSection  = Token;
    else if(Token.Type == TK_EOF)
        ;
    else
        assert(FALSE);
    }
gboolean UI_on_key_press(GtkWidget *widget, GdkEventKey* event, gpointer user_data)
{
    UNUSED_ARG(widget);
    UNUSED_ARG(user_data);
	gboolean shift = FALSE;
	gboolean ctrl = FALSE;
	gboolean alt = FALSE;
	Action action;

	//printf("key : %d (%c) \n",event->keyval,event->keyval);
	
	if (event->state & GDK_CONTROL_MASK)
	{
		ctrl = TRUE;
	}
	if (event->state & GDK_SHIFT_MASK)
	{
		shift = TRUE;
	}
	if(event->state & GDK_MOD1_MASK)
	{
		alt = TRUE;
	}
	// ALT+x
	//_____________
	
	action=ACT_DUMMY;
	

    switch (event->keyval)
	{	
	case GDK_Up:
		action=ACT_NextKFrame;
		break;
	case GDK_Down:
		action=ACT_PreviousKFrame;
		break;
			
		// Position advance
       	case GDK_Left: case GDK_KP_Left:

		// One frame
		if((shift == FALSE) && (ctrl == FALSE))
		{
			action = ACT_PreviousFrame;
		}
                // 100 frames
                else if((shift == TRUE) && (ctrl == TRUE))
                {
                        action = ACT_Back100Frames;
                }
		// 50 frames
		else if(ctrl == TRUE)
		{
			action = ACT_Back50Frames;
		}
		// 25 frames
		else
		{
			action = ACT_Back25Frames;
		}
		break;

		// Position reverse
	case GDK_Right: case GDK_KP_Right:
		if((shift == FALSE) && (ctrl == FALSE))
		{
			action = ACT_NextFrame;
		}
                // 100 frames
                else if((shift == TRUE) && (ctrl == TRUE))
                {
                        action = ACT_Forward100Frames;
                }

		else if(ctrl == TRUE)
		{
			action = ACT_Forward50Frames;
		}
		else
		{
			action = ACT_Forward25Frames;
		}
		break;
		
        }
        if(action!=ACT_DUMMY) // For me to handle
        {
	       HandleAction(action);
               return TRUE;
        }
        return FALSE;
}
static gboolean         cb_prev(GtkButton * button, gpointer user_data)
{
        HandleAction(ACT_PreviousFrame);
        return TRUE;
}
void wxGenericFileDialog::OnListOk( wxCommandEvent &WXUNUSED(event) )
{
    HandleAction( m_text->GetValue() );
}
Exemple #30
0
	void VideoFindProxy::handleHandle ()
	{
		Type_ = PTHandle;
		HandleAction ();
	}