      0: package net.sf.colorer.editor;
      1:
      2: import net.sf.colorer.*;
      3: import net.sf.colorer.handlers.*;
      4:
      5: public interface BaseEditor{
      6:
      7:   /** LineRegionsSupport object preferences.
      8:       Installs specified RegionStore (basically HRDRegionStore), which
      9:       maps HRC Regions into color data, sets default size (in lines) of
     10:       Regions structure cache.
     11:       @param compact Creates LineRegionsSupport (false) or
     12:       LineRegionsCompactSupport (true) object to store lists of RegionDefine's
     13:   */
     14:   public void setRegionCompact(boolean compact);
     15:
     16:   /** Changes used file type */
     17:   public void setFileType(String typename);
     18:   /** Chooses filetype according to the filename and first line of text */
     19:   public String chooseFileType(String fname);
     20:   /** Returns Currently selected file type */
     21:   public String getFileType();
     22:
     23:   /** Specifies number of lines, for which parser
     24:       would be able to run continual processing without
     25:       highlight invalidation.
     26:       @param backParse Number of lines. If <= 0, dropped into default
     27:       value.
     28:   */
     29:   void setBackParse(int backParse);
     30:
     31:   /** Installs specified RegionMapper. */
     32:   public void setRegionMapper(String cls, String name);
     33:
     34:   /** Adds specified RegionHandler object into the parse process.
     35:    * @param filter If not null, handler would be activated only if
     36:    * passed regions have specified <code>filter</code> parent.
     37:    * This allows to optimize performance and disable unnecesary JNI
     38:    * context switches.
     39:   */
     40:   void addRegionHandler(RegionHandler rh, Region filter);
     41:   /** Removes previously added region handler.
     42:   */
     43:   void removeRegionHandler(RegionHandler rh);
     44:
     45:   /** Current Background Region (def:Text) */
     46:   public RegionDefine getBackground();
     47:   /** Current Vertical Rule (def:VertCross) */
     48:   public RegionDefine getVertCross();
     49:   /** Current Horizontal Rule (def:HorzCross) */
     50:   public RegionDefine getHorzCross();
     51:
     52:   /** Searches and creates pair match object.
     53:       Returned object can be used later in the pair search methods.
     54:       This object is valid only until reparse of it's line
     55:       occured. After that event information about line region's
     56:       references in it becomes invalid and, if used, can produce
     57:       faults.
     58:       @param lineNo Line number, where to search paired region.
     59:       @param pos Position in line, where paired region to be searched.
     60:              Paired Region is found, if it includes specified position
     61:              or ends directly at one char before line position.
     62:   */
     63:   public PairMatch getPairMatch(int lineNo, int pos);
     64:
     65:   /** Searches pair match in currently visible text.
     66:       @param pm Unmatched pair match
     67:   */
     68:   public void searchLocalPair(PairMatch pm);
     69:
     70:   /** Searches pair match in all available text, possibly,
     71:       making additional processing.
     72:       @param pm Unmatched pair match
     73:   */
     74:   public void searchGlobalPair(PairMatch pm);
     75:
     76:   /** Return parsed and colored LineRegions of requested line.
     77:       This method validates current cache state
     78:       and, if needed, calls Colorer parser to validate modified block of text.
     79:       Size of reparsed text is choosed according to information
     80:       about visible text range and modification events.
     81:       @todo If number of lines, to be reparsed is more, than backParse parameter,
     82:       then method will return null, until validate() method is called.
     83:   */
     84:   public LineRegion[] getLineRegions(int lno);
     85:
     86:   /** Validates current state of the editor and runs parser, if needed.
     87:       This method can be called periodically in background thread
     88:       to make possible background parsing process.
     89:       @param lno Line number, for which validation is requested.
     90:              If this number is in the current visible window range,
     91:              the part of text is validated, which is required
     92:              for visual repaint.
     93:              If this number is equals to -1, all the text is validated.
     94:              If this number is not in visible range, optimal partial validation
     95:              is used
     96:   */
     97:   void validate(int lno);
     98:
     99:   /** Tries to do some parsing job while user is doing nothing.
    100:       @param time integer between 0 and 100, shows an abount of time,
    101:       available for this job.
    102:   */
    103:   void idleJob(int time);
    104:
    105:   /** Informs BaseEditor object about text modification event.
    106:       All the text becomes invalid after the specified line.
    107:       @param topLine Topmost modified line of text.
    108:   */
    109:   public void modifyEvent(int topLine);
    110:
    111:   /** Informs about single line modification event.
    112:       Generally, this type of event can be processed much faster
    113:       because of pre-checking line's changed structure and
    114:       cancelling further parsing in case of unmodified text structure.
    115:       @param line Modified line of text.
    116:       @todo Not used yet! This must include special 'try' parse method.
    117:   */
    118:   public void modifyLineEvent(int line);
    119:
    120:   /** Informs about changes in visible range of text lines.
    121:       This information is used to make assumptions about
    122:       text structure and to make faster parsing.
    123:       @param wStart Topmost visible line of text.
    124:       @param wSize  Number of currently visible text lines.
    125:                     This number must includes all partially visible lines.
    126:   */
    127:   public void visibleTextEvent(int wStart, int wSize);
    128:
    129:   /** Informs about total lines count change.
    130:       This must include initial lines number setting.
    131:   */
    132:   public void lineCountEvent(int newLineCount);
    133:
    134: };
    135: /* ***** BEGIN LICENSE BLOCK *****
    136:  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
    137:  *
    138:  * The contents of this file are subject to the Mozilla Public License Version
    139:  * 1.1 (the "License"); you may not use this file except in compliance with
    140:  * the License. You may obtain a copy of the License at
    141:  * http://www.mozilla.org/MPL/
    142:  *
    143:  * Software distributed under the License is distributed on an "AS IS" basis,
    144:  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    145:  * for the specific language governing rights and limitations under the
    146:  * License.
    147:  *
    148:  * The Original Code is the Colorer Library.
    149:  *
    150:  * The Initial Developer of the Original Code is
    151:  * Cail Lomecb <cail@nm.ru>.
    152:  * Portions created by the Initial Developer are Copyright (C) 1999-2003
    153:  * the Initial Developer. All Rights Reserved.
    154:  *
    155:  * Contributor(s):
    156:  *
    157:  * Alternatively, the contents of this file may be used under the terms of
    158:  * either the GNU General Public License Version 2 or later (the "GPL"), or
    159:  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    160:  * in which case the provisions of the GPL or the LGPL are applicable instead
    161:  * of those above. If you wish to allow use of your version of this file only
    162:  * under the terms of either the GPL or the LGPL, and not to allow others to
    163:  * use your version of this file under the terms of the MPL, indicate your
    164:  * decision by deleting the provisions above and replace them with the notice
    165:  * and other provisions required by the GPL or the LGPL. If you do not delete
    166:  * the provisions above, a recipient may use your version of this file under
    167:  * the terms of any one of the MPL, the GPL or the LGPL.
    168:  *
    169:  * ***** END LICENSE BLOCK ***** */