Beispiel #1
0
//-----------------------------------------------------------------------------
bool CTabView::removeTab (CView* view)
{
	if (!view)
		return false;
	
	CViewContainer* tabContainer = dynamic_cast<CViewContainer*>(getView (0));
	if (!tabContainer)
		return false;
	CTabChildView* v = firstChild;
	while (v)
	{
		if (v->view == view)
		{
			if (v->previous)
				v->previous->next = v->next;
			if (v->next)
				v->next->previous = v->previous;
			if (v == currentChild)
			{
				setCurrentChild (v->previous ? v->previous : v->next);
				if (v->previous == 0 && v->next == 0)
					currentTab = -1;
			}
			tabContainer->removeView (v->button, true);
			v->forget ();
			numberOfChilds--;
			return true;
		}
		v = v->next;
	}
	return false;
}
Beispiel #2
0
//-----------------------------------------------------------------------------
void ViewSizeChangeOperation::undo ()
{
	selection->empty ();
	iterator it = begin ();
	while (it != end ())
	{
		CView* view = (*it).first;
		CRect size ((*it).second);
		view->invalid ();
		(*it).second = view->getViewSize ();
		CViewContainer* container = 0;
		bool oldAutosizing = false;
		if (!autosizing)
		{
			container = dynamic_cast<CViewContainer*> (view);
			if (container)
			{
				oldAutosizing = container->getAutosizingEnabled ();
				container->setAutosizingEnabled (false);
			}
		}
		view->setViewSize (size);
		view->setMouseableArea (size);
		view->invalid ();
		selection->add (view);
		if (!autosizing && container)
		{
			container->setAutosizingEnabled (oldAutosizing);
		}
		it++;
	}
}
Beispiel #3
0
//-----------------------------------------------------------------------------
void CTabView::drawBackgroundRect (CDrawContext *pContext, const CRect& _updateRect)
{
	CRect oldClip = pContext->getClipRect (oldClip);
	CRect updateRect (_updateRect);
	CViewContainer* tabContainer = dynamic_cast<CViewContainer*>(getView (0));
	if (tabContainer)
	{
		CRect tcRect = tabContainer->getViewSize ();
		if (updateRect.top < tcRect.bottom)
			updateRect.top = tcRect.bottom;
	}
	pContext->setClipRect (updateRect);
	CViewContainer::drawBackgroundRect (pContext, updateRect);
	pContext->setClipRect (oldClip);
}
Beispiel #4
0
//-----------------------------------------------------------------------------
ExchangeViewAnimation::ExchangeViewAnimation (CView* oldView, CView* newView, AnimationStyle style)
: newView (newView)
, viewToRemove (oldView)
, style (style)
{
	assert (newView->isAttached () == false);
	assert (viewToRemove->isAttached ());

	viewToRemove->remember ();
	newView->remember ();
	CViewContainer* parent = reinterpret_cast<CViewContainer*> (viewToRemove->getParentView ());
	if (parent)
		parent->addView (newView);

	newViewValueEnd = newView->getAlphaValue ();
	newView->setAlphaValue (0.f);
}
Beispiel #5
0
/**
 * @param pView view which was removed
 */
void CFrame::onViewRemoved (CView* pView)
{
	removeFromMouseViews (pView);

	if (pActiveFocusView == pView)
		pActiveFocusView = 0;
	if (pFocusView == pView)
		setFocusView (0);
	CViewContainer* container = dynamic_cast<CViewContainer*> (pView);
	if (container)
	{
		if (container->isChild (pFocusView, true))
			setFocusView (0);
	}
	if (getViewAddedRemovedObserver ())
		getViewAddedRemovedObserver ()->onViewRemoved (this, pView);
	if (pAnimator)
		pAnimator->removeAnimations (pView);
}
Beispiel #6
0
//-----------------------------------------------------------------------------
CViewContainer* CFrame::getContainerAt (const CPoint& where, const GetViewOptions& options) const
{
	if (pModalView)
	{
		CPoint where2 (where);
		getTransform ().inverse ().transform (where2);
		if (pModalView->getViewSize ().pointInside (where2))
		{
			CViewContainer* container = dynamic_cast<CViewContainer*> (pModalView);
			if (container)
			{
				if (options.deep ())
					return container->getContainerAt (where2, options);
				return container;
			}
		}
		return 0;
	}
	return CViewContainer::getContainerAt (where, options);
}
Beispiel #7
0
/**
 * @param pView the view which should be set to modal.
 * @return true if view could be set as the modal view. false if there is a already a modal view or the view to be set as modal is already attached.
 */
bool CFrame::setModalView (CView* pView)
{
	if (pView == 0 && pModalView == 0)
		return true;

	// If there is a modal view or the view 
	if ((pView && pModalView) || (pView && pView->isAttached ()))
		return false;

	if (pModalView)
	{
		removeView (pModalView, false);
	}
	
	pModalView = pView;

	if (pModalView)
	{
		bool result = addView (pModalView);
		if (result)
		{
			clearMouseViews (CPoint (0, 0), 0, true);
			CViewContainer* container = dynamic_cast<CViewContainer*> (pModalView);
			if (container)
				container->advanceNextFocusView (0, false);
			else
				setFocusView (pModalView->wantsFocus () ? pModalView : 0);
		}
		return result;
	}
	else
	{
		CPoint where;
		getCurrentMouseLocation (where);
		checkMouseViews (where, getCurrentMouseButtons ());
	}

	return true;
}
Beispiel #8
0
void Editor::initGui( void* systemWindow )
{
	CRect rc      = childFrame_->getViewSize();
    CCoord middle = rc.width() - 276;
    CCoord bottom = rc.height() - 55;

    CRect rcTabView( rc.left+8, rc.top+8, rc.right-8, rc.bottom-8 );
	CRect rcTabButtons( -3, 0, 100, 64 );	            // size of a TabButton (double height)
	CRect rcDisplay( 0, 0, rc.right-16, bottom );	    // area without tab bar
	CRect rcProgramView( 0, 0, middle, bottom );
	CRect rcCtrlView( middle, 0, rc.right-8, bottom );
    CRect rcBankView( 0, 0, rc.right-8, bottom );
    CRect rcSystemView( 0, 0, rc.right-16, bottom );

	tabView_     = new TabView( rcTabView, rcTabButtons, this );
   	ctrlView_    = new CtrlView( rcCtrlView, this );
	programView_ = new ProgramView( rcProgramView, this, ctrlView_ );
    bankView_    = new BankView( rcBankView, this );
    
	CViewContainer* programTab = new CViewContainer( rcDisplay, childFrame_ );
    programTab->setAutosizeFlags( kAutosizeAll );
    programTab->setTransparency( true );
    programTab->addView( programView_->getScrollView() );
	programTab->addView( ctrlView_ );

    tabView_->addTab( programTab, new TabButton( "Program" ));
	tabView_->addTab( bankView_, new TabButton( "Bank" ) );
	
    if( isStandalone() )
    {
        systemView_ = new SystemView( rcSystemView, this );
        tabView_->addTab( systemView_, new TabButton( "System" ) );
    }

    tabView_->init();	
    childFrame_->addView( tabView_ );
    checkAppState();
    setColorScheme();
}
//----------------------------------------------------------------------------------------------------
CView* UIDialogController::verifyView (CView* view, const UIAttributes& attributes, IUIDescription* description)
{
	CControl* control = dynamic_cast<CControl*>(view);
	if (control)
	{
		if (control->getTag () == kButton1Tag)
		{
			CTextButton* button = dynamic_cast<CTextButton*>(control);
			if (button)
			{
				button1 = button;
				button->setTitle (dialogButton1.c_str ());
				layoutButtons ();
			}
		}
		else if (control->getTag () == kButton2Tag)
		{
			CTextButton* button = dynamic_cast<CTextButton*>(control);
			if (button)
			{
				button2 = button;
				if (dialogButton2.empty ())
				{
					button->setVisible (false);
				}
				else
				{
					button->setTitle (dialogButton2.c_str ());
				}
				layoutButtons ();
			}
		}
		else if (control->getTag () == kTitleTag)
		{
			CTextLabel* label = dynamic_cast<CTextLabel*>(control);
			if (label)
			{
				label->setText (dialogTitle.c_str ());
			}
		}
	}
	const std::string* name = attributes.getAttributeValue ("custom-view-name");
	if (name)
	{
		if (*name == "view")
		{
			IController* controller = dialogController.cast<IController> ();
			CView* subView = dialogDescription->createView (templateName.c_str (), controller);
			if (subView)
			{
				subView->setAttribute (kCViewControllerAttribute, sizeof (IController*), &controller);
				sizeDiff.x = subView->getWidth () - view->getWidth ();
				sizeDiff.y = subView->getHeight () - view->getHeight ();
				CRect size = view->getViewSize ();
				size.setWidth (subView->getWidth ());
				size.setHeight (subView->getHeight ());
				view->setViewSize (size);
				view->setMouseableArea (size);
				CViewContainer* container = dynamic_cast<CViewContainer*> (view);
				if (container)
					container->addView (subView);
			}
		}
	}
	return view;
}
Beispiel #10
0
//-----------------------------------------------------------------------------
void CFrame::checkMouseViews (const CPoint& where, const CButtonState& buttons)
{
	if (mouseDownView)
		return;
	CPoint lp;
	CView* mouseView = getViewAt (where, GetViewOptions (GetViewOptions::kDeep|GetViewOptions::kMouseEnabled|GetViewOptions::kIncludeViewContainer));
	CView* currentMouseView = pMouseViews.empty () == false ? pMouseViews.back () : 0;
	if (currentMouseView == mouseView)
		return; // no change

	if (pTooltips)
	{
		if (currentMouseView)
			pTooltips->onMouseExited (currentMouseView);
		if (mouseView && mouseView != this)
			pTooltips->onMouseEntered (mouseView);
	}

	if (mouseView == 0 || mouseView == this)
	{
		clearMouseViews (where, buttons);
		return;
	}
	CViewContainer* vc = currentMouseView ? dynamic_cast<CViewContainer*> (currentMouseView) : 0;
	// if the currentMouseView is not a view container, we know that the new mouseView won't be a child of it and that all other
	// views in the list are viewcontainers
	if (vc == 0 && currentMouseView)
	{
		lp = where;
		currentMouseView->frameToLocal (lp);
		currentMouseView->onMouseExited (lp, buttons);
		callMouseObserverMouseExited (currentMouseView);
	#if DEBUG_MOUSE_VIEWS
		DebugPrint ("mouseExited : %p\n", currentMouseView);
	#endif
		currentMouseView->forget ();
		pMouseViews.remove (currentMouseView);
	}
	ViewList::reverse_iterator it = pMouseViews.rbegin ();
	while (it != pMouseViews.rend ())
	{
		vc = static_cast<CViewContainer*> ((*it));
		if (vc == mouseView)
			return;
		if (vc->isChild (mouseView, true) == false)
		{
			lp = where;
			vc->frameToLocal (lp);
			vc->onMouseExited (lp, buttons);
			callMouseObserverMouseExited (vc);
		#if DEBUG_MOUSE_VIEWS
			DebugPrint ("mouseExited : %p\n", vc);
		#endif
			vc->forget ();
			pMouseViews.erase (--it.base ());
		}
		else
			break;
	}
	vc = pMouseViews.empty () == false ? dynamic_cast<CViewContainer*> (pMouseViews.back ()) : 0;
	if (vc)
	{
		ViewList::iterator it2 = pMouseViews.end ();
		it2--;
		while ((vc = static_cast<CViewContainer*> (mouseView->getParentView ())) != *it2)
		{
			pMouseViews.insert (it2, vc);
			vc->remember ();
			mouseView = vc;
		}
		pMouseViews.push_back (mouseView);
		mouseView->remember ();
		it2++;
		while (it2 != pMouseViews.end ())
		{
			lp = where;
			(*it2)->frameToLocal (lp);
			(*it2)->onMouseEntered (lp, buttons);
			callMouseObserverMouseEntered ((*it2));
		#if DEBUG_MOUSE_VIEWS
			DebugPrint ("mouseEntered : %p\n", (*it2));
		#endif
			it2++;
		}
	}
	else
	{
		// must be pMouseViews.size () == 0
		assert (pMouseViews.empty ());
		pMouseViews.push_back (mouseView);
		mouseView->remember ();
		while ((vc = static_cast<CViewContainer*> (mouseView->getParentView ())) != this)
		{
			pMouseViews.push_front (vc);
			vc->remember ();
			mouseView = vc;
		}
		ViewList::iterator it2 = pMouseViews.begin ();
		while (it2 != pMouseViews.end ())
		{
			lp = where;
			(*it2)->frameToLocal (lp);
			(*it2)->onMouseEntered (lp, buttons);
			callMouseObserverMouseEntered ((*it2));
		#if DEBUG_MOUSE_VIEWS
			DebugPrint ("mouseEntered : %p\n", (*it2));
		#endif
			it2++;
		}
	}
}
Beispiel #11
0
//-----------------------------------------------------------------------------
bool CFrame::advanceNextFocusView (CView* oldFocus, bool reverse)
{
	if (pModalView)
	{
		CViewContainer* container = dynamic_cast<CViewContainer*> (pModalView);
		if (container)
		{
			if (oldFocus == 0 || container->isChild (oldFocus, true) == false)
				return container->advanceNextFocusView (0, reverse);
			else
			{
				CViewContainer* parentView = static_cast<CViewContainer*> (oldFocus->getParentView ());
				if (parentView)
				{
					CView* tempOldFocus = oldFocus;
					while (parentView != container)
					{
						if (parentView->advanceNextFocusView (tempOldFocus, reverse))
							return true;
						else
						{
							tempOldFocus = parentView;
							parentView = static_cast<CViewContainer*> (parentView->getParentView ());
						}
					}
					if (container->advanceNextFocusView (tempOldFocus, reverse))
						return true;
					return container->advanceNextFocusView (0, reverse);
				}
			}
		}
		else if (oldFocus != pModalView)
		{
			setFocusView (pModalView);
			return true;
		}
		return false; // currently not supported, but should be done sometime
	}
	if (oldFocus == 0)
	{
		if (pFocusView == 0)
			return CViewContainer::advanceNextFocusView (0, reverse);
		oldFocus = pFocusView;
	}
	if (isChild (oldFocus))
	{
		if (CViewContainer::advanceNextFocusView (oldFocus, reverse))
			return true;
		else
		{
			setFocusView (0);
			return false;
		}
	}
	CViewContainer* parentView = static_cast<CViewContainer*> (oldFocus->getParentView ());
	if (parentView)
	{
		CView* tempOldFocus = oldFocus;
		while (parentView)
		{
			if (parentView->advanceNextFocusView (tempOldFocus, reverse))
				return true;
			else
			{
				tempOldFocus = parentView;
				parentView = static_cast<CViewContainer*> (parentView->getParentView ());
			}
		}
	}
	return CViewContainer::advanceNextFocusView (oldFocus, reverse);
}
Beispiel #12
0
bool GuiEditor::open (void *ptr)
{
	AEffGUIEditor::open (ptr);
	CRect size (rect.left , rect.top, rect.right, rect.bottom);


	CBitmap* hHFaderBody   = new CBitmap (kHFaderBodyId);
	CBitmap* hHFaderHandle = new CBitmap (kHFaderHandleId);



	CFrame* lFrame = new CFrame(size, ptr, this);
	//lFrame->setBackgroundColor(kGreyCColor);

	int middle = 150;

	size(0,0,dWidth,middle);

	CViewContainer* graphicsView = new CViewContainer(size, lFrame);
	graphicsView->setBackgroundColor(kBlackCColor);

	lFrame->addView(graphicsView);

	size(0,middle,dWidth,dBottom);
	CViewContainer* controlsView = new CViewContainer(size, lFrame);
	controlsView->setBackgroundColor(kGreyCColor);

	lFrame->addView(controlsView);


	size(0,0,700,150);
	mySpectrumView = new SpectrumView(size,effect);
	graphicsView->addView(mySpectrumView);


	int left, top, right, bottom, minPos, maxPos;

	//------------------------------------------------------------------------------
	left = 20;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* bufferLabel = new CTextLabel(size,"BufferSize");
	bufferLabel->setFont (kNormalFontSmall);
	bufferLabel->setFontColor (kWhiteCColor);
	bufferLabel->setBackColor (kBlackCColor);
	bufferLabel->setFrameColor (kBlackCColor);
	controlsView->addView(bufferLabel);

	//------------------------------------------------------------------------------
	left = right + 10;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	bufferMenu = new COptionMenu(size, this,kBufferSize);
	bufferMenu->setFont (kNormalFontSmall);
	bufferMenu->setFontColor (kWhiteCColor);
	bufferMenu->setBackColor (kBlackCColor);
	bufferMenu->setFrameColor (kWhiteCColor);

	bufferMenu->addEntry("512",0);
	bufferMenu->addEntry("1024",1);
	bufferMenu->addEntry("2048",2);
	bufferMenu->addEntry("4096",3);
	bufferMenu->addEntry("8192",4);
	bufferMenu->setCurrent(3);

	controlsView->addView(bufferMenu);

	//----------------------------------------------------------------------------

	left = right + 10;
	right = left + 60;


		size(left, top, right, bottom);
	CTextLabel* displayLabel = new CTextLabel(size,"Display");
	displayLabel->setFont (kNormalFontSmall);
	displayLabel->setFontColor (kWhiteCColor);
	displayLabel->setBackColor (kBlackCColor);
	displayLabel->setFrameColor (kBlackCColor);
	controlsView->addView(displayLabel);


	left = right + 10;
	right = left + 50;

	size(left, top, right, bottom);
	displayMenu = new COptionMenu(size, this,kDisplay);
	displayMenu->setFont (kNormalFontSmall);
	displayMenu->setFontColor (kWhiteCColor);
	displayMenu->setBackColor (kBlackCColor);
	displayMenu->setFrameColor (kWhiteCColor);

	displayMenu->addEntry("Bands",0);
	displayMenu->addEntry("Lines",1);
	displayMenu->setCurrent(0);

	controlsView->addView(displayMenu);


	//------------------------------------------------------------------------------

	left = 20;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* gainLabel = new CTextLabel(size,"Gain");
	gainLabel->setFont (kNormalFontSmall);
	gainLabel->setFontColor (kWhiteCColor);
	gainLabel->setBackColor (kBlackCColor);
	gainLabel->setFrameColor (kBlackCColor);
	controlsView->addView(gainLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	CPoint point (0, 0);

	size (left, top, right, bottom);
	gainFader = new CHorizontalSlider (size, this, kGain, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(gainFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	gainDisplay = new CTextEdit(size, this, kGainText, "0");
	gainDisplay->setFont (kNormalFontSmall);
	gainDisplay->setFontColor (kWhiteCColor);
	gainDisplay->setBackColor (kBlackCColor);
	gainDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (gainDisplay);

	//---------------------------------------------------------------------------
	
	left = 20;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* responseLabel = new CTextLabel(size,"Response");
	responseLabel->setFont (kNormalFontSmall);
	responseLabel->setFontColor (kWhiteCColor);
	responseLabel->setBackColor (kBlackCColor);
	responseLabel->setFrameColor (kBlackCColor);
	controlsView->addView(responseLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	responseFader = new CHorizontalSlider (size, this, kResponse, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(responseFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	responseDisplay = new CTextEdit (size, this, kResponseText, "0");
	responseDisplay->setFont (kNormalFontSmall);
	responseDisplay->setFontColor (kWhiteCColor);
	responseDisplay->setBackColor (kBlackCColor);
	responseDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (responseDisplay);


	//---------------------------------------------------------------------------
	left = 20;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

		size(left, top, right, bottom);
	CTextLabel* bandsLabel = new CTextLabel(size,"Bands");
	bandsLabel->setFont (kNormalFontSmall);
	bandsLabel->setFontColor (kWhiteCColor);
	bandsLabel->setBackColor (kBlackCColor);
	bandsLabel->setFrameColor (kBlackCColor);
	controlsView->addView(bandsLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	bandsFader = new CHorizontalSlider(size, this, kBands, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(bandsFader);
	bandsFader->setValue(0.5);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	bandsDisplay = new CTextEdit (size, this, kBandsText, "32");
	bandsDisplay->setFont (kNormalFontSmall);
	bandsDisplay->setFontColor (kWhiteCColor);
	bandsDisplay->setBackColor (kBlackCColor);
	bandsDisplay->setFrameColor (kWhiteCColor);
	//bandsDisplay->setStringConvert(bandsStringConvert);
	controlsView->addView (bandsDisplay);


	//---------------------------------------------------------------------------
	int left2 = right + 40;
	left = left2;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* ampScaleLabel = new CTextLabel(size,"Amp Scale");
	ampScaleLabel->setFont (kNormalFontSmall);
	ampScaleLabel->setFontColor (kWhiteCColor);
	ampScaleLabel->setBackColor (kBlackCColor);
	ampScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(ampScaleLabel);


	left = right + 10;
	right = left + 70;

	size(left, top, right, bottom);
	ampScaleMenu = new COptionMenu(size, this,kAmpScale);
	ampScaleMenu->setFont (kNormalFontSmall);
	ampScaleMenu->setFontColor (kWhiteCColor);
	ampScaleMenu->setBackColor (kBlackCColor);
	ampScaleMenu->setFrameColor (kWhiteCColor);

	ampScaleMenu->addEntry("No Scaling",0);
	ampScaleMenu->addEntry("Log",1);
	ampScaleMenu->setCurrent(1);

	controlsView->addView(ampScaleMenu);


	//------------------------------------------------------------------------------

	left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

		size(left, top, right, bottom);
	CTextLabel* freqScaleLabel = new CTextLabel(size,"Freq Scale");
	freqScaleLabel->setFont (kNormalFontSmall);
	freqScaleLabel->setFontColor (kWhiteCColor);
	freqScaleLabel->setBackColor (kBlackCColor);
	freqScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(freqScaleLabel);

	left = right +10;
	right = left + 70;

	size(left, top, right, bottom);
	freqScaleMenu = new COptionMenu(size, this,kFreqScale);
	freqScaleMenu->setFont (kNormalFontSmall);
	freqScaleMenu->setFontColor (kWhiteCColor);
	freqScaleMenu->setBackColor (kBlackCColor);
	freqScaleMenu->setFrameColor (kWhiteCColor);

	freqScaleMenu->addEntry("No Scaling",0);
	freqScaleMenu->addEntry("Log",1);
	freqScaleMenu->setCurrent(1);

	controlsView->addView(freqScaleMenu);

	


	//------------------------------------------------------------------------------

		left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

		size(left, top, right, bottom);
	CTextLabel* resamplingLabel = new CTextLabel(size,"Resampling");
	resamplingLabel->setFont (kNormalFontSmall);
	resamplingLabel->setFontColor (kWhiteCColor);
	resamplingLabel->setBackColor (kBlackCColor);
	resamplingLabel->setFrameColor (kBlackCColor);
	controlsView->addView(resamplingLabel);

	left = right +10;
	right = left + 70;

	size(left, top, right, bottom);
	resamplingMenu = new COptionMenu(size, this,kResampling);
	resamplingMenu->setFont (kNormalFontSmall);
	resamplingMenu->setFontColor (kWhiteCColor);
	resamplingMenu->setBackColor (kBlackCColor);
	resamplingMenu->setFrameColor (kWhiteCColor);

	resamplingMenu->addEntry("Decim",0);
	resamplingMenu->addEntry("Sum",1);
	resamplingMenu->setCurrent(0);

	controlsView->addView(resamplingMenu);

	
	//------------------------------------------------------------------------------

	left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* xScaleLabel = new CTextLabel(size,"X Scale");
	xScaleLabel->setFont (kNormalFontSmall);
	xScaleLabel->setFontColor (kWhiteCColor);
	xScaleLabel->setBackColor (kBlackCColor);
	xScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(xScaleLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	xScaleFader = new CHorizontalSlider (size, this, kXScale, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(xScaleFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	xScaleDisplay = new CTextEdit (size, this, kXScaleText, "0");
	xScaleDisplay->setFont (kNormalFontSmall);
	xScaleDisplay->setFontColor (kWhiteCColor);
	xScaleDisplay->setBackColor (kBlackCColor);
	xScaleDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (xScaleDisplay);


	//---------------------------------------------------------------------------

		left = left2;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* yScaleLabel = new CTextLabel(size,"Y Scale");
	yScaleLabel->setFont (kNormalFontSmall);
	yScaleLabel->setFontColor (kWhiteCColor);
	yScaleLabel->setBackColor (kBlackCColor);
	yScaleLabel->setFrameColor (kBlackCColor);
	controlsView->addView(yScaleLabel);

	left = right + 10;
	right = left + hHFaderBody->getWidth ();
	bottom = top + hHFaderBody->getHeight ();

	minPos = left;
	maxPos = right - hHFaderHandle->getWidth () - 1;
	point (0, 0);

	size (left, top, right, bottom);
	yScaleFader = new CHorizontalSlider (size, this, kYScale, minPos, maxPos, hHFaderHandle, hHFaderBody, point, kLeft);
	controlsView->addView(yScaleFader);

	left = right + 10;
	right = left + 30;
	

	size (left, top, right, bottom);
	yScaleDisplay = new CTextEdit (size, this, kYScaleText, "0");
	yScaleDisplay->setFont (kNormalFontSmall);
	yScaleDisplay->setFontColor (kWhiteCColor);
	yScaleDisplay->setBackColor (kBlackCColor);
	yScaleDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (yScaleDisplay);


	//---------------------------------------------------------------------------

	int left3 = right + 40;
	left = left3;
	top = 10;
	right = left + 70;
	bottom = top + 16;

	
		size(left, top, right, bottom);
	CTextLabel* typeLabel = new CTextLabel(size,"Type");
	typeLabel->setFont (kNormalFontSmall);
	typeLabel->setFontColor (kWhiteCColor);
	typeLabel->setBackColor (kBlackCColor);
	typeLabel->setFrameColor (kBlackCColor);
	controlsView->addView(typeLabel);


	left = right + 10;
	right = left + 70;

	size(left, top, right, bottom);
	typeMenu = new COptionMenu(size, this,kType);
	typeMenu->setFont (kNormalFontSmall);
	typeMenu->setFontColor (kWhiteCColor);
	typeMenu->setBackColor (kBlackCColor);
	typeMenu->setFrameColor (kWhiteCColor);

	typeMenu->addEntry("FFT Mono",0);
	typeMenu->addEntry("FFT Average",1);
	typeMenu->addEntry("Filtersbank",2);
	typeMenu->addEntry("Levels",3);
	typeMenu->setCurrent(0);

	controlsView->addView(typeMenu);

	//--------------------------------------------------------------------


	left = left3;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* addressLabel = new CTextLabel(size,"Adress");
	addressLabel->setFont (kNormalFontSmall);
	addressLabel->setFontColor (kWhiteCColor);
	addressLabel->setBackColor (kBlackCColor);
	addressLabel->setFrameColor (kBlackCColor);
	controlsView->addView(addressLabel);

	left = right +10;
	right = left + 70;

	size (left, top, right, bottom);
	addressDisplay = new CTextEdit(size, this, kAddress, "out1");
	addressDisplay->setFont (kNormalFontSmall);
	addressDisplay->setFontColor (kWhiteCColor);
	addressDisplay->setBackColor (kBlackCColor);
	addressDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (addressDisplay);

	//------------------------------------------------------------------------------

	left = left3;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* portLabel = new CTextLabel(size,"Port");
	portLabel->setFont (kNormalFontSmall);
	portLabel->setFontColor (kWhiteCColor);
	portLabel->setBackColor (kBlackCColor);
	portLabel->setFrameColor (kBlackCColor);
	controlsView->addView(portLabel);

	left = right +10;
	right = left + 70;

	size (left, top, right, bottom);
	portDisplay = new CTextEdit (size, this, kPort, "12000");
	portDisplay->setFont (kNormalFontSmall);
	portDisplay->setFontColor (kWhiteCColor);
	portDisplay->setBackColor (kBlackCColor);
	portDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (portDisplay);

	//------------------------------------------------------------------------------

	left = left3;
	top = bottom + 10;
	right = left + 70;
	bottom = top + 16;

	size(left, top, right, bottom);
	CTextLabel* hostLabel = new CTextLabel(size,"host");
	hostLabel->setFont (kNormalFontSmall);
	hostLabel->setFontColor (kWhiteCColor);
	hostLabel->setBackColor (kBlackCColor);
	hostLabel->setFrameColor (kBlackCColor);
	controlsView->addView(hostLabel);

	left = right +10;
	right = left + 70;

	size (left, top, right, bottom);
	hostDisplay = new CTextEdit (size, this, kHost, "localhost");
	hostDisplay->setFont (kNormalFontSmall);
	hostDisplay->setFontColor (kWhiteCColor);
	hostDisplay->setBackColor (kBlackCColor);
	hostDisplay->setFrameColor (kWhiteCColor);
	controlsView->addView (hostDisplay);

	//------------------------------------------------------------------------------


	hHFaderBody->forget ();
	hHFaderHandle->forget ();

	opened = true;

	updateDisplay();

	this->frame = lFrame;


	start();


	return true;
}
Beispiel #13
0
void DrawTestEditor::setTabView (CFrame* frame, const CRect& r, long position)
{
	frame->removeAll ();
	CBitmap* tabButtonBitmap = new CBitmap (kTabButtonBitmap);
	CTabView* tabView = new MyTabView (r, frame, tabButtonBitmap, NULL, position, this);
	tabView->setTransparency (true);
	frame->addView (tabView);
	CRect tabSize = tabView->getTabViewSize (tabSize);
//	tabSize.inset (1, 1);
	// add tabs
	CView* testView;
	CBitmap* testBitmap = new CBitmap (kTestBitmap);
	CRect containerSize;
	containerSize.right = testBitmap->getWidth () + 1000;
	containerSize.bottom = testBitmap->getHeight () + 1000;
	// the first tab is a scroll view with a movie bitmap
	CScrollView* scrollview = new CScrollView (tabSize, containerSize, frame, CScrollView::kHorizontalScrollbar|CScrollView::kVerticalScrollbar/*|CScrollView::kDontDrawFrame*/);
	scrollview->setBackgroundColor (kWhiteCColor);
//	scrollview->setTransparency (true);
	CPoint p (0,0);
	CRect mbSize (containerSize);
	mbSize.setWidth (testBitmap->getWidth ());
	mbSize.setHeight (testBitmap->getHeight ());
	testView = new CMovieBitmap (mbSize, NULL, 0, 1, testBitmap->getHeight (), testBitmap, p);
	testBitmap->forget ();
	scrollview->addView (testView);
	CRect controlsGUISize2 (0, 0, 420, 210);
	controlsGUISize2.offset (mbSize.right, 5);
	testView = new ControlsGUI (controlsGUISize2, frame);
	scrollview->addView (testView);
	tabView->addTab (scrollview, "Scroll View");

	testView = new PLinesView (tabSize);
	tabView->addTab (testView, "Lines");

	testView = new PRectsView (tabSize);
	tabView->addTab (testView, "Rects");

	testView = new PMiscView (tabSize);
	tabView->addTab (testView, "Misc");

	// the third tab is the old controlsgui view embeded into a container view
	CRect controlsGUISize (0, 0, 420, 210);
	controlsGUISize.offset (5, 5);
	testView = new ControlsGUI (controlsGUISize, frame);

	CViewContainer* controlContainer = new CViewContainer (tabSize, frame);
	controlContainer->setTransparency (true);
	controlContainer->addView (testView);
	
	tabView->addTab (controlContainer, "Controls");

	CColor redColor = {255, 0, 0, 150};
	CColor greenColor = {0, 255, 0, 150};
	CColor blueColor = {0, 0, 255, 150};

	CViewContainer* clipView = new CViewContainer (tabSize, frame);
	clipView->setTransparency (true);
	CRect clipViewSize (0, 0, tabSize.getWidth () / 4, tabSize.getHeight () / 2);
	MyColoredView* cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (redColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (greenColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (blueColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (redColor);
	clipView->addView (cv);
	clipViewSize (0, tabSize.getHeight () / 2, tabSize.getWidth () / 4, tabSize.getHeight ());
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (greenColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (blueColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (redColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (greenColor);
	clipView->addView (cv);
	
	tabView->addTab (clipView, "Clip Test");
	tabView->alignTabs (CTabView::kAlignCenter);

	tabButtonBitmap->forget ();
	frame->setDirty ();
}
Beispiel #14
0
//-----------------------------------------------------------------------------
bool CTabView::addTab (CView* view, CControl* button)
{
	if (!view || !button)
		return false;

	CViewContainer* tabContainer = dynamic_cast<CViewContainer*>(getView (0));
	if (tabContainer == 0)
	{
		int32_t asf = kAutosizeLeft | kAutosizeTop | kAutosizeRight | kAutosizeColumn;
		CRect tsc (0, 0, getViewSize ().getWidth (), tabSize.getHeight () / 2);
		switch (tabPosition)
		{
			case kPositionBottom:
			{
				asf = kAutosizeLeft | kAutosizeBottom | kAutosizeRight | kAutosizeColumn;
				tsc.offset (0, getViewSize ().getHeight () - tabSize.getHeight () / 2);
				break;
			}
			case kPositionLeft:
			{
				asf = kAutosizeLeft | kAutosizeTop | kAutosizeBottom | kAutosizeRow;
				tsc.setWidth (tabSize.getWidth ());
				tsc.setHeight (getViewSize ().getHeight ());
				break;
			}
			case kPositionRight:
			{
				asf = kAutosizeRight | kAutosizeTop | kAutosizeBottom | kAutosizeRow;
				tsc.setWidth (getViewSize ().getWidth ());
				tsc.left = tsc.right - tabSize.getWidth ();
				tsc.setHeight (getViewSize ().getHeight ());
				break;
			}
			case kPositionTop:
			{
				break;
			}
		}
		tabContainer = new CViewContainer (tsc);
		tabContainer->setTransparency (true);
		tabContainer->setAutosizeFlags (asf);
		addView (tabContainer);
	}
	CRect ts (tabSize.left, tabSize.top, tabSize.getWidth (), tabSize.getHeight () / 2);
	switch (tabPosition)
	{
		case kPositionTop:
			ts.offset (tabSize.getWidth () * numberOfChilds, 0); break;
		case kPositionBottom:
			ts.offset (tabSize.getWidth () * numberOfChilds, 0); break;
		case kPositionLeft:
			ts.offset (0, tabSize.getHeight () / 2 * numberOfChilds); break;
		case kPositionRight:
			ts.offset (0, tabSize.getHeight () / 2 * numberOfChilds); break;
	}
	button->setViewSize (ts, false);
	button->setMouseableArea (ts);
	button->setListener (this);
	button->setTag (numberOfChilds + kTabButtonTagStart);
	tabContainer->addView (button);

	CRect tabViewSize;
	getTabViewSize (tabViewSize);
	view->setViewSize (tabViewSize);
	view->setMouseableArea (tabViewSize);

	CTabChildView* v = new CTabChildView (view);
	v->button = button;
	if (lastChild)
	{
		lastChild->next = v;
		v->previous = lastChild;
		lastChild = v;
	}
	else
	{
		firstChild = lastChild = v;
		setCurrentChild (v);
	}
	numberOfChilds++;
	return true;
}