mirror of https://gitlab.com/basile.b/dexed.git
add editor commands PreviousChangedArea & NextChangedArea
This commit is contained in:
parent
0f385033a7
commit
a5992c7a8e
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -13,7 +13,7 @@
|
||||||
<DpiAware Value="True"/>
|
<DpiAware Value="True"/>
|
||||||
</XPManifest>
|
</XPManifest>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
<Resources Count="83">
|
<Resources Count="84">
|
||||||
<Resource_0 FileName="../icons/window/layout_add.png" Type="RCDATA" ResourceName="LAYOUT_ADD"/>
|
<Resource_0 FileName="../icons/window/layout_add.png" Type="RCDATA" ResourceName="LAYOUT_ADD"/>
|
||||||
<Resource_1 FileName="../icons/window/layout.png" Type="RCDATA" ResourceName="LAYOUT"/>
|
<Resource_1 FileName="../icons/window/layout.png" Type="RCDATA" ResourceName="LAYOUT"/>
|
||||||
<Resource_2 FileName="../icons/window/application_go.png" Type="RCDATA" ResourceName="APPLICATION_GO"/>
|
<Resource_2 FileName="../icons/window/application_go.png" Type="RCDATA" ResourceName="APPLICATION_GO"/>
|
||||||
|
@ -97,6 +97,7 @@
|
||||||
<Resource_80 FileName="../icons/arrow/arrow_redo.png" Type="RCDATA" ResourceName="ARROW_REDO"/>
|
<Resource_80 FileName="../icons/arrow/arrow_redo.png" Type="RCDATA" ResourceName="ARROW_REDO"/>
|
||||||
<Resource_81 FileName="../icons/arrow/arrow_pen.png" Type="RCDATA" ResourceName="ARROW_PEN"/>
|
<Resource_81 FileName="../icons/arrow/arrow_pen.png" Type="RCDATA" ResourceName="ARROW_PEN"/>
|
||||||
<Resource_82 FileName="../icons/arrow/arrow_down.png" Type="RCDATA" ResourceName="ARROW_DOWN"/>
|
<Resource_82 FileName="../icons/arrow/arrow_down.png" Type="RCDATA" ResourceName="ARROW_DOWN"/>
|
||||||
|
<Resource_83 FileName="../icons/other/case.png" Type="RCDATA" ResourceName="CASE"/>
|
||||||
</Resources>
|
</Resources>
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -12,14 +12,14 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
ClientHeight = 434
|
ClientHeight = 434
|
||||||
ClientWidth = 465
|
ClientWidth = 465
|
||||||
inherited Content: TPanel
|
inherited Content: TPanel
|
||||||
Height = 434
|
Height = 398
|
||||||
Width = 465
|
Width = 465
|
||||||
ClientHeight = 434
|
ClientHeight = 398
|
||||||
ClientWidth = 465
|
ClientWidth = 465
|
||||||
object editorStatus: TStatusBar[0]
|
object editorStatus: TStatusBar[0]
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 412
|
Top = 376
|
||||||
Width = 465
|
Width = 465
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
BorderSpacing.Bottom = 2
|
BorderSpacing.Bottom = 2
|
||||||
|
@ -45,6 +45,9 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
UseSystemFont = False
|
UseSystemFont = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
inherited toolbar: TCEToolBar
|
||||||
|
Width = 457
|
||||||
|
end
|
||||||
end
|
end
|
||||||
inherited contextMenu: TPopupMenu
|
inherited contextMenu: TPopupMenu
|
||||||
left = 24
|
left = 24
|
||||||
|
@ -86,6 +89,9 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
Caption = 'Redo'
|
Caption = 'Redo'
|
||||||
OnClick = mnuedRedoClick
|
OnClick = mnuedRedoClick
|
||||||
end
|
end
|
||||||
|
object MenuItem11: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
object mnuedPrev: TMenuItem
|
object mnuedPrev: TMenuItem
|
||||||
Caption = 'Previous location'
|
Caption = 'Previous location'
|
||||||
OnClick = mnuedPrevClick
|
OnClick = mnuedPrevClick
|
||||||
|
@ -94,6 +100,28 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
Caption = 'Next location'
|
Caption = 'Next location'
|
||||||
OnClick = mnuedNextClick
|
OnClick = mnuedNextClick
|
||||||
end
|
end
|
||||||
|
object MenuItem10: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object mnuedPrevCarea: TMenuItem
|
||||||
|
Caption = 'Previous changed area'
|
||||||
|
OnClick = mnuedPrevCareaClick
|
||||||
|
end
|
||||||
|
object mnuedNextCarea: TMenuItem
|
||||||
|
Caption = 'Next changed area'
|
||||||
|
OnClick = mnuedNextCareaClick
|
||||||
|
end
|
||||||
|
object MenuItem9: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object mnuedUpcase: TMenuItem
|
||||||
|
Caption = 'Upper case selection'
|
||||||
|
OnClick = mnuedUpcaseClick
|
||||||
|
end
|
||||||
|
object mnuedLowcase: TMenuItem
|
||||||
|
Caption = 'Lower case selection'
|
||||||
|
OnClick = mnuedLowcaseClick
|
||||||
|
end
|
||||||
object MenuItem7: TMenuItem
|
object MenuItem7: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ uses
|
||||||
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs,
|
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs,
|
||||||
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs,
|
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs,
|
||||||
ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer,
|
ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer,
|
||||||
ce_sharedres, ce_controls, ce_writableComponent;
|
ce_sharedres, ce_controls, ce_writableComponent, ce_dsgncontrols;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -53,11 +53,18 @@ type
|
||||||
|
|
||||||
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEMultiDocHandler, ICEProjectObserver)
|
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEMultiDocHandler, ICEProjectObserver)
|
||||||
MenuItem1: TMenuItem;
|
MenuItem1: TMenuItem;
|
||||||
|
MenuItem10: TMenuItem;
|
||||||
|
MenuItem11: TMenuItem;
|
||||||
|
mnuedNextCarea: TMenuItem;
|
||||||
|
mnuedPrevCarea: TMenuItem;
|
||||||
|
mnuedLowcase: TMenuItem;
|
||||||
|
mnuedUpcase: TMenuItem;
|
||||||
MenuItem2: TMenuItem;
|
MenuItem2: TMenuItem;
|
||||||
MenuItem3: TMenuItem;
|
MenuItem3: TMenuItem;
|
||||||
MenuItem5: TMenuItem;
|
MenuItem5: TMenuItem;
|
||||||
MenuItem6: TMenuItem;
|
MenuItem6: TMenuItem;
|
||||||
MenuItem8: TMenuItem;
|
MenuItem8: TMenuItem;
|
||||||
|
MenuItem9: TMenuItem;
|
||||||
mnuedRename: TMenuItem;
|
mnuedRename: TMenuItem;
|
||||||
mnuedInvAllNone: TMenuItem;
|
mnuedInvAllNone: TMenuItem;
|
||||||
mnuedComm: TMenuItem;
|
mnuedComm: TMenuItem;
|
||||||
|
@ -76,6 +83,10 @@ type
|
||||||
macRecorder: TSynMacroRecorder;
|
macRecorder: TSynMacroRecorder;
|
||||||
editorStatus: TStatusBar;
|
editorStatus: TStatusBar;
|
||||||
mnuEditor: TPopupMenu;
|
mnuEditor: TPopupMenu;
|
||||||
|
procedure mnuedNextCareaClick(Sender: TObject);
|
||||||
|
procedure mnuedPrevCareaClick(Sender: TObject);
|
||||||
|
procedure mnuedLowcaseClick(Sender: TObject);
|
||||||
|
procedure mnuedUpcaseClick(Sender: TObject);
|
||||||
procedure MenuItem5Click(Sender: TObject);
|
procedure MenuItem5Click(Sender: TObject);
|
||||||
procedure MenuItem6Click(Sender: TObject);
|
procedure MenuItem6Click(Sender: TObject);
|
||||||
procedure MenuItem8Click(Sender: TObject);
|
procedure MenuItem8Click(Sender: TObject);
|
||||||
|
@ -299,6 +310,10 @@ begin
|
||||||
AssignPng(mnuedNext.Bitmap, 'GO_NEXT');
|
AssignPng(mnuedNext.Bitmap, 'GO_NEXT');
|
||||||
AssignPng(mnuedPrev.Bitmap, 'GO_PREVIOUS');
|
AssignPng(mnuedPrev.Bitmap, 'GO_PREVIOUS');
|
||||||
AssignPng(mnuedRename.Bitmap, 'PENCIL');
|
AssignPng(mnuedRename.Bitmap, 'PENCIL');
|
||||||
|
AssignPng(mnuedUpcase.Bitmap, 'CASE');
|
||||||
|
AssignPng(mnuedLowcase.Bitmap, 'CASE');
|
||||||
|
AssignPng(mnuedNextCarea.Bitmap, 'GO_NEXT');
|
||||||
|
AssignPng(mnuedPrevCarea.Bitmap, 'GO_PREVIOUS');
|
||||||
//
|
//
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
EntitiesConnector.addSingleService(self);
|
EntitiesConnector.addSingleService(self);
|
||||||
|
@ -814,6 +829,31 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.mnuedUpcaseClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
//TODO-ceditor: case-related commands are not implemented in synedit
|
||||||
|
if fDoc.isNotNil then
|
||||||
|
fDoc.ExecuteCommand(ecLowerCaseBlock, #0, nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.mnuedLowcaseClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if fDoc.isNotNil then
|
||||||
|
fDoc.ExecuteCommand(ecUpperCaseBlock, #0, nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.mnuedNextCareaClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if fDoc.isNotNil then
|
||||||
|
fDoc.nextChangedArea;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.mnuedPrevCareaClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if fDoc.isNotNil then
|
||||||
|
fDoc.previousChangedArea;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.MenuItem8Click(Sender: TObject);
|
procedure TCEEditorWidget.MenuItem8Click(Sender: TObject);
|
||||||
var
|
var
|
||||||
str: TStringList;
|
str: TStringList;
|
||||||
|
|
|
@ -313,6 +313,8 @@ begin
|
||||||
fBtns[amcMisc]:= btnSelMisc;
|
fBtns[amcMisc]:= btnSelMisc;
|
||||||
fBtns[amcProj]:= btnSelProj;
|
fBtns[amcProj]:= btnSelProj;
|
||||||
//
|
//
|
||||||
|
// reminder: a tollbar button can be used here because it would have the
|
||||||
|
// same size as the buttons used to select a category.
|
||||||
btnClearCat.OnClick := @actClearCurCatExecute;
|
btnClearCat.OnClick := @actClearCurCatExecute;
|
||||||
AssignPng(btnClearCat, 'CLEAN');
|
AssignPng(btnClearCat, 'CLEAN');
|
||||||
//
|
//
|
||||||
|
|
|
@ -175,6 +175,7 @@ type
|
||||||
procedure showCallTips(const tips: string);
|
procedure showCallTips(const tips: string);
|
||||||
function lexCanCloseBrace: boolean;
|
function lexCanCloseBrace: boolean;
|
||||||
procedure handleStatusChanged(Sender: TObject; Changes: TSynStatusChanges);
|
procedure handleStatusChanged(Sender: TObject; Changes: TSynStatusChanges);
|
||||||
|
procedure gotoToChangedArea(next: boolean);
|
||||||
protected
|
protected
|
||||||
procedure DoEnter; override;
|
procedure DoEnter; override;
|
||||||
procedure DoExit; override;
|
procedure DoExit; override;
|
||||||
|
@ -211,6 +212,8 @@ type
|
||||||
procedure showDDocs;
|
procedure showDDocs;
|
||||||
procedure hideDDocs;
|
procedure hideDDocs;
|
||||||
procedure ShowPhobosDoc;
|
procedure ShowPhobosDoc;
|
||||||
|
procedure nextChangedArea;
|
||||||
|
procedure previousChangedArea;
|
||||||
procedure copy;
|
procedure copy;
|
||||||
//
|
//
|
||||||
function breakPointsCount: integer;
|
function breakPointsCount: integer;
|
||||||
|
@ -263,6 +266,8 @@ const
|
||||||
ecRenameIdentifier = ecUserFirst + 12;
|
ecRenameIdentifier = ecUserFirst + 12;
|
||||||
ecCommentIdentifier = ecUserFirst + 13;
|
ecCommentIdentifier = ecUserFirst + 13;
|
||||||
ecShowPhobosDoc = ecUserFirst + 14;
|
ecShowPhobosDoc = ecUserFirst + 14;
|
||||||
|
ecPreviousChangedArea = ecUserFirst + 15;
|
||||||
|
ecNextChangedArea = ecUserFirst + 16;
|
||||||
|
|
||||||
var
|
var
|
||||||
D2Syn: TSynD2Syn; // used as model to set the options when no editor exists.
|
D2Syn: TSynD2Syn; // used as model to set the options when no editor exists.
|
||||||
|
@ -753,6 +758,8 @@ begin
|
||||||
AddKey(ecRenameIdentifier, VK_F2, [], 0, []);
|
AddKey(ecRenameIdentifier, VK_F2, [], 0, []);
|
||||||
AddKey(ecCommentIdentifier, 0, [], 0, []);
|
AddKey(ecCommentIdentifier, 0, [], 0, []);
|
||||||
AddKey(ecShowPhobosDoc, VK_F1, [], 0, []);
|
AddKey(ecShowPhobosDoc, VK_F1, [], 0, []);
|
||||||
|
AddKey(ecPreviousChangedArea, VK_UP, [ssAlt], 0, []);
|
||||||
|
AddKey(ecNextChangedArea, VK_DOWN, [ssAlt], 0, []);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -773,6 +780,8 @@ begin
|
||||||
'ecRenameIdentifier': begin Int := ecRenameIdentifier; exit(true); end;
|
'ecRenameIdentifier': begin Int := ecRenameIdentifier; exit(true); end;
|
||||||
'ecCommentIdentifier': begin Int := ecCommentIdentifier; exit(true); end;
|
'ecCommentIdentifier': begin Int := ecCommentIdentifier; exit(true); end;
|
||||||
'ecShowPhobosDoc': begin Int := ecShowPhobosDoc; exit(true); end;
|
'ecShowPhobosDoc': begin Int := ecShowPhobosDoc; exit(true); end;
|
||||||
|
'ecNextChangedArea': begin Int := ecNextChangedArea; exit(true); end;
|
||||||
|
'ecPreviousChangedArea':begin Int := ecPreviousChangedArea; exit(true); end;
|
||||||
else exit(false);
|
else exit(false);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -794,6 +803,8 @@ begin
|
||||||
ecRenameIdentifier: begin Ident := 'ecRenameIdentifier'; exit(true); end;
|
ecRenameIdentifier: begin Ident := 'ecRenameIdentifier'; exit(true); end;
|
||||||
ecCommentIdentifier: begin Ident := 'ecCommentIdentifier'; exit(true); end;
|
ecCommentIdentifier: begin Ident := 'ecCommentIdentifier'; exit(true); end;
|
||||||
ecShowPhobosDoc: begin Ident := 'ecShowPhobosDoc'; exit(true); end;
|
ecShowPhobosDoc: begin Ident := 'ecShowPhobosDoc'; exit(true); end;
|
||||||
|
ecNextChangedArea: begin Ident := 'ecNextChangedArea'; exit(true); end;
|
||||||
|
ecPreviousChangedArea:begin Ident := 'ecPreviousChangedArea'; exit(true); end;
|
||||||
else exit(false);
|
else exit(false);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -843,6 +854,10 @@ begin
|
||||||
commentIdentifier;
|
commentIdentifier;
|
||||||
ecShowPhobosDoc:
|
ecShowPhobosDoc:
|
||||||
ShowPhobosDoc;
|
ShowPhobosDoc;
|
||||||
|
ecNextChangedArea:
|
||||||
|
gotoToChangedArea(true);
|
||||||
|
ecPreviousChangedArea:
|
||||||
|
gotoToChangedArea(false);
|
||||||
end;
|
end;
|
||||||
if fOverrideColMode and not SelAvail then
|
if fOverrideColMode and not SelAvail then
|
||||||
begin
|
begin
|
||||||
|
@ -1223,6 +1238,56 @@ begin
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCESynMemo.nextChangedArea;
|
||||||
|
begin
|
||||||
|
gotoToChangedArea(true);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCESynMemo.previousChangedArea;
|
||||||
|
begin
|
||||||
|
gotoToChangedArea(false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCESynMemo.gotoToChangedArea(next: boolean);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
s: TSynLineState;
|
||||||
|
d: integer;
|
||||||
|
b: integer = 0;
|
||||||
|
p: TPoint;
|
||||||
|
begin
|
||||||
|
i := CaretY - 1;
|
||||||
|
s := GetLineState(i);
|
||||||
|
case next of
|
||||||
|
true: begin d := 1; b := lines.count-1; end;
|
||||||
|
false:d := -1;
|
||||||
|
end;
|
||||||
|
if i = b then
|
||||||
|
exit;
|
||||||
|
// exit the current area if it's modified
|
||||||
|
while s <> slsNone do
|
||||||
|
begin
|
||||||
|
s := GetLineState(i);
|
||||||
|
if i = b then
|
||||||
|
exit;
|
||||||
|
i += d;
|
||||||
|
end;
|
||||||
|
// find next modified area
|
||||||
|
while s = slsNone do
|
||||||
|
begin
|
||||||
|
s := GetLineState(i);
|
||||||
|
if i = b then
|
||||||
|
break;
|
||||||
|
i += d;
|
||||||
|
end;
|
||||||
|
// goto area beg/end
|
||||||
|
if (s <> slsNone) and (i <> CaretY + 1) then
|
||||||
|
begin
|
||||||
|
p.X:= 1;
|
||||||
|
p.Y:= i + 1 - d;
|
||||||
|
ExecuteCommand(ecGotoXY, #0, @p);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION DDoc & CallTip --------------------------------------------------------}
|
{$REGION DDoc & CallTip --------------------------------------------------------}
|
||||||
|
|
Loading…
Reference in New Issue