Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folding Record Blocks #70

Merged
merged 6 commits into from
Jun 26, 2022
Merged

Folding Record Blocks #70

merged 6 commits into from
Jun 26, 2022

Conversation

shriprem
Copy link
Owner

No description provided.

Initial commit

Added folding button group. Implemented 'Remove' folding.

Caching fold status and restoring it in onBufferActivate.

Implemented FoldInfo read from FoldStructs.ini file.

Implemented Toggle Line and  Fold/Unfold for Level2 1 to 8

Minor bug fixes
@shriprem shriprem merged commit b49bd3f into master Jun 26, 2022
@shriprem shriprem deleted the folding_record_blocks branch June 26, 2022 20:18
@jeff-bowles
Copy link

jeff-bowles commented Jun 27, 2022 via email

@shriprem
Copy link
Owner Author

Hi @jeff-bowles, I was hoping to write some coherent usage documentation before providing you with a pre-release version to try out. I will probably finish the documentation by tomorrow. But since my pace slows down to a crawl during the documentation phase (a task I don't enjoy as much as coding), there will likely be some delays beyond that as well.

So, if you are keen on trying out FWDataViz earlier than that, you can use the zip files attached below. But please be sure to review my brief usage notes below. And, let me know if you need further clarifications or have any questions or feedback.
FWDataViz_x86_2.6.0.0-Pre.zip
FWDataViz_x64_2.6.0.0-Pre.zip

Side note:

  • If you need the DLLs from the latest commit CI build, you can obtain it from GitHub without reaching out to me. On the plugin repo page, click on Actions » CI_build and then click on the link for the top workflow run. The resulting page will list the DLL files from the CI builds for the commit.
  • For latest Notepad++ builds, go to the Notepad++ AppVeyor Build History page. Then click on the link for the latest completed build (the top one with a green line on its side). Then click the link for Release version to match your NPP environment. Finally, click the Artifacts tab link to view the exe download link.

I recommend that you use the menu option: Settings » Import » Import Plugin(s) and select the folder wherein you downloaded the zip file matching your Notepad++ version bitness. However, if you prefer to update FWDataViz selectively, you will need to copy these 4 files that are new/changed:

File Status Install Location
FWDataViz.dll Changed <Notepad++_executable_folder>/plugins/FWDataViz/
default_FoldStructs.ini New <Notepad++_executable_folder>/plugins/FWDataViz/
default_Visualizer.ini Changed <Notepad++_executable_folder>/plugins/FWDataViz/
Samples/Ouroboros.txt New <Notepad++_executable_folder>/plugins/FWDataViz/Samples/

Version Enhancements

Major Enhancements

  1. Foldable Record Blocks.
  2. [Side Panel] Default Background checkbox option to suppress the background colors specified in theme styles.
  3. [Side Panel] Show Calltip checkbox option to display inline Cursor Position Data.

Minor Enhancements

  1. [Side Panel] Fold and Unfold buttons for: All Levels and Level 1 to Level 10. These buttons are functional with any file (fixed-width or not) opened in Notepad++.
  2. [Side Panel] Toggle Line button to toggle between folded and unfolded states on the current line. This button is functional with any file (fixed-width or not) opened in Notepad++.
  3. [Preferences Dialog] Specify color and transparency for the horizontal demarcator lines drawn above and below the fold header text-line when the block it encloses is in collapsed state. This preference setting is applied globally for all files open in Notepad++.

Pending

  1. An editor GUI to define and modify record block structures for fixed-width file types (that have been defined either via the File Type Metadata Editor or directly in Visualizer.ini file). This editor will be implemented in due course for the next general release of FwDataViz.

Known Issues

  1. If you use Notepad++ menu options to fold levels, the text in the view page may end up partially colorized. However, if you move the caret (i.e., keyboard cursor) to a different position, the page will be fully colorized again. You can avoid this by using the Fold and Unfold buttons on the FWDataViz side panel.
  2. If you edit the data file, you may also need to click on the Apply button on the FWDataViz side panel to rescan the file and rebuild the new folding structure. No workaround for this, since any file edits may require a full file scan which will not be optimal if done automatically for each bit of file edit.

Brief Usage Notes

The definition scheme for record blocks will reside in the new FoldStructs.ini file. Upon the first run of Notepad++ after upgrading the FWDataViz dll, this new file will get copied into either of the two folder locations:

  1. %APPDATA%/Notepad++/plugins/Config/FWDataViz/ (for non-portable installs of NPP) or
  2. <Notepad++_executable_folder>/plugins/Config/FWDataViz/ (for portable installs of NPP)

FoldStructs.ini file layout

  • In the Base section, the FoldStructCount should indicate the number of file types that are being defined with folding record blocks.
  • Each file type will have its own section in the format FSnnn, starting with FS001.

With each file type section:

  • FileType value should exactly match the corresponding file type section name in the Visualizer.ini file.
  • FileLabel value should optionally match the corresponding FileLabel value in the Visualizer.ini file.
  • FoldLevelAuto values can be either Y or N. This will specify whether, after a file loads into the NPP editor, the plugin should automatically try to do a full file scan and apply the specified folding structure for the matching file type. Recommend setting this to N for file types with likely large data files, when this process can take a longer time.
  • HeaderRecords define a comma separated list of record types that will be headers for a folding record block. The record types should exactly match the corresponding record types for the file type in the Visualizer.ini file.
  • RECnnn_Priority value will specify the order priority for a record block. A block with lower numeric value of priority will enclose a block with higher numeric value of priority. Recommend using values in increments of 10, so that blocks that need to be added at a later time can be specified with intermediate values. For example, the outermost record block can have a priority of 10, the next record block that may be enclosed underneath it can have a priority of 20, and so on.
  • RECnnn_Recursive value will specify whether record blocks with same priority value should nest inside each other. For most data files, this value will be N. If this value is set to Y, the result will be a nested folding structure similar to the nesting in the pseudocode below.
IF (CONDITION#1) THEN
   IF (CONDITION#2) THEN
      IF (CONDITION#3) THEN
         ...
      END IF
   END IF
END IF
  • RECnnn_EndRecords value will specify record types that will terminate the record block. The end-record types should exactly match the corresponding record types for the file type in the Visualizer.ini file. The record blocks will auto-terminate with:
    • with end of file or
    • by another record block that outranks it (i.e., one with a lower numeric value of Priority) or
    • by another record block of the same rank when RECnnn_Recursive=N for the record block that will be terminated.
  • Outranking block termination: A record block with a lower numeric value of priority will terminate multiple levels of nested record blocks with higher numeric values of priority that are present above it in the data file.
  • Peer block termination: A peer record block will terminate a single level of record block with an equal numeric value of priority that is present above it in the data file.

Sample Files with Folding

View the sample files and then review their definitions in FoldStructs.ini file.

1. ICD-10 Billable-Flagged Order Codes

This file has the most basic record block folding with just two record types, and only one level of folding.
image

2. Treasury IPAC (ANSI) File

This file has three levels of hierarchical folding. Yet the structure is simple since no recursive nesting is involved.
image

3. Ouroboros Fold Levels

This sample file is named after the icon of a serpent eating its own tail. This contrived sample file is being included to showcase the full possibilities with the record block folding feature of FWDataViz.

  • Record type 1 (marker P3) is recursive and terminated by record type 2.
  • Record type 2 (marker Q4) is recursive and terminated by record type 3.
  • Record type 3 (marker R5) is recursive and terminated by record type 4.
  • Record type 4 (marker S6) is recursive and terminated by record type 1.
  • Record type 5 (marker TF) is non-recursive and terminates record types 1, 2, 3 & 4.

To gain better sense of the folding structure in this file, turn on the Show Calltip option on the side panel, and then click on lines 1 through 10. The last line in the calltip will indicate the fold level for the current line.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants