예제 #1
0
void V3DocViewWin::showMainMenu()
{
    lvRect fullRc = _wm->getScreen()->getRect();
    CRFullScreenMenu * menu_win = new CRFullScreenMenu(
            _wm, 0, lString16(_("Main Menu")), 8, fullRc );
/*
VIEWER_MENU_GOTOFIRSTPAGE=Go to first page
VIEWER_MENU_GOTOENDPAGE=Go to last page
VIEWER_MENU_GOTOPAGE=Go to page...
VIEWER_MENU_GOTOINDEX=Go to index
VIEWER_MENU_5ABOUT=About...
VIEWER_MENU_4ABOUT=About...
*/
    menu_win->setSkinName(lString16(L"#main"));
	CRGUIAcceleratorTableRef menuItems = _wm->getAccTables().get(lString16("mainMenuItems"));
	if ( !menuItems.isNull() && menuItems->length()>1 ) {
		// get menu from file
		for ( unsigned i=0; i<menuItems->length(); i++ ) {
			const CRGUIAccelerator * acc = menuItems->get( i );
			int cmd = acc->commandId;
			int param = acc->commandParam;
			const char * name = getCommandName( cmd, param );
			int key = 0;
			int keyFlags = 0;
			lString8 label( name );
			if ( _acceleratorTable->findCommandKey( cmd, param, key, keyFlags ) ) {
				const char * keyname = getKeyName( key, keyFlags );
				if ( keyname && keyname[0] )
					label << "\t" << keyname;
			}
			menu_win->addItem( new CRMenuItem( menu_win, cmd,
				label.c_str(),
				LVImageSourceRef(),
				LVFontRef() ) );
		}
	} else {
		// default menu
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_ABOUT,
					_("About"),
					LVImageSourceRef(),
					LVFontRef() ) );
	#if 0
		menu_win->addItem( new CRMenuItem( menu_win, DCMD_BEGIN,
					_wm->translateString("VIEWER_MENU_GOTOFIRSTPAGE", "Go to first page"),
					LVImageSourceRef(),
					LVFontRef() ) );
	#endif
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_GO_PAGE,
					_("Go to page"),
					LVImageSourceRef(),
					LVFontRef() ) );
	#if 0
		menu_win->addItem( new CRMenuItem( menu_win, DCMD_END,
					_wm->translateString("VIEWER_MENU_GOTOENDPAGE", "Go to last page"),
					LVImageSourceRef(),
					LVFontRef() ) );
	#endif

		menu_win->addItem( new CRMenuItem( menu_win, MCMD_RECENT_BOOK_LIST,
					_("Open recent book"),
					LVImageSourceRef(),
					LVFontRef() ) );

	#ifdef WITH_DICT
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_DICT,
					_("Dictionary"),
					LVImageSourceRef(),
					LVFontRef() ) );
	#endif
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_CITE,
					_("Cite"),
					LVImageSourceRef(),
					LVFontRef() ) );
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_BOOKMARK_LIST,
					_("Bookmarks"),
					LVImageSourceRef(),
					LVFontRef() ) );
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_SEARCH,
					_("Search"),
					LVImageSourceRef(),
					LVFontRef() ) );
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_SETTINGS,
					_("Settings"),
					LVImageSourceRef(),
					LVFontRef() ) );
		if ( !_helpFile.empty() )
			menu_win->addItem( new CRMenuItem( menu_win, MCMD_HELP,
					_("Help"),
					LVImageSourceRef(),
					LVFontRef() ) );
		menu_win->addItem( new CRMenuItem( menu_win, MCMD_HELP_KEYS,
					_("Keyboard layout"),
					LVImageSourceRef(),
					LVFontRef() ) );
	}

    menu_win->setAccelerators( getMenuAccelerators() );

    lString16 s(_("$1 - choose command\n$2, $3 - close"));
    s.replaceParam(1, menu_win->getItemNumberKeysName());
    s.replaceParam(2, menu_win->getCommandKeyName(MCMD_OK) );
    s.replaceParam(3, menu_win->getCommandKeyName(MCMD_CANCEL) );
    menu_win->setStatusText( s );
    menu_win->setFullscreen( true );

    menu_win->reconfigure(0);
    _wm->activateWindow( menu_win );
}
예제 #2
0
CRRecentBookMenuItem::CRRecentBookMenuItem( CRMenu * menu, int index, CRFileHistRecord * book )
: CRMenuItem(menu, index, lString16::empty_str, LVImageSourceRef(), LVFontRef() ), _book( book )
{
}
예제 #3
0
CRBookmarkMenuItem::CRBookmarkMenuItem( CRMenu * menu, int shortcut, CRBookmark * bookmark, int page )
: CRMenuItem(menu, shortcut, lString16(_("Empty slot")), LVImageSourceRef(), LVFontRef() ), _bookmark( bookmark ), _page(page)
{

}