// Scintilla source code edit control /** @file ViewStyle.h ** Store information on how the document is to be viewed. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef VIEWSTYLE_H #define VIEWSTYLE_H namespace Scintilla::Internal { /** */ class MarginStyle { public: Scintilla::MarginType style; ColourRGBA back; int width; int mask; bool sensitive; Scintilla::CursorShape cursor; MarginStyle(Scintilla::MarginType style_= Scintilla::MarginType::Symbol, int width_=0, int mask_=0) noexcept; bool ShowsFolding() const noexcept; }; /** */ class FontRealised { public: FontMeasurements measurements; std::shared_ptr font; void Realise(Surface &surface, int zoomLevel, Scintilla::Technology technology, const FontSpecification &fs, const char *localeName); }; typedef std::map> FontMap; using ColourOptional = std::optional; inline ColourOptional OptionalColour(Scintilla::uptr_t wParam, Scintilla::sptr_t lParam) noexcept { if (wParam) { return ColourRGBA::FromIpRGB(lParam); } else { return {}; } } struct SelectionAppearance { // Is the selection visible? bool visible = true; // Whether to draw on base layer or over text Scintilla::Layer layer = Layer::Base; // Draw selection past line end characters up to right border bool eolFilled = false; }; struct CaretLineAppearance { // Whether to draw on base layer or over text Scintilla::Layer layer = Layer::Base; // Also show when non-focused bool alwaysShow = false; // highlight sub line instead of whole line bool subLine = false; // Non-0: draw a rectangle around line instead of filling line. Value is pixel width of frame int frame = 0; }; struct CaretAppearance { // Line, block, over-strike bar ... Scintilla::CaretStyle style = CaretStyle::Line; // Width in pixels int width = 1; }; struct WrapAppearance { // No wrapping, word, character, whitespace appearance Scintilla::Wrap state = Wrap::None; // Show indication of wrap at line end, line start, or in margin Scintilla::WrapVisualFlag visualFlags = WrapVisualFlag::None; // Show indication near margin or near text Scintilla::WrapVisualLocation visualFlagsLocation = WrapVisualLocation::Default; // How much indentation to show wrapping int visualStartIndent = 0; // WrapIndentMode::Fixed, Same, Indent, DeepIndent Scintilla::WrapIndentMode indentMode = WrapIndentMode::Fixed; }; struct EdgeProperties { int column = 0; ColourRGBA colour; constexpr EdgeProperties(int column_ = 0, ColourRGBA colour_ = ColourRGBA::FromRGB(0)) noexcept : column(column_), colour(colour_) { } }; // This is an old style enum so that its members can be used directly as indices without casting enum StyleIndices { StyleDefault = static_cast(Scintilla::StylesCommon::Default), StyleLineNumber = static_cast(Scintilla::StylesCommon::LineNumber), StyleBraceLight = static_cast(Scintilla::StylesCommon::BraceLight), StyleBraceBad = static_cast(Scintilla::StylesCommon::BraceBad), StyleControlChar = static_cast(Scintilla::StylesCommon::ControlChar), StyleIndentGuide = static_cast(Scintilla::StylesCommon::IndentGuide), StyleCallTip = static_cast(Scintilla::StylesCommon::CallTip), StyleFoldDisplayText = static_cast(Scintilla::StylesCommon::FoldDisplayText), }; /** */ class ViewStyle { UniqueStringSet fontNames; FontMap fonts; public: std::vector