Exemplo n.º 1
0
/*******************************************************
*   Setup the main view. Add in all the niffty components
*   we have made and get things rolling
*******************************************************/
PrefKeys::PrefKeys():BView("Prefs keys",0){
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// add the prefs list at the left
	list = new BOutlineListView("key list");
	BScrollView *sv = new BScrollView("scroll", list, B_WILL_DRAW, false, true, B_PLAIN_BORDER);
	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	sv->MakeFocus(false);

	BListItem *item = NULL;
	for (int32 i=0; i<KeyBind.CountBindings(); i++){
		if (KeyBind.GetMessage(KeyBind.GetID(i)) == SPLITTER){
			if (item)	list->Collapse(item);
			list->AddItem(item = new KeyItem(Language.get(KeyBind.GetID(i)), 0, 0, 0, 0, -1));
		}else{
			list->AddUnder(new KeyItem(Language.get(KeyBind.GetID(i)), KeyBind.GetKey(KeyBind.GetID(i)), KeyBind.GetMod(KeyBind.GetID(i)), KeyBind.GetKeyAlt(KeyBind.GetID(i)), KeyBind.GetModAlt(KeyBind.GetID(i)), i), item);
		}
	}
	if (item)	list->Collapse(item);
	m_index = -1;
	BLayoutBuilder::Group<>(this)
		.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
			.SetInsets(B_USE_WINDOW_SPACING)
			.Add(sv);
}
Exemplo n.º 2
0
/*******************************************************
*   Setup the main view. Add in all the niffty components
*   we have made and get things rolling
*******************************************************/
KeymapView::KeymapView()
	:
	BView(BRect(0,0,300,100), "Prefs keys", B_FOLLOW_ALL, B_WILL_DRAW)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// add the prefs list at the left
	list = new BOutlineListView("key list");

	BScrollView *sv = new BScrollView("scroll", list,
		B_FOLLOW_ALL_SIDES, false, true, B_PLAIN_BORDER);

	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	sv->MakeFocus(false);

	BObjectList<BListItem> items(false);

	for (int32 i=0; i<gKeyBind->CountKeys(); i++) {
		uint32 code = gKeyBind->GetCode(i);
		if (code == FABER_SPLITTER)
			continue;

		BListItem* item = items.ItemAt(items.CountItems()-1);

		if (code == FABER_ITEM_END || code == FABER_EOF) {
			//if (item != NULL) {
				list->Collapse(item);
				items.RemoveItemAt(items.CountItems()-1);
			//}

			continue;
		}

		if (code == FABER_ITEM_START) {

			BListItem* newItem = new KeyItem(gKeyBind->GetLabel(i), 0, 0, 0, 0, -1);
			if (items.CountItems() > 0) {
				list->AddUnder(newItem, item);
			} else {	
				list->AddItem(newItem);
			}
			items.AddItem(newItem);

		} else if (item != NULL) {
			list->AddUnder(new KeyItem(gKeyBind->GetLabel(i),
				gKeyBind->GetKey(code),
				gKeyBind->GetMod(code), gKeyBind->GetKeyAlt(code),
				gKeyBind->GetModAlt(code), i), item);
		}
	}

	m_index = -1;

	BLayoutBuilder::Group<>(this, B_VERTICAL, 1)
		.Add(sv, 0)
	.End();
}
Exemplo n.º 3
0
//   Setup the main view. Add in all the niffty components
//   we have made and get things rolling
KeymapView::KeymapView()
	:
	BView(BRect(0,0,300,100), "Prefs keys", B_FOLLOW_ALL, B_WILL_DRAW)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// add the prefs list at the left
	fListView = new BOutlineListView("key list");

	BScrollView* scrollView = new BScrollView("scroll", fListView,
		B_FOLLOW_ALL_SIDES, false, true, B_PLAIN_BORDER);

	scrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	scrollView->MakeFocus(false);

	BObjectList<BListItem> items(false);

	for (int32 i=0; i < FaberShortcut::CountKeys(); i++) {
		KeyBind* bind = FaberShortcut::KeyBindAt(i);
		if (bind->itemType == FABER_SPLITTER)
			continue;

		BListItem* item = items.ItemAt(items.CountItems()-1);

		if (item != NULL && (bind->itemType == FABER_ITEM_END
			|| bind->itemType == FABER_EOF)) {
				fListView->Collapse(item);
				items.RemoveItemAt(items.CountItems()-1);
			continue;
		} 
		
		if (bind->itemType == FABER_ITEM_START) {
			BListItem* newItem = new KeyItem(bind->label, 0, 0, -1);

			if (items.CountItems() > 0)
				fListView->AddUnder(newItem, item);
			else	
				fListView->AddItem(newItem);

			items.AddItem(newItem);
		} else if (item != NULL) {
			fListView->AddUnder(new KeyItem(bind->label,
				bind->key,
				bind->mod, i), item);
		}
	}

	fIndex = -1;

	BLayoutBuilder::Group<>(this, B_VERTICAL, 1)
		.Add(scrollView, 0)
	.End();
}
Exemplo n.º 4
0
FreqWindow::FreqWindow(BPoint p) : BWindow(BRect(p.x,p.y,p.x,p.y),Language.get("FREQ_WINDOW"),B_FLOATING_WINDOW_LOOK,B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
	BRect r(0,0,180,180);
	ResizeTo(r.Width(), r.Height());
	MoveBy(-r.Width()/2, -r.Height()/2);

	view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	r.InsetBy(8,8);
	r.right = 70;

	r.top += 28;		// space for the textbox
	list = new BListView(r,"Freq list");
	BScrollView *sv = new BScrollView("scroll", list, B_FOLLOW_ALL_SIDES, B_WILL_DRAW, false, true, B_PLAIN_BORDER);
	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	sv->MakeFocus(false);
	view->AddChild(sv);
	
	r.Set(4,8,85,28);
	text = new SpinControl(r, NULL, NULL, new BMessage(SET_TEXT), 4000, 96000, 44100, 500);
	view->AddChild(text);

	r = Bounds();
	r.left = r.right - 85;
	r.top = r.bottom - 32;
	r.bottom -=8;
	r.right -= 8;
	view->AddChild(new BButton(r, NULL, Language.get("OK"), new BMessage(SET)) );
	r.OffsetBy(0,-30);
	view->AddChild(new BButton(r, NULL, Language.get("CANCEL"), new BMessage(QUIT)) );

	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BStringItem *it;
	list->AddItem(it = new BStringItem("96000"));
	list->AddItem(it = new BStringItem("64000"));
	list->AddItem(it = new BStringItem("48000"));
	list->AddItem(it = new BStringItem("44100"));
	list->AddItem(it = new BStringItem("32000"));
	list->AddItem(it = new BStringItem("22050"));
	list->AddItem(it = new BStringItem("16000"));
	list->AddItem(it = new BStringItem("12500"));
	list->AddItem(it = new BStringItem("11025"));
	list->AddItem(it = new BStringItem("8000"));
	list->SetSelectionMessage(new BMessage(SELECT));
	list->SetInvocationMessage(new BMessage(SELECT));
	SetList();

	m_old = Pool.frequency;
	Run();
	Show();
}