Ejemplo n.º 1
0
HelpBrowser::HelpBrowser( QWidget* parent, const QString& /*caption*/, const QString& guiLanguage, const QString& jumpToSection, const QString& jumpToFile)
	: QMainWindow( parent )
{
	firstRun=true;
	setupUi(this);
	helpNav = new HelpNavigation(this);
#if defined(Q_OS_MAC) && defined(HELP_NAV_AS_DRAWER)
	// TODO
#else
	QDockWidget * dckw = new QDockWidget(tr("Navigation"),this);
	dckw->setWidget(helpNav);
	addDockWidget(Qt::LeftDockWidgetArea, dckw);
#endif
	progressBar = new QProgressBar(this);
	progressBar->setRange(0,100);
	statusBar()->addPermanentWidget(progressBar);

	setupLocalUI();
	language = guiLanguage.isEmpty() ? QString("en") : guiLanguage.left(2);
	finalBaseDir = ScPaths::instance().docDir() + "en/"; //Sane default for help location
	textBrowser->setSearchPaths(QStringList(finalBaseDir));
	menuModel=NULL;
	loadMenu();
	if (menuModel!=NULL)
	{
		readBookmarks();
		readHistory();
		jumpToHelpSection(jumpToSection, jumpToFile );
		languageChange();
	}
	else
	{
		displayNoHelp();
	}
}
Ejemplo n.º 2
0
void HelpBrowser::languageChange()
{
	setWindowTitle( tr( "Scribus Online Help" ) );
	
	fileMenu->setTitle(tr("&File"));
	editMenu->setTitle(tr("&Edit"));
	bookMenu->setTitle(tr("&Bookmarks"));
	
	filePrint->setText(tr("&Print..."));
	fileExit->setText(tr("&Quit"));
	editFind->setText(tr("&Find..."));
	editFindNext->setText(tr("Find &Next"));
	editFindPrev->setText(tr("Find &Previous"));
	bookAdd->setText(tr("&Add Bookmark"));
	bookDel->setText(tr("&Delete"));
	bookDelAll->setText(tr("D&elete All"));
	Ui::HelpBrowser::retranslateUi(this);
	if (!firstRun)
	{
		QString fname(QDir::cleanPath(textBrowser->source().toLocalFile()));
		QFileInfo fi(fname);
		QString filename(fi.fileName());
		if (ScCore->getGuiLanguage().isEmpty())
			language="en";
		else
			language=ScCore->getGuiLanguage();
		loadMenu();
		if (menuModel!=NULL)
			loadHelp(finalBaseDir + "/" + filename);
	}
	else
		firstRun=false;
}
Ejemplo n.º 3
0
bool ActionManager::insertMenuActions(const QString &idMenu, const QString &idBeforeSep, bool newGroup,  QList<QAction*> &actions)
{
    if (idMenu.isEmpty()) {
        return false;
    }
    QMenu *menu = loadMenu(idMenu);
    if (!menu) {
        return false;
    }
    if (newGroup) {
        QMenu *realMenu = menu->menuAction()->menu();
        if (realMenu) {
            if (!realMenu->actions().isEmpty() && !realMenu->actions().last()->isSeparator()) {
                menu->addSeparator();
            }
        } else {
            menu->addSeparator();
        }
    }
    QAction *sep = 0;
    if (!idBeforeSep.isEmpty()) {
        sep = m_idMenuSepMap[idMenu][idBeforeSep];
        if (!sep) {
            sep = menu->addSeparator();
            m_idMenuSepMap[idMenu].insert(idBeforeSep,sep);
        }
    }
    foreach (QAction *act, actions) {
        menu->insertAction(sep,act);
    }
Ejemplo n.º 4
0
//初始化各项数据
void Over::initData()
{
    //加载背景
    loadBackground();
    //显示得分
    showScore();
    //加载菜单
    loadMenu();
}
void SvCreator::load(const QString& _path)
{
  loadMenu();
  addEvents();
  loadFile(_path);
  setWindowTitle(tr("%1 Editor - %2").arg(APP_NAME).arg(m_activeConfig));
  showStatusMsg(tr("Loaded."), false);
  show();
}
Ejemplo n.º 6
0
void reloadMenu()
{
	loadMenu(hWin, MAKEINTRESOURCE(IDR_MENU), subId);

	HMENU m=GetMenu(hWin);
	for(int *p= (editor ? gameItems : editorItems); *p; p++){
		DeleteMenu(m, *p, MF_BYCOMMAND);
	}

	checkMenus();
	DrawMenuBar(hWin);
}
Ejemplo n.º 7
0
void Menuer::init()
{
    nid_.cbSize = sizeof(nid_);
    nid_.hWnd = app_hwnd;
    nid_.uID = IDI_APP_16;
    nid_.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
    nid_.uCallbackMessage = WM_USER;
    nid_.hIcon = LoadIcon(app_hins, MAKEINTRESOURCE(IDI_APP_16));
    // nid_.szTip, see updateTip()
    Shell_NotifyIcon(NIM_ADD, &nid_);

    loadMenu();
}
Ejemplo n.º 8
0
MouseConfig::MouseConfig(QWidget *parent, ShortcutsPlugin *plugin)
        : MouseConfigBase(parent)
{
    m_plugin = plugin;
    lstCmd->setSorting(0);
    loadMenu(MenuMain);
    loadMenu(MenuGroup);
    loadMenu(MenuContact);
    adjustColumns();
    cmbButton->insertItem("");
    cmbButton->insertItem(i18n("Left click"));
    cmbButton->insertItem(i18n("Right click"));
    cmbButton->insertItem(i18n("Middle click"));
    cmbButton->insertItem(i18n("Left dblclick"));
    cmbButton->insertItem(i18n("Right dblclick"));
    cmbButton->insertItem(i18n("Middle dblclick"));
    selectionChanged();
    connect(lstCmd, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(cmbButton, SIGNAL(activated(int)), this, SLOT(buttonChanged(int)));
    connect(chkAlt, SIGNAL(toggled(bool)), this, SLOT(changed(bool)));
    connect(chkCtrl, SIGNAL(toggled(bool)), this, SLOT(changed(bool)));
    connect(chkShift, SIGNAL(toggled(bool)), this, SLOT(changed(bool)));
}
Ejemplo n.º 9
0
void init(int width, int height) {
	danmakux.width = width;
	danmakux.height = height;

	if (!al_init()) al_show_native_message_box(display, "Error", "Error", "Failed to initialize Allegro!", NULL, ALLEGRO_MESSAGEBOX_ERROR);
	
	if (!al_install_keyboard()) al_show_native_message_box(display, "Error", "Error", "Failed to install keyboard!", NULL, ALLEGRO_MESSAGEBOX_ERROR);

	if (!al_install_audio()) al_show_native_message_box(display, "Error", "Error", "Failed to install audio!", NULL, ALLEGRO_MESSAGEBOX_ERROR);
	
	if (!al_reserve_samples(10)) al_show_native_message_box(display, "Error", "Error", "Failed to reserve samples!", NULL, ALLEGRO_MESSAGEBOX_ERROR);

	timer = al_create_timer(1.0 / FPS);
	if (!timer) al_show_native_message_box(display, "Error", "Error", "Failed to create timer!", NULL, ALLEGRO_MESSAGEBOX_ERROR);
	
	al_set_new_display_flags(ALLEGRO_WINDOWED);
	al_set_new_window_position(700, 200);
	display = al_create_display(danmakux.width, danmakux.height);
	if (!display) al_show_native_message_box(display, "Error", "Error", "Failed to create display!", NULL, ALLEGRO_MESSAGEBOX_ERROR);

	event_queue = al_create_event_queue();
	if (!event_queue) al_show_native_message_box(display, "Error", "Error", "Failed to create event queue!", NULL, ALLEGRO_MESSAGEBOX_ERROR);

	al_register_event_source(event_queue, al_get_keyboard_event_source());
	al_register_event_source(event_queue, al_get_timer_event_source(timer));
	al_register_event_source(event_queue, al_get_display_event_source(display));

	redraw = false;
	danmakux.fireBomb = false;
	danmakux.lives = 2;
	danmakux.bombsRemain = 2;
	danmakux.weaponLevel = 1;
	danmakux.done = false;
	danmakux.state_menu = true;
	danmakux.state_paused = false;
	danmakux.state_playing = false;
	danmakux.state_dialog = false;
	danmakux.menuChoice = 0;
	danmakux.currentLevel = 1;
	danmakux.player = &playerset;
	UI = danmakux.resources.get_image("ui.png");

	al_start_timer(timer);
	loadMenu("mainmenu");
	/*danmakux.state_menu = false;
							danmakux.state_playing = true;
							danmakux.state_paused = false;
							loadLevel("level1");*/
	al_play_sample(danmakux.bgm, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_LOOP, NULL);
}
Ejemplo n.º 10
0
/// Function name  : GetContextMenu
// Description     : Retrieve the context menu for an Language entry's RichEdit button object
// 
// WORD         iSelectionType  : [in]  Whether text and/or objects are selected
// IOleObject*  piObject        : [in]  OLE interface of the current object selection
// CHARRANGE*   pSelection      : [in]  Character indicies of the current text selection
// HMENU*       pOutput         : [out] Handle to a popup menu
// 
// Return Value   : S_OK
// 
OLE_Method 
HRESULT    RichEditCallback::GetContextMenu(WORD  iSelectionType, IOleObject*  piObject, CHARRANGE*  pSelection, HMENU*  pOutput)
{
   HMENU  hParentMenu;

   // BUG
   VERBOSE(BUG "Richedit provided context menu can't be custom drawn");

   // Retrieve appropriate Popup
   hParentMenu = loadMenu(TEXT("LANGUAGE_MENU"));
   *pOutput = GetSubMenu(hParentMenu, IDM_RICHEDIT_POPUP);

   // Return without destroying menu.
   return S_OK;
}
Ejemplo n.º 11
0
ShortcutsConfig::ShortcutsConfig(QWidget *parent, ShortcutsPlugin *plugin)
        : ShortcutsConfigBase(parent)
{
    m_plugin = plugin;
    lstKeys->setSorting(0);
    loadMenu(MenuMain, true);
    loadMenu(MenuGroup, false);
    loadMenu(MenuContact, false);
    loadMenu(MenuStatus, true);
    adjustColumns();
    selectionChanged();
    connect(lstKeys, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(edtKey, SIGNAL(changed()), this, SLOT(keyChanged()));
    connect(btnClear, SIGNAL(clicked()), this, SLOT(keyClear()));
    connect(chkGlobal, SIGNAL(toggled(bool)), this, SLOT(globalChanged(bool)));
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        mouse_cfg = new MouseConfig(tab, plugin);
        tab->addTab(mouse_cfg, i18n("Mouse"));
        break;
    }
}
Ejemplo n.º 12
0
void keyboard(unsigned char key, int x, int y)
{
    
	/* key presses move the cube, if it isn't at the extents (hard-coded here) */
	switch (key)
	{
		case 'q':
		case 27:
			//exit (0);
			break;
            
		case 'r':
        case 'R':
			particleInit();
			break;
            
		case 'f':
        case 'F':
            if (!friction){
            for (int i = 0; i< objectAmount; i++) {
                objects[i].bounce = 0.9;
            }
                friction = true;
            }
            else{
                for (int i = 0; i< objectAmount; i++) {
                    objects[i].bounce = 1;
                }
                friction = false;
            }
            break;

            
        case ' ':
            loadMenu();
            break;

            
            
	}
    
	glutPostRedisplay();
}
Ejemplo n.º 13
0
QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties &fileItemInfos, QWidget *parent)
{
    Q_UNUSED(parent)

    QList<QAction*> list;

    // Don't show the action for files that we can't send
    if (!fileItemInfos.isLocal()) {
        return list;
    }

    m_infos = fileItemInfos;

    QAction *menuAction = new QAction(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")), i18n("Send via Bluetooth"), this);
    QMenu *menu = new QMenu();
    menuAction->setMenu(menu);
    loadMenu(menu);

    list.append(menuAction);
    return list;
}
Ejemplo n.º 14
0
HelpBrowser::HelpBrowser( QWidget* parent, const QString& /*caption*/, const QString& guiLanguage, const QString& jumpToSection, const QString& jumpToFile)
	: QMainWindow( parent )
{
	firstRun=true;
	setupUi(this);
	setupLocalUI();
	language = guiLanguage.isEmpty() ? QString("en") : guiLanguage.left(2);
	finalBaseDir = ScPaths::instance().docDir() + "en/"; //Sane default for help location
	menuModel=NULL;
	loadMenu();
	if (menuModel!=NULL)
	{
		readBookmarks();
		readHistory();
		jumpToHelpSection(jumpToSection, jumpToFile );
		languageChange();
	}
	else
	{
		displayNoHelp();
	}
}
Ejemplo n.º 15
0
/*
	每类菜单的code不能重复,否则会造成部分不能显示
*/
CMenuLoader::CMenuLoader(QObject* receiver):m_Receiver(receiver)
{
	initAppMap();
	loadMenu();
}
Ejemplo n.º 16
0
Common::Error MadsEngine::run() {
	// Set up the graphics mode
	initGraphics(320, 200, false);

	// Necessary pre-initialisation
	_resourceManager = new MADSResourceManager(this);

	// Set up needed common functionality
	MadsM4Engine::run();

	_palette->setMadsSystemPalette();

	_mouse->init("cursor.ss", NULL);
	_mouse->setCursorNum(0);

	// Load MADS data files
	MadsGlobals *globs = (MadsGlobals *)_globals;
	globs->loadMadsVocab();			// vocab.dat
	globs->loadQuotes();			// quotes.dat
	globs->loadMadsMessagesInfo();	// messages.dat
	globs->loadMadsObjects();

	// Setup globals
	globs->_config.easyMouse = true;
	globs->_config.invObjectsStill = false;
	globs->_config.textWindowStill = false;
	globs->_config.storyMode = 1;	// Naughty
	globs->_config.screenFades = 0;

	// Test code to dump all messages to the console
	//for (int i = 0; i < _globals->getMessagesSize(); i++)
	//debugCN(kDebugCore, "%s\n----------\n", _globals->loadMessage(i));

	if (getGameType() == GType_RexNebular) {
		MadsGameLogic::initialiseGlobals();

		_scene = NULL;
		loadMenu(MAIN_MENU);
	} else {
		// Test code
		_scene = new MadsScene(this);

		startScene(FIRST_SCENE);
		RGBList *_bgPalData;
		_scene->loadBackground(FIRST_SCENE, &_bgPalData);
		_palette->addRange(_bgPalData);
		_scene->translate(_bgPalData);

		_scene->show();

		_font->setFont(FONT_MAIN_MADS);
		_font->current()->setColors(2, 1, 3);
		_font->current()->writeString(_scene->getBackgroundSurface(), "Testing the M4/MADS ScummVM engine", 5, 160, 310, 2);
		_font->current()->writeString(_scene->getBackgroundSurface(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 5, 180, 310, 2);

		if (getGameType() == GType_DragonSphere) {
			//_scene->showMADSV2TextBox("Test", 10, 10, NULL);
		}

		_mouse->cursorOn();
	}

	_viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler);
	_viewManager->systemHotkeys().add(Common::KEYCODE_KP_MULTIPLY, &textviewHotkeyHandler);

	uint32 nextFrame = g_system->getMillis();
	while (!_events->quitFlag) {
		eventHandler();

		if (g_system->getMillis() >= nextFrame) {
			nextFrame = g_system->getMillis() + GAME_FRAME_DELAY;
			++_currentTimer;

			// Call the updateState method of all views
			_viewManager->updateState();

			// Refresh the display
			_viewManager->refreshAll();
		}

		g_system->delayMillis(10);

		if (globals()->dialogType != DIALOG_NONE)
			showDialog();
	}

	return Common::kNoError;
}
Ejemplo n.º 17
0
int GUI_HoF::optionsButton(Button *button) {
	PauseTimer pause(*_vm->_timer);

	_restartGame = false;
	_reloadTemporarySave = false;

	updateButton(&_vm->_inventoryButtons[0]);

	if (!_screen->isMouseVisible() && button)
		return 0;

	_vm->showMessage(0, 0xCF);

	if (_vm->_mouseState < -1) {
		_vm->_mouseState = -1;
		_screen->setMouseCursor(1, 1, _vm->getShapePtr(0));
		return 0;
	}

	int oldHandItem = _vm->_itemInHand;
	_screen->setMouseCursor(0, 0, _vm->getShapePtr(0));
	_vm->displayInvWsaLastFrame();
	_displayMenu = true;

	for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i) {
		_menuButtons[i].data0Val1 = _menuButtons[i].data1Val1 = _menuButtons[i].data2Val1 = 4;
		_menuButtons[i].data0Callback = _redrawShadedButtonFunctor;
		_menuButtons[i].data1Callback = _menuButtons[i].data2Callback = _redrawButtonFunctor;
	}

	initMenuLayout(_mainMenu);
	initMenuLayout(_gameOptions);
	initMenuLayout(_audioOptions);
	initMenuLayout(_choiceMenu);
	_loadMenu.numberOfItems = 6;
	initMenuLayout(_loadMenu);
	initMenuLayout(_saveMenu);
	initMenuLayout(_savenameMenu);
	initMenuLayout(_deathMenu);

	_currentMenu = &_mainMenu;

	if (_vm->_menuDirectlyToLoad) {
		backUpPage1(_vm->_screenBuffer);
		setupPalette();

		_loadedSave = false;

		loadMenu(0);

		if (_loadedSave) {
			if (_restartGame)
				_vm->_itemInHand = kItemNone;
		} else {
			restorePage1(_vm->_screenBuffer);
			restorePalette();
		}

		resetState(-1);
		_vm->_menuDirectlyToLoad = false;
		return 0;
	}

	if (!button) {
		_currentMenu = &_deathMenu;
		_isDeathMenu = true;
	} else {
		_isDeathMenu = false;
	}

	backUpPage1(_vm->_screenBuffer);
	setupPalette();
	initMenu(*_currentMenu);
	_madeSave = false;
	_loadedSave = false;
	updateAllMenuButtons();

	if (_isDeathMenu) {
		while (!_screen->isMouseVisible())
			_screen->showMouse();
	}

	while (_displayMenu) {
		processHighlights(*_currentMenu);
		getInput();
	}

	if (_vm->_runFlag && !_loadedSave && !_madeSave) {
		restorePalette();
		restorePage1(_vm->_screenBuffer);
	}

	if (_vm->_runFlag)
		updateMenuButton(&_vm->_inventoryButtons[0]);

	resetState(oldHandItem);

	if (!_loadedSave && _reloadTemporarySave) {
		_vm->_unkSceneScreenFlag1 = true;
		_vm->loadGameStateCheck(999);
		//_vm->_saveFileMan->removeSavefile(_vm->getSavegameFilename(999));
		_vm->_unkSceneScreenFlag1 = false;
	}

	return 0;
}
Ejemplo n.º 18
0
int main()
{
	Vector::numVectors = 0;
	Vector::degreeMode = true;
	Vector BLANKVECTOR;
	Vector a(22,45);
	a.setLine(createLine(a), BLANKVECTOR);
	Vector b(34, 60);
	b.setLine(createLine(b,a),a);
	Vector c = a+b;
	c.setLine(createLine(c), BLANKVECTOR);


	sf::Vector2i toggleLocation(200,50);
	sf::RectangleShape toggle((sf::Vector2f)toggleLocation);
	toggle.setFillColor(sf::Color::Yellow);
	sf::RenderWindow window(sf::VideoMode(xMax, yMax), "FUNSICZ");
	sf::Font font;
	if (!font.loadFromFile("tnr.ttf"))
		return EXIT_FAILURE;
	sf::Mouse mouse;
	// Start the `main loop
	bool toggleComponents = false;
	int i=0;
	while (window.isOpen())
	{
		// Process events
		sf::Event event;
		while (window.pollEvent(event))
		{
			// Close window : exit
			if (event.type == sf::Event::Closed)
				window.close();
			if(event.type==event.MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left && V2i_inRange(sf::Mouse::getPosition(window), toggleLocation, 200, 50))
			{
				i++;
				std::cout << "dicks  " << i <<std::endl;
				if(toggleComponents)
					toggleComponents = false;
				else
					toggleComponents = true;
			}
			if(event.type==event.KeyReleased && event.key.code == sf::Keyboard::Escape)
				loadMenu();
		}
		// Clear screen
		window.clear();
		
		
		if(toggleComponents)
		{
			
			window.draw(a.getCXL());
			window.draw(a.getCYL());
			window.draw(b.getCXL());
			window.draw(b.getCYL());
			window.draw(c.getCXL());
			window.draw(c.getCYL());
		}
		window.draw(a.getLine());
		window.draw(b.getLine());
		window.draw(c.getLine());
		window.draw(toggle);
	
		// Draw the string
		//window.draw(text);
		
		//window.draw(b_line);
		// Update the window
		window.display();
	}

return EXIT_SUCCESS;
}