Exemple #1
0
void
MainWindow::AboutRequested()
{
	BAboutWindow* about = new BAboutWindow(
		B_TRANSLATE_SYSTEM_NAME("BeMines"), "application/x-vnd.dw-BeMines");

	const char* kCopyright = "Kevin Adams, Humdinger, Janus";

	const char* kExtraCopyrights[] = {
		"2015 Justin Stressman",
		"2009 DarkWyrm",
		NULL
	};

	const char* kAuthors[] = {
		B_TRANSLATE("DarkWyrm (original author)"),
		"Kevin Adams",
		"Adrien Destugues",
		"Humdinger",
		"Janus",
		"Justin Stressman",
		NULL
	};
	about->AddDescription(
		B_TRANSLATE("A themable, open-source rendition of Minesweeper."));
	about->AddCopyright(2018, kCopyright, kExtraCopyrights);
	about->AddAuthors(kAuthors);
	about->Show();
}
Exemple #2
0
void
BrowserApp::AboutRequested()
{
	BAboutWindow* window = new BAboutWindow(kApplicationName,
		kApplicationSignature);
	
	// create the about window

	const char* authors[] = {
		"Andrea Anzani",
		"Stephan Aßmus",
		"Alexandre Deckner",
		"Rene Gollent",
		"Ryan Leavengood",
		"Michael Lotz",
		"Maxime Simon",
		NULL
	};

	BString aboutText("");
	aboutText << "HaikuWebKit " << WebKitInfo::HaikuWebKitVersion();
	aboutText << " (" << WebKitInfo::HaikuWebKitRevision() << ")";
	aboutText << "\nWebKit " << WebKitInfo::WebKitVersion();
	aboutText << " (" << WebKitInfo::WebKitRevision() << ")";

	window->AddCopyright(2007, "Haiku, Inc.");
	window->AddAuthors(authors);
	window->AddExtraInfo(aboutText.String());

	window->Show();
}
Exemple #3
0
void
WorkspacesView::_AboutRequested()
{
	BAboutWindow* window = new BAboutWindow(
		B_TRANSLATE_SYSTEM_NAME("Workspaces"), kSignature);

	const char* authors[] = {
		"Axel Dörfler",
		"Oliver \"Madison\" Kohl",
		"Matt Madia",
		"François Revol",
		NULL
	};

	const char* extraCopyrights[] = {
		"2002 François Revol",
		NULL
	};

	const char* extraInfo = "Send windows behind using the Option key. "
		"Move windows to front using the Control key.\n";

	window->AddCopyright(2002, "Haiku, Inc.",
			extraCopyrights);
	window->AddAuthors(authors);
	window->AddExtraInfo(extraInfo);

	window->Show();
}
void
NetworkStatusView::_AboutRequested()
{
	BAboutWindow* window = new BAboutWindow(
		B_TRANSLATE_SYSTEM_NAME("NetworkStatus"), kSignature);

	const char* authors[] = {
		"Axel Dörfler",
		"Hugo Santos",
		NULL
	};

	window->AddCopyright(2007, "Haiku, Inc.");
	window->AddAuthors(authors);

	window->Show();
}
Exemple #5
0
void
PowerStatusReplicant::_AboutRequested()
{
	BAboutWindow* window = new BAboutWindow(
		B_TRANSLATE_SYSTEM_NAME("PowerStatus"), kSignature);

	const char* authors[] = {
		"Axel Dörfler",
		"Alexander von Gluck",
		"Clemens Zeidler",
		NULL
	};

	window->AddCopyright(2006, "Haiku, Inc.");
	window->AddAuthors(authors);

	window->Show();
}
void
ProcessController::AboutRequested()
{
	BAboutWindow* window = new BAboutWindow(
		B_TRANSLATE_SYSTEM_NAME("ProcessController"), kSignature);

	const char* extraCopyrights[] = {
		"2004 beunited.org",
		"1997-2001 Georges-Edouard Berenger",
		NULL
	};

	const char* authors[] = {
		"Georges-Edouard Berenger",
		NULL
	};

	window->AddCopyright(2007, "Haiku, Inc.", extraCopyrights);
	window->AddAuthors(authors);

	window->Show();
}
Exemple #7
0
void
ActivityView::MessageReceived(BMessage* message)
{
	// if a color is dropped, use it as background
	if (message->WasDropped()) {
		rgb_color* color;
		ssize_t size;
		if (message->FindData("RGBColor", B_RGB_COLOR_TYPE, 0,
				(const void**)&color, &size) == B_OK
			&& size == sizeof(rgb_color)) {
			BPoint dropPoint = message->DropPoint();
			ConvertFromScreen(&dropPoint);

			if (_HistoryFrame().Contains(dropPoint)) {
				fHistoryBackgroundColor = *color;
				Invalidate(_HistoryFrame());
			} else {
				// check each legend color box
				BAutolock _(fSourcesLock);

				BRect legendFrame = _LegendFrame();
				for (int32 i = 0; i < fSources.CountItems(); i++) {
					BRect frame = _LegendColorFrameAt(legendFrame, i);
					if (frame.Contains(dropPoint)) {
						fSources.ItemAt(i)->SetColor(*color);
						Invalidate(_HistoryFrame());
						Invalidate(frame);
						return;
					}
				}

				if (dynamic_cast<ActivityMonitor*>(be_app) == NULL) {
					// allow background color change in the replicant only
					fLegendBackgroundColor = *color;
					SetLowColor(fLegendBackgroundColor);
					Invalidate(legendFrame);
				}
			}
			return;
		}
	}

	switch (message->what) {
		case B_ABOUT_REQUESTED:
		{
			BAboutWindow* window = new BAboutWindow(kAppName, kSignature);

			const char* authors[] = {
				"Axel Dörfler",
				NULL
			};

			window->AddCopyright(2008, "Haiku, Inc.");
			window->AddAuthors(authors);

			window->Show();

			break;
		}
		case kMsgUpdateResolution:
		{
			int32 resolution;
			if (message->FindInt32("resolution", &resolution) != B_OK)
				break;

			_UpdateResolution(resolution, false);
			break;
		}

		case kMsgTimeIntervalUpdated:
			bigtime_t interval;
			if (message->FindInt64("interval", &interval) != B_OK)
				break;

			if (interval < 10000)
				interval = 10000;

			atomic_set64(&fRefreshInterval, interval);
			break;

		case kMsgToggleDataSource:
		{
			int32 index;
			if (message->FindInt32("index", &index) != B_OK)
				break;

			const DataSource* baseSource = DataSource::SourceAt(index);
			if (baseSource == NULL)
				break;

			DataSource* source = FindDataSource(baseSource);
			if (source == NULL)
				AddDataSource(baseSource);
			else
				RemoveDataSource(baseSource);

			Invalidate();
			break;
		}

		case kMsgToggleLegend:
			fShowLegend = !fShowLegend;
			Invalidate();
			break;

		case B_MOUSE_WHEEL_CHANGED:
		{
			float deltaY = 0.0f;
			if (message->FindFloat("be:wheel_delta_y", &deltaY) != B_OK
				|| deltaY == 0.0f)
				break;

			int32 resolution = fDrawResolution;
			if (deltaY > 0)
				resolution *= 2;
			else
				resolution /= 2;

			_UpdateResolution(resolution);
			break;
		}

		default:
			BView::MessageReceived(message);
			break;
	}
}
Exemple #8
0
void
CalcView::MessageReceived(BMessage* message)
{
	if (message->what == B_COLORS_UPDATED && !fHasCustomBaseColor) {
		const char* panelBgColorName = ui_color_name(B_PANEL_BACKGROUND_COLOR);
		if (message->HasColor(panelBgColorName)) {
			fBaseColor = message->GetColor(panelBgColorName, fBaseColor);
			_Colorize();
		}

		return;
	}

	if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
		// if we are embedded in desktop we need to receive these
		// message here since we don't have a parent BWindow
		switch (message->what) {
			case MSG_OPTIONS_AUTO_NUM_LOCK:
				ToggleAutoNumlock();
				return;

			case MSG_OPTIONS_AUDIO_FEEDBACK:
				ToggleAudioFeedback();
				return;

			case MSG_OPTIONS_ANGLE_MODE_RADIAN:
				SetDegreeMode(false);
				return;

			case MSG_OPTIONS_ANGLE_MODE_DEGREE:
				SetDegreeMode(true);
				return;
		}
	}

	// check if message was dropped
	if (message->WasDropped()) {
		// pass message on to paste
		if (message->IsSourceRemote())
			Paste(message);
	} else {
		// act on posted message type
		switch (message->what) {

			// handle "cut"
			case B_CUT:
				Cut();
				break;

			// handle copy
			case B_COPY:
				Copy();
				break;

			// handle paste
			case B_PASTE:
				// access system clipboard
				if (be_clipboard->Lock()) {
					BMessage* clipper = be_clipboard->Data();
					//clipper->PrintToStream();
					Paste(clipper);
					be_clipboard->Unlock();
				}
				break;

			// (replicant) about box requested
			case B_ABOUT_REQUESTED:
			{
				BAboutWindow* window = new BAboutWindow(kAppName, kSignature);

				// create the about window
				const char* extraCopyrights[] = {
					"1997, 1998 R3 Software Ltd.",
					NULL
				};

				const char* authors[] = {
					"Stephan Aßmus",
					"John Scipione",
					"Timothy Wayper",
					"Ingo Weinhold",
					NULL
				};

				window->AddCopyright(2006, "Haiku, Inc.", extraCopyrights);
				window->AddAuthors(authors);

				window->Show();

				break;
			}

			case MSG_UNFLASH_KEY:
			{
				int32 key;
				if (message->FindInt32("key", &key) == B_OK)
					_FlashKey(key, 0);

				break;
			}

			case kMsgAnimateDots:
			{
				int32 end = fExpressionTextView->TextLength();
				int32 start = end - 3;
				if (fEnabled || strcmp(fExpressionTextView->Text() + start,
						"...") != 0) {
					// stop the message runner
					delete fEvaluateMessageRunner;
					fEvaluateMessageRunner = NULL;
					break;
				}

				uint8 dot = 0;
				if (message->FindUInt8("dot", &dot) == B_OK) {
					rgb_color fontColor = fExpressionTextView->HighColor();
					rgb_color backColor = fExpressionTextView->LowColor();
					fExpressionTextView->SetStylable(true);
					fExpressionTextView->SetFontAndColor(start, end, NULL, 0,
						&backColor);
					fExpressionTextView->SetFontAndColor(start + dot - 1,
						start + dot, NULL, 0, &fontColor);
					fExpressionTextView->SetStylable(false);
				}

				dot++;
				if (dot == 4)
					dot = 1;

				delete fEvaluateMessageRunner;
				BMessage animate(kMsgAnimateDots);
				animate.AddUInt8("dot", dot);
				fEvaluateMessageRunner = new (std::nothrow) BMessageRunner(
					BMessenger(this), &animate, kAnimationInterval, 1);
				break;
			}

			case kMsgCalculating:
			{
				// calculation has taken more than 3 seconds
				if (fEnabled) {
					// stop the message runner
					delete fEvaluateMessageRunner;
					fEvaluateMessageRunner = NULL;
					break;
				}

				BString calculating;
				calculating << B_TRANSLATE("Calculating") << "...";
				fExpressionTextView->SetText(calculating.String());

				delete fEvaluateMessageRunner;
				BMessage animate(kMsgAnimateDots);
				animate.AddUInt8("dot", 1U);
				fEvaluateMessageRunner = new (std::nothrow) BMessageRunner(
					BMessenger(this), &animate, kAnimationInterval, 1);
				break;
			}

			case kMsgDoneEvaluating:
			{
				_SetEnabled(true);
				rgb_color fontColor = fExpressionTextView->HighColor();
				fExpressionTextView->SetFontAndColor(NULL, 0, &fontColor);

				const char* result;
				if (message->FindString("error", &result) == B_OK)
					fExpressionTextView->SetText(result);
				else if (message->FindString("value", &result) == B_OK)
					fExpressionTextView->SetValue(result);

				// stop the message runner
				delete fEvaluateMessageRunner;
				fEvaluateMessageRunner = NULL;
				break;
			}

			default:
				BView::MessageReceived(message);
				break;
		}
	}
}
Exemple #9
0
// Handling of user interface and other events
void MainWindow::MessageReceived(BMessage *message)
{
	switch(message->what){
		case SELECTION_CHANGED:
			BRow *row;
			row = teamView->RowAt(message->FindInt32("index"));

			if(row != NULL && message->FindInt32("buttons") == B_SECONDARY_MOUSE_BUTTON){
				BPoint point;
				uint32 state;
				teamView->GetMouse(&point,&state);

				BPoint p2 = teamView->ConvertToScreen(point);
				p2.x -= 5.0;
				p2.y -= 5.0;
				//if(fItemMenu->FindMarked())
				//	fItemMenu->FindMarked()->SetMarked(false);

				teamView->SelectionMessage()->ReplaceInt32("buttons",0);
				teamView->ActionMenu()->Go(p2, true, true, true);
				//fItemMenu->Go(p2, true, true, true);
			}
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_KILL:
		case IE_MAINWINDOW_MAINKILL:
			DoKill();
		 	UpdateTeams();
		 	SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_SUSPEND:
		case IE_MAINWINDOW_MAINSUSPEND:
			DoSuspend();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_RESUME:
		case IE_MAINWINDOW_MAINRESUME:
			DoResume();
			UpdateTeams();
			SetButtonState();
			break;
		case SET_PRIORITY: {
			int32 priority = message->FindInt32("priority");
			DoPriority(priority);
			UpdateTeams();
			SetButtonState();
			break;
		}
		case IE_MAINWINDOW_MAINPRIORITYVALUE:
			// takes priority from text field
			DoPriority();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINUPDATE:
			UpdateTeams();
			SetButtonState();
			break;
		case B_ABOUT_REQUESTED:    // "About…" is selected from menu…
		{
			BAboutWindow* fAboutWin = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Slayer"), slayer_signature);
			fAboutWin->AddDescription(B_TRANSLATE("A thread manager for Haiku"));
			fAboutWin->SetVersion(SLAYER_VERSION);
			fAboutWin->AddCopyright(1999, "Arto Jalkanen");
			const char* authors[] = {
				"Arto Jalkanen ([email protected])",
				NULL
			};
			fAboutWin->AddAuthors(authors);
			fAboutWin->Show();
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_DOCS__:
		{
			BMessage message(B_REFS_RECEIVED);
			message.AddString("url", ProjectWebsite);
			be_roster->Launch("text/html", &message);
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_QUIT:    // "Quit" is selected from menu…
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		case IE_MAINWINDOW_MAINMENU_WINDOWS_SETTINGS:
		{
			const char* windowSettingsTitle = B_TRANSLATE("Settings");
			BWindow *settings = slayer->FindWindow(windowSettingsTitle);
			if (!settings)
				new SettingsWindow(windowSettingsTitle);
			else if (settings->Lock()) {
				settings->Activate(true);
				settings->Unlock();
			}
		}
			break;
		default:
			BWindow::MessageReceived(message);
			break;
	}

}