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

Use proper font for View>Use Default Font menu item #24

Merged
merged 5 commits into from
Mar 21, 2017

Conversation

GreyMerlin
Copy link
Contributor

@GreyMerlin GreyMerlin commented Mar 20, 2017

Use proper font for View>Use Default Font menu item

Symptom:

Use of the View > Use Default Font menu selection always
sets the Directory Tree window to the 12-point Courier New font,
which is not the default font for that window.

Discussion:

WinMerge has an Options::Font structure that maintains an
in-memory copy of 'actual' and 'default' values for the font of
each of the Directory Tree and File View windows. This structure
is populated at program initialization by procedure SetDefaults()
in file Src/OptionFont.cpp. The 'default' values are generated by
this procedure, the 'actual' values are loaded from the Registry.

The existing code only queries the system for the default fixed-
size font (via the default MIME codepage) and then uses this font
as the 'default' value for the Options::Font structure for both
Directory and File windows. This value is typically Courier New.

However, WinMerge actually uses the Menu font as the actual Directory
window font if no other font is marked as 'Specified' in the
Registry. The default Menu font (for English, since Windows 7) is
Segoe UI. But this use of Segoe UI has never been reflected in the
Options::Font structure, nor in the Registry.

By having the proper information in the 'default' value in the
Options::Font structure, the View > Use Default Font menu
selection now works correctly.

Implementation:

  • The procedure SetDefaults() is modified to additionally capture
    the system-wide Menu font information via SystemParametersInfo()
    to be used for the Directory Tree window, while continuing to use the
    codepage MIME font for the File View window.

  • A "helper" function is added: InitializeLogFont(). It should only
    be used within Src/OptionFont.cpp. It is documented by comment in
    the Src/OptionFont.h file.

  • The information in the Registry for the Options::Font structure
    now always reflects the values of the in-memory structure, and
    the values being used by the windows themselves.

Incidental changes:

  • Numerous added or modified comments in Src/OptionFont.cpp
  • Reordering of all Registry related code to be in the canonical
    order implied by the layout of the LOGFONT structure itself.
  • Explicitly cast the three boolean values (Italic, Underline,
    Strikeout) to boolean to invoke the properly typed Options::Font
    procedures (InitOption(), SaveOption())
  • Remove two unnecessary String() function references relating to
    font in files Src/DirView.cpp and Src/MergeEditView.cpp

Symptom:
	Use of the 'View > Use Default Font' menu selection always
	sets the Directory Tree window to the 12-point Courier New font,
	which is not the default font for that window.

Discussion:
	WinMerge has an Options::Font structure that maintains an
	in-memory copy of 'actual' and 'default' values for the font of
	each of the Directory Tree and File View windows.  This structure
	is populated at program initialization by procedure SetDefaults()
	in file Src/OptionFont.cpp.  The 'default' values are generated by
	this procedure, the 'actual' values are loaded from the Registry.

	The existing code only queries the system for the default fixed-
	size font (via the default MIME codepage) and then uses this font
	as the 'default' value for the Options::Font structure for both
	Directory and File windows.  This value is typically Courier New.

	However, WinMerge actually uses the Menu font as the actual Directory
	window font if no other font is marked as 'Specified' in the
	Registry.  The default Menu font (for English, since Windows 7) is
	Segoe UI.  But this use of Segoe UI is never reflected in the
	Options::Font structure, nor in the Registry.

Implementation:
	The procedure SetDefaults() is modified to additionally
	capture the existing Menu font information for the Directory Tree
	window, while continuing to use the codepage MIME font for the
	File View window.

	A "helper" function is added: InitializeLogFont().  It should only
	be used within Src/OptionFont.cpp.  It is documented by comment in
	the Src/OptionFont.h file.

	The information in the Registry for the Options::Font structure
	now always reflects the values of the in-memory structure, and
	the values being used by the windows themselves.

Incidental changes:
* Numerous added or modified comments in Src/OptionFont.cpp
* Reordering of all Registry related code to be in the canonical
	order implied by the layout of the LOGFONT structure itself.
* Explicitly cast the three boolean values (Italic, Underline,
	Strikeout) to boolean to invoke the properly typed Options::Font
	procedures (InitOption, SaveOption)
* Remove two unnecessary String() function references relating to
	font in files Src/DirView.cpp and Src/MergeEditView.cpp
@GreyMerlin
Copy link
Contributor Author

Sorry about the four "Merge ..." commits. They are harmless and have no impact on the code; they are redundant with your "Merge ..." commits.

@sdottaka sdottaka merged commit 6f51af3 into WinMerge:master Mar 21, 2017
@sdottaka
Copy link
Member

sdottaka commented Mar 21, 2017

Thank you!

Sorry about the four "Merge ..." commits. They are harmless and have no impact on the code; they are redundant with your "Merge ..." commits.

There is no problem at all.

@GreyMerlin
Copy link
Contributor Author

Thank You !!

@GreyMerlin GreyMerlin deleted the bugfix/DefaultFonts branch March 21, 2017 18:00
sdottaka added a commit that referenced this pull request Feb 1, 2019
…tbucket-t-1548915674714 (pull request #24)

Russian.po edited online with Bitbucket

Approved-by: Timon34 <kaktebyavirubit@gmail.com>
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.

2 participants