Page 1 of 1

Changing the "spelling" of some #defined functions

Posted: Mon Aug 21, 2017 8:48 am
by Edgar5
In file \DisplayWindow\DisplayWindow.h at or near line number #28
there are quite a few #defines of which these are two examples:

#define DisplayWindow_SetFont(hDisplay,hFont) \
SendMessage(hDisplay,DWM_SETFONT,hFont,0)

#define DisplayWindow_GetFont(hDisplay,hFont) \
SendMessage(hDisplay,DWM_GETFONT,hFont,0)

From the way they are titled they would appear to be specific to the
Display Window (the panel which displays information about selected
items and is gradient filled). From the way they are written they
would seem to be generic to any "window" (where "window" can refer to
windows, buttons, or other controls). Would it make sense to rename
these like:

#define Item_SetFont(hDisplay,hFont) \
SendMessage(hDisplay,DWM_SETFONT,hFont,0)

#define Item_GetFont(hDisplay,hFont) \
SendMessage(hDisplay,DWM_GETFONT,hFont,0)

replacing "DisplayWindow" with "Item", "Window" or something similar
So that it is more clear that they can be used generically?

Re: Changing the "spelling" of some #defined functions

Posted: Tue Aug 22, 2017 5:58 am
by Edgar5
Here's what I ended up with for my personal build:
#define Set_Window_ThumbnailFile(hDisplay,FileName,bShowImage) \
SendMessage(hDisplay,DWM_SETTHUMBNAILFILE,(WPARAM)FileName,(LPARAM)bShowImage)

//#define Get_Window_Surround_Color(hDisplay) \
//SendMessage(hDisplay,DWM_GETSURROUNDCOLOR,0,0)//efm5 unused

//#define Set_Window_Colors(hDisplay,rgbColor) \
//SendMessage(hDisplay,DWM_SETSURROUNDCOLOR,rgbColor,0)//efm5 unused

#define Set_Window_Font(hDisplay,hFont) \
SendMessage(hDisplay,DWM_SETFONT,hFont,0)

#define Get_Window_Font(hDisplay,hFont) \
SendMessage(hDisplay,DWM_GETFONT,hFont,0)

#define Get_Window_Text_Color(hDisplay) \
(COLORREF)SendMessage(hDisplay,DWM_GETTEXTCOLOR,0,0)

#define Set_Window_Text_Color(hDisplay,hColor) \
SendMessage(hDisplay,DWM_SETTEXTCOLOR,hColor,0)

//#define Save_Window_Settings(hDisplay,szKeyPath) \
//SendMessage(hDisplay,DWM_SAVESETTINGS,szKeyPath,0)//efm5 unused

//#define Load_Window_Settings(hDisplay,szKeyPath) \
//SendMessage(hDisplay,DWM_LOADSETTINGS,szKeyPath,0)//efm5 unused

//#define Window_Directory_Entered(hDisplay,szDirectory) \
//SendMessage(hDisplay,DWM_DIRECTORYENTERED,0,szDirectory)//efm5 unused

#define Send_Text_Buffer_To_Window(hDisplay,szText) \
SendMessage(hDisplay,DWM_BUFFERTEXT,(WPARAM)0,(LPARAM)szText)

#define Clear_Window_Text_Buffer(hDisplay) \
SendMessage(hDisplay,DWM_CLEARTEXTBUFFER,(WPARAM)0,(LPARAM)0)

#define Set_Window_Line(hDisplay,iLine,szText) \
SendMessage(hDisplay,DWM_SETLINE,(WPARAM)iLine,(LPARAM)szText)

Note that I have commented out a few of these which are not used anywhere but left them for future reference.