⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syneditsource.pas

📁 SynEditStudio delphi 代码编辑器
💻 PAS
📖 第 1 页 / 共 3 页
字号:
          Background := ReadInteger(Section, 'SelectedColor_Background', Background);
          Foreground := ReadInteger(Section, 'SelectedColor_Foreground', Foreground);
        end;
      if IsMask(smSelectionMode) then
        SelectionMode := TSynSelectionMode(ReadInteger(Section, 'SelectionMode', Integer(SelectionMode)));
      if IsMask(smTabWidth) then
        TabWidth := ReadInteger(Section, 'TabWidth', TabWidth);
      if IsMask(smWantTabs) then
        WantTabs := ReadBool(Section, 'WantTabs', WantTabs);
      if IsMask(smWordWrap) then
        with WordWrap do
        begin
          Indicator.Visible := ReadBool(Section, 'Wordwrap_Indicator', Indicator.Visible);
          Enabled := ReadBool(Section, 'Wordwrap_Enabled', Enabled);
          Position := ReadInteger(Section, 'Wordwrap_Position', Position);
          Style := TSynWordWrapStyle(ReadInteger(Section, 'Wordwrap_Style', Integer(Style)));
        end;
        {$IFDEF CODEFOLDING}
        //### Code Folding ###
      if IsMask(smCodeFolding) then
        with fCodeFolding do
        begin
          CaseSensitive := ReadBool(Section, 'CodeFolding_CaseSensitive', CaseSensitive);
          CollapsedCodeHint := ReadBool(Section, 'CodeFolding_CollapsedCodeHint', CollapsedCodeHint);
          CollapsedLineColor := ReadInteger(Section, 'CodeFolding_CollapsedLineColor', CollapsedLineColor);
          CollapsingMarkStyle := TSynCollapsingMarkStyle(ReadInteger(Section, 'CodeFolding_CollapsingMarkStyle', integer(CollapsingMarkStyle)));
          CollapsedLineColor := ReadInteger(Section, 'CodeFolding_CollapsedLineColor', CollapsedLineColor);
          Enabled := ReadBool(Section, 'CodeFolding_Enabled', Enabled);
          FolderBarColor := ReadInteger(Section, 'CodeFolding_FolderBarColor', FolderBarColor);
          FolderBarLinesColor := ReadInteger(Section, 'CodeFolding_FolderBarLinesColor', FolderBarLinesColor);
          HighlighterFoldRegions := ReadBool(Section, 'CodeFolding_HighlighterFoldRegions', HighlighterFoldRegions);
          HighlightIndentGuides := ReadBool(Section, 'CodeFolding_HighlightIndentGuides', HighlightIndentGuides);
          IndentGuides := ReadBool(Section, 'CodeFolding_IndentGuides', IndentGuides);
          ShowCollapsedLine := ReadBool(Section, 'CodeFolding_ShowCollapsedLine', ShowCollapsedLine);
        end;
        //### End Code Folding ###
        {$ENDIF}

    end;

end;

procedure TSynEditSource.Notification(AComponent: TComponent;
  Operation: TOperation);
begin
  inherited;
  If (AComponent = fHighlighter) and (Operation = opRemove) then
    fHighlighter := nil;
  If (AComponent = FPopupMenu) and (Operation = opRemove) then
    FPopupMenu := nil;
end;

procedure TSynEditSource.SaveToIni(IniFile: TCustomIniFile; Section: String);
begin
  if IniFile <> nil then
    With IniFile do
    begin
      if IsMask(smActiveLine) then
        with ActiveLine do
        begin
          WriteBool(Section, 'ActiveLine_Visible', Visible);
          WriteBool(Section, 'ActiveLine_Indicator', Indicator.Visible);
          WriteInteger(Section, 'ActiveLine_Background', Background);
          WriteInteger(Section, 'ActiveLine_Foreground', Foreground);
        end;
      if IsMask(smBackground) then
        with Background do
        begin
          WriteBool(Section, 'Background_Visible', Visible);
          WriteInteger(Section, 'Background_RepeatMode', Integer(RepeatMode));
        end;
      if IsMask(smBlockWidth) then
        WriteInteger(Section, 'BlockWidth', BlockWidth);
      if IsMask(smBookMarkOptions) then
        with BookMarkOptions do
        begin
          WriteBool(Section, 'BookMarkOptions_DrawBookmarksFirst', DrawBookmarksFirst);
          WriteBool(Section, 'BookMarkOptions_EnableKeys', EnableKeys);
          WriteBool(Section, 'BookMarkOptions_GlyphsVisible', GlyphsVisible);
          WriteInteger(Section, 'BookMarkOptions_LeftMargin', LeftMargin);
          WriteInteger(Section, 'BookMarkOptions_Xoffset', Xoffset);
        end;
      if IsMask(smBorderStyle) then
        WriteInteger(Section, 'BorderStyle', Integer(BorderStyle));
      if IsMask(smColor) then
        WriteInteger(Section, 'Color', Color);
      if IsMask(smFont) then
        WriteString(Section, 'Font', FontToStr(Font));
      if IsMask(smGutter) then
        with Gutter do
        begin
          WriteBool(Section, 'Gutter_AutoSize', AutoSize);
          WriteInteger(Section, 'Gutter_LeftOffsetColor', LeftOffsetColor);
          WriteInteger(Section, 'Gutter_RightOffsetColor', RightOffsetColor);
          WriteBool(Section, 'Gutter_ShowLineModified', ShowLineModified);
          WriteInteger(Section, 'Gutter_LineNormalColor', LineNormalColor);
          WriteInteger(Section, 'Gutter_LineModifiedColor', LineModifiedColor);
          WriteInteger(Section, 'Gutter_BorderStyle', Integer(BorderStyle));
          WriteInteger(Section, 'Gutter_Color', Color);
          WriteInteger(Section, 'Gutter_DigitCount', DigitCount);
          WriteString(Section, 'Gutter_Font', FontToStr(Font));
          WriteBool(Section, 'Gutter_LeaderZeros', LeadingZeros);
          WriteInteger(Section, 'Gutter_LeftOffset', LeftOffset);
          WriteInteger(Section, 'Gutter_RightOffset', RightOffset);
          WriteBool(Section, 'Gutter_ShowLineNumbers', ShowLineNumbers);
          WriteBool(Section, 'Gutter_UseFontStyle', UseFontStyle);
          WriteBool(Section, 'Gutter_Visible', Visible);
          WriteBool(Section, 'Gutter_ZeroStart', ZeroStart);
          WriteInteger(Section, 'Gutter_BorderColor', BorderColor);
          WriteInteger(Section, 'Gutter_LineNumberStart', LineNumberStart);
          WriteBool(Section, 'Gutter_Intens', Intens);
          WriteBool(Section, 'Gutter_Gradient', Gradient);
          WriteInteger(Section, 'Gutter_GradientStartColor', GradientStartColor);
          WriteInteger(Section, 'Gutter_GradientEndColor', GradientEndColor);
          WriteInteger(Section, 'Gutter_GradientSteps', GradientSteps);
        end;
      if IsMask(smHideSelection) then
        WriteBool(Section, 'HideSelection', HideSelection);
//      if IsMask(smHighlighter) then
      if IsMask(smInsertCaret) then
        WriteInteger(Section, 'InsertCaret', Integer(InsertCaret));
      if IsMask(smInsertMode) then
        WriteBool(Section, 'insertMode', insertMode);
//      if IsMask(smKeystrokes) then
//      if IsMask(smLines) then
      if IsMask(smLineDivider) then
        with LineDivider do
        begin
          WriteBool(Section, 'LineDivider_Visible', Visible);
          WriteInteger(Section, 'LineDivider_Color', Color);
          WriteInteger(Section, 'LineDivider_Style', Integer(Style));
        end;
      if IsMask(smLineSpacing) then
        WriteInteger(Section, 'LineSpacing', LineSpacing);
      if IsMask(smLineSpacingRule) then
        WriteInteger(Section, 'LineSpacingRule', Integer(LineSpacingRule));
      if IsMask(smMaxScrollWidth) then
        WriteInteger(Section, 'MaxScrollWidth', MaxScrollWidth);
      if IsMask(smMaxUndo) then
        WriteInteger(Section, 'MaxUndo', MaxUndo);
      if IsMask(smOptions) then
      begin
        WriteBool(Section, 'Options_AltSetsColumnMode', eoAltSetsColumnMode in Options);
        WriteBool(Section, 'Options_AutoSizeMaxScrollWidth', eoAutoSizeMaxScrollWidth in Options);
        WriteBool(Section, 'Options_AutoIndent', eoAutoIndent in Options);
        WriteBool(Section, 'Options_DisableScrollArrows', eoDisableScrollArrows in Options);
        WriteBool(Section, 'Options_DragDropEditing', eoDragDropEditing in Options);
        WriteBool(Section, 'Options_DropFiles', eoDropFiles in Options);
        WriteBool(Section, 'Options_EnhanceHomeKey', eoEnhanceHomeKey in Options);
        WriteBool(Section, 'Options_EnhanceEndKey', eoEnhanceEndKey in Options);
        WriteBool(Section, 'Options_GroupUndo', eoGroupUndo in Options);
        WriteBool(Section, 'Options_HalfPageScroll', eoHalfPageScroll in Options);
        WriteBool(Section, 'Options_HideShowScrollbars', eoHideShowScrollbars in Options);
        WriteBool(Section, 'Options_KeepCaretX', eoKeepCaretX in Options);
        WriteBool(Section, 'Options_NoCaret', eoNoCaret in Options);
        WriteBool(Section, 'Options_NoSelection', eoNoSelection in Options);
        WriteBool(Section, 'Options_RightMouseMovesCursor', eoRightMouseMovesCursor in Options);
        WriteBool(Section, 'Options_ScrollByOneLess', eoScrollByOneLess in Options);
        WriteBool(Section, 'Options_ScrollHintFollows', eoScrollHintFollows in Options);
        WriteBool(Section, 'Options_ScrollPastEof', eoScrollPastEof in Options);
        WriteBool(Section, 'Options_ScrollPastEol', eoScrollPastEol in Options);
        WriteBool(Section, 'Options_ShowScrollHint', eoShowScrollHint in Options);
        WriteBool(Section, 'Options_ShowSpecialChars', eoShowSpecialChars in Options);
        WriteBool(Section, 'Options_SmartTabs', eoSmartTabs in Options);
        WriteBool(Section, 'Options_SmartTabDelete', eoSmartTabDelete in Options);
        WriteBool(Section, 'Options_SpecialLineDefaultFg', eoSpecialLineDefaultFg in Options);
        WriteBool(Section, 'Options_TabsToSpaces', eoTabsToSpaces in Options);
        WriteBool(Section, 'Options_TabIndent', eoTabIndent in Options);
        WriteBool(Section, 'Options_TrimTrailingSpaces', eoTrimTrailingSpaces in Options);
        WriteBool(Section, 'Options_ColumnEditExtension', eoColumnEditExtension in Options);
      end;
      if IsMask(smOverwriteCaret) then
        WriteInteger(Section, 'OverwriteCaret', Integer(OverwriteCaret));
//      if IsMask(smPopupMenu) then
      if IsMask(smReadOnly) then
        WriteBool(Section, 'ReadOnly', ReadOnly);
      if IsMask(smRightEdge) then
        with RightEdge do
        begin
          WriteBool(Section, 'RightEdge_Visible', Visible);
          WriteInteger(Section, 'RightEdge_Position', Position);
          WriteInteger(Section, 'RightEdge_Color', Color);
          WriteInteger(Section, 'RightEdge_Style', Integer(Style));
          WriteBool(Section, 'RightEdge_MouseMove', MouseMove);
        end;
      if IsMask(smScrollBars) then
        with ScrollBars do
        begin
          WriteInteger(Section, 'ScrollBars_ScrollBars', Integer(ScrollBars));
          WriteInteger(Section, 'ScrollBars_Style', Integer(Style));
          WriteInteger(Section, 'ScrollBars_HintColor', HintColor);
          WriteInteger(Section, 'ScrollBars_HintFormat', Integer(HintFormat));
        end;
      if IsMask(smSelectedColor) then
        with SelectedColor do
        begin
          WriteInteger(Section, 'SelectedColor_Background', Background);
          WriteInteger(Section, 'SelectedColor_Foreground', Foreground);
        end;
      if IsMask(smSelectionMode) then
        WriteInteger(Section, 'SelectionMode', Integer(SelectionMode));
      if IsMask(smTabWidth) then
        WriteInteger(Section, 'TabWidth', TabWidth);
      if IsMask(smWantTabs) then
        WriteBool(Section, 'WantTabs', WantTabs);
      if IsMask(smWordWrap) then
        with WordWrap do
        begin
          WriteBool(Section, 'Wordwrap_Enabled', Enabled);
          WriteInteger(Section, 'Wordwrap_Position', Position);
          WriteInteger(Section, 'Wordwrap_Style', Integer(Style));
          WriteBool(Section, 'Wordwrap_Indicator', Indicator.Visible);
        end;
        {$IFDEF CODEFOLDING}
        //### Code Folding ###
      if IsMask(smCodeFolding) then
        with fCodeFolding do
        begin
          WriteBool(Section, 'CodeFolding_CaseSensitive', CaseSensitive);
          WriteBool(Section, 'CodeFolding_CollapsedCodeHint', CollapsedCodeHint);
          WriteInteger(Section, 'CodeFolding_CollapsedLineColor', CollapsedLineColor);
          WriteInteger(Section, 'CodeFolding_CollapsingMarkStyle', integer(CollapsingMarkStyle));
          WriteInteger(Section, 'CodeFolding_CollapsedLineColor', CollapsedLineColor);
          WriteBool(Section, 'CodeFolding_Enabled', Enabled);
          WriteInteger(Section, 'CodeFolding_FolderBarColor', FolderBarColor);
          WriteInteger(Section, 'CodeFolding_FolderBarLinesColor', FolderBarLinesColor);
          WriteBool(Section, 'CodeFolding_HighlighterFoldRegions', HighlighterFoldRegions);
          WriteBool(Section, 'CodeFolding_HighlightIndentGuides', HighlightIndentGuides);
          WriteBool(Section, 'CodeFolding_IndentGuides', IndentGuides);
          WriteBool(Section, 'CodeFolding_ShowCollapsedLine', ShowCollapsedLine);
        end;
        //### End Code Folding ###
        {$ENDIF}
     end;
end;

procedure TSynEditSource.SetActiveLine(const Value: TSynActiveLine);
begin
  FActiveLine.Assign(Value);
end;

procedure TSynEditSource.SetBackground(const Value: TSynEditBackground);
begin
  fBackground.Assign(Value);
end;

procedure TSynEditSource.SetBookMarks(const Value: TSynBookMarkOpt);
begin
  FBookmarks.Assign(Value);
end;

{$IFDEF CODEFOLDING}
//### Code Folding ###
procedure TSynEditSource.setCodeFolding(const Value: TSynCodeFolding);
begin
  fCodeFolding.Assign(Value);
end;
//### End Code Folding ###
{$ENDIF}

procedure TSynEditSource.SetFont(const Value: TFont);
begin
  FFont.Assign(Value);
end;

procedure TSynEditSource.SetHighlighter(
  const Value: TSynCustomHighlighter);
begin
  if fHighlighter <> nil then
    fHighlighter.RemoveFreeNotification(Self);
  fHighlighter := Value;
  if fHighlighter <> nil then
    fHighlighter.FreeNotification(Self);
end;

procedure TSynEditSource.SetKeystrokes(const Value: TSynEditKeyStrokes);
begin
  FKeystrokes.Assign(Value);
end;

procedure TSynEditSource.SetLineDivider(const Value: TSynLineDivider);
begin
  FLineDivider.Assign(Value);
end;

procedure TSynEditSource.SetLines(const Value: TStrings);
begin
  FLines.Assign(Value);
end;

procedure TSynEditSource.SetPopupMenu(const Value: TPopupMenu);
begin
  if FPopupMenu <> nil then
    FPopupMenu.RemoveFreeNotification(Self);
  FPopupMenu := Value;
  if FPopupMenu <> nil then
    FPopupMenu.FreeNotification(Self);
end;

procedure TSynEditSource.SetRightEdge(const Value: TSynRightEdge);
begin
  FRightEdge.Assign(Value);
end;

procedure TSynEditSource.SetScrollBars(const Value: TSynScrollBars);
begin
  FScrollBars.Assign(Value);
end;

procedure TSynEditSource.SetSelectedColor(const Value: TSynSelectedColor);
begin
  FSelectedColor.Assign(Value);
end;

procedure TSynEditSource.SetSynGutter(const Value: TSynGutter);
begin
  FSynGutter.Assign(Value);
end;

procedure TSynEditSource.SetWordWrap(const Value: TSynWordWrap);
begin
  FWordWrap.Assign(Value);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -