Пример #1
0
void
TReplicantTray::RealignReplicants(int32 startIndex)
{
	if (startIndex < 0)
		startIndex = 0;

	int32 count = fShelf->CountReplicants();
	if (count <= 0)
		return;

	if (startIndex == 0)
		fRightBottomReplicant.Set(0, 0, 0, 0);

	BView* view = NULL;
	for (int32 i = startIndex ; i < count ; i++) {
		fShelf->ReplicantAt(i, &view);
		if (view != NULL) {
			BPoint loc = LocationForReplicant(i, view->Frame().Width());
			if (view->Frame().LeftTop() != loc)
				view->MoveTo(loc);
		}
	}
}
Пример #2
0
void ArpKnobPanel::LayoutVertical(	const char* name, const char* label, BMessage* message,
									int32 minValue, int32 maxValue,
									bool showIntControl, uint32 knobFlags, float labelWidth,
									float intControlWidth)
{
	const BFont*	font = be_plain_font;
	float			fh = arp_get_font_height(font);
	float			spaceY = 3;
	float			top = 0;
	float			widest = 0;		// Cache the widest view just to save ourselves an
									// extra iteration over the views
	/* Add label
	 */
	BStringView*	sv = 0;
	if( label ) {
		float		w = (labelWidth >= 0) ? labelWidth : font->StringWidth( label );
		sv = new BStringView(	BRect( 0, top, 0 + w, top + fh ),
								"label", label );
		if( sv ) {
			AddChild( sv );
			if( w > widest ) widest = w;
		}
		top += fh + spaceY;
	}
	/* Add knob
	 */
	float			knobW, knobH;
	if( knobFlags&ARP_RING_ADORNMENT ) {
		knobW = Prefs().Size(KNOB_RING_X);
		knobH = Prefs().Size(KNOB_RING_Y);
	} else if( knobFlags&ARP_TIGHT_RING_ADORNMENT ) {
		knobW = Prefs().Size(KNOB_RING_TIGHT_X);
		knobH = Prefs().Size(KNOB_RING_TIGHT_Y);
	} else {
		knobW = Prefs().Size(KNOB_X);
		knobH = Prefs().Size(KNOB_Y);
	}
	ArpKnobControl* knob = new ArpKnobControl(	BRect(0, top, knobW, top + knobH ),
												name, message, minValue, maxValue, knobFlags);
	if( knob ) {
		AddChild( knob );
		if( knobW > widest ) widest = knobW;
		top += knobH + spaceY;
	}
	/* Add int control
	 */
	ArpIntControl*	intCtrl = 0;
	if( showIntControl ) {
		float		w = (intControlWidth >= 0) ? intControlWidth : knobW;
		intCtrl = new ArpIntControl( BRect(0, top, w, top + Prefs().Size(INT_CTRL_Y) ),
									"int_control", 0, 0);
		if( intCtrl ) {
			intCtrl->SetLimits( minValue, maxValue );
			if( knob ) knob->SetIntControl( intCtrl );
			AddChild( intCtrl );
			if( w > widest ) widest = w;
		}
	}
	/* Now center everything based on the widest view.
	 */
	if( !sv && !intCtrl ) return;
	if( widest <= 0 ) return;

	BView*	view;
	for( view = ChildAt(0); view; view = view->NextSibling() ) {
		BRect	f = view->Frame();
		if( f.Width() < widest )
			view->MoveTo( (widest - f.Width()) / 2, f.top );
	}		
}
Пример #3
0
void ArpKnobPanel::LayoutHorizontal(const char* name, const char* label, BMessage* message,
									int32 minValue, int32 maxValue,
									bool showIntControl, uint32 knobFlags, float labelWidth,
									float intControlWidth)
{
	const BFont*	font = be_plain_font;
	float			fh = arp_get_font_height(font);
	float			spaceX = 8;
	float			left = 0;
	/* Add label
	 */
	BStringView*	sv = 0;
	if( label ) {
		float		w = (labelWidth >= 0) ? labelWidth : font->StringWidth( label );
		sv = new BStringView(	BRect( left, 0, left + w, 0 + fh ),
								"label", label );
		if( sv ) AddChild( sv );
		left += w + spaceX;
	}
	/* Add knob
	 */
	float			knobW, knobH;
	if( knobFlags&ARP_RING_ADORNMENT ) {
		knobW = Prefs().Size(KNOB_RING_X);
		knobH = Prefs().Size(KNOB_RING_Y);
	} else if( knobFlags&ARP_TIGHT_RING_ADORNMENT ) {
		knobW = Prefs().Size(KNOB_RING_TIGHT_X);
		knobH = Prefs().Size(KNOB_RING_TIGHT_Y);
	} else {
		knobW = Prefs().Size(KNOB_X);
		knobH = Prefs().Size(KNOB_Y);
	}
	ArpKnobControl* knob = new ArpKnobControl(	BRect(left, 0, left + knobW, 0 + knobH ),
												name, message, minValue, maxValue, knobFlags);
	if( knob ) {
		AddChild( knob );
		left += knobW + spaceX;
	}
	/* Add int control
	 */
	ArpIntControl*	intCtrl = 0;
	if( showIntControl ) {
		float		w = (intControlWidth >= 0) ? intControlWidth : knobW;
		intCtrl = new ArpIntControl( BRect(left, 0, left + w, 0 + Prefs().Size(INT_CTRL_Y) ),
									"int_control", 0, 0);
		if( intCtrl ) {
			intCtrl->SetLimits( minValue, maxValue );
			if( knob ) knob->SetIntControl( intCtrl );
			AddChild( intCtrl );
		}
	}
	/* Now center everything based on the tallest view.
	 */
	if( !sv && !intCtrl ) return;
	float	tallest = (knobH > fh) ? knobH : fh;

	BView*	view;
	for( view = ChildAt(0); view; view = view->NextSibling() ) {
		BRect	f = view->Frame();
		if( f.Height() < tallest )
			view->MoveTo( f.left, (tallest - f.Height()) / 2 );
	}		
}
Пример #4
0
float PBox::BuildGUI(BMessage viewTemplate, BMessage settings, BView *view) {
	
	BMessage curr;
	float yOffset = kEdgeOffset + kControlOffset;
	float xOffset = 0;
	
	const float kControlWidth = view->Bounds().Width() - (kEdgeOffset * 2);
	
	BMessage postAdded;
	
	for (int i=0; viewTemplate.FindMessage("setting",i,&curr) == B_OK; i++ ) {
		char temp[512];
		
		// get text etc from template
		const char * name = curr.FindString("name");
		const char * desc = curr.FindString("description");
		const char * value = NULL;
		int32 type = -1;
		bool secret = false;
		bool freeText = true;
		bool multiLine = false;
		BView *control = NULL;
		BMenu *menu = NULL;
		BMessage* enabling = NULL;
		
		if ( name != NULL && strcmp(name,"app_sig") == 0 ) {
			// skip app-sig setting
			continue;
		}
		
		if (curr.FindInt32("type", &type) != B_OK) {
			printf("Error getting type for %s, skipping\n", name);
			continue;
		};
		
		switch (type) {
			case B_STRING_TYPE: {
				if (curr.FindString("valid_value")) {
					// It's a "select one of these" setting
					
					freeText = false;
			
					menu = new BPopUpMenu(name);
//					menu->SetDivider(be_plain_font->StringWidth(name) + 10);
					
					for (int j = 0; curr.FindString("valid_value", j); j++) {
						menu->AddItem(new BMenuItem(curr.FindString("valid_value", j),NULL));
					};
					
					value = NULL;
					value = curr.FindString("default");
					if (value && menu->FindItem(value)) menu->FindItem(value)->SetMarked(true);
					
					value = settings.FindString(name);
					if (value && menu->FindItem(value)) menu->FindItem(value)->SetMarked(true);
					
				} else {
					// It's a free-text setting
					
					if (curr.FindBool("multi_line", &multiLine) != B_OK) multiLine = false;
					value = settings.FindString(name);
					if (!value) value = curr.FindString("default");
					if (curr.FindBool("is_secret",&secret) != B_OK) secret = false;
				}
			} break;
			case B_INT32_TYPE: {
				if (curr.FindInt32("valid_value")) {
					// It's a "select one of these" setting
					
					freeText = false;
					
					menu = new BPopUpMenu(name);
					
					int32 v = 0;
					for ( int j = 0; curr.FindInt32("valid_value",j,&v) == B_OK; j++ ) {
						sprintf(temp,"%ld", v);
						menu->AddItem(new BMenuItem(temp, NULL));
					};
					
					if ( curr.FindInt32("default",&v) == B_OK ) {
						sprintf(temp,"%ld",v);
						value = temp;
						menu->FindItem(value)->SetMarked(true);
					}
					
					if ( settings.FindInt32(name,&v) == B_OK ) {
						sprintf(temp,"%ld",v);
						value = temp;
						menu->FindItem(value)->SetMarked(true);
					}
					
					
				} else {
					// It's a free-text (but number) setting
					int32 v = 0;
					if (settings.FindInt32(name,&v) == B_OK) {
						sprintf(temp,"%ld",v);
						value = temp;
					} else if ( curr.FindInt32("default",&v) == B_OK ) {
						sprintf(temp,"%ld",v);
						value = temp;
					}
					if (curr.FindBool("is_secret",&secret) != B_OK) secret = false;
				}
			} break;
			case B_BOOL_TYPE: {
				bool active;
				
				if (settings.FindBool(name, &active) != B_OK) {
					if (curr.FindBool("default", &active) != B_OK) {
						active = false;
					};
				};
				
				for (int j = 0; curr.FindString("enable_control", j); j++) {
						if(!enabling) enabling = new BMessage('enab');
						enabling->AddString("enable_control",curr.FindString("enable_control",j) );
						if(!active) postAdded.AddString("disable",curr.FindString("enable_control", j));
				};
					
				control = new BCheckBox(BRect(0, 0, kControlWidth, fFontHeight),
					name, _T(desc), enabling);
			
				if (active) ((BCheckBox*)control)->SetValue(B_CONTROL_ON);
				
			} break;			
			default: {
				continue;
			};
		};
		
		if (!value) value = "";
		
		if (!control) {
			if (freeText) {
				if (multiLine == false) {
					control = new BTextControl(
						BRect(0, 0, kControlWidth, fFontHeight), name,
						_T(desc), value, NULL);
					if (secret) {
						((BTextControl *)control)->TextView()->HideTyping(true);
						((BTextControl *)control)->SetText(_T(value));
					};
					((BTextControl *)control)->SetDivider(kDividerWidth);
				} else 
				{
					BRect rect;
					BRect textRect;
					if (desc) //andrea: add description only if available.
					{
						BRect labelRect(0, 0, kDividerWidth, fFontHeight);
						BStringView *label = new BStringView(labelRect, "NA", _T(desc),
							B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
						view->AddChild(label);
						label->MoveTo(kEdgeOffset, yOffset);

						rect = BRect(0, 0, kControlWidth - kDividerWidth, fFontHeight * 4);
						rect.right -= B_V_SCROLL_BAR_WIDTH + kEdgeOffset + kControlOffset;
						xOffset = kEdgeOffset + kDividerWidth;
					}
					else
					{
						rect = BRect(0, 0, kControlWidth, fFontHeight * 4);
						rect.right -= B_V_SCROLL_BAR_WIDTH + kControlOffset;
						xOffset = 0;
					}
					
					textRect = rect;
					textRect.InsetBy(kEdgeOffset, kEdgeOffset);
					textRect.OffsetTo(1.0, 1.0);
						
					BTextView *textView = new BTextView(rect, name, textRect,
						B_FOLLOW_ALL_SIDES, B_WILL_DRAW);

					control = new BScrollView("NA", textView, B_FOLLOW_ALL_SIDES,
						B_WILL_DRAW | B_NAVIGABLE, false, true);
					textView->SetText(_T(value));			
				};
			} else {
				control = new BMenuField(BRect(0, 0, kControlWidth, fFontHeight),
					name, _T(desc), menu);
				
				float size=kDividerWidth;
				if(control->StringWidth(_T(desc)) > kDividerWidth)
					size=control->StringWidth(_T(desc)) + 20;
				
				((BMenuField *)control)->SetDivider(size);
			};
		};
		
		
		view->AddChild(control);
		
		if(enabling)
			 ((BCheckBox*)control)->SetTarget(this);
					
		float h, w = 0;
		control->GetPreferredSize(&w, &h);
		
		if (h < control->Bounds().Height()) 
			h = control->Bounds().Height();
			
		control->MoveTo(kEdgeOffset + xOffset, yOffset);
		yOffset += kControlOffset + h ;
		xOffset = 0;
	};

	for (int j = 0; postAdded.FindString("disable", j); j++) 
	{
			const char* name=postAdded.FindString("disable", j);
			BView*	viewz=view->FindView(name);
			if(viewz)
				((BControl*)viewz)->SetEnabled(false);
			
	}
	
	//if ( yOffset < view->Bounds().Height() )
	//	yOffset = view->Bounds().Height();
	
	return yOffset;//view->ResizeTo( view->Bounds().Width(), yOffset 
}
Пример #5
0
void SeqSplitterView::MouseMoved(	BPoint where,
									uint32 code,
									const BMessage* message)
{
	if (code == B_ENTERED_VIEW) {
		if (mDirection == B_VERTICAL && gVrtCursor) SetViewCursor(gVrtCursor);
		if (mDirection == B_HORIZONTAL && gHrzCursor) SetViewCursor(gHrzCursor);
	}
	if( !mMouseDown || !Window() || !Window()->CurrentMessage() ) return;
	BView*	prev = PreviousSibling();
	BView*	next = NextSibling();
	if( !prev || !next ) return;
	
	// The mouse moved message's "where" field is in window
	// coordinates.  We need to use that instead of view
	// coordinates because the changes in this view's frame
	// are asynchronous with the mouse events we receive.
	BPoint	screenWhere;
	Window()->CurrentMessage()->FindPoint("where", &screenWhere);
	Window()->ConvertToScreen(&screenWhere);
	BPoint	delta = screenWhere - mPointDown;
	
	bool	locked = false;
//printf("recived mouse of %f\n", where.x);

if( Window() && Window()->Lock() ) {
	locked = true;
	Window()->BeginViewTransaction();
}
	if( mDirection == B_VERTICAL ) {
		/* Move me
		 */
		float	prevLeft = prev->Frame().left;
		float	nextRight = next->Frame().right;
		float	x = mFrameDown.left + delta.x;
		float	y = mFrameDown.top;
		if( x < prevLeft ) x = prevLeft;
		if( x + Bounds().Width() > nextRight ) x = nextRight - Bounds().Width();
		MoveTo( x, y );
		/* Move prev
		 */
		float	height = prev->Bounds().Height();
		float	prevRight = Frame().left - 1;
		prev->ResizeTo( prevRight - prevLeft, height );
		/* Move next
		 */
		height = next->Bounds().Height();
		float	nextTop = next->Frame().top;
		float	nextLeft = Frame().right + 1;
//printf("\tsending out move to %f\n", nextLeft);
		BRect	f = next->Frame();
		if( f.left != nextLeft ) next->MoveTo( nextLeft, nextTop );
		if( f.Width() != nextRight - nextLeft ) next->ResizeTo( nextRight - nextLeft, height );
#if 0
		next->MoveTo( nextLeft, nextTop );
		next->ResizeTo( nextRight - nextLeft, height );
#endif
	} else {
		/* Move me
		 */
		float	prevTop = prev->Frame().top;
		float	nextBottom = next->Frame().bottom;
		float	x = mFrameDown.left;
		float	y = mFrameDown.top + delta.y;
		if( y < prevTop ) y = prevTop;
		if( y + Bounds().Height() > nextBottom ) y = nextBottom - Bounds().Height();
		MoveTo( x, y );
		/* Move prev
		 */
		float	width = prev->Bounds().Width();
		float	prevBottom = Frame().top - 1;
		prev->ResizeTo( width, prevBottom - prevTop );
		/* Move next
		 */
		width = next->Bounds().Width();
		float	nextLeft = next->Frame().left;
		float	nextTop = Frame().bottom + 1;
		next->MoveTo( nextLeft, nextTop );
		next->ResizeTo( width, nextBottom - nextTop );
	}
if( locked ) {
	Window()->EndViewTransaction();
	Window()->Unlock();
}
}
Пример #6
0
//ctor
SpecificColorWindow	::	SpecificColorWindow(	BRect paramBound,
												uint32 paramkind)
				: 
				ScrollingWindow(	paramBound, 
									myPrefs->lvwTitleStr[paramkind], 
									lScrollViewName[paramkind],
									lNamePrefFrame[paramkind],
									myPrefs->mpPreferenceSet,
									true,
									false),
				mui32Kind(paramkind),
				mpViewColorControl(NULL),
				mpHighColorControl(NULL),
				mpLowColorControl(NULL),
				mpBarColorControl(NULL),
				mpFillColorControl(NULL),
				mpViewColorWell(NULL),
				mpHighColorWell(NULL),
				mpLowColorWell(NULL),
				mpBarColorWell(NULL),
				mpFillColorWell(NULL),
				mpBarHeightGadget(NULL),
				mpColorWellWidthGadget(NULL),
				mpColorWellHeightGadget(NULL),
				mpThumbRadioView(NULL),
				mpCCLrv(NULL),
				mpSliderBarCB(NULL),
				mpSliderBarFillCB(NULL),
				mpDemoItem(NULL)
{
	sem_id calc_sem;
	if ((calc_sem = create_sem(1, "calc_sem")) < B_NO_ERROR)
	{
		warning(myPrefs->FailCreateSemaphore);
		return;
	}
	acquire_sem(calc_sem);
	try 
	{
		LayoutMatrix *	pholdTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
/////////////////////////////////////////////////////////////////////////////////////////////
		BFont * pBFont = new BFont(myPrefs->GetPreferredFont());
		float fontSize = pBFont->Size();
		fontSize *= 2;
		if (fontSize > 200)
		{
			fontSize = 200;
		}
		pBFont->SetSize(fontSize);
		pBFont->SetShear(122);
		//will need offset for demo--use a seperate matrix and get it's bottom
		MyStringDrawer * pMyStringDrawer = new MyStringDrawer(	"specificTitleMyStringDrawer", 
																myPrefs->lvwTitleStr[mui32Kind],
																pholdTitleLayoutMatrix, 
																pBFont);
/////////////////////////////
		if (!myPrefs->mbUseColorControl && !myPrefs->mbUseColorWell)
		{
			warning(myPrefs->noCCenabled);
		}
		LayoutMatrix * pholdViewCCLayoutMatrix = NULL;
		LayoutMatrix * pholdHighCCLayoutMatrix = NULL;
		LayoutMatrix * pholdLowCCLayoutMatrix = NULL;
		MyStringDrawer * pMyStringDrawerAXX = NULL;
		MyStringDrawer * pMyStringDrawerBXX = NULL;
		MyStringDrawer * pMyStringDrawerCXX = NULL;
		rgb_color color;//re-use for every setvalue
		if (myPrefs->mbUseColorControl)
		{
			pholdViewCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	/////////////////////////////////////////////////////////////////////////////////////
			pMyStringDrawerAXX = new MyStringDrawer(	"MyStringDrawerAXX", 
														myPrefs->ColorWindowHeading2, 
														pholdViewCCLayoutMatrix);
	////////////////////////////////////////////////////////////////////
			mpViewColorControl = new MyColorControl(	myPrefs->mCCL,
														"ColorControlAXX", 
														COLORCONTROL_VIEW,
														pholdViewCCLayoutMatrix);
			switch (mui32Kind)
			{
				case SPECIFIC_COLOR_BUTTON:
					myPrefs->GetPreferredMyButtonViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_PICTURE:
					myPrefs->GetPreferredMyPictureButtonViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_RADIOVIEW:
					myPrefs->GetPreferredMyRadioViewViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_CHECKBOX:
					myPrefs->GetPreferredMyCheckBoxViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STATUSBAR:
					myPrefs->GetPreferredMyStatusBarViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_SLIDER:
					myPrefs->GetPreferredMySliderViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_COLORCONTROL:
					myPrefs->GetPreferredMyColorControlViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_TEXTVIEW:
					myPrefs->GetPreferredMyTextViewViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_LISTVIEW:
					myPrefs->GetPreferredMyListViewViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT32CONTROL:
					myPrefs->GetPreferredUInt32ControlViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT8GADGET:
					myPrefs->GetPreferredInt8GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT8GADGET:
					myPrefs->GetPreferredUInt8GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT16GADGET:
					myPrefs->GetPreferredInt16GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT16GADGET:
					myPrefs->GetPreferredUInt16GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT32GADGET:
					myPrefs->GetPreferredInt32GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT32GADGET:
					myPrefs->GetPreferredUInt32GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT64GADGET:
					myPrefs->GetPreferredInt64GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT64GADGET:
					myPrefs->GetPreferredUInt64GadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_FLOATGADGET:
					myPrefs->GetPreferredFloatGadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGGADGET:
					myPrefs->GetPreferredStringGadgetViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_FLOATCONTROL:
					myPrefs->GetPreferredFloatControlViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGCONTROL:
					myPrefs->GetPreferredStringControlViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_COLORWELL:
					myPrefs->GetPreferredColorWellViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGDRAWER:
					myPrefs->GetPreferredMyStringDrawerViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				default:
					warning(myPrefs->BadSpecColorKindView);
					throw;
				break;
			}
	/////////////////////
			pholdHighCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	////////////////////////////////
			pMyStringDrawerBXX = new MyStringDrawer(	"MyStringDrawerBXX", 
														myPrefs->ColorWindowHeading3, 
														pholdHighCCLayoutMatrix);
	/////////////////////////////////////////////
			mpHighColorControl = new MyColorControl(	myPrefs->mCCL,
														"HighColorControlBXX", 
														COLORCONTROL_HIGH,
														pholdHighCCLayoutMatrix);
			switch (mui32Kind)
			{
				case SPECIFIC_COLOR_BUTTON:
					myPrefs->GetPreferredMyButtonHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_PICTURE:
					myPrefs->GetPreferredMyPictureButtonHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_RADIOVIEW:
					myPrefs->GetPreferredMyRadioViewHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_CHECKBOX:
					myPrefs->GetPreferredMyCheckBoxHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STATUSBAR:
					myPrefs->GetPreferredMyStatusBarHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_SLIDER:
					myPrefs->GetPreferredMySliderHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_COLORCONTROL:
					myPrefs->GetPreferredMyColorControlHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_TEXTVIEW:
					myPrefs->GetPreferredMyTextViewHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_LISTVIEW:
					myPrefs->GetPreferredMyListViewHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT32CONTROL:
					myPrefs->GetPreferredUInt32ControlHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT8GADGET:
					myPrefs->GetPreferredInt8GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT8GADGET:
					myPrefs->GetPreferredUInt8GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT16GADGET:
					myPrefs->GetPreferredInt16GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT16GADGET:
					myPrefs->GetPreferredUInt16GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT32GADGET:
					myPrefs->GetPreferredInt32GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT32GADGET:
					myPrefs->GetPreferredUInt32GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT64GADGET:
					myPrefs->GetPreferredInt64GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT64GADGET:
					myPrefs->GetPreferredUInt64GadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_FLOATGADGET:
					myPrefs->GetPreferredFloatGadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGGADGET:
					myPrefs->GetPreferredStringGadgetHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_FLOATCONTROL:
					myPrefs->GetPreferredFloatControlHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGCONTROL:
					myPrefs->GetPreferredStringControlHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_COLORWELL:
					myPrefs->GetPreferredColorWellHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGDRAWER:
					myPrefs->GetPreferredMyStringDrawerHighColor(&color);
					mpHighColorControl->SetValue(color);
				break;
				default:
					warning(myPrefs->BadSpecColorKindHigh);
					throw;
				break;
			}
	//////////////////////////////////////////////////////////////
			pholdLowCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	///////////////////////////////////////////////////
			pMyStringDrawerCXX = new MyStringDrawer(	"MyStringDrawerCXX", 
														myPrefs->ColorWindowHeading4, 
														pholdLowCCLayoutMatrix);
	///////////////////////////////////////////////////////////////////
			mpLowColorControl = new MyColorControl(	myPrefs->mCCL,
													"LowColorControlCXX", 
													COLORCONTROL_LOW,
													pholdLowCCLayoutMatrix);
			switch (mui32Kind)
			{
				case SPECIFIC_COLOR_BUTTON:
					myPrefs->GetPreferredMyButtonLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_PICTURE:
					myPrefs->GetPreferredMyPictureButtonLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_RADIOVIEW:
					myPrefs->GetPreferredMyRadioViewLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_CHECKBOX:
					myPrefs->GetPreferredMyCheckBoxLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STATUSBAR:
					myPrefs->GetPreferredMyStatusBarLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_SLIDER:
					myPrefs->GetPreferredMySliderLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_COLORCONTROL:
					myPrefs->GetPreferredMyColorControlLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_TEXTVIEW:
					myPrefs->GetPreferredMyTextViewLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_LISTVIEW:
					myPrefs->GetPreferredMyListViewLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT32CONTROL:
					myPrefs->GetPreferredUInt32ControlLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT8GADGET:
					myPrefs->GetPreferredInt8GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT8GADGET:
					myPrefs->GetPreferredUInt8GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT16GADGET:
					myPrefs->GetPreferredInt16GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT16GADGET:
					myPrefs->GetPreferredUInt16GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT32GADGET:
					myPrefs->GetPreferredInt32GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT32GADGET:
					myPrefs->GetPreferredUInt32GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_INT64GADGET:
					myPrefs->GetPreferredInt64GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_UINT64GADGET:
					myPrefs->GetPreferredUInt64GadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_FLOATGADGET:
					myPrefs->GetPreferredFloatGadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGGADGET:
					myPrefs->GetPreferredStringGadgetLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_FLOATCONTROL:
					myPrefs->GetPreferredFloatControlLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGCONTROL:
					myPrefs->GetPreferredStringControlLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_COLORWELL:
					myPrefs->GetPreferredColorWellLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STRINGDRAWER:
					myPrefs->GetPreferredMyStringDrawerLowColor(&color);
					mpLowColorControl->SetValue(color);
				break;
				default:
					warning(myPrefs->BadSpecColorKindLow);
					throw;
				break;
			}
		}
////////////////////////
		LayoutMatrix * pholdColorWellLayoutMatrix = NULL;
		if (myPrefs->mbUseColorWell)
		{
			pholdColorWellLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 3, this);//rows,columns
	//////////////
			mpViewColorWell = new ColorWell(	"ColorWellViewColorPref", 
												VIEW_COLOR,
												myPrefs->ColorWindowHeading5,
												this,
												pholdColorWellLayoutMatrix);
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			mpHighColorWell = new ColorWell(	"ColorWellHighColorPref", 
												HIGH_COLOR,
												myPrefs->ColorWindowHeading6,
												this,
												pholdColorWellLayoutMatrix);
	////////////////////////////////////////////////////////////////////////////////////////////////////
			mpLowColorWell = new ColorWell(	"ColorWellLowColorPref", 
											LOW_COLOR,
											myPrefs->ColorWindowHeading7,
											this,
											pholdColorWellLayoutMatrix);
		}
///////////////////////////////////////////////////////////////////////
		LayoutMatrix * pholdDemoLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
//////////////////////////////////
		int32 kindDemo;
		void * pholdDemo;
		switch (mui32Kind)
		{
			case SPECIFIC_COLOR_BUTTON:
			{
				MyButton * pholdDemoMyButton = new MyButton(	"demoButton", 
																myPrefs->DemoButtonLabel, 
																DEMOBUTTONMSG,
																pholdDemoLayoutMatrix);
				kindDemo = KIND_MYBUTTON;
				pholdDemo = (void *)pholdDemoMyButton;
			}
			break;
			case SPECIFIC_COLOR_PICTURE:
			{
				BPicture * pOnPicture;
				BPicture * pOnDisabledPicture;
				BPicture * pOffPicture;
				BPicture * pOffDisabledPicture;
				BWindow * bWindow = new BWindow(	BRect(0, 0, 32, 32), //manditory for BPicture
													NULL, 
													B_DOCUMENT_WINDOW, 
													0);
				BView * bView = new BView(	BRect(0, 0, 32, 32), 
											NULL, 
											B_FOLLOW_NONE, 
											0);
//				BWindow bWindow(	BRect(0, 0, 32, 32), //manditory for BPicture
//									NULL, 
//									B_DOCUMENT_WINDOW, 
//									0);
//				BView bView(	BRect(0, 0, 32, 32), 
//								NULL, 
//								B_FOLLOW_NONE, 
//								0);
				bWindow->AddChild(bView);
				bView->BeginPicture(new BPicture);
				bView->MoveTo(5, 5);
				bView->StrokeRect(BRect(0,0,8,8));
				pOffPicture = bView->EndPicture();
				
				bView->BeginPicture(new BPicture);
				bView->MoveTo(10, 5);
				bView->StrokeRect(BRect(0,0,10,15));
				pOnPicture = bView->EndPicture();
				
				bView->BeginPicture(new BPicture);
				bView->MoveTo(2, 5);
				bView->FillRect(BRect(0,0,22,20));
				pOffDisabledPicture = bView->EndPicture();
				
				bView->BeginPicture(new BPicture);
				bView->MoveTo(1, 5);
				bView->FillRect(BRect(0,0,6,15));
				pOnDisabledPicture = bView->EndPicture();
				//bView.RemoveSelf();
				bWindow->Run();
				bWindow->PostMessage(B_QUIT_REQUESTED);
				MyPictureButton * pholdDemoMyPictureButton = new MyPictureButton(	BRect(0, 0, 32, 32),
																					"DemoPictureButton", 
																					pOffPicture,
																					pOnPicture,
																					pOffDisabledPicture,
																					pOnDisabledPicture,
																					DEMOPICTUREBUTTONMSG,
																					B_TWO_STATE_BUTTON,//B_ONE_STATE_BUTTON
																					pholdDemoLayoutMatrix);
				kindDemo = KIND_MYPICTUREBUTTON;
				pholdDemo = (void *)pholdDemoMyPictureButton;
			}
			break;
			case SPECIFIC_COLOR_RADIOVIEW:
			{
				BList * pBList = new BList();
				RadioViewData * pRadioViewDataOne = new RadioViewData(	'_one',
																		myPrefs->DemoRadio1Label,
																		pBList);
				RadioViewData * pRadioViewDataTwo = new RadioViewData(	'_two',
																		myPrefs->DemoRadio2Label,
																		pBList);
				RadioViewData * pRadioViewDataThree = new RadioViewData(	'thre',
																			myPrefs->DemoRadio3Label,
																			pBList);
				MyRadioView * pholdMyRadioView = new MyRadioView(	"demoRadio",
																	false,//true gives vertical orientation
																	pBList,
																	myPrefs->GetPreferredFont(),
																	pholdDemoLayoutMatrix);
				if (!pholdMyRadioView->Initialize())
				{
					warning(myPrefs->RadioViewFailInit);
					throw;
				}
				kindDemo = KIND_MYRADIOVIEW;
				pholdDemo = (void *)pholdMyRadioView;
			}
			break;
			case SPECIFIC_COLOR_CHECKBOX:
			{
				MyCheckBox * pholdCheckBox = new MyCheckBox(	"checkBox", 
																myPrefs->DemoCheckBoxLabel, 
																B_CONTROL_ON,
																'_one',
																pholdDemoLayoutMatrix);
				kindDemo = KIND_MYCHECKBOX;
				pholdDemo = (void *)pholdCheckBox;
			}
			break;
			case SPECIFIC_COLOR_STATUSBAR:
			{
				MyStatusBar * pholdStatusBar = new MyStatusBar(	"StatusBar", 
																myPrefs->DemoStatusBarLeadLabel, 
																myPrefs->DemoStatusBarTrailLabel,
																50,
																10.0,
																pholdDemoLayoutMatrix);
				kindDemo = KIND_MYSTATUSBAR;
				pholdDemo = (void *)pholdStatusBar;
			}
			break;
			case SPECIFIC_COLOR_SLIDER:
			{
				MySlider * pholdSlider = new MySlider(	BRect(1, 1, 65, 32), 
														"Slider",
														"Label",
														'Sldr',
														1,
														10,
														.5,
														pholdDemoLayoutMatrix);
				kindDemo = KIND_MYSLIDER;
				pholdDemo = (void *)pholdSlider;
			}
			break;
			case SPECIFIC_COLOR_COLORCONTROL:
			{
				MyColorControl * pholdColorControl = new MyColorControl(	myPrefs->mCCL,
																			"ColorControl", 
																			DEMOCOLORCONTROLMSG,
																			pholdDemoLayoutMatrix);
			
				kindDemo = KIND_MYCOLORCONTROL;
				pholdDemo = (void *)pholdColorControl;
			}
			break;
			case SPECIFIC_COLOR_TEXTVIEW:
			{
				float leftOffset;
				float baseline;
				float width;
				float height;
				if (!StringBoundsBox(	myPrefs->TextGadgetLabel,
										&width,
										&height,
										&leftOffset,
										&baseline))
				{
					throw;
				}
				MyTextView * pholdTextView = new MyTextView(	"textView", 
																NULL, 
																width,
																6 * height,//allow 6 lines visible
																pholdDemoLayoutMatrix);
				rgb_color textColor;
				myPrefs->GetPreferredMyTextViewHighColor(&textColor);
				pholdTextView->SetFontAndColor(myPrefs->GetPreferredFont(), B_FONT_ALL, &textColor);
				pholdTextView->SetText(myPrefs->TextGadgetLabel);
				kindDemo = KIND_MYTEXTVIEW;
				pholdDemo = (void *)pholdTextView;
			}
			break;
			case SPECIFIC_COLOR_LISTVIEW:
			{
				DataList * dataList = new DataList();
				DataNode * nodeOne = new DataNode(myPrefs->ListViewSample1);
				dataList->AddItem(nodeOne);
				DataNode * nodeTwo = new DataNode(myPrefs->ListViewSample2);
				dataList->AddItem(nodeTwo);
				DataNode * nodeThree = new DataNode(myPrefs->ListViewSample3);
				dataList->AddItem(nodeThree);
				MyListView * mlv = new MyListView(	"mlvTitle",
													dataList,
													'selc',
													'invc',
													B_SINGLE_SELECTION_LIST,
													pholdDemoLayoutMatrix);
				kindDemo = KIND_MYLISTVIEW;
				pholdDemo = (void *)mlv;
			}
			break;
			case SPECIFIC_COLOR_INT8GADGET:
			{
				Int8Gadget * pholdInt8Gadget = new Int8Gadget(	MIN_I8,
																"int8Gadget",
																myPrefs->GetInt8GadgetLabel,
																0,
																this,
																pholdDemoLayoutMatrix);
				kindDemo = KIND_INT8GADGET;
				pholdDemo = (void *)pholdInt8Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterIntNumeric);
				pholdInt8Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_UINT8GADGET:
			{
				UInt8Gadget * pholdUInt8Gadget = new UInt8Gadget(	MAX_UI8,
																	"uInt8Gadget",
																	myPrefs->GetUInt8GadgetLabel,
																	0,
																	this,
																	pholdDemoLayoutMatrix);
				kindDemo = KIND_UINT8GADGET;
				pholdDemo = (void *)pholdUInt8Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterUIntNumeric);
				pholdUInt8Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_INT16GADGET:
			{
				Int16Gadget * pholdInt16Gadget = new Int16Gadget(	MIN_I16,
																	"int16Gadget",
																	myPrefs->GetInt16GadgetLabel,
																	0,
																	this,
																	pholdDemoLayoutMatrix);
				kindDemo = KIND_INT16GADGET;
				pholdDemo = (void *)pholdInt16Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterIntNumeric);
				pholdInt16Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_UINT16GADGET:
			{
				UInt16Gadget * pholdUInt16Gadget = new UInt16Gadget(	MAX_UI16,
																		"uInt16Gadget",
																		myPrefs->GetUInt16GadgetLabel,
																		0,
																		this,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_UINT16GADGET;
				pholdDemo = (void *)pholdUInt16Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterUIntNumeric);
				pholdUInt16Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_INT32GADGET:
			{
				Int32Gadget * pholdInt32Gadget = new Int32Gadget(	MIN_I32,
																	"int32Gadget",
																	myPrefs->GetInt32GadgetLabel,
																	0,
																	this,
																	pholdDemoLayoutMatrix);
				kindDemo = KIND_INT32GADGET;
				pholdDemo = (void *)pholdInt32Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterIntNumeric);
				pholdInt32Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_UINT32GADGET:
			{
				UInt32Gadget * pholdUInt32Gadget = new UInt32Gadget(	MAX_UI32,
																		"uInt32Gadget",
																		myPrefs->GetUInt32GadgetLabel,
																		0,
																		this,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_UINT32GADGET;
				pholdDemo = (void *)pholdUInt32Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterUIntNumeric);
				pholdUInt32Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_INT64GADGET:
			{
				Int64Gadget * pholdInt64Gadget = new Int64Gadget(	MIN_I64,
																	"int64Gadget",
																	myPrefs->GetInt64GadgetLabel,
																	0,
																	this,
																	pholdDemoLayoutMatrix);
				kindDemo = KIND_INT64GADGET;
				pholdDemo = (void *)pholdInt64Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterIntNumeric);
				pholdInt64Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_UINT64GADGET:
			{
				UInt64Gadget * pholdUInt64Gadget = new UInt64Gadget(	MAX_UI64,
																		"uInt64Gadget",
																		myPrefs->GetUInt64GadgetLabel,
																		0,
																		this,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_UINT64GADGET;
				pholdDemo = (void *)pholdUInt64Gadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterUIntNumeric);
				pholdUInt64Gadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_FLOATGADGET:
			{
				FloatGadget * pholdFloatGadget = new FloatGadget(	(float)12.34,
																	"floatGadget",
																	myPrefs->GetFloatGadgetLabel,
																	0,
																	this,
																	pholdDemoLayoutMatrix);
				kindDemo = KIND_FLOATGADGET;
				pholdDemo = (void *)pholdFloatGadget;
				BMessageFilter * bmfDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																B_LOCAL_SOURCE, 
																'_KYD', 
																filterFloatNumeric);
				pholdFloatGadget->AddFilter(bmfDemo);
			}
			break;
			case SPECIFIC_COLOR_STRINGGADGET:
			{
				StringGadget * pholdStringGadget = new StringGadget(	myPrefs->GetStringGadgetLabel,
																		"stringGadget",
																		myPrefs->GetStringGadgetLabel,
																		0,
																		this,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_STRINGGADGET;
				pholdDemo = (void *)pholdStringGadget;
			}
			break;
			case SPECIFIC_COLOR_UINT32CONTROL:
			{
				UInt32Control * pholdUInt32Control = new UInt32Control(	123,
																		"uInt32Control", 
																		myPrefs->UInt32ControlLabel, 
																		DEMOINTCONTROLMSG,
																		0,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_UINT32CONTROL;
				pholdDemo = (void *)pholdUInt32Control;
			}
			break;
			case SPECIFIC_COLOR_FLOATCONTROL:
			{
				FloatControl * pholdFloatControl = new FloatControl(	(float)1.23,
																		"floatControl", 
																		myPrefs->FloatControlLabel, 
																		DEMOFLOATCONTROLMSG,
																		0,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_FLOATCONTROL;
				pholdDemo = (void *)pholdFloatControl;
			}
			break;
			case SPECIFIC_COLOR_STRINGCONTROL:
			{
				StringControl * pholdStringControl = new StringControl(	"stringControlName", 
																		myPrefs->StringControlLabel, 
																		NULL, 
																		DEMOSTRINGCONTROLMSG,
																		0,
																		pholdDemoLayoutMatrix);
				kindDemo = KIND_STRINGCONTROL;
				pholdDemo = (void *)pholdStringControl;
			}
			break;
			case SPECIFIC_COLOR_COLORWELL:
			{
				ColorWell * pholdColorWell = new ColorWell(	"colorWell", 
															NO_COLOR,
															myPrefs->DemoRoLabel,
															this,
															pholdDemoLayoutMatrix);
				kindDemo = KIND_COLORWELL;
				pholdDemo = (void *)pholdColorWell;
			}
			break;
			case SPECIFIC_COLOR_STRINGDRAWER:
			{
				MyStringDrawer * pholdMyStringDrawer = new MyStringDrawer(	"stringDrawer", 
																			myPrefs->DemoTextItemText, 
																			pholdDemoLayoutMatrix);
				kindDemo = KIND_STRINGDRAWER;
				pholdDemo = (void *)pholdMyStringDrawer;
			}
			break;
			default:
				warning(myPrefs->BadSpecItemKind);
				throw;
			break;
		}
		mpDemoItem = pholdDemo;
/////////////////////
		LayoutMatrix *	pholdBarTitleLayoutMatrix = NULL;
		LayoutMatrix *	pholdBarCCLayoutMatrix = NULL;
		LayoutMatrix * pholdBarCWLayoutMatrix = NULL;
		LayoutMatrix * pholdBarHLayoutMatrix = NULL;
		LayoutMatrix * pholdColorWellWHLayoutMatrix = NULL;
		LayoutMatrix * pholdSliderLayoutMatrix = NULL;
		LayoutMatrix * pholdFillCCLayoutMatrix = NULL;
		LayoutMatrix * pholdFillCWLayoutMatrix = NULL;
		LayoutMatrix * pholdCCLLayoutMatrix = NULL;
///////////////////////////
		if (mui32Kind == SPECIFIC_COLOR_STATUSBAR)
		{
			pholdBarTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
////////////////////////////////////////////////////////////////
			BFont * pBFontBar = new BFont(myPrefs->GetPreferredFont());
			float fontSize = pBFontBar->Size();
			fontSize *= 2;
			if (fontSize > 200)
			{
				fontSize = 200;
			}
			pBFontBar->SetSize(fontSize);
			pBFontBar->SetShear(122);
			//will need offset for demo--use a seperate matrix and get it's bottom
			MyStringDrawer * pBarMyStringDrawer = new MyStringDrawer(	"specificTitleBarMyStringDrawer", 
																		myPrefs->BarColorTitle,
																		pholdBarTitleLayoutMatrix, 
																		pBFontBar);
//////////////////////////////////////////////////
			if (myPrefs->mbUseColorControl)
			{
				pholdBarCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	///////////////////////////////////////////////////////////////////////////////////
				MyStringDrawer * pBarMyStringDrawerAXX = new MyStringDrawer(	"BarMyStringDrawerAXX", 
																				myPrefs->BarCCLabel, 
																				pholdBarCCLayoutMatrix);
	////////////////////////////////////////////////////////////////////
				mpBarColorControl = new MyColorControl(	myPrefs->mCCL,
														"barColorControl", 
														BARCOLORCONTROL,
														pholdBarCCLayoutMatrix);
				myPrefs->GetPreferredMyBarStatusColor(&color);
				mpBarColorControl->SetValue(color);
			}
//////////////////////////////////////
			if (myPrefs->mbUseColorWell)
			{
				pholdBarCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
	///////////////////////////////////////////
				mpBarColorWell = new ColorWell(	"ColorWellViewColorPref", 
												BAR_COLOR,
												myPrefs->BarCWLabel,
												this,
												pholdBarCWLayoutMatrix);
			}
///////////////////////////////////////////
			pholdBarHLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
//////////////////////////////////////////////////////////////////////////
			mpBarHeightGadget = new FloatGadget(	myPrefs->GetPreferredBarHeight(),
													"BarHeightFloatGadget", 
													myPrefs->EnterBarHeightLabel,
													0,
													this,
													pholdBarHLayoutMatrix);
				BMessageFilter * bmfBHDemo = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
																	B_LOCAL_SOURCE, 
																	'_KYD', 
																	filterFloatNumeric);
				mpBarHeightGadget->AddFilter(bmfBHDemo);
		}
/////////////////////////////////////////////////////////////////
		else if (mui32Kind == SPECIFIC_COLOR_COLORCONTROL)
		{
			pholdCCLLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
//////////////////////////////////////////////////////////////////////////
			BFont * pCCLFont = new BFont(myPrefs->GetPreferredFont());
			float fontSize = pCCLFont->Size();
			fontSize *= 1.5;
			if (fontSize > 200)
			{
				fontSize = 200;
			}
			pCCLFont->SetSize(fontSize);
			MyStringDrawer * pCCLMyStringDrawer = new MyStringDrawer(	"CCLMyStringDrawer", 
																		myPrefs->ColorControlKind,
																		pholdCCLLayoutMatrix, 
																		pCCLFont);
			BList * bl = new BList();
			RadioViewData * pRVD4x64 = new RadioViewData(	CCL4x64RV,
															myPrefs->CC_4x64_Cell,
															bl,
															(B_CELLS_4x64 == myPrefs->mCCL));
			RadioViewData * pRVD8x32 = new RadioViewData(	CCL8x32RV,
															myPrefs->CC_8x32_Cell,
															bl,
															(B_CELLS_8x32 == myPrefs->mCCL));
			RadioViewData * pRVD16x16 = new RadioViewData(	CCL16x16RV,
															myPrefs->CC_16x16_Cell,
															bl,
															(B_CELLS_16x16 == myPrefs->mCCL));
			RadioViewData * pRVD32x8 = new RadioViewData(	CCL32x8RV,
															myPrefs->CC_32x8_Cell,
															bl,
															(B_CELLS_32x8 == myPrefs->mCCL));
			RadioViewData * pRVD64x4 = new RadioViewData(	CCL64x4RV,
															myPrefs->CC_64x4_Cell,
															bl,
															(B_CELLS_64x4 == myPrefs->mCCL));
			mpCCLrv = new MyRadioView(	"CCLRadioView",
										false,
										bl,
										myPrefs->GetPreferredFont(),
										pholdCCLLayoutMatrix);
			if (!mpCCLrv->Initialize())
			{
				warning(myPrefs->RadioViewFailInit);
				throw;
			}
//////////////////////////////////////////////////////////////////////////
		}
		else if (mui32Kind == SPECIFIC_COLOR_SLIDER)
		{
			pholdBarTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
////////////////////////////////////////////////////////////////
			BFont * pBFontBar = new BFont(myPrefs->GetPreferredFont());
			float fontSize = pBFontBar->Size();
			fontSize *= 2;
			if (fontSize > 200)
			{
				fontSize = 200;
			}
			pBFontBar->SetSize(fontSize);
			pBFontBar->SetShear(122);
			//will need offset for demo--use a seperate matrix and get it's bottom
			MyStringDrawer * pBarMyStringDrawer = new MyStringDrawer(	"specificTitleBarMyStringDrawer", 
																		myPrefs->BarColorTitle,
																		pholdBarTitleLayoutMatrix, 
																		pBFontBar);
//////////////////////////////////////////////////
			if (myPrefs->mbUseColorControl)
			{
				pholdBarCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	///////////////////////////////////////////////////////////////////////////////////
				MyStringDrawer * pBarMyStringDrawerAXX = new MyStringDrawer(	"BarMyStringDrawerAXX", 
																				myPrefs->BarCCLabel, 
																				pholdBarCCLayoutMatrix);
	////////////////////////////////////////////////////////////////////
				mpBarColorControl = new MyColorControl(	myPrefs->mCCL,
														"barColorControl", 
														BARCOLORCONTROL,
														pholdBarCCLayoutMatrix);
				myPrefs->GetPreferredMyBarStatusColor(&color);
				mpBarColorControl->SetValue(color);
			}
//////////////////////////////////////
			if (myPrefs->mbUseColorWell)
			{
				pholdBarCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
	///////////////////////////////////////////
				mpBarColorWell = new ColorWell(	"ColorWellViewColorPref", 
												BAR_COLOR,
												myPrefs->BarCWLabel,
												this,
												pholdBarCWLayoutMatrix);
			}
////////////////////////////////////////
			if (myPrefs->mbUseColorControl)
			{
				pholdFillCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	///////////////////////////////////////////////////////////////////////////////////
				MyStringDrawer * pFillMSD = new MyStringDrawer(	"FillMSD", 
																myPrefs->FillCCLabel, 
																pholdFillCCLayoutMatrix);
	////////////////////////////////////////////////////////////////////
				mpFillColorControl = new MyColorControl(	myPrefs->mCCL,
															"fillColorControl", 
															FILLCOLORCONTROL,
															pholdFillCCLayoutMatrix);
				myPrefs->GetPreferredMyBarFillSliderColor(&color);
				mpFillColorControl->SetValue(color);
			}
//////////////////////////////////////
			if (myPrefs->mbUseColorWell)
			{
				pholdFillCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
	///////////////////////////////////////////
				mpFillColorWell = new ColorWell(	"ColorWellViewColorPref", 
													FILL_COLOR,
													myPrefs->FillCWLabel,
													this,
													pholdFillCWLayoutMatrix);
			}
///////////////////////////////////////////
			pholdSliderLayoutMatrix = new LayoutMatrix(BESTSIZE, 3, 1, this);//rows,columns
//////////////////////////////////////
			mpSliderBarCB = new MyCheckBox(	"SliderBarCheckBox", 
											myPrefs->ColorSliderBarCBLabel,
											myPrefs->mui32ColorSliderBar,
											SLIDERBARCB,
											pholdSliderLayoutMatrix);
			mpSliderBarFillCB = new MyCheckBox(	"SliderBarCheckBoxFill", 
												myPrefs->FillSliderBarCBLabel,
												myPrefs->mui32FillSliderBar,
												SLIDERBARFILLCB,
												pholdSliderLayoutMatrix);
			BList * bl = new BList();
			RadioViewData * pRVDOne = new RadioViewData(	THUMB_RECT,
															myPrefs->DemoRadioLabelThumbRect,
															bl,
															(B_BLOCK_THUMB == myPrefs->GetPreferredThumbStyle()));
			RadioViewData * pRVDTwo = new RadioViewData(	THUMB_TRI,
															myPrefs->DemoRadioLabelThumbTri,
															bl,
															(B_TRIANGLE_THUMB == myPrefs->GetPreferredThumbStyle()));
			mpThumbRadioView = new MyRadioView(	"thumbRadioView",
												true,
												bl,
												myPrefs->GetPreferredFont(),
												pholdSliderLayoutMatrix);
			if (!mpThumbRadioView->Initialize())
			{
				warning(myPrefs->RadioViewFailInit);
				throw;
			}
		}
/////////////////////////////////////////////////////////////////////////////////////
		else if (mui32Kind == SPECIFIC_COLOR_COLORWELL)
		{
			pholdColorWellWHLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
////////////////////////////////////////////////////////////////
			mpColorWellWidthGadget = new UInt8Gadget(	myPrefs->GetPreferredColorWellWidth(),
														"ColorWellWidthGadget",
														myPrefs->EnterColorWellWidthLabel,
														0,
														this,
														pholdColorWellWHLayoutMatrix);
			BMessageFilter * bmfW = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
														B_LOCAL_SOURCE, 
														'_KYD', 
														filterUIntNumeric);
			mpColorWellWidthGadget->AddFilter(bmfW);
//////////////////////////////////////////////////////////////
			mpColorWellHeightGadget = new UInt8Gadget(	myPrefs->GetPreferredColorWellHeight(),
														"ColorWellHeightGadget",
														myPrefs->EnterColorWellHeightLabel,
														0,
														this,
														pholdColorWellWHLayoutMatrix);
			BMessageFilter * bmfH = new BMessageFilter(	B_PROGRAMMED_DELIVERY, 
														B_LOCAL_SOURCE, 
														'_KYD', 
														filterUIntNumeric);
			mpColorWellHeightGadget->AddFilter(bmfH);
////////////////////
		}
/////////////////////////////////////////////////////////////
		release_sem(calc_sem);
		pholdTitleLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, MATRIXVERTICALOFFSET, calc_sem);
		float bottom = pholdTitleLayoutMatrix->mfBottom;
		float right = MATRIXHORIZONTALOFFSET;
		if (myPrefs->mbUseColorControl)
		{
			pholdViewCCLayoutMatrix->Calc(right, bottom, calc_sem);
			pholdHighCCLayoutMatrix->Calc(pholdViewCCLayoutMatrix->mfRight, bottom, calc_sem);
			pholdLowCCLayoutMatrix->Calc(pholdHighCCLayoutMatrix->mfRight, bottom, calc_sem);
			bottom = pholdLowCCLayoutMatrix->mfBottom;
			if (bottom < pholdHighCCLayoutMatrix->mfBottom)
			{
				bottom = pholdHighCCLayoutMatrix->mfBottom;
			}
			if (bottom < pholdViewCCLayoutMatrix->mfBottom)
			{
				bottom = pholdViewCCLayoutMatrix->mfBottom;
			}
			right = pholdLowCCLayoutMatrix->mfRight;
		}
		float cwRight = MATRIXHORIZONTALOFFSET;
		if (myPrefs->mbUseColorWell)
		{
			pholdColorWellLayoutMatrix->Calc(cwRight, bottom, calc_sem);
			bottom = pholdColorWellLayoutMatrix->mfBottom;
			cwRight = pholdColorWellLayoutMatrix->mfRight;
		}
		if (cwRight > right)
		{
			right = cwRight;
		}
		pholdDemoLayoutMatrix->Calc(right, pholdTitleLayoutMatrix->mfBottom, calc_sem);
		if (	(mui32Kind == SPECIFIC_COLOR_STATUSBAR)
				||
				(mui32Kind == SPECIFIC_COLOR_SLIDER))
		{
			pholdBarTitleLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem);
			if (myPrefs->mbUseColorControl)
			{
				pholdBarCCLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, pholdBarTitleLayoutMatrix->mfBottom, calc_sem);
				bottom = pholdBarCCLayoutMatrix->mfBottom;
			}
			if (myPrefs->mbUseColorWell)
			{
				pholdBarCWLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem);
				bottom = pholdBarCWLayoutMatrix->mfBottom;
			}
			float ccRightSB = cwRight;
			float cwRightSB = cwRight;
			if (myPrefs->mbUseColorControl)
			{
				ccRightSB = pholdBarCCLayoutMatrix->mfRight;
			}
			if (myPrefs->mbUseColorWell)
			{
				cwRightSB = pholdBarCWLayoutMatrix->mfRight;
			}
			if (ccRightSB > cwRightSB)
			{
				cwRightSB = ccRightSB;
			}
			if (mui32Kind == SPECIFIC_COLOR_STATUSBAR)
			{
				pholdBarHLayoutMatrix->Calc(cwRightSB, pholdBarTitleLayoutMatrix->mfBottom, calc_sem);
			}
			else //if (mui32Kind == SPECIFIC_COLOR_SLIDER)
			{
				if (myPrefs->mbUseColorControl)
				{
					pholdFillCCLayoutMatrix->Calc(cwRightSB, pholdBarTitleLayoutMatrix->mfBottom, calc_sem);
					bottom = pholdFillCCLayoutMatrix->mfBottom;
				}
				else
				{
					bottom = pholdBarTitleLayoutMatrix->mfBottom;
				}
				if (myPrefs->mbUseColorWell)
				{
					pholdFillCWLayoutMatrix->Calc(cwRightSB, bottom, calc_sem);
				}
				float fccRightSB = cwRightSB;
				float fcwRightSB = cwRightSB;
				if (myPrefs->mbUseColorControl)
				{
					fccRightSB = pholdFillCCLayoutMatrix->mfRight;
				}
				if (myPrefs->mbUseColorWell)
				{
					fcwRightSB = pholdFillCWLayoutMatrix->mfRight;
				}
				if (fccRightSB > fcwRightSB)
				{
					fcwRightSB = fccRightSB;
				}
				pholdSliderLayoutMatrix->Calc(fcwRightSB + 3, pholdBarTitleLayoutMatrix->mfBottom, calc_sem);
			}
		}
		else if (mui32Kind == SPECIFIC_COLOR_COLORWELL)
		{
			pholdColorWellWHLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem);
		}
		else if (mui32Kind == SPECIFIC_COLOR_COLORCONTROL)
		{
			pholdCCLLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom + 3, calc_sem);
		}
	}
	catch (...)
	{
		warning(myPrefs->CaughtSpecificColorWindowCTOR);
		release_sem(calc_sem);
		throw;
	}
	try 
	{
		BMenuItem *	menuItem;
		BMenu * APPMenu = new BMenu(myPrefs->AppMenuLabel);
		menuItem = new BMenuItem(	myPrefs->AboutMenuLabel, 
									new BMessage(ABOUT_SPECIFICCOLORWINDOW));
		APPMenu->AddItem(menuItem);
		menuItem = new BMenuItem(	myPrefs->CloseWindow, 
									new BMessage(B_QUIT_REQUESTED));
		APPMenu->AddItem(menuItem);
		menuItem = new BMenuItem(	myPrefs->QuitMenuLabel, 
									new BMessage(QUIT_APP));
		APPMenu->AddItem(menuItem);
		mpMenuBar->AddItem(APPMenu);
	}
	catch(...) 
	{
		throw;
	}
}//end
Пример #7
0
BView *
DefaultMediaTheme::MakeViewFor(BParameterGroup& group, const BRect* hintRect)
{
	CALLED();

	if (group.Flags() & B_HIDDEN_PARAMETER)
		return NULL;

	BRect rect;
	if (hintRect != NULL)
		rect = *hintRect;

	GroupView *view = new GroupView(rect, group.Name());

	// Create the parameter views - but don't add them yet

	rect.OffsetTo(B_ORIGIN);
	rect.InsetBySelf(5, 5);

	BList views;
	for (int32 i = 0; i < group.CountParameters(); i++) {
		BParameter *parameter = group.ParameterAt(i);
		if (parameter == NULL)
			continue;

		BView *parameterView = MakeSelfHostingViewFor(*parameter,
			hintRect ? &rect : NULL);
		if (parameterView == NULL)
			continue;

		parameterView->SetViewColor(view->ViewColor());
			// ToDo: dunno why this is needed, but the controls
			// sometimes (!) have a white background without it

		views.AddItem(parameterView);
	}

	// Identify a title view, and add it at the top if present

	TitleView *titleView = dynamic_cast<TitleView *>((BView *)views.ItemAt(0));
	if (titleView != NULL) {
		view->AddChild(titleView);
		rect.OffsetBy(0, titleView->Bounds().Height());
	}

	// Add the sub-group views

	rect.right = rect.left + 20;
	rect.bottom = rect.top + 20;
	float lastHeight = 0;

	for (int32 i = 0; i < group.CountGroups(); i++) {
		BParameterGroup *subGroup = group.GroupAt(i);
		if (subGroup == NULL)
			continue;

		BView *groupView = MakeViewFor(*subGroup, &rect);
		if (groupView == NULL)
			continue;

		if (i > 0) {
			// add separator view
			BRect separatorRect(groupView->Frame());
			separatorRect.left -= 3;
			separatorRect.right = separatorRect.left + 1;
			if (lastHeight > separatorRect.Height())
				separatorRect.bottom = separatorRect.top + lastHeight;

			view->AddChild(new SeparatorView(separatorRect));
		}

		view->AddChild(groupView);

		rect.OffsetBy(groupView->Bounds().Width() + 5, 0);

		lastHeight = groupView->Bounds().Height();
		if (lastHeight > rect.Height())
			rect.bottom = rect.top + lastHeight - 1;
	}

	view->ResizeTo(rect.left + 10, rect.bottom + 5);
	view->SetContentBounds(view->Bounds());

	if (group.CountParameters() == 0)
		return view;

	// add the parameter views part of the group

	if (group.CountGroups() > 0) {
		rect.top = rect.bottom + 10;
		rect.bottom = rect.top + 20;
	}

	bool center = false;

	for (int32 i = 0; i < views.CountItems(); i++) {
		BView *parameterView = static_cast<BView *>(views.ItemAt(i));

		if (parameterView->Bounds().Width() + 5 > rect.Width())
			rect.right = parameterView->Bounds().Width() + rect.left + 5;

		// we don't need to add the title view again
		if (parameterView == titleView)
			continue;

		// if there is a BChannelSlider (ToDo: or any vertical slider?)
		// the views will be centered
		if (dynamic_cast<BChannelSlider *>(parameterView) != NULL)
			center = true;

		parameterView->MoveTo(parameterView->Frame().left, rect.top);
		view->AddChild(parameterView);

		rect.OffsetBy(0, parameterView->Bounds().Height() + 5);
	}

	if (views.CountItems() > (titleView != NULL ? 1 : 0))
		view->ResizeTo(rect.right + 5, rect.top + 5);

	// center the parameter views if needed, and tweak some views

	float width = view->Bounds().Width();

	for (int32 i = 0; i < views.CountItems(); i++) {
		BView *subView = static_cast<BView *>(views.ItemAt(i));
		BRect frame = subView->Frame();

		if (center)
			subView->MoveTo((width - frame.Width()) / 2, frame.top);
		else {
			// tweak the PopUp views to look better
			if (dynamic_cast<BOptionPopUp *>(subView) != NULL)
				subView->ResizeTo(width, frame.Height());
		}
	}

	view->SetContentBounds(view->Bounds());
	return view;
}
Пример #8
0
void TestWindow::MakeTermSettings()
{
	BView* settings = 0;
	BView* root = 0;
	BWindow* win = 0;
	
	try {
		// Pick some arbitrary initial frame for the window.
		BRect initFrame(0,0,100,100);
		
		// Create our three objects: the settings view, the top-level view
		// in the window, and the window itself.
		settings = GetTermSettings(BMessenger(), BMessage());
		root = new BView(initFrame, "root", B_FOLLOW_ALL, B_WILL_DRAW);
		win = new BWindow(initFrame, "Terminal Settings",
							B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
							B_ASYNCHRONOUS_CONTROLS);
		
		// Set the background color of the root view and add it to the window.
		root->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
		win->AddChild(root);
		
		// Set the size and position of the settings view -- inset a little
		// from the root -- and add it.
		float fw = be_plain_font->StringWidth("W");
		font_height fhs;
		be_plain_font->GetHeight(&fhs);
		float fh = fhs.ascent+fhs.descent+fhs.leading;
		
		settings->MoveTo(fw, fh);
		settings->ResizeTo(initFrame.right-fw*2, initFrame.bottom-fh*2);
		root->AddChild(settings);
		
		win->Run();
		mTermWin = win;
		mTermSet = settings;
		
		if( root ) {
			// Send a message to the view with our current global settings.
			// If the view is an ArpRootView, it will get the message and
			// know what to do with it.
			const BMessage* curGlobs = this->root->Globals()->GlobalValues();
			if( curGlobs ) {
				BMessage globals(*curGlobs);
				globals.what = ARP_PREF_MSG;
				BMessage ret;
				mTermSet.SendMessage(&globals, &ret);
			}
		}
		
		// Get preferred size of settings view, and make final window dimensions
		// from this.
		float width=0, height=0;
		settings->GetPreferredSize(&width, &height);
		width += fw*2;
		height += fh*2;
		
		float minw=0,minh=0,maxw=0,maxh=0;
		win->GetSizeLimits(&minw,&maxw,&minh,&maxh);
		win->SetSizeLimits(width,maxw,height,maxh);
		
		BRect frm = Frame();
		win->ResizeTo(width, height);
		BRect cfrm = Frame();
		win->MoveTo( frm.left
					+ (frm.Width()-cfrm.Width())/2,
				 	frm.top
				 	+ (frm.Height()-cfrm.Height())/2);
		
		win->Show();
		mTermWin = win;
		mTermSet = settings;
	} catch(...) {
		delete settings;
		delete root;
		delete win;
	}
}