Exemple #1
0
	TableDemo() 
		: BApplication("application/x-vnd.haiku.table-demo")
	{
		BRect frameRect;
		frameRect.Set(100, 100, 400, 400);
		TableDemoWindow* window = new TableDemoWindow(frameRect);
		window->Show();
	}
Exemple #2
0
GraphWindow::GraphWindow(BRect frame):BWindow(frame, "Graph", B_TITLED_WINDOW,
								B_NOT_ZOOMABLE|B_ASYNCHRONOUS_CONTROLS|B_WILL_ACCEPT_FIRST_CLICK)
{	
	BRect the_rect;
	BMenu* tempMenu;
	
	the_rect = Bounds();
	
	menuBar = new BMenuBar(the_rect, "GraphMenuBar");
	AddChild(menuBar);
	
	tempMenu = new BMenu("File");
	tempMenu->AddItem(new BMenuItem("About", new BMessage(MENU_FILE_ABOUT) ));
	tempMenu->AddSeparatorItem();
	tempMenu->AddItem(new BMenuItem("Save", new BMessage(MENU_FILE_SAVE), 'S'));
	tempMenu->AddSeparatorItem();
	tempMenu->AddItem(new BMenuItem("Quit", new BMessage(MENU_FILE_QUIT) , 'Q') );
	
	
	menuBar->AddItem(tempMenu);
	
	tempMenu = new BMenu("Edit");
	tempMenu->AddItem(new BMenuItem("Copy", new BMessage(MENU_EDIT_COPY), 'C' ) );
	
	menuBar->AddItem(tempMenu);
	
	tempMenu = new BMenu("Window");
	settingsWindowItem = new BMenuItem("Window Settings", new BMessage(MENU_WINDOW_SETTINGS), '1');
	settingsWindowItem->SetMarked(true);
	tempMenu->AddItem(settingsWindowItem);
	
	functionWindowItem = new BMenuItem("Function List", new BMessage(MENU_WINDOW_FUNCTION), '2');
	functionWindowItem->SetMarked(true);
	tempMenu->AddItem(functionWindowItem);
	
	menuBar->AddItem(tempMenu);
	
	menuBar->ResizeToPreferred();
	
	the_rect.top = menuBar->Frame().bottom +1;
	AddChild(the_graph = new GraphView( the_rect ));
	savePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this) ,NULL,B_FILE_NODE,false);

	BRect windowRect;
	windowRect.Set(frame.right,frame.top, frame.right+250, frame.top+110);
	windowRect.OffsetBy(10,0);
	settingsWindow = new SettingsWindow(windowRect);
	windowRect.OffsetBy(0,settingsWindow->Frame().Height()+20);
	windowRect.right=windowRect.left+250;
	windowRect.bottom=windowRect.top+300; 
	functionWindow = new FunctionListWindow(windowRect);
	settingsWindow->AddToSubset(this);
	functionWindow->AddToSubset(this);


	
	
}
	Friend() 
		:
		BApplication("application/x-vnd.haiku.Friend") 
	{
		BRect frameRect;
		frameRect.Set(100, 100, 300, 300);
		FriendWindow* window = new FriendWindow(frameRect);
		window->Show();
	}
Exemple #4
0
	Pinwheel() 
		:
		BApplication("application/x-vnd.haiku.Pinwheel") 
	{
		BRect frameRect;
		frameRect.Set(100, 100, 300, 300);
		PinwheelWindow* window = new PinwheelWindow(frameRect);
		window->Show();
	}
Exemple #5
0
void
BTextControl::DoLayout()
{
	// Bail out, if we shan't do layout.
	if (!(Flags() & B_SUPPORTS_LAYOUT))
		return;

	CALLED();

	// If the user set a layout, we let the base class version call its
	// hook.
	if (GetLayout()) {
		BView::DoLayout();
		return;
	}

	_ValidateLayoutData();

	// validate current size
	BSize size(Bounds().Size());
	if (size.width < fLayoutData->min.width)
		size.width = fLayoutData->min.width;
	if (size.height < fLayoutData->min.height)
		size.height = fLayoutData->min.height;

	BRect dirty(fText->Frame());
	BRect textFrame;

	// divider
	float divider = 0;
	if (fLayoutData->text_view_layout_item != NULL) {
		if (fLayoutData->label_layout_item != NULL) {
			// We have layout items. They define the divider location.
			divider = fabs(fLayoutData->text_view_layout_item->Frame().left
				- fLayoutData->label_layout_item->Frame().left);
		}
		textFrame = fLayoutData->text_view_layout_item->FrameInParent();
	} else {
		if (fLayoutData->label_width > 0) {
			divider = fLayoutData->label_width
				+ be_control_look->DefaultLabelSpacing();
		}
		textFrame.Set(divider, 0, size.width, size.height);
	}

	// place the text view and set the divider
	textFrame.InsetBy(kFrameMargin, kFrameMargin);
	BLayoutUtils::AlignInFrame(fText, textFrame);

	fDivider = divider;

	// invalidate dirty region
	dirty = dirty | fText->Frame();
	dirty.InsetBy(-kFrameMargin, -kFrameMargin);

	Invalidate(dirty);
}
Exemple #6
0
	Views() 
		:
		BApplication("application/x-vnd.haiku.Views") 
	{
		BRect frameRect;
		frameRect.Set(100, 100, 300, 300);
		ViewsWindow* window = new ViewsWindow(frameRect);
		window->Show();
	}
Exemple #7
0
/////////////////////////////////////////////////////////////////
//init window frame.
/////////////////////////////////////////////////////////////////
BRect
kanBeApp::InitFrame(float w, float h)
{
BRect			frameRect;

	frameRect.Set(0, 0, K_CONVBUFSIZE * w + 2 * 2, h * 2 + 2 * 3);
	frameRect.OffsetTo(10, BScreen().Frame().bottom - h * 2 - 2 * 3 - 30);

	return frameRect;
}
Exemple #8
0
HApp::HApp()
	:
	BApplication("application/x-vnd.Haiku-Sounds")
{
	BRect rect;
	rect.Set(200, 150, 590, 570);

	HWindow* window = new HWindow(rect, B_TRANSLATE_SYSTEM_NAME("Sounds"));
	window->Show();
}
Exemple #9
0
/*
 * setup this arranger view, call parents and stuff back up the chain and create a time scale object
 */
int
MFCArrangeView::OnCreate(LPCREATESTRUCT lpCreateStruct )
{
	int		ret = MFCSequenceEditor::OnCreate(lpCreateStruct);

	BRect		r;
	r.Set(0, bounds.bottom-60, 600, bounds.bottom-50);
	tScale.CreateTScale(r, this, 1111, this);
	return ret;
}
Exemple #10
0
SampleGLApp::SampleGLApp()
    : BApplication("application/x-vnd.Haiku-GLDirectMode")
{
    BRect windowRect;
    uint32 type = BGL_RGB|BGL_DOUBLE|BGL_DEPTH;

    windowRect.Set(50, 50, 350, 350);

    theWindow = new SampleGLWindow(windowRect, type);
}
BRect
RepositoriesSettings::GetFrame()
{
	BMessage settings(_ReadFromFile());
	BRect frame;
	status_t status = settings.FindRect(key_frame, &frame);
	// Set default off screen so it will center itself
	if (status != B_OK)
		frame.Set(-10, -10, 750, 300);
	return frame;
}
Exemple #12
0
/***********************************************************
 * Constructor.
 ***********************************************************/
HApp::HApp():BApplication("application/x-vnd.takamatsu-hltrackerreader")
{
	BRect rect;
	RectUtils utils;
	if(utils.LoadRectFromApp("servwinrect",&rect) == false)
	{
		rect.Set(40,40,500,300);
	}
	fWindow = new HWindow(rect,_("Tracker"));
	fWindow->Show();
}
void HexKeyView::AttachedToWindow() 
{
    
    BBox *aBox;
    BRect aBoxRect;
	aBoxRect.Set(10, 10, 370, 270);
    
    aBox = new BBox(aBoxRect, "Box1", B_FOLLOW_NONE);
    aBox->SetLabel(LABEL_BOX_TITLE);
    AddChild(aBox);
    
    BRect drawRect;
	drawRect.Set(10, 10, 340, 240);
	
	DrawView *drawView;
	drawView = new DrawView(drawRect, "DrawView");
	drawView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	drawView->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	aBox->AddChild(drawView);
	
}
Exemple #14
0
void MonthWindowView::MouseDown(BPoint p)
{
 // It's necessary to define whether mouse cursor is on one of dates
 BRect r;
 
 int k=cwday1;
 float x=w_cell*k+1;
 float y=yearStringView->Frame().bottom+h_cell+h_cell;
 
 int qu_days=monthDays[cmonth-1]; // quantity of days in month
 
 if(cmonth==2) if(cyear%4==0) if((cyear%100!=0) || (cyear%400==0)) qu_days=29;
 
 bool flag=false; // whether mouse is pressed just on date
 int t=0;
 while(t<qu_days)
 {
  t++;
  r.Set(x,y-h_cell+5,x+w_cell-1,y+4);
  
  if(r.Contains(p))
  {
   flag=true;
   dayPressed=t;
   cursorPressed.Set(r.left,r.top,r.right,r.bottom);
   MousePressed=true;
   break; // exit while
  }
  
  x+=w_cell;
  k++;
  
  if(k==7)
  {
   k=0;
   y+=h_cell;
   x=1;
  }
 }
}
Exemple #15
0
Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
	main_loop = NULL;
	current_video_mode = p_desired;

	app = new HaikuApplication();

	BRect frame;
	frame.Set(50, 50, 50 + current_video_mode.width - 1, 50 + current_video_mode.height - 1);

	window = new HaikuDirectWindow(frame);
	window->SetVideoMode(&current_video_mode);

	if (current_video_mode.fullscreen) {
		window->SetFullScreen(true);
	}

	if (!current_video_mode.resizable) {
		uint32 flags = window->Flags();
		flags |= B_NOT_RESIZABLE;
		window->SetFlags(flags);
	}

#if defined(OPENGL_ENABLED)
	context_gl = memnew(ContextGL_Haiku(window));
	context_gl->initialize();
	context_gl->make_current();
	context_gl->set_use_vsync(current_video_mode.use_vsync);
	RasterizerGLES3::register_config();
	RasterizerGLES3::make_current();

#endif

	visual_server = memnew(VisualServerRaster);
	// FIXME: Reimplement threaded rendering
	if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
		visual_server = memnew(VisualServerWrapMT(visual_server, false));
	}

	ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);

	video_driver_index = p_video_driver;

	input = memnew(InputDefault);
	window->SetInput(input);

	window->Show();
	visual_server->init();

	AudioDriverManager::initialize(p_audio_driver);

	return OK;
}
int
main()
{
	BApplication app("application/x-vnd.haiku.ThreeButtons");

	BRect frameRect;
	frameRect.Set(100, 100, 600, 300);
	ThreeButtonsWindow* window = new ThreeButtonsWindow(frameRect);
	window->Show();

	app.Run();
	return 0;
}
void
PreviewView::Update(const BRect* rect, BBitmap* bitmap)
{
	if (Window() == NULL || Window()->IsHidden())
		return;

	if (rect != NULL)
		_SetRect(*rect);

	bigtime_t now = system_time();
	if (bitmap == NULL) {
		// Avoid updating preview too often
		if (fTimeStamp + 50000 >= now)
			return;
		BScreen screen(Window());
		screen.GetBitmap(&bitmap, false, &fCoordRect);
	}
	if (bitmap != NULL) {
		BRect destRect;
		BRect bitmapBounds = bitmap->Bounds();
		BRect viewBounds = fBitmapView->Bounds();
		if (BRectRatio(viewBounds) >= BRectRatio(bitmapBounds)) {
			float overlap = BRectHorizontalOverlap(viewBounds, bitmapBounds);
			destRect.Set(-overlap, 0, viewBounds.Width() + overlap,
						viewBounds.Height());
		} else {
			float overlap = BRectVerticalOverlap(viewBounds, bitmapBounds);
			destRect.Set(0, -overlap, viewBounds.Width(), viewBounds.Height() + overlap);
		}
		fTimeStamp = now;
		fBitmapView->SetViewBitmap(bitmap,
			bitmap->Bounds().OffsetToCopy(B_ORIGIN),
			destRect,
			B_FOLLOW_TOP|B_FOLLOW_LEFT, B_FILTER_BITMAP_BILINEAR);
		Invalidate();
	}
}
CMassWindow::CMassWindow(BRect frame, struct picture *theBitmaps)							//	constructor
    : BWindow(frame, "Critical Mass", B_TITLED_WINDOW, 0)
{
    BRect viewRect;
    viewRect.Set(Bounds().left, Bounds().top, Bounds().right, 0);
    theMenuBar = new CMassMenuBar(viewRect, "Critical Mass Menu Bar");				//	initialize the menu bar
    AddChild(theMenuBar);

    viewRect.Set(Bounds().left, Bounds().bottom - 32, Bounds().right, Bounds().bottom);
    theStatusBar = new BStatusBar(viewRect, "GedankenBar", NULL, NULL);
    theStatusBar->SetResizingMode(B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT);
    theStatusBar->SetMaxValue(DEFAULT_N_ROWS * DEFAULT_N_COLS);
    AddChild(theStatusBar);
    rgb_color red_colour = {0xDC, 0x46, 0x46, 0};
    theStatusBar->SetBarColor(red_colour);

    viewRect.Set(Bounds().left, theMenuBar->Frame().bottom, Bounds().right, theStatusBar->Frame().top);
    theView = new CMassView(viewRect, "Critical Mass View", theBitmaps);			//	initialize the board view
    AddChild(theView);

    ResizeBy(- theView->marginx(), 2 - theView->marginy());

    SetSizeLimits(Bounds().Width(), 9999, Bounds().Height(), 9999);
}
Exemple #19
0
bool
IPCPAddon::GetPreferredSize(float *width, float *height) const
{
	BRect rect;
	if(Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect) != B_OK)
		rect.Set(0, 0, 200, 300);
			// set default values
	
	if(width)
		*width = rect.Width();
	if(height)
		*height = rect.Height();
	
	return true;
}
Exemple #20
0
BRect
VectorPath::_Bounds() const
{
	agg::path_storage path;

	BRect b;
	if (get_path_storage(path, fPath, fPointCount, fClosed)) {
		agg::conv_curve<agg::path_storage> curve(path);

		uint32 pathID[1];
		pathID[0] = 0;
		double left, top, right, bottom;

		agg::bounding_rect(curve, pathID, 0, 1, &left, &top, &right, &bottom);

		b.Set(left, top, right, bottom);
	} else if (fPointCount == 1) {
		b.Set(fPath[0].point.x, fPath[0].point.y, fPath[0].point.x,
			fPath[0].point.y);
	} else {
		b.Set(0.0, 0.0, -1.0, -1.0);
	}
	return b;
}
Exemple #21
0
status_t
KeymapWindow::_LoadSettings(BRect& windowFrame, BString& keyboardLayout)
{
	BScreen screen(this);

	windowFrame.Set(-1, -1, 799, 329);
	// See if we can use a larger default size
	if (screen.Frame().Width() > 1200) {
		windowFrame.right = 899;
		windowFrame.bottom = 349;
	}

	keyboardLayout = "";

	BFile file;
	status_t status = _GetSettings(file, B_READ_ONLY);
	if (status == B_OK) {
		BMessage settings;
		status = settings.Unflatten(&file);
		if (status == B_OK) {
			BRect frame;
			if (settings.FindRect("window frame", &frame) == B_OK)
				windowFrame = frame;

			settings.FindString("keyboard layout", &keyboardLayout);
		}
	}

	if (!screen.Frame().Contains(windowFrame)) {
		// Make sure the window is not larger than the screen
		if (windowFrame.Width() > screen.Frame().Width())
			windowFrame.right = windowFrame.left + screen.Frame().Width();
		if (windowFrame.Height() > screen.Frame().Height())
			windowFrame.bottom = windowFrame.top + screen.Frame().Height();

		// Make sure the window is on screen (and center if it isn't)
		if (windowFrame.left < screen.Frame().left
			|| windowFrame.right > screen.Frame().right
			|| windowFrame.top < screen.Frame().top
			|| windowFrame.bottom > screen.Frame().bottom) {
			windowFrame.OffsetTo(BAlert::AlertPosition(windowFrame.Width(),
				windowFrame.Height()));
		}
	}

	return status;
}
Exemple #22
0
TSliderView::TSliderView(BRect rect, char *name, float val, slider_func func, void *arg)
			:BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
{
	BRect	r;

	fValue = val;
	callback = func;
	callback_arg = arg;

	// load in our canned slider knob bitmap
	r.Set(0, 0, ((KNOB_WIDTH + 7) & 0xfff8) - 1, KNOB_HEIGHT);
	fKnob = new BBitmap(r, B_COLOR_8_BIT);
	fKnob->SetBits((char*)knob, fKnob->BitsLength(), 0, B_COLOR_8_BIT);

	// create our offscreen drawing environment
	r = Bounds();
	back_width = r.Width();
	fSlider = new BBitmap(r, B_COLOR_8_BIT, TRUE);
	fSlider->AddChild(fOffView = new BView(r, "", B_FOLLOW_ALL, B_WILL_DRAW));
}
Exemple #23
0
void
SlideShowSaver::LayoutCaption(BView *view, BFont &font, BPoint &pos, BRect &rect)
{
	font_height fontHeight;
	float width, height;
	BRect bounds(view->Bounds());
	font = be_plain_font;
	width = font.StringWidth(fCaption.String()) + 1; // 1 for text shadow
	font.GetHeight(&fontHeight);
	height = fontHeight.ascent + fontHeight.descent;
	// center text horizontally
	pos.x = (bounds.left + bounds.right - width)/2;
	// flush bottom
	pos.y = bounds.bottom - fontHeight.descent - 5;

	// background rectangle
	rect.Set(0, 0, (width-1)+2, (height-1)+2+1); // 2 for border and 1 for text shadow
	rect.OffsetTo(pos);
	rect.OffsetBy(-1, -1-fontHeight.ascent); // -1 for border
}
void TVideoCaptureToolbar::Init()
{
	//
	// Create the toolbar buttons
	//

	BRect bounds;

	// Create Play button
	BBitmap* recordUp = GetIcon16FromResource("Record");
	BBitmap* recordDn = GetIcon16FromResource("AudioStopUp");
	bounds = Bounds();
	bounds.Set( kButtonLeftOffset, bounds.top + kButtonTopOffset, kToolButtonWidth+kButtonLeftOffset,
	            bounds.top + kButtonTopOffset + kToolButtonHeight );
	fRecordButton = new TBitmapButton( bounds, "RecordButton", recordUp, recordDn,
	                                   this, new BMessage(VIDCAP_RECORD_MSG), true, B_TWO_STATE_BUTTON);

	AddChild(fRecordButton);
	fRecordButton->Show();
	fRecordButton->SetTarget(Parent());
}
Exemple #25
0
TMailWindow*
TMailApp::NewWindow(const entry_ref* ref, const char* to, bool resend,
	BMessenger* trackerMessenger)
{
	float fontFactor = be_plain_font->Size() / 12.0f;
	BRect r;
	if (fMailWindowFrame.Width() < 64 || fMailWindowFrame.Height() < 20) {
		// default size
		r.Set(40 * fontFactor, 40 * fontFactor, fontFactor * (40 + WIND_WIDTH),
			fontFactor * (40 + WIND_HEIGHT));
	} else
		r = fMailWindowFrame;

	// cascading windows
	r.OffsetBy(fontFactor * (((fWindowCount + 5) % 10) * 15 - 75),
		fontFactor * (((fWindowCount + 5) % 10) * 15 - 75));

	fWindowCount++;

	BString title;
	BFile file;
	if (!resend && ref && file.SetTo(ref, O_RDONLY) == B_OK) {
		BString name;
		if (file.ReadAttrString(B_MAIL_ATTR_NAME, &name) == B_OK) {
			title << name;
			BString subject;
			if (file.ReadAttrString(B_MAIL_ATTR_SUBJECT, &subject) == B_OK)
				title << " -> " << subject;
		}
	}
	if (title == "")
		title = B_TRANSLATE_SYSTEM_NAME("Mail");

	TMailWindow* window = new TMailWindow(r, title.String(), this, ref, to,
		&fContentFont, resend, trackerMessenger);
	fWindowList.AddItem(window);

	window->MoveOnScreen();
	return window;
}
// -------------------------------------------------------------------
//	* CONSTRUCTORS and DESTRUCTORS
// -------------------------------------------------------------------
DPRegression::DPRegression() : BApplication(data_plus_regr_sig)
{

	// Install this app and data file type if necessary
	BMimeType mime(data_plus_regr_sig);
	if (mime.InitCheck() == B_OK && !mime.IsInstalled()) {
		mime.Install();
	}
	BMimeType dataMime(regrplot_mime_type);
	if (dataMime.InitCheck() == B_OK && !dataMime.IsInstalled()) {
		dataMime.Install();
		// Set the document icons
		status_t status;
		BBitmap* lgIcon = new BBitmap(BRect(0,0,31,31),B_CMAP8);
		lgIcon->SetBits(largeIcon_bits,sizeof(largeIcon_bits),0,B_CMAP8);
		status = dataMime.SetIcon(lgIcon,B_LARGE_ICON);
		delete lgIcon;

		BBitmap* miniIcon = new BBitmap(BRect(0,0,15,15),B_CMAP8);
		miniIcon->SetBits(smallIcon_bits,sizeof(smallIcon_bits),0,B_CMAP8);
		status = dataMime.SetIcon(miniIcon,B_MINI_ICON);
		delete miniIcon;
	}
	// Make sure data marker is installed
	BMimeType markMime(data_plus_marker_sig);
	if (markMime.InitCheck() == B_OK && !markMime.IsInstalled()) {
		markMime.Install();
	}

	// We should get preference data for this
	
	mData = new BList();
	
	// Show the regression graph
	BRect	dataRect;
	dataRect.Set(100, 100, 450, 450);
	mRegrWindow = new DRRegrWindow(dataRect);
	mRegrWindow->Show();
}
Exemple #27
0
void TMIDIEditor::Init()
{

	// Create Background View.  It hold all the other views...
	BRect bgRect    = Bounds();
	bgRect.right    -= (B_V_SCROLL_BAR_WIDTH+1);
	bgRect.bottom   -= (B_H_SCROLL_BAR_HEIGHT+1);
	fBackground = new BView(bgRect, "Container", B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(fBackground);
	fBackground->SetViewColor(kWhite);
	fBackground->Show();


	// Create editor view.
	BRect audioBounds = Bounds();
	audioBounds.bottom -= -(B_H_SCROLL_BAR_HEIGHT+1);
	fEditorView = new TMIDIEditorView(this, audioBounds);
	fBackground->AddChild(fEditorView);
	fEditorView->Show();

	// Horizontal	Scroll Bar
	BRect scrollRect = Bounds();
	scrollRect.Set(scrollRect.left, scrollRect.bottom-B_H_SCROLL_BAR_HEIGHT, scrollRect.right-B_V_SCROLL_BAR_WIDTH, scrollRect.bottom);
	fHScroll = new BScrollBar(scrollRect, "HMIDIScroll", fBackground, 0, 1000, B_HORIZONTAL);
	AddChild(fHScroll);

	// Set minimum window size and then open it to max
	SetSizeLimits(100, 600, 500, 500);

	//
	// Set up midi editor parameters
	//

	// Get number of tracks in General MIDI file
	//fTotalTracks = fMIDICue->GetMidiFile()->GetTotalTracks();

	// Test: Get name of track 1...

}
Exemple #28
0
void
Panel::GetItemRect(
			float indent,
			float item_wid, float item_hite,
			float seperation_wid,
			BRect &wrect)
{
	if (thePoint.x + item_wid > myWidth) {
		if (thePoint.x + item_wid < maxWidth) {	// can expand in wid
			myWidth = thePoint.x + item_wid+indent;
			seperation_wid = indent;
			if (rowHeight < item_hite + MIXER_MARGIN)
				rowHeight = item_hite + MIXER_MARGIN;
			if (thePoint.y + rowHeight > myHeight) {
				myHeight = thePoint.y + rowHeight;
			}
		} else {								// gotta go down
			thePoint.x = indent;
			thePoint.y = myHeight;
			rowHeight = item_hite + MIXER_MARGIN;
			myHeight = thePoint.y + rowHeight;
			myWidth = Max(myWidth, item_wid+2*indent);
			if (myWidth > maxWidth)
				myWidth = maxWidth;
		}
	} else {									// fits in this row.
		if (rowHeight < item_hite + MIXER_MARGIN)
			rowHeight = item_hite + MIXER_MARGIN;
		if (thePoint.y + rowHeight > myHeight) {
			myHeight = thePoint.y + rowHeight;
		}
	}
//	fprintf(stderr, "%s %g %g %g %g\n", Name(), myWidth, myHeight, item_wid, item_hite);
	ResizeTo(myWidth, myHeight);
	wrect.Set(thePoint.x, thePoint.y, thePoint.x+item_wid, thePoint.y+item_hite);
	thePoint.x += item_wid + seperation_wid;
}
void
TeamsColumn::DrawField(BField* field, BRect rect, BView* parent)
{
	BBitmapStringField* bitmapField
		= dynamic_cast<BBitmapStringField*>(field);
	BStringField* stringField = dynamic_cast<BStringField*>(field);

	if (bitmapField) {
		const BBitmap* bitmap = bitmapField->Bitmap();

		// figure out the placement
		float x = 0.0;
		BRect r = bitmap ? bitmap->Bounds() : BRect(0, 0, 15, 15);
		float y = rect.top + ((rect.Height() - r.Height()) / 2);
		float width = 0.0;

		switch (Alignment()) {
			default:
			case B_ALIGN_LEFT:
			case B_ALIGN_CENTER:
				x = rect.left + sTextMargin;
				width = rect.right - (x + r.Width()) - (2 * sTextMargin);
				r.Set(x + r.Width(), rect.top, rect.right - width, rect.bottom);
				break;

			case B_ALIGN_RIGHT:
				x = rect.right - sTextMargin - r.Width();
				width = (x - rect.left - (2 * sTextMargin));
				r.Set(rect.left, rect.top, rect.left + width, rect.bottom);
				break;
		}

		if (width != bitmapField->Width()) {
			BString truncatedString(bitmapField->String());
			parent->TruncateString(&truncatedString, fTruncateMode, width + 2);
			bitmapField->SetClippedString(truncatedString.String());
			bitmapField->SetWidth(width);
		}

		// draw the bitmap
		if (bitmap) {
			parent->SetDrawingMode(B_OP_ALPHA);
			parent->DrawBitmap(bitmap, BPoint(x, y));
			parent->SetDrawingMode(B_OP_OVER);
		}

		// draw the string
		DrawString(bitmapField->ClippedString(), parent, r);

	} else if (stringField) {

		float width = rect.Width() - (2 * sTextMargin);

		if (width != stringField->Width()) {
			BString truncatedString(stringField->String());

			parent->TruncateString(&truncatedString, fTruncateMode, width + 2);
			stringField->SetClippedString(truncatedString.String());
			stringField->SetWidth(width);
		}

		DrawString(stringField->ClippedString(), parent, rect);
	}
}
void SeqPhraseMatrixView::DrawTopLevelPhrase(	BRect clip,
        BView* view,
        const AmTrack* track,
        const AmPhraseEvent* event,
        AmTime end,
        AmPhraseEvent* topPhrase,
        AmPhraseRendererI* renderer)
{
    ArpASSERT(event && topPhrase);
    if (!event || !event->Phrase() ) return;
    const AmPhrase*		phrase = event->Phrase();
    BRect				entireF(0, clip.top + 3, 0, clip.bottom - 3);
    AmTime				phraseEnd = event->EndTime();
    BString				n = event->Phrase()->Name();
    float				labelH = mCurLabelH + 3;
    bool				drawLabel = mCurLabelH > 0 && labelH < entireF.Height() && n.Length() > 0;

    entireF.left = mMtc.TickToPixel(event->StartTime()) - 2;
    entireF.right = mMtc.TickToPixel(phraseEnd) + 2;
    BRect				labelF = arp_invalid_rect();
    BRect				contentF = arp_invalid_rect();
    if (drawLabel) {
        if (entireF.Height() - 4 > labelH + 4) {
            labelF.Set(entireF.left + 2, entireF.top + 2, entireF.right - 2, entireF.bottom - 2);
            contentF = labelF;
            labelF.bottom = labelF.top + labelH - 1;
            contentF.top = labelF.bottom + 1;
        } else labelF.Set(entireF.left + 2, entireF.top + 2, entireF.right - 2, entireF.bottom - 2);
    } else contentF.Set(entireF.left + 2, entireF.top + 2, entireF.right - 2, entireF.bottom - 2);

    rgb_color			bgC = phrase->Color(phrase->BACKGROUND_C);
    rgb_color			fgC = phrase->Color(phrase->FOREGROUND_C);
    if (mDrawMuted) {
        bgC = shade_color(bgC, MUTE_SHADE);
        fgC = shade_color(fgC, MUTE_SHADE);
    }
    if (arp_is_valid_rect(contentF) ) {
        /* Fill the background.
         */
        if (!mDrawMuted) {
            view->SetHighColor(bgC);
            view->FillRect(contentF);
        }
        /* Draw the measure markers.
         */
        AmTrackMeasureBackground		bg(mSongRef, AmTrackRef(track), mMtc);
        if (mDrawMuted) bg.SetFlag(bg.DRAW_BEATS_FLAG, false);
        else {
            rgb_color	c = weighted_shade(bgC, Prefs().Color(AM_MEASURE_FG_C), 5);
            bg.SetBeatColor(c);
        }
        bg.LockedDraw(view, contentF, track->Signatures() );
    }

    mLines.BeginLineArray();
    if (arp_is_valid_rect(labelF) ) {
        rgb_color	c = weighted_shade(bgC, fgC, 3);
        view->SetHighColor(c);
        view->SetLowColor(c);
        view->FillRect(labelF);
        draw_label_border(view, labelF, c, mLines, mDrawMuted, !arp_is_valid_rect(contentF));
        view->SetHighColor(Prefs().Color(AM_MEASURE_FG_C) );
        BPoint		pt(labelF.left + 2, labelF.bottom - 2);
        if (arp_is_valid_rect(contentF) ) pt.y -= 2;
        view->TruncateString(&n, B_TRUNCATE_END, labelF.Width() );
        view->DrawString(n.String(), pt);
    }

    /* Shade the background.
     */
    rgb_color		c;
    c.red = c.green = c.blue = 0;
    if (mDrawMuted) c = shade_color(c, MUTE_SHADE);
    mLines.AddLine(BPoint(entireF.left + 1, entireF.top), BPoint(entireF.right - 1, entireF.top), c);
    mLines.AddLine(BPoint(entireF.left + 1, entireF.bottom), BPoint(entireF.right - 1, entireF.bottom), c);
    mLines.AddLine(BPoint(entireF.left, entireF.top + 1), BPoint(entireF.left, entireF.bottom - 1), c);
    mLines.AddLine(BPoint(entireF.right, entireF.top + 1), BPoint(entireF.right, entireF.bottom - 1), c);

    if (arp_is_valid_rect(contentF) ) {
        draw_content_border(view, contentF, bgC, mLines, mDrawMuted, !arp_is_valid_rect(labelF));
    }

    c = tint_color(Prefs().Color(AM_DATA_BACKDROP_C), B_DARKEN_1_TINT);
    if (mDrawMuted) c = shade_color(c, MUTE_SHADE);
    if (!gPhraseBg) {
        mLines.AddLine(BPoint(entireF.right + 1, entireF.top + 2), BPoint(entireF.right + 1, entireF.bottom + 0), c);
        mLines.AddLine(BPoint(entireF.left + 2, entireF.bottom + 1), BPoint(entireF.right + 0, entireF.bottom + 1), c);
        mLines.AddLine(BPoint(entireF.right + 0, entireF.bottom + 0), BPoint(entireF.right + 0, entireF.bottom + 0), c);
    }

    /* Indicate if this phrase is linked.
     */
    if (phrase->CountLinks() > 0) {
        view->SetHighColor(bgC);
        view->SetLowColor(0, 0, 0);
        view->StrokeRect(entireF, LINK_PATTERN);
    }

    if (arp_is_valid_rect(contentF) ) {
        /* Draw the events.
         */
        if (renderer) {
            BRect					trackR(clip.left, contentF.top, clip.right, contentF.bottom);
            view->SetHighColor(fgC);
            renderer->BeginTrack(trackR, view, track, mLines);
            renderer->DrawPhrase(contentF, view, track, event, end < phraseEnd ? end : phraseEnd, topPhrase, mLines);
            renderer->EndTrack(trackR, view, track, mLines);
        }
    }
    /* Finish.
     */
    mLines.EndLineArray();
}