Exemple #1
0
bool GuiInspectorField::onAdd()
{   
   setInspectorProfile();   

   if ( !Parent::onAdd() )
      return false;

   if ( !mInspector )
      return false;   

   mEdit = constructEditControl();
   if ( mEdit == NULL )
      return false;

   setBounds(0,0,100,18);

   // Add our edit as a child
   addObject( mEdit );

   // Calculate Caption and EditCtrl Rects
   updateRects();   

   // Force our editField to set it's value
   updateValue();

   return true;
}
Exemple #2
0
void TEDemo::setMenuVisible(bool visible)
{
  b_menuvis = visible;
  m_options->setItemChecked(1,b_menuvis);
  if (b_menuvis) menubar->show(); else menubar->hide();
  updateRects();
}
Exemple #3
0
void KfindTop::enableStatusBar(bool enable) // rewriten (sven)
{
  /*
   DON`T LOOK HERE FOR EXAMPLE! IT`S A FORNBIDDEN DANCE!
   instead please mail me: [email protected]
  */
  //debug ("Wow, what an honour!");
  if (enable) // we become full-free - win is hsown and set
  {

    KTopLevelWidget::enableStatusBar(KStatusBar::Show); // implicite update
    _kfind->resize(_kfind->sizeHint());  // set size
    _kfind->setMaximumSize(9999, 9999);  // set us loos
    _kfind->setMinimumSize(_kfind->sizeHint()- QSize(0, 200));
    setMaximumSize(9999, 9999); // kill any constraints
    adjustSize(); // force us to resizeresizeresizeresizeresize
    setMinimumSize (size()); // dont' make us smaller
    
  }
  else  // we become YFixed - win is hidden
  {
    _kfind->resize(width(), _kfind->sizeHint().height());
    _kfind->setMinimumSize(_kfind->sizeHint());
    _kfind->setMaximumSize(9999, _kfind->sizeHint().height());
    KTopLevelWidget::enableStatusBar(KStatusBar::Hide); // updateRects: one
    updateRects();  // Ooops? Twice?
  }
}
Exemple #4
0
bool GuiInspectorField::resize( const Point2I &newPosition, const Point2I &newExtent )
{
   if ( !Parent::resize( newPosition, newExtent ) )
      return false;

   return updateRects();
}
Exemple #5
0
	void Window::setRect(const IRect &rect) {
		DASSERT(!m_dragging_mode);
		DASSERT(!rect.empty());

		m_rect = rect;
		setInnerRect(IRect({0, 0}, m_rect.size()));
		updateRects();
	}
void ColorSchemeGraphicsItem::setPadding(const qreal padding)
{
    if (padding == m_padding)
        return;

    m_padding = padding;
    updateRects();
}
void ColorSchemeGraphicsItem::setMargin(const qreal margin)
{
    if (margin == m_margin)
        return;

    m_margin = margin;
    updateRects();
}
void ColorSchemeGraphicsItem::setRectSize(const QSizeF & size)
{
    if (size == m_rectSize)
        return;

    m_rectSize = size;
    updateRects();
}
Exemple #9
0
void mainWidget::resizeEvent (QResizeEvent *) {
  // save size of the application window
  KConfig *config = KApplication::getKApplication()->getConfig();
  config->setGroup( "Appearance" );
  QString geom;
  geom.sprintf( "%dx%d", geometry().width(), geometry().height() );
  config->writeEntry( "Geometry", geom );
  updateRects();
}
Exemple #10
0
void kdvi::applyShowMenubar()
{
    if ( hideMenubar )	menuBar->hide();
    else			menuBar->show();
    optionsmenu->setItemChecked( optionsmenu->idAt(ID_OPT_MB), !hideMenubar );
    config->writeEntry( "HideMenubar", hideMenubar );

    // calling this will update the child geometries
    updateRects();
}
Exemple #11
0
void VideoWidget::frameReady()
{
	if(!m_thread)
		return;

// 	if(frame.isEmpty())
// 		qDebug() << "VideoWidget::frameReady(): isEmpty: "<<frame.isEmpty();

	VideoFramePtr f = m_thread->frame();
	if(!f)
		return;
	#ifdef DEBUG_VIDEOFRAME_POINTERS
	qDebug() << "VideoWidget::frameReady(): Received frame ptr:"<<f;
	#endif
		
	if(f->isValid())
	{
// 		if(m_frame && 
// 		   m_frame->release())
// 		{
// 			#ifdef DEBUG_VIDEOFRAME_POINTERS
// 			qDebug() << "VideoWidget::frameReady(): Deleting old m_frame:"<<m_frame;
// 			#endif
// 			
// 			delete m_frame;
// 		}

		m_frame = f;
		
		#ifdef DEBUG_VIDEOFRAME_POINTERS
		qDebug() << "VideoWidget::frameReady(): Received new m_frame:"<<m_frame;
		#endif
	}
// 	else
// 	{
// 		if(f->release())
// 		{
// 			#ifdef DEBUG_VIDEOFRAME_POINTERS
// 			qDebug() << "VideoWidget::frameReady(): Deleting invalid f ptr:"<<f;
// 			#endif
// 			
// 			delete f;
// 		}
// 	}

	if(m_frame && (m_frame->size() != m_origSourceRect.size() || m_targetRect.isEmpty() || m_sourceRect.isEmpty()))
		updateRects();

	//qDebug() << "VideoWidget::frameReady: frame size:"<<m_frame->size()<<", orig source rect size:" <<m_origSourceRect.size(); 
	//QTimer::singleShot(0, this, SLOT(updateTimer()));
	
	repaint();
}
Exemple #12
0
void QGraphicsVideoItemPrivate::_q_updateNativeSize()
{
    QSize size = surface->surfaceFormat().sizeHint();
    if (size.isEmpty())
        size = rendererControl->property("nativeSize").toSize();

    if (nativeSize != size) {
        nativeSize = size;

        updateRects();
        emit q_ptr->nativeSizeChanged(nativeSize);
    }
}
Exemple #13
0
void TEDemo::setColLin(int columns, int lines)
{
  if (columns==0 && lines==0)
  {
    if (defaultSize.isNull()) // not in config file : set default value
    {
      defaultSize = te->calcSize(80,24);
      notifySize(24,80); // set menu items (strange arg order !)
    }
    resize(defaultSize);
  }
  else
  {
    resize(te->calcSize(columns,lines));
    notifySize(lines,columns); // set menu items (strange arg order !)
  }
  updateRects();
}
Exemple #14
0
DialogScene::DialogScene(GameManager * manager, DialogBranch::Ref branch, Globals & globals)
: GameScene(manager), m_topScene(manager->getTopScene()), m_branch(branch), m_iter(m_branch->begin()), m_globals(globals)
{
	auto renderer = m_manager->getRenderer();
	
	// init phrase types animation:
	m_percent = 1.0f;
	m_oldtype = m_iter->first;
	m_newtype = m_iter->first;

	// create font data:
	m_font = CL_Font_System(renderer->getGC(), "Microsoft Sans Serif", 32);

	// provide initial layout:
	updateRects(renderer->getGCSize());
	updateLayout();

	// attach input handlers:
	m_slots.connect(renderer->getIC().get_keyboard().sig_key_down(), this, &DialogScene::onKeyDown);
	m_slots.connect(renderer->getIC().get_mouse().sig_key_down(), this, &DialogScene::onKeyDown);
}
bool GuiInspectorVariableField::onAdd()
{    
   setInspectorProfile();   

   // Hack: skip our immediate parent
   if ( !Parent::Parent::onAdd() )
      return false;  

   {
      GuiTextEditCtrl *edit = new GuiTextEditCtrl();

      edit->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );

      edit->registerObject();

      char szBuffer[512];
      dSprintf( szBuffer, 512, "%d.apply(%d.getText());",getId(), edit->getId() );
      edit->setField("AltCommand", szBuffer );
      edit->setField("Validate", szBuffer );

      mEdit = edit;
   }

   setBounds(0,0,100,18);

   // Add our edit as a child
   addObject( mEdit );

   // Calculate Caption and EditCtrl Rects
   updateRects();   

   // Force our editField to set it's value
   updateValue();

   return true;
}
Exemple #16
0
void TopLevel::resizeEvent(QResizeEvent *)
{
  updateRects();

  doResize();
}
void ColorSchemeGraphicsItem::setClasses(const uint classes)
{
    m_classes = qBound<uint>(m_scheme.minClasses(), classes, m_scheme.maxClasses());

    updateRects();
}
Exemple #18
0
void JpegServer::generateNextFrame()
{
	if(!m_scene || !MainWindow::mw())
		return;
		
	if(m_onlyRenderOnSlideChange &&
	   !m_slideChanged &&
	   !m_cachedImage.isNull())
	{
		//qDebug() << "JpegServer::generateNextFrame(): Hit Cache";
		emit frameReady(m_cachedImage);
		if(m_sender)
			m_sender->transmitImage(m_cachedImage);
		return;
	}
	
	if(m_onlyRenderOnSlideChange)
	{
		m_slideChanged = false;
		//qDebug() << "JpegServer::generateNextFrame(): Cache fallthru ...";
	}
	
	//qDebug() << "JpegServer::generateNextFrame(): Rendering scene "<<m_scene<<", slide:"<<m_scene->slide();
	
	m_time.start();
	
	QImage image(FRAME_WIDTH,
	             FRAME_HEIGHT,
		     FRAME_FORMAT);
	memset(image.scanLine(0), 0, image.byteCount());
	
	QPainter painter(&image);
	painter.fillRect(image.rect(),Qt::transparent);
	painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
	painter.setRenderHint(QPainter::Antialiasing, false);
	painter.setRenderHint(QPainter::TextAntialiasing, false);
	
	if(!m_sourceRect.isValid())
		m_sourceRect = MainWindow::mw()->standardSceneRect();
		
	if(m_sourceRect != m_targetRect)
		updateRects();
	
	m_scene->render(&painter,
		m_targetRect,
		m_sourceRect);
	
	painter.end();
	
 	emit frameReady(image);
	
	if(m_sender)
	{
		//qDebug() << "JpegServer::generateNextFrame(): Sending image via VideoSender";
		m_sender->transmitImage(image);
	}
	else
	{
		//qDebug() << "JpegServer::generateNextFrame(): No VideoSender created";
	}
	
	if(m_onlyRenderOnSlideChange)
		m_cachedImage = image;
	
// 	QImageWriter writer("frame.png", "png");
// 	writer.write(image);

	m_frameCount ++;
	m_timeAccum  += m_time.elapsed();
	
// 	if(m_frameCount % (m_fps?m_fps:10) == 0)
// 	{
// 		QString msPerFrame;
// 		msPerFrame.setNum(((double)m_timeAccum) / ((double)m_frameCount), 'f', 2);
// 	
// 		qDebug() << "JpegServer::generateNextFrame(): Avg MS per Frame:"<<msPerFrame<<", threadId:"<<QThread::currentThreadId();
// 	}
// 			
// 	if(m_frameCount % ((m_fps?m_fps:10) * 10) == 0)
// 	{
// 		m_timeAccum  = 0;
// 		m_frameCount = 0;
// 	}
	
	//qDebug() << "JpegServer::generateNextFrame(): Done rendering "<<m_scene;
}
Exemple #19
0
void VideoWidget::resizeEvent(QResizeEvent*)
{
	updateRects();
}
Exemple #20
0
void Scale9Sprite::updateSprites() {
	updateRects();
	
	float contentScaleX = 1.0f;
	float contentScaleY = 1.0f;
	
	if (_contentSize.width < _minContentSize.width) {
		contentScaleX = _contentSize.width / _minContentSize.width;
	}
	
	if (_contentSize.height < _minContentSize.height) {
		contentScaleY = _contentSize.height / _minContentSize.height;
	}

    int i, j;

    bool visible;
	float scaleX, scaleY;

    cocos2d::Rect texRect;
    cocos2d::Vec2 spritePos;

    auto tex = getTexture();
    float atlasWidth = (float)tex->getPixelsWide();
    float atlasHeight = (float)tex->getPixelsHigh();

    cocos2d::Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity );
	if (_opacityModifyRGB) {
		color4.r *= _displayedOpacity/255.0f;
		color4.g *= _displayedOpacity/255.0f;
		color4.b *= _displayedOpacity/255.0f;
    }

	size_t quadsCount = 9;
	size_t quadId = 0;

	if (contentScaleY < 1.0f && contentScaleX < 1.0f) {
		quadsCount = 4;
	} else if (contentScaleY < 1.0f || contentScaleX < 1.0f) {
		quadsCount = 6;
	}

	_quads->resize(quadsCount);

	for (int tag = 0; tag < 9; tag++) {
		visible = true;

		i = tag % 3;
		j = tag / 3;

		scaleX = contentScaleX;
		scaleY = contentScaleY;

		if (i == 1) {
			if (contentScaleY < 1.0f) {
				visible = false;
			} else {
				scaleY = _drawRect.size.height / _insetRect.size.height;
			}
		}

		if (j == 1) {
			if (contentScaleX < 1.0f) {
				visible = false;
			} else {
				scaleX = _drawRect.size.width / _insetRect.size.width;
			}
		}

		if (visible) {

			texRect = textureRectForGrid(i, j);
			spritePos = texturePositionForGrid(i, j, contentScaleX, contentScaleY);

			_quads->setTextureRect(quadId, texRect, atlasWidth, atlasHeight, _flipX, _flipY);
			_quads->setGeometry(quadId, spritePos, cocos2d::Size(texRect.size.width * scaleX, texRect.size.height * scaleY), _positionZ);
			_quads->setColor(quadId, color4);

			quadId ++;
		}
	}

	_quads->shrinkToFit();
}