Home | Modules | Class Hierarchy | Alphabetical List | Compound List | Related Pages

BaseEditor Class Reference
[Editor]

Inheritance diagram for BaseEditor:

RegionHandler

Detailed Description

Base Editor functionality.

This class implements basic functionality, which could be useful in application's editing system. This includes automatic top-level caching of hilighting state, outline structure creation, pair constructions search. This class has event-oriented structure. Each editor event is passed into this object and gets internal processing.


Public Member Functions

 BaseEditor (ParserFactory *pf, LineSource *lineSource)
 Initial constructor.
 ~BaseEditor ()
void setRegionCompact (bool compact)
 This method informs handler about internal form of requeried LineRegion lists, which is returned after the parsing process.
void setRegionMapper (RegionMapper *rm)
 Installs specified RegionMapper, which maps HRC Regions into color data.
void setRegionMapper (const String *hrdClass, const String *hrdName)
 Installs specified RegionMapper, which is created with ParserFactory methods and maintained internally by this handler.
void setBackParse (int backParse)
 Specifies number of lines, for which parser would be able to run continual processing without highlight invalidation.
void setFileType (FileType *ftype)
 Initial HRC type, used for parse processing.
FileTypesetFileType (const String &fileType)
 Initial HRC type, used for parse processing.
FileTypechooseFileType (const String *fileName)
 Tries to choose appropriate file type from HRC database using passed fileName and first line of text (if available through lineSource).
FileTypegetFileType ()
 Returns currently used HRC file type.
void addRegionHandler (RegionHandler *rh)
 Adds specified RegionHandler object into parse process.
void removeRegionHandler (RegionHandler *rh)
 Removes previously added RegionHandler object.
void addEditorListener (EditorListener *el)
 Adds specified EditorListener object into parse process.
void removeEditorListener (EditorListener *el)
 Removes previously added EditorListener object.
PairMatchsearchLocalPair (int lineNo, int pos)
 Searches and creates pair match object in currently visible text.
PairMatchsearchGlobalPair (int lineNo, int pos)
 Searches pair match in all available text, possibly, making additional processing.
PairMatchgetEnwrappedPairMatch (int lineNo, int pos)
 Searches and creates pair match object of first enwrapping block.
void releasePairMatch (PairMatch *pm)
 Frees previously allocated PairMatch object.
LineRegiongetLineRegions (int lno)
 Return parsed and colored LineRegions of requested line.
void validate (int lno, bool rebuildRegions)
 Validates current state of the editor and runs parser, if needed.
void idleJob (int time)
 Tries to do some parsing job while user is doing nothing.
void modifyEvent (int topLine)
 Informs BaseEditor object about text modification event.
void modifyLineEvent (int line)
 Informs about single line modification event.
void visibleTextEvent (int wStart, int wSize)
 Informs about changes in visible range of text lines.
void lineCountEvent (int newLineCount)
 Informs about total lines count change.
void startParsing (int lno)
void endParsing (int lno)
void clearLine (int lno, String *line)
void addRegion (int lno, String *line, int sx, int ex, const Region *region)
void enterScheme (int lno, String *line, int sx, int ex, const Region *region, const Scheme *scheme)
void leaveScheme (int lno, String *line, int sx, int ex, const Region *region, const Scheme *scheme)

Data Fields

const Regiondef_Text
 Basic HRC region - default text (background color).
const Regiondef_Syntax
 Basic HRC region - syntax checkable region.
const Regiondef_Special
 Basic HRC region - special region.
const Regiondef_PairStart
 Basic HRC region - Paired region start.
const Regiondef_PairEnd
 Basic HRC region - Paired region end.
const RegionDefinerd_def_Text
 Basic HRC region mapping.
const RegionDefinerd_def_HorzCross
const RegionDefinerd_def_VertCross

Protected Attributes

ErrorHandlerfeh


Constructor & Destructor Documentation

BaseEditor::BaseEditor ParserFactory pf,
LineSource lineSource
 

Initial constructor.

Creates uninitialized base editor functionality support.

Parameters:
pf ParserFactory, used as source of all created parsers (HRC, HRD, Text parser). Can't be null.
lineSource Object, that provides parser with text data in line-separated form. Can't be null.

BaseEditor::~BaseEditor  ) 
 

Todo:
wait until validation is finished


Member Function Documentation

void BaseEditor::setRegionCompact bool  compact  ) 
 

This method informs handler about internal form of requeried LineRegion lists, which is returned after the parsing process.

Compact regions are guaranteed not to overlap with each other (this is achieved with more internal processing and more extensive cpu usage); non-compact regions are placed directly as they created by the TextParser and can be overlapped.

Note:
By default, if method is not called, regions are not compacted.
Parameters:
compact Creates LineRegionsSupport (false) or LineRegionsCompactSupport (true) object to store lists of RegionDefine's

void BaseEditor::setRegionMapper RegionMapper rm  ) 
 

Installs specified RegionMapper, which maps HRC Regions into color data.

Parameters:
rm RegionMapper object to map region values into colors.

void BaseEditor::setRegionMapper const String hrdClass,
const String hrdName
 

Installs specified RegionMapper, which is created with ParserFactory methods and maintained internally by this handler.

If no one of two overloads of setRegionMapper is called, all work is started without mapping of extended region information.

Parameters:
hrdClass Class of RegionMapper instance
hrdName Name of RegionMapper instance

void BaseEditor::setBackParse int  backParse  ) 
 

Specifies number of lines, for which parser would be able to run continual processing without highlight invalidation.

Parameters:
backParse Number of lines. If <= 0, dropped into default value.

void BaseEditor::setFileType FileType ftype  ) 
 

Initial HRC type, used for parse processing.

If changed during processing, all text information is invalidated.

FileType * BaseEditor::setFileType const String fileType  ) 
 

Initial HRC type, used for parse processing.

If changed during processing, all text information is invalidated.

PairMatch * BaseEditor::searchLocalPair int  lineNo,
int  pos
 

Searches and creates pair match object in currently visible text.

Parameters:
lineNo Line number, where to search paired region.
pos Position in line, where paired region to be searched. Paired Region is found, if it includes specified position or ends directly at one char before line position.

PairMatch * BaseEditor::searchGlobalPair int  lineNo,
int  pos
 

Searches pair match in all available text, possibly, making additional processing.

Parameters:
pos Position in line, where paired region to be searched. Paired Region is found, if it includes specified position or ends directly at one char before line position.

PairMatch * BaseEditor::getEnwrappedPairMatch int  lineNo,
int  pos
 

Searches and creates pair match object of first enwrapping block.

Returned object could be used as with getPairMatch method. Enwrapped block is the first meeted start of block, if moving from specified position to the left and top. Not Implemented yet.

Parameters:
lineNo Line number, where to search paired region.
pos Position in line, where paired region to be searched.

void BaseEditor::releasePairMatch PairMatch pm  ) 
 

Frees previously allocated PairMatch object.

Parameters:
pm PairMatch object to free.

LineRegion * BaseEditor::getLineRegions int  lno  ) 
 

Return parsed and colored LineRegions of requested line.

This method validates current cache state and, if needed, calls Colorer parser to validate modified block of text. Size of reparsed text is choosed according to information about visible text range and modification events.

Todo:
If number of lines, to be reparsed is more, than backParse parameter, then method will return null, until validate() method is called.

void BaseEditor::validate int  lno,
bool  rebuildRegions
 

Validates current state of the editor and runs parser, if needed.

This method can be called periodically in background thread to make possible background parsing process.

Parameters:
lno Line number, for which validation is requested. If this number is in the current visible window range, the part of text is validated, which is required for visual repaint. If this number is equals to -1, all the text is validated. If this number is not in visible range, optimal partial validation is used.
rebuildRegions If true, regions will be recalculated and repositioned for the specified line number usage. If false, parser will just start internal cache rebuilding procedure.

void BaseEditor::idleJob int  time  ) 
 

Tries to do some parsing job while user is doing nothing.

Parameters:
time integer between 0 and 100, shows an abount of time, available for this job.

void BaseEditor::modifyEvent int  topLine  ) 
 

Informs BaseEditor object about text modification event.

All the text becomes invalid after the specified line.

Parameters:
topLine Topmost modified line of text.

void BaseEditor::modifyLineEvent int  line  ) 
 

Informs about single line modification event.

Generally, this type of event can be processed much faster because of pre-checking line's changed structure and cancelling further parsing in case of unmodified text structure.

Parameters:
line Modified line of text.
Todo:
Not used yet! This must include special 'try' parse method.

void BaseEditor::visibleTextEvent int  wStart,
int  wSize
 

Informs about changes in visible range of text lines.

This information is used to make assumptions about text structure and to make faster parsing.

Parameters:
wStart Topmost visible line of text.
wSize Number of currently visible text lines. This number must includes all partially visible lines.

void BaseEditor::lineCountEvent int  newLineCount  ) 
 

Informs about total lines count change.

This must include initial lines number setting.



Colorer-take5 Library. Copyright © 1999-2006 Igor Russkih.
Generated at Fri Nov 24 17:13:12 2006 by doxygen 1.4.6.