Ejemplo n.º 1
0
void
jView::Draw(BRect update)
{
	DBG(AWT_EVT, printf( "jView::Draw(" ));
	DBG(AWT_EVT, update.PrintToStream());
	DBG(AWT_EVT, printf( "\n" ));

#if 0
  DBG(AWT_EVT, printf("Draw\n"));

// !!! NOT THE BEST PLACE, 
//     it would be better to intercept events before they are dispatched to the handlers
//     (see event_hook)

  BMessage * msg = new BMessage();

  msg->what = UPDATE_EVENT;					/* custom update event */
  msg->AddPointer(sourceTag, Window()); 
  msg->AddRect("frame", Frame());           /* update the entire frame */
  
  bigtime_t t = system_time();
  msg->AddInt64("when", t);

	update.PrintToStream();

	javaApp->AddMessage( msg );
#endif
} 
Ejemplo n.º 2
0
// MessageReceived
void
TestView::MessageReceived(BMessage* message)
{
	if (message->what == MSG_COPY_BITS) {
		printf("MSG_COPY_BITS\n");
		fSourceRect.PrintToStream();
		fDestRect.PrintToStream();
		CopyBits(fSourceRect, fDestRect);
		fCopyBitsJustCalled = true;
	} else
		BView::MessageReceived(message);
}
Ejemplo n.º 3
0
StyledEditApp::StyledEditApp()
	:
	BApplication(APP_SIGNATURE),
	fOpenPanel(NULL)
{
	B_TRANSLATE_MARK_SYSTEM_NAME_VOID("StyledEdit");

	fOpenPanel = new BFilePanel();
	fOpenAsEncoding = 0;

	BMenuBar* menuBar
		= dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
	if (menuBar != NULL) {
		fOpenPanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding"));
		fOpenPanelEncodingMenu->SetRadioMode(true);

		menuBar->AddItem(fOpenPanelEncodingMenu);

		BCharacterSetRoster roster;
		BCharacterSet charset;
		while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) {
			BString name;
			if (charset.GetFontID() == B_UNICODE_UTF8)
				name = B_TRANSLATE("Default");
			else
				name = charset.GetPrintName();

			const char* mime = charset.GetMIMEName();
			if (mime != NULL) {
				name.Append(" (");
				name.Append(mime);
				name.Append(")");
			}
			BMenuItem* item
				= new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING));
			item->SetTarget(this);
			fOpenPanelEncodingMenu->AddItem(item);
			if (charset.GetFontID() == fOpenAsEncoding)
				item->SetMarked(true);
		}
	} else
		fOpenPanelEncodingMenu = NULL;

	fWindowCount = 0;
	fNextUntitledWindow = 1;
	fBadArguments = false;

	float factor = be_plain_font->Size() / 12.0f;
	sCascadeOffset *= factor;
	sTopLeft.x *= factor;
	sTopLeft.y *= factor;
	sWindowRect.left *= factor;
	sWindowRect.top *= factor;
	sWindowRect.right *= factor;
	sWindowRect.bottom *= factor;
	sWindowRect.PrintToStream();
}
Ejemplo n.º 4
0
void
WinDecorator::Draw(BRect update)
{
	STRACE(("WinDecorator::Draw(): ")); update.PrintToStream();

	fDrawingEngine->SetDrawState(&fDrawState);

	_DrawFrame(update);
	_DrawTab(update);
}
Ejemplo n.º 5
0
/*!	\brief Updates the decorator in the rectangular area \a updateRect.

	Updates all areas which intersect the frame and tab.

	\param updateRect The rectangular area to update.
*/
void
TabDecorator::Draw(BRect updateRect)
{
	STRACE(("TabDecorator::Draw(BRect updateRect): "));
	updateRect.PrintToStream();

	fDrawingEngine->SetDrawState(&fDrawState);

	_DrawFrame(updateRect & fBorderRect);
	_DrawTabs(updateRect & fTitleBarRect);
}
Ejemplo n.º 6
0
/*!	\brief Updates the decorator in the rectangular area \a updateRect.

	Updates all areas which intersect the frame and tab.

	\param updateRect The rectangular area to update.
*/
void
WinDecorator::Draw(BRect updateRect)
{
	STRACE(("WinDecorator::Draw(BRect updateRect): "));
	updateRect.PrintToStream();

	// We need to draw a few things: the tab, the resize knob, the borders,
	// and the buttons
	fDrawingEngine->SetDrawState(&fDrawState);

	_DrawFrame(updateRect & fBorderRect);
	_DrawTabs(updateRect & fTitleBarRect);
}
Ejemplo n.º 7
0
void
BTwoDimensionalLayout::LayoutView()
{
	_ValidateMinMax();

	// layout the horizontal/vertical elements
	BSize size = SubtractInsets(View()->Frame().Size());

#ifdef DEBUG_LAYOUT
printf("BTwoDimensionalLayout::LayoutView(%p): size: (%.1f, %.1f)\n",
View(), size.width, size.height);
#endif

	fLocalLayouter->Layout(size);

	// layout the items
	int itemCount = CountItems();
	for (int i = 0; i < itemCount; i++) {
		BLayoutItem* item = ItemAt(i);
		if (item->IsVisible()) {
			Dimensions itemDimensions;
			GetItemDimensions(item, &itemDimensions);
			BRect frame = fLocalLayouter->ItemFrame(itemDimensions);
			frame.left += fLeftInset;
			frame.top += fTopInset;
			frame.right += fLeftInset;
			frame.bottom += fTopInset;
{
#ifdef DEBUG_LAYOUT
printf("  frame for item %2d (view: %p): ", i, item->View());
frame.PrintToStream();
#endif
//BSize min(item->MinSize());
//BSize max(item->MaxSize());
//printf("    min: (%.1f, %.1f), max: (%.1f, %.1f)\n", min.width, min.height,
//	max.width, max.height);
//if (item->HasHeightForWidth()) {
//float minHeight, maxHeight, preferredHeight;
//item->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight,
//	&preferredHeight);
//printf("    hfw: min: %.1f, max: %.1f, pref: %.1f\n", minHeight, maxHeight,
//	preferredHeight);
//}
}

			item->AlignInFrame(frame);
		}
//else
//printf("  item %2d not visible", i);
	}
}
Ejemplo n.º 8
0
// Draw
void
TestView::Draw(BRect updateRect)
{
printf("TestView::Draw(");
updateRect.PrintToStream();
	BRect r(Bounds());

	rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
	rgb_color shadow = tint_color(ViewColor(), B_DARKEN_2_TINT);

	BeginLineArray(4);
		AddLine(r.LeftTop(), r.RightTop(), light);
		AddLine(r.RightTop(), r.RightBottom(), shadow);
		AddLine(r.RightBottom(), r.LeftBottom(), shadow);
		AddLine(r.LeftBottom(), r.LeftTop(), light);
	EndLineArray();
}
Ejemplo n.º 9
0
// Should be called every time the media_format_family is changed
status_t
Controller::UpdateMediaFormatAndCodecsForCurrentFamily()
{
	BAutolock _(this);
	
	Settings settings;
	BRect targetRect = settings.TargetRect();
	targetRect.right++;
	targetRect.bottom++;
	
	targetRect.PrintToStream();
	
	const int32 frameRate = 10;
	media_format mediaFormat = _ComputeMediaFormat(targetRect.IntegerWidth(),
									targetRect.IntegerHeight(),
									settings.ClipDepth(), frameRate);
	
	fEncoder->SetMediaFormat(mediaFormat);
	
	delete fCodecList;
	fCodecList = new BObjectList<media_codec_info> (1, true);
	
	int32 cookie = 0;
	media_codec_info codec;
	media_format dummyFormat;
	media_file_format fileFormat = fEncoder->MediaFileFormat();
	while (get_next_encoder(&cookie, &fileFormat, &mediaFormat,
			&dummyFormat, &codec) == B_OK) {
		media_codec_info* newCodec = new media_codec_info;
		*newCodec = codec;
		fCodecList->AddItem(newCodec);
	}
		
	SendNotices(kMsgControllerCodecListUpdated);
	return B_OK;
}
Ejemplo n.º 10
0
TargetSettingsWin::TargetSettingsWin(const char *uWindowTitle, TargetConfig *targetConfig)
:
	BWindow(
		BRect(64, 64, 680, 450),
		uWindowTitle,
		B_FLOATING_WINDOW_LOOK,
		/*B_NORMAL_WINDOW_FEEL*/ B_MODAL_APP_WINDOW_FEEL,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE,
		0 )
{
	assert(targetConfig != NULL);
	
	MainView = new BView(BWindow::Bounds(), NULL, B_FOLLOW_ALL, 0);
	if (MainView == NULL)
	{
		AppReturnValue = B_NO_MEMORY;
		be_app->PostMessage(B_QUIT_REQUESTED);
		return;		
	}
	MainView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BWindow::AddChild(MainView);
	
	//members
	fConfig = targetConfig;
	fChangedConfig = false;
	fGeneralSettingsChanged = false;
	fCompilerSettingsChanged = false;
	fLinkerSettingsChanged = false;
	fIncludeSettingsChanged = false;
	
	//list of available settings
	BRect r = MainView->Bounds();
	r.left += 15;
	r.bottom = r.top + (r.bottom - r.top)/2;
	r.top += 15;
	
	r.right = r.left + 100;
	fSettingsListView = new BListView(r, "settings list");
	fSettingsListView->SetSelectionMessage(new BMessage(PANEL_LIST_ITEM_SELECTED));
	//XXX - the following doesn't work. Why?
	fSettingsListView->Select(0); //select the first item, i.e. "general settings"
	MainView->AddChild(fSettingsListView);
	fSettingsListView->AddItem(new BStringItem("General"));
	fSettingsListView->AddItem(new BStringItem("Include Paths"));
	fSettingsListView->AddItem(new BStringItem("Compiler Options"));
	fSettingsListView->AddItem(new BStringItem("Linker Options"));
	
	/////////////////////////////////////////////////////////////////////
	//create all settings panels. Use the same rect for all views.
	r = MainView->Bounds();
	r.top += 15;
	r.right -= 15;
	r.bottom -= 50;
	r.left += fSettingsListView->Bounds().Width() + 30;
	//create GeneralSettingsView and make it the current view
	fGeneralSettingsView = new GeneralSettingsView(r, "general settings view");
	fCurrentSettingsView = fGeneralSettingsView;
	MainView->AddChild(fGeneralSettingsView);

	fCompilerSettingsView = new CompilerSettingsView(r, "compiler settings view");
	fLinkerSettingsView = new LinkerSettingsView(r, "linker settings view");
	fIncludeSettingsView = new IncludeSettingsView(r, "include settings view");

	/////////////////////////////////////////////////////////////////////
		
	//insert 'OK' and 'Cancel' buttons
	r = BWindow::Bounds();
	r.top = fGeneralSettingsView->Bounds().bottom + 30;
	r.bottom -= 15;
	r.right -=15;
	r.left = r.right - 75;
	r.PrintToStream();
	//OK
	BButton* okButton = new BButton(r, "OK button", "OK", new BMessage(OK_BUTTON_PRESSED));
	MainView->AddChild(okButton);
	//Cancel
	r.right = r.left - 15;
	r.left = r.right - 75;
	r.PrintToStream();
	BButton* cancelButton = new BButton(r, "Cancel button", "Cancel", new BMessage(CANCEL_BUTTON_PRESSED));
	MainView->AddChild(cancelButton);
	
	/////////////////////////////////////////////////////////////////////
	
	//initialize views with configuration settings
	PopulateSettings();
	//tell the application that there's a new window
	Register();
	//last but not least...
	Show();
}