JX Application Framework
Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
JStyledText.cpp File Reference
#include "JStyledText.h"
#include "JSTUndoTyping.h"
#include "JSTUndoPaste.h"
#include "JSTUndoMove.h"
#include "JSTUndoStyle.h"
#include "JSTUndoTabShift.h"
#include "JFontManager.h"
#include "JColorManager.h"
#include "JListUtil.h"
#include "JRunArrayIterator.h"
#include "JRegex.h"
#include "JStringIterator.h"
#include "JStringMatch.h"
#include "JInterpolate.h"
#include "JLatentPG.h"
#include "JMinMax.h"
#include "jTextUtil.h"
#include "jASCIIConstants.h"
#include "jFStreamUtil.h"
#include "jStreamUtil.h"
#include "jFileUtil.h"
#include "jGlobals.h"
#include "jAssert.h"
#include "JStyledTextSetFont.th"
Include dependency graph for JStyledText.cpp:

Macros

#define LocalVarName   size
 
#define GetElementName   GetSize()
 
#define SetElementName   SetSize
 
#define LocalVarName   bold
 
#define GetElementName   GetStyle().bold
 
#define SetElementName   SetBold
 
#define LocalVarName   italic
 
#define GetElementName   GetStyle().italic
 
#define SetElementName   SetItalic
 
#define LocalVarName   count
 
#define GetElementName   GetStyle().underlineCount
 
#define SetElementName   SetUnderlineCount
 
#define LocalVarName   strike
 
#define GetElementName   GetStyle().strike
 
#define SetElementName   SetStrike
 
#define LocalVarName   color
 
#define GetElementName   GetStyle().color
 
#define SetElementName   SetColor
 
#define LocalVarName   style
 
#define GetElementName   GetStyle()
 
#define SetElementName   SetStyle
 
#define COPY_FOR_CLEAN_TEXT
 
#define CLEAN_WS_ALIGNMENT
 

Typedefs

using FontIterator = JRunArrayIterator< JFont >
 

Functions

bool isWhitespace (const JUtf8Character &c)
 
void jComputeForwardFontRange (const JStyledText::TextIndex &start, const JString &text, const FontIterator &iter, const bool wrapped, JStyledText::TextRange *range)
 
void jComputeBackwardFontRange (const JStyledText::TextIndex &start, const JString &text, const FontIterator &iter, const bool wrapped, JStyledText::TextRange *range)
 
bool jCRMIsEOS (const JUtf8Character &c)
 

Variables

const JFileVersion kCurrentPrivateFormatVersion = 1
 
const JSize kDefaultMaxUndoCount = 100
 
const JSize kUNIXLineWidth = 75
 
const JSize kUNIXTabCharCount = 8
 

Macro Definition Documentation

◆ CLEAN_WS_ALIGNMENT

#define CLEAN_WS_ALIGNMENT
Value:
textIter.SkipPrev(); \
const JCharacterRange r = textIter.FinishMatch().GetCharacterRange(); \
styleIter.MoveTo(JListT::kStartBefore, r.first); \
styleIter.RemoveNext(r.GetCount()); \
textIter.RemoveLastMatch();
Definition JCharacterRange.h:16
@ kStartBefore
Definition JList.h:37
T first
Definition JRange.h:20
JSize GetCount() const
Definition JRange.h:44

Clean up the indentation whitespace and strip trailing whitespace in the specified range.

Returns the range of the resulting text.

◆ COPY_FOR_CLEAN_TEXT

#define COPY_FOR_CLEAN_TEXT
Value:
if (*cleanText == nullptr) \
{ \
*cleanText = jnew JString(text); \
assert( *cleanText != nullptr ); \
*cleanStyle = jnew JRunArray<JFont>(style); \
assert( *cleanStyle != nullptr ); \
}
Definition JRunArray.h:43
Definition JString.h:24
#define jnew
Definition jNew.h:31

Removes illegal characters, converts to UNIX newline format, adjusts fonts to ensure that all characters will be rendered correctly, lets derived class perform additional filtering. Returns true if the text was modified.

okToInsert is true if derived class filtering accepted the text.

◆ GetElementName [1/7]

#define GetElementName   GetSize()

◆ GetElementName [2/7]

#define GetElementName   GetStyle().bold

◆ GetElementName [3/7]

#define GetElementName   GetStyle().italic

◆ GetElementName [4/7]

#define GetElementName   GetStyle().underlineCount

◆ GetElementName [5/7]

#define GetElementName   GetStyle().strike

◆ GetElementName [6/7]

#define GetElementName   GetStyle().color

◆ GetElementName [7/7]

#define GetElementName   GetStyle()

◆ LocalVarName [1/7]

#define LocalVarName   size

◆ LocalVarName [2/7]

#define LocalVarName   bold

◆ LocalVarName [3/7]

#define LocalVarName   italic

◆ LocalVarName [4/7]

#define LocalVarName   count

◆ LocalVarName [5/7]

#define LocalVarName   strike

◆ LocalVarName [6/7]

#define LocalVarName   color

◆ LocalVarName [7/7]

#define LocalVarName   style

◆ SetElementName [1/7]

#define SetElementName   SetSize

◆ SetElementName [2/7]

#define SetElementName   SetBold

◆ SetElementName [3/7]

#define SetElementName   SetItalic

◆ SetElementName [4/7]

#define SetElementName   SetUnderlineCount

◆ SetElementName [5/7]

#define SetElementName   SetStrike

◆ SetElementName [6/7]

#define SetElementName   SetColor

◆ SetElementName [7/7]

#define SetElementName   SetStyle

Typedef Documentation

◆ FontIterator

Function Documentation

◆ isWhitespace()

bool isWhitespace ( const JUtf8Character c)
inline

◆ jComputeBackwardFontRange()

void jComputeBackwardFontRange ( const JStyledText::TextIndex start,
const JString text,
const FontIterator iter,
const bool  wrapped,
JStyledText::TextRange range 
)

Look for the match before the current position. If we find it, we select it and return true.

◆ jComputeForwardFontRange()

void jComputeForwardFontRange ( const JStyledText::TextIndex start,
const JString text,
const FontIterator iter,
const bool  wrapped,
JStyledText::TextRange range 
)

Look for the next match beyond the given position.

◆ jCRMIsEOS()

bool jCRMIsEOS ( const JUtf8Character c)
inline

Read one block of { spaces + word (non-spaces) } from itsBuffer, starting at *charIndex, stopping if we get as far as endCharIndex. *spaceBuffer contains the whitespace (spaces + tabs) that was found. *spaceCount is the equivalent number of spaces. *wordBuffer contains the word. charIndex is incremented to point to the next character to read.

Newlines are treated separately. If a newline is encountered while reading spaces, we throw out the spaces and return kFoundNewLine. If a newline is encountered while reading a word, we leave it for the next time, when we immediately return kFoundNewLine.

When we pass the position origCaretIndex, we set *totalCount to be the index into *spaceBuffer+*wordBuffer. Otherwise, we do not change totalCount.

Variable Documentation

◆ kCurrentPrivateFormatVersion

const JFileVersion kCurrentPrivateFormatVersion = 1

◆ kDefaultMaxUndoCount

const JSize kDefaultMaxUndoCount = 100

◆ kUNIXLineWidth

const JSize kUNIXLineWidth = 75

◆ kUNIXTabCharCount

const JSize kUNIXTabCharCount = 8