Ejemplo n.º 1
0
/******************************************************************************
void IFXKeyTrack::Filter(F32 deltatime)

remove track entries too close in time

******************************************************************************/
void IFXKeyTrack::Filter(F32 deltatime)
{
	//I32 original=GetNumberElements();

	IFXListContext basecontext,nextcontext;
	IFXKeyFrame *base,*next;

	ToHead(basecontext);
	while((base=GetCurrent(basecontext)) != NULL)
	{
		nextcontext=basecontext;
		PostIncrement(nextcontext);

		if(IsAtTail(nextcontext))
			break;

		next=GetCurrent(nextcontext);

		if( (next->Time()-base->Time()) < deltatime )
		{
			Delete(next);
		}
		else
		{
			PostIncrement(basecontext);
		}
	}
}
Ejemplo n.º 2
0
void
ParamListGL::Special(int key, int /*x*/, int /*y*/)
{
    switch(key) {
    case GLUT_KEY_DOWN:
        Increment();
        break;
    case GLUT_KEY_UP:
        Decrement();
        break;
    case GLUT_KEY_RIGHT:
        GetCurrent()->Increment();
        break;
    case GLUT_KEY_LEFT:
        GetCurrent()->Decrement();
        break;
    case GLUT_KEY_HOME:
        GetCurrent()->Reset();
        break;
    case GLUT_KEY_END:
        GetCurrent()->SetPercentage(1.0);
        break;
    }
    glutPostRedisplay();
}
Ejemplo n.º 3
0
void IFXKeyTrack::Compress(F32 deltaposition,F32 deltarotation,F32 deltascale)
{
	//I32 original=GetNumberElements();

	IFXListContext basecontext,midcontext,leapcontext;
	IFXKeyFrame *base,*mid,*leap;

	ToHead(basecontext);
	while((base=GetCurrent(basecontext)) != NULL)
	{
		midcontext=basecontext;
		PostIncrement(midcontext);
		leapcontext=midcontext;
		PostIncrement(leapcontext);

		if(IsAtTail(leapcontext))
			break;

		mid=GetCurrent(midcontext);
		leap=GetCurrent(leapcontext);

		F32 fraction=(mid->Time()-base->Time())/(leap->Time()-base->Time());

		IFXVector3 intervector;
		intervector.Interpolate(fraction,base->LocationConst(),
			leap->LocationConst());

		IFXQuaternion interquat;
		interquat.Interpolate(fraction,base->RotationConst(),
			leap->RotationConst());
		IFXVector3 interscale;
		interscale.Interpolate(fraction,base->ScaleConst(),
			leap->ScaleConst());



		if(mid->LocationConst().IsApproximately(intervector,deltaposition) &&
			mid->RotationConst().IsApproximately(interquat,deltarotation) &&
			mid->ScaleConst().IsApproximately(interscale,deltascale) )
		{
			//* watch out for spans close to 180 degrees
			F32 radians;
			IFXVector3 axis;
			IFXQuaternion inverse,span;
			inverse.Invert(base->RotationConst());
			span.Multiply(inverse,leap->RotationConst());
			span.ComputeAngleAxis(radians,axis);

			if(radians<170.0*IFXTO_RAD)
				Delete(mid);
			else
				PostIncrement(basecontext);
		}
		else
		{
			PostIncrement(basecontext);
		}
	}
}
Ejemplo n.º 4
0
eOSState cMenuBrowseFiles::Info(void)
{
  if (GetCurrent() && !GetCurrent()->IsDir()) {
    cString filename = cString::sprintf("%s/%s", *m_CurrentDir, GetCurrent()->Name());
    return AddSubMenu(new cMetainfoMenu(filename));
  }
  return osContinue;
}
Ejemplo n.º 5
0
void cMenuBrowseFiles::SetHelpButtons(void)
{
  bool isDir  = !GetCurrent() || GetCurrent()->IsDir();
  bool isFile = !isDir;
  bool bDel   = isFile && xc.media_enable_delete;

  if (isDir && !strcmp("..", GetCurrent()->Name())) {
    help[0] = help[1] = help[2] = help[3] = NULL;
  } else if (m_Mode == ShowMusic) {
    help[0] = isDir  ? trVDR("Button$Play")   : NULL;
    help[1] =          tr   ("Button$Queue");
    help[2] = bDel   ? trVDR("Button$Delete") : NULL;
    help[3] = isFile ? trVDR("Button$Info")   : NULL;
  } else if (m_Mode == ShowImages) {
    help[0] = isDir  ? trVDR("Button$Play")   : NULL;
    help[1] =                                   NULL;
    help[2] = bDel   ? trVDR("Button$Delete") : NULL;
    help[3] = isFile ? trVDR("Button$Info")   : NULL;
  } else {
    bool isDvd     = GetCurrent() && (GetCurrent()->IsDvd() || GetCurrent()->IsBluRay());
    bool hasResume = GetCurrent() && GetCurrent()->HasResume();

    help[0] = isDir && isDvd  ? trVDR("Button$Open")   : NULL;
    help[1] = hasResume       ? trVDR("Button$Rewind") : NULL;
    help[2] = bDel            ? trVDR("Button$Delete") : NULL;
    help[3] = isFile          ? trVDR("Button$Info")   : NULL;
  }

  SetHelp(help[0], help[1], help[2], help[3]);
}
Ejemplo n.º 6
0
bool LEVELSELECT::addDirectoryListEntry(char* directoryName)
{
    if (strlen(directoryName)+1 > MAX_PATH)
    {
        error("LEVELSELECT::addLevelListEntry", "Parameter directoryName too long. Max length is MAX_PATH (%d).", MAX_PATH);
        return false;
    }

    LEVELDIRECTORY *lastDirectory = GetCurrent()->GetDirectory();
    LEVELDIRECTORY *newDirectory;

    //get last directory
    if (lastDirectory != NULL)
    {
        while (lastDirectory->next != NULL)
        {
            lastDirectory = lastDirectory->next;
        }
    }

    newDirectory = (LEVELDIRECTORY*)malloc(sizeof(LEVELDIRECTORY));
    newDirectory->prev = lastDirectory;
    newDirectory->next = NULL;
    if (lastDirectory != NULL)
    {
        lastDirectory->next = newDirectory;
        newDirectory->index = lastDirectory->index+1;
    }
    else
    {
        newDirectory->index = 0;
    }

    if (strcmp(directoryName, "..")==0)
    {
        strcpy(newDirectory->name, "");
    }
    else
    {
        strcpy(newDirectory->name, directoryName);
    }

    GetCurrent()->GetDirectoryPath(newDirectory->path, newDirectory->name);

    if (GetCurrent()->GetDirectory() == NULL)
        GetCurrent()->currentDirectory = newDirectory;
    return true;
}
Ejemplo n.º 7
0
void subPageSpells::Del()
{
	School *school = currentSchool;

	if ( school->spells.size() == 1 )
	{
		currentSpell->Clear();
		GetCurrent();
		return;
	}
	spellItr = school->spells.erase(spellItr);
	delete currentSpell;
	currentSpell = *spellItr;

	GetCurrent();
}
Ejemplo n.º 8
0
void subPageSpells::Next(unsigned int n)
{
	SetCurrent();

	std::vector<Spell*> *pSpells = &currentSchool->spells;

	if ( n > (pSpells->size()-spellNumber) && n!=1 )
	{
		spellItr = pSpells->end();
		spellItr--;
		currentSpell = *spellItr;
		spellNumber = pSpells->size();
		return;
	}

	for ( ; n > 0; n-- )
	{
		spellItr++;
		spellNumber++;
		if ( spellItr == pSpells->end() )
		{
			spellItr = pSpells->begin();
			spellNumber = 1;
		}
		currentSpell = *spellItr;
	}

	GetCurrent();
}
Ejemplo n.º 9
0
void subPageSpells::Prev(unsigned int n)
{
	SetCurrent();

	std::vector<Spell*> *pSpells = &currentSchool->spells;

	if ( n > spellNumber )
	{
		spellItr = pSpells->begin();
		currentSpell = *spellItr;
		spellNumber = 1;
		return;
	}

	for ( ; n > 0; n-- )
	{
		spellNumber--;
		if ( spellItr == pSpells->begin() )
		{
			spellItr = pSpells->end();
			spellNumber = currentSchool->spells.size();
		}
		spellItr--;
		currentSpell = *spellItr;
	}

	GetCurrent();
}
Ejemplo n.º 10
0
bool
TaskQueue::IsCurrentThreadIn()
{
  bool in = NS_GetCurrentThread() == mRunningThread;
  MOZ_ASSERT(in == (GetCurrent() == this));
  return in;
}
Ejemplo n.º 11
0
nsresult
TaskQueue::DispatchLocked(already_AddRefed<nsIRunnable> aRunnable,
                               DispatchMode aMode, DispatchFailureHandling aFailureHandling,
                               DispatchReason aReason)
{
  nsCOMPtr<nsIRunnable> r = aRunnable;
  AbstractThread* currentThread;
  if (aReason != TailDispatch && (currentThread = GetCurrent()) && RequiresTailDispatch(currentThread)) {
    currentThread->TailDispatcher().AddTask(this, r.forget(), aFailureHandling);
    return NS_OK;
  }

  mQueueMonitor.AssertCurrentThreadOwns();
  if (mIsFlushing && aMode == AbortIfFlushing) {
    return NS_ERROR_ABORT;
  }
  if (mIsShutdown) {
    return NS_ERROR_FAILURE;
  }
  mTasks.push(r.forget());
  if (mIsRunning) {
    return NS_OK;
  }
  nsRefPtr<nsIRunnable> runner(new Runner(this));
  nsresult rv = mPool->Dispatch(runner.forget(), NS_DISPATCH_NORMAL);
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to dispatch runnable to run TaskQueue");
    return rv;
  }
  mIsRunning = true;

  return NS_OK;
}
Ejemplo n.º 12
0
Size DockCont::GetMinSize() const
{
	if (ignoreminsize) return Size(0, 0);
	Size sz = tabbar.GetCount() ? GetCurrent().GetMinSize() : Size(0, 0);
	sz = AddFrameSize(sz);
	return sz;
}
Ejemplo n.º 13
0
int	CoroutineMgr::Yield(int coid )
{
    Coroutine * cur = GetCurrent();
    if(!cur)
    {
		LOG_FATAL("current co is null !");
        return -1;
    }
	Coroutine * co = Find(coid);
	if(0 == coid)
	{
		//switch to prev
		co = cur->from;
	}
    if(!co)
    {
		LOG_FATAL("current from co is null !");
        return -1;
    }
	if(cur->bState == Coroutine::COROUTINE_STATUS_RUNNING)
	{
		cur->bState = Coroutine::COROUTINE_STATUS_SUSPEND;
	}
	co->bState = Coroutine::COROUTINE_STATUS_RUNNING;
    SetCurrent(co);
	LOG_INFO("co = %d is yield schedule next = %d for = %d",cur->iID,co->iID,coid);
    swapcontext(&(cur->ctx),&(co->ctx));
    return retval;
}
Ejemplo n.º 14
0
void VirtualHost::UpdateSerializationSizeLimit() {
  const VirtualHost *vh = GetCurrent();
  assert(vh);
  if (vh->m_runtimeOption.serializationSizeLimit != StringData::MaxSize) {
    VariableSerializer::serializationSizeLimit =
      vh->m_runtimeOption.serializationSizeLimit;
  }
}
Ejemplo n.º 15
0
const vector<string> &VirtualHost::GetAllowedDirectories() {
  const VirtualHost *vh = GetCurrent();
  ASSERT(vh);
  if (!vh->m_runtimeOption.allowedDirectories.empty()) {
    return vh->m_runtimeOption.allowedDirectories;
  }
  return RuntimeOption::AllowedDirectories;
}
Ejemplo n.º 16
0
int64 VirtualHost::GetUploadMaxFileSize() {
  const VirtualHost *vh = GetCurrent();
  ASSERT(vh);
  if (vh->m_runtimeOption.uploadMaxFileSize != -1) {
    return vh->m_runtimeOption.uploadMaxFileSize;
  }
  return RuntimeOption::UploadMaxFileSize;
}
Ejemplo n.º 17
0
void Shader::Unbind()
{
	if(GetCurrent() != nullptr)
	{
		glUseProgram(0);
		SetCurrent(nullptr);
	}
}
Ejemplo n.º 18
0
int64 VirtualHost::GetMaxPostSize() {
  const VirtualHost *vh = GetCurrent();
  ASSERT(vh);
  if (vh->m_runtimeOption.maxPostSize != -1) {
    return vh->m_runtimeOption.maxPostSize;
  }
  return RuntimeOption::MaxPostSize;
}
Ejemplo n.º 19
0
void Shader::Bind()
{
	if(GetCurrent() != this)
	{
		glUseProgram(id);
		SetCurrent(this);
	}
}
Ejemplo n.º 20
0
void FProgress::DrawMeter(CDC& dc, FRect& rcPaint)
{

	//fill the unavailable 
	int nLines = rcPaint.Width() / (gLineDistance + gPenWidth) + 1; 

	int nAvailLines = (int)GetAvail((double)nLines) ;
	int nCurrLines  = (int)GetCurrent((double)nLines);
	
	assert(nAvailLines >= nCurrLines);

	int x = rcPaint.left; 
	int y = rcPaint.top; 

	dc.MoveTo(x, y); 

	int lh = rcPaint.Height() - 0; 
	int mh = lh; 

	int nPenIndex = 2; 
	dc.SelectPen(m_Pens[nPenIndex]); 
	dword dwStyle = GetWindowLong(GWL_STYLE); 

	for (int k = 0; k < nLines; k++)
	{
		if (k == nCurrLines)
		{
			if (k < nAvailLines)
				dc.SelectPen(m_Pens[1]);	
			else
				dc.SelectPen(m_Pens[0]);
			if (dwStyle & PROG_LARGER_CURRENT)
			{
				lh = lh / 2; 
				y += lh / 2; 
				dc.MoveTo(x, y);  
			}
		}
		else if (k == nAvailLines)
		{
			dc.SelectPen(m_Pens[0]); 
		}

		if (dwStyle & PROG_GROWING)
		{
			double dblNow = (double)k / (double)nLines; 
			lh = (int)(mh * dblNow); 
			y = mh - lh; 
			dc.MoveTo(x, y); 
		}

		dc.LineTo(x, y + lh);
		x += gLineDistance; 
		x += gPenWidth;
		dc.MoveTo(x, y); 
	}
}
Ejemplo n.º 21
0
	void VListWin::SetNoCurrent()
	{
		if ( current == -1 ) { return; }

		current = -1;
		Command( CMD_ITEM_CHANGED, GetCurrent(), this, 0 );

		if ( IsVisible() ) { Invalidate(); }
	}
Ejemplo n.º 22
0
BOOL CPlayer::Rew(long lSkip)
{
	CAutoLock lock(&m_csecInterface);
	if (m_fOpen == OPEN_NONE)
		return FALSE;

	LONG lTime = GetCurrent();
	lTime -= lSkip;
	return Seek(lTime);
}
Ejemplo n.º 23
0
	unsigned int Buffer::Read( void* pData, int iSize )
	{
		if ( m_iPos + iSize > m_iSize ) { return 0; }

		if ( iSize == 0 ) { return 0; }

		memcpy( pData, GetCurrent(), iSize );
		m_iPos += iSize;
		return iSize;
	}
Ejemplo n.º 24
0
	void Buffer::Write( const void* pData, unsigned int iSize )
	{
		if ( iSize == 0 ) { return; }

		if ( !EnsureCapacity( m_iPos + iSize ) ) { return; }

		memcpy( GetCurrent(), pData, iSize );
		m_iPos += iSize;
		m_iWritten = Bootil::Max( m_iWritten, m_iPos );
	}
Ejemplo n.º 25
0
Size DockCont::GetStdSize() const
{
	Size sz = usersize;
	if (IsNull(sz.cx) || IsNull(sz.cy)) {
		Size std = GetCurrent().GetStdSize();
		if (IsNull(sz.cx)) sz.cx = std.cx;
		if (IsNull(sz.cy)) sz.cy = std.cy;
	}
	return AddFrameSize(sz);
}
 virtual bool IsCurrentThreadIn() override
 {
   // Compare NSPR threads so that this works after shutdown when
   // NS_GetCurrentThread starts returning null.
   PRThread* thread = nullptr;
   mTarget->GetPRThread(&thread);
   bool in = PR_GetCurrentThread() == thread;
   MOZ_ASSERT(in == (GetCurrent() == this));
   return in;
 }
Ejemplo n.º 27
0
// GetCurrent
Entry *
NameIndexEntryIterator::GetCurrent(uint8 *buffer, size_t *keyLength)
{
	Entry *entry = GetCurrent();
	if (entry) {
		strncpy((char*)buffer, entry->GetName(), kMaxIndexKeyLength);
		*keyLength = strlen(entry->GetName());
	}
	return entry;
}
Ejemplo n.º 28
0
void RubberEllipse::Draw() {
    IntCoord cx, cy, rx, ry, xr, yr;

    if (!drawn) {
	GetCurrent(cx, cy, rx, ry);
	CurrentRadii(xr, yr);
	output->Ellipse(canvas, cx+offx, cy+offy, xr, yr);
	drawn = true;
    }
}
Ejemplo n.º 29
0
void PictSelection::WriteData (ostream& to) {
    to << "Begin " << startdata << " Pict\n";
    WritePictGS(to);
    to << "\n";

    for (First(); !AtEnd(); Next()) {
	Selection* s = GetCurrent();
	s->WriteData(to);
    }

    to << "End " << startdata << " eop\n\n";
}
Ejemplo n.º 30
0
	bool VListWin::EventKey( cevent_key* pEvent )
	{
		if ( pEvent->Type() == EV_KEYDOWN )
		{
			switch ( pEvent->Key() )
			{
				case VK_DOWN:
					MoveCurrent( current + 1 );
					break;

				case VK_UP:
					MoveCurrent( current - 1 );
					break;

				case VK_END:
					MoveCurrent( count - 1 );
					break;

				case VK_HOME:
					MoveCurrent( 0 );
					break;

				case VK_PRIOR:
					MoveCurrent( current - ( pageSize <= 1 ? pageSize : pageSize - 1 ) );
					break;

				case VK_NEXT:
					MoveCurrent( current + ( pageSize <= 1 ? pageSize : pageSize - 1 ) );
					break;

				case VK_LEFT:
					MoveXOffset( xOffset - 10 );
					break;

				case VK_RIGHT:
					MoveXOffset( xOffset + 10 );
					break;

				case VK_NUMPAD_RETURN:
				case VK_RETURN:
					Command( CMD_ITEM_CLICK, GetCurrent(), this, 0 );
					break;

				default:
					return false;
			}

			Invalidate();
			return true;
		}

		return false;
	}