void LeftLeftRotation(AVLTree* A)
{
    AVLTree B = (*A)->Left;
    (*A)->Left = B->Right;
    UpdateHeight(*A);
    B->Right = *A;
    UpdateHeight(B);
    *A = B;
}
Ejemplo n.º 2
0
void  ZNetCharacter::OnUpdate(float fDelta)
{
	if (m_bInitialized==false) return;
	if (!IsVisible()) return;

	float fTimeLapse = ZGetGame()->GetTime() - m_fLastValidTime;
	m_fLastValidTime = ZGetGame()->GetTime();

	ZCharacter::OnUpdate(fDelta);

	// 실제 움직이는 부분은 module_movable 로 옮겨갔다

	if(IsMoveAnimation())		// 애니메이션에 움직임이 포함된넘은 움직여줘야한다.
	{
		rvector origdiff=fDelta*GetVelocity();

		rvector diff = m_AnimationPositionDiff.Ref();
		diff.z+=origdiff.z;
		//		rvector diff=m_RealPositionBefore-m_RealPosition;	// mesh 의 위치 변화로 움직임판정
		if(GetDistToFloor()<0 && diff.z<0) diff.z=-GetDistToFloor();

		Move(diff);

		// debug
		/*
		mlog("%d pos : %3.3f %3.3f %3.3f      ani-move : %3.3f %3.3f %3.3f\n",
			m_AniState_Lower,
			m_Position.x,m_Position.y,m_Position.z,diff.x,diff.y,diff.z);
		*/
	}

	UpdateHeight(fDelta);
}
void Insert2AVLTree(AVLTree* T, ElementType data)
{
    if (*T == NULL)
    {
        AVLTree temp = (AVLTree)malloc(sizeof(struct AVLTreeNode));
        temp->Data = data;
        temp->Height = 0;
        temp->Left = temp->Right = NULL;
        *T = temp;
    }
    else
    {
        if (data < (*T)->Data)
        {
            Insert2AVLTree(&(*T)->Left, data);
            UpdateHeight(*T);
            if (IsBalance(*T))
            {
                if (data < (*T)->Left->Data)
                {
                    LeftLeftRotation(&(*T));
                }
                else
                {
                    LeftRightRotation(&(*T));
                }
            }
        }
        else
        {
            Insert2AVLTree(&(*T)->Right, data);
            UpdateHeight(*T);
            if (IsBalance(*T))
            {
                if (data > (*T)->Right->Data)
                {
                    RightRightRotation(&(*T));
                }
                else
                {
                    RightLeftRotation(&(*T));
                }
            }
        }
    }
}
Ejemplo n.º 4
0
void NowPlayingWidget::resizeEvent(QResizeEvent* e) {
  if (visible_ && e->oldSize() != e->size()) {
    if (mode_ == LargeSongDetails || mode_ == LargeSongDetailsBelow) {
      UpdateHeight();
      UpdateDetailsText();
    }
  }
}
Ejemplo n.º 5
0
void NowPlayingWidget::FitCoverWidth(bool fit) {
  fit_width_ = fit;
  UpdateHeight();
  update();

  QSettings s;
  s.beginGroup(kSettingsGroup);
  s.setValue("fit_cover_width", fit_width_);
}
Ejemplo n.º 6
0
bool FXCylinder::Update( void )
{
	UpdateScale();
	UpdateHeight();
	UpdateAlpha();
	UpdateRGB();

	return true;
}
Ejemplo n.º 7
0
void CPoltergeist::shedule_Update(u32 dt)
{
	inherited::shedule_Update(dt);
	CTelekinesis::schedule_update();
	Energy::schedule_update();

	UpdateHeight();

	ability()->update_schedule();
}
Ejemplo n.º 8
0
void CPictureSizeDlg::OnChangeHeight() 
{
   UpdateData();
   UpdateHeight();
   if(m_bPorportions)
   {
      m_dPicVecWidth = m_dPicVecHeight * (m_dOriginalPicVecWidth / m_dOriginalPicVecHeight);
      FillWidthAndHeight();
   }
}
Ejemplo n.º 9
0
void NowPlayingWidget::UpdateDetailsText() {
  QString html;

  switch (mode_) {
    case SmallSongDetails:
      details_->setTextWidth(-1);
      details_->setDefaultStyleSheet("");
      html += "<p>";
      break;

    case LargeSongDetails:
      details_->setTextWidth(cover_loader_options_.desired_height_);
      details_->setDefaultStyleSheet(
          "p {"
          "  font-size: small;"
          "  color: white;"
          "}");
      html += "<p align=center>";
      break;

    case LargeSongDetailsBelow:
      details_->setTextWidth(cover_loader_options_.desired_height_);
      if (fit_width_) {
        details_->setDefaultStyleSheet(
            "p {"
            "  font-size: small;"
            "}");
      } else {
        details_->setDefaultStyleSheet(
            "p {"
            "  font-size: small;"
            "  color: white;"
            "}");
      }
      html += "<p align=center>";
      break;
  }

  // TODO: Make this configurable
  html += QString("<i>%1</i><br/>%2<br/>%3").arg(
      Qt::escape(metadata_.PrettyTitle()), Qt::escape(metadata_.artist()),
      Qt::escape(metadata_.album()));

  html += "</p>";
  details_->setHtml(html);

  // if something spans multiple lines the height needs to change
  if (mode_ == LargeSongDetailsBelow) {
    UpdateHeight();
  }
}
Ejemplo n.º 10
0
HKWidgetLabel::HKWidgetLabel(HKWidgetType *pType)
: HKWidget(pType)
{
	textColour = MFVector::black;

	pFont = MFFont_GetDebugFont();
	bOwnFont = false;

	textJustification = MFFontJustify_Top_Left;

	bAutoTextHeight = true;
	textHeight = MFFont_GetFontHeight(pFont);
	shadowDepth = 0.f;

	if(bAutoHeight)
		UpdateHeight(textHeight);
}
Ejemplo n.º 11
0
void NowPlayingWidget::SetMode(int mode) {
  mode_ = Mode(mode);

  if (mode_ == SmallSongDetails) {
    fit_cover_width_action_->setEnabled(false);
  } else {
    fit_cover_width_action_->setEnabled(true);
  }

  UpdateHeight();
  UpdateDetailsText();
  update();

  QSettings s;
  s.beginGroup(kSettingsGroup);
  s.setValue("mode", mode_);
}
Ejemplo n.º 12
0
void ZActor::OnUpdate(float fDelta)
{
	if(m_pVMesh) {
		m_pVMesh->SetVisibility(1.f);
	}

	if (CheckFlag(AF_MY_CONTROL))
	{
		m_TaskManager.Run(fDelta);
		CheckDead(fDelta);

		ProcessNetwork(fDelta);

		// for test - bird
		if (m_bTestControl)
		{
			TestControl(fDelta);
		}
		else
		{
			__BP(60,"ZActor::OnUpdate::ProcessAI");
			if(isThinkAble())
				ProcessAI(fDelta);
			__EP(60);
		}

		ProcessMovement(fDelta);
	}
	
	ProcessMotion(fDelta);

	if (CheckFlag(AF_MY_CONTROL))
	{
		UpdateHeight(fDelta);
	}
}
Ejemplo n.º 13
0
	void MultilineLabel::UpdateSize()
	{
		// forward change to line buffer
		Lines.SetLBWidth(rcBounds.Wdt);
		UpdateHeight();
	}
Ejemplo n.º 14
0
NowPlayingWidget::NowPlayingWidget(QWidget* parent)
    : QWidget(parent),
      app_(nullptr),
      album_cover_choice_controller_(new AlbumCoverChoiceController(this)),
      mode_(SmallSongDetails),
      menu_(new QMenu(this)),
      above_statusbar_action_(nullptr),
      fit_cover_width_action_(nullptr),
      visible_(false),
      small_ideal_height_(0),
      fit_width_(false),
      show_hide_animation_(new QTimeLine(500, this)),
      fade_animation_(new QTimeLine(1000, this)),
      details_(new QTextDocument(this)),
      previous_track_opacity_(0.0),
      bask_in_his_glory_action_(nullptr),
      downloading_covers_(false),
      aww_(false),
      kittens_(nullptr),
      pending_kitten_(0) {
  // Load settings
  QSettings s;
  s.beginGroup(kSettingsGroup);
  mode_ = Mode(s.value("mode", SmallSongDetails).toInt());
  album_cover_choice_controller_->search_cover_auto_action()->setChecked(
      s.value("search_for_cover_auto", false).toBool());
  fit_width_ = s.value("fit_cover_width", false).toBool();

  // Accept drops for setting album art
  setAcceptDrops(true);

  // Context menu
  QActionGroup* mode_group = new QActionGroup(this);
  QSignalMapper* mode_mapper = new QSignalMapper(this);
  connect(mode_mapper, SIGNAL(mapped(int)), SLOT(SetMode(int)));
  CreateModeAction(SmallSongDetails, tr("Small album cover"), mode_group,
                   mode_mapper);
  CreateModeAction(LargeSongDetails, tr("Large album cover"), mode_group,
                   mode_mapper);
  CreateModeAction(LargeSongDetailsBelow,
                   tr("Large album cover (details below)"), mode_group,
                   mode_mapper);

  menu_->addActions(mode_group->actions());

  fit_cover_width_action_ = menu_->addAction(tr("Fit cover to width"));

  fit_cover_width_action_->setCheckable(true);
  fit_cover_width_action_->setEnabled((mode_ != SmallSongDetails) ? true
                                                                  : false);
  connect(fit_cover_width_action_, SIGNAL(toggled(bool)),
          SLOT(FitCoverWidth(bool)));
  fit_cover_width_action_->setChecked(fit_width_);
  menu_->addSeparator();

  QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();

  // Here we add the search automatically action, too!
  actions.append(album_cover_choice_controller_->search_cover_auto_action());

  connect(album_cover_choice_controller_->cover_from_file_action(),
          SIGNAL(triggered()), this, SLOT(LoadCoverFromFile()));
  connect(album_cover_choice_controller_->cover_to_file_action(),
          SIGNAL(triggered()), this, SLOT(SaveCoverToFile()));
  connect(album_cover_choice_controller_->cover_from_url_action(),
          SIGNAL(triggered()), this, SLOT(LoadCoverFromURL()));
  connect(album_cover_choice_controller_->search_for_cover_action(),
          SIGNAL(triggered()), this, SLOT(SearchForCover()));
  connect(album_cover_choice_controller_->unset_cover_action(),
          SIGNAL(triggered()), this, SLOT(UnsetCover()));
  connect(album_cover_choice_controller_->show_cover_action(),
          SIGNAL(triggered()), this, SLOT(ShowCover()));
  connect(album_cover_choice_controller_->search_cover_auto_action(),
          SIGNAL(triggered()), this, SLOT(SearchCoverAutomatically()));

  menu_->addActions(actions);
  menu_->addSeparator();
  above_statusbar_action_ = menu_->addAction(tr("Show above status bar"));

  above_statusbar_action_->setCheckable(true);
  connect(above_statusbar_action_, SIGNAL(toggled(bool)),
          SLOT(ShowAboveStatusBar(bool)));
  above_statusbar_action_->setChecked(
      s.value("above_status_bar", false).toBool());

  bask_in_his_glory_action_ =
      menu_->addAction(tr("ALL GLORY TO THE HYPNOTOAD"));
  bask_in_his_glory_action_->setVisible(false);
  connect(bask_in_his_glory_action_, SIGNAL(triggered()), SLOT(Bask()));

  // Animations
  connect(show_hide_animation_, SIGNAL(frameChanged(int)),
          SLOT(SetHeight(int)));
  setMaximumHeight(0);

  connect(fade_animation_, SIGNAL(valueChanged(qreal)),
          SLOT(FadePreviousTrack(qreal)));
  fade_animation_->setDirection(QTimeLine::Backward);  // 1.0 -> 0.0

  // add placeholder text to get the correct height
  if (mode_ == LargeSongDetailsBelow) {
    details_->setDefaultStyleSheet(
        "p {"
        "  font-size: small;"
        "  color: white;"
        "}");
    details_->setHtml(QString("<p align=center><i></i><br/><br/></p>"));
  }

  UpdateHeight();

  connect(album_cover_choice_controller_, SIGNAL(AutomaticCoverSearchDone()),
          this, SLOT(AutomaticCoverSearchDone()));
}
Ejemplo n.º 15
0
void NowPlayingWidget::set_ideal_height(int height) {
  small_ideal_height_ = height;
  UpdateHeight();
}
Ejemplo n.º 16
0
/*---------------------------------------------------------------------------*/
void HTMLBodyDisplay::Format(void)
{
	DisplayManager *manager = GetManager();

	if (manager)
	{
		PresetWebRect rect(&manager->mViewRect);
		DISPLAY_INT viewportWidth  = rect.Width();
		DISPLAY_INT viewportHeight = rect.Height();
		WEBC_DEBUG_LOG_TIME_HANDLE(TimeInside)

		WEBC_DEBUG_LOG_TIME_ENTER(TimeInside,"HTMLBodyDisplay::Format", " ")
		rect.MoveTo(0, 0);


		SetParentWidth(viewportWidth, viewportWidth);
		SetParentHeight(viewportHeight);

#if (WEBC_SUPPORT_FRAMES)
		HTMLBody* bodyElement = (HTMLBody*) mpHtmlElement;
		HTMLFrameSet* framesetElement = (bodyElement)? bodyElement->GetFrameSet() : 0;

		mpFrameSet = (HTMLFrameSetDisplay*) ((framesetElement)? framesetElement->GetDisplayElement() : 0);

		if (mpFrameSet)
		{
			// remove all old children
			while (mpFirstChild)
			{
				Remove(mpFirstChild);
			}

			// add the frameset
			mpFrameSet->SetParentWidth(viewportWidth, viewportWidth);
			mpFrameSet->SetParentHeight(viewportHeight);
			mpFrameSet->SetXYPosition(0,0);
			mpFrameSet->SetParentDisplay(this, 0);
			miContentHeight = viewportHeight;
			miMaxWidth = viewportWidth;
			miMinWidth = viewportWidth;

			mFlowFlags &= ~(FD_FLAG_POS_CHILD_STYLE_MODIFIED|
			                FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                FD_FLAG_LOCAL_STYLE_MODIFIED|
							FD_FLAG_PARENT_STYLE_MODIFIED);
		}
		else
#endif // WEBC_SUPPORT_FRAMES
		{
			DISPLAY_INT marginLeftValue   = GetLeftMargin();
			DISPLAY_INT marginRightValue  = GetRightMargin();
			DISPLAY_INT marginTopValue    = GetTopMargin();

			DISPLAY_INT paddingLeftValue  = mBorder.GetPaddingWidth(CSS_LEFT);
			DISPLAY_INT paddingRightValue = mBorder.GetPaddingWidth(CSS_RIGHT);
			DISPLAY_INT paddingTopValue   = mBorder.GetPaddingWidth(CSS_TOP);

			// check to see if we just need to update positioned child formatting
			if (mFlowFlags & (FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                  FD_FLAG_LOCAL_STYLE_MODIFIED|
			                  FD_FLAG_PARENT_STYLE_MODIFIED))
			{
				DISPLAY_INT iContentWidth;
				MarginContext margin (marginLeftValue + paddingLeftValue,
				                      viewportWidth - (marginRightValue + paddingRightValue) - 1, this);

				// Format the flow content
				miContentHeight = FormatFlowContent (&margin,
				                                     marginLeftValue + paddingLeftValue,
				                                     marginTopValue + paddingTopValue, &iContentWidth);

				// update miContentHeight to include anything in the margins
				DISPLAY_INT topPad = marginTopValue + paddingTopValue;
				DISPLAY_INT clearedHeight = margin.ClearAll(topPad + miContentHeight) - topPad;
				if (clearedHeight > miContentHeight)
				{
					miContentHeight = clearedHeight;
				}

				// set this element's height
				UpdateHeight(0, 0);
			}

			// Format positioned elements
			FormatContextFactory childContextFactory;

			if (mPositionedChildFormatContext)
			{
				WebRect oldRect;

				mPositionedChildFormatContext->getContainingBlock(&oldRect);

				if (!oldRect.Equals(&rect) ||
				    miContentHeight != mPositionedChildFormatContext->getAutoIndentTop())
				{
					mPositionedChildFormatContext->release();
					mPositionedChildFormatContext = 0;
				}
			}

			WEBC_BOOL reformatPositionedChildren = (mFlowFlags & FD_FLAG_POS_CHILD_STYLE_MODIFIED) != 0;

			if (!mPositionedChildFormatContext)
			{
				mPositionedChildFormatContext = childContextFactory.newPositioned (
						&rect,            // containingBlock,
						WEBC_FALSE,       // parentHeightIsAuto,
						TU_DIR_LTR,       // textDirection,
						0,                // parentBorderLeft,
						0,                // parentBorderTop,
						0,                // parentBorderRight,
						0,                // parentBorderBottom,
						marginLeftValue,  // autoIndentLeft,
						miContentHeight,  // autoIndentTop,
						marginRightValue  // autoIndentRight
					);

				reformatPositionedChildren = (mPositionedChildFormatContext != WEBC_NULL);
			}

			if (reformatPositionedChildren)
			{
				HTMLFlowDisplayFormatContext formatCtx;

				BeginFormatPositionedChildren(&formatCtx);

				FormatPositionedChildren (
						mPositionedChildFormatContext,
						mPositionedChildFormatContext,
						&childContextFactory
					);

				EndFormatPositionedChildren(&formatCtx);
			}

			mFlowFlags &= ~(FD_FLAG_POS_CHILD_STYLE_MODIFIED|
			                FD_FLAG_FLOW_CHILD_STYLE_MODIFIED|
			                FD_FLAG_LOCAL_STYLE_MODIFIED|
							FD_FLAG_PARENT_STYLE_MODIFIED);
		}

		WEBC_ASSERT(!NeedsFormat());

		// handles the case where HTMLDocument::ScrollToAnchor is called before the
		//  document's content has been formatted.
		if (mpHtmlElement)
		{
			HTMLDocument* document = mpHtmlElement->GetDocument();
			if (document)
			{
				document->ScrollToDefaultAnchor();
				document->SetQueuedFocus();
			}
		}
		WEBC_DEBUG_LOG_TIME_EXIT(TimeInside,"HTMLBodyDisplay::Format", " ")
	}
}