-
Notifications
You must be signed in to change notification settings - Fork 789
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Sorry about the four "Merge ..." commits. They are harmless and have no impact on the code; they are redundant with your "Merge ..." commits. |
Thank you!
There is no problem at all. |
Thank You !! |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use proper font for
View>Use Default Font
menu itemSymptom:
Use of the
View > Use Default Font
menu selection alwayssets 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 anin-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 bothDirectory 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 ofSegoe UI
has never been reflected in theOptions::Font
structure, nor in the Registry.By having the proper information in the 'default' value in the
Options::Font
structure, theView > Use Default Font
menuselection now works correctly.
Implementation:
The procedure
SetDefaults()
is modified to additionally capturethe 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 onlybe 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
structurenow always reflects the values of the in-memory structure, and
the values being used by the windows themselves.
Incidental changes:
order implied by the layout of the
LOGFONT
structure itself.Strikeout) to boolean to invoke the properly typed
Options::Font
procedures (
InitOption()
,SaveOption()
)String()
function references relating tofont in files Src/DirView.cpp and Src/MergeEditView.cpp