Пример #1
0
// static
nsresult nsEditorController::RegisterEditingCommands(nsIControllerCommandTable *inCommandTable)
{
  // now register all our commands
  // These are commands that will be used in text widgets, and in composer

  NS_REGISTER_ONE_COMMAND(nsUndoCommand, "cmd_undo");
  NS_REGISTER_ONE_COMMAND(nsRedoCommand, "cmd_redo");
  NS_REGISTER_ONE_COMMAND(nsClearUndoCommand, "cmd_clearUndo");

  NS_REGISTER_ONE_COMMAND(nsCutCommand, "cmd_cut");
  NS_REGISTER_ONE_COMMAND(nsCutOrDeleteCommand, "cmd_cutOrDelete");
  NS_REGISTER_ONE_COMMAND(nsCopyCommand, "cmd_copy");
  NS_REGISTER_ONE_COMMAND(nsCopyOrDeleteCommand, "cmd_copyOrDelete");
  NS_REGISTER_ONE_COMMAND(nsSelectAllCommand, "cmd_selectAll");

  NS_REGISTER_ONE_COMMAND(nsPasteCommand, "cmd_paste");
  NS_REGISTER_ONE_COMMAND(nsPasteTransferableCommand, "cmd_pasteTransferable");

  NS_REGISTER_ONE_COMMAND(nsSwitchTextDirectionCommand, "cmd_switchTextDirection");

  NS_REGISTER_FIRST_COMMAND(nsDeleteCommand, "cmd_delete");
  NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteCharBackward");
  NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteCharForward");
  NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteWordBackward");
  NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteWordForward");
  NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteToBeginningOfLine");
  NS_REGISTER_LAST_COMMAND(nsDeleteCommand, "cmd_deleteToEndOfLine");

  // Insert content
  NS_REGISTER_ONE_COMMAND(nsInsertPlaintextCommand, "cmd_insertText");
  NS_REGISTER_ONE_COMMAND(nsPasteQuotationCommand,  "cmd_pasteQuote");

  return NS_OK;
}
// static
nsresult
nsComposerController::RegisterEditorDocStateCommands(
                        nsIControllerCommandTable *inCommandTable)
{
  nsresult rv;

  // observer commands for document state
  NS_REGISTER_FIRST_COMMAND(nsDocumentStateCommand, "obs_documentCreated")
  NS_REGISTER_NEXT_COMMAND(nsDocumentStateCommand, "obs_documentWillBeDestroyed")
  NS_REGISTER_LAST_COMMAND(nsDocumentStateCommand, "obs_documentLocationChanged")

  // commands that may get or change state
  NS_REGISTER_FIRST_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentModified")
  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentUseCSS")
  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentReadOnly")
  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_insertBrOnReturn")
  NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_enableObjectResizing")
  NS_REGISTER_LAST_COMMAND(nsSetDocumentStateCommand, "cmd_enableInlineTableEditing")

  NS_REGISTER_ONE_COMMAND(nsSetDocumentOptionsCommand, "cmd_setDocumentOptions")

  return NS_OK;
}
Пример #3
0
// static
nsresult
EditorController::RegisterEditorCommands(
                    nsIControllerCommandTable* aCommandTable)
{
  // These are commands that will be used in text widgets only.

  NS_REGISTER_FIRST_COMMAND(SelectionMoveCommands, "cmd_scrollTop");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollBottom");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveTop");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveBottom");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectTop");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectBottom");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_lineNext");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_linePrevious");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLineNext");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLinePrevious");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_charPrevious");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_charNext");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectCharPrevious");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectCharNext");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_beginLine");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_endLine");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectBeginLine");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectEndLine");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_wordPrevious");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_wordNext");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectWordPrevious");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectWordNext");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollPageUp");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollPageDown");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollLineUp");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollLineDown");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_movePageUp");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_movePageDown");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectPageUp");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectPageDown");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveLeft");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveRight");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveUp");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveDown");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveLeft2");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveRight2");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveUp2");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveDown2");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLeft");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectRight");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectUp");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectDown");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLeft2");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectRight2");
  NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectUp2");
  NS_REGISTER_LAST_COMMAND(SelectionMoveCommands, "cmd_selectDown2");

  return NS_OK;
}