// 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; inline std::optional OptionalColour(Scintilla::uptr_t wParam, Scintilla::sptr_t lParam) { if (wParam) { return ColourRGBA::FromIpRGB(lParam); } else { return {}; } } struct SelectionAppearance { // Whether to draw on base layer or over text Scintilla::Layer layer; // Draw selection past line end characters up to right border bool eolFilled; }; struct CaretLineAppearance { // Whether to draw on base layer or over text Scintilla::Layer layer; // Also show when non-focused bool alwaysShow; // highlight sub line instead of whole line bool subLine; // Non-0: draw a rectangle around line instead of filling line. Value is pixel width of frame int frame; }; struct CaretAppearance { // Line, block, over-strike bar ... Scintilla::CaretStyle style; // Width in pixels int width; }; struct WrapAppearance { // No wrapping, word, character, whitespace appearance Scintilla::Wrap state; // Show indication of wrap at line end, line start, or in margin Scintilla::WrapVisualFlag visualFlags; // Show indication near margin or near text Scintilla::WrapVisualLocation visualFlagsLocation; // How much indentation to show wrapping int visualStartIndent; // WrapIndentMode::Fixed, _SAME, _INDENT, _DEEPINDENT Scintilla::WrapIndentMode indentMode; }; 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