/***************************************************************************//**
 * @author Daniel Andrus, Johnny Ackerman
 * 
 * @par Description: Mouse movement callback. Executes when the mouse is moved
 *		inside the program window while a button is pressed.
 *
 * @param[in]	x - New x position of the mouse.
 * @param[in]	y - New y position of the mouse.
*******************************************************************************/
void Fractals::mousedrag(int x, int y)
{
	double vx;	// view x
	double vy;	// view y

	// Correct for coordinate system
	vx = x;
    vy = window_height - y;

	// Correct for scaling
	vx *= view_width / window_width;
	vy *= view_height / window_height;

	vx -= view_x;
	vy -= view_y;

	// Forward event to tabs
	for (auto tab : tabs)
	{
		tab->mousedrag(vx, vy);
	}

	// Forward event to active view
	if (getActiveView() != NULL)
	{
		getActiveView()->mousedrag(vx, vy);
	}
}
Beispiel #2
0
void SDScreens::changeCamera(long p)
{
    this->getActiveView()->getCameras()->nextCamera(p);

    // For SpanSplit ensure screens change together
    if (m_SpanSplit && getActiveView()->getViewOffset() )
    {
        int i, camList,camNum;

        getActiveView()->getCameras()->getIntSelectedListAndCamera(&camList,&camNum);

        for (i=0; i < m_NbActiveScreens; i++)
            if (Screens[i]->getViewOffset() )
                Screens[i]->getCameras()->selectCamera(camList,camNum);
    }
}
Beispiel #3
0
void KfmView::copySelection()
{
	// clear the internal clipboard first.
    clipboard->clear();

    // Is there any text selected ?	
    if ( getActiveView()->isTextSelected() )
    {
        QString txt;
		getActiveView()->getSelectedText ( txt );		
        if (!txt.isEmpty())
		{			
            clipboard->append(txt);
			KApplication::clipboard()->setText( txt );
		}
	}
	// If not what about URL(s) ?	
	else
	{
		getActiveView()->getSelected( (*clipboard) );
		// if user clicked on the background w/o selecting anything else.	
		if (clipboard->isEmpty() && popupMenuEvent )
		{
			clipboard->append ( getURL() );
			KApplication::clipboard()->setText( getURL() );
        }
		else
        {
            if ( clipboard->count() == 1 )
    			KApplication::clipboard()->setText( clipboard->first() );
            else if ( clipboard->count() > 1  )
            {
                QString url = "";
                for ( const char *s = clipboard->first(); s != 0L; s = clipboard->next() )
                {
                    url += s;
                    url += "\n"; // add a line feed for separating multiple selections
                }
                if ( !url.isEmpty() )
                    KApplication::clipboard()->setText( url.data() );
            }
        }
    }
}
Beispiel #4
0
void NGraphicManager::renderScene(sf::RenderTarget& target)
{
    sf::View old = target.getView();
    target.setView(getActiveView());
    for (auto itr = mRenderables.begin(); itr != mRenderables.end(); itr++)
    {
        (*itr)->render(target);
    }
    target.setView(old);
}
Beispiel #5
0
void KfmView::slotBookmarks()
{
    char *s;
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
    {
       popupFiles.append ( getURL() );
    }
    for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )    
	gui->addBookmark( s, s );
}
Beispiel #6
0
void KfmView::slotNewView()
{
	char *s;
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
       popupFiles.append ( getURL() );
	for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )
	{
	KfmGui *m = new KfmGui( 0L, 0L, s );
	m->show();
    }
}
Beispiel #7
0
void KfmView::slotProperties()
{
	QStrList popupFiles = new QStrList();
	getActiveView()->getSelected ( popupFiles );
	if ( popupFiles.isEmpty() && popupMenuEvent )
	{
		popupFiles.append ( getURL() );
	}
    if ( popupFiles.count() != 1 )
    {
	warning(klocale->translate("ERROR: Can not open properties for multiple files"));
	return;
    }

    (void)new Properties( popupFiles.first() );
}
Beispiel #8
0
void KfmView::slotOpenWith()
{
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
{
		popupFiles.append ( getURL() );
    }
    OpenWithDlg l( klocale->translate("Open With:"), "", this, true );
    if ( l.exec() )
    {
      KMimeBind *bind = l.mimeBind();
      if ( bind )
      {
	const char *s;
	for( s = popupFiles.first(); s != 0L; s = popupFiles.next() )
	  bind->runBinding( s );
	return;
      }
      QString pattern = l.getText();
      if ( pattern.length() == 0 )
	return;
    }
    else
      return;
    
    printf("KfmView::slotPopupOpenWith starts openWithOldApplication(%s)\n", l.getText());
    KURL u(popupFiles.first());
    if (u.isLocalFile())
    {
        QString udir(u.directory());
        udir.detach();
        KURL::decodeURL(udir); // I hate KURL, you never know when it's encoded ... David.
        openWithOldApplication( l.getText(), popupFiles, udir ); 
    }
    else  openWithOldApplication( l.getText(), popupFiles );
}              
Beispiel #9
0
sf::Vector2f NWorld::getPointerPositionView(int touchIndex)
{
    return getWindow().getPointerPositionView(getActiveView(),touchIndex);
}