void
JXScrolltab::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	const JBoolean shiftOn = modifiers.shift();
	const JBoolean metaOn  = modifiers.meta();

	if (button == kJXLeftButton && metaOn && shiftOn)
		{
		itsScrollbar->RemoveAllScrolltabs();
		}
	else if (button == kJXLeftButton && metaOn)
		{
		delete this;
		}
	else if (button == kJXLeftButton)
		{
		ScrollToTab();
		}
	else if (button == kJXRightButton)
		{
		OpenActionMenu(pt, buttonStates, 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
GLFitParameterTable::HandleKeyPress
	(
	const int 				key,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint cell;
	if (key == kJReturnKey && GetEditedCell(&cell))
		{
		if (EndEditing())
			{
			if (!modifiers.shift() && cell.y < (JCoordinate)GetRowCount())
				{
				BeginEditing(JPoint(cell.x, cell.y + 1));
				}
			else if (modifiers.shift() && cell.y > 1)
				{
				BeginEditing(JPoint(cell.x, cell.y - 1));
				}
			}
		}
	else if (key == kJTabKey)
		{
		// do nothing
		}

	else
		{
		JXEditTable::HandleKeyPress(key, modifiers);
		}
}
void
TestWidget::AdjustCursor
	(
	const JPoint&			pt,
	const JXKeyModifiers&	modifiers
	)
{
	if (itsHomeRect.Contains(pt))
		{
		DisplayCursor(kJXDefaultCursor);
		}
	else if (its2Rect.Contains(pt))
		{
		DisplayCursor(itsGumbyCursor);
		}
	else if (its3Rect.Contains(pt))
		{
		DisplayCursor(itsBogosityCursor);
		}
	else if (modifiers.meta())
		{
		DisplayCursor(itsFleurCursor);
		}
	else
		{
		JXScrollableWidget::AdjustCursor(pt, modifiers);
		}
}
void
JXHorizPartition::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	itsDragType = kInvalidDrag;
	if (button != kJXLeftButton)
		{
		return;
		}

	if (modifiers.meta())
		{
		itsDragType = kDragAll;
		PrepareToDragAll(pt.x, &itsMinDragX, &itsMaxDragX);
		}
	else
		{
		itsDragType = kDragOne;
		PrepareToDrag(pt.x, &itsMinDragX, &itsMaxDragX);
		}

	JPainter* p = CreateDragInsidePainter();

	const JRect ap = GetAperture();
	p->Line(pt.x, ap.top, pt.x, ap.bottom);
	itsPrevPt = pt;
}
void
JXInputField::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if (button == kJXRightButton)
		{
//		if (!PointInSelection(pt))
//			{
//			JXTEBase::HandleMouseDown(pt, kJXLeftButton, 1, buttonStates, modifiers);
//			}
		CreateContextMenu();
		itsContextMenu->PopUp(this, pt, buttonStates, modifiers);
		}
	else
		{
		ShouldAllowDragAndDrop(modifiers.meta());
		JXTEBase::HandleMouseDown(pt, button, clickCount, buttonStates, modifiers);
		}
}
void
JXExprEditor::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	if (0 < key && key <= 255 &&
		!modifiers.meta() && !modifiers.control())
		{
		EIPHandleKeyPress(key);
		}
	else
		{
		JXScrollableWidget::HandleKeyPress(key, modifiers);
		}
}
void
JXTreeListWidget::HandleMouseUp
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if (itsToggleDragIndex > 0 && itsMouseInToggleFlag)
		{
		ToggleNode(itsToggleDragIndex, modifiers.shift(), modifiers.meta());
		Refresh();
		}

	itsMouseInToggleFlag = kJFalse;
	itsToggleDragIndex   = 0;
}
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);
		}
}
Exemple #10
0
void
JXTable::BeginSelectionDrag
	(
	const JPoint&			cell,
	const JXMouseButton		button,
	const JXKeyModifiers&	modifiers
	)
{
	if (button != kJXMiddleButton)
		{
		const JBoolean extendSelection =
			JI2B((button == kJXLeftButton && modifiers.shift()) ||
				 button == kJXRightButton);

		const JBoolean selectDiscont = modifiers.control();

		JTable::BeginSelectionDrag(cell, extendSelection, selectDiscont);
		}
}
Exemple #11
0
JBoolean
JXTable::HandleSelectionKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	return JI2B(0 < key && key <= 255 &&
				JTable::HandleSelectionKeyPress(key, modifiers.shift()));
}
void
JXTreeListWidget::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	if (key == kJLeftArrow && !IsEditing())
		{
		CloseSelectedNodes(modifiers.shift(), modifiers.meta());
		}
	else if (key == kJRightArrow && !IsEditing())
		{
		OpenSelectedNodes(modifiers.shift(), modifiers.meta());
		}
	else
		{
		JXStyleTable::HandleKeyPress(key, modifiers);
		}
}
void
JXTable::BeginSelectionDrag
	(
	const JPoint&			cell,
	const JXMouseButton		button,
	const JXKeyModifiers&	modifiers
	)
{
	if (button != kJXMiddleButton)
		{
		const JBoolean extendSelection =
			JI2B((button == kJXLeftButton && modifiers.shift()) ||
				 button == kJXRightButton);

		const JBoolean selectDiscont =
//			GetDisplay()->IsOSX() ? modifiers.meta() :	// meta-dbl-click used in too many places
			modifiers.control();

		JTable::BeginSelectionDrag(cell, extendSelection, selectDiscont);
		}
}
Atom
GMMessageDragSource::GetDNDAction
	(
	const JXContainer*		target,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if (modifiers.control())
		{
		return GetDNDManager()->GetDNDActionAskXAtom();
		}
	else if (modifiers.meta())
		{
		return GetDNDManager()->GetDNDActionCopyXAtom();
		}
	else
		{
		return GetDNDManager()->GetDNDActionMoveXAtom();
		}
}
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
JXInputField::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	if (itsTable != NULL && itsTable->WantsInputFieldKey(key, modifiers))
		{
		itsTable->HandleKeyPress(key, modifiers);
		return;
		}
	else if (itsTable != NULL)
		{
		JPoint cell;
		const JBoolean ok = itsTable->GetEditedCell(&cell);
		assert( ok );
		itsTable->TableScrollToCell(cell);
		}

	if (key == JXCtrl('K') && modifiers.control() && HasSelection())
		{
		Cut();
		}
	else if (key == JXCtrl('K') && modifiers.control())
		{
		JIndex i;
		const JBoolean ok = GetCaretLocation(&i);
		assert( ok );
		SetSelection(i, GetTextLength());
		Cut();
		}

	else
		{
		JXTEBase::HandleKeyPress(key, modifiers);
		}
}
JBoolean
JX3DWidget::ZoomForWheel
	(
	const JXMouseButton		button,
	const JXKeyModifiers&	modifiers
	)
{
	JCoordinate delta;
	if (button == kJXButton4)
		{
		delta = -1;
		}
	else if (button == kJXButton5)
		{
		delta = +1;
		}
	else
		{
		return kJFalse;
		}

	const JVector& o = itsCamera->GetAttentionPt();
	const JVector& p = itsCamera->GetPosition();

	JFloat scale =
		(modifiers.shift()   ? kSmallZoomScale :
		(modifiers.control() ? kBigZoomScale   :
		kZoomScale));

#ifdef _J_OSX
	scale /= 10.0;
#endif

	itsCamera->SetPosition(o + (p - o) * (1.0 + delta * scale));
	return kJTrue;
}
void
JXHorizPartition::AdjustCursor
	(
	const JPoint&			pt,
	const JXKeyModifiers&	modifiers
	)
{
	if (modifiers.meta())
		{
		DisplayCursor(itsDragAllLineCursor);
		}
	else
		{
		JXPartition::AdjustCursor(pt, modifiers);
		}
}
void
JXRowHeaderWidget::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	itsDragType = kInvalidDrag;
	if (!itsAllowRowResizingFlag)
		{
		return;
		}

	const JBoolean inDragRegion = InDragRegion(pt, &itsDragCell);

	if (inDragRegion && button == kJXLeftButton)
		{
		itsDragCellRect = GetCellRect(itsDragCell);
		if (modifiers.meta())
			{
			itsDragType = kDragAllRows;
			}
		else
			{
			itsDragType = kDragOneRow;
			}

		JPainter* p = CreateDragOutsidePainter();
		JRect defClipRect = p->GetDefaultClipRect();
		JRect apG = GetApertureGlobal();
		defClipRect.top    = apG.top;
		defClipRect.bottom = apG.bottom;
		p->SetDefaultClipRect(defClipRect);

		const JRect enclAp = JXContainer::GlobalToLocal((GetEnclosure())->GetApertureGlobal());
		p->Line(enclAp.left, pt.y, enclAp.right, pt.y);
		itsPrevPt = pt;
		}
}
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();
		}
}
void
CMArray2DTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	JTableSelection& s = GetTableSelection();

	JPoint cell;
	if (ScrollForWheel(button, modifiers))
		{
		// work has been done
		}
	else if (!GetCell(pt, &cell))
		{
		s.ClearSelection();
		}
	else if (button == kJXLeftButton && modifiers.meta())
		{
		if (!s.IsSelected(cell))
			{
			SelectSingleCell(cell, kJFalse);
			}

		const JString expr = itsArrayDir->GetExpression(cell);
		itsCmdDir->DisplayExpression(expr);
		}
	else if (button == kJXLeftButton && clickCount == 2)
		{
		BeginEditing(cell);
		}
	else if (button == kJXLeftButton && clickCount == 1)
		{
		SelectSingleCell(cell, kJFalse);
		}
}
void
JXRowHeaderWidget::AdjustCursor
	(
	const JPoint&			pt,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint cell;
	const JBoolean inDragRegion = InDragRegion(pt, &cell);
	if (itsAllowRowResizingFlag && inDragRegion && modifiers.meta())
		{
		DisplayCursor(itsDragAllLineCursor);
		}
	else if (itsAllowRowResizingFlag && inDragRegion)
		{
		DisplayCursor(itsDragLineCursor);
		}
	else
		{
		JXEditTable::AdjustCursor(pt, modifiers);
		}
}
void
CBSymbolTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	itsKeyBuffer.Clear();

	JPoint cell;
	if (ScrollForWheel(button, modifiers))
		{
		return;
		}
	else if (!GetCell(pt, &cell))
		{
		(GetTableSelection()).ClearSelection();
		}
	else if (button == kJXLeftButton &&
			 clickCount == 2 &&
			 !modifiers.shift() && modifiers.meta() && modifiers.control())
		{
		SelectSingleCell(cell, kJFalse);
		DisplaySelectedSymbols();
		(GetWindow())->Close();
		return;
		}
	else if (clickCount == 2 && modifiers.meta())
		{
		SelectSingleCell(cell, kJFalse);
		FindSelectedSymbols(button);
		}
	else if (button == kJXLeftButton &&
			 clickCount == 2 &&
			 !modifiers.shift() && !modifiers.control())
		{
		DisplaySelectedSymbols();
		}
	else
		{
		BeginSelectionDrag(cell, button, modifiers);
		}
}
void
JXFSBindingTable::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint cell;
	if (GetEditedCell(&cell) && cell.x == kPatternColumn &&
		(key == kJTabKey ||
		 (modifiers.meta() && (key == kJRightArrow || key == '6'))))
		{
		if (EndEditing() &&
			(GetTableSelection()).GetSingleSelectedCell(&cell))
			{
			BeginEditing(JPoint(kCommandColumn, cell.y));
			}
		}

	else
		{
		JXEditTable::HandleKeyPress(key, modifiers);
		}
}
Exemple #25
0
JBoolean
JXEditTable::WantsInputFieldKey
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
	const
{
	return JI2B(
		key == kJReturnKey || key == kJTabKey || key == kJEscapeKey ||
		(modifiers.meta() &&
		 (key == kJUpArrow || key == '8' ||
		  key == kJDownArrow || key == '2' ||
		  key == kJLeftArrow || key == '4' ||
		  key == kJRightArrow || key == '6')) ||

		// JXScrollableWidget

		(!JXTEBase::WillUseWindowsHomeEnd() &&
		 (key == XK_Home || key == XK_KP_Home ||
		  key == XK_End || key == XK_KP_End)) ||
		key == XK_Page_Up || key == XK_KP_Page_Up ||
		key == XK_Page_Down || key == XK_KP_Page_Down);
}
void
CBStylerTableInput::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if ((button == kJXLeftButton && modifiers.meta()) ||
		button == kJXRightButton)
		{
		JPoint cell;
		const JBoolean ok = itsStylerTable->GetEditedCell(&cell);
		assert( ok );
		itsStylerTable->DisplayFontMenu(cell, this, pt, buttonStates, modifiers);
		}
	else
		{
		JXInputField::HandleMouseDown(pt, button, clickCount,
									  buttonStates, modifiers);
		}
}
void
TestStringTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	itsIsDraggingFlag = kJFalse;
	if (button > kJXRightButton)
		{
		ScrollForWheel(button, modifiers);
		return;
		}

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

	JStringTableData* data = GetStringData();
	JTableSelection& s     = GetTableSelection();

	if (button == kJXMiddleButton)
		{
		BeginEditing(cell);
		}

	else if (itsMouseAction == kSelectCells)
		{
		if (button == kJXLeftButton && !modifiers.shift())
			{
			s.ClearSelection();
			s.SetBoat(cell);
			s.SetAnchor(cell);
			s.SelectCell(cell);
			itsIsDraggingFlag = kJTrue;
			}
		else
			{
			itsIsDraggingFlag = s.ExtendSelection(cell);
			}
		}

	else if (itsMouseAction == kSelectRows)
		{
		if (button == kJXLeftButton && !modifiers.shift())
			{
			s.ClearSelection();
			}
		s.SetBoat(JPoint(1, cell.y));
		s.SetAnchor(JPoint(GetColCount(), cell.y));
		s.SelectRow(cell.y);
		}

	else if (itsMouseAction == kSelectCols)
		{
		if (button == kJXLeftButton && !modifiers.shift())
			{
			s.ClearSelection();
			}
		s.SetBoat(JPoint(cell.x, 1));
		s.SetAnchor(JPoint(cell.x, GetRowCount()));
		s.SelectCol(cell.x);
		}

	// row manipulations

	else if (button == kJXLeftButton && itsMouseAction == kInsertRow)
		{
		data->InsertRows(cell.y, 1);
		}
	else if (button == kJXRightButton && itsMouseAction == kInsertRow)
		{
		data->InsertRows(cell.y+1, 1);
		}

	else if (button == kJXLeftButton && itsMouseAction == kDuplicateRow)
		{
		data->DuplicateRow(cell.y, cell.y);
		}
	else if (button == kJXRightButton && itsMouseAction == kDuplicateRow)
		{
		data->DuplicateRow(cell.y, cell.y+1);
		}

	else if (button == kJXLeftButton && itsMouseAction == kMoveRow &&
			 cell.y > 1)
		{
		data->MoveRow(cell.y, cell.y-1);
		}
	else if (button == kJXRightButton && itsMouseAction == kMoveRow &&
			 ((JIndex) cell.y) < GetRowCount())
		{
		data->MoveRow(cell.y, cell.y+1);
		}

	else if (itsMouseAction == kRemoveRow)
		{
		data->RemoveRow(cell.y);
		}

	// column manipulations

	else if (button == kJXLeftButton && itsMouseAction == kInsertCol)
		{
		data->InsertCols(cell.x, 1);
		}
	else if (button == kJXRightButton && itsMouseAction == kInsertCol)
		{
		data->InsertCols(cell.x+1, 1);
		}

	else if (button == kJXLeftButton && itsMouseAction == kDuplicateCol)
		{
		data->DuplicateCol(cell.x, cell.x);
		}
	else if (button == kJXRightButton && itsMouseAction == kDuplicateCol)
		{
		data->DuplicateCol(cell.x, cell.x+1);
		}

	else if (button == kJXLeftButton && itsMouseAction == kMoveCol &&
			 cell.x > 1)
		{
		data->MoveCol(cell.x, cell.x-1);
		}
	else if (button == kJXRightButton && itsMouseAction == kMoveCol &&
			 ((JIndex) cell.x) < GetColCount())
		{
		data->MoveCol(cell.x, cell.x+1);
		}

	else if (itsMouseAction == kRemoveCol)
		{
		data->RemoveCol(cell.x);
		}
}
void
TestWidget::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton		button,
	const JSize				clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if (button == kJXLeftButton && clickCount == 1 && itsHomeRect.Contains(pt))
		{
		JString dir;
		if (JGetHomeDirectory(&dir))
			{
			JPtrArray<JString> list(JPtrArrayT::kForgetAll);
			list.Append(&dir);

			// Normally, you should use the other constructor and then
			// override JXWidget::GetSelectionData().

			JXFileSelection* data = jnew JXFileSelection(GetDisplay(), list);
			assert( data != NULL );

			BeginDND(pt, buttonStates, modifiers, data);
			}
		}
	else if (button == kJXLeftButton && clickCount == 1)
		{
		JPainter* p = CreateDragInsidePainter();
		p->Rect(JRect(pt, pt));
		}
	else if (button == kJXMiddleButton && clickCount == 1)
		{
		itsAnimButton->Place(pt.x, pt.y);
		}
	else if (button == kJXRightButton && clickCount == 1 && !modifiers.meta())
		{
		JRect r = itsAnimButton->GetFrame();
		if (pt.x > r.left && pt.y > r.top)
			{
			itsAnimButton->SetSize(pt.x-r.left, pt.y-r.top);
			}
		}
	else if (button == kJXRightButton && clickCount == 1 && modifiers.meta())
		{
		if (itsSecretMenu->PopUp(this, pt, buttonStates, modifiers))
			{
			return;
			}
		else
			{
			(JGetUserNotification())->ReportError("Unable to open secret menu!");
			}
		}
	else if (ScrollForWheel(button, modifiers))
		{
		// work has been done
		}
	else if ((clickCount == 2 && its2Rect.Contains(pt)) ||
			 (clickCount == 3 && its3Rect.Contains(pt)))
		{
		GetNewSize();
		}

	itsStartPt = itsPrevPt = pt;
}
void
CBSymbolTable::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint topSelCell;
	JTableSelection& s          = GetTableSelection();
	const JBoolean hadSelection = s.GetFirstSelectedCell(&topSelCell);

	if (key == ' ')
		{
		ClearSelection();
		}

	else if (key == kJReturnKey)
		{
		DisplaySelectedSymbols();
		if (modifiers.meta() && modifiers.control())
			{
			(GetWindow())->Close();
			return;
			}
		}

	else if (key == kJUpArrow || key == kJDownArrow)
		{
		itsKeyBuffer.Clear();
		if (!hadSelection && key == kJUpArrow && GetRowCount() > 0)
			{
			SelectSingleEntry(GetRowCount());
			}
		else
			{
			HandleSelectionKeyPress(key, modifiers);
			}
		}

	else if ((key == 'c' || key == 'C') && modifiers.meta() && !modifiers.shift())
		{
		CopySelectedSymbolNames();
		}

	else if (JXIsPrint(key) && !modifiers.control() && !modifiers.meta())
		{
		itsKeyBuffer.AppendCharacter(key);

		JIndex index;
		if (itsSymbolList->ClosestMatch(itsKeyBuffer, *itsVisibleList, &index))
			{
			JString saveBuffer = itsKeyBuffer;
			SelectSingleEntry(index);
			itsKeyBuffer = saveBuffer;
			}
		}

	else
		{
		JXTable::HandleKeyPress(key, modifiers);
		}
}
void
CBShellEditor::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	const JBoolean controlOn = modifiers.control();
	const JBoolean metaOn    = modifiers.meta();
	const JBoolean shiftOn   = modifiers.shift();
	if ((key == kJLeftArrow && metaOn && !controlOn && !shiftOn) ||
		(key == JXCtrl('A') && controlOn && !metaOn && !shiftOn))
		{
		const JIndex index            = GetInsertionIndex();
		const JRunArray<Font>& styles = GetStyles();
		if (index > 1 && styles.GetElement(index-1) == GetDefaultFont())
			{
			JIndex runIndex, firstIndexInRun;
			const JBoolean ok = styles.FindRun(index-1, &runIndex, &firstIndexInRun);
			SetCaretLocation(firstIndexInRun);
			return;
			}
		}

	if (key == kJReturnKey)
		{
		SetCurrentFont(itsInsertFont);
		}
	else
		{
		SetCurrentFont(GetDefaultFont());
		}

	JBoolean sentCmd = kJFalse;
	if (key == kJReturnKey && !modifiers.shift() && !HasSelection())
		{
		JIndex index;
		JBoolean ok = GetCaretLocation(&index);
		assert( ok );

		JString cmd;
		const JRunArray<Font>& styles = GetStyles();
		if (index > 1 && styles.GetElement(index-1) == GetDefaultFont())
			{
			JIndex runIndex, firstIndexInRun;
			ok = styles.FindRun(index-1, &runIndex, &firstIndexInRun);

			const JIndex endIndex = firstIndexInRun + styles.GetRunLength(runIndex);
			cmd = (GetText()).GetSubstring(firstIndexInRun, endIndex - 1);
			SetCaretLocation(endIndex);

			if (cmd.BeginsWith("man "))
				{
				cmd.ReplaceSubstring(1, 4, "jcc --man ");
				}
			else if (cmd.BeginsWith("apropos "))
				{
				cmd.ReplaceSubstring(1, 8, "jcc --apropos ");
				}
			else if (cmd.BeginsWith("vi "))
				{
				cmd.ReplaceSubstring(1, 3, "jcc ");
				}
			else if (cmd.BeginsWith("less ") || cmd.BeginsWith("more "))
				{
				cmd.ReplaceSubstring(1, 5, "jcc ");
				}
			else if (cmd == "more" || cmd == "less" || cmd == "vi")
				{
				cmd = "jcc";
				}
			}

		cmd += "\n";
		itsShellDoc->SendCommand(cmd);

		sentCmd = kJTrue;
		}

	CBTextEditor::HandleKeyPress(key, modifiers);

	if (sentCmd)
		{
		itsInsertIndex = GetInsertionIndex();
		}
}