void
CBFileNameDisplay::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	if (key == kJEscapeKey)
		{
		itsTE->Focus();
		}
	else if (key == '\t' &&
			 !modifiers.GetState(kJXMetaKeyIndex)   &&
			 modifiers.GetState(kJXControlKeyIndex) &&
			 !modifiers.shift())
		{
		itsTE->Focus();
		itsTE->HandleKeyPress(key, modifiers);
		}
	else if ((key == '\r' || key == '\n') &&
			 !modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXMetaKeyIndex)) &&
			 !modifiers.shift())
		{
		itsUnfocusAction =
			modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXControlKeyIndex)) ?
			kRename : kSaveAs;
		itsTE->Focus();				// trigger HandleUnfocusEvent()
		itsUnfocusAction = kCancel;
		}
	else
		{
		JXFileInput::HandleKeyPress(key, modifiers);
		}
}
void
CMLineIndexTable::AdjustBreakpoints
	(
	const JIndex			lineIndex,
	const JPoint&			pt,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	JIndex bpIndex;
	if (!GetFirstBreakpointOnLine(lineIndex, &bpIndex))
		{
		SetBreakpoint(lineIndex, JI2B(
			modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXMetaKeyIndex)) &&
			modifiers.shift()));
		}
	else if (HasMultipleBreakpointsOnLine(bpIndex))
		{
		OpenLineMenu(lineIndex, pt, buttonStates, modifiers, kJTrue, bpIndex);
		}
	else if (modifiers.shift())
		{
		(itsBPList->NthElement(bpIndex))->ToggleEnabled();
		}
	else
		{
		itsLink->RemoveBreakpoint(*(itsBPList->NthElement(bpIndex)));
		}
}
void
CMLineIndexTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if (ScrollForWheel(button, modifiers, NULL, itsVScrollbar))
		{
		return;
		}

	JPoint cell;
	if (!GetCell(pt, &cell))
		{
		return;
		}

	itsText->SelectLine(cell.y);
	const JIndex lineIndex = itsText->VisualLineIndexToCRLineIndex(cell.y);

	if (button == kJXRightButton)
		{
		OpenLineMenu(lineIndex, pt, buttonStates, modifiers, kJFalse);
		}
	else if (button == kJXLeftButton &&
			 modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXMetaKeyIndex)) &&
			 !modifiers.shift())
		{
		RunUntil(lineIndex);
		}
	else if (button == kJXLeftButton &&
			 modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXControlKeyIndex)))
		{
		SetExecutionPoint(lineIndex);
		}
	else if (button == kJXLeftButton)
		{
		AdjustBreakpoints(lineIndex, pt, buttonStates, modifiers);
		}
}
Atom
CBCommandTable::GetDNDAction
	(
	const JXContainer*		target,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	const JBoolean meta =
		modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXMetaKeyIndex));

	if ((target == this && !meta) ||
		(target != this &&  meta))
		{
		return (GetDNDManager())->GetDNDActionMoveXAtom();
		}
	else
		{
		return (GetDNDManager())->GetDNDActionCopyXAtom();
		}
}