Example #1
0
void UI_Main::preloadUI( void ) {
	int i;
	NavigationStack *navigator;

	for( i = 0; i < UI_NUM_CONTEXTS; i++ ) {
		UI_Navigation &navigation = navigations[i];
		navigator = navigation.front();

		while( !navigation.empty() ) {
			NavigationStack *stack = navigation.front();
			navigation.pop_front();

			// clear the navigation stack
			stack->popAllDocuments();
			if( stack != navigator ) {
				__delete__( stack );
			}
		}

		navigation.push_front( navigator );

		navigator->setDefaultPath( ui_basepath->string );
	}

	// load translation strings

	trap::L10n_ClearDomain();

	// load base UI strings: l10n/ui
	trap::L10n_LoadLangPOFile( "l10n/ui" );

	// load strings provided by the theme: e.g. ui/l10n/porkui

	// initialize with default document

	navigator = navigations[UI_CONTEXT_MAIN].front();

	String l10nLocalPath( navigator->getDefaultPath().c_str() );
	l10nLocalPath += "l10n";
	l10nLocalPath.Erase( 0, 1 );
	trap::L10n_LoadLangPOFile( l10nLocalPath.CString() );

	// postpone displaying the document until the first valid refresh state
	navigator->pushDocument( ui_index, false, false );
	showNavigationStack = navigator->hasDocuments();

	// initial cursor setup
	if( trap::IN_SupportedDevices() & IN_DEVICE_TOUCHSCREEN ) {
		mouseMove( UI_CONTEXT_MAIN, 0, 0, 0, true, false );
	} else {
		mouseMove( UI_CONTEXT_MAIN, 0, refreshState.width >> 1, refreshState.height >> 1, true, true );
	}

	if( !quickMenuURL.Empty() ) {
		navigator = navigations[UI_CONTEXT_QUICK].front();
		navigator->pushDocument( quickMenuURL.CString(), false );
	}

	rocketModule->update();
}
Example #2
0
void UI_Main::preloadUI( void )
{
	navigator->popAllDocuments();

	// initialize with default document
	navigator->setDefaultPath( ui_basepath->string );

	// load translation strings

	trap::L10n_ClearDomain();

	// load base UI strings: l10n/ui
	trap::L10n_LoadLangPOFile( "l10n/ui" );
	
	// load strings provided by the theme: e.g. ui/l10n/porkui
	String l10nLocalPath( navigator->getDefaultPath().c_str() );
	l10nLocalPath += "l10n";
	l10nLocalPath.Erase( 0, 1 );
	trap::L10n_LoadLangPOFile( l10nLocalPath.CString() );

	// postpone displaying the document until the first valid refresh state
	navigator->pushDocument( ui_index, false, false );
	showNavigationStack = navigator->hasDocuments();
}