Beispiel #1
0
static void InvokeMacroButton( PMACRO_BUTTON button, LOGICAL bBannerMessage )
{
	struct current_macro_state_during_invoke new_current_macro;

	if( !pls_macros )
		pls_macros = CreateLinkStack();

	PushLink( &pls_macros, &new_current_macro );
	new_current_macro.macro = button;
	for( new_current_macro.element = button->elements; new_current_macro.element; new_current_macro.element = NextThing( new_current_macro.element ) )
	{
		if( !QueryShowControl( new_current_macro.element->button ) )
			continue;
		if( new_current_macro.element->button->original_keypress )
		{
			// there really should be some sort of way to abort, and unpress these buttons...
			// that would be cool, but I don't think that will happen.
			new_current_macro.element->flags.allow_continue = 1;
			if( bBannerMessage )
			{
				TEXTCHAR msg[256];
				TEXTCHAR msg2[256];
				int cur = 0;
				int ofs;
				InterShell_TranslateLabelText( NULL, msg2, sizeof( msg2 ), new_current_macro.element->button->text );
				for( ofs = 0; msg2[ofs]; ofs++ )
				{
					if( msg2[ofs] == '\\' )
					{
						if( msg2[ofs+1] == 'n' )
						{
							msg2[cur++] = '\n';
							ofs++;
						}
					}
					else
						msg2[cur++] = msg2[ofs];
				}
				msg2[cur++] = msg2[ofs];
				snprintf( msg, sizeof( msg ), WIDE("Invoke Startup\n%s"), msg2 );
				// friggin visual studio... the spec claims 'will have a nul in buffer'
				msg[255] = 0;
				Banner2NoWaitAlpha( msg );
			}
			new_current_macro.element->button->original_keypress( new_current_macro.element->button->psvUser );
			if( !new_current_macro.element->flags.allow_continue )
			{
				// abort the page change too.
				if( new_current_macro.macro->button )
					new_current_macro.macro->button->flags.bIgnorePageChange = 1;
				break; // stop this macro button.
			}
		}
		if( new_current_macro.element->button->pPageName )
		{
			if( !new_current_macro.element->button->canvas ) // probably part of starup or shutdown macro
			{
				if( !new_current_macro.element->button->flags.bIgnorePageChange )
				{
					ShellSetCurrentPage( InterShell_GetCanvas( new_current_macro.macro->button->page )
						, new_current_macro.element->button->pPageName );
				}
			}
			else if( new_current_macro.element->button->canvas && !new_current_macro.element->button->flags.bIgnorePageChange )
			{
				//lprintf( WIDE( "Changing pages, but only virtually don't activate the page always" ) );
				ShellSetCurrentPage( new_current_macro.element->button->canvas->pc_canvas, new_current_macro.element->button->pPageName );
			}
			new_current_macro.element->button->flags.bIgnorePageChange = 0;
		}
	}
	PopLink( &pls_macros );
}
Beispiel #2
0
static void CPROC change( uintptr_t psv )
{
	if( l.flags.allow_cycle )
		if( !l.flags.bDisableChange )
			ShellSetCurrentPage( GetCanvas( (PSI_CONTROL)psv ), WIDE("next"), PAGE_TRANSITION_NONE, 0 );
}