Beispiel #1
0
BRect
LibraryWindow::ScanFolder(BPoint location, const char *path, float *maxwidth)
{
	BDirectory dir(path);
	if (dir.InitCheck() != B_OK)
		return BRect(0,0,-1,-1);
	
	float width = 0.0;
	dir.Rewind();
	entry_ref ref;
	BRect r(location.x,location.y,location.x + 1,location.y + 1);
	
	while (dir.GetNextRef(&ref) == B_OK)
	{
		BString str(ref.name);
		
		int32 soPos = str.FindLast(".so");
		int32 aPos = str.FindLast(".a");
		
		if (soPos < 0 && aPos < 0)
			continue;
		
		if (soPos >= 0 && soPos < str.CountChars() - 3)
			continue;
		
		if (aPos >= 0 && aPos < str.CountChars() - 2)
			continue;
		
		Lock();	
		BMessage *msg = new BMessage(M_TOGGLE_LIB);
		msg->AddRef("ref",&ref);
		msg->AddString("path",path);
		BCheckBox *box = new BCheckBox(r,ref.name,ref.name,msg);
		box->ResizeToPreferred();
		r = box->Frame();
		fCheckList->AddChild(box);
		fSystemLibs.AddItem(box);
		
		// Make sure that there isn't any shortcut normalization
		BPath dirpath(path);
		dirpath.Append(ref.name);
		
		if (fProject && fProject->HasLibrary(dirpath.Path()))
			box->SetValue(B_CONTROL_ON);
		else
			box->SetValue(B_CONTROL_OFF);
		Unlock();
		
		
		width = MAX(r.right,width);
		r.OffsetBy(0,r.Height());
	}
	
	if (r.Height() == 1)
		r.Set(0, 0, -1, -1);
	
	*maxwidth = width;
	return r;
}
Beispiel #2
0
void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
{
	char		 numberString [30];
	BRect		 tempRect;
	char		*tempStringPntr;

	SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));

	// Make the checkbox for choosing whether the spam is marked by a
	// modification to the subject of the mail message.

	tempRect = Bounds ();
	fAddSpamToSubjectCheckBoxPntr = new BCheckBox (
		tempRect,
		"AddToSubject",
		"Add spam rating to start of subject",
		new BMessage (kAddSpamToSubjectPressed));
	AddChild (fAddSpamToSubjectCheckBoxPntr);
	fAddSpamToSubjectCheckBoxPntr->ResizeToPreferred ();
	fAddSpamToSubjectCheckBoxPntr->SetValue (fAddSpamToSubject);
	fAddSpamToSubjectCheckBoxPntr->SetTarget (this);

	tempRect = Bounds ();
	tempRect.top = fAddSpamToSubjectCheckBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

	// Add the checkbox on the right for the no words means spam option.

	fNoWordsMeansSpamCheckBoxPntr = new BCheckBox (
		tempRect,
		"NoWordsMeansSpam",
		"or empty e-mail",
		new BMessage (kNoWordsMeansSpam));
	AddChild (fNoWordsMeansSpamCheckBoxPntr);
	fNoWordsMeansSpamCheckBoxPntr->ResizeToPreferred ();
	fNoWordsMeansSpamCheckBoxPntr->MoveBy (
		floorf (tempRect.right - fNoWordsMeansSpamCheckBoxPntr->Frame().right),
		0.0);
	fNoWordsMeansSpamCheckBoxPntr->SetValue (fNoWordsMeansSpam);
	fNoWordsMeansSpamCheckBoxPntr->SetTarget (this);

	// Add the box displaying the spam cutoff ratio to the left, in the space
	// remaining between the left edge and the no words checkbox.

	tempRect.right = fNoWordsMeansSpamCheckBoxPntr->Frame().left -
		be_plain_font->StringWidth ("a");
	tempStringPntr = "Spam above:";
	sprintf (numberString, "%06.4f", (double) fSpamCutoffRatio);
	fSpamCutoffRatioTextBoxPntr	= new BTextControl (
		tempRect,
		"spamcutoffratio",
		tempStringPntr,
		numberString,
		NULL /* BMessage */);
	AddChild (fSpamCutoffRatioTextBoxPntr);
	fSpamCutoffRatioTextBoxPntr->SetDivider (
		be_plain_font->StringWidth (tempStringPntr) +
		1 * be_plain_font->StringWidth ("a"));

	tempRect = Bounds ();
	tempRect.top = fSpamCutoffRatioTextBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

	// Add the box displaying the genuine cutoff ratio, on a line by itself.

	tempStringPntr = "Genuine below and uncertain above:";
	sprintf (numberString, "%08.6f", (double) fGenuineCutoffRatio);
	fGenuineCutoffRatioTextBoxPntr = new BTextControl (
		tempRect,
		"genuinecutoffratio",
		tempStringPntr,
		numberString,
		NULL /* BMessage */);
	AddChild (fGenuineCutoffRatioTextBoxPntr);
	fGenuineCutoffRatioTextBoxPntr->SetDivider (
		be_plain_font->StringWidth (tempStringPntr) +
		1 * be_plain_font->StringWidth ("a"));

	tempRect = Bounds ();
	tempRect.top = fGenuineCutoffRatioTextBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

    // Checkbox for automatically training on incoming mail.

	fAutoTrainingCheckBoxPntr = new BCheckBox (
		tempRect,
		"autoTraining",
		"Learn from all incoming e-mail",
		new BMessage (kAutoTrainingPressed));
	AddChild (fAutoTrainingCheckBoxPntr);
	fAutoTrainingCheckBoxPntr->ResizeToPreferred ();
	fAutoTrainingCheckBoxPntr->SetValue (fAutoTraining);
	fAutoTrainingCheckBoxPntr->SetTarget (this);

	tempRect = Bounds ();
	tempRect.top = fAutoTrainingCheckBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

	// Button for editing the server settings.

/*	fServerSettingsButtonPntr = new BButton (
		tempRect,
		"serverSettings",
		"Advanced Server Settings…",
		new BMessage (kServerSettingsPressed));
	AddChild (fServerSettingsButtonPntr);
	fServerSettingsButtonPntr->ResizeToPreferred ();
	fServerSettingsButtonPntr->SetTarget (this);

	tempRect = Bounds ();
	tempRect.top = fServerSettingsButtonPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;


    // Checkbox for closing the server when done.

	fQuitServerWhenFinishedCheckBoxPntr = new BCheckBox (
		tempRect,
		"quitWhenFinished",
		"Close spam scanner when finished.",
		new BMessage (kQuitWhenFinishedPressed));
	AddChild (fQuitServerWhenFinishedCheckBoxPntr);
	fQuitServerWhenFinishedCheckBoxPntr->ResizeToPreferred ();
	fQuitServerWhenFinishedCheckBoxPntr->SetValue (fQuitServerWhenFinished);
	fQuitServerWhenFinishedCheckBoxPntr->SetTarget (this);

	tempRect = Bounds ();
	tempRect.top = fQuitServerWhenFinishedCheckBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;
*/
}
/*!	\function		CalendarModulePreferences::CreateWeekendSelectionBox
 *	\brief			Create box for selection of the weekend days
 *	\note			Additionally, select the color for weekends and weekdays
 *	\param[in]	frame	Enclosing rectangle.
 *	\param[in]	label	Reference to label of the enclosing BBox.
 *	\param[in]	calModule	The calendar module for which the preferences are set.
 */
void	CalendarModulePreferences::CreateWeekendSelectionBox( BRect frame,
															  BString &label,
															  CalendarModule* calModule )
{
	/*!	\par	Notes on implementation:
	 *			It's not all that straightforward - to create this selection box.
	 *			The problem is that number of days in week is dependent on the
	 *			Calendar Module, therefore the frame rectangle must be divided
	 *			properly. We should take into account the possibility that there's
	 *			not enough place for all days in the submitted frame.
	 *
	 *	\par	
	 *			The solution will be as follows:
	 *			Let number of days in week be N. I create two columns and 
	 *			several rows (the number depends on N). Days in week will be
	 *			proceeded in the order <em>as Calendar Module supplies them</em>.
	 *			The days occupy both columns, and are located in rows
	 *			[0, (ceiling of (N/2)) ). Days returned from CalendarModule are
	 *			placed as follows: days from 0 to (ceiling of (N/2)-1) in the left
	 *			column, days from (ceiling of (N/2)-1) to (N-1) in right column.
	 *
	 *	\par	
	 *			Two controls for setting the colors of weekdays and weekends
	 *			are located at the bottom row of the grid; weekdays on right,
	 *			weekends on left.
	 *
	 *	\par	
	 *			There will be an empty cell in the right column, if number
	 *			of days in week is odd.
	 */
	BMessage* 	toSend = NULL;
	BCheckBox* 	dayCheckBox = NULL;
	BString		tempString;
	
	/* indexX is 0 for left column or 1 for right column.
	 * indexY is 0 for topmost row, 1 for second from top row, etc.
	 * Max value for indexY = (ceiling of (N/2)).
	 */
	int indexX, indexY;
	 
	// Prepare the item to be returned
	BBox*	enclosingBox = new BBox( frame, "Weekend selector" );
	if ( !enclosingBox )
	{
		/* Panic! */
		exit(1);
	}

	// Prepare the layout to be used
	BGridLayout* layout = new BGridLayout();
	if ( !layout)
	{
		/* Panic! */
		exit(1);
	}	
	enclosingBox->SetLayout( layout );
	
	// Get the data on days of week
	unsigned int daysInWeek = (unsigned int)( calModule->GetDaysInWeek() );
	map<uint32, DoubleNames> weekdayNames = calModule->GetWeekdayNames();
	
	indexX = indexY = 0;
	for (unsigned char day = 0; day < daysInWeek; ++day )
	{
		/* Creating the message to be sent */
		toSend = new BMessage( kCalendarModuleWeekendDaySelected );
		if ( !toSend )
		{
			/* Panic! */
			exit(1);
		}
		toSend->AddInt32( "Weekday no", day );

		/* Obtain the name of the day. I use the long name. */
		tempString = (DoubleNames)weekdayNames[ day ].longName;
		
		/* Creating the checkbox */
		dayCheckBox = new BCheckBox( BRect(0, 0, 1, 1),
									 "Weekday",
									 tempString.String(),
									 toSend );
		if (!dayCheckBox)
		{
			// Panic!
			exit(1);
		}
		
		dayCheckBox->ResizeToPreferred();
		
		/* Adding the item to the BBox */
		layout->AddView( dayCheckBox, indexX, indexY );
		
		/* Advancing to the next cell in grid */
		// If arrived to the last item in the first column, advancing to second
		if ( day == ( int )( ( daysInWeek + 1 ) / 2 ) )
		{
			indexX = 1;	
			indexY = 0;
		}
		else 	// Staying in the same column, but advancing down
		{
			++indexY;	
		}
		
	}	// <-- end of "for (all days in week)"

	BListView* weekdayColorSelector = NULL;	
	
	
	
	
}
Beispiel #4
0
BControl *
DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect)
{
	BRect rect;
	if (hintRect)
		rect = *hintRect;
	else
		rect.Set(0, 0, 50, 100);

	switch (parameter->Type()) {
		case BParameter::B_NULL_PARAMETER:
			// there is no default view for a null parameter
			return NULL;

		case BParameter::B_DISCRETE_PARAMETER:
		{
			BDiscreteParameter &discrete = static_cast<BDiscreteParameter &>(*parameter);

			if (!strcmp(discrete.Kind(), B_ENABLE)
				|| !strcmp(discrete.Kind(), B_MUTE)
				|| discrete.CountItems() == 0) {
				// create a checkbox item

				BCheckBox *checkBox = new BCheckBox(rect, discrete.Name(),
					discrete.Name(), NULL);
				checkBox->ResizeToPreferred();

				return checkBox;
			} else {
				// create a pop up menu field

				// ToDo: replace BOptionPopUp (or fix it in Antares...)
				// this is a workaround for a bug in BOptionPopUp - you need to
				// know the actual width before creating the object - very nice...

				BFont font;
				float width = 0;
				for (int32 i = 0; i < discrete.CountItems(); i++) {
					float labelWidth = font.StringWidth(discrete.ItemNameAt(i));
					if (labelWidth > width)
						width = labelWidth;
				}
				width += font.StringWidth(discrete.Name()) + 55;
				rect.right = rect.left + width;

				BOptionPopUp *popUp = new BOptionPopUp(rect, discrete.Name(),
					discrete.Name(), NULL);

				for (int32 i = 0; i < discrete.CountItems(); i++) {
					popUp->AddOption(discrete.ItemNameAt(i), discrete.ItemValueAt(i));
				}

				popUp->ResizeToPreferred();

				return popUp;
			}
		}

		case BParameter::B_CONTINUOUS_PARAMETER:
		{
			BContinuousParameter &continuous = static_cast<BContinuousParameter &>(*parameter);

			if (!strcmp(continuous.Kind(), B_MASTER_GAIN)
				|| !strcmp(continuous.Kind(), B_GAIN)) {
				BChannelSlider *slider = new BChannelSlider(rect, continuous.Name(),
					continuous.Name(), NULL, B_VERTICAL, continuous.CountChannels());

				char minLabel[64], maxLabel[64];

				const char *unit = continuous.Unit();
				if (unit[0]) {
					// if we have a unit, print it next to the limit values
					sprintf(minLabel, "%g %s", continuous.MinValue(), continuous.Unit());
					sprintf(maxLabel, "%g %s", continuous.MaxValue(), continuous.Unit());
				} else {
					sprintf(minLabel, "%g", continuous.MinValue());
					sprintf(maxLabel, "%g", continuous.MaxValue());
				}
				slider->SetLimitLabels(minLabel, maxLabel);

				float width, height;
				slider->GetPreferredSize(&width, &height);
				slider->ResizeTo(width, 190);

				// ToDo: take BContinuousParameter::GetResponse() & ValueStep() into account!

				for (int32 i = 0; i < continuous.CountChannels(); i++) {
					slider->SetLimitsFor(i, int32(continuous.MinValue() * 1000),
						int32(continuous.MaxValue() * 1000));
				}

				return slider;
			}

			BSlider *slider = new BSlider(rect, parameter->Name(), parameter->Name(),
				NULL, 0, 100);

			float width, height;
			slider->GetPreferredSize(&width, &height);
			slider->ResizeTo(100, height);

			return slider;
		}

		default:
			ERROR("BMediaTheme: Don't know parameter type: 0x%x\n",
				parameter->Type());
	}
	return NULL;
}
/*!	
 *	\brief			Create box for selection of the weekend days
 *	\note			Additionally, select the color for weekends and weekdays
 *	\param[in]	frame	Enclosing rectangle.
 *	\param[in]	id		Reference to name of the selected Calendar module.
 *	\returns		Pointer to all-set-up BBox. Or NULL in case of error.
 */
BBox*	CalendarModulePreferencesView::CreateWeekendSelectionBox( BRect frame,
															  const BString &id )
{
	/*!	\par	Notes on implementation:
	 *			It's not all that straightforward - to create this selection box.
	 *			The problem is that number of days in week is dependent on the
	 *			Calendar Module, therefore the frame rectangle must be divided
	 *			properly. We should take into account the possibility that there's
	 *			not enough place for all days in the submitted frame.
	 *
	 *	\par	
	 *			The solution will be as follows:
	 *			Let number of days in week be N. I create two columns and 
	 *			several rows (the number depends on N). Days in week will be
	 *			proceeded in the order <em>as Calendar Module supplies them</em>.
	 *			The days occupy both columns, and are located in rows
	 *			[0, (ceiling of (N/2)) ). Days returned from CalendarModule are
	 *			placed as follows: days from 0 to (ceiling of (N/2)-1) in the left
	 *			column, days from (ceiling of (N/2)-1) to (N-1) in right column.
	 *
	 *	\par	
	 *			There will be an empty cell in the right column, if number
	 *			of days in week is odd, (which is usually the case).
	 */
	frame.InsetBySelf( 5, 0 );
	BMessage* 	toSend = NULL;
	BCheckBox* 	dayCheckBox = NULL;
	BString		tempString;
	BLayoutItem*	layoutItem = NULL;
	CalendarModulePreferences* prefs = NULL;
	CalendarModule*	calModule = NULL;
	int height = 0;		//!< this is used to resize the BBox to proper size
	
	calModule = utl_FindCalendarModule( id );
	if ( calModule == NULL ) {
		/* Error */
		utl_Deb = new DebuggerPrintout( "Did not succeed to find the calendar module." );
		return NULL;
	}
	// Get the data on days of week
	uint32 daysInWeek = ( uint32 )( calModule->GetDaysInWeek() );
	map<uint32, DoubleNames> weekdayNames = calModule->GetWeekdayNames();

	
	/* Obtain the current Calendar Module preferences */
	prefs = pref_GetPreferencesForCalendarModule( id );
	if ( !prefs ) {
		utl_Deb = new DebuggerPrintout( "Did not succeed to find the preferences for the calendar module." );
		return NULL;
	}
	
	// At this point, "pref" points to current preferences of this calendar module.
	
	BList* weekends = prefs->GetWeekends();		// Get info on currently selected weekends
	
	// Prepare the item to be returned
	BBox*	enclosingBox = new BBox( frame, "Weekend selector" );
	if ( !enclosingBox )
	{
		/* Panic! */
		exit(1);
	}
	enclosingBox->SetLabel( "Select the non-working days (weekends)" );

	// Prepare the layout to be used
	BGridLayout* layout = new BGridLayout();
	if ( !layout)
	{
		/* Panic! */
		exit(1);
	}	
	enclosingBox->SetLayout( layout );
	layout->SetInsets( 10, 15, 10, 5 );
	layout->SetVerticalSpacing( 1 );
	
	/* indexX is 0 for left column or 1 for right column.
	 * indexY is 0 for topmost row, 1 for second from top row, etc.
	 * Max value for indexY = (ceiling of (N/2)).
	 */
	int indexX = 0, indexY = 0;
	
	for (uint32 day = prefs->GetFirstDayOfWeek(), i = 0; i < ( uint32 )daysInWeek; ++i )
	{
		/* Creating the message to be sent */
		toSend = new BMessage( kCalendarModuleWeekendDaySelected );
		if ( !toSend )
		{
			/* Panic! */
			exit(1);
		}
		toSend->AddInt32( "Weekday const", day );
		toSend->AddString( "Calendar module", id );

		/* Set the name of the checkbox.
		 * This is used to identify if the checkbox was checked or unchecked.
		 */
		tempString.SetTo( "Weekday" );
		tempString << day;
		
		/* Creating the checkbox */
		dayCheckBox = new BCheckBox( BRect(0, 0, 1, 1),
									 tempString.String(),
									 weekdayNames[ day ].longName.String(),
									 toSend );
		if (!dayCheckBox)
		{
			// Panic!
			exit(1);
		}
		dayCheckBox->ResizeToPreferred();
		
		// Check if the checkbox should be checked
		if ( weekends->HasItem( ( void* )day ) ) {
			dayCheckBox->SetValue( 1 );
		} else {
			dayCheckBox->SetValue( 0 );
		}
		
		/* Adding the item to the BBox */
		layoutItem = layout->AddView( dayCheckBox, indexX, indexY );
		if ( layoutItem )
		{
			layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT, B_ALIGN_TOP ) );
//			layoutItem->SetExplicitMaxSize( BSize( (int )dayCheckBox->Bounds().Width(), (int )dayCheckBox->Bounds().Height() ) );
			layout->SetMaxRowHeight( indexY, (int )dayCheckBox->Bounds().Height() + 10 );
			layout->SetRowWeight( indexY, 0 );
		}
		
		/* Advancing to the next cell in grid */
		// If arrived to the last item in the first column, advancing to second
		// The +1 is needed because i starts from 0, but days are starting from 1
		if ( ( i + 1 ) == ( unsigned int )( ( daysInWeek + 1 ) / 2 ) )
		{
			indexX = 1;	
			indexY = 0;
		}
		else 	// Staying in the same column, but advancing down
		{
			++indexY;	
		}
		
		/* Advancing to the next day */
		( day == daysInWeek ) ? day = kSunday : ++day;
		
	}	// <-- end of "for (all days in week)"
	
	// Resizing the BBox to the correct size.
	// Note: dayCheckBox is surely not NULL; if it were, we would exit earlier.
	height =(int )( ( dayCheckBox->Bounds().Height() + 5           ) * ( int )( ( daysInWeek + 1 ) / 2 ) - 5 );
	// Formula:	    ( ^height of one checkbox^       + ^separator^ ) * ( ^number of days in column^      ) - ^one unneeded extra separator^
	
	enclosingBox->ResizeTo( enclosingBox->Bounds().Width() - 10, ( int )height );
//	layout->SetExplicitMaxSize( BSize( enclosingBox->Bounds().Width() - 5, ( int )height + 25 ) );
	
	return enclosingBox;
}
Beispiel #6
0
// --------------------------------------------------------------
NetworkSetupWindow::NetworkSetupWindow(const char *title)
	:
	BWindow(BRect(100, 100, 600, 600), title, B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	BMenu 		*show_menu;
	BMenu		*profiles_menu;
	BMenuField 	*menu_field;
	BBox 		*top_box, *bottom_box, *line;	// *group
	BButton		*button;
	BCheckBox 	*check;
	BRect		r;
	float		x, w, h;
	float		size, min_size = 360;

	// TODO: cleanup this mess!
	show_menu = new BPopUpMenu("<please select me!>");
	_BuildShowMenu(show_menu, SHOW_MSG);
	
#define H_MARGIN	10
#define V_MARGIN	10
#define SMALL_MARGIN	3

	// Resize the window to minimal width
	ResizeTo(fMinAddonViewRect.Width() + 2 * H_MARGIN, Bounds().Height());

	top_box = new BBox(Bounds(), NULL, B_FOLLOW_NONE,
						B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
						B_PLAIN_BORDER);
	AddChild(top_box); 

	r = top_box->Bounds();
	r.InsetBy(H_MARGIN, V_MARGIN);

	// ---- Profiles section
	profiles_menu = new BPopUpMenu("<none>");
	menu_field = new BMenuField(r, "profiles_menu", PROFILE_LABEL, 
		profiles_menu);

	menu_field->SetFont(be_bold_font);
	menu_field->SetDivider(be_bold_font->StringWidth(PROFILE_LABEL "#"));
	top_box->AddChild(menu_field);
	menu_field->ResizeToPreferred();
	menu_field->GetPreferredSize(&w, &h);

	size = w;

	button = new BButton(r, "manage_profiles", MANAGE_PROFILES_LABEL,
					new BMessage(MANAGE_PROFILES_MSG),
					B_FOLLOW_TOP | B_FOLLOW_RIGHT);
	button->GetPreferredSize(&w, &h);
	button->ResizeToPreferred();
	button->MoveTo(r.right - w, r.top);
	top_box->AddChild(button);
	
	size += SMALL_MARGIN + w;
	
	min_size = max_c(min_size, (H_MARGIN + size + H_MARGIN));
	
	r.top += h + V_MARGIN;

	// ---- Separator line between Profiles section and Settings section
	line = new BBox(BRect(r.left, r.top, r.right, r.top + 1), NULL,
						 B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
	top_box->AddChild(line);

	_BuildProfilesMenu(profiles_menu, SELECT_PROFILE_MSG);

	r.top += 2 + V_MARGIN;

	// ---- Settings section

	// Make the show popup field half the whole width and centered
	menu_field = new BMenuField(r, "show_menu", SHOW_LABEL, show_menu);
	menu_field->SetFont(be_bold_font);
	menu_field->SetDivider(be_bold_font->StringWidth(SHOW_LABEL "#"));
	top_box->AddChild(menu_field);

	menu_field->ResizeToPreferred();
	menu_field->GetPreferredSize(&w, &h);
	r.top += h+1 + V_MARGIN;
	
	min_size = max_c(min_size, (H_MARGIN + w + H_MARGIN));
	

	r = fMinAddonViewRect.OffsetByCopy(H_MARGIN, r.top);
	fPanel = new BBox(r, "showview_box", B_FOLLOW_NONE,
						B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
						B_PLAIN_BORDER);
	top_box->AddChild(fPanel);
	top_box->ResizeTo(Bounds().Width(), r.bottom + 1 + V_MARGIN);

	// ---- Bottom globals buttons section
	r = Bounds();
	r.top = top_box->Frame().bottom + 1;
	bottom_box = new BBox(r, NULL, B_FOLLOW_NONE,
						B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
						B_PLAIN_BORDER);
	AddChild(bottom_box); 

	r.OffsetTo(0, 0);
	r.InsetBy(H_MARGIN, V_MARGIN);

	check = new BCheckBox(r, "dont_touch", DONT_TOUCH_LABEL,
					new BMessage(DONT_TOUCH_MSG),
					B_FOLLOW_TOP | B_FOLLOW_LEFT);
	check->GetPreferredSize(&w, &h);
	check->ResizeToPreferred();
	check->SetValue(B_CONTROL_ON);
	check->MoveTo(H_MARGIN, r.top);
	bottom_box->AddChild(check);
	
	size = w;

	button = new BButton(r, "apply_now", APPLY_NOW_LABEL,
					new BMessage(APPLY_NOW_MSG),
					B_FOLLOW_TOP | B_FOLLOW_RIGHT);
	button->GetPreferredSize(&w, &h);
	button->ResizeToPreferred();
	x = r.right - w;
	button->MoveTo(x, r.top);
	bottom_box->AddChild(button);

	fApplyNowButton = button;
	
	size += SMALL_MARGIN + w;
	
	button = new BButton(r, "revert", REVERT_LABEL, new BMessage(REVERT_MSG), 
		B_FOLLOW_TOP | B_FOLLOW_RIGHT);
		
	button->GetPreferredSize(&w, &h);
	button->ResizeToPreferred();
	button->MoveTo(x - w - SMALL_MARGIN, r.top);
	bottom_box->AddChild(button);

	fRevertButton = button;
	fRevertButton->SetEnabled(false);

	size += SMALL_MARGIN + w;

	min_size = max_c(min_size, (H_MARGIN + size + H_MARGIN));
	
	r.bottom = r.top + h;
	r.InsetBy(-H_MARGIN, -V_MARGIN);
	
	bottom_box->ResizeTo(Bounds().Width(), r.Height());

	// Resize window to enclose top and bottom boxes
	ResizeTo(Bounds().Width(), bottom_box->Frame().bottom);
	
	// Enable boxes resizing modes
	top_box->SetResizingMode(B_FOLLOW_ALL);
	fPanel->SetResizingMode(B_FOLLOW_ALL);
	bottom_box->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);

	// Set default/minimal window size
	ResizeTo(min_size, Bounds().Height());
	SetSizeLimits(min_size, 20000, Bounds().Height(), 20000);	
	
	fAddonView = NULL;
}