void TLFrameSequenceLayout::loadFrames( QPtrList<Layer> layers )
{
    number_of_frame_sequences = 0;
    max_used_frames = 0;
    delete current_frame_sequence;
    list_of_frame_sequences.clear();

    Layer *l_it;
    for ( l_it = layers.first(); l_it; l_it = layers.next() )
    {
	QPtrList<KeyFrame> keyframes = l_it -> keyFrames();
        number_of_frame_sequences++;

    	TLFrameSequence *new_frame_sequence = new TLFrameSequence( number_of_frame_sequences, viewport(), this );
	if ( l_it == layers.getFirst() )
	    current_frame_sequence = new_frame_sequence;
    	addChild( new_frame_sequence, 0, ( number_of_frame_sequences - 1 ) * new_frame_sequence -> height() );
    	connect( new_frame_sequence, SIGNAL( frameInserted() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( frameRemoved() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( keyframeRemoved( int ) ), SIGNAL( keyframeRemovedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenCreated( int ) ), SIGNAL( motionTweenCreatedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenRemoved( int ) ), SIGNAL( motionTweenRemovedToES( int ) ) );
	list_of_frame_sequences.append( new_frame_sequence );
    	last_frame_sequence = new_frame_sequence;
    	updateContentSize();

	new_frame_sequence -> loadFrames( keyframes );
    }
}
示例#2
0
void Button::setTitleText(const std::string& text)
{
    if (text == getTitleText())
    {
        return;
    }
    _titleRenderer->setString(text);
    updateContentSize();
}
void TLFrameSequenceLayout::resizeEvent( QResizeEvent *resize_event )
{
    Q_CHECK_PTR( resize_event );
    QSize new_size = resize_event -> size();

    QScrollView::resizeEvent( resize_event );

    updateContentSize();
}
示例#4
0
void Button::setTitleFontSize(float size)
{
    if (_type == FontType::SYSTEM) {
        _titleRenderer->setSystemFontSize(size);
    }
    else {
        TTFConfig config = _titleRenderer->getTTFConfig();
        config.fontSize = size;
        _titleRenderer->setTTFConfig(config);
    }
    updateContentSize();
    _fontSize = size;
}
示例#5
0
void Button::setTitleText(const std::string& text)
{
    if (text == getTitleText())
    {
        return;
    }
    if(nullptr == _titleRenderer)
    {
        this->createTitleRenderer();
    }
    _titleRenderer->setString(text);
    this->setTitleFontSize(_fontSize);
    updateContentSize();
}
void TLFrameSequenceLayout::slotInsertFrameSequence()
{
    number_of_frame_sequences++;
    TLFrameSequence *new_frame_sequence = new TLFrameSequence( number_of_frame_sequences, viewport(), this );
    addChild( new_frame_sequence, 0, ( number_of_frame_sequences - 1 ) * new_frame_sequence -> height() );
    connect( new_frame_sequence, SIGNAL( frameInserted() ), SLOT( slotUpdateMaxUsedFrames() ) );
    connect( new_frame_sequence, SIGNAL( frameRemoved() ), SLOT( slotUpdateMaxUsedFrames() ) );
    connect( new_frame_sequence, SIGNAL( keyframeRemoved( int ) ), SIGNAL( keyframeRemovedToES( int ) ) );
    connect( new_frame_sequence, SIGNAL( motionTweenCreated( int ) ), SIGNAL( motionTweenCreatedToES( int ) ) );
    connect( new_frame_sequence, SIGNAL( motionTweenRemoved( int ) ), SIGNAL( motionTweenRemovedToES( int ) ) );
    new_frame_sequence -> show();
    list_of_frame_sequences.append( new_frame_sequence );
    last_frame_sequence = new_frame_sequence;
    updateContentSize();
}
void TLFrameSequenceLayout::slotMoveFrameSequenceDown()
{
    //If the current frame sequence is the last, do nothing
    if ( current_frame_sequence == last_frame_sequence )
        return;

    //Find the frame sequence above the current and reinsert it into the list in its new position
    TLFrameSequence *frame_sequence_below = list_of_frame_sequences.take( list_of_frame_sequences.find( current_frame_sequence ) + 1 );
    current_frame_sequence -> setPosition( current_frame_sequence -> position() + 1 );
    frame_sequence_below -> setPosition( frame_sequence_below -> position() - 1 );
    list_of_frame_sequences.insert( frame_sequence_below -> position() - 1, frame_sequence_below );
    if ( frame_sequence_below == last_frame_sequence )
        last_frame_sequence = current_frame_sequence;

    //Swap both frame sequences in the scroll view
    moveChild( frame_sequence_below, childX( frame_sequence_below ), childY( frame_sequence_below ) - 24 );
    moveChild( current_frame_sequence, childX( current_frame_sequence ), childY( current_frame_sequence ) + 24 );
    updateContentSize();
}
void TLFrameSequenceLayout::slotSwapFrameSequences( int c_pos, int r_pos )
{
    Q_ASSERT( c_pos > 0 && r_pos > 0 );
    TLFrameSequence *release_frame_sequence;

    release_frame_sequence = NULL;

    //Above
    if ( c_pos > r_pos )
    {
        current_frame_sequence = list_of_frame_sequences.take( list_of_frame_sequences.find( current_frame_sequence ) );
        release_frame_sequence = list_of_frame_sequences.take( r_pos - 1 );
        current_frame_sequence -> setPosition( r_pos );
        release_frame_sequence -> setPosition( c_pos );
        list_of_frame_sequences.insert( current_frame_sequence -> position() - 1, current_frame_sequence );
        list_of_frame_sequences.insert( release_frame_sequence -> position() - 1, release_frame_sequence );
    }
    //Below
    else if ( c_pos < r_pos )
    {
        release_frame_sequence = list_of_frame_sequences.take( r_pos - 1 );
        current_frame_sequence = list_of_frame_sequences.take( list_of_frame_sequences.find( current_frame_sequence ) );
        current_frame_sequence -> setPosition( r_pos );
        release_frame_sequence -> setPosition( c_pos );
        list_of_frame_sequences.insert( release_frame_sequence -> position() - 1, release_frame_sequence );
        list_of_frame_sequences.insert( current_frame_sequence -> position() - 1, current_frame_sequence );
    }
    last_frame_sequence = list_of_frame_sequences.getLast();

    int cfs_old_x, cfs_old_y, rfs_old_x, rfs_old_y;
    cfs_old_x = childX( current_frame_sequence );
    cfs_old_y = childY( current_frame_sequence );
    rfs_old_x = childX( release_frame_sequence );
    rfs_old_y = childY( release_frame_sequence );
    moveChild( current_frame_sequence, rfs_old_x, rfs_old_y );
    moveChild( release_frame_sequence, cfs_old_x, cfs_old_y );
    updateContentSize();
}
void TLFrameSequenceLayout::slotRemoveFrameSequence()
{
   if ( number_of_frame_sequences > 1 )
   {
      TLFrameSequence *bridge_frame_sequence;
      number_of_frame_sequences--;

      //Case 1: When the sequence of frames is the last within the list
      if ( current_frame_sequence == last_frame_sequence )
      {
	  list_of_frame_sequences.remove( current_frame_sequence );
	  bridge_frame_sequence = list_of_frame_sequences.getLast();
	  delete current_frame_sequence;
	  current_frame_sequence = bridge_frame_sequence;
	  last_frame_sequence = current_frame_sequence;
	  current_frame = NULL;
      }
      //Case 2: When the sequence of frames is any except the last
      else
      {
	  bridge_frame_sequence = list_of_frame_sequences.at( list_of_frame_sequences.find( current_frame_sequence ) + 1 );

	  //Reaccomodate every frame_sequence next to the frame_sequence that is going to be deleted
	  TLFrameSequence *frame_sequence_iterator;
	  for ( frame_sequence_iterator = bridge_frame_sequence; frame_sequence_iterator; frame_sequence_iterator = list_of_frame_sequences.next() )
	  {
	      moveChild( frame_sequence_iterator, childX( frame_sequence_iterator ), childY( frame_sequence_iterator ) - frame_sequence_iterator -> height() );
	      frame_sequence_iterator -> setPosition( frame_sequence_iterator -> position() - 1 );
	  }

	  list_of_frame_sequences.remove( current_frame_sequence );
	  delete current_frame_sequence;
	  current_frame_sequence = bridge_frame_sequence;
	  current_frame = NULL;
      }
      updateContentSize();
   }
}
示例#10
0
void Button::setTitleFontSize(float size)
{
    if (nullptr == _titleRenderer)
    {
        this->createTitleRenderer();
    }

    _fontSize = size;
    if (_type == FontType::SYSTEM)
    {
        _titleRenderer->setSystemFontSize(_fontSize);
    }
    else if (_type == FontType::TTF)
    {
        TTFConfig config = _titleRenderer->getTTFConfig();
        config.fontSize = _fontSize;
        _titleRenderer->setTTFConfig(config);
    }
    //we can't change font size of BMFont.
    if(FontType::BMFONT != _type)
    {
        updateContentSize();
    }
}
示例#11
0
void wyBitmapFontLabel::setAlignment(Alignment alignment) {
	m_alignment = alignment;
	updateContentSize();
}
示例#12
0
void wyBitmapFontLabel::setLineSpacing(float spacing) {
	m_lineSpacing = spacing;
	updateContentSize();
}
示例#13
0
void wyBitmapFontLabel::setLineWidth(float width) {
	m_lineWidth = width;
	updateContentSize();
}
示例#14
0
void wyBitmapFontLabel::setLineHeight(float height) {
	m_lineHeight = height;
	updateContentSize();
}