mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Editor - Word wrap option (fixes #2886)
This commit is contained in:
parent
b05b79bc9a
commit
56098e1312
4 changed files with 84 additions and 2 deletions
|
|
@ -862,6 +862,21 @@ object frmEditor: TfrmEditor
|
|||
end
|
||||
end
|
||||
end
|
||||
object miView: TMenuItem
|
||||
Caption = '&View'
|
||||
object miZoomIn: TMenuItem
|
||||
Action = actZoomIn
|
||||
end
|
||||
object miZoomOut: TMenuItem
|
||||
Action = actZoomOut
|
||||
end
|
||||
object miSeparator3: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object miWordWrap: TMenuItem
|
||||
Action = actWordWrap
|
||||
end
|
||||
end
|
||||
object miEncoding: TMenuItem
|
||||
Caption = 'En&coding'
|
||||
object miEncodingIn: TMenuItem
|
||||
|
|
@ -883,7 +898,7 @@ object frmEditor: TfrmEditor
|
|||
end
|
||||
object ActListEdit: TActionList
|
||||
Images = dmComData.ilEditorImages
|
||||
Left = 112
|
||||
Left = 120
|
||||
Top = 32
|
||||
object actAbout: TAction
|
||||
Category = 'Help'
|
||||
|
|
@ -1072,13 +1087,20 @@ object frmEditor: TfrmEditor
|
|||
OnExecute = actExecute
|
||||
end
|
||||
object actZoomIn: TAction
|
||||
Category = 'View'
|
||||
Caption = 'Zoom In'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actZoomOut: TAction
|
||||
Category = 'View'
|
||||
Caption = 'Zoom Out'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actWordWrap: TAction
|
||||
Category = 'View'
|
||||
Caption = '&Word wrap'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
end
|
||||
object pmContextMenu: TPopupMenu
|
||||
Images = dmComData.ilEditorImages
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
{"hash":2805797,"name":"tfrmeditor.mifile.caption","sourcebytes":[38,70,105,108,101],"value":"&File"},
|
||||
{"hash":2800388,"name":"tfrmeditor.miedit.caption","sourcebytes":[38,69,100,105,116],"value":"&Edit"},
|
||||
{"hash":97085973,"name":"tfrmeditor.milineendtype.caption","sourcebytes":[69,110,100,32,79,102,32,76,105,110,101],"value":"End Of Line"},
|
||||
{"hash":2871239,"name":"tfrmeditor.miview.caption","sourcebytes":[38,86,105,101,119],"value":"&View"},
|
||||
{"hash":212198471,"name":"tfrmeditor.miencoding.caption","sourcebytes":[69,110,38,99,111,100,105,110,103],"value":"En&coding"},
|
||||
{"hash":107742931,"name":"tfrmeditor.miencodingin.caption","sourcebytes":[79,112,101,110,32,97,115],"value":"Open as"},
|
||||
{"hash":160200403,"name":"tfrmeditor.miencodingout.caption","sourcebytes":[83,97,118,101,32,97,115],"value":"Save as"},
|
||||
|
|
@ -55,5 +56,6 @@
|
|||
{"hash":97034739,"name":"tfrmeditor.acteditfindprevious.caption","sourcebytes":[70,105,110,100,32,112,114,101,118,105,111,117,115],"value":"Find previous"},
|
||||
{"hash":93074804,"name":"tfrmeditor.actfilereload.caption","sourcebytes":[82,101,108,111,97,100],"value":"Reload"},
|
||||
{"hash":23458974,"name":"tfrmeditor.actzoomin.caption","sourcebytes":[90,111,111,109,32,73,110],"value":"Zoom In"},
|
||||
{"hash":106909908,"name":"tfrmeditor.actzoomout.caption","sourcebytes":[90,111,111,109,32,79,117,116],"value":"Zoom Out"}
|
||||
{"hash":106909908,"name":"tfrmeditor.actzoomout.caption","sourcebytes":[90,111,111,109,32,79,117,116],"value":"Zoom Out"},
|
||||
{"hash":140859104,"name":"tfrmeditor.actwordwrap.caption","sourcebytes":[38,87,111,114,100,32,119,114,97,112],"value":"&Word wrap"}
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ type
|
|||
actEditFindPrevious: TAction;
|
||||
actFileReload: TAction;
|
||||
actEditTimeDate: TAction;
|
||||
actWordWrap: TAction;
|
||||
actZoomOut: TAction;
|
||||
actZoomIn: TAction;
|
||||
ilBookmarks: TImageList;
|
||||
|
|
@ -73,6 +74,10 @@ type
|
|||
actFileNew: TAction;
|
||||
actFileExit: TAction;
|
||||
MenuItem1: TMenuItem;
|
||||
miWordWrap: TMenuItem;
|
||||
miZoomOut: TMenuItem;
|
||||
miZoomIn: TMenuItem;
|
||||
miView: TMenuItem;
|
||||
miFileReload: TMenuItem;
|
||||
miFindPrevious: TMenuItem;
|
||||
miGotoLine: TMenuItem;
|
||||
|
|
@ -116,6 +121,7 @@ type
|
|||
miReplace: TMenuItem;
|
||||
Help1: TMenuItem;
|
||||
miAbout: TMenuItem;
|
||||
miSeparator3: TMenuItem;
|
||||
StatusBar: TStatusBar;
|
||||
Editor: TSynEdit;
|
||||
miHighlight: TMenuItem;
|
||||
|
|
@ -168,6 +174,9 @@ type
|
|||
FElevate: TDuplicates;
|
||||
FCommands: TFormCommands;
|
||||
FMultiCaret: TSynPluginMultiCaret;
|
||||
{$if lcl_fullversion >= 4990000}
|
||||
FSynEditWrap: TLazSynEditPlugin;
|
||||
{$endif}
|
||||
|
||||
property Commands: TFormCommands read FCommands implements IFormCommands;
|
||||
|
||||
|
|
@ -236,6 +245,7 @@ type
|
|||
procedure cm_EditRplc(const {%H-}Params:array of string);
|
||||
procedure cm_ZoomIn(const {%H-}Params: array of string);
|
||||
procedure cm_ZoomOut(const {%H-}Params: array of string);
|
||||
procedure cm_WordWrap(const {%H-}Params: array of string);
|
||||
end;
|
||||
|
||||
procedure ShowEditor(const sFileName: String; WaitData: TWaitData = nil);
|
||||
|
|
@ -252,6 +262,9 @@ uses
|
|||
uLng, uShowMsg, uGlobs, fOptions, DCClassesUtf8, uAdministrator, uHighlighters,
|
||||
uOSUtils, uConvEncoding, fOptionsToolsEditor, uDCUtils, uClipboard, uFindFiles,
|
||||
DCOSUtils
|
||||
{$if lcl_fullversion >= 4990000}
|
||||
, SynEditWrappedView
|
||||
{$endif}
|
||||
{$IFDEF DARWIN}
|
||||
, uDarwinApplication, uEarlyConfig
|
||||
{$ENDIF}
|
||||
|
|
@ -387,6 +400,21 @@ begin
|
|||
Editor.RightEdge := gEditorSynEditRightEdge;
|
||||
Editor.BlockIndent := gEditorSynEditBlockIndent;
|
||||
Editor.VisibleSpecialChars:= gEditorSynEditSpecialChars;
|
||||
{$if lcl_fullversion >= 4990000}
|
||||
if gEditorWordWrap then
|
||||
begin
|
||||
if not (eoScrollPastEoL in gEditorSynEditOptions) then
|
||||
begin
|
||||
Editor.ScrollBars:= ssVertical;
|
||||
end;
|
||||
FSynEditWrap:= TLazSynEditLineWrapPlugin.Create(Editor)
|
||||
end;
|
||||
actWordWrap.Checked := gEditorWordWrap
|
||||
{$else}
|
||||
actWordWrap.Enabled:= False;
|
||||
actWordWrap.Visible:= False;
|
||||
miSeparator3.Visible:= False;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TfrmEditor.actExecute(Sender: TObject);
|
||||
|
|
@ -1122,6 +1150,32 @@ begin
|
|||
self.DoZoomOut;
|
||||
end;
|
||||
|
||||
procedure TfrmEditor.cm_WordWrap(const Params: array of string);
|
||||
{$if lcl_fullversion >= 4990000}
|
||||
var
|
||||
TopLine: Integer;
|
||||
{$endif}
|
||||
begin
|
||||
gEditorWordWrap:= not gEditorWordWrap;
|
||||
actWordWrap.Checked:= gEditorWordWrap;
|
||||
{$if lcl_fullversion >= 4990000}
|
||||
TopLine:= Editor.TopLine;
|
||||
if gEditorWordWrap then
|
||||
begin
|
||||
if not (eoScrollPastEoL in Editor.Options) then
|
||||
begin
|
||||
Editor.ScrollBars:= ssVertical;
|
||||
end;
|
||||
FSynEditWrap:= TLazSynEditLineWrapPlugin.Create(Editor)
|
||||
end
|
||||
else begin
|
||||
FreeAndNil(FSynEditWrap);
|
||||
Editor.ScrollBars:= ssBoth;
|
||||
end;
|
||||
Editor.TopLine:= TopLine;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TfrmEditor.frmEditorClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -665,6 +665,7 @@ var
|
|||
gEditorSynEditRightEdge,
|
||||
gEditorSynEditBlockIndent: Integer;
|
||||
gEditorFindWordAtCursor: Boolean;
|
||||
gEditorWordWrap: Boolean;
|
||||
|
||||
{ Differ }
|
||||
gDifferIgnoreCase,
|
||||
|
|
@ -2262,6 +2263,7 @@ begin
|
|||
gEditorSynEditRightEdge := 80;
|
||||
gEditorSynEditBlockIndent := 2;
|
||||
gEditorFindWordAtCursor := True;
|
||||
gEditorWordWrap:= False;
|
||||
|
||||
{ Differ }
|
||||
gDifferIgnoreCase := False;
|
||||
|
|
@ -3341,6 +3343,7 @@ begin
|
|||
gEditorSynEditRightEdge := GetValue(Node, 'SynEditRightEdge', gEditorSynEditRightEdge);
|
||||
gEditorSynEditBlockIndent := GetValue(Node, 'SynEditBlockIndent', gEditorSynEditBlockIndent);
|
||||
gEditorFindWordAtCursor := GetValue(Node, 'FindWordAtCursor', gEditorFindWordAtCursor);
|
||||
gEditorWordWrap := GetValue(Node, 'WordWrap', gEditorWordWrap);
|
||||
end;
|
||||
|
||||
{ Differ }
|
||||
|
|
@ -3933,6 +3936,7 @@ begin
|
|||
SetValue(Node, 'SynEditRightEdge', gEditorSynEditRightEdge);
|
||||
SetValue(Node, 'SynEditBlockIndent', gEditorSynEditBlockIndent);
|
||||
SetValue(Node, 'FindWordAtCursor', gEditorFindWordAtCursor);
|
||||
SetValue(Node, 'WordWrap', gEditorWordWrap);
|
||||
|
||||
{ Differ }
|
||||
Node := FindNode(Root, 'Differ',True);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue