Пример #1
0
reg_t GfxPorts::kernelNewWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
	Window *wnd = NULL;

	if (restoreRect.bottom != 0 && restoreRect.right != 0)
		wnd = addWindow(dims, &restoreRect, title, style, priority, false);
	else
		wnd = addWindow(dims, NULL, title, style, priority, false);
	wnd->penClr = colorPen;
	wnd->backClr = colorBack;
	drawWindow(wnd);

	return make_reg(0, wnd->id);
}
Пример #2
0
void RKWorkplace::newX11Window (WId window_to_embed, int device_number) {
	RK_TRACE (APP);

	RKCaughtX11Window *window = new RKCaughtX11Window (window_to_embed, device_number);
	window->state = RKMDIWindow::Detached;
	addWindow (window, false);
}
Пример #3
0
void WindowsManager::search(const QString &query, const QString &engine, OpenHints hints)
{
	Window *window = m_mdi->getActiveWindow();

	if (hints == DefaultOpen && ((window && window->isUrlEmpty()) || SettingsManager::getValue(QLatin1String("Browser/ReuseCurrentTab")).toBool()))
	{
		hints = CurrentTabOpen;
	}

	if (window && (hints & CurrentTabOpen) && window->getType() == QLatin1String("web"))
	{
		window->search(query, engine);

		return;
	}

	if (window && window->canClone())
	{
		window = window->clone(false, m_mdi);

		addWindow(window, hints);
	}
	else
	{
		open(QUrl(), hints);

		window = m_mdi->getActiveWindow();
	}

	if (window)
	{
		window->search(query, engine);
	}
}
Пример #4
0
bool RKWorkplace::openScriptEditor (const KUrl &url, const QString& encoding, bool use_r_highlighting, bool read_only, const QString &force_caption, bool delete_on_close) {
	RK_TRACE (APP);

// is this url already opened?
	if (!url.isEmpty ()) {
	  	RKWorkplaceObjectList script_windows = getObjectList (RKMDIWindow::CommandEditorWindow, RKMDIWindow::AnyWindowState);
		for (RKWorkplaceObjectList::const_iterator it = script_windows.constBegin (); it != script_windows.constEnd (); ++it) {
			  KUrl ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
			  if (url == ourl) {
				  (*it)->activate ();
				  return true;
			  }
		}
	}

	RKCommandEditorWindow *editor = new RKCommandEditorWindow (view (), use_r_highlighting);

	if (!url.isEmpty ()) {
		if (!editor->openURL (url, encoding, use_r_highlighting, read_only, delete_on_close)) {
			delete editor;
			KMessageBox::messageBox (view (), KMessageBox::Error, i18n ("Unable to open \"%1\"", url.prettyUrl ()), i18n ("Could not open command file"));
			return false;
		}
	}

	if (!force_caption.isEmpty ()) editor->setCaption (force_caption);
	addWindow (editor);
	return true;
}
void
PointerDetectorFilter::invoke (KmsMediaInvocationReturn &_return,
                               const std::string &command,
                               const std::map< std::string, KmsMediaParam > &params)
throw (KmsMediaServerException)
{
  if (g_KmsMediaPointerDetectorFilterType_constants.ADD_NEW_WINDOW.compare (command) == 0) {
    KmsMediaPointerDetectorWindow windowInfo;
    const KmsMediaParam *p;
    /* extract window params from param */
    p = getParam (params,
                  g_KmsMediaPointerDetectorFilterType_constants.ADD_NEW_WINDOW_PARAM_WINDOW);

    if (p != NULL) {
      unmarshalStruct (windowInfo, p->data);
      /* create window */
      addWindow (windowInfo);
    }
  } else if (g_KmsMediaPointerDetectorFilterType_constants.REMOVE_WINDOW.compare (command) == 0) {
    std::string id;

    getStringParam (id, params, g_KmsMediaPointerDetectorFilterType_constants.REMOVE_WINDOW_PARAM_WINDOW_ID);
    removeWindow (id);
  } else if (g_KmsMediaPointerDetectorFilterType_constants.CLEAR_WINDOWS.compare (command) == 0) {
    clearWindows();
  }
}
Пример #6
0
Window* WindowsManager::openWindow(ContentsWidget *widget, OpenHints hints)
{
	if (!widget)
	{
		return NULL;
	}

	Window *window = NULL;

	if (hints.testFlag(NewWindowOpen))
	{
		MainWindow *mainWindow = Application::getInstance()->createWindow(widget->isPrivate(), hints.testFlag(BackgroundOpen));

		if (mainWindow)
		{
			window = mainWindow->getWindowsManager()->openWindow(widget, (hints.testFlag(PrivateOpen) ? PrivateOpen : DefaultOpen));

			mainWindow->getWindowsManager()->closeOther();
		}
	}
	else
	{
		window = new Window((widget->isPrivate() || hints.testFlag(PrivateOpen)), widget);

		addWindow(window, hints);
	}

	return window;
}
Пример #7
0
void WindowsManager::search(const QString &query, const QString &engine)
{
	Window *window = m_mdi->getActiveWindow();

	if (window && SettingsManager::getValue(QLatin1String("Browser/ReuseCurrentTab")).toBool())
	{
		window->search(query, engine);

		return;
	}

	if (window && window->canClone())
	{
		window = window->clone(false, m_mdi);

		addWindow(window);
	}
	else
	{
		open();

		window = m_mdi->getActiveWindow();
	}

	if (window)
	{
		window->search(query, engine);
	}
}
Пример #8
0
RKEditor *RKWorkplace::editObject (RObject *object) {
	RK_TRACE (APP);

	RObject *iobj = object;
	RKEditor *ed = 0;
	RKEditor *existing_editor = RKGlobals::tracker ()->objectEditor (object);
	if (!existing_editor) {
		if (!iobj->isDataFrame ()) {
			if (iobj->isVariable () && iobj->getContainer ()->isDataFrame ()) {
				iobj = iobj->getContainer ();
			} else {
				return 0;
			}
		}

		unsigned long size = 1;
		foreach (int dim, iobj->getDimensions ()) {
			size *= dim;
		}
		if ((RKSettingsModuleGeneral::warnLargeObjectThreshold () != 0) && (size > RKSettingsModuleGeneral::warnLargeObjectThreshold ())) {
			if (KMessageBox::warningContinueCancel (view (), i18n ("You are about to edit object \"%1\", which is very large (%2 fields). RKWard is not optimized to handle very large objects in the built in data editor. This will use a lot of memory, and - depending on your system - might be very slow. For large objects it is generally recommended to edit using command line means or to split into smaller chunks before editing. On the other hand, if you have enough memory, or the data is simple enough (numeric data is easier to handle, than factor), editing may not be a problem at all. You can configure this warning (or turn it off entirely) under Settings->Configure RKWard->General.\nReally edit object?", iobj->getFullName (), size), i18n ("About to edit very large object")) != KMessageBox::Continue) {
				return 0;
			}
		}

		ed = new RKEditorDataFrame (static_cast<RContainerObject*> (iobj), 0);
		addWindow (ed);
	} else {
Пример #9
0
void WindowsManager::restore(const SessionMainWindow &session)
{
	if (session.windows.isEmpty())
	{
		open();
	}
	else
	{
		for (int i = 0; i < session.windows.count(); ++i)
		{
			Window *window = new Window(m_isPrivate, NULL, m_mdi);
			window->setSession(session.windows.at(i));

			addWindow(window);
		}
	}

	m_isRestored = true;

	connect(SessionsManager::getInstance(), SIGNAL(requestedRemoveStoredUrl(QString)), this, SLOT(removeStoredUrl(QString)));
	connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(setActiveWindow(int)));
	connect(m_tabBar, SIGNAL(requestedClone(int)), this, SLOT(cloneWindow(int)));
	connect(m_tabBar, SIGNAL(requestedDetach(int)), this, SLOT(detachWindow(int)));
	connect(m_tabBar, SIGNAL(requestedPin(int,bool)), this, SLOT(pinWindow(int,bool)));
	connect(m_tabBar, SIGNAL(requestedClose(int)), this, SLOT(closeWindow(int)));
	connect(m_tabBar, SIGNAL(requestedCloseOther(int)), this, SLOT(closeOther(int)));

	setActiveWindow(session.index);
}
Пример #10
0
bool RKWorkplace::openScriptEditor (const KURL &url, bool use_r_highlighting, bool read_only, const QString &force_caption) {
	RK_TRACE (APP);

// is this url already opened?
	if (!url.isEmpty ()) {
		for (RKWorkplaceObjectList::const_iterator it = windows.constBegin (); it != windows.constEnd (); ++it) {
			if ((*it)->type == RKMDIWindow::CommandEditorWindow) {
				KURL ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
				if (url.equals (ourl, true)) {
					(*it)->activate ();
					return true;
				}
			}
		}
	}

	RKCommandEditorWindow *editor = new RKCommandEditorWindow (view (), use_r_highlighting);

	if (!url.isEmpty ()) {
		if (!editor->openURL (url, use_r_highlighting, read_only)) {
			delete editor;
			KMessageBox::messageBox (view (), KMessageBox::Error, i18n ("Unable to open \"%1\"").arg (url.prettyURL ()), i18n ("Could not open command file"));
			return false;
		}
	}

	if (!force_caption.isEmpty ()) editor->setCaption (force_caption);
	addWindow (editor);
	return true;
}
Пример #11
0
void RKWorkplace::openOutputWindow (const KURL &url) {
	RK_TRACE (APP);

	RKOutputWindow::refreshOutput (true, true, false);
	if (windows.find (RKOutputWindow::getCurrentOutput ()) == windows.end ()) {
		addWindow (RKOutputWindow::getCurrentOutput ());
	}
}
Пример #12
0
void WindowsManager::openTab(const QUrl &url, OpenHints hints)
{
	Window *window = new Window((hints & PrivateOpen), NULL, m_mdi);

	addWindow(window, hints);

	window->setUrl(url, false);
}
Пример #13
0
void ofxFensterManager::setupWindow(ofxFenster* window, int x, int y, int w, int h, ofWindowMode screenMode) {
	window->setupOpenGL(w, h, screenMode);
	window->setWindowPosition(x, y);
	window->initializeWindow();
	addWindow(window);
	ofEventArgs args;
	ofNotifyEvent(window->onSetup, args);
}
Пример #14
0
void WindowsManager::openTab(const QUrl &url, OpenHints hints)
{
	Window *window = new Window(hints.testFlag(PrivateOpen));

	addWindow(window, hints);

	window->setUrl(url, false);
}
Пример #15
0
void RKWorkplace::newOutput (bool only_if_modified) {
	RK_TRACE (APP);
	RKOutputWindow *window = RKOutputWindow::refreshOutput (RKSettingsModuleOutput::autoShow (), RKSettingsModuleOutput::autoRaise (), only_if_modified);
	if (window) {
		if (windows.find (window) == windows.end ()) {
			addWindow (window);
		}
	}
}
Пример #16
0
RKEditor* RKWorkplace::editNewDataFrame (const QString &name) {
	RK_TRACE (APP);

	RKEditorDataFrame* ed = new RKEditorDataFrame (name, 0);
	addWindow (ed);
	ed->activate ();

	return ed;
}
Пример #17
0
INT_PTR Mwin_MenuClicked(WPARAM wParam,LPARAM lParam) 
{
	BOOL addwnd = WindowList_Find(hMwinWindowList, (HANDLE)wParam) == NULL;
	if (addwnd)
		addWindow((HANDLE)wParam);
	else
		removeWindow((HANDLE)wParam);
	return 0;
}
Пример #18
0
void MyMainFrame::setActiveWindow(MyWindow* win)
{
	if(containsWindow(win)==false) addWindow(win);
	else
	{
		m_activeWin = win;
		Presentation()->MoveFocusTree(win);
	}
}
Пример #19
0
void WindowsManager::cloneWindow(int index)
{
	Window *window = getWindow(index);

	if (window && window->canClone())
	{
		addWindow(window->clone(true, m_mdi));
	}
}
Пример #20
0
void WindowServerLuna::createDismissCardWindow()
{
        if (m_dismissCardDialog)
                return;

        std::string qmlSrcPath = Settings::LunaSettings()->lunaQmlUiComponentsPath + "DismissCardTutorial/dismissDialog.qml";

        m_dismissCardDialog = new QmlAlertWindow(qmlSrcPath.c_str(), kAlertWindowWidth, 170);
        addWindow(m_dismissCardDialog.data());
}
Пример #21
0
void RKWorkplace::placeInToolWindowBar (RKMDIWindow *window, KMultiTabBar::KMultiTabBarPosition position) {
	RK_TRACE (APP);

	RK_ASSERT (window->isToolWindow ());
	tool_window_bars[position]->addWidget (window);
	if (!windows.contains (window)) {	// must be new
		addWindow (window, true);
		RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
	}
}
Пример #22
0
void WindowServerLuna::createMsmEntryFailedAlertWindow()
{
    if (m_msmEntryFailedAlert)
		return;

	std::string qmlSrcPath = Settings::LunaSettings()->lunaQmlUiComponentsPath + "MsmEntryFailed/alert.qml";

	m_msmEntryFailedAlert = new QmlAlertWindow(qmlSrcPath.c_str(), kAlertWindowWidth, 160);
	addWindow(m_msmEntryFailedAlert.data());
}
 WindowsManager::WindowID WindowsManager::createWindow (const char* winName)
 {
     std::string wn (winName);
     WindowManagerPtr_t newWindow = WindowManager::create ();
     WindowID windowId = addWindow (wn, newWindow);
     boost::thread refreshThread (boost::bind
             (&WindowsManager::threadRefreshing,
              this, newWindow));
     return windowId;
 }
Пример #24
0
void RKWorkplace::openOutputWindow (const KUrl &url) {
	RK_TRACE (APP);

	RKHTMLWindow *w = RKOutputWindowManager::self ()->getCurrentOutputWindow ();
	if (!windows.contains (w)) {
		addWindow (w);
	} else {
		w->activate ();
	}
}
Пример #25
0
 void GLFW_App::init()
 {
     // Initialize GLFW
     if( !glfwInit() )
     {
         throw Exception("GLFW failed to initialize");
     }
     
     int num_color_bits = 8;
     
     //TODO: find out why this is necessary for smooth gradients
     glfwWindowHint(GLFW_RED_BITS, num_color_bits);
     glfwWindowHint(GLFW_GREEN_BITS, num_color_bits);
     glfwWindowHint(GLFW_BLUE_BITS, num_color_bits);
     
     // request an OpenGl 4.1 Context
     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
     glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
     glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
     glfwWindowHint(GLFW_SAMPLES, 4);
     
     // create the window
     addWindow(GLFW_Window::create(getWidth(), getHeight(), getName(), fullSceen()));
     gl::setWindowDimension(windowSize());
     
     // set graphical log stream
     Logger::get()->add_outstream(&m_outstream_gl);
     
     // version
     LOG_INFO<<"OpenGL: " << glGetString(GL_VERSION);
     LOG_INFO<<"GLSL: " << glGetString(GL_SHADING_LANGUAGE_VERSION);
     
     glfwSwapInterval(1);
     glClearColor(0, 0, 0, 1);
     
     // file search paths
     kinski::addSearchPath(".", true);
     kinski::addSearchPath("./res", true);
     kinski::addSearchPath("../Resources", true);
     
     //---------------------------------
     #ifdef KINSKI_MAC
     kinski::addSearchPath("/Library/Fonts");
     kinski::addSearchPath("~/Library/Fonts");
     #endif
     //---------------------------------
     
     // AntTweakbar
     TwInit(TW_OPENGL_CORE, NULL);
     TwWindowSize(getWidth(), getHeight());
     
     // call user defined setup callback
     setup();
 }
Пример #26
0
// c'tor: starts app by adding an initial window:
NanoDotApp::NanoDotApp() :
	BApplication("application/x-vnd.eamoon-nanodot-r1"),
	m_pMidiSynth(NULL) {
	
	// initialize synth:
	initSynth();
	
	// get a list of available ports:
	enumeratePorts();

	// add first window:
	addWindow(new NanoDotWindow());
}
void TravelWorkbench::slotFileNewContact()
{
   BEGIN;
   ContactWindow *window = new ContactWindow("ContactWindow", this);
   window->initialize(); //init the DataModel?
   if (window->slotFileNew() == true) {
      initWindow(window);
      addWindow(window);
      showWindow(window);
   } else {
      delete window;
   }

}
Пример #28
0
Pager::Pager(KWMModuleApplication *a, char *name) : QWidget(NULL,  "kwmpager")
{
    kwmmapp = a;
    a->setMainWidget(this);
    kwmmapp -> connectToKWM();
    KWM::setSticky(winId(), true);
    KWM::setDecoration(winId(), KWM::tinyDecoration | KWM::noFocus);
    KWM::setWmCommand(winId(), name);
    KWM::setUnsavedDataHint(winId(), false);

    int count = KWM::numberOfDesktops();
    desktop_font = new QFont();
    Desktop *desk;

    desktops.resize(count);
    for (int i = 0; i < count; i++) {
        desk = new Desktop(a, i + 1, this);
        desktops[i] = desk;
    }
    
    activeDesktop = desktops.at(KWM::currentDesktop() - 1);
    activeDesktop->activate(true);
    
    connect(kwmmapp, SIGNAL(desktopChange(int)) , 
	    SLOT(changeDesktop(int)));
    connect(kwmmapp, SIGNAL(init()), 
	    SLOT(initDesktops()));
    connect(kwmmapp, SIGNAL( desktopNumberChange(int)), 
	    SLOT(changeNumber(int)));
    connect(kwmmapp, SIGNAL( windowAdd(Window)), 
	    SLOT(addWindow(Window)));
    connect(kwmmapp, SIGNAL( windowRemove(Window)), 
	    SLOT(removeWindow(Window)));
    connect(kwmmapp, SIGNAL( windowChange(Window)), 
	    SLOT(windowChange(Window)));
    connect(kwmmapp, SIGNAL( windowRaise(Window)), 
	    SLOT(raiseWindow(Window)));
    connect(kwmmapp, SIGNAL( windowLower(Window)), 
	    SLOT(lowerWindow(Window)));
    connect(kwmmapp, SIGNAL( windowActivate(Window)), 
	    SLOT(windowActivate(Window)));
    connect(kwmmapp, SIGNAL( commandReceived(QString)),
	    SLOT(receiveCommand(QString)));

    moved = false;
    readSettings();
    initDesktops();
    show();
    placeIt();
}
Пример #29
0
void WindowsManager::restore(int index)
{
	if (index < 0 || index >= m_closedWindows.count())
	{
		return;
	}

	const ClosedWindow closedWindow = m_closedWindows.at(index);
	int windowIndex = -1;

	if (closedWindow.previousWindow == 0)
	{
		windowIndex = 0;
	}
	else if (closedWindow.nextWindow == 0)
	{
		windowIndex = m_mainWindow->getTabBar()->count();
	}
	else
	{
		const int previousIndex = getWindowIndex(closedWindow.previousWindow);

		if (previousIndex >= 0)
		{
			windowIndex = (previousIndex + 1);
		}
		else
		{
			const int nextIndex = getWindowIndex(closedWindow.nextWindow);

			if (nextIndex >= 0)
			{
				windowIndex = qMax(0, (nextIndex - 1));
			}
		}
	}

	Window *window = new Window(m_isPrivate);
	window->setSession(closedWindow.window);

	m_closedWindows.removeAt(index);

	if (m_closedWindows.isEmpty() && SessionsManager::getClosedWindows().isEmpty())
	{
		emit closedWindowsAvailableChanged(false);
	}

	addWindow(window, DefaultOpen, windowIndex);
}
Пример #30
0
void RKWorkplace::newObjectViewer (RObject *object) {
	RK_TRACE (APP);
	RK_ASSERT (object);

	RKWorkplaceObjectList object_windows = getObjectList (RKMDIWindow::ObjectWindow, RKMDIWindow::AnyWindowState);
	for (RKWorkplaceObjectList::const_iterator it = object_windows.constBegin (); it != object_windows.constEnd (); ++it) {
		if (static_cast<RObjectViewer *> (*it)->object () == object) {
			(*it)->activate ();
			return;
		}
	}

	RObjectViewer *ov = new RObjectViewer (view (), object);
	addWindow (ov);
}