Exemple #1
0
PasswordWindow::PasswordWindow(ScreenSaverSettings& settings) 
	: BWindow(BRect(100, 100, 380, 249), "Password Window", B_MODAL_WINDOW_LOOK,
		B_MODAL_APP_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE),
	fSettings(settings)
{
	_Setup();
	Update();

	BRect screenFrame = BScreen(B_MAIN_SCREEN_ID).Frame();
	BPoint point;
	point.x = (screenFrame.Width() - Bounds().Width()) / 2;
	point.y = (screenFrame.Height() - Bounds().Height()) / 2;

	if (screenFrame.Contains(point))
		MoveTo(point);
}
Exemple #2
0
void
TTimeWindow::_AlignWindow()
{
	BPoint pt = TimeSettings().LeftTop();
	MoveTo(pt);

	BRect frame = Frame();
	BRect screen = BScreen().Frame();
	if (!frame.Intersects(screen.InsetByCopy(50.0, 50.0))) {
		BRect bounds(Bounds());
		BPoint leftTop((screen.Width() - bounds.Width()) / 2.0,
			(screen.Height() - bounds.Height()) / 2.0);

		MoveTo(leftTop);
	}
}
void
BrowserApp::_CreateNewWindow(const BString& url, bool fullscreen)
{
	// Offset the window frame unless this is the first window created in the
	// session.
	if (fWindowCount > 0)
		fLastWindowFrame.OffsetBy(20, 20);
	if (!BScreen().Frame().Contains(fLastWindowFrame))
		fLastWindowFrame.OffsetTo(50, 50);

	BrowserWindow* window = new BrowserWindow(fLastWindowFrame, fSettings,
		url);
	if (fullscreen)
		window->ToggleFullscreen();
	window->Show();
}
void
TExpandoMenuBar::AddTeam(BList *team, BBitmap *icon, char *name, char *signature)
{
	float itemWidth = fVertical ? Frame().Width() : kMinimumWindowWidth;
	float itemHeight = -1.0f;

	desk_settings *settings = ((TBarApp *)be_app)->Settings();
	TTeamMenuItem *item = new TTeamMenuItem(team, icon, name, signature, itemWidth,
		itemHeight, fDrawLabel, fVertical);

	if (settings->trackerAlwaysFirst && !strcmp(signature, kTrackerSignature)) {
		AddItem(item, fFirstApp);
	} else if (settings->sortRunningApps) {
		TTeamMenuItem *teamItem = dynamic_cast<TTeamMenuItem *>(ItemAt(fFirstApp));
		int32 firstApp = fFirstApp;

		// if Tracker should always be the first item, we need to skip it
		// when sorting in the current item
		if (settings->trackerAlwaysFirst && teamItem != NULL
			&& !strcmp(teamItem->Signature(), kTrackerSignature)) {
			firstApp++;
		}

		int32 count = CountItems(), i;
		for (i = firstApp; i < count; i++) {
			teamItem = dynamic_cast<TTeamMenuItem *>(ItemAt(i));
			if (teamItem != NULL && strcasecmp(teamItem->Name(), name) > 0) {
				AddItem(item, i);
				break;
			}
		}
		// was the item added to the list yet?
		if (i == count)
			AddItem(item);
	} else
		AddItem(item);

	if (fVertical) {
		if (item && fShowTeamExpander && fExpandNewTeams)
			item->ToggleExpandState(false);

		fBarView->SizeWindow(BScreen(Window()).Frame());
	} else 
		CheckItemSizes(1);

	Window()->UpdateIfNeeded();
}
Exemple #5
0
MainWindow::MainWindow(BRect pieRect)
	:
	BWindow(pieRect, B_TRANSLATE_SYSTEM_NAME("DiskUsage"), B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE
		| B_AUTO_UPDATE_SIZE_LIMITS)
{
	fControlsView = new ControlsView();

	SetLayout(new BGroupLayout(B_VERTICAL));

	AddChild(BLayoutBuilder::Group<>(B_VERTICAL)
		.Add(fControlsView)
		.SetInsets(0, B_USE_WINDOW_SPACING, 0, 0)
	);
	float maxHeight = BScreen(this).Frame().Height() - 12;
	fControlsView->SetExplicitMaxSize(BSize(maxHeight, maxHeight));
}
void
PulseWindow::MoveOnScreen()
{
	// check if the window is on screen, and move it if not
	BRect frame = Frame();
	BRect screenFrame = BScreen().Frame();

	if (frame.left > screenFrame.right)
		MoveBy(screenFrame.right - frame.right - 10, 0);
	else if (frame.right < 0)
		MoveTo(10, frame.top);

	if (frame.top > screenFrame.bottom)
		MoveBy(0, screenFrame.bottom - frame.bottom - 10);
	else if (frame.bottom < 0)
		MoveTo(frame.left, 10);
}
void RBitmapView::Draw(BRect )
{
    switch(BScreen().ColorSpace())
    {
        case B_COLOR_8_BIT:
        if (mMap8)
        {
            DrawBitmap(mMap8);
            break;
        }
        default:
        if (mMap32)
        {
            DrawBitmap(mMap32);
        }
    }
    return;
}
BRect
FitRectToScreen(BRect source)
{
	// This function returns the source moved and resized so that it fits onto
	// current screen.
	BRect result = source;
	BRect screenFrame = BScreen().Frame();

	if (!screenFrame.Contains(result.RightBottom()))
		result.OffsetTo(BPoint(15.0, 15.0));

	if (!screenFrame.Contains(result.RightBottom())) {
		result.bottom = min_c(screenFrame.bottom, result.bottom);
		result.right = min_c(screenFrame.right, result.right);
	}

	return result;
}
// TopOfScreen -- Places the BWindow starting from the top of the Current Screen
static void TopOfScreen(BWindow* w)
{
	BRect	screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame());
	BPoint 	pt;
	pt.x = screenFrame.Width() - 350;
	pt.y = 296;

	if (screenFrame.Contains(pt))
		w->MoveTo(pt);
	
	int BottomProp = 269;
	//int BottomProp = (int) screenFrame.Height() - 450; // 450
	/*char tmp[250];
	sprintf(tmp,"BottomProp is %i",BottomProp);
	(new BAlert("",tmp,"debug"))->Go();*/
	//w->ResizeTo(225,BottomProp);
	w->ResizeTo(w->Bounds().Width(),BottomProp);
}
PreviewView::PreviewView()
	:
	BView("Rect View", B_WILL_DRAW),
	fBitmapView(NULL),
	fCoordRect(BScreen().Frame()),
	fTimeStamp(0),
	fChanged(true),
	fLeftTop(NULL),
	fRightBottom(NULL)
{
	SetLayout(new BGroupLayout(B_VERTICAL));
	BLayoutBuilder::Group<>(this)
	.AddGroup(B_VERTICAL, 0)
		.AddGroup(B_HORIZONTAL, 0)
			.Add(fBitmapView = new BitmapView())
		.End()
	.End();
}
Exemple #11
0
/* be_gfx_bwindow_set_palette:
 *  Sets the internal color map to reflect the given palette, and
 *  makes the drawing thread to update the window.
 */
extern "C" void be_gfx_bwindow_set_palette(AL_CONST struct RGB *p, int from, int to, int vsync)
{
   int i;
   
   if (vsync)
      be_gfx_vsync();
   
   if (_be_allegro_window->screen_depth != 8)
      return;
   
   _be_allegro_window->Lock();
   for (i=from; i<=to; i++)
      cmap[i] = BScreen().IndexForColor(p[i].r << 2, p[i].g << 2, p[i].b << 2);
   for (i=0; i<_be_allegro_window->screen_height; i++)
      _be_dirty_lines[i] = 1;
   _be_allegro_window->Unlock();
   release_sem(_be_window_lock);
}
bool
SelectionWindow::QuitRequested()
{
	Hide();
	BMessage message(fCommand);
	BBitmap *bitmap = NULL;	
	BRect selection = fView->SelectionRect();
	FixRect(selection);
	BScreen(this).GetBitmap(&bitmap, false, &selection);
	
	snooze(2000);
	message.AddRect("selection", selection);
	message.AddPointer("bitmap", bitmap);
	
	fTarget.SendMessage(&message);
	
		
	return BWindow::QuitRequested();
}
void
ProcessController::MouseDown(BPoint where)
{
	if (atomic_add(&gPopupFlag, 1) > 0) {
		atomic_add(&gPopupFlag, -1);
		return;
	}

	Tpopup_param* param = new Tpopup_param;
	ConvertToScreen(&where);
	param->where = where;
	param->clickToOpenRect = Frame ();
	ConvertToScreen (&param->clickToOpenRect);
	param->top = where.y < BScreen(this->Window()).Frame().bottom-50;

	gPopupThreadID = spawn_thread(thread_popup, "Popup holder thread",
		B_URGENT_DISPLAY_PRIORITY, param);
	resume_thread(gPopupThreadID);
}
extern "C" int be_sys_desktop_color_depth(void)
{
    display_mode current_mode;

    BScreen().GetMode(&current_mode);
    switch(current_mode.space) {
    case B_CMAP8:
        return 8;
    case B_RGB15:
    case B_RGBA15:
        return 15;
    case B_RGB16:
        return 16;
    case B_RGB32:
    case B_RGBA32:
        return 32;
    }
    return -1;
}
Exemple #15
0
MainWindow::MainWindow(BRect pieRect)
	: BWindow(pieRect, "DiskUsage", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)
{
	BRect r = Bounds();
	r.bottom = r.top + 1.0;
	fControlsView = new ControlsView(r);
	float cvHeight = fControlsView->Bounds().Height();
	AddChild(fControlsView);

	r = Bounds();
	r.top = r.bottom - 1.0;
	fStatusView = new StatusView(r);
	float svHeight = fStatusView->Bounds().Height();

	float winHeight = pieRect.Height() + cvHeight + svHeight;
	fStatusView->MoveTo(0.0, winHeight - svHeight);
	ResizeTo(r.Width(), winHeight);

	AddChild(fStatusView);

	r = fControlsView->Frame();
	r.top = r.bottom + 1.0;
	r.bottom = fStatusView->Frame().top - 1.0;
	fPieView = new PieView(r, this);
	AddChild(fPieView);

	Show();

	// Note: The following code is semi-broken because BScreen::Frame()
	// returns incorrect dimensions for the G200 in 1152x864 mode.  I reported
	// this bug, and Be said it's not a bug -- the Matrox driver actually uses
	// a resolution of 1152x900 in that mode.  Oh well.
	Lock();
	float extraHeight = fControlsView->Bounds().Height() + fStatusView->Bounds().Height();
	float minHeight = kMinWinSize + extraHeight;
	float maxHeight = BScreen(this).Frame().Height();
	float maxWidth = maxHeight - extraHeight;
	Unlock();

	SetSizeLimits(kMinWinSize, maxWidth, minHeight, maxHeight);
}
void
OutputView::UpdateSettings()
{
	Settings settings;
	
	if (fWholeScreen->Value() == B_CONTROL_ON)
		settings.SetCaptureArea(BScreen().Frame());
		
	//BRect captureRect = settings.CaptureArea();
	//const float factor = 100;
	
	//  TODO: set the frame
	//settings.SetClipFrame(GetScaledRect(captureRect, factor));
	
	UpdatePreviewFromSettings();
	
	BuildCodecMenu(FormatFamily());
	
	fController->SetMediaFormat(fFormat);
}
Exemple #17
0
bool8
S9xDeinitUpdate (int Width, int Height, bool8 sixteen_bit)
{
	if(settings.ui.s9x_vsync)
		BScreen().WaitForRetrace();
	switch(settings.ui.s9x_drawmode) {
		case DIRECT:
			s9x->DrawDirect(Width, Height);
			break;
		case OVERLAY:
			s9x->DrawOverlay(Width, Height);
			break;
		case BITMAP:
			s9x->DrawStandard(Width, Height);
			break;
	}
	if(settings.ui.s9x_snooze)
		sleep_until();
	asm("emms");
	return (true);
}
Exemple #18
0
VUView::VUView(BRect rect, uint32 resizeFlags)
	: BView(rect, "vumeter", resizeFlags, B_WILL_DRAW),
	fThreadId(-1),
	fBitmap(NULL),
	fQuitting(false)
{
	rect.OffsetTo(B_ORIGIN);
	fLevelCount = int(rect.Height()) / 2;
	fChannels = 2;
	fCurrentLevels = new int32[fChannels];
	for (int channel = 0; channel < fChannels; channel++)
		fCurrentLevels[channel] = 0;
	fBitmap = new BBitmap(rect, BScreen().ColorSpace(), true);
	
	
	memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
	
	fBitmapView = new BView(rect, "bitmapView", B_FOLLOW_LEFT|B_FOLLOW_TOP, 
		B_WILL_DRAW);
	fBitmap->AddChild(fBitmapView);
}
void
TBarView::PlaceTray(bool vertSwap, bool leftSwap)
{
	BPoint statusLoc;
	if (fState == kFullState) {
		fDragRegion->ResizeTo(fBarMenuBar->Frame().Width(), kMenuBarHeight);
		statusLoc.y = fBarMenuBar->Frame().bottom + 1;
		statusLoc.x = 0;
		fDragRegion->MoveTo(statusLoc);

		if (!fReplicantTray->IsHidden())
			fReplicantTray->Hide();

		return;
	}

	if (fReplicantTray->IsHidden())
		fReplicantTray->Show();

	if (fTrayLocation != 0) {
		fReplicantTray->SetMultiRow(fVertical);
		fReplicantTray->RealignReplicants();
		fDragRegion->ResizeToPreferred();

		if (fVertical) {
			statusLoc.y = fBarMenuBar->Frame().bottom + 1;
			statusLoc.x = 0;
			if (fLeft && fVertical)
				fReplicantTray->MoveTo(5, 2);
			else
				fReplicantTray->MoveTo(2, 2);
		} else {
			BRect screenFrame = (BScreen(Window())).Frame();
			statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width();
			statusLoc.y = -1;
		}

		fDragRegion->MoveTo(statusLoc);
	}
}
Exemple #20
0
BBitmap *DragonView::_MakeNoneImage( void )
{
	// Draw an "empty" bitmap to represent "no image"; we'll use one
	// that tells the user what to do.
	BBitmap *bitmap = new BBitmap( BRect( 0, 0, 319, 199 ),
								   BScreen().ColorSpace(),
								   true );
	BView *view = new BView( bitmap->Bounds(),
							 "not a bitmap",
							 B_FOLLOW_ALL_SIDES, 0 );
	bitmap->AddChild( view );

	DragonApp *app = dynamic_cast<DragonApp *>( be_app );
	
	rgb_color White = { 255, 255, 255, 0 };
	rgb_color Black = { 0, 0, 0, 0 };
	
	bitmap->Lock();

	view->SetLowColor( White );
	view->SetViewColor( White );
	view->SetHighColor( Black );
	view->SetDrawingMode( B_OP_OVER );
	view->FillRect( view->Bounds(), B_SOLID_LOW );

	// Excercise for the reader here:  Read the old newsletter articles
	// about how to use the font metrics to find out how large a font is,
	// then center to font in the window dynamically no matter what font
	// settings the user has.

	view->SetFont( be_plain_font );
	view->MovePenTo( 5, 100 );
	view->DrawString( app->rsrc_strings->FindString( RSRC_Drop_an_image ) );
	view->Sync();
	
	bitmap->Unlock();

	return bitmap;
}
Exemple #21
0
VolumeWindow::VolumeWindow(BRect frame, bool dontBeep, int32 volumeWhich)
	: BWindow(frame, "VolumeWindow", B_BORDERED_WINDOW_LOOK,
		B_FLOATING_ALL_WINDOW_FEEL,
		B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK
		| B_AUTO_UPDATE_SIZE_LIMITS, 0),
	fUpdatedCount(0)
{
	SetLayout(new BGroupLayout(B_HORIZONTAL));

	BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
	layout->SetInsets(5, 5, 5, 5);

	BBox* box = new BBox("sliderbox");
	box->SetLayout(layout);
	box->SetBorder(B_PLAIN_BORDER);
	AddChild(box);

	BSlider* slider = new VolumeControl(volumeWhich, !dontBeep,
		new BMessage(kMsgVolumeChanged));
	slider->SetModificationMessage(new BMessage(kMsgVolumeUpdate));
	box->AddChild(slider);

	slider->SetTarget(this);
	ResizeTo(300, 50);

	// Make sure it's not outside the screen.
	const int32 kMargin = 3;
	BRect windowRect = Frame();
	BRect screenFrame(BScreen(B_MAIN_SCREEN_ID).Frame());
	if (screenFrame.right < windowRect.right + kMargin)
		MoveBy(- kMargin - windowRect.right + screenFrame.right, 0);
	if (screenFrame.bottom < windowRect.bottom + kMargin)
		MoveBy(0, - kMargin - windowRect.bottom + screenFrame.bottom);
	if (screenFrame.left > windowRect.left - kMargin)
		MoveBy(kMargin + screenFrame.left - windowRect.left, 0);
	if (screenFrame.top > windowRect.top - kMargin)
		MoveBy(0, kMargin + screenFrame.top - windowRect.top);
}
PreviewView::PreviewView()
	:
	BView("Rect View", B_WILL_DRAW),
	fBitmapView(NULL),
	fLeftTop(NULL),
	fRightBottom(NULL)
{
	fCoordRect = BScreen().Frame();
	fChanged = true;

	SetLayout(new BGroupLayout(B_VERTICAL));
	//SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
	//	B_ALIGN_VERTICAL_CENTER));
	BLayoutBuilder::Group<>(this)
	.AddGroup(B_VERTICAL, 0)
		//.AddGroup(B_HORIZONTAL)
		//	.AddGlue()
		//	.AddGlue()
		//.End()
		.AddGroup(B_HORIZONTAL, 0)
			//.AddStrut(10)
			//.Add(fLeftTop = new BStringView("lefttop", ""))
			.Add(fBitmapView = new BitmapView())
			//.Add(fRightBottom = new BStringView("rightbottom", ""))
			//.AddStrut(10)
			.End()
		/*.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.AddGlue()
		.End()*/
		.End();
	
	/*fLeftTop->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_TOP));
	fRightBottom->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
		B_ALIGN_BOTTOM));*/
}
Exemple #23
0
void
TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
{
	int32 count = CountItems();
	for (int32 i = fFirstApp; i < count; i++) {
		if (TTeamMenuItem *item = dynamic_cast<TTeamMenuItem *>(ItemAt(i))) {
			if (item->Teams()->HasItem((void *)team)) {
				item->Teams()->RemoveItem(team);

				if (partial)
					return;

#ifdef DOUBLECLICKBRINGSTOFRONT
				if (fLastClickItem == i)
					fLastClickItem = -1;
#endif

				RemoveItem(i);

				if (fVertical) {
					//	instead of resizing the window here and there in the code
					//	the resize method will be centered in one place
					//	thus, the same behavior (good or bad) will be used whereever
					//	window sizing is done
					fBarView->SizeWindow(BScreen(Window()).Frame());
				} else
					CheckItemSizes(-1);

				Window()->UpdateIfNeeded();

				delete item;
				return;
			}
		}
	}
}
Exemple #24
0
void
TTimeView::ShowCalendar(BPoint where)
{
	if (fCalendarWindow.IsValid()) {
		// If the calendar is already shown, just activate it
		BMessage activate(B_SET_PROPERTY);
		activate.AddSpecifier("Active");
		activate.AddBool("data", true);

		if (fCalendarWindow.SendMessage(&activate) == B_OK)
			return;
	}

	where.y = Bounds().bottom + 4.0;
	ConvertToScreen(&where);

	if (where.y >= BScreen().Frame().bottom)
		where.y -= (Bounds().Height() + 4.0);

	CalendarMenuWindow* window = new CalendarMenuWindow(where);
	fCalendarWindow = BMessenger(window);

	window->Show();
}
Exemple #25
0
MediaAlert::MediaAlert(BRect _rect, const char* title, const char* text)
	: BWindow(_rect, title, B_MODAL_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE)
{
	fTextView = NULL;

	// Set up the "_master_" view
	TAlertView* masterView = new TAlertView(Bounds());
	masterView->SetBitmap(InitIcon());
	AddChild(masterView);

	// Set up the text view
	BRect textViewRect(kTextIconOffset, kTextTopOffset,
		Bounds().right, Bounds().bottom);
	BRect rect = textViewRect;
	rect.OffsetTo(B_ORIGIN);
	rect.InsetBy(4, 2);

	fTextView = new BTextView(textViewRect, "_tv_", rect,
		B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
	fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTextView->SetText(text, strlen(text));
	fTextView->MakeEditable(false);
	fTextView->MakeSelectable(false);
	fTextView->SetWordWrap(true);
	fTextView->SetFontAndColor(be_bold_font);

	masterView->AddChild(fTextView);

	BRect screenFrame = BScreen(B_MAIN_SCREEN_ID).Frame();
	BPoint pt;
	pt.x = screenFrame.Width() / 2 - Bounds().Width() / 2;
	pt.y = screenFrame.Height() / 2 - Bounds().Height() / 2;

	if (screenFrame.Contains(pt))
		MoveTo(pt);
}
OutputView::OutputView(Controller *controller)
	:
	BView("Capture Options", B_WILL_DRAW),
	fController(controller)
{
	SetLayout(new BGroupLayout(B_VERTICAL));
	
	BBox *selectBox = new BBox("selection");
	selectBox->SetLabel("Selection");
	selectBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	AddChild(selectBox);
	
	BBox *outputBox = new BBox("output");
	outputBox->SetLabel("Output");
	outputBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	AddChild(outputBox);

	Settings settings;
	
	const char *kTCLabel = "File name:"; 
	const char *fileName = NULL;
	settings.GetOutputFileName(&fileName);
	fFileName = new BTextControl("file name",
			kTCLabel, fileName, new BMessage(kFileNameChanged));
	
	const char *kOutputMenuLabel = "Output Format:";
	fOutputFileType = new BOptionPopUp("OutFormat",
			kOutputMenuLabel, new BMessage(kFileTypeChanged));
						
	const char *kCodecMenuLabel = "Codec:";
	BPopUpMenu *popUpMenu = new BPopUpMenu("Codecs");
	fCodecMenu = new BMenuField("OutCodec", kCodecMenuLabel, popUpMenu);
	
	fWholeScreen = new BRadioButton("screen frame", "Whole screen",
		new BMessage(kCheckBoxAreaSelectionChanged));
	fCustomArea = new BRadioButton("custom area",
		"Custom Area", new BMessage(kCheckBoxAreaSelectionChanged));
	fSelectArea = new BButton("select area", "Select", new BMessage(kSelectArea));
	fSelectArea->SetEnabled(false);
	
	fMinimizeOnStart = new BCheckBox("Minimize on start",
		"Minimize on recording", new BMessage(kMinimizeOnRecording));
	
	fRectView = new PreviewView();
	
	BView *layoutView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
			.Add(fFileName)
			.Add(fOutputFileType)
			.Add(fCodecMenu)
			.Add(fMinimizeOnStart)
		.End()	
		.View();

	outputBox->AddChild(layoutView);

	layoutView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL)
			.AddGroup(B_HORIZONTAL)
				.AddGroup(B_VERTICAL, 0)
					.Add(fWholeScreen)
					.Add(fCustomArea)
				.End()
				.AddGroup(B_VERTICAL)
					.AddGlue()
					.Add(fSelectArea)
				.End()
			.End()
			.Add(fRectView)
		.End()
		.View();
	
	selectBox->AddChild(layoutView);

	fMinimizeOnStart->SetValue(settings.MinimizeOnRecording() ? B_CONTROL_ON : B_CONTROL_OFF);
	
	// fill in the list of available file formats
	media_file_format mff;
	
	int32 cookie = 0;
	bool firstFound = true;
	while (get_next_file_format(&cookie, &mff) == B_OK) {
		if (mff.capabilities & media_file_format::B_KNOWS_ENCODED_VIDEO) {
			fOutputFileType->AddOption(mff.pretty_name, mff.family);
			if (firstFound) {
				fOutputFileType->MenuField()->Menu()->ItemAt(0)->SetMarked(true);
				firstFound = false;
			}
		}	
	}
	
	fWholeScreen->SetValue(B_CONTROL_ON);
	
	UpdateSettings();
	
	fController->SetCaptureArea(BScreen(Window()).Frame());
	fController->SetMediaFormatFamily(FormatFamily());
	fController->SetOutputFileName(fFileName->Text());
}
Exemple #27
0
void
BrowserApp::ReadyToRun()
{
	// Since we will essentially run the GUI...
	set_thread_priority(Thread(), B_DISPLAY_PRIORITY);

	BWebPage::InitializeOnce();
	BWebPage::SetCacheModel(B_WEBKIT_CACHE_MODEL_WEB_BROWSER);

	BPath path;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK
		&& path.Append(kApplicationName) == B_OK
		&& create_directory(path.Path(), 0777) == B_OK) {

		BWebSettings::SetPersistentStoragePath(path.Path());
	}

	BString mainSettingsPath(kApplicationName);
	mainSettingsPath << "/Application";
	fSettings = new SettingsMessage(B_USER_SETTINGS_DIRECTORY,
		mainSettingsPath.String());
#if ENABLE_NATIVE_COOKIES
	mainSettingsPath = kApplicationName;
	mainSettingsPath << "/Cookies";
	fCookies = new SettingsMessage(B_USER_SETTINGS_DIRECTORY,
		mainSettingsPath.String());
	BMessage cookieArchive;
	cookieArchive = fCookies->GetValue("cookies", cookieArchive);
	fCookieJar = new BNetworkCookieJar(cookieArchive);
	BWebPage::SetCookieJar(fCookieJar);
#endif

	fLastWindowFrame = fSettings->GetValue("window frame", fLastWindowFrame);
	BRect defaultDownloadWindowFrame(-10, -10, 365, 265);
	BRect downloadWindowFrame = fSettings->GetValue("downloads window frame",
		defaultDownloadWindowFrame);
	BRect settingsWindowFrame = fSettings->GetValue("settings window frame",
		BRect());
	bool showDownloads = fSettings->GetValue("show downloads", false);

	fDownloadWindow = new DownloadWindow(downloadWindowFrame, showDownloads,
		fSettings);
	if (downloadWindowFrame == defaultDownloadWindowFrame) {
		// Initially put download window in lower right of screen.
		BRect screenFrame = BScreen().Frame();
		BMessage decoratorSettings;
		fDownloadWindow->GetDecoratorSettings(&decoratorSettings);
		float borderWidth = 0;
		if (decoratorSettings.FindFloat("border width", &borderWidth) != B_OK)
			borderWidth = 5;
		fDownloadWindow->MoveTo(screenFrame.Width()
			- fDownloadWindow->Frame().Width() - borderWidth,
			screenFrame.Height() - fDownloadWindow->Frame().Height()
			- borderWidth);
	}
	fSettingsWindow = new SettingsWindow(settingsWindowFrame, fSettings);

	BWebPage::SetDownloadListener(BMessenger(fDownloadWindow));

	fInitialized = true;

	int32 pagesCreated = 0;
	bool fullscreen = false;
	if (fLaunchRefsMessage) {
		_RefsReceived(fLaunchRefsMessage, &pagesCreated, &fullscreen);
		delete fLaunchRefsMessage;
		fLaunchRefsMessage = NULL;
	}
	if (pagesCreated == 0)
		_CreateNewWindow("", fullscreen);

	PostMessage(PRELOAD_BROWSING_HISTORY);
}
Exemple #28
0
AboutWindow::AboutWindow ()
	: BWindow (BRect (0, 0, 300, 200), "About", B_MODAL_WINDOW,
		B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE)
{
	PRINT (("AboutWindow::AboutWindow ()\n"));
	SetFeel (B_MODAL_APP_WINDOW_FEEL);
	SetLook (B_MODAL_WINDOW_LOOK);

	/* Create the BBitmap objects and set its data with error checking */
	BBitmap *appIcon = new BBitmap (BRect (0, 0, kLargeIconWidth - 1, kLargeIconHeight - 1), B_COLOR_8_BIT);
	appIcon->SetBits (iconBits, 32 * 32 * 8, 0, B_COLOR_8_BIT);
	BBitmap *bmp = BTranslationUtils::GetBitmap ('PNG ', "Image:AboutTitle");
	if (bmp == NULL)
	{
		BAlert *err = new BAlert ("Error", "An error was encountered while "
							"trying to load the resource element \"Image:AboutTitle\"\n", "Hmm..",
							NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT);
		err->Go();
		Hide();
		Quit();
		QuitRequested();
		return;
	}
	
	/* Yet another annoying control rendering section :( */
	BRect bounds (Bounds());
	backView = new BView (bounds.InsetBySelf (1, 1), "AboutWindow:BackView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
	AddChild (backView);

	iconView = new BView (BRect (1.5 * DialogMargin + 3, 1.5 * DialogMargin,
					1.5 * DialogMargin + kLargeIconWidth - 1 + 3, 1.5 * DialogMargin + kLargeIconWidth - 1),
					"AboutWindow:IconView", B_FOLLOW_LEFT, B_WILL_DRAW);
	backView->AddChild (iconView);
	iconView->SetViewBitmap (appIcon);
	
	float left = DialogMargin + kLargeIconWidth + 1.5 * ButtonSpacing - 3;
	float top = DialogMargin / 2.0;
	titleView = new BView (BRect (left, top, 214 + left, 58 + top), "AboutWindow:TitleView",
						B_FOLLOW_LEFT, B_WILL_DRAW);
	backView->AddChild (titleView);
	titleView->SetViewBitmap (bmp);
	
	lineView = new BView (BRect (0, titleView->Frame().bottom + 3, bounds.right, titleView->Frame().bottom + 3),
						"AboutWindow:LineView", B_FOLLOW_LEFT, B_WILL_DRAW);
	lineView->SetViewColor (128, 128, 128);
	backView->AddChild (lineView);
	
	textView = new MarqueeView (BRect (2, lineView->Frame().bottom + ButtonSpacing / 2 + 2,
									bounds.right - DialogMargin - 1, bounds.bottom - 2 - ButtonSpacing / 2),
									"AboutWindow:CreditsView", BRect (0, 0, bounds.right - DialogMargin, 0),
									B_FOLLOW_LEFT, B_WILL_DRAW);
	backView->AddChild (textView);
	textView->SetStylable (true);
	textView->MakeSelectable (false);
	textView->MakeEditable (false);
	textView->SetAlignment (B_ALIGN_CENTER);
	textView->SetViewColor (BePureWhite);
	backView->SetViewColor (BePureWhite);
	textView->SetFontAndColor (be_plain_font, B_FONT_ALL, &BeJetBlack);
	
	/* Calculate no of '\n's to leave to make the text go to the bottom, calculate the no. of lines */
	font_height fntHt;
	textView->GetFontHeight (&fntHt);
	int32 noOfLines = (int32)(textView->Frame().Height() / fntHt.ascent) - 1;
	for (int32 i = 1; i < (int32)noOfLines; i++)
		lineFeeds << "\n";

	creditsText =
		"Freeware, Version " AppVersion "\n"
		"Copyright " B_UTF8_COPYRIGHT " 2002 Ramshankar\n\n\n"
		CODING "\nRamshankar\n([email protected])\n\n* * *\n\n\n\n\n\n\n\n\n"

		THANKS_TO "\n\n"
		BUBBLEHELP "\nMarco Nelissen\n\n"
		BESHARE "\nJeremy Friesner\n\n"
		"Thank you all for your\n"
		"contributions with the code...\n\n* * *\n\n\n\n\n\n\n\n\n"
		"Also thanks to\n\n"
		"John Trujillo\nSebastian Benner\nM Floro\n\n"
		"for your support and contributions...\n\n* * *\n\n\n\n\n\n\n\n\n"
		"A special round of applause\n"
		"to BeShare members (in no\n"
		"particular order) :\n\n"
		"lillo\nshatty\nProcton\n"
		"Bryan\nPahtz\nmmu_man\nBeMikko\nNeil\nskiBUM\nand "
		"others\n\n"
		"for being so good... :)\n\n* * *\n\n\n\n\n\n\n\n\n"
		
		LEGAL_MUMBO_JUMBO "\n\n"
		"This program is distributed under\n"
		"its own license, and the gist of\n"
		"the license is attached to each\n"
		"source file of this program\n\n"
		
		"For third party code, the license's\n"
		"terms and conditions are explicitly\n"
		"stated and the author disclaimed of\n"
		"any and all liabilities\n\n"
		
		"For the full license read the\n"
		"file \"License.txt\" and for\n"
		"information on how to use this\n"
		"program read \"Readme.txt\"\n\n* * *\n\n\n\n\n\n\n\n\n"
		
		DISCLAIMER "\n\n"
		"Because the software is licensed\n"
		"free of charge, there is no warranty\n"
		"for the software. The copyright\n"
		"holders and/or other parties provide\n"
		"the software \"AS IS\" without warranty\n"
		"of any kind, either expressed or\n"
		"implied, including, but not limited to,\n"
		"the implied warranties of merchantability\n"
		"and fitness for a particular purpose.\n"
		"The entire risk as to the quality and\n"
		"performance of the software is with you.\n"
		"Should the software prove defective, you\n"
		"assume the cost of all necessary\n"
		"servicing, repair or correction.\n\n"
		
		"In no event will the copyright holder,\n"
		"or any other party who may modify and/or\n"
		"redistribute the software as permitted\n"
		"above, be liable to you for damages,\n"
		"including any general, special, incidental\n"
		"or consequential damages arising out of\n"
		"the use or inability to use the software\n"
		"(including but not limited to the loss of\n"
		"data or data being rendered inaccurate or\n"
		"losses sustained by you or third parties\n"
		"or a failure of the software to operate\n"
		"with any other programs), even if such\n"
		"holder or other party has been advised\n"
		"of the possibility of such damages.\n\n\n\n\n\n\n\n\n"
		
		FINAL_THANKS "\n\n"
		"Be, Inc., for making this OS\n"
		"in the first place\n\n"
		"OpenBeOS for their efforts to\n"
		"keep BeOS alive\n\n"
		"BeBits.com, BeGroovy.com, BeZip.de and\n"
		"other BeOS related sites for their\n"
		"continued enthusiasm and effort!\n\n"
		"BeOS programmers, designers, artists for\n"
		"their contributions to the OS' growth\n\n"
		"and a big applause goes to the Be\n"
		"community (it includes me too :)\n\n* * *\n\n\n\n\n\n\n\n\n"
		"OK... you can close this window now :)\n\n\n\n\n\n";
		
	textView->SetText (lineFeeds.String());
	textView->Insert (lineFeeds.Length(), creditsText, strlen(creditsText));
	
	int32 nSubHeadings = 4;
	BString subHeadings[] =
	{
		CODING,				// 0
		BUBBLEHELP,			// 2
		BESHARE,			// 3
		DISCLAIMER			// 4
	};

	int32 nMainHeadings = 3;
	BString mainHeadings[] =
	{
		THANKS_TO,			// 0
		LEGAL_MUMBO_JUMBO,	// 1
		FINAL_THANKS		// 2
	};
	
	/* Search and color sub headings */
	BString temp = textView->Text();
	int32 strt;
	for (int32 i = 0; i < nSubHeadings; i++)
	{
		if ((strt = temp.FindFirst (subHeadings[i].String())) != B_ERROR)
		{
			textView->SetFontAndColor (strt, strt + strlen(subHeadings[i].String()),
							be_plain_font, B_FONT_ALL, &TreeLabelColor);
		}
	}
	
	/* Search and color main headings */
	for (int32 i = 0; i < nMainHeadings; i++)
	{
		if ((strt = temp.FindFirst (mainHeadings[i].String())) != B_ERROR)
		{
			textView->SetFontAndColor (strt, strt + strlen(mainHeadings[i].String()),
							be_plain_font, B_FONT_ALL, &(rgb_color){0, 0, 200});
		}
	}
	
	/* Center window on-screen */
	BRect screen_rect (BScreen().Frame());
	MoveTo (screen_rect.Width() / 2 - Frame().Width() / 2, screen_rect.Height() / 2 - Frame().Height() / 2);

	/* Delete unwanted stuff */
	delete appIcon;
	delete bmp;

	/* Spawn & resume the scroller thread now */
	PRINT ((" >> spawning_thread: Magic_Scroll\n"));
	thread_id tid = spawn_thread (ScrollIt, "Magic_Scroll", B_NORMAL_PRIORITY, (void*)this);
	resume_thread (tid);
}
Exemple #29
0
void CCellView::Read(BPositionIO& stream)
{
	CSwapStream str(stream);

	scChunk chunk;
	long offset;
	int *funcList, *styleList, *fontList, *formatList;
	int funcCount, styleCount, fontCount, formatCount, borderFont = fBorderFontID;
	bool warnForIncorrectFormula = true;
	scCell cl;

	styleCount = 0;
	styleList = (int *)MALLOC(0);
	fontCount = 0;
	fontList = (int *)MALLOC(0);
	formatCount = 0;
	formatList = (int *)MALLOC(0);
	funcList = NULL;
	
	scCSElement *colStyles = NULL;
	int colStyleCount = 0;

	offset = 0;

	StProgress progress(this, 1, pColorYellow, false);
	StWriteLock lock(fContainer);

	try
	{
		stream.Seek(offset, SEEK_SET);
		
		str >> chunk;

		if (chunk.type == kscVersion)
		{
			scVersion vers;
			str >> vers;
			if (vers.major != 3)
				THROW((errTooNewFileFormat));
		}
		else
			THROW((errUnknownFileFormat, ((CCellWindow *)Window())->EntryRef()->name));

		do
		{
			if (stream.Seek(offset, SEEK_SET) < offset)
			{
				MStopAlert("File is too short").Go();
				break;
			}
			
			str >> chunk;
			offset += 4 + chunk.size;
			
			switch (chunk.type)
			{
				case kscVersion:
					break;
				case kscHeader:
				{
					scHeader head;
					str >> head;
					
					funcList = (int *)CALLOC(head.functionCount, sizeof(int));
					FailNil(funcList);
					funcCount = head.functionCount;
					progress.NewMax(head.cellCount);
					break;
				}
				case kscView:
				{
					scView view;
					str >> view;
					
					if (view.windowRect.left > 0 && view.windowRect.top > 0)
					{
						BRect r;
						{
							r = BScreen().Frame();
						}

						r.InsetBy(4, 4);
						r = r & view.windowRect;
						
						if (r.IsValid() && r.Width() >= 300 && r.Height() >= 100)
						{
							Window()->MoveTo(r.left, r.top);
							Window()->ResizeTo(r.Width(), r.Height());
						}
					}
					if (view.position.h > 0 && view.position.v > 0)
						fPosition = view.position;
					fFrozen = view.frozen;
					if (view.selection.IsValid())
						fSelection = view.selection;
					if (fSelection.Contains(view.curCell))
						fCurCell = view.curCell;
					borderFont = view.headingFont;
					fShowGrid = (view.flags & kscShowGrid) != 0;
					fShowBorders = (view.flags & kscShowHeadings) != 0;
					if (!fShowBorders)
					{
						fCellBounds.left -= fBorderWidth;
						fCellBounds.top -= fBorderHeight;
					}

					Window()->Show();
					Window()->UpdateIfNeeded();
					break;
				}
				case kscPrint:
					break;
				case kscWidths:
				case kscHeights:
				{
					int count = chunk.size/(sizeof(short)*2);
					scWidthElement *elems = (scWidthElement *)MALLOC(chunk.size);
					FailNil(elems);
					
					int k = count * sizeof(scWidthElement);
					stream.Read(elems, k);
					
					if (chunk.type == kscWidths)
						fCellWidths.Read(count, elems);
					else
						fCellHeights.Read(count, elems);

					FREE(elems);
					break;
				}
				case kscColStyles:
				{
					colStyleCount = chunk.size/(sizeof(short)*2);
					colStyles = (scCSElement *)MALLOC(chunk.size);
					FailNil(colStyles);
					
					for (int i = 0; i < colStyleCount; i++)
						str >> colStyles[i];
					break;
				}
				case kscName:
				{
					char buf[50];
					scName *name = (scName *)buf;
					int l = std::min((int)chunk.size, 50);
					
					stream.Read(name, l);

					range r;
					
					memcpy(&r, name->reference+1, sizeof(cell));
					if (name->reference[0] == valRange)
						memcpy(&r.bottom, name->reference+5, sizeof(cell));
					else
						r.BotRight() = r.TopLeft();
					
					swap_order(r);
					
					if (fNames->count(name->name) == 0)
						(*fNames)[CName(name->name)] = r;
					break;
				}
				case kscFunc:
				{
					scFunc func;
					str >> func;
					
					if (!funcList) THROW((errCorruptedFile));
					if (func.funcNr >= funcCount)
						THROW((errCorruptedFile));
					
					funcList[func.funcNr] = GetFunctionNr(func.name);
					if (funcList[func.funcNr] == -1)
						WarnForMissingFunction(func.name);
					break;
				}
				case kscFont:
				{
					scFont font;
					str >> font;
					font_family fam;
					font_style sty;
					
					ReadCString(stream, sizeof(font_style), sty);
					ReadCString(stream, sizeof(font_family), fam);
				
					int *t = (int *)REALLOC(fontList, (fontCount+1)*sizeof(int));
					FailNil(t);
					fontList = t;
					fontList[fontCount] = gFontSizeTable.GetFontID(
						fam, sty, font.size, font.color);
					fontCount++;
					break;
				}
				case kscFormat:
				{
					scFormat format;
					str >> format;
					
					int *t = (int *)REALLOC(formatList, (formatCount+1)*sizeof(int));
					FailNil(t);
					formatList = t;
					
					if (format.nr < eFirstNewFormat)
						formatList[formatCount] = format.nr;
					else
					{
						char fs[256];
						ReadCString(stream, 255, fs);
						formatList[formatCount] = gFormatTable.GetFormatID(fs);
					}
						
					formatCount++;
					break;
				}
				case kscStyle:
				{
					scStyle style;
					str >> style;
					
					int *t = (int *)REALLOC(styleList, (styleCount+1)*sizeof(int));
					FailNil(t);
					styleList = t;
					
					CellStyle cs;

					if (style.font >= fontCount)
						THROW((errCorruptedFile));
					cs.fFont = fontList[style.font];

					if (style.format >= formatCount)
						THROW((errCorruptedFile));
					cs.fFormat = formatList[style.format];

					cs.fAlignment = style.align;
					cs.fLowColor = style.lowColor;
					cs.fLocked = (style.flags & kscLocked) != 0;
					cs.fHidden = (style.flags & kscHidden) != 0;
					
					styleList[styleCount] = gStyleTable.GetStyleID(cs);
					
					styleCount++;
					break;
				}
				case kscCellEmpty:
				case kscCellBool:
				case kscCellNumber:
				case kscCellDateTime:
				case kscCellText:
				{
					str >> cl;
					
					Value val;
					
					switch (chunk.type)
					{
						case kscCellBool:
						{
							bool b;
							str >> b;
							val = b;
							break;
						}
						case kscCellNumber:
						{
							double d;
							str >> d;
							val = d;
							break;
						}
						case kscCellDateTime:
						{
							time_t t;
							str >> t;
							val = t;
							break;
						}
						case kscCellText:
						{
							// do nothing yet...
						}
					}
	
					fContainer->NewCell(cl.loc, val, NULL);
					if (cl.style >= styleCount)
						/*THROW((errCorruptedFile))*/;
					else
						fContainer->SetCellStyleNr(cl.loc, styleList[cl.style]);
					
					progress.Step();
					break;
				}
				case kscString:
				{
					char s[256];
					Value val;
					stream.Read(s, std::min((int)chunk.size, 255));
					s[std::min((int)chunk.size, 255)] = 0;
					val = s;
					
					fContainer->SetValue(cl.loc, val);
					break;
				}
				case kscFormula:
				{
					CFormula form;
					try
					{
						if (!funcList) THROW((errCorruptedFile));
						form.Read(stream, funcList);
						Value v;
						form.Calculate(cl.loc, v, fContainer);
						fContainer->SetCellFormula(cl.loc, form.CopyString());
					}
					catch (CErr& e)
					{
						CATCHED;
						char s[32];
						cl.loc.GetName(s);
#if DEBUG
						printf("%s in formula of cell %s\n", (char *)e, s);
#endif
						if (warnForIncorrectFormula)
						{
							char m[256];
							sprintf(m, GetMessage(msgIncorrectFormula), s);
							MAlert *a = new MWarningAlert(m, GetMessage(msgOK),
								GetMessage(msgNoMoreWarnings));
							if (a->Go() == 2)
								warnForIncorrectFormula = false;
						}
					}
					form.Clear();
					break;
				}
				case kscChart:
					ReadChart(stream, chunk.size);
				case kscEnd:
					break;
				default:
					MStopAlert("File contains errors").Go();
					chunk.type = kscEnd;
					break;
			}
		}
		while (chunk.type != kscEnd);

// adjust the fields that couldn't be adjusted before
		if (fontCount && borderFont < fontCount)
			fBorderFontID = fontList[borderFont];
		
		if (colStyles && styleList)
		{
			for (int i = 0; i < colStyleCount; i++)
			{
				if (colStyles[i].style >= 0 && colStyles[i].style < styleCount)	
					colStyles[i].style = styleList[colStyles[i].style];
			}
			fContainer->GetColumnStyles().Read(colStyleCount, colStyles);
		}
	}
Exemple #30
0
/***** Constructor ****/
DisplayView::DisplayView(BRect frame,const char *name, float tabHeight)
	: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW)//,
{
	SetViewColor(216, 216, 216);
	int space = 5;
	int boxHight = 200;
	int boxWidth = (Bounds().Width() / 2) / 2;
	int chkBoxWidth = 15;
	int chkBoxHight = 15;
	
// ---------------------
	BRect boxRect = BRect(Bounds().left + space, Bounds().top + space, Bounds().left + boxWidth, Bounds().top + boxHight);
	fBoxGeneral = new BBox(boxRect, "fBoxGeneral", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxGeneral->SetLabel("General");
	
	BRect rect = BRect(boxRect.left + space, boxRect.top + space, boxRect.Width() - space, boxRect.top + chkBoxWidth);
	
/*	fChkboxFulscreen = new BCheckBox(rect, "fChkboxFulscreen", "Full Screen", new BMessage(S9x_FULLSCREEN),B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);
	fChkboxFulscreen->SetValue(settings.ui.S9x_FULLSCREEN);
	fBoxGeneral->AddChild(fChkboxFulscreen);*/
	
//	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxBiLiner = new BCheckBox(rect, "fChkboxBiLiner", "Bi-Linear Mode 7", new BMessage(S9x_BILINER7), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxBiLiner->SetValue(settings.graphics.s9x_Mode7Interpolate);
	fBoxGeneral->AddChild(fChkboxBiLiner);

	rect.OffsetBy(0, space + chkBoxHight);	
	fChkboxShowFrameRate = new BCheckBox(rect, "fChkboxShowFrameRate", "Show Frame Rate", new BMessage(S9x_SHOWFRAMERATE), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxShowFrameRate->SetValue(settings.graphics.s9x_DisplayFrameRate);
	fBoxGeneral->AddChild(fChkboxShowFrameRate);

/*	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxStretchImage = new BCheckBox(rect, "fChkboxStretchImage", "Stretch Image", new BMessage(S9x_STRETSHIMAGE), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
//	fChkboxStretchImage->SetValue(settings.ui.s9x_extended);
	fBoxGeneral->AddChild(fChkboxStretchImage);*/

	AddChild(fBoxGeneral);

// ---------------------
	boxRect.OffsetBy(space + boxRect.Width(), 0);
	fBoxSnesImage = new BBox(boxRect, "fBoxSnesImage", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxSnesImage->SetLabel("Snes Image");

	boxRect.OffsetBy(-(boxRect.Width()+ space), 0);
	rect = BRect(boxRect.left + space, boxRect.top + space, boxRect.Width() - space, boxRect.top + chkBoxHight);
	fChkboxExtendHeight = new BCheckBox(rect, "fChkboxExtendHeight", "Extend Height", new BMessage(S9x_EXTENDED), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxExtendHeight->SetValue(settings.ui.s9x_extended);
	fBoxSnesImage->AddChild(fChkboxExtendHeight);


	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxRender16Bit = new BCheckBox(rect, "fChkboxRender16Bit", "Render 16-bit", new BMessage(S9x_RENDER16BIT), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxRender16Bit->SetValue(settings.graphics.s9x_SixteenBit);
	fBoxSnesImage->AddChild(fChkboxRender16Bit);


	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxTransparency = new BCheckBox(rect, "fChkboxTransparency", "Transparency", new BMessage(S9x_TRANSPARENCY), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxTransparency->SetValue(settings.graphics.s9x_Transparency);
	fBoxSnesImage->AddChild(fChkboxTransparency);

	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxHiRes = new BCheckBox(rect, "fChkboxHiRes", "Support Hi Res", new BMessage(S9x_HIRES), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxHiRes->SetValue(settings.graphics.s9x_SupportHiRes);
	fBoxSnesImage->AddChild(fChkboxHiRes);

	AddChild(fBoxSnesImage);

// ---------------------
//	Lock();	
	boxRect.OffsetBy(space + boxRect.Width(), 0);
	boxRect = BRect(boxRect.left, boxRect.top, boxRect.right + boxWidth - space * 3, Bounds().bottom - (tabHeight + (space*2)));
	boxRect.OffsetBy(space + boxWidth, 0);
	fBoxFullScreen = new BBox(boxRect, "fBoxFullScreen", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxFullScreen->SetLabel("Fullscreen Display Settings");
	
	rect.OffsetTo(space, space*4);
	rect = BRect(rect.left, rect.top - space, (rect.left + boxRect.Width())- space*2 , boxRect.bottom - space*2);	
	fColumnList = new DisplayModeColumnListView (rect, "ColumnList", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW |B_NAVIGABLE);
	fColumnList->AddColumn(new DisplayModeColumn("Video Mode", 200, 10, 150, 0),0);
	fColumnList->AddColumn(new BStringColumn("Status", 100, 10, 100, 0),1);

	fBoxFullScreen->AddChild(fColumnList);
	AddChild(fBoxFullScreen);

	display_mode *modes;
	uint32 mode_count;
	BRow *cRow;
	if (BScreen().GetModeList(&modes, &mode_count) == B_NO_ERROR) {
		qsort(modes, mode_count, sizeof(display_mode), compare_mode);
		
		display_mode prevDisplayMode;
		
		for(unsigned int i = 0; i < mode_count; i++) {			
			if(compare_mode(&prevDisplayMode, &modes[i])){
				cRow = new BRow();
				cRow->SetField(new DisplayModeField(modes[i]), 0);
				cRow->SetField(new BStringField("Supported"), 1);
				fColumnList->AddRow(cRow, (int32)i);
				prevDisplayMode = modes[i];
			}
		}
	}
//	BMessage *m = new BMessage(ID_REFRESH);
//	m->AddPointer("ColumnList", fColumnList);
//	message->AddInt32("width", mode.width);
//	message->AddInt32("height", mode.height);
//	fColumnList->SetSelectionMessage(m);
	
// ---------------------
	boxRect = BRect(Bounds().left + space, Bounds().top + boxHight + space*2, boxRect.left - space, boxHight);
	fBoxOutputImageProcessing = new BBox(boxRect, "boxOutputImageProcessing", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxOutputImageProcessing->SetLabel("Output Image Processing");
	AddChild(fBoxOutputImageProcessing);	
}