Exemplo n.º 1
0
void AGOSEngine::openTextWindow() {
	if (_textWindow) {
		if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
			if (_textWindow->flags & 0x80)
				clearWindow(_textWindow);
		}
		return;
	}

	if (getGameType() == GType_FF || getGameType() == GType_PP)
		_textWindow = openWindow(64, 96, 384, 172, 1, 0, 15);
	else
		_textWindow = openWindow(8, 144, 24, 6, 1, 0, 15);
}
Exemplo n.º 2
0
void LoadSaveWindow::onOK() {
	if(bSaveWindow == false) {
		int index = fileList.getSelectedIndex();
		if(index >= 0) {
			filename = directories[currentDirectoryIndex] + fileList.getEntry(index) + "." + extension;

			Window* pParentWindow = dynamic_cast<Window*>(getParent());
			if(pParentWindow != NULL) {
				pParentWindow->closeChildWindow();
			}
		}
	} else {
		std::string savename = saveName.getText();

		if(savename != "" && savename.find_first_of("\\/") == std::string::npos) {
			filename = directories[currentDirectoryIndex] + saveName.getText() + "." + extension;

			Window* pParentWindow = dynamic_cast<Window*>(getParent());
			if(pParentWindow != NULL) {
				pParentWindow->closeChildWindow();
			}
		} else {
            openWindow(MsgBox::create(_("Invalid file name! File names must not contain \\ or / and must not be empty!")));
		}
	}
}
Exemplo n.º 3
0
bool LoadMapWindow::handleKeyPress(SDL_KeyboardEvent& key) {
	if(pChildWindow != NULL) {
		bool ret = pChildWindow->handleKeyPress(key);
		return ret;
	}

	if(isEnabled() && (pWindowWidget != NULL)) {
		if(key.keysym.sym == SDLK_RETURN) {
			onLoad();
			return true;
		} else if(key.keysym.sym == SDLK_DELETE) {
		    int index = mapList.getSelectedIndex();
            if(index >= 0) {
                QstBox* pQstBox = QstBox::create(   strprintf(_("Do you really want to delete '%s' ?"), mapList.getEntry(index).c_str()),
                                                    _("No"),
                                                    _("Yes"),
                                                    QSTBOX_BUTTON2);

                pQstBox->setTextColor(color);

                openWindow(pQstBox);
            }

            return true;
		} else {
			return pWindowWidget->handleKeyPress(key);
		}
	} else {
		return false;
	}
}
Exemplo n.º 4
0
void AGOSEngine::o_defWindow() {
	// 101: define window
	uint num = getVarOrByte();
	uint x = getVarOrWord();
	uint y = getVarOrWord();
	uint w = getVarOrWord();
	uint h = getVarOrWord();
	uint flags = getVarOrWord();
	uint color = getVarOrWord();

	uint fillColor, textColor;
	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 ||
		getGameType() == GType_WW) {
		fillColor = color % 100;
		textColor = color / 100;
	} else {
		fillColor = color;
		textColor = 0;
	}

	num &= 7;

	if (_windowArray[num])
		closeWindow(num);

	_windowArray[num] = openWindow(x, y, w, h, flags, fillColor, textColor);

	if (num == _curWindow) {
		_textWindow = _windowArray[num];
		justifyStart();
	}
}
Exemplo n.º 5
0
    void
    GuiApp::run()
    {
        commander().registerAllCommandsForTarget (JUCEApplication::getInstance());
        commander().registerAllCommandsForTarget (this);

        globals().session().open();
        sessionDoc = new SessionDocument (globals().session());

        content = new ContentComponent (*this);
        content->setSize (800, 600);
        mainWindow = new MainWindow (*this);
        mainWindow->setContentNonOwned (content.get(), true);

        PropertiesFile* pf = globals().settings().getUserSettings();
        mainWindow->restoreWindowStateFromString (pf->getValue ("mainWindowState"));

       #if JUCE_IOS || JUCE_ANDROID
        Desktop& d = Desktop::getInstance();
        d.setKioskModeComponent (mainWindow);
       #endif

        mainWindow->addToDesktop();
        mainWindow->setVisible (true);
        dispatch->startTimer (250);

        openWindow (ELEMENT_PLUGIN_MANAGER);

        File sess (pf->getValue ("lastSession"));
        if (sess.existsAsFile()) {
            sessionDoc->loadFrom (sess, true);
            mainWindow->setName (sessionDoc->getDocumentTitle());
        }
    }
Exemplo n.º 6
0
static IPTR mAbout(struct IClass *cl, Object *obj, UNUSED Msg msg)
{
    struct data *data = INST_DATA(cl,obj);

    superset(cl,obj,MUIA_Application_Sleep,TRUE);

    if(data->about == NULL)
    {
        if(g_aboutClass != NULL || initAboutClass() == TRUE)
        {
            if((data->about = aboutObject,
                    MUIA_Aboutmui_Application, obj,
                    MUIA_Window_RefWindow,     data->win,
                End) != NULL)
            {
                DoSuperMethod(cl,obj,OM_ADDMEMBER,(IPTR)data->about);
                DoMethod(data->about,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,(IPTR)obj,5,
                    MUIM_Application_PushMethod,(IPTR)obj,2,MUIM_App_DisposeWin,(IPTR)data->about);
            }
        }
    }

    openWindow(obj,data->about);

    superset(cl,obj,MUIA_Application_Sleep,FALSE);

    return 0;
}
Exemplo n.º 7
0
/**
 * Opens window if "Show"-action is clicked in tray icon context menu, otherwise closes it.
 * @brief MainWindow::trayMenuClicked
 * @param action Action that has been clicked.
 */
void MainWindow::trayMenuClicked(QAction* action)
{
   if( trayMenu->actions().at(0) == action)
   {
       if(!isVisible()) openWindow();
   }
   else close();
}
Exemplo n.º 8
0
void PICadillo35t::flushCacheBlock() {
    if (_cacheState != cacheDirty) {
        return;
    }
    openWindow(_cacheX, _cacheY, 1 << cacheDimension, 1 << cacheDimension);
    windowData(_cacheData, ((1 << cacheDimension) * (1 << cacheDimension)));
    closeWindow();
    _cacheState = cacheClean;
}
Exemplo n.º 9
0
/*
   Initialisation de l'affichage
*/
void init_affichage(map_t * m, SDL_Renderer ** s) {
    // Initialisation de la partie graphique
    // On ouvre une fenêtre représentant la carte : nombre de case * nombre de pixel par case
    //*s = openWindow(m->largeur * SIZE, m->hauteur * SIZE + HAUTEUR_INTERFACE); // Ouvre une fenêtre de largeur et hauteur pixels

    // ÉCran de SIZE*SIZE maxi
    *s = openWindow(m->largeur_affichage * SIZE, m->hauteur_affichage * SIZE + HAUTEUR_INTERFACE); // Ouvre une fenêtre de largeur et hauteur pixels
    loadTiles(*s); // Charge les tuiles (sprites carrés) qu'on va placer sur l'écran pour générer la carte
    init_sdlttf();
}
Exemplo n.º 10
0
void CGObjectInstance::onHeroVisit( const CGHeroInstance * h ) const
{
	switch(ID)
	{
	case Obj::HILL_FORT:
		{
			openWindow(OpenWindow::HILL_FORT_WINDOW,id.getNum(),h->id.getNum());
		}
		break;
	case Obj::SANCTUARY:
		{
			//You enter the sanctuary and immediately feel as if a great weight has been lifted off your shoulders.  You feel safe here.
			showInfoDialog(h, 114);
		}
		break;
	case Obj::TAVERN:
		{
			openWindow(OpenWindow::TAVERN_WINDOW,h->id.getNum(),id.getNum());
		}
		break;
	}
}
Exemplo n.º 11
0
void Window::openWindowInForeground()
{
  openWindow();

  MessageLoop loop(getManager());

  m_isForeground = true;

  while (!(this->flags & JI_HIDDEN))
    loop.pumpMessages();

  m_isForeground = false;
}
Exemplo n.º 12
0
Common::Error AGOSEngine_FeebleDemo::go() {
    // Main menu
    defineBox( 1,  80,  75,  81, 117, kBFBoxDead, 0, NULL);
    defineBox( 2, 267,  21, 105,  97, kBFBoxDead, 0, NULL);
    defineBox( 3, 456,  89, 125, 103, kBFBoxDead, 0, NULL);
    defineBox( 4, 151, 225, 345,  41, kBFBoxDead, 0, NULL);
    defineBox( 5, 169, 319, 109, 113, kBFBoxDead, 0, NULL);
    defineBox( 6, 404, 308,  62, 117, kBFBoxDead, 0, NULL);

    // Film menu
    defineBox(11,  28,  81, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(12, 182,  81, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(13, 335,  81, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(14, 488,  81, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(15,  28, 201, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(16, 182, 201, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(17, 335, 201, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(18, 488, 201, 123,  93, kBFBoxDead, 0, NULL);
    defineBox(19, 255, 357, 135,  45, kBFBoxDead, 0, NULL);

    // Exit Menu
    defineBox(21, 548, 421,  42,  21, kBFBoxDead, 0, NULL);

    // Text Window used by Feeble Files Data section
    if (_language ==Common::DE_DEU) {
        _textWindow = openWindow(322, 457, 196, 15, 1, 0, 255);
    } else {
        _textWindow = openWindow(444, 452, 196, 15, 1, 0, 255);
    }

    playVideo("winasoft.smk");
    playVideo("fbigtalk.smk");

    while (!shouldQuit())
        mainMenu();

    return Common::kNoError;
}
Exemplo n.º 13
0
void GLFW::run()
{
	willOpenWindow();
	openWindow();
	didOpenWindow();
	initialize();
	
	while (glfwGetWindowParam(GLFW_OPENED))
	{
		draw();
		glfwSwapBuffers();
	}
	
	finalize();
}
Exemplo n.º 14
0
/**
 * Unhides the main window when tray icon is double-clicked.
 * @brief MainWindow::trayActions
 */
void MainWindow::trayActions(QSystemTrayIcon::ActivationReason reason)
{
    switch (reason)
    {
        case QSystemTrayIcon::Trigger:
            break;
        case QSystemTrayIcon::DoubleClick:
            openWindow();
            break;
        case QSystemTrayIcon::MiddleClick:
            break;
        default:
            break;
    }
}
Exemplo n.º 15
0
int main(int argc, char *argv[]) {
    Image<byte> I;
    Image<float> Vx, Vy;
    if (!load(I, argc > 1 ? argv[1] : srcPath("salon.png"))) {
        cout << "Echec de lecture d'image" << endl;
        return 1;
    }

    openWindow(I.width(), I.height());
    display(I);
    click();
    cout << "Contraste simple" << endl;
    affiche(I);
    gradient(I, Vx, Vy);
    click();
    cout << "Dérivée selon x par la fonction gradient" <<endl;
    affiche(Vx);
    click();
    cout << "Dérivée selon y par la fonction gradient" <<endl;
    affiche(Vy);

    click();

    Image<float> F = dx(I);

    cout << "Dérivée selon x par la fonction dx" <<endl;

    affiche(F);

    click();

    Image<float> U= dy(I);
    cout << "Dérivée selon y par la fonction dy" <<endl;

    affiche(U);

    click();

    masque(I,F,U);

    Image<float> z = poisson(F,U);
    cout << "Image reconstruite par poisson" <<endl;

    affiche(z);

    endGraphics();
    return 0;
}
Exemplo n.º 16
0
	void toggleFullScreen()
	{
		LOGD("toggleFullScreen()");

		g_isFullScreen = !g_isFullScreen;

		//glfwTerminate();
		glfwCloseWindow();

		openWindow(g_isFullScreen);

		input_resetStates();
		engine_unloadContent();

		engine_loadContent();
	}
Exemplo n.º 17
0
int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  // Store the process instance.
  ::hInstance = hInstance;

  // Randomize the random generator.
  srand((unsigned int)time(NULL));

  // Get the command line parameters.
  std::vector<std::string> params;
  int numArgs;
  LPWSTR * args = CommandLineToArgvW(GetCommandLineW(), &numArgs);
  for (int i = 0; i < numArgs; ++i)
  {
    std::string param;
    param.resize(WideCharToMultiByte(CP_UTF8, 0, args[i], -1, 0, 0, NULL, NULL) - 1);
    WideCharToMultiByte(CP_UTF8, 0, args[i], -1, &param[0], param.size(), NULL, NULL);
    params.push_back(param);
  }
  LocalFree(args);
  
  // Open a window.
  openWindow();

  configure(params);

  do
  {
    // Process message
    MSG msg;
    BOOL messageWasPulled = PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE);
    if (messageWasPulled == TRUE)
    {
      TranslateMessage(&msg); // If we can, post a separate character message onto the message queue for later consumption.
      DispatchMessage(&msg);
    }

    if (widget != 0)
    {
      widget->tick(1000.0f / 60.0f);
      widget->render();
    }
  } while (loop);
  
  // Finalize.
  closeWindow();
}
Exemplo n.º 18
0
int main() {
	if (openWindow() == -1) return -1;
	
	init_first_triangle();
	init_small_triangle();
	init_second_triangle();

	glfwSetKeyCallback(keyboard);	
	glfwEnable(GLFW_STICKY_KEYS);

	glClearColor(0.0f, 0.0f, 0.6f, 0.0f);
	
	GLuint first_triangleID = LoadShaders("VertexShader.glsl", "FragmentShader.glsl");
	GLuint second_triangleID = LoadShaders("VertexShader.glsl", "FragmentShader2.glsl");
	GLuint small_triangleID = LoadShaders("VertexShader.glsl", "FragmentShader.glsl");
	
	GLuint vertexbuffer;
	glGenBuffers(1, &vertexbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);

	do {
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		
		glEnableVertexAttribArray(0);
		glEnableVertexAttribArray(1);

		glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
		glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)36);
		
		draw(first_triangleID, first_triangle, vertexbuffer);
		draw(small_triangleID, small_triangle, vertexbuffer);
		draw(second_triangleID, second_triangle, vertexbuffer);

		glDisableVertexAttribArray(0);
		glDisableVertexAttribArray(1);

		glfwSwapBuffers();
	} while (glfwGetKey(GLFW_KEY_ESC) != GLFW_PRESS && glfwGetWindowParam(GLFW_OPENED));

	glfwTerminate();
	glDeleteBuffers(1, &vertexbuffer);
	glDeleteProgram(first_triangleID);
	glDeleteProgram(second_triangleID);

	return 0;
}
Exemplo n.º 19
0
void QtApp::openWindowViaMenu() {
    if(sender() == NULL) {
        printf("QtApp::openWindowViaMenu: no sender\n");
        return;
    }

    QAction* act = qobject_cast<QAction*>(sender());
    if(!act) {
        printf("QtApp::openWindowViaMenu: sender is not QAction\n");
        return;
    }
    if(act->objectName().isEmpty()) {
        printf("QtApp::openWindowViaMenu: sender name is empty\n");
        return;
    }

    openWindow(act->objectName().toStdString());
}
Exemplo n.º 20
0
void MainWindow::createTrayIcon()
{
    trayMenu = new QMenu(this);
    trayMenu->addAction("&Players", myserverwidget, SLOT(openPlayers()));
    trayMenu->addAction("&Anti DoS", myserverwidget, SLOT(openAntiDos()));
    trayMenu->addAction("&Config", myserverwidget, SLOT(openConfig()));
    trayMenu->addAction("&Script Window", myserverwidget, SLOT(openScriptWindow()));
    trayMenu->addAction("&Battle Config", myserverwidget, SLOT(openBattleConfigWindow()));
    trayMenu->addAction("&SQL Config", myserverwidget, SLOT(openSqlConfigWindow()));
    trayMenu->addSeparator();
    trayMenu->addAction("&Plugin Manager", myserverwidget, SLOT(openPluginManager()));
    trayMenu->addSeparator();
    trayMenu->addAction("&Open", this, SLOT(openWindow()));
    trayMenu->addAction("&Close", qApp, SLOT(quit()));
    trayIcon = new QSystemTrayIcon(this);
    trayIcon->setContextMenu(trayMenu);
    trayIcon->setToolTip("Pok\303\251mon Online Server");
    trayIcon->setIcon(QIcon("db/icon.png"));
}
Exemplo n.º 21
0
static IPTR mOpenWin(UNUSED struct IClass *cl, Object *obj, struct MUIP_App_OpenWin *msg)
{
    Object *win = findWinObjByAttr(obj,msg->IDAttr,msg->IDVal);

    if (!win)
    {
        set(obj,MUIA_Application_Sleep,TRUE);

        win = NewObject(msg->Class,  NULL,
                        msg->IDAttr, msg->IDVal,
                        TAG_MORE,    &msg->InitAttrs);

        if (win) DoMethod(obj,OM_ADDMEMBER,(IPTR)win);

        set(obj,MUIA_Application_Sleep,FALSE);
    }

    return openWindow(obj,win);
}
Exemplo n.º 22
0
void startupNiKom(void) {
  struct MsgPort *port;

  Forbid();
  port = (struct MsgPort *)FindPort("NiKomPort");
  if(port == NULL) {
    NiKPort = (struct MsgPort *)CreatePort("NiKomPort",0);
  }
  Permit();
  if(port != NULL) {
    printf("NiKServer is already running.\n");
    exit(10);
  }
  if(NiKPort == NULL) {
    printf("Can't create message port 'NiKomPort'\n");
    exit(10);
  }
  openLibrariesAndPorts();
  setupServermem();
  initLanguages();
  
  readSysInfo();
  readTextInfo();
  readGroupData();
  ReadCommandConfig();
  ReadSystemConfig();
  readConferenceData();
  readConferenceTexts();
  readUserData();
  ReadFidoConfig();
  ReadNodeTypesConfig();
  readLastLogins();
  ReadFileKeyConfig();
  ReadStatusConfig();
  readFileAreas();
  readFileAreaFiles();
  GetServerversion();
  scanFidoConferences();
  InitLegacyConversionData();
  initNodes();
  openWindow();
}
Exemplo n.º 23
0
int main (int argc, char** argv)
{
    XEvent event;
    connectX();
    x=500;
    y=400;
    main_window = openWindow(10,20,x,y,5, argc, argv);
    gc = getGC();
    XMapWindow(display, main_window);
    draw();
    XFlush(display);
    while (True)
    {
        XNextEvent(display, &event);
        switch(event.type)
        {
        case Expose:
            printf("Expose event\n");
            draw();
            break;
        case ButtonPress:
            printf("Button Pressed\n");
            doButtonPressEvent(&event);
            break;
        case ButtonRelease:
            printf("Button released\n");
            tst=0;
            break;
        case KeyPress:
            printf("Key pressed\n");
            doKeyPressEvent(&event);
            break;
        case MotionNotify:
            doMotionNotifyEvent(&event);
            break;
        }
    }
}
Exemplo n.º 24
0
nsresult
nsNNTPNewsgroupList::GetRangeOfArtsToDownload(nsIMsgWindow *aMsgWindow,
                                              int32_t first_possible,
                                              int32_t last_possible,
                                              int32_t maxextra,
                                              int32_t *first,
                                              int32_t *last,
                                              int32_t *status)
{
  nsresult rv = NS_OK;

  NS_ENSURE_ARG_POINTER(first);
  NS_ENSURE_ARG_POINTER(last);
  NS_ENSURE_ARG_POINTER(status);
  *first = 0;
  *last = 0;

  nsCOMPtr <nsIMsgFolder> folder = do_QueryInterface(m_newsFolder, &rv);
  NS_ENSURE_SUCCESS(rv,rv);
  m_msgWindow = aMsgWindow;

  nsCOMPtr<nsINewsDatabase> db(do_QueryInterface(m_newsDB, &rv));
  NS_ENSURE_SUCCESS(rv,rv);

  rv = db->GetReadSet(&m_set);
  if (NS_FAILED(rv) || !m_set)
    return rv;

  m_set->SetLastMember(last_possible); // make sure highwater mark is valid.

  nsCOMPtr <nsIDBFolderInfo> newsGroupInfo;
  rv = m_newsDB->GetDBFolderInfo(getter_AddRefs(newsGroupInfo));
  if (NS_SUCCEEDED(rv) && newsGroupInfo) {
    nsCString knownArtsString;
    nsMsgKey mark;
    newsGroupInfo->GetKnownArtsSet(getter_Copies(knownArtsString));

    rv = newsGroupInfo->GetHighWater(&mark);
    NS_ENSURE_SUCCESS(rv,rv);

    if (last_possible < ((int32_t)mark))
      newsGroupInfo->SetHighWater(last_possible);
    if (m_knownArts.set)
      delete m_knownArts.set;
    m_knownArts.set = nsMsgKeySet::Create(knownArtsString.get());
  }
  else
  {
    if (m_knownArts.set)
      delete m_knownArts.set;
    m_knownArts.set = nsMsgKeySet::Create();
    nsMsgKey low, high;
    rv = m_newsDB->GetLowWaterArticleNum(&low);
    NS_ENSURE_SUCCESS(rv,rv);
    rv = m_newsDB->GetHighWaterArticleNum(&high);
    NS_ENSURE_SUCCESS(rv,rv);
    m_knownArts.set->AddRange(low,high);
  }

  if (m_knownArts.set->IsMember(last_possible)) {
    nsString statusString;
    nsCOMPtr<nsIStringBundleService> bundleService =
      mozilla::services::GetStringBundleService();
    NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIStringBundle> bundle;
    rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
    NS_ENSURE_SUCCESS(rv, rv);

    rv = bundle->GetStringFromName(NS_LITERAL_STRING("noNewMessages").get(), getter_Copies(statusString));
    NS_ENSURE_SUCCESS(rv, rv);

    SetProgressStatus(statusString.get());
  }

  if (maxextra <= 0 || last_possible < first_possible || last_possible < 1)
  {
    *status=0;
    return NS_OK;
  }

  m_knownArts.first_possible = first_possible;
  m_knownArts.last_possible = last_possible;

  nsCOMPtr <nsIMsgIncomingServer> server;
  rv = folder->GetServer(getter_AddRefs(server));
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsINntpIncomingServer> nntpServer = do_QueryInterface(server, &rv);
  NS_ENSURE_SUCCESS(rv,rv);

  /* Determine if we only want to get just new articles or more messages.
  If there are new articles at the end we haven't seen, we always want to get those first.
  Otherwise, we get the newest articles we haven't gotten, if we're getting more.
  My thought for now is that opening a newsgroup should only try to get new articles.
  Selecting "More Messages" will first try to get unseen messages, then old messages. */

  if (m_getOldMessages || !m_knownArts.set->IsMember(last_possible))
  {
    bool notifyMaxExceededOn = true;
    rv = nntpServer->GetNotifyOn(&notifyMaxExceededOn);
    if (NS_FAILED(rv)) notifyMaxExceededOn = true;

    // if the preference to notify when downloading more than x headers is not on,
    // and we're downloading new headers, set maxextra to a very large number.
    if (!m_getOldMessages && !notifyMaxExceededOn)
      maxextra = 0x7FFFFFFFL;
        int result =
            m_knownArts.set->LastMissingRange(first_possible, last_possible,
                                              first, last);
    if (result < 0) {
            *status=result;
      return NS_ERROR_NOT_INITIALIZED;
        }
    if (*first > 0 && *last - *first >= maxextra)
    {
      if (!m_getOldMessages && !m_promptedAlready && notifyMaxExceededOn)
      {
        m_downloadAll = false;
        nsCOMPtr<nsINewsDownloadDialogArgs> args = do_CreateInstance("@mozilla.org/messenger/newsdownloaddialogargs;1", &rv);
        if (NS_FAILED(rv)) return rv;
        NS_ENSURE_SUCCESS(rv,rv);

        rv = args->SetArticleCount(*last - *first + 1);
        NS_ENSURE_SUCCESS(rv,rv);

        nsString groupName;
        rv = m_newsFolder->GetUnicodeName(groupName);
        NS_ENSURE_SUCCESS(rv,rv);

        rv = args->SetGroupName(groupName);
        NS_ENSURE_SUCCESS(rv,rv);

        // get the server key
        nsCString serverKey;
        rv = server->GetKey(serverKey);
        NS_ENSURE_SUCCESS(rv,rv);

        rv = args->SetServerKey(serverKey.get());
        NS_ENSURE_SUCCESS(rv,rv);

        // we many not have a msgWindow if we are running an autosubscribe url from the browser
        // and there isn't a 3 pane open.
        //
        // if we don't have one, bad things will happen when we fail to open up the "download headers dialog"
        // (we will subscribe to the newsgroup, but it will appear like there are no messages!)
        //
        // for now, act like the "download headers dialog" came up, and the user hit cancel.  (very safe)
        //
        // TODO, figure out why we aren't opening and using a 3 pane when the autosubscribe url is run.
        // perhaps we can find an available 3 pane, and use it.

        bool download = false;

        if (aMsgWindow) {
          rv = openWindow(aMsgWindow, DOWNLOAD_HEADERS_URL, args);
          NS_ENSURE_SUCCESS(rv,rv);

          rv = args->GetHitOK(&download);
          NS_ENSURE_SUCCESS(rv,rv);
        }

      if (download) {
         rv = args->GetDownloadAll(&m_downloadAll);
         NS_ENSURE_SUCCESS(rv,rv);
         m_maxArticles = 0;
         rv = nntpServer->GetMaxArticles(&m_maxArticles);
         NS_ENSURE_SUCCESS(rv,rv);

          maxextra = m_maxArticles;
          if (!m_downloadAll)
          {
            bool markOldRead = false;

            rv = nntpServer->GetMarkOldRead(&markOldRead);
            if (NS_FAILED(rv)) markOldRead = false;

            if (markOldRead && m_set)
              m_set->AddRange(*first, *last - maxextra);
            *first = *last - maxextra + 1;
          }
        }
        else
          *first = *last = 0;
        m_promptedAlready = true;
      }
      else if (m_promptedAlready && !m_downloadAll)
        *first = *last - m_maxArticles + 1;
      else if (!m_downloadAll)
        *first = *last - maxextra + 1;
    }
  }

  m_firstMsgToDownload = *first;
  m_lastMsgToDownload = *last;
  *status=0;
  return NS_OK;
}
Exemplo n.º 25
0
Graphics::Graphics(Resources *resources){
	this->resources = resources;
	openWindow(1200, 800);
	particleRenderer.initialise(5000);
	std::cout << "Graphics instantiated" << std::endl;
}
Exemplo n.º 26
0
main(int argc, char **argv)
//
//////////////////////////////////////////////////////////////
{
    Options		options;
    SoSeparator		*root;
    Display		*display;
    Window		window;
    float		asisTime, ptsTime, invisTime, freezeTime,
                        noMatTime, noTexTime, noLitTime, noXformTime,
                        noClearTime, oneTexTime;

    // Init Inventor
    SoInteraction::init();

    // Parse arguments
    if (! parseArgs(argc, argv, options)) {
	printUsage(argv[0]);
	return 1;
    }

    // Open scene graphs
    SoInput	sceneInput;
    if (! sceneInput.openFile(options.inputFileName)) {
	fprintf(stderr,
		"Cannot open %s\n", options.inputFileName);
	return 1;
    }

    SbViewportRegion vpr(options.windowX, options.windowY);
    root = setUpGraph(vpr, &sceneInput, options);

    // Create and initialize window
    openWindow(display, window, options.windowX, options.windowY, argv[0]);

    // Timing tests
   
    printf("\t\t\tseconds/frame\tframes/second\n");
    // as is rendering
    asisTime = timeRendering(options, vpr, root);
    printf("As-Is rendering:\t%10.3f\t%10.2f\n", asisTime, 1.0/asisTime);


    // time for rendering without clear
    options.noClear = TRUE;
    noClearTime = timeRendering(options, vpr, root);
    options.noClear = FALSE;
    printf("No Clear:\t\t%10.3f\t%10.2f\n", noClearTime, 1.0/noClearTime);
    
    // time for rendering without materials
    options.noMaterials = TRUE;
    noMatTime = timeRendering(options, vpr, root);
    options.noMaterials = FALSE;
    printf("No Materials:\t\t%10.3f\t%10.2f\n", noMatTime, 1.0/noMatTime);
    
    // time for rendering without xforms
    options.noXforms = TRUE;
    noXformTime = timeRendering(options, vpr, root);
    options.noXforms = FALSE;
    printf("No Transforms:\t\t%10.3f\t%10.2f\n", noXformTime, 1.0/noXformTime);

    if (options.hasTextures) { // do tests only if scene has textures

	// time for rendering without any textures
	options.noTextures = TRUE;
	noTexTime = timeRendering(options, vpr, root);
	options.noTextures = FALSE;
	printf("No Textures:\t\t%10.3f\t%10.2f\n", noTexTime, 1.0/noTexTime);

	// time for rendering without only one texture
	options.oneTexture = TRUE;
	oneTexTime = timeRendering(options, vpr, root);
	options.oneTexture = FALSE;
	printf("One Texture:\t\t%10.3f\t%10.2f\n", oneTexTime, 1.0/oneTexTime);
    }
    else 
	noTexTime = oneTexTime = asisTime;


    // time for rendering without fill
    options.noFill = TRUE;
    ptsTime = timeRendering(options, vpr, root);
    options.noFill = FALSE;    
    printf("No Fills:\t\t%10.3f\t%10.2f\n", ptsTime, 1.0/ptsTime);

    if (options.hasLights) { // do test only if scene has lights
	// time for rendering with lights turned off
	options.noLights = TRUE;
	noLitTime = timeRendering(options, vpr, root);
	options.noLights = FALSE;
	printf("No Lights:\t\t%10.3f\t%10.2f\n", noLitTime, 1.0/noLitTime);
    }
    else
	noLitTime = asisTime;

    printf("\n");

    // time for rendering without vertex xforms
    options.noVtxXforms = TRUE;
    invisTime = timeRendering(options, vpr, root);
    options.noVtxXforms = FALSE;
    printf("Time taken by vertex transformations:\t%10.3f seconds/frame\n", 
	   ptsTime-invisTime);
    
    // time for rendering with scene graph frozen
    options.freeze = TRUE;
    freezeTime = timeRendering(options, vpr, root);
    options.freeze = FALSE;
    printf("Time taken to traverse scene graph:\t%10.3f seconds/frame\n\n", 
	   asisTime-freezeTime);


    // kill window
    XEvent 	event;
    XUnmapWindow(display, window);
    XIfEvent(display, &event, waitForNotify, (char *) window);

    // draw timing bars
    if (options.showBars) 
	drawBar(asisTime, noClearTime, noMatTime,
		noXformTime, noTexTime, oneTexTime,
		noLitTime, ptsTime, invisTime, freezeTime);

    return 0;
}
void SinglePlayerSkirmishMenu::onGameOptions()
{
    openWindow(GameOptionsWindow::create(currentGameOptions));
}
Exemplo n.º 28
0
int main(int argc, char **argv)
{
	int x, y;

	Window win1;
	GC gc1;
	XEvent event;
	XImage *ximg1;

	int flag;
	struct IplImage *prev1, *curr1, *motion;
	struct IplDev *dev1;

	time_t start, end;
	int f;

	f = 0;
	start = 0;
	end = 0;
	
	x = 0;
	y = 0;
	initX();
	getXinfo();
	win1 = openWindow(500, 500, 640, 480, 0, &gc1);
	XNextEvent(theDisplay, &event);
	ximg1 = XGetImage(theDisplay, win1, x, y, 640, 480, AllPlanes, ZPixmap);
	if(XInitImage(ximg1) == 0) {
		fprintf(stderr,"error: XInitImage\n");
		return 1;
	}

	printf("first xgetimage done\n");

	if ((dev1 = ipl_opendev(0, IPL_RGB_MODE)) == NULL) {
		printf("error while creating device 0\n");
		return 1;
	}

	if (ipl_setparams(dev1, 320, 240, IPL_FORCE_SCALE_ON) < 0) {
		fprintf(stderr, "error on changing cam params\n");
		free(dev1);
		return 1;
	}
	if ((prev1 = ipl_getframe(dev1)) == NULL) {
		printf("error capturing prev1\n");
		return 1;
	}


	flag = 1;
	start = time(NULL);
	
	while (flag) {
		f++;	
		end = time(NULL);
		if (end - start >= 1.0) {
			printf("fps = %i\n", f);
			f = 0;
			start = end;
		}
	
		if ((curr1 = ipl_getframe(dev1)) == NULL) {
			printf("error capturing curr1\n");
			return 1;
		}
		motion = framescompare(curr1, prev1);
		ipl_scaleimg(&motion, 640, 480);
		camera_shoot(motion, ximg1, gc1, win1, x, y);
		ipl_freeimg(&prev1);
		prev1 = curr1;


		ipl_freeimg(&motion);
		XCheckTypedWindowEvent(theDisplay, win1, ButtonPress, &event);
		if (event.xbutton.button == 1)
			flag = 0;
	}

	ipl_freeimg(&curr1);
	XDestroyImage(ximg1);
	XDestroyWindow(theDisplay, win1);

	quitX();


	return 0;
}
Exemplo n.º 29
0
void ImageViewer::giveImage(const cv::Mat_<cv::Vec3b>& image)
{
	openWindow(image);
}
Exemplo n.º 30
0
int WindowsMain(int argc, char** argv, IApp* app)
{
	pApp = app;

	//Used for automated testing, if enabled app will exit after 120 frames
	bool testing = false;
	uint32_t testingFrameCount = 0;
	const uint32_t testingDesiredFrameCount = 120;

	//search for --test in command line arguments
	if (argc > 1)
	{
		for(int i = 0 ; i < argc ; i++)
		{
			if (strcmp(argv[i], "--testing"))
				testing = true;
		}
	}


	FileSystem::SetCurrentDir(FileSystem::GetProgramDir());

	IApp::Settings* pSettings = &pApp->mSettings;
	WindowsDesc window = {};
	Timer deltaTimer;

	if (pSettings->mWidth == -1 || pSettings->mHeight == -1)
	{
		RectDesc rect = {};
		getRecommendedResolution(&rect);
		pSettings->mWidth = getRectWidth(rect);
		pSettings->mHeight = getRectHeight(rect);
	}

	window.windowedRect = { 0, 0, (int)pSettings->mWidth, (int)pSettings->mHeight };
	window.fullScreen = pSettings->mFullScreen;
	window.maximized = false;
	openWindow(pApp->GetName(), &window);

	pSettings->mWidth = window.fullScreen ? getRectWidth(window.fullscreenRect) : getRectWidth(window.windowedRect);
	pSettings->mHeight = window.fullScreen ? getRectHeight(window.fullscreenRect) : getRectHeight(window.windowedRect);
	pApp->pWindow = &window;
	pApp->mCommandLine = GetCommandLineA();

	if (!pApp->Init())
		return EXIT_FAILURE;

	registerWindowResizeEvent(onResize);

	while (isRunning())
	{
		float deltaTime = deltaTimer.GetMSec(true) / 1000.0f;
		// if framerate appears to drop below about 6, assume we're at a breakpoint and simulate 20fps.
		if (deltaTime > 0.15f)
			deltaTime = 0.05f;

		handleMessages();
		pApp->Update(deltaTime);
		pApp->Draw();
		
		//used in automated tests only.
		if (testing)
		{
			testingFrameCount++;
			if (testingFrameCount >= testingDesiredFrameCount)
				break;
		}
	}

	pApp->Exit();

	return 0;
}