Code Browser

The CodeBrowser makes browsing through projects with multiple files and lots of functions easy, convenient and pleasant.

Requirements

  • Igor Pro version 6.3.0 or later

Installation

  1. Install Igor.
  2. Start Igor. This creates a folder called WaveMetrics in Documents. Close Igor.
  3. Extract the zip file into a folder somewhere on your disc.
  4. Create a link from CodeBrowser-v*/procedures to Documents\WaveMetrics\Igor Pro [6-8] User Files\Igor Procedures.
  5. Start Igor. You can now find CodeBrowser/Open in the main menu.

Features

  • Shows all functions/macros from a procedure file including parameter types, return types and special properties like static and threadsafe.
  • Shows Menu/Constant/StrConstant/Structure entries.
  • Shows the structure name for window hook and background tasks for easier searching.
  • Allows jumping to the definition of these elements within the code by mouse and keyboard.
  • Optionally alphabetically sorted lists.
  • Shows function comments as tooltips (IP8 only).
  • Works with Independent Modules.

For reasons of ease-of-use the function declarations are displayed as myFunction(var, str) -> var for a function taking a variable and string parameter and returning a variable. Programmers might recognize this as being inspired by the trailing return types from C++11.

  • CTRL+0: Open the panel.
  • Jump to the definition of the listbox selection with .
  • Pressing any character while the ListBox has the focus activates the first listbox entry which starts with that character.

Limitations

  • No parameter types are shown for macros

Screenshot

Screenshot of the Code Browser

Images:

Screenshot

Project Details

Current Project Release

Release File: CodeBrowser-v1.3.zip (25.46 KB)
Version Date:
Version Major: 1
Version Patch Level: 3
OS Compatibility: Windows Mac-Intel
Release Notes:

Features:

  • Add for Namespace and Procedures to select all items in the current listbox.
  • Add option to filter procedure files according to certain patterns like CodeBrowser*.
  • save last selected procedure, namespace, search, filter and listbox item in package preferences on codebrowser exit.
  • Add menu items to the list of elements.
  • Display the comment lines above the function definition as html formatted help text (QT, requires IP8)
  • Make CodeBrowser a floating panel
  • Performance enhancement by calling ProcedureText() only once.
  • Switch to rolling releases under BSD 3-clause on https://github.com/byte-physics/igor-code-browser
  • Support for structure name parsing in functions with only one structure as input like Window Hooks with WMWinHookStruct.
  • Partly switch to doxygen comments.
  • Internal changes to the BeforeQuitHook.
  • Internal changes to the global variable management and package folder cleanup.

Bugfixes:

  • Fix a bug where an empty function list was marked valid in "not compiled" state.
  • Fix variable deletion on Igor Exit.
  • Move initialized state from userdata to global variable because BeforeQuitHook is behaving strangly in some occasions.
  • Allow to jump to the selected procedure file in uncompiled state.
  • Fall back to last compiled state for display when procedures are not compiled.
  • Fix and enhance constant parsing.
  • Searching in empty procedures lead to a crash.
  • Fix parsing of nested Independent Modules.

     

The following people have contributed to this release:

$ git shortlog --no-merges -s -n v1.2..
    48  Matthias Kastner
    17  Thomas Braun

View All Releases

Hi Thomas,

Thank you very much for this nice package. I noticed that you have a IgorBeforeQuitHook() function in place which silently saves experiments in the background. I experienced that some aspects of experiment files were saved even though I didn't intend this when closing the program. I wonder what this is for and whether it is really necessary for the package. I would think this may lead to some undesired behavior.

Hi Stephan.

glad you like the package, and sorry to hear that it did not work on your end as expected. The purpose of the IgorBeforeQuitHook is to sync preferences to disk, kill internal data and the panel before closing. Killing the internal data and closing the panel is necessary to make the saved experiments smaller and also relieves us from the burden to need to handle old panels and internal data with new codebrowser versions.

Of course the bug you described should not happen either. I've now rewritten the hook to be safer, although with the drawback that the codebrowser data and panel is now kept. I've opened https://github.com/byte-physics/igor-code-browser/pull/59 with a fix. Please try that out. And in case you don't use git I can also make a zip available with that patch.

Thanks,
Thomas

Hi Thomas,

Thank you for the quick reply and the fix. The github link is fine for me. I am sorry, I should have given a more precise error report here. The problem is as follows: You may know that Igor does not set the unsaved state when just hiding / unhiding graphs, layouts etc. or changing their order (by bringing different graphs on top without moving any windows). I noticed that the code browser thus inevitably saves the new window state upon closing the application, which in effect alters the state of the experiment file (or at least how graphs are organized). I don't know which other actions 'fail' to trigger the unsaved state in Igor, but having the (unpatched) code browser loaded brought the risk to have such things saved behind the scenes. I think it is the right thing to take this part out. I also often have problems with users leaving stale panels open when saving experiments. Maybe in the future WaveMetrics invents temporary folders and panel states with special 'never save' labels to circumvent this problem.

Stephan

Hello Thomas,

I recently started using this package again. Is this still under development?

 

I noticed a few things which might be improved:

- It is possible to accidentally double-click the very top row of the list box, which returns a row of -1 and triggers an abort message. It may be better (less annoying) to just ignore such calls.

- If a function has no comment, then the tool tip just shows an empty box, which is confusing. Better show no tool tip in this case.

- constants show the standard list-box help text instead, which is also confusing.

- It would be better to have the contents of structures in multiple rows, especially if the structure contains many elements, which easily goes beyond any reasonable window size.

- The parser for structures seems to have some issues, which you can see, e.g., in the info for the WMResizeInfo structure of the code browser (two superfluous commas appear at the end).

- The 'jump to first letter via keyboard' function seems to work only occasionally. Often enough nothing happens (focus is somewhere else?)

 

It would also be nice to have the following conveniences:

- Sort and filter by type

- Find lines which uses the selected object within the code (e.g., via keyboard shortcut forward/backward search)

- Optionally offer a non-floating panel

- Offer options to select between different types of function-comments to display. For example, I have often comments on the same line as the function declaration (i.e., to the right of the code). Others might use the first lines below the function name.

- Offer option to filter certain characters from function comments before / after text, such as #, + *. If the comment is empty after filtering these characters, show no tooltip. This would also enable compatibility with Igor's own code marker comments.

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More