Friday, January 3, 2014

Program View – Edit Box Dependencies

Continuing with the reorganization of the program and edit box classes, the program view dock widget used in the main window class and is connected to the program unit, contained two minor dependencies on the edit box class the needed to be removed.  One of these dependencies required the edit box instance to be created before the program view widget could be initialized.

This dependency was that the font of the program view was set to the same fixed width font set in the edit box.  In was not necessary to use this font for the program view.  In fact, using the default proportional font uses less width than the fixed width font.  So the font of the program view widget is no longer set to the edit box font letting it use the default font.

The other dependency was in the creation of the program line delegate used to draw the program lines of the program view widget.  The base line number is passed to this delegate so that it knows what line number to use for the first program line.  This constant is currently set to zero so that the line numbers match the program line indexes to make debugging easier.  This constant was defined in the edit box class since it also needs this value.  To eliminate the dependency on the edit box class definition, this constant was moved to the main header file as a global definition.

[commit f06fa7c304]