Пример #1
0
bool CApplication::KeyPress(int c)
{
	if (c == TINKER_KEY_F4 && IsAltDown())
		exit(0);

	return DoKeyPress(c);
}
Пример #2
0
bool CApplication::KeyPress(int c)
{
	if (glgui::CRootPanel::Get()->KeyPressed(c, IsCtrlDown()))
		return true;

	if (c == TINKER_KEY_F4 && IsAltDown())
		exit(0);

	return DoKeyPress(c);
}
Пример #3
0
HRESULT CBKeyboardState::ReadKey(SDL_Event *event) {
	m_CurrentPrintable = (event->type == SDL_TEXTINPUT);
	m_CurrentCharCode = KeyCodeToVKey(event);
	//m_CurrentKeyData = KeyData;

	m_CurrentControl = IsControlDown();
	m_CurrentAlt     = IsAltDown();
	m_CurrentShift   = IsShiftDown();

	return S_OK;
}
Пример #4
0
// processes a keystroke
void EditView::HandleKey(int ch)
{
	//stat("got ch: %c", ch);
	if (modifiers() & B_CONTROL_KEY)
	{
		// translate e.g., CTRL+C back into just "C".
		// todo: fixup so we don't have to do this.
		ch = TranslateAltKey(ch);
	}
	//stat("translated ch: %c", ch);
	
	// ctrl+tab shortcut
	if (ch==TAB && IsCtrlDown())
	{
		if (IsShiftDown())
			TabBar->SwitchToPrevTab();
		else
			TabBar->SwitchToNextTab();
		
		return;
	}
	
	// catch command-shortcut sequences
	if (ProcessCommandSeq(ch))
		return;
	
	// ctrl+shift+z (Redo) shortcut
	if ((ch=='z' || ch=='Z') && IsCtrlDown() && IsShiftDown())
	{
		MainWindow->ProcessMenuCommand(M_EDIT_REDO);
		return;
	}
	
	// catch some other shortcuts before passing to main key processor
	switch(ch)
	{
		case B_DELETE:
			if (IsShiftDown())	// SHIFT+DEL: shortcut for cut
			{
				MainWindow->ProcessMenuCommand(M_EDIT_CUT);
				break;
			}
			else
			{
				ProcessKey(this, ch);
			}
		break;
		
		case B_INSERT:
			if (IsShiftDown())	// SHIFT+INS: legacy shortcut for paste
			{
				MainWindow->ProcessMenuCommand(M_EDIT_PASTE);
				break;
			}
			else
			{
				editor.InOverwriteMode ^= 1;
				MainView->cursor.SetThick(editor.InOverwriteMode);
			}
		break;
		
		default:
			if (IsCtrlDown() || IsAltDown()) break;
		case B_TAB: case B_HOME: case B_END:
		case KEY_MOUSEWHEEL_UP: case KEY_MOUSEWHEEL_DOWN:
			ProcessKey(this, ch);
		break;
	}
	
	this->RedrawView();
}
FReply FKismetVariableDragDropAction::DroppedOnPanel( const TSharedRef< SWidget >& Panel, FVector2D ScreenPosition, FVector2D GraphPosition, UEdGraph& Graph)
{	
	if (Cast<const UEdGraphSchema_K2>(Graph.GetSchema()) != NULL)
	{
		UProperty* VariableProperty = GetVariableProperty();
		if (VariableProperty != nullptr && CanVariableBeDropped(VariableProperty, Graph))
		{
			UStruct* Outer = CastChecked<UStruct>(VariableProperty->GetOuter());
			
			FNodeConstructionParams NewNodeParams;
			NewNodeParams.VariableName = VariableName;
			NewNodeParams.Graph = &Graph;
			NewNodeParams.GraphPosition = GraphPosition;
			NewNodeParams.VariableSource= Outer;

			// call analytics
			AnalyticCallback.ExecuteIfBound();

			// Take into account current state of modifier keys in case the user changed his mind
			auto ModifierKeys = FSlateApplication::Get().GetModifierKeys();
			const bool bModifiedKeysActive = ModifierKeys.IsControlDown() || ModifierKeys.IsAltDown();
			const bool bAutoCreateGetter = bModifiedKeysActive ? ModifierKeys.IsControlDown() : bControlDrag;
			const bool bAutoCreateSetter = bModifiedKeysActive ? ModifierKeys.IsAltDown() : bAltDrag;
			// Handle Getter/Setters
			if (bAutoCreateGetter || bAutoCreateSetter)
			{
				if (bAutoCreateGetter || !CanExecuteMakeSetter(NewNodeParams, VariableProperty))
				{
					MakeGetter(NewNodeParams);
					NewNodeParams.GraphPosition.Y += 50.f;
				}
				if (bAutoCreateSetter && CanExecuteMakeSetter( NewNodeParams, VariableProperty))
				{
					MakeSetter(NewNodeParams);
				}
			}
			// Show selection menu
			else
			{
				FMenuBuilder MenuBuilder(true, NULL);
				const FText VariableNameText = FText::FromName( VariableName );

				MenuBuilder.BeginSection("BPVariableDroppedOn", VariableNameText );

				MenuBuilder.AddMenuEntry(
					LOCTEXT("CreateGetVariable", "Get"),
					FText::Format( LOCTEXT("CreateVariableGetterToolTip", "Create Getter for variable '{0}'\n(Ctrl-drag to automatically create a getter)"), VariableNameText ),
					FSlateIcon(),
					FUIAction(
					FExecuteAction::CreateStatic(&FKismetVariableDragDropAction::MakeGetter, NewNodeParams), FCanExecuteAction())
					);

				MenuBuilder.AddMenuEntry(
					LOCTEXT("CreateSetVariable", "Set"),
					FText::Format( LOCTEXT("CreateVariableSetterToolTip", "Create Setter for variable '{0}'\n(Alt-drag to automatically create a setter)"), VariableNameText ),
					FSlateIcon(),
					FUIAction(
					FExecuteAction::CreateStatic(&FKismetVariableDragDropAction::MakeSetter, NewNodeParams),
					FCanExecuteAction::CreateStatic(&FKismetVariableDragDropAction::CanExecuteMakeSetter, NewNodeParams, VariableProperty ))
					);

				TSharedRef< SWidget > PanelWidget = Panel;
				// Show dialog to choose getter vs setter
				FSlateApplication::Get().PushMenu(
					PanelWidget,
					FWidgetPath(),
					MenuBuilder.MakeWidget(),
					ScreenPosition,
					FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu)
					);

				MenuBuilder.EndSection();
			}
		}
	}

	return FReply::Handled();
}
Пример #6
0
inline int GetCurrentModifiers () { 
return (IsCtrlDown()? VKM_CTRL:0)
| (IsShiftDown()? VKM_SHIFT:0)
| (IsAltDown()? VKM_ALT:0);
}