示例#1
0
void BrowserDialog::maximizeWidth()
{
    int viewportWidth = getCurrentView()->page()->viewportSize().width();
    int frameWidth = width() - viewportWidth;

    int contentWidth = getCurrentView()->page()->mainFrame()->contentsSize().width();

    QDesktopWidget screen;
    int currentScreen = screen.screenNumber(this);
    int screenWidth = screen.screenGeometry(currentScreen).size().width();

    int targetWidth = std::min<int>(std::max<int>(viewportWidth, contentWidth) + frameWidth, screenWidth);
    this->resize(targetWidth, height());
}
示例#2
0
void BrowserDialog::on_urlEdit_returnPressed()
{
    QWebView *currentView = getCurrentView();
    if (currentView != nullptr) {
        currentView->setUrl(QUrl(ui->urlEdit->text()));
    }
}
void RenderRectangle::removeView(View *view)
{
	if(view != NULL && !_views.empty())
	{
	  osg::ref_ptr<View> cv = getCurrentView(); // Save currently selected view
	  osg::ref_ptr<View> v_save = view; // Save to make sure View doesn't get deallocated

	  // Find the view to be deleted
	  ViewList::iterator i = std::find(_views.begin(), _views.end(), view);
	  while(i != _views.end())
	  {
	    // Save this view's trackball then erase it from the list
	    (*i)->saveTrackball();
	    _views.erase(i);
		
		i = std::find(_views.begin(), _views.end(), view); // Find next instance of view
	  }

	  // We erased the currently selected view, so select the first view
	  if(cv == v_save) 
	  {
		_currView = 0;
		selectCurrentView(); // Will select first view (or default view if no stored views)
	  }
	  else selectView(cv); // Select what was already selected before
	}
}
RenderRectangle::RenderRectangle()
{
	// Create the Camera that will draw the border.
	_border = new osg::Camera;

	// Create the auto depth partitioning node
	_depthPartition = new DepthPartitionNode;

	// The scene contains the user's scene along with decorations
	_scene = new osg::Group;

	// Create the sky sphere but don't draw it yet
        _skySphere = new SkySphere("Sky Sphere");
        _skySphere->setDrawMode(SkySphere::NONE);

	// The SceneView is responsible for doing the update, cull, and 
	// draw operations for the ReferenceFrame scene.
	_sceneView = new osgViewer::View();

	// Create a default view and make it active
	_defaultView = new View;
	_currView = 0;
	_sceneView->setCameraManipulator(getCurrentView()->getTrackball());

	// Initialize parameters
	_init();
}
示例#5
0
void BrowserDialog::on_backBtn_clicked()
{
    BrowserView *currentView = getCurrentView();
    if (currentView != nullptr) {
        currentView->back();
    }
}
示例#6
0
void BrowserDialog::on_fwdBtn_clicked()
{
    BrowserView *currentView = getCurrentView();
    if (currentView != nullptr) {
        currentView->forward();
    }
}
示例#7
0
void BrowserDialog::on_searchEdit_returnPressed()
{
    BrowserView *currentView = getCurrentView();
    if (currentView != nullptr) {
        currentView->findText(ui->searchEdit->text(), QWebPage::FindWrapsAroundDocument);
    }
}
void ScriptCollectionDialog::onAbort()
{
    ScriptUnitView *scriptView = getCurrentView();
    if (scriptView == nullptr)
        return;

    scriptView->onAbort();
}
示例#9
0
bool ContactsTable::checkSaving() const
  {
  if (ContactView * currentView = getCurrentView ())
    {
    return currentView->CheckSaving();
    }
  return true;
  }
示例#10
0
void BrowserDialog::urlChanged(const QUrl &url)
{
    BrowserView *currentView = getCurrentView();
    if (currentView != nullptr) {
        ui->backBtn->setEnabled(currentView->history()->canGoBack());
        ui->fwdBtn->setEnabled(currentView->history()->canGoForward());
    }
    ui->urlEdit->setText(url.toString());
}
void ScriptCollectionDialog::onSave()
{
    ScriptUnitView *scriptView = getCurrentView();
    if (scriptView == nullptr)
        return;

    if (scriptView->onSave())
        clearModifiedMark(m_ui->tabWidget->currentIndex());
}
示例#12
0
void ContactsTable::on_actionShow_details_toggled(bool checked)
  {
  if (ContactView * currentView = getCurrentView ())
    if (currentView->isAddingNewContact ())
      return;

  if (checked)
    ui->contact_details_view->show();
  else
    ui->contact_details_view->hide();
  }
示例#13
0
bool ContactsTable::EscapeIfEditMode() const
{
  if (ContactView * currentView = getCurrentView ())
  {
    if (currentView->isEditing())
    {
      currentView->onCancel();
      return true;
    }    
  }
  return false;
}
void RenderRectangle::selectView(unsigned int newView)
{
	if(_views.empty() || (newView >= _views.size())) return;

	// Save the previous View's trackball
	getCurrentView()->saveTrackball();

	_currView = newView; // Select the new View

	// Set the new View's trackball as active 
	selectCurrentView();
}
boost::python::list NotepadPlusWrapper::getFiles()
{
	idx_t count;
	intptr_t bufferID;

	boost::python::list files;

	int view = 0;
	bool onlyOneView = isSingleView();
	if (onlyOneView) { view = getCurrentView(); }
	int view_end = onlyOneView ? view : 1;
			
	for(view; view <= view_end; view++)
	{
		count = (idx_t)callNotepad(NPPM_GETNBOPENFILES, 0, view ? SECOND_VIEW : PRIMARY_VIEW);

		TCHAR **fileNames = (TCHAR **)new TCHAR*[count];
		for (idx_t i = 0 ; i < count ; i++)
		{
			fileNames[i] = new TCHAR[MAX_PATH];
		}

		if (callNotepad(view ? NPPM_GETOPENFILENAMESSECOND : NPPM_GETOPENFILENAMESPRIMARY,
							reinterpret_cast<WPARAM>(fileNames), static_cast<LPARAM>(count)))
		{
			for(idx_t pos = 0; pos < count; pos++)
			{
				bufferID = callNotepad(NPPM_GETBUFFERIDFROMPOS, pos, view);
				if (bufferID)
				{
#ifdef UNICODE
					std::shared_ptr<char> mbFilename = WcharMbcsConverter::tchar2char(fileNames[pos]);
					files.append(boost::python::make_tuple(const_cast<const char*>(mbFilename.get()), bufferID, pos, view));
#else
					files.append(boost::python::make_tuple(const_cast<const char*>(fileNames[pos]), bufferID, pos, view));
#endif
				}
			}
		}

		for (idx_t i = 0 ; i < count ; i++)
		{
			delete [] fileNames[i];
		}

		delete [] fileNames;
	}

	return files;
}
void RenderRectangle::previousView()
{
	// Save the current View's trackball
	getCurrentView()->saveTrackball();

	// Cycle to previous View
	if(!_views.empty())
	{
	  if(_currView == 0) _currView = _views.size()-1;
	  else _currView--;
	}

	// Set the new View's trackball as active 
	selectCurrentView();
}
void RenderRectangle::nextView()
{
	// Save the current View's trackball
	getCurrentView()->saveTrackball();

	// Cycle to next View
	if(!_views.empty())
	{
	  if(_currView >= _views.size()-1) _currView = 0;
	  else _currView++;
	}

	// Set the new View's trackball as active 
	selectCurrentView();
}
示例#18
0
void jumpToFirstChange()
{
	HWND currView = getCurrentView();

	const int sci_search_mask = (1 << MARKER_MOVED_LINE)
							  | (1 << MARKER_CHANGED_LINE)
							  | (1 << MARKER_ADDED_LINE)
							  | (1 << MARKER_REMOVED_LINE)
							  | (1 << MARKER_BLANK_LINE);

	const int nextLine = ::SendMessage(currView, SCI_MARKERNEXT, 0, sci_search_mask);

	if (nextLine < 0)
		return;

	::SendMessage(currView, SCI_ENSUREVISIBLEENFORCEPOLICY, nextLine, 0);
	::SendMessage(currView, SCI_GOTOLINE, nextLine, 0);
}
void RenderRectangle::selectView(View *view)
{
	// Search for the requested view in the list
	for(unsigned int i = 0; i < _views.size(); ++i)
	{
	  // If found, apply that view
	  if(_views[i] == view) 
	  {
	    // Save the previous View's trackball
	    getCurrentView()->saveTrackball();

	    _currView = i; // Select the new View

	    // Set the new View's trackball as active 
	    selectCurrentView();
		return;
	  }
	}
}
void RenderRectangle::applyCurrentPerspective()
{
	View *view = getCurrentView();

	/** Adjust the perspective projection with the current viewport size */
	if(view->getProjectionType() == View::PERSPECTIVE)
	{
	  const osg::Viewport *vp = _sceneView->getCamera()->getViewport();
	  double fov, ratio;

	  view->getPerspective(fov, ratio); // Get current field of view (fov)

	  // Compute new aspect ratio if the viewport is defined
	  if(vp != NULL) ratio = (double)vp->width() / (double)vp->height();

	  view->setPerspective(fov, ratio); // Set new aspect ratio
	}

	_sceneView->getCamera()->setProjectionMatrix(view->getProjectionMatrix());
}
示例#21
0
void ContactsTable::selectChat()
  {
  if (ContactView * currentView = getCurrentView ())
    if (!currentView->isAddingNewContact ())
      currentView->onChat ();
  }
示例#22
0
void BrowserDialog::on_refreshBtn_clicked()
{
    getCurrentView()->reload();
}
void RenderRectangle::selectCurrentView()
{
	_sceneView->setCameraManipulator(getCurrentView()->getTrackball());
	applyCurrentPerspective();
}
示例#24
0
void jumpToNextChange(bool down, bool wrapAround)
{
	HWND view = getCurrentView();

	const int sci_search_mask = (1 << MARKER_MOVED_LINE) |
								(1 << MARKER_CHANGED_LINE) |
								(1 << MARKER_ADDED_LINE) |
								(1 << MARKER_REMOVED_LINE) |
								(1 << MARKER_BLANK_LINE);

	const int sci_marker_direction = down ? SCI_MARKERNEXT : SCI_MARKERPREVIOUS;

	int currentLine = getCurrentLine(view);

	const int lineMax = ::SendMessage(view, SCI_GETLINECOUNT, 0, 0);
	const int prevLine = currentLine;
	int nextLine = currentLine;

	while (nextLine == currentLine)
	{
		if (down)
		{
			while ((::SendMessage(view, SCI_MARKERGET, currentLine, 0) & sci_search_mask) && (currentLine < lineMax))
				++currentLine;
		}
		else
		{
			while ((::SendMessage(view, SCI_MARKERGET, currentLine, 0) & sci_search_mask) && (currentLine > -1))
				--currentLine;
		}

		nextLine = ::SendMessage(view, sci_marker_direction, currentLine, sci_search_mask);

		if (nextLine < 0)
		{
			if (!wrapAround)
				return;

			currentLine = down ? 0 : lineMax;
			nextLine = ::SendMessage(view, sci_marker_direction, currentLine, sci_search_mask);

			if (nextLine < 0)
				return;
			else
				break;
		}
	}

	if ((down && (nextLine < prevLine)) || (!down && (nextLine > prevLine)))
	{
		FLASHWINFO flashInfo;
		flashInfo.cbSize = sizeof(flashInfo);
		flashInfo.hwnd = nppData._nppHandle;
		flashInfo.uCount = 2;
		flashInfo.dwTimeout = 100;
		flashInfo.dwFlags = FLASHW_ALL;
		::FlashWindowEx(&flashInfo);
	}

	::SendMessage(view, SCI_ENSUREVISIBLEENFORCEPOLICY, nextLine, 0);
	::SendMessage(view, SCI_GOTOLINE, nextLine, 0);
}
示例#25
0
void ContactsTable::contactRemoved()
  {
  if (ContactView * currentView = getCurrentView ())
      currentView->onInfo ();
  }