Esempio n. 1
0
BMenuBar*
MenuBuilder::BuildMainMenuBar()
{
	BMenuBar* menuBar = new BMenuBar("MainMenuBar");

	menuBar->AddItem(BuildFileMenu());
	menuBar->AddItem(BuildEditMenu());
	menuBar->AddItem(BuildProjectMenu());
	menuBar->AddItem(BuildTracksMenu());
	menuBar->AddItem(BuildEffectsMenu());
	menuBar->AddItem(BuildGenerateMenu());
	menuBar->AddItem(BuildEngineMenu());
	menuBar->AddItem(BuildHelpMenu());

	return menuBar;
}
Esempio n. 2
0
PoorManWindow::PoorManWindow(BRect frame)
	:
	BWindow(frame, STR_APP_NAME, B_TITLED_WINDOW, 0),
	fStatus(false),
	fHits(0),
	fPrefWindow(NULL),
	fLogFile(NULL),
	fServer(NULL)
{
	//preferences init
	fWebDirectory.SetTo(STR_DEFAULT_WEB_DIRECTORY);
	fIndexFileName.SetTo("index.html");
	fDirListFlag = false;
	
	fLogConsoleFlag = true;
	fLogFileFlag = false;
	fLogPath.SetTo("");
	
	fMaxConnections = (int16)32;
	
	fIsZoomed = true;
	fLastWidth = 318.0f;
	fLastHeight = 320.0f;
	this->fFrame = frame;
	fSetwindowFrame.Set(112.0f, 60.0f, 492.0f, 340.0f);
	
	// PoorMan Window
	SetSizeLimits(318, 1600, 53, 1200); 
	// limit the size of the size of the window
	
	// -----------------------------------------------------------------
	// Three Labels 
	
	// Status String
	fStatusView = new BStringView("Status View", B_TRANSLATE("Status: Stopped"));
	
	// Directory String
	fDirView = new BStringView("Dir View", B_TRANSLATE("Directory: (none)"));
	
	// Hits String
	fHitsView = new BStringView("Hit View", B_TRANSLATE("Hits: 0"));

	// -----------------------------------------------------------------
	// Logging View

	fLoggingView = new BTextView(STR_TXT_VIEW, B_WILL_DRAW );

	fLoggingView->MakeEditable(false);	// user cannot change the text
	fLoggingView->MakeSelectable(true);
	fLoggingView->SetViewColor(WHITE);
	fLoggingView->SetStylable(true);
		
	// create the scroll view
	fScrollView = new BScrollView("Scroll View", fLoggingView,
					B_WILL_DRAW | B_FRAME_EVENTS | B_FOLLOW_ALL_SIDES, 
					// Make sure articles on border do not occur when resizing
					false, true);
	fLoggingView->MakeFocus(true);


	// -----------------------------------------------------------------
	// menu bar
	fFileMenuBar = new BMenuBar("File Menu Bar");
	
	// menus
	fFileMenu = BuildFileMenu();
	if (fFileMenu)
		fFileMenuBar->AddItem(fFileMenu);
			
	fEditMenu = BuildEditMenu();
	if (fEditMenu)
		fFileMenuBar->AddItem(fEditMenu);
		
	fControlsMenu = BuildControlsMenu();
	if (fControlsMenu)
		fFileMenuBar->AddItem(fControlsMenu);
	
	// File Panels
	BWindow* change_title;
	
	fSaveConsoleFilePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this),
						NULL, B_FILE_NODE, false,
						new BMessage(MSG_FILE_PANEL_SAVE_CONSOLE));
	change_title = fSaveConsoleFilePanel->Window();
	change_title->SetTitle(STR_FILEPANEL_SAVE_CONSOLE);
	
	fSaveConsoleSelectionFilePanel = new BFilePanel(B_SAVE_PANEL,
						new BMessenger(this), NULL, B_FILE_NODE, false,
						new BMessage(MSG_FILE_PANEL_SAVE_CONSOLE_SELECTION));
	change_title = fSaveConsoleSelectionFilePanel->Window();
	change_title->SetTitle(STR_FILEPANEL_SAVE_CONSOLE_SELECTION);
	
	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.SetInsets(0)
		.Add(fFileMenuBar)
		.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
			.SetInsets(B_USE_WINDOW_INSETS)
			.AddGroup(B_HORIZONTAL)
				.Add(fStatusView)
				.AddGlue()
				.Add(fHitsView)
				.End()
			.AddGroup(B_HORIZONTAL)
				.Add(fDirView)
				.AddGlue()
				.End()
			.Add(fScrollView);
	
	pthread_rwlock_init(&fLogFileLock, NULL);
}
Esempio n. 3
0
void WorkspaceWork::FileMenu(Bar& menu)
{
	bool sel = filelist.IsCursor() && filelist[filelist.GetCursor()].isdir;
	bool isaux = IsAux();
	if(isaux)
		InsertSpecialMenu(menu);
	else {
		menu.Add(!isaux, "Insert package directory file(s)", THISBACK1(AddFile, PACKAGE_FILE))
			.Help("Insert file relative to current package");
		menu.Add(!isaux, "Insert topic++ group", THISBACK(AddTopicGroup));
		menu.Add("Special", THISBACK(SpecialFileMenu))
		    .Help("Less frequently used methods of adding files to the package");
	}
	menu.Add("Insert separator", THISBACK(AddSeparator))
		.Help("Insert text separator line");
	menu.Separator();
	if(!organizer) {
		if(sel)
			menu.Add(closed.Find(GetActiveSepfo()) < 0 ? "Close group\t[double-click]"
			                                           : "Open group\t[double-click]", THISBACK(Group));
		menu.Add("Open all groups", THISBACK(OpenAllGroups));
		menu.Add("Close all groups", THISBACK(CloseAllGroups));
		menu.Separator();
		BuildFileMenu(menu);
		menu.Separator();
	}
	menu.Add("Rename...", THISBACK(RenameFile))
	    .Help("Rename file / separator / topic group");
	menu.Add("Remove", THISBACK(RemoveFile))
		.Key(organizer ? K_DELETE : K_ALT_DELETE)
		.Help("Remove file / separator / topic group from package");
	menu.Add(filelist.IsCursor() && !sel, "Delete", THISBACK(DelFile))
		.Help("Remove file / topic group reference from package & delete file / folder on disk");
	menu.Separator();
	menu.Add("Open File Directory",THISBACK(OpenFileFolder));
	menu.Add("Copy File Path", callback1(WriteClipboardText, GetActiveFilePath()));
	menu.Separator();
	menu.Add(filelist.GetCursor() > 0, "Move up", THISBACK1(MoveFile, -1))
		.Key(organizer ? K_CTRL_UP : K_SHIFT_CTRL_UP)
		.Help("Move current file one position towards package beginning");
	menu.Add(filelist.IsCursor() && filelist.GetCursor() < filelist.GetCount() - 1, "Move down",
	         THISBACK1(MoveFile, 1))
		.Key(organizer ? K_CTRL_DOWN : K_SHIFT_CTRL_DOWN)
		.Help("Move current file one position towards package end");
	if(IsActiveFile()) {
		menu.Separator();
		String p = GetActiveFilePath();
		String ext = GetFileExt(p);
		if(ext == ".tpp" && IsFolder(p)) {
			menu.Add("Includeable topic group", THISBACK(ToggleIncludeable))
			    .Check(FileExists(AppendFileName(p, "all.i")));
			if(IsSvnDir(p))
				menu.Add("Svn Synchronize " + p, THISBACK1(SyncSvnDir, p));
		}
		else {
			menu.Add("Optimize for speed", THISBACK(ToggleFileSpeed))
			    .Check(ActiveFile().optimize_speed);
			if(IsHeaderExt(ext))
				menu.Add("Precompile header", THISBACK(TogglePCH))
				    .Check(ActiveFile().pch);
		}
	}
	FilePropertiesMenu(menu);
}
Esempio n. 4
0
MenuWindow::MenuWindow(const char* name)
	: BWindow(BRect(60,60,60,60), name, B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
	m_bUsingFullMenuBar = true;
	
	// menu bars
	BRect dummyFrame(0, 0, 0, 0);
	m_pFullMenuBar = new BMenuBar(dummyFrame, "Full Menu Bar");
	m_pHiddenMenuBar = new BMenuBar(dummyFrame, "Menu Bar w. Hidden User Menus");
	
	// File menu
	BMenu* pMenu = BuildFileMenu();
	if (pMenu) {
		m_pFullMenuBar->AddItem(pMenu);
	}
	pMenu = BuildFileMenu();
	if (pMenu) {
		m_pHiddenMenuBar->AddItem(pMenu);
	}
	
	// Test menu
	pMenu = m_testMenuBuilder.BuildTestMenu(B_MINI_ICON);
	if (pMenu) {
		m_pFullMenuBar->AddItem(pMenu);
	}
	pMenu = m_testMenuBuilder.BuildTestMenu(B_MINI_ICON);
	if (pMenu) {
		m_pHiddenMenuBar->AddItem(pMenu);
	}
	 
	// add child after menus are added so its initially
	// calculated app_server bounds take added menus into
	// account
	AddChild(m_pFullMenuBar);
	
	float menuHeight = m_pFullMenuBar->Bounds().Height();
	
	// Menu view
	m_pMenuView = new MenuView(B_FOLLOW_NONE); // don't follow window just yet!
	m_pMenuView->MoveBy(0, menuHeight + 1);
	AddChild(m_pMenuView);

	// Status view	
	BRect menuViewRect = m_pMenuView->Frame();
	float top = menuViewRect.bottom + 1;
	font_height plainHeight;
	be_plain_font->GetHeight(&plainHeight);
	
	// Simulate a vertical divider by making a BBox where only the top side
	// can be seen in the window.
	BRect boxFrame;
	boxFrame.Set(menuViewRect.left - 2, 
		top,
		menuViewRect.right + 2,
		top + plainHeight.ascent + plainHeight.descent + plainHeight.leading + 4);
	
	BBox* pStatusBox = new BBox(boxFrame);
	AddChild(pStatusBox);

	BRect statusFrame = pStatusBox->Bounds();
	statusFrame.InsetBy(2,2);	
	m_pStatusView = new BStringView(statusFrame, "Status View", STR_STATUS_DEFAULT,
		B_FOLLOW_ALL); // don't follow window just yet!
	m_pStatusView->SetViewColor(BKG_GREY);
	pStatusBox->AddChild(m_pStatusView);
	
	// Resize window dynamically to fit MenuView (and Status View)
	float windowWidth = m_pMenuView->Frame().right;
	float windowHeight = boxFrame.bottom - 4;
	ResizeTo(windowWidth, windowHeight);
}