IDE: undid handling copy, cut, paste of objectinspector

git-svn-id: trunk@24855 -
This commit is contained in:
mattias 2010-04-23 16:05:36 +00:00
parent 504da5187d
commit a92d69cb0d
5 changed files with 92 additions and 63 deletions

View File

@ -48,7 +48,7 @@ uses
LazarusIDEStrConsts, EnvironmentOpts, IDECommands, ComponentReg, LazarusIDEStrConsts, EnvironmentOpts, IDECommands, ComponentReg,
NonControlDesigner, FrameDesigner, AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg, NonControlDesigner, FrameDesigner, AlignCompsDlg, SizeCompsDlg, ScaleCompsDlg,
TabOrderDlg, DesignerProcs, CustomFormEditor, AskCompNameDlg, TabOrderDlg, DesignerProcs, CustomFormEditor, AskCompNameDlg,
ControlSelection, ChangeClassDialog, EditorOptions, SynEditKeyCmds; ControlSelection, ChangeClassDialog, EditorOptions;
type type
TDesigner = class; TDesigner = class;
@ -197,8 +197,6 @@ type
procedure DoOrderMoveSelectionToBack; procedure DoOrderMoveSelectionToBack;
procedure DoOrderForwardSelectionOne; procedure DoOrderForwardSelectionOne;
procedure DoOrderBackSelectionOne; procedure DoOrderBackSelectionOne;
procedure DoUndo;
procedure DoRedo;
procedure GiveComponentsNames; procedure GiveComponentsNames;
procedure NotifyPersistentAdded(APersistent: TPersistent); procedure NotifyPersistentAdded(APersistent: TPersistent);
@ -262,7 +260,6 @@ type
MenuIndex: integer): boolean; override; MenuIndex: integer): boolean; override;
procedure DoProcessCommand(Sender: TObject; var Command: word; procedure DoProcessCommand(Sender: TObject; var Command: word;
var Handled: boolean); var Handled: boolean);
function DoCommand(Command: word): boolean;
function NonVisualComponentLeftTop(AComponent: TComponent): TPoint; function NonVisualComponentLeftTop(AComponent: TComponent): TPoint;
function NonVisualComponentAtPos(X, Y: integer): TComponent; function NonVisualComponentAtPos(X, Y: integer): TComponent;
@ -510,7 +507,8 @@ begin
'Custom dynamic section'); 'Custom dynamic section');
// register align section // register align section
DesignerMenuSectionAlign:=RegisterIDEMenuSection(DesignerMenuRoot, 'Align section'); DesignerMenuSectionAlign:=RegisterIDEMenuSection(DesignerMenuRoot,
'Align section');
DesignerMenuAlign:=RegisterIDEMenuCommand(DesignerMenuSectionAlign, DesignerMenuAlign:=RegisterIDEMenuCommand(DesignerMenuSectionAlign,
'Align',fdmAlignWord, nil, nil, nil, 'align'); 'Align',fdmAlignWord, nil, nil, nil, 'align');
DesignerMenuMirrorHorizontal:=RegisterIDEMenuCommand(DesignerMenuSectionAlign, DesignerMenuMirrorHorizontal:=RegisterIDEMenuCommand(DesignerMenuSectionAlign,
@ -523,7 +521,8 @@ begin
'Size',fdmSizeWord, nil, nil, nil, 'size'); 'Size',fdmSizeWord, nil, nil, nil, 'size');
// register tab and z-order section // register tab and z-order section
DesignerMenuSectionOrder:=RegisterIDEMenuSection(DesignerMenuRoot, 'Order section'); DesignerMenuSectionOrder:=RegisterIDEMenuSection(DesignerMenuRoot,
'Order section');
DesignerMenuTabOrder:=RegisterIDEMenuCommand(DesignerMenuSectionOrder, DesignerMenuTabOrder:=RegisterIDEMenuCommand(DesignerMenuSectionOrder,
'Tab order',fdmTabOrder); 'Tab order',fdmTabOrder);
DesignerMenuSectionZOrder:=RegisterIDESubMenu(DesignerMenuSectionOrder, DesignerMenuSectionZOrder:=RegisterIDESubMenu(DesignerMenuSectionOrder,
@ -538,7 +537,8 @@ begin
'Move z order backwards one',fdmOrderBackOne, nil, nil, nil, 'Order_back_one'); 'Move z order backwards one',fdmOrderBackOne, nil, nil, nil, 'Order_back_one');
// register clipboard section // register clipboard section
DesignerMenuSectionClipboard:=RegisterIDEMenuSection(DesignerMenuRoot, 'Clipboard section'); DesignerMenuSectionClipboard:=RegisterIDEMenuSection(DesignerMenuRoot,
'Clipboard section');
DesignerMenuCut:=RegisterIDEMenuCommand(DesignerMenuSectionClipboard, DesignerMenuCut:=RegisterIDEMenuCommand(DesignerMenuSectionClipboard,
'Cut',lisMenuCut, nil, nil, nil, 'laz_cut'); 'Cut',lisMenuCut, nil, nil, nil, 'laz_cut');
DesignerMenuCopy:=RegisterIDEMenuCommand(DesignerMenuSectionClipboard, DesignerMenuCopy:=RegisterIDEMenuCommand(DesignerMenuSectionClipboard,
@ -551,7 +551,8 @@ begin
'Select All',fdmSelectAll, nil, nil, nil, 'menu_select_all'); 'Select All',fdmSelectAll, nil, nil, nil, 'menu_select_all');
// register miscellaneous section // register miscellaneous section
DesignerMenuSectionMisc:=RegisterIDEMenuSection(DesignerMenuRoot, 'Miscellaneous section'); DesignerMenuSectionMisc:=RegisterIDEMenuSection(DesignerMenuRoot,
'Miscellaneous section');
DesignerMenuChangeClass:=RegisterIDEMenuCommand(DesignerMenuSectionMisc, DesignerMenuChangeClass:=RegisterIDEMenuCommand(DesignerMenuSectionMisc,
'Change class',lisChangeClass); 'Change class',lisChangeClass);
DesignerMenuChangeParent:=RegisterIDEMenuSection(DesignerMenuSectionMisc, DesignerMenuChangeParent:=RegisterIDEMenuSection(DesignerMenuSectionMisc,
@ -566,7 +567,8 @@ begin
'Center form', lisCenterForm); 'Center form', lisCenterForm);
// register options section // register options section
DesignerMenuSectionOptions:=RegisterIDEMenuSection(DesignerMenuRoot, 'Options section'); DesignerMenuSectionOptions:=RegisterIDEMenuSection(DesignerMenuRoot,
'Options section');
DesignerMenuSnapToGridOption:=RegisterIDEMenuCommand(DesignerMenuSectionOptions, DesignerMenuSnapToGridOption:=RegisterIDEMenuCommand(DesignerMenuSectionOptions,
'Snap to grid',fdmSnapToGridOption); 'Snap to grid',fdmSnapToGridOption);
DesignerMenuSnapToGuideLinesOption:=RegisterIDEMenuCommand(DesignerMenuSectionOptions, DesignerMenuSnapToGuideLinesOption:=RegisterIDEMenuCommand(DesignerMenuSectionOptions,
@ -1320,16 +1322,6 @@ begin
Modified; Modified;
end; end;
procedure TDesigner.DoUndo;
begin
; // ToDo: Implement Undo
end;
procedure TDesigner.DoRedo;
begin
; // ToDo: Implement Redo
end;
procedure TDesigner.GiveComponentsNames; procedure TDesigner.GiveComponentsNames;
var var
i: Integer; i: Integer;
@ -1419,32 +1411,28 @@ end;
procedure TDesigner.DoProcessCommand(Sender: TObject; var Command: word; procedure TDesigner.DoProcessCommand(Sender: TObject; var Command: word;
var Handled: boolean); var Handled: boolean);
begin begin
if Assigned(OnProcessCommand) and (Command <> ecNone) then if Assigned(OnProcessCommand) and (Command <> ecNone)
begin then begin
OnProcessCommand(Self,Command,Handled); OnProcessCommand(Self,Command,Handled);
Handled := Handled or (Command = ecNone); Handled := Handled or (Command = ecNone);
end; end;
if not Handled then
Handled := DoCommand(Command);
end;
function TDesigner.DoCommand(Command: word): boolean; if Handled then Exit;
begin
case Command of case Command of
ecDesignerSelectParent : SelectParentOfSelection; ecDesignerSelectParent : SelectParentOfSelection;
ecUndo : DoUndo; ecDesignerCopy : CopySelection;
ecRedo : DoRedo; ecDesignerCut : CutSelection;
ecCopy : CopySelection; ecDesignerPaste : PasteSelection([cpsfFindUniquePositions]);
ecCut : CutSelection;
ecPaste : PasteSelection([cpsfFindUniquePositions]);
ecDesignerMoveToFront : DoOrderMoveSelectionToFront; ecDesignerMoveToFront : DoOrderMoveSelectionToFront;
ecDesignerMoveToBack : DoOrderMoveSelectionToBack; ecDesignerMoveToBack : DoOrderMoveSelectionToBack;
ecDesignerForwardOne : DoOrderForwardSelectionOne; ecDesignerForwardOne : DoOrderForwardSelectionOne;
ecDesignerBackOne : DoOrderBackSelectionOne; ecDesignerBackOne : DoOrderBackSelectionOne;
else else
Exit(False); Exit;
end; end;
Result := True;
Handled := True;
end; end;
function TDesigner.NonVisualComponentLeftTop(AComponent: TComponent): TPoint; function TDesigner.NonVisualComponentLeftTop(AComponent: TComponent): TPoint;
@ -1689,7 +1677,9 @@ begin
Result := True; Result := True;
Sender.Dispatch(TheMessage); Sender.Dispatch(TheMessage);
if ControlSelection.SelectionForm = Form then if ControlSelection.SelectionForm = Form then
begin
ControlSelection.CheckForLCLChanges(True); ControlSelection.CheckForLCLChanges(True);
end;
end; end;
function TDesigner.MoveControl(Sender: TControl; TheMessage: TLMMove): Boolean; function TDesigner.MoveControl(Sender: TControl; TheMessage: TLMMove): Boolean;
@ -1982,6 +1972,7 @@ var
// modified // modified
Modified; Modified;
// set initial properties // set initial properties
if NewComponent is TControl then begin if NewComponent is TControl then begin
TControl(NewComponent).Visible:=true; TControl(NewComponent).Visible:=true;
@ -2368,7 +2359,8 @@ begin
if Mediator<>nil then if Mediator<>nil then
Mediator.KeyDown(Sender,TheMessage.CharCode,Shift); Mediator.KeyDown(Sender,TheMessage.CharCode,Shift);
Command := FTheFormEditor.TranslateKeyToDesignerCommand(TheMessage.CharCode, Shift); Command := FTheFormEditor.TranslateKeyToDesignerCommand(
TheMessage.CharCode, Shift);
//DebugLn(['TDesigner.KEYDOWN Command=',dbgs(Command),' ',TheMessage.CharCode,' ',dbgs(Shift)]); //DebugLn(['TDesigner.KEYDOWN Command=',dbgs(Command),' ',TheMessage.CharCode,' ',dbgs(Shift)]);
DoProcessCommand(Self, Command, Handled); DoProcessCommand(Self, Command, Handled);
//DebugLn(['TDesigner.KeyDown Command=',Command,' Handled=',Handled,' TheMessage.CharCode=',TheMessage.CharCode]); //DebugLn(['TDesigner.KeyDown Command=',Command,' Handled=',Handled,' TheMessage.CharCode=',TheMessage.CharCode]);
@ -2452,7 +2444,8 @@ begin
if (ControlSelection.LookupRootSelected) then begin if (ControlSelection.LookupRootSelected) then begin
if ControlSelection.Count>1 then if ControlSelection.Count>1 then
MessageDlg(lisInvalidDelete, MessageDlg(lisInvalidDelete,
lisTheRootComponentCanNotBeDeleted, mtInformation, [mbOk],0); lisTheRootComponentCanNotBeDeleted, mtInformation,
[mbOk],0);
exit; exit;
end; end;
// check if a selected component is inherited (can not be deleted) // check if a selected component is inherited (can not be deleted)
@ -2513,7 +2506,8 @@ begin
Form.Invalidate; Form.Invalidate;
end; end;
procedure TDesigner.DoDeletePersistent(APersistent: TPersistent; FreeIt: boolean); procedure TDesigner.DoDeletePersistent(APersistent: TPersistent;
FreeIt: boolean);
var var
Hook: TPropertyEditorHook; Hook: TPropertyEditorHook;
begin begin
@ -2543,7 +2537,8 @@ begin
// delete component // delete component
if APersistent is TComponent then if APersistent is TComponent then
TheFormEditor.DeleteComponent(TComponent(APersistent),FreeIt) TheFormEditor.DeleteComponent(TComponent(APersistent),FreeIt)
else if FreeIt then else
if FreeIt then
APersistent.Free; APersistent.Free;
// unmark component // unmark component
DeletingPersistent.Remove(APersistent); DeletingPersistent.Remove(APersistent);

View File

@ -596,6 +596,9 @@ begin
ecReportingBug: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]); ecReportingBug: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
// designer // designer
ecDesignerCopy : SetResult(VK_C,[ssCtrl],VK_Insert,[ssCtrl]);
ecDesignerCut : SetResult(VK_X,[ssCtrl],VK_Delete,[ssShift]);
ecDesignerPaste : SetResult(VK_V,[ssCtrl],VK_Insert,[ssShift]);
ecDesignerSelectParent: SetResult(VK_ESCAPE,[],VK_UNKNOWN,[]); ecDesignerSelectParent: SetResult(VK_ESCAPE,[],VK_UNKNOWN,[]);
ecDesignerMoveToFront : SetResult(VK_PRIOR,[ssShift],VK_UNKNOWN,[]); ecDesignerMoveToFront : SetResult(VK_PRIOR,[ssShift],VK_UNKNOWN,[]);
ecDesignerMoveToBack : SetResult(VK_NEXT,[ssShift],VK_UNKNOWN,[]); ecDesignerMoveToBack : SetResult(VK_NEXT,[ssShift],VK_UNKNOWN,[]);
@ -693,7 +696,7 @@ begin
case Command of case Command of
// moving // moving
ecWordLeft: SetResult(VK_A, [ssCtrl], VK_UNKNOWN, [], VK_LEFT, [ssCtrl], VK_UNKNOWN,[]); ecWordLeft:SetResult(VK_A, [ssCtrl], VK_UNKNOWN, [], VK_LEFT, [ssCtrl], VK_UNKNOWN,[]);
ecWordRight: SetResult(VK_D, [ssCtrl], VK_UNKNOWN, [], VK_RIGHT, [ssCtrl],VK_UNKNOWN,[]); ecWordRight: SetResult(VK_D, [ssCtrl], VK_UNKNOWN, [], VK_RIGHT, [ssCtrl],VK_UNKNOWN,[]);
ecLineStart: SetResult(VK_Q, [ssCtrl], VK_S, [], VK_HOME, [],VK_UNKNOWN,[]); ecLineStart: SetResult(VK_Q, [ssCtrl], VK_S, [], VK_HOME, [],VK_UNKNOWN,[]);
ecLineEnd: SetResult(VK_Q, [ssCtrl], VK_D, [], VK_END, [],VK_UNKNOWN,[]); ecLineEnd: SetResult(VK_Q, [ssCtrl], VK_D, [], VK_END, [],VK_UNKNOWN,[]);
@ -1030,6 +1033,9 @@ begin
ecReportingBug: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]); ecReportingBug: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
// designer // designer
ecDesignerCopy : SetResult(VK_C,[ssCtrl],VK_UNKNOWN,[],VK_Insert,[ssCtrl],VK_UNKNOWN,[]);
ecDesignerCut : SetResult(VK_X,[ssCtrl],VK_UNKNOWN,[],VK_Delete,[ssShift],VK_UNKNOWN,[]);
ecDesignerPaste : SetResult(VK_V,[ssCtrl],VK_UNKNOWN,[],VK_Insert,[ssShift],VK_UNKNOWN,[]);
ecDesignerSelectParent: SetResult(VK_ESCAPE,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]); ecDesignerSelectParent: SetResult(VK_ESCAPE,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecDesignerMoveToFront : SetResult(VK_PRIOR,[ssShift],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]); ecDesignerMoveToFront : SetResult(VK_PRIOR,[ssShift],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecDesignerMoveToBack : SetResult(VK_NEXT,[ssShift],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]); ecDesignerMoveToBack : SetResult(VK_NEXT,[ssShift],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
@ -1646,6 +1652,9 @@ begin
ecReportingBug: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]); ecReportingBug: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
// designer // designer
ecDesignerCopy : SetResult(VK_C,[ssMeta],VK_UNKNOWN,[]);
ecDesignerCut : SetResult(VK_X,[ssMeta],VK_UNKNOWN,[]);
ecDesignerPaste : SetResult(VK_V,[ssMeta],VK_UNKNOWN,[]);
ecDesignerSelectParent: SetResult(VK_ESCAPE,[],VK_UNKNOWN,[]); ecDesignerSelectParent: SetResult(VK_ESCAPE,[],VK_UNKNOWN,[]);
ecDesignerMoveToFront : SetResult(VK_PRIOR,[ssShift],VK_UNKNOWN,[]); ecDesignerMoveToFront : SetResult(VK_PRIOR,[ssShift],VK_UNKNOWN,[]);
ecDesignerMoveToBack : SetResult(VK_NEXT,[ssShift],VK_UNKNOWN,[]); ecDesignerMoveToBack : SetResult(VK_NEXT,[ssShift],VK_UNKNOWN,[]);
@ -2177,6 +2186,9 @@ begin
ecReportingBug : Result:= lisMenuReportingBug; ecReportingBug : Result:= lisMenuReportingBug;
// desginer // desginer
ecDesignerCopy : Result:= lisDsgCopyComponents;
ecDesignerCut : Result:= lisDsgCutComponents;
ecDesignerPaste : Result:= lisDsgPasteComponents;
ecDesignerSelectParent : Result:= lisDsgSelectParentComponent; ecDesignerSelectParent : Result:= lisDsgSelectParentComponent;
ecDesignerMoveToFront : Result:= lisDsgOrderMoveToFront; ecDesignerMoveToFront : Result:= lisDsgOrderMoveToFront;
ecDesignerMoveToBack : Result:= lisDsgOrderMoveToBack; ecDesignerMoveToBack : Result:= lisDsgOrderMoveToBack;
@ -2394,7 +2406,8 @@ begin
AddDefault(C, 'Move cursor left one page', srkmecPageLeft, ecPageLeft); AddDefault(C, 'Move cursor left one page', srkmecPageLeft, ecPageLeft);
AddDefault(C, 'Move cursor right one page', srkmecPageRight, ecPageRight); AddDefault(C, 'Move cursor right one page', srkmecPageRight, ecPageRight);
AddDefault(C, 'Move cursor to top of page', srkmecPageTop, ecPageTop); AddDefault(C, 'Move cursor to top of page', srkmecPageTop, ecPageTop);
AddDefault(C, 'Move cursor to bottom of page', srkmecPageBottom, ecPageBottom); AddDefault(C, 'Move cursor to bottom of page', srkmecPageBottom, ecPageBottom
);
AddDefault(C, 'Move cursor to absolute beginning', srkmecEditorTop, AddDefault(C, 'Move cursor to absolute beginning', srkmecEditorTop,
ecEditorTop); ecEditorTop);
AddDefault(C, 'Move cursor to absolute end', srkmecEditorBottom, AddDefault(C, 'Move cursor to absolute end', srkmecEditorBottom,
@ -2407,6 +2420,9 @@ begin
// selection // selection
C:=Categories[AddCategory('Selection',srkmCatSelection, C:=Categories[AddCategory('Selection',srkmCatSelection,
IDECmdScopeSrcEditOnly)]; IDECmdScopeSrcEditOnly)];
AddDefault(C, 'Copy selection to clipboard', srkmecCopy, ecCopy);
AddDefault(C, 'Cut selection to clipboard', srkmecCut, ecCut);
AddDefault(C, 'Paste clipboard to current position', srkmecPaste, ecPaste);
AddDefault(C, 'Normal selection mode', srkmecNormalSelect, ecNormalSelect); AddDefault(C, 'Normal selection mode', srkmecNormalSelect, ecNormalSelect);
AddDefault(C, 'Column selection mode', srkmecColumnSelect, ecColumnSelect); AddDefault(C, 'Column selection mode', srkmecColumnSelect, ecColumnSelect);
AddDefault(C, 'Line selection mode', srkmecLineSelect, ecLineSelect); AddDefault(C, 'Line selection mode', srkmecLineSelect, ecLineSelect);
@ -2419,10 +2435,12 @@ begin
AddDefault(C, 'Convert tabs to spaces in selection', AddDefault(C, 'Convert tabs to spaces in selection',
srkmecSelectionTabs2Spaces, ecSelectionTabs2Spaces); srkmecSelectionTabs2Spaces, ecSelectionTabs2Spaces);
AddDefault(C, 'Enclose selection', lisKMEncloseSelection, ecSelectionEnclose); AddDefault(C, 'Enclose selection', lisKMEncloseSelection, ecSelectionEnclose);
AddDefault(C, 'Comment selection', lisMenuCommentSelection, ecSelectionComment); AddDefault(C, 'Comment selection', lisMenuCommentSelection, ecSelectionComment
);
AddDefault(C, 'Uncomment selection', lisMenuUncommentSelection, AddDefault(C, 'Uncomment selection', lisMenuUncommentSelection,
ecSelectionUncomment); ecSelectionUncomment);
AddDefault(C, 'Toggle comment', lisMenuToggleComment, ecToggleComment); AddDefault(C, 'Toggle comment', lisMenuToggleComment, ecToggleComment
);
AddDefault(C, 'Sort selection', lisSortSelSortSelection, ecSelectionSort); AddDefault(C, 'Sort selection', lisSortSelSortSelection, ecSelectionSort);
AddDefault(C, 'Break Lines in selection', lisMenuBeakLinesInSelection, AddDefault(C, 'Break Lines in selection', lisMenuBeakLinesInSelection,
ecSelectionBreakLines); ecSelectionBreakLines);
@ -2493,21 +2511,25 @@ begin
AddDefault(C, 'Insert from Character Map', lisMenuInsertCharacter, AddDefault(C, 'Insert from Character Map', lisMenuInsertCharacter,
ecInsertCharacter); ecInsertCharacter);
AddDefault(C, 'Insert GPL notice', srkmecInsertGPLNotice, ecInsertGPLNotice); AddDefault(C, 'Insert GPL notice', srkmecInsertGPLNotice, ecInsertGPLNotice);
AddDefault(C, 'Insert LGPL notice', srkmecInsertLGPLNotice, ecInsertLGPLNotice); AddDefault(C, 'Insert LGPL notice', srkmecInsertLGPLNotice, ecInsertLGPLNotice
);
AddDefault(C, 'Insert modified LGPL notice', srkmecInsertModifiedLGPLNotice, AddDefault(C, 'Insert modified LGPL notice', srkmecInsertModifiedLGPLNotice,
ecInsertModifiedLGPLNotice); ecInsertModifiedLGPLNotice);
AddDefault(C, 'Insert username', lisKMInsertUsername, ecInsertUserName); AddDefault(C, 'Insert username', lisKMInsertUsername, ecInsertUserName);
AddDefault(C, 'Insert date and time', lisKMInsertDateAndTime, ecInsertDateTime); AddDefault(C, 'Insert date and time', lisKMInsertDateAndTime, ecInsertDateTime
);
AddDefault(C, 'Insert ChangeLog entry', srkmecInsertChangeLogEntry, AddDefault(C, 'Insert ChangeLog entry', srkmecInsertChangeLogEntry,
ecInsertChangeLogEntry); ecInsertChangeLogEntry);
AddDefault(C, 'Insert CVS keyword Author', srkmecInsertCVSAuthor, AddDefault(C, 'Insert CVS keyword Author', srkmecInsertCVSAuthor,
ecInsertCVSAuthor); ecInsertCVSAuthor);
AddDefault(C, 'Insert CVS keyword Date', srkmecInsertCVSDate, ecInsertCVSDate); AddDefault(C, 'Insert CVS keyword Date', srkmecInsertCVSDate, ecInsertCVSDate
);
AddDefault(C, 'Insert CVS keyword Header', srkmecInsertCVSHeader, AddDefault(C, 'Insert CVS keyword Header', srkmecInsertCVSHeader,
ecInsertCVSHeader); ecInsertCVSHeader);
AddDefault(C, 'Insert CVS keyword ID', srkmecInsertCVSID, ecInsertCVSID); AddDefault(C, 'Insert CVS keyword ID', srkmecInsertCVSID, ecInsertCVSID);
AddDefault(C, 'Insert CVS keyword Log', srkmecInsertCVSLog, ecInsertCVSLog); AddDefault(C, 'Insert CVS keyword Log', srkmecInsertCVSLog, ecInsertCVSLog);
AddDefault(C, 'Insert CVS keyword Name', srkmecInsertCVSName, ecInsertCVSName); AddDefault(C, 'Insert CVS keyword Name', srkmecInsertCVSName, ecInsertCVSName
);
AddDefault(C, 'Insert CVS keyword Revision', srkmecInsertCVSRevision, AddDefault(C, 'Insert CVS keyword Revision', srkmecInsertCVSRevision,
ecInsertCVSRevision); ; ecInsertCVSRevision); ;
AddDefault(C, 'Insert CVS keyword Source', srkmecInsertCVSSource, AddDefault(C, 'Insert CVS keyword Source', srkmecInsertCVSSource,
@ -2519,9 +2541,6 @@ begin
C:=Categories[AddCategory('CommandCommands',srkmCatCmdCmd,nil)]; C:=Categories[AddCategory('CommandCommands',srkmCatCmdCmd,nil)];
AddDefault(C, 'Undo', lisMenuUndo, ecUndo); AddDefault(C, 'Undo', lisMenuUndo, ecUndo);
AddDefault(C, 'Redo', lisMenuRedo, ecRedo); AddDefault(C, 'Redo', lisMenuRedo, ecRedo);
AddDefault(C, 'Copy selection to clipboard', srkmecCopy, ecCopy);
AddDefault(C, 'Cut selection to clipboard', srkmecCut, ecCut);
AddDefault(C, 'Paste clipboard to current position', srkmecPaste, ecPaste);
// search & replace // search & replace
C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace, C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace,
@ -2542,7 +2561,8 @@ begin
AddDefault(C, 'Jump forward', lisMenuJumpForward, ecJumpForward); AddDefault(C, 'Jump forward', lisMenuJumpForward, ecJumpForward);
AddDefault(C, 'Add jump point', srkmecAddJumpPoint, ecAddJumpPoint); AddDefault(C, 'Add jump point', srkmecAddJumpPoint, ecAddJumpPoint);
AddDefault(C, 'View jump history', lisKMViewJumpHistory, ecViewJumpHistory); AddDefault(C, 'View jump history', lisKMViewJumpHistory, ecViewJumpHistory);
AddDefault(C, 'Jump to next error', lisMenuJumpToNextError, ecJumpToNextError); AddDefault(C, 'Jump to next error', lisMenuJumpToNextError, ecJumpToNextError
);
AddDefault(C, 'Jump to previous error', lisMenuJumpToPrevError, AddDefault(C, 'Jump to previous error', lisMenuJumpToPrevError,
ecJumpToPrevError); ecJumpToPrevError);
AddDefault(C, 'Open file at cursor', srkmecOpenFileAtCursor, AddDefault(C, 'Open file at cursor', srkmecOpenFileAtCursor,
@ -2635,7 +2655,8 @@ begin
ecRemoveEmptyMethods); ecRemoveEmptyMethods);
AddDefault(C, 'Remove unused units', srkmecRemoveUnusedUnits, AddDefault(C, 'Remove unused units', srkmecRemoveUnusedUnits,
ecRemoveUnusedUnits); ecRemoveUnusedUnits);
AddDefault(C, 'Find overloads', srkmecFindOverloads, ecFindOverloads); AddDefault(C, 'Find overloads', srkmecFindOverloads,
ecFindOverloads);
// Template editing // Template editing
C:=Categories[AddCategory('Edit Template', srkmCatTemplateEdit, IDECmdScopeSrcEditOnlyTmplEdit)]; C:=Categories[AddCategory('Edit Template', srkmCatTemplateEdit, IDECmdScopeSrcEditOnlyTmplEdit)];
@ -2703,7 +2724,8 @@ begin
AddDefault(C, 'Go to next editor', srkmecNextEditor, ecNextEditor); AddDefault(C, 'Go to next editor', srkmecNextEditor, ecNextEditor);
AddDefault(C, 'Go to prior editor', srkmecPrevEditor, ecPrevEditor); AddDefault(C, 'Go to prior editor', srkmecPrevEditor, ecPrevEditor);
AddDefault(C, 'Add break point', srkmecToggleBreakPoint, ecToggleBreakPoint); AddDefault(C, 'Add break point', srkmecToggleBreakPoint, ecToggleBreakPoint);
AddDefault(C, 'Remove break point', srkmecRemoveBreakPoint, ecRemoveBreakPoint); AddDefault(C, 'Remove break point', srkmecRemoveBreakPoint, ecRemoveBreakPoint
);
AddDefault(C, 'Move editor left', srkmecMoveEditorLeft, ecMoveEditorLeft); AddDefault(C, 'Move editor left', srkmecMoveEditorLeft, ecMoveEditorLeft);
AddDefault(C, 'Move editor right', srkmecMoveEditorRight, ecMoveEditorRight); AddDefault(C, 'Move editor right', srkmecMoveEditorRight, ecMoveEditorRight);
AddDefault(C, 'Move editor leftmost', srkmecMoveEditorLeftmost, ecMoveEditorLeftmost); AddDefault(C, 'Move editor leftmost', srkmecMoveEditorLeftmost, ecMoveEditorLeftmost);
@ -2801,7 +2823,8 @@ begin
AddDefault(C, 'Save project', lisKMSaveProject, ecSaveProject); AddDefault(C, 'Save project', lisKMSaveProject, ecSaveProject);
AddDefault(C, 'Save project as', lisKMSaveProjectAs, ecSaveProjectAs); AddDefault(C, 'Save project as', lisKMSaveProjectAs, ecSaveProjectAs);
AddDefault(C, 'Publish project', lisKMPublishProject, ecPublishProject); AddDefault(C, 'Publish project', lisKMPublishProject, ecPublishProject);
AddDefault(C, 'Project Inspector', lisMenuProjectInspector, ecProjectInspector); AddDefault(C, 'Project Inspector', lisMenuProjectInspector, ecProjectInspector
);
AddDefault(C, 'Add active unit to project', lisKMAddActiveUnitToProject, AddDefault(C, 'Add active unit to project', lisKMAddActiveUnitToProject,
ecAddCurUnitToProj); ecAddCurUnitToProj);
AddDefault(C, 'Remove active unit from project', AddDefault(C, 'Remove active unit from project',
@ -2896,6 +2919,12 @@ begin
// designer - without menu items in the IDE bar (at least not directly) // designer - without menu items in the IDE bar (at least not directly)
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,IDECmdScopeDesignerOnly)]; C:=Categories[AddCategory('Designer',lisKeyCatDesigner,IDECmdScopeDesignerOnly)];
AddDefault(C, 'Copy selected Components to clipboard',
lisKMCopySelectedComponentsToClipboard, ecDesignerCopy);
AddDefault(C, 'Cut selected Components to clipboard',
lisKMCutSelectedComponentsToClipboard, ecDesignerCut);
AddDefault(C, 'Paste Components from clipboard',
lisKMPasteComponentsFromClipboard, ecDesignerPaste);
AddDefault(C, 'Select parent component', lisDsgSelectParentComponent, AddDefault(C, 'Select parent component', lisDsgSelectParentComponent,
ecDesignerSelectParent); ecDesignerSelectParent);
AddDefault(C, 'Move component to front', lisDsgOrderMoveToFront, AddDefault(C, 'Move component to front', lisDsgOrderMoveToFront,
@ -2904,8 +2933,8 @@ begin
ecDesignerMoveToBack); ecDesignerMoveToBack);
AddDefault(C, 'Move component one forward', lisDsgOrderForwardOne, AddDefault(C, 'Move component one forward', lisDsgOrderForwardOne,
ecDesignerForwardOne); ecDesignerForwardOne);
AddDefault(C, 'Move component one back', lisDsgOrderBackOne, AddDefault(C, 'Move component one back', lisDsgOrderBackOne, ecDesignerBackOne
ecDesignerBackOne); );
// object inspector - without menu items in the IDE bar (at least no direct) // object inspector - without menu items in the IDE bar (at least no direct)
C:=Categories[AddCategory('Object Inspector',lisKeyCatObjInspector, C:=Categories[AddCategory('Object Inspector',lisKeyCatObjInspector,

View File

@ -16613,27 +16613,27 @@ end;
procedure TMainIDE.mnuEditCopyClicked(Sender: TObject); procedure TMainIDE.mnuEditCopyClicked(Sender: TObject);
begin begin
DoCommand(ecCopy); DoSourceEditorCommand(ecCopy);
end; end;
procedure TMainIDE.mnuEditCutClicked(Sender: TObject); procedure TMainIDE.mnuEditCutClicked(Sender: TObject);
begin begin
DoCommand(ecCut); DoSourceEditorCommand(ecCut);
end; end;
procedure TMainIDE.mnuEditPasteClicked(Sender: TObject); procedure TMainIDE.mnuEditPasteClicked(Sender: TObject);
begin begin
DoCommand(ecPaste); DoSourceEditorCommand(ecPaste);
end; end;
procedure TMainIDE.mnuEditRedoClicked(Sender: TObject); procedure TMainIDE.mnuEditRedoClicked(Sender: TObject);
begin begin
DoCommand(ecRedo); DoSourceEditorCommand(ecRedo);
end; end;
procedure TMainIDE.mnuEditUndoClicked(Sender: TObject); procedure TMainIDE.mnuEditUndoClicked(Sender: TObject);
begin begin
DoCommand(ecUndo); DoSourceEditorCommand(ecUndo);
end; end;
procedure TMainIDE.mnuEditIndentBlockClicked(Sender: TObject); procedure TMainIDE.mnuEditIndentBlockClicked(Sender: TObject);
@ -16837,6 +16837,7 @@ var
ActiveUnitInfo: TUnitInfo; ActiveUnitInfo: TUnitInfo;
AForm: TCustomForm; AForm: TCustomForm;
begin begin
// todo: if focus is really on a designer or the source editor
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo); GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
case FDisplayState of case FDisplayState of
dsSource: // send command to source editor dsSource: // send command to source editor
@ -16848,8 +16849,8 @@ begin
GetUnitWithForm(FLastFormActivated, ActiveSourceEditor, ActiveUnitInfo); GetUnitWithForm(FLastFormActivated, ActiveSourceEditor, ActiveUnitInfo);
if Assigned(ActiveUnitInfo) then begin if Assigned(ActiveUnitInfo) then begin
AForm:=GetDesignerFormOfSource(ActiveUnitInfo,False); AForm:=GetDesignerFormOfSource(ActiveUnitInfo,False);
if (AForm<>nil) and (AForm.Designer<>nil) then
TDesigner(AForm.Designer).DoCommand(ACommand); // ToDo: call designer
end; end;
end; end;
end; end;
@ -16865,7 +16866,8 @@ begin
CurFocusControl:=GetParentForm(CurFocusControl); CurFocusControl:=GetParentForm(CurFocusControl);
if (CurFocusControl<>MainIDEBar) and not(CurFocusControl is TSourceNotebook) then if (CurFocusControl<>MainIDEBar) and not(CurFocusControl is TSourceNotebook) then
begin begin
// MainIDEBar.mnuMainMenu.ShortcutHandled := false; // Shortcut not handled yet // continue processing shortcut, not handled yet
MainIDEBar.mnuMainMenu.ShortcutHandled := false;
exit; exit;
end; end;
end; end;

View File

@ -149,7 +149,7 @@ type
out ActiveSourceEditor: TSourceEditorInterface; out ActiveSourceEditor: TSourceEditorInterface;
out ActiveUnitInfo: TUnitInfo); virtual; abstract; out ActiveUnitInfo: TUnitInfo); virtual; abstract;
procedure DoCommand(ACommand: integer); virtual; abstract; procedure DoCommand(EditorCommand: integer); virtual; abstract;
procedure GetIDEFileState(Sender: TObject; const AFilename: string; procedure GetIDEFileState(Sender: TObject; const AFilename: string;
NeededFlags: TIDEFileStateFlags; NeededFlags: TIDEFileStateFlags;

View File

@ -298,6 +298,9 @@ const
ecReportingBug = ecFirstLazarus + 905; ecReportingBug = ecFirstLazarus + 905;
// designer // designer
ecDesignerCopy = ecFirstLazarus + 1000;
ecDesignerCut = ecFirstLazarus + 1001;
ecDesignerPaste = ecFirstLazarus + 1002;
ecDesignerSelectParent = ecFirstLazarus + 1003; ecDesignerSelectParent = ecFirstLazarus + 1003;
ecDesignerMoveToFront = ecFirstLazarus + 1004; ecDesignerMoveToFront = ecFirstLazarus + 1004;
ecDesignerMoveToBack = ecFirstLazarus + 1005; ecDesignerMoveToBack = ecFirstLazarus + 1005;