The aim of this project is to enhance Vision with a RichText control that supports folding. The goal is to make this surface in the editor windows of EiffelStudio.
While using an editor like the one provided by EiffelStudio the actual area in a text, in thsi case source code, that is actually being edited is restricted to a small part of the entire document. Therefor being able to remove text sequences from the display without changing the actual text sequence could increase productivity. One such approach is to use folding, which is a line-based technique that "folds" a block of lines into a single line that is then displayed in addition to a special symbol that marks the line as actually being a "pile" of lines, and which also serves as the interface to unfold the passage back into it's original state (and subsequent fold/unfold operations).
The goal of this project was to implement folding support for the EiffelStudio editor in order to be able to fold semantic blocks of code such as entire features or loop blocks. The source text should however not be modified by this procedure in the sense that folding or unfolding a text should not change the AST. In addition folding should also not have any affects on any print output. A search for specific parts of code should also be able to enter folded text areas. It is also critical that folded areas are always displayed to the user correctly. Nested folding (e.g. a loop body in a feature, nested loops etc...) should also be possible.
See our class diagram:
The following testcases have been propsed: - write a small application (source code to be provided by author) that includes multiple features, loops and nested loops to check the correct creation and display of folded areas (ncl. nested folds).
- print the source code of the application mentioned above with and without folding support. The output should be identical.
- compile and run both the source code with and without folding support. The applications behaviour should be identical.
- search for specific words and text segments within folded areas of the source. The search should find such segments.
Part one :: generating the folding areas
This is the part where the data is gathered and put in to a datastructure to work on. Assigned to
Folding points of interests are gathered from the class ast via click_tool.current_class.ast. the of features of the class include
- next: EB_FOLDING_AREA
- previous: EB_FOLDING_AREA
-- links to adjacent folding_areas
- hidden: BOOLEAN
-- flag to indicate if the feature is hidden or not
-- manipulate the hidden-flag
EB_FOLDING_AREAs are inserted stored in an avl-tree EB_FOLDING_AREA_TREE with doubly-linked leaves. features of the class include
- first: EB_FOLDING_AREA
- last: EB_FOLDING_AREA
-- links to the very first and very last folding_areas
The editor was enchanced to support the generation an maintaining of folding areas. properties and functions include
- folding_areas: EB_FOLDING_AREA_TREE
-- rooting point of the datastructure
-- deletes any existing tree & builds it anew from the currently loaded classtext
-- synchronizes with the shown/saved classtext. only executes if the syntax is correct.
A breakpoint-sidebar like widget to display our folding-handles in. Assigned to
- lord bubu
- added grey bar containing EDITOR_TOKEN_FOLDING_POINTs (the thingies to click on)
- added menu entry to toggle folding-support (edit menu -> toggle folding points)
- added keyboard shortcut for toggling folding-support (ctrl + p)
- prepared interface for code-folding (see "part three")
images speak a thousand words
|Basic bar||Code-Folding bar with line numbers bar||Code-Folding: menu entry|
Part three :: text-manipulation
To be familiar with ES' way of implementing the AST
- (half) ADT specified
- some specifications
- generation of points/areas-of-interest (aka folding-areas)
- graphical representation (aka folding bar)
- togglabillity (sp?) of graphical bar (aka ctrl-p)
Everyone intrested in this project is welcome to join our mailinglist firstname.lastname@example.org