コード例 #1
0
ファイル: CarInput.cpp プロジェクト: AntonioModer/xray-16
void CCar::OnKeyboardPress(int cmd)
{
	if (Remote())								return;

	switch (cmd)	
	{
	case kCAM_1:	OnCameraChange(ectFirst);	break;
	case kCAM_2:	OnCameraChange(ectChase);	break;
	case kCAM_3:	OnCameraChange(ectFree);	break;
	case kACCEL:	TransmissionUp();			break;
	case kCROUCH:	TransmissionDown();			break;
	case kFWD:		PressForward();				break;
	case kBACK:		PressBack();				break;
	case kR_STRAFE:	PressRight();				if (OwnerActor()) OwnerActor()->steer_Vehicle(1);	break;
	case kL_STRAFE:	PressLeft();				if (OwnerActor()) OwnerActor()->steer_Vehicle(-1);break;
	case kJUMP:		PressBreaks();				break;
	case kDETECTOR:	SwitchEngine();				break;
	case kTORCH:	m_lights.SwitchHeadLights();break;
	case kUSE:									break;
	};

}
コード例 #2
0
ファイル: bydpmainwindow.cpp プロジェクト: ytmytm/beos-bsap
void BYdpMainWindow::MessageReceived(BMessage *Message) {
	int item;
	this->DisableUpdates();
	switch (Message->what) {
		case MSG_MODIFIED_INPUT:
			HandleModifiedInput(false);
			break;
		case MSG_LIST_INVOKED:
			item = dictList->CurrentSelection(0);
			wordInput->SetText(((BStringItem*)dictList->ItemAt(item))->Text());
			break;
		case MSG_LIST_SELECTED:
			item = dictList->CurrentSelection(0);
			if (item>dictList->CountItems())
				item = dictList->CountItems();
			if (item>=0)
				myDict->GetDefinition(myDict->wordPairs[item+dictList->topIndex]);
			break;
		case MSG_LISTUP:
		case MSG_LISTDOWN:
//			printf("got listup\n");
			myDict->GetDefinition(myDict->wordPairs[dictList->topIndex+dictList->CurrentSelection(0)]);
			break;
//		case MSG_LISTDOWN:
//			printf("got listdown\n");
//			myDict->GetDefinition(myDict->wordPairs[dictList->topIndex+dictList->CurrentSelection(0)]);
//			break;
		case MSG_CLEAR_INPUT:
			wordInput->SetText("");
			wordInput->MakeFocus();
			break;
		case MENU_ENG2POL:
			UpdateLanguages(true);
			break;
		case MENU_POL2ENG:
			UpdateLanguages(false);
			break;
		case MENU_SWITCH:
			UpdateLanguages(!config->toPolish);
			break;
		case MENU_FUZZY:
			config->searchmode = SEARCH_FUZZY;
			config->save();
			HandleModifiedInput(true);
			UpdateMenus();
			break;
		case MENU_PLAIN:
			config->searchmode = SEARCH_BEGINS;
			config->save();
			HandleModifiedInput(true);
			UpdateMenus();
			break;
/*		case MENU_ENGINESQ2:
			SwitchEngine(DICTIONARY_SQ2);
			break; */
		case MENU_ENGINESAP:
			SwitchEngine(DICTIONARY_SAP);
			break;
		case MENU_ENGINEYDP:
			SwitchEngine(DICTIONARY_YDP);
			break;
		case MENU_PATH:
			ConfigPath();
			break;
		case MENU_COLOR0:
			ConfigColour(0);
			break;
		case MENU_COLOR1:
			ConfigColour(1);
			break;
		case MENU_COLOR2:
			ConfigColour(2);
			break;
		case MENU_COLOR3:
			ConfigColour(3);
			break;
		case MENU_CLIP:
			config->clipboardTracking = !config->clipboardTracking;
			config->save();
			UpdateMenus();
			break;
		case MENU_FOCUS:
			config->setFocusOnSelf = !config->setFocusOnSelf;
			config->save();
			UpdateMenus();
			break;
		case MENU_DISTANCE:
			ConfigDistance();
			break;
/*		case MENU_SQL:
			ConfigSQLTables();
			break; */
		case MENU_ABOUT: {
			BString about;
			about = "\n\n" APP_NAME " " APP_VERSION "\n";
			about += "English-Polish, Polish-English dictionary\n";
			about += "\n\nBeOS version:\n";
			about += "Maciej Witkowiak <*****@*****.**>";
			about += "\n\nSAP engine based on sap v0.2b\n";
			about += "(c) 1998 Bohdan R. Rau,\n(c) 2001 Daniel Mealha Cabrita";
			about += "\nYDP and SQL engines by Maciej Witkowiak\n";
			about += "\n\nSoftware released under GNU/GPL license";
			about += "\n\nvisit:\n";
			about += "http://home.elysium.pl/ytm/html/beos.html\n";
			about += "\nDevelopment has been encouraged by:\n";
			about += "http://www.haiku-os.pl";
			outputView->SetText(about.String()); }
			break;
		case FONT_SIZE:
		{
			float fontSize;
			Message->FindFloat("size",&fontSize);
			SetFontSize(fontSize);
		}
		break;
		case FONT_FAMILY:
		{
			const char * fontFamily = 0, * fontStyle = 0;
			void * ptr;
			if (Message->FindPointer("source",&ptr) == B_OK) {
				currentFontItem = static_cast<BMenuItem*>(ptr);
				fontFamily = currentFontItem->Label();
			}
			SetFontStyle(fontFamily, fontStyle);
		}
		case FONT_STYLE:
		{
			const char * fontFamily = 0, * fontStyle = 0;
			void * ptr;
			if (Message->FindPointer("source",&ptr) == B_OK) {
				BMenuItem * item = static_cast<BMenuItem*>(ptr);
				fontStyle = item->Label();
				BMenu * menu = item->Menu();
				if (menu != 0) {
					currentFontItem = menu->Superitem();
					if (currentFontItem != 0) {
						fontFamily = currentFontItem->Label();
					}
				}
			}
			SetFontStyle(fontFamily, fontStyle);
		}
		case MSG_SCROLL:
//			printf("scroll value changed\n");
			if (scrollBar->Value() != dictList->topIndex) {
				dictList->ListScrolled(scrollBar->Value());
				myDict->GetDefinition(myDict->wordPairs[dictList->topIndex+dictList->CurrentSelection(0)]);
			}
			break;
		case MSG_COLOURUPDATE:
//			printf("colour update\n");
			myDict->ReGetDefinition();
			break;
		case MSG_FUZZYUPDATE:
//			printf("fuzzy update\n");
			if (config->searchmode == SEARCH_FUZZY)
				HandleModifiedInput(true);
			break;
/*		case MSG_SQLTABLESUPDATE:
//			printf("sql tables updated\n");
			myDict->FlushCache();
			SwitchEngine(config->dictionarymode);
			break; */
		case B_CLIPBOARD_CHANGED:
			NewClipData();
			break;
		case B_REFS_RECEIVED:
			RefsReceived(Message);
			break;
		case B_CANCEL:
//			printf("canceled\n");
			if (firstStart) {
				config->dictionarymode = DICTIONARY_SAP;	// will be saved in QuitRequested below
				BAlert *alert = new BAlert(APP_NAME, "Couldn't open dictionary. Dictionary engine has been reset to SAP.", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
				alert->Go();
				QuitRequested();
			}
			else
				delete myPanel;
//			break;
		default:
			BWindow::MessageReceived(Message);
			break;
	}
	this->EnableUpdates();
}