示例#1
0
	void valueChanged (CControl* pControl)
	{
		if (pControl->getValue ())
		{
			switch (pControl->getTag ())
			{
				case 0:
				{
					CView* view = desc->createView ("ModalView", this);
					if (view)
					{
						CFrame* frame = pControl->getFrame ();
						CPoint center = frame->getViewSize ().getCenter ();
						CRect viewSize = view->getViewSize ();
						viewSize.offset (center.x - viewSize.getWidth () / 2, center.y - viewSize.getHeight () / 2);
						view->setViewSize (viewSize);
						view->setMouseableArea (viewSize);
						frame->setModalView (view);
						view->setAlphaValue (0.f);
						view->addAnimation ("AlphaAnimation", new Animation::AlphaValueAnimation (1.f), new Animation::PowerTimingFunction (240, 2));
						pControl->setValue (0);
						view->forget ();
					}
					break;
				}
				case 1:
				{
					CView* modalView = pControl->getFrame ()->getModalView ();
					modalView->addAnimation ("AlphaAnimation", new RemoveModalViewAnimation (0.f), new Animation::PowerTimingFunction (240, 0.5));
					pControl->setMouseEnabled (false);
					break;
				}
			}
		}
	}
示例#2
0
void CFrameJSegmentor::DetectSemgment(const CFrame & frame)
{
        if( m_RegionMap )
            m_RegionMap->Release();
        m_SegmentNum = m_SegmentDetector->Segment(*frame.GetImage(), &m_RegionMap);
        m_FrameId = frame.Id();
}
示例#3
0
//////////////////////////////////////////////////////////////
// GetCollisionRect
//	- return the entity's bounding rectangle
/*virtual*/ RECT CEntity::GetCollisionRect( void ) const
{
	CFrame* currFrame = m_pAM->GetCurrentFrame(m_pAnimInfo);
	RECT rCollision = currFrame->GetCollisionRect().GetRECT();

	if (m_bFlipped == true)
	{
		// Get the width of the collision rect before flipping
		int width = (rCollision.right - rCollision.left);

		// Get the offset from the anchor point to the top left of the collision rect
		tVector2D offset = { (float)(rCollision.left), (float)(rCollision.top ) };

		// Negate the anchor point x value
		rCollision.left  = (LONG)(-offset.fX);
		rCollision.right = (LONG)(-offset.fX);

		// Subtract the width of the collision rect
		rCollision.left  -= width;
	}

	// Add the position of the character in the world to the collision rect
	rCollision.left		+= (int)(m_fPosX - m_pGC->GetPosX());
	rCollision.right	+= (int)(m_fPosX - m_pGC->GetPosX());
	rCollision.top		+= (int)(m_fPosY - m_pGC->GetPosY());
	rCollision.bottom	+= (int)(m_fPosY - m_pGC->GetPosY());

	return rCollision;
}
示例#4
0
void Surfel::transformToWorldSpace(const CFrame& xform) {
    position = xform.pointToWorldSpace(position);
    geometricNormal = xform.vectorToWorldSpace(geometricNormal);
    shadingNormal   = xform.vectorToWorldSpace(shadingNormal);
    shadingTangent1 = xform.vectorToWorldSpace(shadingTangent1);
    shadingTangent2 = xform.vectorToWorldSpace(shadingTangent2);
}
示例#5
0
/*! Application initialization function 
 *
 * This function is called once when the
 * application is started. It creates the main frame for
 * the program and displays it. 
 * \returns true
 */
bool CApp::OnInit()
{
    wxInitAllImageHandlers();
    CFrame *frame = new CFrame();
    frame->Show(true);
    SetTopWindow(frame);
    return true;
}
示例#6
0
//-----------------------------------------------------------------------------------
void TutorialEditor::close ()
{
    //-- on close we need to delete the frame object.
    //-- once again we make sure that the member frame variable is set to zero before we delete it
    //-- so that calls to setParameter won't crash.
    CFrame* oldFrame = frame;
    frame = 0;
    oldFrame->forget ();
}
void CPlayerLoop::ShowMapInText(const CFrame &frame)
{
    const CMap &map = frame.GetMap();
    // печатаем карту
    system("clear");
    for (int rowNumber = 0; rowNumber < map.GetMapSizeY(); ++rowNumber)
    {
        for (int colNumber = 0; colNumber < map.GetMapSizeX(); ++colNumber)
        {
            bool antIsHere = false;
            for (size_t antNumber = 0; antNumber < map.GetNumberOfAnts(); ++antNumber)
            {
                const CAnt &a = map.GetAnt(antNumber);
                if((colNumber == a.GetAntPosX()) && (rowNumber == a.GetAntPosY()) && !a.AntIsBanned() && !a.AntIsWinner())
                {
                    std::cout << a.GetAntName()[0];
                    antIsHere = true;
                    break;
                }
                else
                {
                    continue;
                }
            }
            if (!antIsHere)
            {
                std::cout << (char)map.Cell(colNumber, rowNumber);
            }
        }
        std::cout << std::endl;
    }

    for (size_t antNumber = 0; antNumber < map.GetNumberOfAnts(); ++antNumber)
    {
        const CAnt &a = map.GetAnt(antNumber);
        if (!a.AntIsBanned() && !a.AntIsWinner())
        {
            std::cout  << "Муравей " << a.GetAntName()
                       << " по профессии " << AntTypeToString(a.GetAntType()) << " "
                       << AntStatusToString(a.GetAntStatus()) << "!" << std::endl
                       << "Находится в клетке X = " << a.GetAntPosX() << " Y = " << a.GetAntPosY()
                       << std::endl << std::flush;
        }
        else
        {
            std::cout  << "Муравей " << a.GetAntName()
                       << " по профессии " << AntTypeToString(a.GetAntType()) << " "
                       << AntStatusToString(a.GetAntStatus()) << "!" << std::endl;
        }

    }

    std::cout  << "Доска объявлений: " << std::endl;
    frame.GetBoard().PrintBoard();
    std::cout << std::flush;
}
示例#8
0
void CGmObjAnim3::CData::Update()
{
	unsigned int i = m_oArrFrame.GetSize();
	while( i )
	{
		--i;
		CFrame * poFrame = m_oArrFrame[i];
		poFrame->Update();
	}
}
示例#9
0
void CGmObjAnim3::CSharedData::ClearOGL()
{
	unsigned int i = m_oArrFrame.GetSize();
	while( i )
	{
		--i;
		CFrame * poFrame = m_oArrFrame[i];
		poFrame->ClearOGL();
	}
}
示例#10
0
HRESULT CVideoProcessor::BufferCB(double SampleTime, BYTE *pBuffer, long BufferLen)
{
	if (MEDIATYPE_Video == m_mt.majortype)
	{
		if (MEDIASUBTYPE_YUY2 == m_mt.subtype)
		{
			//[ Y0 U0 Y1 V0] [ Y2 U1 Y3 V1]  
			VIDEOINFOHEADER* pVIH=(VIDEOINFOHEADER*)m_mt.pbFormat;
			CFrame* pF = new CFrame(
				pVIH->bmiHeader.biWidth,
				pVIH->bmiHeader.biHeight);
			struct YUY2
			{
				unsigned char y0, u0, y1, v0;
			};
			//Remember: Macropixel Y0 U0 Y1 V0 = 2 image pixel
			for (int j = 0; j < pVIH->bmiHeader.biHeight; j++)
			{
				YUY2* pRow = (YUY2*)(pBuffer + j*pVIH->bmiHeader.biWidth * 2);
				for (int i = 0; i < pVIH->bmiHeader.biWidth / 2; i++)
				{
					CFrame::PIXEL pixel_1, pixel_2;
					//YUY2 to RGB
					YUY2* MacroPixel = &pRow[i];
					int C = (int)MacroPixel->y0 - 15;
					int D = (int)MacroPixel->u0 - 128;
					int E = (int)MacroPixel->v0 - 128;

					pixel_1.r = max(0,min(255,(298 * C + 409 * E + 128) / 256));
					pixel_1.g = max(0, min(255,(298 * C - 100 * D - 208 * E + 128) / 256));
					pixel_1.b = max(0, min(255, (298 * C + 516 * D + 128) / 256));

					C = (int)MacroPixel->y1 -16;
					pixel_2.r = max(0, min(255, (298 * C + 409 * E + 128) / 256));
					pixel_2.g = max(0, min(255, (298 * C - 100 * D - 208 * E + 128) / 256));
					pixel_2.b = max(0, min(255, (298 * C + 516 * D + 128) / 256));

					pF->GetPixel(i * 2, j) = pixel_1;
					pF->GetPixel((i * 2) + 1, j) = pixel_2;
					/*LummaGray.r = LummaGray.g = LummaGray.b = pRow->y0;
					pF->GetPixel(i * 2, j) = LummaGray;
					LummaGray.r = LummaGray.g = LummaGray.b = pRow->y1;
					pF->GetPixel((i * 2)+1, j) = LummaGray;*/
					//pRow++;
				}
			}
			Push(pF);
		}
	}
	return S_OK;
}
void PhysicsFrameSplineEditor::addControlPoint() {
    if (m_spline.control.size() == 0) {
        m_spline.append(CFrame());
    } else if (m_spline.control.size() == 1) {
        // Adding the 2nd point
        CFrame f = m_spline.control.last();
        f.translation += f.lookVector();
        m_spline.append(f);

        resizeControlPointDropDown(m_spline.control.size());
        // Select the new point
        setSelectedControlPointIndex(m_selectedControlPointIndex + 1);
    } else {
        // Adding between two points
        float t0 = m_spline.time[m_selectedControlPointIndex];
        float newT = t0;
        float evalT = 0;
        if (m_selectedControlPointIndex < m_spline.control.size() - 1) {
            // Normal interval
            newT = m_spline.time[m_selectedControlPointIndex + 1];
            evalT = (t0 + newT) / 2;
        } else if (m_spline.extrapolationMode == SplineExtrapolationMode::CYCLIC) {
            // After the end on a cyclic spline
            newT = m_spline.getFinalInterval() + t0;
            evalT = (t0 + newT) / 2;
        } else {
            // After the end on a non-cyclic spline of length at least
            // 2; assume that we want to step the distance of the previous
            // interval
            newT = evalT = 2.0f * t0 - m_spline.time[m_selectedControlPointIndex - 1];
        }

        const PhysicsFrame f = m_spline.evaluate(evalT);
        m_spline.control.insert(m_selectedControlPointIndex + 1, f);
        m_spline.time.insert(m_selectedControlPointIndex + 1, newT);

        // Select the new point
        resizeControlPointDropDown(m_spline.control.size());
        setSelectedControlPointIndex(m_selectedControlPointIndex + 1);

        // Fix the rest of the times to be offset by the inserted duration
        float shift = newT - t0;
        for (int i = m_selectedControlPointIndex + 1; i < m_spline.time.size(); ++i) {
            m_spline.time[i] += shift;
        }
        
    }

}
	HRESULT CSabOnlineSubshotDetectorImp::DetectNewSubshot(CFrame & frame)
	{
            m_FrameId = frame.Id();

		    if ( m_SubshotIdx < (m_SubshotList.Size()-1) && !m_IsInSubshot )
		    {
			     m_SubshotIdx++;

			     m_BgnFrameId = m_SubshotList[m_SubshotIdx].BeginFrameId();
			     m_EndFrameId = m_SubshotList[m_SubshotIdx].EndFrameId();
		   }

		   if ( m_FrameId <= m_BgnFrameId )
		   {
                // We have get the next sub shot, but frame is not arrived the bgn frame of the sub shot
		        // Example: sub shot(bgnFrameId, endFrameId): 1 (1, 10)  2(15, 20)
		        // If we arrive frame 11, we have entered the subshot 2, but we need to set the flag
			    m_IsInSubshot = true;
		   }

		   if ( m_FrameId == m_BgnFrameId )
           {
                m_SubshotList[m_SubshotIdx].BeginTime(frame.BeginTime());
                m_IsSubshotStart = true;
           }
		
           m_KeyframeExtractor->OnNewFrame(frame, m_IsSubshotStart);

		   //we get a new sub shot
		   if ( m_FrameId == m_EndFrameId )
		   {
			    m_IsInSubshot = false;
                m_IsSubshotStart = false;
			    m_SubshotList[m_SubshotIdx].EndTime(frame.EndTime());

                //extract the key frame for current sub shot
                //add the last frame
                m_KeyframeExtractor->OnNewFrame(frame, true);
                CFrameList & keyframeList = m_KeyframeExtractor->OnNewSegment(m_SubshotList[m_SubshotIdx]);
				int size = keyframeList.Size();
					
                for( int i = 0; i < size; ++i )
					  m_SubshotList[m_SubshotIdx].AddKeyframe(keyframeList[i]);

			    return S_OK;
		   }
		   
           return S_FALSE;
	}
示例#13
0
void CScrollerView::dragval(CDrawContext *dstcon, CPoint &where)
{
  CPoint ref = where;
  float old = mParam->GetVal();
  bool allow = false; // need to drag a bit before edit
  int d;

	while(1)
	{
		long button = dstcon->getMouseButtons();
		if (!(button & kLButton))
    {
			break;
    }

		dstcon->getMouseLocation(where);
    d = mVert ? ref.y-where.y : where.x-ref.x;
    if(allow==false)
    {
      if(d<-2 || d>2)
      {
        allow = true;
        ref = where;
      }
    }
    else
    {
      mParam->SetVal(old+d, NFLG_ALL);
    }

		if(mFrame) 
			mFrame->doIdleStuff();
	}
}
示例#14
0
unsigned int CFrameJSegmentor::GetSegmentNum(const CFrame & frame)
{
         if( frame.Id() != m_FrameId )
            DetectSemgment(frame);

         return m_SegmentNum;
}
示例#15
0
//////////////////////////////////////////////////////////////
// GetCollisionRect
//	- return the entity's bounding rectangle
RECT CEntity::GetSourceRect( void ) const
{
	RECT rSource = m_pAM->GetCurrentFrame(m_pAnimInfo)->GetSourceRect().GetRECT();
	CFrame* currFrame = m_pAM->GetCurrentFrame(m_pAnimInfo);

	int width = rSource.right - rSource.left;
	int height = rSource.bottom - rSource.top;

	RECT bounding;

	bounding.left = (LONG)(m_fPosX - currFrame->GetAnchorPointX() - m_pGC->GetPosX() );
	bounding.top = (LONG)(m_fPosY - currFrame->GetAnchorPointY() - m_pGC->GetPosY() );
	bounding.right = bounding.left + width;
	bounding.bottom = bounding.top + height;

	return bounding;
}
示例#16
0
void CDisplayView::valueChanged(CDrawContext *pContext, CControl *pControl)
{
  if(mParentView)
  {
    mParentView->notify(this,text);
    mFrame->setDirty();
  }
}
示例#17
0
bool DrawTestEditor::open (void *ptr)
{
	AEffGUIEditor::open (ptr);
	CRect size (rect.left , rect.top, rect.right, rect.bottom);
	CFrame* frame = new CFrame (size, ptr, this);
	frame->setBackground (backgroundBitmap);
	size.inset (8, 8);
	size.top++; // the background bitmap is not correct
	size.left++; // the background bitmap is not correct

//	CView* testView = new PLinesView (size);
//	frame->addView (testView);

	setTabView (frame, size, CTabView::kPositionBottom);
	tooltipSupport = new CTooltipSupport;
	frame->setMouseObserver (tooltipSupport);
	// last but not least set the class variable frame to our newly created frame
	this->frame = frame;
	return true;
}
示例#18
0
void ParticleSurface::sortAndUploadIndices(shared_ptr<ParticleSurface> particleSurface, const Vector3& csz) {
    ParticleSystem::s_sortArray.fastClear();
    
    shared_ptr<ParticleSystem::Block> block = particleSurface->m_block;
    shared_ptr<ParticleSystem> particleSystem = block->particleSystem.lock();
    for (int i = 0; i < particleSystem->m_particle.size(); ++i) {
        const ParticleSystem::Particle& particle = particleSystem->m_particle[i];
        CFrame cframe;
        particleSurface->getCoordinateFrame(cframe);
        const Point3& wsPosition = particleSystem->particlesAreInWorldSpace() ?
            particle.position :
            cframe.pointToWorldSpace(particle.position);
        const float particleCSZ = dot(wsPosition, csz);

        ParticleSystem::SortProxy proxy;
        proxy.index = block->startIndex + i;
        proxy.z = particleCSZ;
        ParticleSystem::s_sortArray.append(proxy);
    }
    ParticleSystem::s_sortArray.sort(SORT_DECREASING);
    ParticleSystem::ParticleBuffer& pBuffer = ParticleSystem::s_particleBuffer;
    bool needsReallocation = true;
    if (pBuffer.indexStream.valid() &&
        (pBuffer.indexStream.maxSize() >= size_t(ParticleSystem::s_sortArray.size()))) {
        needsReallocation = false;
    }

    if (needsReallocation) {
        int numToAllocate = ParticleSystem::s_sortArray.size() * 2;
        shared_ptr<VertexBuffer> vb = VertexBuffer::create(sizeof(int) * numToAllocate + 8);
        int ignored;
        pBuffer.indexStream = IndexStream(ignored, numToAllocate, vb);
    }
    static Array<int> sortedIndices;
    sortedIndices.fastClear();
    for (const ParticleSystem::SortProxy& p : ParticleSystem::s_sortArray) {
        sortedIndices.append(p.index);
    }
    pBuffer.indexStream.update(sortedIndices);
}
void ArticulatedModel::BoundsCallback::operator()
    (ArticulatedModel::Part* part, const CFrame& worldToPartFrame, 
     shared_ptr<ArticulatedModel> m, const int treeDepth) {
    for (int i = 0; i < m->meshArray().size(); ++i) {
        Mesh* mesh = m->meshArray()[i];
        if (mesh->logicalPart == part) {
            const Box& b = worldToPartFrame.toWorldSpace(mesh->boxBounds);
            AABox partBounds;
            b.getBounds(partBounds);
            bounds.merge(partBounds);
        }
    }
}
示例#20
0
        void operator()(ArticulatedModel::Part* part, const CFrame& worldToPartFrame, ArticulatedModel::Ref model, const int treeDepth) {
            int offset = vertexArray.size();
            for (int i = 0; i < part->cpuVertexArray.size(); ++i) {
                vertexArray.append(worldToPartFrame.pointToObjectSpace(part->cpuVertexArray.vertex[i].position));
            }

            for (int m = 0; m < part->meshArray().size(); ++m) {
                const ArticulatedModel::Mesh* mesh = part->meshArray()[m];
                for (int i = 0; i < mesh->cpuIndexArray.size(); ++i) {
                    indexArray.append(mesh->cpuIndexArray[i] + offset);
                }
            }
        }
示例#21
0
//-----------------------------------------------------------------------------------
bool TutorialEditor::open (void* ptr)
{
	//-- first we create the frame with a size of 300, 300 and set the background to white
	CRect frameSize (0, 0, 300, 300);
	CFrame* newFrame = new CFrame (frameSize, ptr, this);
	newFrame->setBackgroundColor (kWhiteCColor);

	//-- load some bitmaps we need
	CBitmap* background = new CBitmap ("KnobBackground.png");
	CBitmap* handle = new CBitmap ("KnobHandle.png");
	CBitmap* handleHighlight = new CBitmap ("KnobHandleHighlight.png");

	//-- creating a knob and adding it to the frame
	CRect r (0, 0, background->getWidth (), background->getHeight ());
	CKnob* knob1 = new MyKnob (r, this, kLeftVolumeParameter, background, handle, handleHighlight);
	newFrame->addView (knob1);

	//-- creating another knob, we are offsetting the rect, so that the knob is next to the previous knob
	r.offset (background->getWidth () + 5, 0);
	CKnob* knob2 = new MyKnob (r, this, kRightVolumeParameter, background, handle, handleHighlight);
	newFrame->addView (knob2);

	//-- forget the bitmaps
	background->forget ();
	handle->forget ();

	//-- remember our controls so that we can sync them with the state of the effect
	controls[kLeftVolumeParameter] = knob1;
	controls[kRightVolumeParameter] = knob2;

	//-- set the member frame to our frame
	frame = newFrame;

	//-- sync parameters
	for (int i = 0; i < kNumParameters; i++)
		setParameter (i, effect->getParameter (i));
	return true;
}
示例#22
0
void AudioDevice::simulate
(const float    dt, 
 const float    timeScaleAtListener, 
 const CFrame&  wsListenerFrame,
 const Vector3& wsListenerVelocity) {

    m_listenerPosition = wsListenerFrame.translation;

    if (m_engine) {
        m_engine->setListenerPosition
            (g3dToirrKlang(wsListenerFrame.translation), 
             g3dToirrKlang(wsListenerFrame.lookVector()), 
             g3dToirrKlang(wsListenerVelocity),
             g3dToirrKlang(wsListenerFrame.upVector()));
    }

    m_timeScaleAtListener = timeScaleAtListener;
    if (m_music) {
        m_music->setPlaybackSpeed(speedAdjust(timeScaleAtListener));
        if (m_music->isFinished()) {
            m_music->drop();
            m_music = NULL;
        }
    }

    // Update already-playing 3D sounds
    for (int s = 0; s < m_active3D.size(); ++s) {
        ISound* sound = m_active3D[s];
        if (sound->isFinished()) {
            // End
            m_active3D.fastRemove(s);
            --s;
        } else {
            sound->setPosition(sound->getPosition() + dt * sound->getVelocity());
        }
    }
}
示例#23
0
int main(){
  bool done = false;
  int key = 0;
  int i = 0;
  CFrame Cont;
  CFrame B(5, 10, 50,15, true, "+-+|+-+|", &Cont);
  CFrame C(5, 10, 20,5, true,C_BORDER_CHARS, &B);
  Cont.draw();
  for(int k=0;k<console.getRows();k+=2){
    for(int m=0;m<console.getCols()-10;m+=10){
      console.setPos(k, m);
      i=!i;
      console<<(i?"Hello":"Hi");
    }
  }
  B.draw();
  C.draw();
  console.display("Press any key...", 0, 0,0);
  console.pause();
  while(!done){
    console.display("ESC: exit, F6: Move Container, F7: Move Inner border", 0, 0,0);
    key = console.getKey();
    switch(key){
    case ESCAPE:
      done = true;
      break;
    case F(6):
      B.move();
      C.draw();
      break;
    case F(7):
      C.move();
      break;
    }
  }
  return 0;
}
示例#24
0
void COpenGL::DrawSplashScreen()
{
   CFrame oFrame;

   glEnable(GL_TEXTURE_2D);		

   // Set viewport
   glViewport(0, 0, static_cast<int>(m_vecScreenSize.X()), static_cast<int>(m_vecScreenSize.Y()));

   // Set camera
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   gluPerspective(45.0f, (GLfloat)1024/(GLfloat)768, 0.1f, 25001.0f);

   // Init modelview matrix
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   
   oFrame.init(0.0f, 0.0f, 1.0f, 1.0f, "loadscreen.png");

   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   oFrame.renderQuad();

}
示例#25
0
文件: Caret.cpp 项目: dreieier/Nexus
void Caret::show()
{
    if( frame_ ) 
    {
        CDrawContext* context = frame_->createDrawContext();
        context->setFrameColor( kBlackCColor );
        context->setLineWidth( 1 );

        CPoint p = position_;
        context->moveTo( p );
        p.offset( 0, height_ );
        context->lineTo( p );

        context->forget();
    }
}
示例#26
0
文件: Caret.cpp 项目: dreieier/Nexus
void Caret::start( CView* parent, const CPoint& pos, CCoord height )
{
    parent_ = parent;
    frame_  = parent_->getFrame();
    ASSERT( frame_ );
    
    HWND hwnd = (HWND)frame_->getSystemWindow();
    CreateCaret( hwnd, NULL, 1, height );

    setPosition( pos );
    height_   = height;
    
    ShowCaret( hwnd );

	//timer_ = new CVSTGUITimer( this, 500 );
	//timer_->start ();
}
示例#27
0
void CScrollerView::SetFrame(CFrame *frame, CPoint ofs)
{
  if(frame)
  {
    size = mSize;
    size.offset(-ofs.x, -ofs.y);
    // add this view to the frame
    frame->addView(this);
  }
  else
  {
    // remove this view from the current frame
    if(mFrame)
    {
      mFrame->removeView(this);
    }
  }
  mFrame = frame;
  mDisplay->SetFrame(frame,ofs,this);
}
示例#28
0
//
//								open
//
bool SDEditor::open (void *ptr)
{
	// !!! always call this !!!
	AEffGUIEditor::open (ptr);
	
	//--load some bitmaps
	CBitmap* hFaderBody   = new CBitmap (kFaderBodyId);
	CBitmap* hFaderHandle = new CBitmap (kFaderHandleId);

	//--init background frame-----------------------------------------------
	// We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. 
	// If all GUI objects are created we assign our class member to this one. See bottom of this method.
	CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ());
	CFrame* lFrame = new CFrame (size, ptr, this);
	lFrame->setBackground (hBackground);

	//--init the faders------------------------------------------------
	int minPos = kFaderY;
	int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1;
	CPoint point (0, 0);
	CPoint offset (1, 0);

	// fine pitch
	size (kFaderX, kFaderY,
          kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ());
	finePitchFader = new CVerticalSlider (size, this, kFinePitch, minPos, maxPos, hFaderHandle, hFaderBody, point);
	finePitchFader->setOffsetHandle (offset);
	finePitchFader->setValue (effect->getParameter (kFinePitch));
	lFrame->addView (finePitchFader);

	// delay
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	delayFader = new CVerticalSlider (size, this, kDelay, minPos, maxPos, hFaderHandle, hFaderBody, point);
	delayFader->setOffsetHandle (offset);
	delayFader->setValue (effect->getParameter (kDelay));
	lFrame->addView (delayFader);

	// feedback
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	feedbackFader = new CVerticalSlider (size, this, kFeedback, minPos, maxPos, hFaderHandle, hFaderBody, point);
	feedbackFader->setOffsetHandle (offset);
	feedbackFader->setValue (effect->getParameter (kFeedback));
	lFrame->addView (feedbackFader);

	// Coarse pitch shift in steps
	size (kSelectX, kSelectY,
          kSelectX + kSelectWidth, kSelectY + kSelectHeight);
	coarsePitchOption = new COptionMenu(size, this, kCoarsePitch);
	coarsePitchOption->addEntry("+12");
	coarsePitchOption->addEntry("+11");
	coarsePitchOption->addEntry("+10");
	coarsePitchOption->addEntry("+9");
	coarsePitchOption->addEntry("+8");
	coarsePitchOption->addEntry("+7");
	coarsePitchOption->addEntry("+6");
	coarsePitchOption->addEntry("+5");
	coarsePitchOption->addEntry("+4");
	coarsePitchOption->addEntry("+3");
	coarsePitchOption->addEntry("+2");
	coarsePitchOption->addEntry("+1");
	coarsePitchOption->addEntry("0");
	coarsePitchOption->addEntry("-1");
	coarsePitchOption->addEntry("-2");
	coarsePitchOption->addEntry("-3");
	coarsePitchOption->addEntry("-4");
	coarsePitchOption->addEntry("-5");
	coarsePitchOption->addEntry("-6");
	coarsePitchOption->addEntry("-7");
	coarsePitchOption->addEntry("-8");
	coarsePitchOption->addEntry("-9");
	coarsePitchOption->addEntry("-10");
	coarsePitchOption->addEntry("-11");
	coarsePitchOption->addEntry("-12");
	coarsePitchOption->setCurrent(ROUND((effect->getParameter(kCoarsePitch)*NUM_PITCHES)));
	lFrame->addView (coarsePitchOption);

	// Mix mode
	size.offset( 0, kSelectInc );
	mixOption = new COptionMenu(size, this, kMixMode);
	mixOption->addEntry("mono");
	mixOption->addEntry("wet only");
	mixOption->addEntry("wet left");
	mixOption->addEntry("wet right");
	mixOption->addEntry("wet part left");
	mixOption->addEntry("wet part right");
	mixOption->addEntry("stereo");
	mixOption->setCurrent((int)(effect->getParameter(kMixMode)*NUM_MIX_MODES));
	lFrame->addView (mixOption);

	// Note : in the constructor of a CBitmap, the number of references is set to 1.
	// Then, each time the bitmap is used (for hinstance in a vertical slider), this
	// number is incremented.
	// As a consequence, everything happens as if the constructor by itself was adding
	// a reference. That's why we need til here a call to forget ().
	// You mustn't call delete here directly, because the bitmap is used by some CControls...
	// These "rules" apply to the other VSTGUI objects too.
	hFaderBody->forget ();
	hFaderHandle->forget ();

	frame = lFrame;
	return true;
}
示例#29
0
//
//								open
//
bool SDEditor::open (void *ptr)
{
	// !!! always call this !!!
	AEffGUIEditor::open (ptr);
	
	//--load some bitmaps
	CBitmap* hFaderBody   = new CBitmap (kFaderBodyId);
	CBitmap* hFaderHandle = new CBitmap (kFaderHandleId);

	//--init background frame-----------------------------------------------
	// We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. 
	// If all GUI objects are created we assign our class member to this one. See bottom of this method.
	CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ());
	CFrame* lFrame = new CFrame (size, ptr, this);
	lFrame->setBackground (hBackground);

	//--init the faders------------------------------------------------
	int minPos = kFaderY;
	int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1;
	CPoint point (0, 0);
	CPoint offset (1, 0);

	// Rate
	size (kFaderX, kFaderY,
          kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ());
	rateFader = new CVerticalSlider (size, this, kRate, minPos, maxPos, hFaderHandle, hFaderBody, point);
	rateFader->setOffsetHandle (offset);
	rateFader->setValue (effect->getParameter (kRate));
	lFrame->addView (rateFader);

	// Width
	size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	widthFader = new CVerticalSlider (size, this, kWidth, minPos, maxPos, hFaderHandle, hFaderBody, point);
	widthFader->setOffsetHandle (offset);
	widthFader->setValue (effect->getParameter (kWidth));
	lFrame->addView (widthFader);

	// Feedback
	//size.offset (kFaderInc + hFaderBody->getWidth (), 0);
	//feedbackFader = new CVerticalSlider (size, this, kFeedback, minPos, maxPos, hFaderHandle, hFaderBody, point);
	//feedbackFader->setOffsetHandle (offset);
	//feedbackFader->setValue (effect->getParameter (kFeedback));
	//lFrame->addView (feedbackFader);

	// Stages
	size (kSelectX, kSelectY,
          kSelectX + kSelectWidth, kSelectY + kSelectHeight);
	delayOption = new COptionMenu(size, this, kDelay);
	delayOption->addEntry("1 ms");
	delayOption->addEntry("1.2 ms");
	delayOption->addEntry("2.5 ms");
	delayOption->addEntry("4 ms");
	delayOption->addEntry("6.3 ms");
	delayOption->addEntry("10 ms");
	delayOption->addEntry("12 ms");
	delayOption->addEntry("25 ms");
	delayOption->addEntry("40 ms");
	delayOption->addEntry("63 ms");
	delayOption->addEntry("100 ms");
	delayOption->setCurrent(ROUND((effect->getParameter(kDelay)*NUM_DELAYS)));
	lFrame->addView (delayOption);

	// Mix mode
	size.offset( 0, kSelectInc );
	mixOption = new COptionMenu(size, this, kMixMode);
	mixOption->addEntry("normal");
	mixOption->addEntry("wet only");
	mixOption->addEntry("wet left");
	mixOption->addEntry("wet right");
	mixOption->addEntry("wet left 75%");
	mixOption->addEntry("wet right 75%");
	mixOption->addEntry("stereo");
	mixOption->setCurrent((int)(effect->getParameter(kMixMode)*NUM_MIX_MODES));
	lFrame->addView (mixOption);

	// Note : in the constructor of a CBitmap, the number of references is set to 1.
	// Then, each time the bitmap is used (for hinstance in a vertical slider), this
	// number is incremented.
	// As a consequence, everything happens as if the constructor by itself was adding
	// a reference. That's why we need til here a call to forget ().
	// You mustn't call delete here directly, because the bitmap is used by some CControls...
	// These "rules" apply to the other VSTGUI objects too.
	hFaderBody->forget ();
	hFaderHandle->forget ();

	frame = lFrame;
	return true;
}
示例#30
0
void CScrollerView::draw(CDrawContext *dstcon)
{
  CPoint cp;
  CRect  cr;
  int x,y,w,h;
  int bar = 0;
  
	setDirty(false);
  if(mParam) bar += mParam->IsBipolar() ? 0: 1;

  w = mLedbmp->getWidth();
  h = mLedbmp->getHeight();

  switch(mType)
  {
  case kScTpVS:
    x = size.left + mHmLeft;
    y = size.top + mHmTop;
    cr = CRect(x,y, x+LEDBAR_WIDTH, y+LEDBAR_HEIGHT);
    cp = CPoint(bar*LEDBAR_WIDTH, (mLedbarValue/2)*LEDBAR_HEIGHT);
    mLedbmp->draw(dstcon, cr, cp);
    break;

  case kScTpHB:
    x = size.left + 1 + mHmLeft;
    y = size.top - 1 + mHmTop;
    cr = CRect(x,y, x+w, y+h);
    int v,b;

    if(bar)
    {
      v = 63-mLedbarValue;;
      for(int l=0; l<10; l++)
      {
        if(mFrame) 
			mFrame->getBackground()->draw(dstcon, cr, CPoint(x,y));
        b = v>7 ? v>16 ? 78-(v/12) : 7 : v<=0 ? 0 : v;
        b *= 36;
        mLedbmp->drawAlphaBlend(dstcon, cr, CPoint(0,0), b);
        cr.offset(w+1,0);
        v -= 6;
      }
    }
    else
    {
      if(mLedbarValue < 33)
      {
        v = 68-mLedbarValue;
        for(int l=0; l<10; l++)
        {
          if(mFrame) 
			  mFrame->getBackground()->draw(dstcon, cr, CPoint(x,y));
          b = l<4 ? 0 : v>7 ? v>16 ? 80-(v/6) : 7 : v<=0 ? 0 : v;
          b *= 36;
          mLedbmp->drawAlphaBlend(dstcon, cr, CPoint(0,0), b);
          cr.offset(w+1,0);
          v -= 6;
        }
      }
      else
      {
        v = mLedbarValue+3;
        cr.offset(9*(w+1),0);
        for(int l=0; l<10; l++)
        {
          if(mFrame) 
			  mFrame->getBackground()->draw(dstcon, cr, CPoint(x,y));
          b = l<4 ? 0 : v>7 ? v>16 ? 80-(v/6) : 7 : v<=0 ? 0 : v;
          b *= 36;
          mLedbmp->drawAlphaBlend(dstcon, cr, CPoint(0,0), b);
          cr.offset(-(w+1),0);
          v -= 6;
        }
      }
    }
    break;
  }

#if 0
  mHitmap->drawAlphaBlend(dstcon, size, cp(0,0));
#endif
}