xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
BBApi.cpp File Reference
#include "BBApi.h"
#include "..\Graphics\BImage.h"
#include "..\Plugins\PluginManager.h"
#include "..\Toolbar\Taskbar.h"
#include "..\Workspaces\Workspaces.h"
#include "..\Menu\MenuCommon.h"
#include "..\Desktop\Wallpaper.h"
#include <time.h>
#include <shellapi.h>
#include <shlwapi.h>
#include <versionhelpers.h>
#include <gdiplus.h>

Macros

#define WS_EX_LAYERED   0x00080000
 
#define LWA_COLORKEY   0x00000001
 
#define LWA_ALPHA   0x00000002
 

Typedefs

typedef vector< HWND > StickyWindowsVector
 
typedef BOOL(WINAPI * LPFN_WOW64_DISABLE_REDIRECTION) (PVOID)
 
typedef BOOL(WINAPI * LPFN_WOW64_REVERT_REDIRECTION) (PVOID)
 
typedef bool(__stdcall * slwaFunc) (HWND, COLORREF, BYTE, DWORD)
 

Functions

COLORREF ParseLiteralColor (LPCSTR color)
 
LPCSTR GetBBVersion ()
 
HWND GetBBWnd ()
 
LPCSTR GetOSInfo (void)
 
bool WINAPI GetBlackboxPath (LPSTR pszPath, int nMaxLen)
 
FILE * FileOpen (LPCSTR szPath)
 
bool FileClose (FILE *fp)
 
LPSTR Tokenize (LPCSTR string, LPSTR buf, LPSTR delims)
 
int BBTokenize (LPCSTR szString, char *lpszBuffers[], DWORD dwNumBuffers, LPSTR szExtraParameters)
 
LPSTR StrRemoveEncap (LPSTR string)
 
LPSTR ReadValue (LPCSTR fp, LPCSTR keyword, LPLONG ptr)
 
bool ReadBool (LPCSTR fp, LPCSTR szString, bool szDefault)
 
int ReadInt (LPCSTR fp, LPCSTR szString, int szDefault)
 
LPSTR ReadString (LPCSTR fp, LPCSTR szString, LPSTR szDefault)
 
COLORREF ReadColor (LPCSTR fp, LPCSTR szString, LPCSTR szDefault)
 
void * GetSettingPtr (int index)
 
void Log (LPCSTR des, LPCSTR line)
 
bool FileRead (FILE *stream, LPSTR string)
 
bool ReadNextCommand (FILE *f, LPSTR szBuffer, DWORD dwLength)
 
bool GetConfigFilePath (LPSTR filePath, LPCSTR setPath, LPCSTR checkName1, LPCSTR checkName2)
 
LPCSTR ConfigFileExists (LPCSTR filename, LPCSTR pluginDir)
 
bool FileExists (LPCSTR szFileName)
 
bool FolderExists (LPCSTR szFolderPath)
 
LPCSTR bbrcPath (LPCSTR other)
 
LPCSTR extensionsrcPath (LPCSTR other)
 
LPCSTR plugrcPath (LPCSTR other)
 
LPCSTR menuPath (LPCSTR other)
 
LPCSTR stylePath (LPCSTR other)
 
void GetBlackboxEditor (LPSTR editor)
 
int MBoxErrorFile (LPCSTR szFile)
 
int MBoxErrorValue (LPCSTR szValue)
 
HINSTANCE BBExecute (HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
 
void BBSmartExecute (LPSTR inputString)
 
bool IsAppWindow (HWND hWnd)
 
void SnapWindowToEdge (WINDOWPOS *pwPos, int nDist, bool bUseScreenSize)
 
void GetPositionEvolved (LPSTR placement, SIZE size, POINT *pt)
 
StyleItemFindStyleElement (LPSTR styleElement)
 
int GetMetricsEvolved (LPSTR styleElement, int metricsToInclude)
 
void MakeGradientSuper (HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth)
 
void MakeGradientEx (HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF split1, COLORREF split2, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth)
 
void MakeGradient (HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, bool interlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColor, int borderWidth)
 
bool MakeGradientEvolved (HDC hdc, RECT rect, LPSTR styleElement, bool drawBevel, bool drawBorder)
 
void MakeStyleGradient (HDC hdc, RECT *rect, StyleItem *item, bool withBorder)
 
void CreateBorder (HDC hdc, RECT *rect, int borderColour, int borderWidth)
 
void CreateBorderSuper (HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, int borderWidth)
 
void CreateElementImage (StyleItem *styleItem)
 
void DrawImageIntoRect (HDC hdc, RECT r, StyleItem *styleItem, bool useAlpha, bool drawBorder)
 
void AlphaRect (HDC hdc, RECT rect, unsigned char alpha)
 
void AlphaBorder (HDC hdc, RECT rect, unsigned char alpha, int borderWidth)
 
void AlphaCorner (HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth, unsigned char minAlpha, unsigned char maxAlpha)
 
void AlphaFromRGB (HDC hdc, RECT rect, unsigned char minAlpha, unsigned char maxAlpha, bool recolor, COLORREF color)
 
void AlphaMask (HDC destHdc, RECT destRect, HDC srcHdc, RECT srcRect, bool useSrcRGBAsAlpha)
 
void AlphaApply (HDC hdc, RECT rect)
 
void PrepareCorner (HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth)
 
int PrepareCornerEvolved (HDC hdc, RECT rect, int corner, LPSTR styleElement)
 
static int CALLBACK EnumFontFamProc (ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, int FontType, LPARAM lParam)
 
HFONT CreateStyleFont (StyleItem *item)
 
bool IsInString (LPCSTR inputString, LPCSTR searchString)
 
bool IsInStringUnicode (LPWSTR inputString, LPWSTR searchString)
 
void ParseItem (LPCSTR szItem, StyleItem *item)
 
void ReplaceEnvVars (LPSTR string)
 
void ReplaceShellFolders (LPSTR string)
 
void ParseFontString (LPSTR string, StyleItem *item)
 
void CheckFontSubstitution (LPSTR font)
 
MenuMakeMenu (LPCSTR HeaderText)
 
MenuMakeNamedMenu (LPCSTR HeaderText, LPCSTR MenuId, bool popup)
 
MenuItemMakeSubmenu (Menu *ParentMenu, Menu *ChildMenu, LPCSTR Title)
 
void DelMenu (Menu *PluginMenu)
 
MenuItemMakeMenuItem (Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, bool ShowIndicator)
 
MenuItemMakeMenuItemBool (Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, bool state, int selectionGroup)
 
MenuItemMakeMenuNOP (Menu *PluginMenu, LPCSTR Title)
 
MenuItemMakeMenuItemString (Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, LPCSTR init_string)
 
MenuItemMakeMenuItemInt (Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, int val, int minval, int maxval)
 
void ShowMenu (Menu *PluginMenu)
 
void MakeSticky (HWND window)
 
void RemoveSticky (HWND window)
 
bool CheckSticky (HWND window)
 
void ToggleSticky (HWND window)
 
void ClearSticky ()
 
bool SetTransparencyEx (HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
 
bool SetTransparency (HWND hwnd, BYTE alpha)
 
void WriteValue (LPCSTR fp, LPCSTR keyword, LPCSTR value)
 
void WriteBool (LPCSTR fp, LPCSTR keyword, bool value)
 
void WriteInt (LPCSTR fp, LPCSTR keyword, int value)
 
void WriteString (LPCSTR fp, LPCSTR keyword, LPSTR value)
 
void WriteColor (LPCSTR fp, LPCSTR keyword, COLORREF value)
 
int GetTraySize ()
 
trayIconItemGetTrayIcon (int pointer)
 
bool GetUnderExplorer ()
 
void GetDesktopInfo (DesktopInfo *deskInfo)
 
int GetTaskListSize ()
 
void SetTaskWorkspace (HWND hwnd, int workspace)
 
int GetTaskWorkspace (HWND hwnd)
 
HWND GetTask (int pointer)
 
int GetActiveTask ()
 
bool IsOnTaskbar (HWND hwnd)
 
HWND IsAppRunning (LPSTR path)
 
bool DownloadFile (LPCSTR url, LPCSTR path)
 
int ParseDropFiles (HWND hwnd, WPARAM wParam)
 
bool CopyStringToClipboard (LPSTR string)
 
bool RetrieveStringFromClipboard (LPSTR target)
 
void DrawTextWithEffectsEx (HDC hdc, RECT r, LPWSTR textUnicode, LPSTR textANSI, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
 
void DrawTextWithEffects (HDC hdc, RECT r, LPSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
 
void DrawTextWithEffectsUnicode (HDC hdc, RECT r, LPWSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
 
bool DrawTextEvolved (HDC hdc, RECT *rect, LPSTR styleElement, LPWSTR textUnicode, LPSTR textANSI, unsigned int fontHeightOverride, unsigned int format, bool getSize)
 
void DrawSatHueIcon (HDC hdc, RECT r, HICON icon, int size, int saturation, int hue)
 
void DrawGlyph (HDC hdc, RECT r, int glyph, COLORREF glyphColor)
 
int GetParentFolder (LPSTR path)
 
HMONITOR GetMonitorRect (void *from, RECT *r, int Flags)
 

Variables

BImagepBImage
 
MenupMenu
 
MenuCommonpMenuCommon
 
PluginManagerpPluginManager
 
TaskbarpTaskbar
 
WorkspacespWorkspaces
 
SettingspSettings
 
DesktoppDesktop
 
WallpaperpWallpaper
 
static char tempBuf [MAX_LINE_LENGTH]
 
static char lineFromFile [MAX_LINE_LENGTH+1]
 
StickyWindowsVector stickyWindows
 
HWND hBlackbox = NULL
 
bool hideNamedMenu = false
 
static char szTempBuffer [MAX_LINE_LENGTH]
 
RECT gradientRect
 
BYTE red
 
BYTE green
 
BYTE blue
 
BYTE greyscale
 
BYTE destred
 
BYTE destgreen
 
BYTE destblue
 
COLORREF pixel
 
int invsat
 
int invhue
 

Macro Definition Documentation

◆ WS_EX_LAYERED

#define WS_EX_LAYERED   0x00080000

◆ LWA_COLORKEY

#define LWA_COLORKEY   0x00000001

◆ LWA_ALPHA

#define LWA_ALPHA   0x00000002

Typedef Documentation

◆ StickyWindowsVector

typedef vector<HWND> StickyWindowsVector

◆ LPFN_WOW64_DISABLE_REDIRECTION

typedef BOOL(WINAPI * LPFN_WOW64_DISABLE_REDIRECTION) (PVOID)

◆ LPFN_WOW64_REVERT_REDIRECTION

typedef BOOL(WINAPI * LPFN_WOW64_REVERT_REDIRECTION) (PVOID)

◆ slwaFunc

typedef bool(__stdcall * slwaFunc) (HWND, COLORREF, BYTE, DWORD)

Function Documentation

◆ ParseLiteralColor()

COLORREF ParseLiteralColor ( LPCSTR color)
1014{
1015 int i = strchr(colour, ' ') - colour;
1016 while (i > 0)
1017 {
1018 memmove ( (VOID*) (colour + i), (VOID*) (colour + i + 1), strlen (colour) - i );
1019 i = strchr(colour, ' ') - colour;
1020 }
1021
1022 //====================
1023
1024 if (!_strnicmp(colour, "gray", 4) || !_strnicmp(colour, "grey", 4))
1025 {
1026 i = strlen(colour);
1027 if (i > 5)
1028 {
1029 float tmp = (float)(2.55 * atoi(colour+4));
1030 i = (int)(tmp + .5);
1031 if (i < (int)tmp) i = (int)tmp;
1032 return RGB(i,i,i);
1033 }
1034 else return RGB(80,80,80);
1035 }
1036
1037 char firstCharacter = colour[0];
1038
1039 //====================
1040
1041 switch (colour[0])
1042 {
1043 case 'a': //====================
1044 {
1045 if (! _stricmp(colour, "aliceblue")) return RGB(240,248,255);
1046 else if (! _stricmp(colour, "antiquewhite")) return RGB(250,235,215);
1047 else if (! _stricmp(colour, "aquamarine")) return RGB(127,255,212);
1048 else if (! _stricmp(colour, "azure")) return RGB(240,255,255);
1049/*
1050 else if (! _stricmp(colour, "antiquewhite1")) return RGB(255,239,219);
1051 else if (! _stricmp(colour, "antiquewhite2")) return RGB(238,223,204);
1052 else if (! _stricmp(colour, "antiquewhite3")) return RGB(205,192,176);
1053 else if (! _stricmp(colour, "antiquewhite4")) return RGB(139,131,120);
1054 else if (! _stricmp(colour, "aquamarine1")) return RGB(127,255,212);
1055 else if (! _stricmp(colour, "aquamarine2")) return RGB(118,238,198);
1056 else if (! _stricmp(colour, "aquamarine3")) return RGB(102,205,170);
1057 else if (! _stricmp(colour, "aquamarine4")) return RGB(69,139,116);
1058 else if (! _stricmp(colour, "azure1")) return RGB(240,255,255);
1059 else if (! _stricmp(colour, "azure2")) return RGB(224,238,238);
1060 else if (! _stricmp(colour, "azure3")) return RGB(193,205,205);
1061 else if (! _stricmp(colour, "azure4")) return RGB(131,139,139);
1062*/
1063 }
1064 case 'b': //====================
1065 {
1066 if (! _stricmp(colour, "beige")) return RGB(245,245,220);
1067 else if (! _stricmp(colour, "bisque")) return RGB(255,228,196);
1068 else if (! _stricmp(colour, "black")) return RGB(0,0,0);
1069 else if (! _stricmp(colour, "blanchedalmond")) return RGB(255,235,205);
1070 else if (! _stricmp(colour, "blue")) return RGB(0,0,255);
1071 else if (! _stricmp(colour, "blueviolet")) return RGB(138,43,226);
1072 else if (! _stricmp(colour, "brown")) return RGB(165,42,42);
1073 else if (! _stricmp(colour, "burlywood")) return RGB(222,184,135);
1074/*
1075 else if (! _stricmp(colour, "bisque1")) return RGB(255,228,196);
1076 else if (! _stricmp(colour, "bisque2")) return RGB(238,213,183);
1077 else if (! _stricmp(colour, "bisque3")) return RGB(205,183,158);
1078 else if (! _stricmp(colour, "bisque4")) return RGB(139,125,107);
1079 else if (! _stricmp(colour, "blue1")) return RGB(0,0,255);
1080 else if (! _stricmp(colour, "blue2")) return RGB(0,0,238);
1081 else if (! _stricmp(colour, "blue3")) return RGB(0,0,205);
1082 else if (! _stricmp(colour, "blue4")) return RGB(0,0,139);
1083 else if (! _stricmp(colour, "brown1")) return RGB(255,64,64);
1084 else if (! _stricmp(colour, "brown2")) return RGB(238,59,59);
1085 else if (! _stricmp(colour, "brown3")) return RGB(205,51,51);
1086 else if (! _stricmp(colour, "brown4")) return RGB(139,35,35);
1087 else if (! _stricmp(colour, "burlywood1")) return RGB(255,211,155);
1088 else if (! _stricmp(colour, "burlywood2")) return RGB(238,197,145);
1089 else if (! _stricmp(colour, "burlywood3")) return RGB(205,170,125);
1090 else if (! _stricmp(colour, "burlywood4")) return RGB(139,115,85);
1091*/
1092 }
1093 case 'c': //====================
1094 {
1095 if (! _stricmp(colour, "cadetblue")) return RGB(95,158,160);
1096 else if (! _stricmp(colour, "chartreuse")) return RGB(127,255,0);
1097 else if (! _stricmp(colour, "chocolate")) return RGB(210,105,30);
1098 else if (! _stricmp(colour, "coral")) return RGB(255,127,80);
1099 else if (! _stricmp(colour, "cornflowerblue")) return RGB(100,149,237);
1100 else if (! _stricmp(colour, "cornsilk")) return RGB(255,248,220);
1101 else if (! _stricmp(colour, "cyan")) return RGB(0,255,255);
1102/*
1103 else if (! _stricmp(colour, "cadetblue1")) return RGB(152,245,255);
1104 else if (! _stricmp(colour, "cadetblue2")) return RGB(142,229,238);
1105 else if (! _stricmp(colour, "cadetblue3")) return RGB(122,197,205);
1106 else if (! _stricmp(colour, "cadetblue4")) return RGB(83,134,139);
1107 else if (! _stricmp(colour, "chartreuse1")) return RGB(127,255,0);
1108 else if (! _stricmp(colour, "chartreuse2")) return RGB(118,238,0);
1109 else if (! _stricmp(colour, "chartreuse3")) return RGB(102,205,0);
1110 else if (! _stricmp(colour, "chartreuse4")) return RGB(69,139,0);
1111 else if (! _stricmp(colour, "chocolate1")) return RGB(255,127,36);
1112 else if (! _stricmp(colour, "chocolate2")) return RGB(238,118,33);
1113 else if (! _stricmp(colour, "chocolate3")) return RGB(205,102,29);
1114 else if (! _stricmp(colour, "chocolate4")) return RGB(139,69,19);
1115 else if (! _stricmp(colour, "coral1")) return RGB(255,114,86);
1116 else if (! _stricmp(colour, "coral2")) return RGB(238,106,80);
1117 else if (! _stricmp(colour, "coral3")) return RGB(205,91,69);
1118 else if (! _stricmp(colour, "coral4")) return RGB(139,62,47);
1119 else if (! _stricmp(colour, "cornsilk1")) return RGB(255,248,220);
1120 else if (! _stricmp(colour, "cornsilk2")) return RGB(238,232,205);
1121 else if (! _stricmp(colour, "cornsilk3")) return RGB(205,200,177);
1122 else if (! _stricmp(colour, "cornsilk4")) return RGB(139,136,120);
1123 else if (! _stricmp(colour, "cyan1")) return RGB(0,255,255);
1124 else if (! _stricmp(colour, "cyan2")) return RGB(0,238,238);
1125 else if (! _stricmp(colour, "cyan3")) return RGB(0,205,205);
1126 else if (! _stricmp(colour, "cyan4")) return RGB(0,139,139);
1127*/
1128 }
1129 case 'd': //====================
1130 {
1131 if (! _stricmp(colour, "darkblue")) return RGB(0,0,139);
1132 else if (! _stricmp(colour, "darkcyan")) return RGB(0,139,139);
1133 else if (! _stricmp(colour, "darkgoldenrod")) return RGB(184,134,11);
1134 else if (! _stricmp(colour, "darkgray")) return RGB(169,169,169);
1135 else if (! _stricmp(colour, "darkgreen")) return RGB(0,100,0);
1136 else if (! _stricmp(colour, "darkgrey")) return RGB(169,169,169);
1137 else if (! _stricmp(colour, "darkkhaki")) return RGB(189,183,107);
1138 else if (! _stricmp(colour, "darkmagenta")) return RGB(139,0,139);
1139 else if (! _stricmp(colour, "darkolivegreen")) return RGB(85,107,47);
1140 else if (! _stricmp(colour, "darkorange")) return RGB(255,140,0);
1141 else if (! _stricmp(colour, "darkorchid")) return RGB(153,50,204);
1142 else if (! _stricmp(colour, "darkred")) return RGB(139,0,0);
1143 else if (! _stricmp(colour, "darksalmon")) return RGB(233,150,122);
1144 else if (! _stricmp(colour, "darkseagreen")) return RGB(143,188,143);
1145 else if (! _stricmp(colour, "darkslateblue")) return RGB(72,61,139);
1146 else if (! _stricmp(colour, "darkslategray")) return RGB(47,79,79);
1147 else if (! _stricmp(colour, "darkslategrey")) return RGB(47,79,79);
1148 else if (! _stricmp(colour, "darkturquoise")) return RGB(0,206,209);
1149 else if (! _stricmp(colour, "darkviolet")) return RGB(148,0,211);
1150 else if (! _stricmp(colour, "deeppink")) return RGB(255,20,147);
1151 else if (! _stricmp(colour, "deepskyblue")) return RGB(0,191,255);
1152 else if (! _stricmp(colour, "dimgray")) return RGB(105,105,105);
1153 else if (! _stricmp(colour, "dimgrey")) return RGB(105,105,105);
1154 else if (! _stricmp(colour, "dodgerblue")) return RGB(30,144,255);
1155/*
1156 else if (! _stricmp(colour, "darkgoldenrod1")) return RGB(255,185,15);
1157 else if (! _stricmp(colour, "darkgoldenrod2")) return RGB(238,173,14);
1158 else if (! _stricmp(colour, "darkgoldenrod3")) return RGB(205,149,12);
1159 else if (! _stricmp(colour, "darkgoldenrod4")) return RGB(139,101,8);
1160 else if (! _stricmp(colour, "darkolivegreen1")) return RGB(202,255,112);
1161 else if (! _stricmp(colour, "darkolivegreen2")) return RGB(188,238,104);
1162 else if (! _stricmp(colour, "darkolivegreen3")) return RGB(162,205,90);
1163 else if (! _stricmp(colour, "darkolivegreen4")) return RGB(110,139,61);
1164 else if (! _stricmp(colour, "darkorange1")) return RGB(255,127,0);
1165 else if (! _stricmp(colour, "darkorange2")) return RGB(238,118,0);
1166 else if (! _stricmp(colour, "darkorange3")) return RGB(205,102,0);
1167 else if (! _stricmp(colour, "darkorange4")) return RGB(139,69,0);
1168 else if (! _stricmp(colour, "darkorchid1")) return RGB(191,62,255);
1169 else if (! _stricmp(colour, "darkorchid2")) return RGB(178,58,238);
1170 else if (! _stricmp(colour, "darkorchid3")) return RGB(154,50,205);
1171 else if (! _stricmp(colour, "darkorchid4")) return RGB(104,34,139);
1172 else if (! _stricmp(colour, "darkseagreen1")) return RGB(193,255,193);
1173 else if (! _stricmp(colour, "darkseagreen2")) return RGB(180,238,180);
1174 else if (! _stricmp(colour, "darkseagreen3")) return RGB(155,205,155);
1175 else if (! _stricmp(colour, "darkseagreen4")) return RGB(105,139,105);
1176 else if (! _stricmp(colour, "deeppink1")) return RGB(255,20,147);
1177 else if (! _stricmp(colour, "deeppink2")) return RGB(238,18,137);
1178 else if (! _stricmp(colour, "deeppink3")) return RGB(205,16,118);
1179 else if (! _stricmp(colour, "deeppink4")) return RGB(139,10,80);
1180 else if (! _stricmp(colour, "deepskyblue1")) return RGB(0,191,255);
1181 else if (! _stricmp(colour, "deepskyblue2")) return RGB(0,178,238);
1182 else if (! _stricmp(colour, "deepskyblue3")) return RGB(0,154,205);
1183 else if (! _stricmp(colour, "deepskyblue4")) return RGB(0,104,139);
1184 else if (! _stricmp(colour, "darkslategray1")) return RGB(151,255,255);
1185 else if (! _stricmp(colour, "darkslategray2")) return RGB(141,238,238);
1186 else if (! _stricmp(colour, "darkslategray3")) return RGB(121,205,205);
1187 else if (! _stricmp(colour, "darkslategray4")) return RGB(82,139,139);
1188 else if (! _stricmp(colour, "dodgerblue1")) return RGB(30,144,255);
1189 else if (! _stricmp(colour, "dodgerblue2")) return RGB(28,134,238);
1190 else if (! _stricmp(colour, "dodgerblue3")) return RGB(24,116,205);
1191 else if (! _stricmp(colour, "dodgerblue4")) return RGB(16,78,139);
1192*/
1193 }
1194 case 'f': //====================
1195 {
1196 if (! _stricmp(colour, "firebrick")) return RGB(178,34,34);
1197 else if (! _stricmp(colour, "floralwhite")) return RGB(255,250,240);
1198 else if (! _stricmp(colour, "forestgreen")) return RGB(34,139,34);
1199/*
1200 else if (! _stricmp(colour, "firebrick1")) return RGB(255,48,48);
1201 else if (! _stricmp(colour, "firebrick2")) return RGB(238,44,44);
1202 else if (! _stricmp(colour, "firebrick3")) return RGB(205,38,38);
1203 else if (! _stricmp(colour, "firebrick4")) return RGB(139,26,26);
1204*/
1205 }
1206 case 'g': //====================
1207 {
1208 if (! _stricmp(colour, "gainsboro")) return RGB(220,220,220);
1209 else if (! _stricmp(colour, "ghostwhite")) return RGB(248,248,255);
1210 else if (! _stricmp(colour, "gold")) return RGB(255,215,0);
1211 else if (! _stricmp(colour, "goldenrod")) return RGB(218,165,32);
1212 else if (! _stricmp(colour, "gray")) return RGB(190,190,190);
1213 else if (! _stricmp(colour, "green")) return RGB(0,255,0);
1214 else if (! _stricmp(colour, "greenyellow")) return RGB(173,255,47);
1215 else if (! _stricmp(colour, "grey")) return RGB(190,190,190);
1216/*
1217 else if (! _stricmp(colour, "gold1")) return RGB(255,215,0);
1218 else if (! _stricmp(colour, "gold2")) return RGB(238,201,0);
1219 else if (! _stricmp(colour, "gold3")) return RGB(205,173,0);
1220 else if (! _stricmp(colour, "gold4")) return RGB(139,117,0);
1221 else if (! _stricmp(colour, "goldenrod1")) return RGB(255,193,37);
1222 else if (! _stricmp(colour, "goldenrod2")) return RGB(238,180,34);
1223 else if (! _stricmp(colour, "goldenrod3")) return RGB(205,155,29);
1224 else if (! _stricmp(colour, "goldenrod4")) return RGB(139,105,20);
1225 else if (! _stricmp(colour, "green1")) return RGB(0,255,0);
1226 else if (! _stricmp(colour, "green2")) return RGB(0,238,0);
1227 else if (! _stricmp(colour, "green3")) return RGB(0,205,0);
1228 else if (! _stricmp(colour, "green4")) return RGB(0,139,0);
1229*/
1230 }
1231 case 'h': //====================
1232 {
1233 if (! _stricmp(colour, "honeydew")) return RGB(240,255,240);
1234 else if (! _stricmp(colour, "hotpink")) return RGB(255,105,180);
1235/*
1236 else if (! _stricmp(colour, "honeydew1")) return RGB(240,255,240);
1237 else if (! _stricmp(colour, "honeydew2")) return RGB(224,238,224);
1238 else if (! _stricmp(colour, "honeydew3")) return RGB(193,205,193);
1239 else if (! _stricmp(colour, "honeydew4")) return RGB(131,139,131);
1240 else if (! _stricmp(colour, "hotpink1")) return RGB(255,110,180);
1241 else if (! _stricmp(colour, "hotpink2")) return RGB(238,106,167);
1242 else if (! _stricmp(colour, "hotpink3")) return RGB(205,96,144);
1243 else if (! _stricmp(colour, "hotpink4")) return RGB(139,58,98);
1244*/
1245 }
1246 case 'i': //====================
1247 {
1248 if (! _stricmp(colour, "indianred")) return RGB(205,92,92);
1249 else if (! _stricmp(colour, "ivory")) return RGB(255,255,240);
1250/*
1251 else if (! _stricmp(colour, "indianred1")) return RGB(255,106,106);
1252 else if (! _stricmp(colour, "indianred2")) return RGB(238,99,99);
1253 else if (! _stricmp(colour, "indianred3")) return RGB(205,85,85);
1254 else if (! _stricmp(colour, "indianred4")) return RGB(139,58,58);
1255 else if (! _stricmp(colour, "ivory1")) return RGB(255,255,240);
1256 else if (! _stricmp(colour, "ivory2")) return RGB(238,238,224);
1257 else if (! _stricmp(colour, "ivory3")) return RGB(205,205,193);
1258 else if (! _stricmp(colour, "ivory4")) return RGB(139,139,131);
1259*/
1260 }
1261 case 'k': //====================
1262 {
1263 if (! _stricmp(colour, "khaki")) return RGB(240,230,140);
1264/*
1265 else if (! _stricmp(colour, "khaki1")) return RGB(255,246,143);
1266 else if (! _stricmp(colour, "khaki2")) return RGB(238,230,133);
1267 else if (! _stricmp(colour, "khaki3")) return RGB(205,198,115);
1268 else if (! _stricmp(colour, "khaki4")) return RGB(139,134,78);
1269*/
1270 }
1271 case 'l': //====================
1272 {
1273 if (! _stricmp(colour, "lavender")) return RGB(230,230,250);
1274 else if (! _stricmp(colour, "lavenderblush")) return RGB(255,240,245);
1275 else if (! _stricmp(colour, "lawngreen")) return RGB(124,252,0);
1276 else if (! _stricmp(colour, "lemonchiffon")) return RGB(255,250,205);
1277 else if (! _stricmp(colour, "lightblue")) return RGB(173,216,230);
1278 else if (! _stricmp(colour, "lightcoral")) return RGB(240,128,128);
1279 else if (! _stricmp(colour, "lightcyan")) return RGB(224,255,255);
1280 else if (! _stricmp(colour, "lightgoldenrod")) return RGB(238,221,130);
1281 else if (! _stricmp(colour, "lightgoldenrodyellow")) return RGB(250,250,210);
1282 else if (! _stricmp(colour, "lightgray")) return RGB(211,211,211);
1283 else if (! _stricmp(colour, "lightgreen")) return RGB(144,238,144);
1284 else if (! _stricmp(colour, "lightgrey")) return RGB(211,211,211);
1285 else if (! _stricmp(colour, "lightpink")) return RGB(255,182,193);
1286 else if (! _stricmp(colour, "lightsalmon")) return RGB(255,160,122);
1287 else if (! _stricmp(colour, "lightseagreen")) return RGB(32,178,170);
1288 else if (! _stricmp(colour, "lightskyblue")) return RGB(135,206,250);
1289 else if (! _stricmp(colour, "lightslateblue")) return RGB(132,112,255);
1290 else if (! _stricmp(colour, "lightslategray")) return RGB(119,136,153);
1291 else if (! _stricmp(colour, "lightslategrey")) return RGB(119,136,153);
1292 else if (! _stricmp(colour, "lightsteelblue")) return RGB(176,196,222);
1293 else if (! _stricmp(colour, "lightyellow")) return RGB(255,255,224);
1294 else if (! _stricmp(colour, "limegreen")) return RGB(50,205,50);
1295 else if (! _stricmp(colour, "linen")) return RGB(250,240,230);
1296/*
1297 else if (! _stricmp(colour, "lavenderblush1")) return RGB(255,240,245);
1298 else if (! _stricmp(colour, "lavenderblush2")) return RGB(238,224,229);
1299 else if (! _stricmp(colour, "lavenderblush3")) return RGB(205,193,197);
1300 else if (! _stricmp(colour, "lavenderblush4")) return RGB(139,131,134);
1301 else if (! _stricmp(colour, "lemonchiffon1")) return RGB(255,250,205);
1302 else if (! _stricmp(colour, "lemonchiffon2")) return RGB(238,233,191);
1303 else if (! _stricmp(colour, "lemonchiffon3")) return RGB(205,201,165);
1304 else if (! _stricmp(colour, "lemonchiffon4")) return RGB(139,137,112);
1305 else if (! _stricmp(colour, "lightblue1")) return RGB(191,239,255);
1306 else if (! _stricmp(colour, "lightblue2")) return RGB(178,223,238);
1307 else if (! _stricmp(colour, "lightblue3")) return RGB(154,192,205);
1308 else if (! _stricmp(colour, "lightblue4")) return RGB(104,131,139);
1309 else if (! _stricmp(colour, "lightcyan1")) return RGB(224,255,255);
1310 else if (! _stricmp(colour, "lightcyan2")) return RGB(209,238,238);
1311 else if (! _stricmp(colour, "lightcyan3")) return RGB(180,205,205);
1312 else if (! _stricmp(colour, "lightcyan4")) return RGB(122,139,139);
1313 else if (! _stricmp(colour, "lightgoldenrod1")) return RGB(255,236,139);
1314 else if (! _stricmp(colour, "lightgoldenrod2")) return RGB(238,220,130);
1315 else if (! _stricmp(colour, "lightgoldenrod3")) return RGB(205,190,112);
1316 else if (! _stricmp(colour, "lightgoldenrod4")) return RGB(139,129,76);
1317 else if (! _stricmp(colour, "lightpink1")) return RGB(255,174,185);
1318 else if (! _stricmp(colour, "lightpink2")) return RGB(238,162,173);
1319 else if (! _stricmp(colour, "lightpink3")) return RGB(205,140,149);
1320 else if (! _stricmp(colour, "lightpink4")) return RGB(139,95,101);
1321 else if (! _stricmp(colour, "lightsalmon1")) return RGB(255,160,122);
1322 else if (! _stricmp(colour, "lightsalmon2")) return RGB(238,149,114);
1323 else if (! _stricmp(colour, "lightsalmon3")) return RGB(205,129,98);
1324 else if (! _stricmp(colour, "lightsalmon4")) return RGB(139,87,66);
1325 else if (! _stricmp(colour, "lightskyblue1")) return RGB(176,226,255);
1326 else if (! _stricmp(colour, "lightskyblue2")) return RGB(164,211,238);
1327 else if (! _stricmp(colour, "lightskyblue3")) return RGB(141,182,205);
1328 else if (! _stricmp(colour, "lightskyblue4")) return RGB(96,123,139);
1329 else if (! _stricmp(colour, "lightsteelblue1")) return RGB(202,225,255);
1330 else if (! _stricmp(colour, "lightsteelblue2")) return RGB(188,210,238);
1331 else if (! _stricmp(colour, "lightsteelblue3")) return RGB(162,181,205);
1332 else if (! _stricmp(colour, "lightsteelblue4")) return RGB(110,123,139);
1333 else if (! _stricmp(colour, "lightyellow1")) return RGB(255,255,224);
1334 else if (! _stricmp(colour, "lightyellow2")) return RGB(238,238,209);
1335 else if (! _stricmp(colour, "lightyellow3")) return RGB(205,205,180);
1336 else if (! _stricmp(colour, "lightyellow4")) return RGB(139,139,122);
1337*/
1338 }
1339 case 'm': //====================
1340 {
1341 if (! _stricmp(colour, "magenta")) return RGB(255,0,255);
1342 else if (! _stricmp(colour, "maroon")) return RGB(176,48,96);
1343 else if (! _stricmp(colour, "mediumaquamarine")) return RGB(102,205,170);
1344 else if (! _stricmp(colour, "mediumblue")) return RGB(0,0,205);
1345 else if (! _stricmp(colour, "mediumorchid")) return RGB(186,85,211);
1346 else if (! _stricmp(colour, "mediumpurple")) return RGB(147,112,219);
1347 else if (! _stricmp(colour, "mediumseagreen")) return RGB(60,179,113);
1348 else if (! _stricmp(colour, "mediumslateblue")) return RGB(123,104,238);
1349 else if (! _stricmp(colour, "mediumspringgreen")) return RGB(0,250,154);
1350 else if (! _stricmp(colour, "mediumturquoise")) return RGB(72,209,204);
1351 else if (! _stricmp(colour, "mediumvioletred")) return RGB(199,21,133);
1352 else if (! _stricmp(colour, "midnightblue")) return RGB(25,25,112);
1353 else if (! _stricmp(colour, "mintcream")) return RGB(245,255,250);
1354 else if (! _stricmp(colour, "mistyrose")) return RGB(255,228,225);
1355 else if (! _stricmp(colour, "moccasin")) return RGB(255,228,181);
1356/*
1357 else if (! _stricmp(colour, "magenta1")) return RGB(255,0,255);
1358 else if (! _stricmp(colour, "magenta2")) return RGB(238,0,238);
1359 else if (! _stricmp(colour, "magenta3")) return RGB(205,0,205);
1360 else if (! _stricmp(colour, "magenta4")) return RGB(139,0,139);
1361 else if (! _stricmp(colour, "maroon1")) return RGB(255,52,179);
1362 else if (! _stricmp(colour, "maroon2")) return RGB(238,48,167);
1363 else if (! _stricmp(colour, "maroon3")) return RGB(205,41,144);
1364 else if (! _stricmp(colour, "maroon4")) return RGB(139,28,98);
1365 else if (! _stricmp(colour, "mediumorchid1")) return RGB(224,102,255);
1366 else if (! _stricmp(colour, "mediumorchid2")) return RGB(209,95,238);
1367 else if (! _stricmp(colour, "mediumorchid3")) return RGB(180,82,205);
1368 else if (! _stricmp(colour, "mediumorchid4")) return RGB(122,55,139);
1369 else if (! _stricmp(colour, "mediumpurple1")) return RGB(171,130,255);
1370 else if (! _stricmp(colour, "mediumpurple2")) return RGB(159,121,238);
1371 else if (! _stricmp(colour, "mediumpurple3")) return RGB(137,104,205);
1372 else if (! _stricmp(colour, "mediumpurple4")) return RGB(93,71,139);
1373 else if (! _stricmp(colour, "mistyrose1")) return RGB(255,228,225);
1374 else if (! _stricmp(colour, "mistyrose2")) return RGB(238,213,210);
1375 else if (! _stricmp(colour, "mistyrose3")) return RGB(205,183,181);
1376 else if (! _stricmp(colour, "mistyrose4")) return RGB(139,125,123);
1377*/
1378 }
1379 case 'n': //====================
1380 {
1381 if (! _stricmp(colour, "navajowhite")) return RGB(255,222,173);
1382 else if (! _stricmp(colour, "navy")) return RGB(0,0,128);
1383 else if (! _stricmp(colour, "navyblue")) return RGB(0,0,128);
1384/*
1385 else if (! _stricmp(colour, "navajowhite1")) return RGB(255,222,173);
1386 else if (! _stricmp(colour, "navajowhite2")) return RGB(238,207,161);
1387 else if (! _stricmp(colour, "navajowhite3")) return RGB(205,179,139);
1388 else if (! _stricmp(colour, "navajowhite4")) return RGB(139,121,94);
1389*/
1390 }
1391 case 'o': //====================
1392 {
1393 if (! _stricmp(colour, "oldlace")) return RGB(253,245,230);
1394 else if (! _stricmp(colour, "olivedrab")) return RGB(107,142,35);
1395 else if (! _stricmp(colour, "orange")) return RGB(255,165,0);
1396 else if (! _stricmp(colour, "orangered")) return RGB(255,69,0);
1397 else if (! _stricmp(colour, "orchid")) return RGB(218,112,214);
1398/*
1399 else if (! _stricmp(colour, "olivedrab1")) return RGB(192,255,62);
1400 else if (! _stricmp(colour, "olivedrab2")) return RGB(179,238,58);
1401 else if (! _stricmp(colour, "olivedrab3")) return RGB(154,205,50);
1402 else if (! _stricmp(colour, "olivedrab4")) return RGB(105,139,34);
1403 else if (! _stricmp(colour, "orange1")) return RGB(255,165,0);
1404 else if (! _stricmp(colour, "orange2")) return RGB(238,154,0);
1405 else if (! _stricmp(colour, "orange3")) return RGB(205,133,0);
1406 else if (! _stricmp(colour, "orange4")) return RGB(139,90,0);
1407 else if (! _stricmp(colour, "orangered1")) return RGB(255,69,0);
1408 else if (! _stricmp(colour, "orangered2")) return RGB(238,64,0);
1409 else if (! _stricmp(colour, "orangered3")) return RGB(205,55,0);
1410 else if (! _stricmp(colour, "orangered4")) return RGB(139,37,0);
1411 else if (! _stricmp(colour, "orchid1")) return RGB(255,131,250);
1412 else if (! _stricmp(colour, "orchid2")) return RGB(238,122,233);
1413 else if (! _stricmp(colour, "orchid3")) return RGB(205,105,201);
1414 else if (! _stricmp(colour, "orchid4")) return RGB(139,71,137);
1415*/
1416 }
1417 case 'p': //====================
1418 {
1419 if (! _stricmp(colour, "palegoldenrod")) return RGB(238,232,170);
1420 else if (! _stricmp(colour, "palegreen")) return RGB(152,251,152);
1421 else if (! _stricmp(colour, "paleturquoise")) return RGB(175,238,238);
1422 else if (! _stricmp(colour, "palevioletred")) return RGB(219,112,147);
1423 else if (! _stricmp(colour, "papayawhip")) return RGB(255,239,213);
1424 else if (! _stricmp(colour, "peachpuff")) return RGB(255,218,185);
1425 else if (! _stricmp(colour, "peru")) return RGB(205,133,63);
1426 else if (! _stricmp(colour, "pink")) return RGB(255,192,203);
1427 else if (! _stricmp(colour, "plum")) return RGB(221,160,221);
1428 else if (! _stricmp(colour, "powderblue")) return RGB(176,224,230);
1429 else if (! _stricmp(colour, "purple")) return RGB(160,32,240);
1430/*
1431 else if (! _stricmp(colour, "palegreen1")) return RGB(154,255,154);
1432 else if (! _stricmp(colour, "palegreen2")) return RGB(144,238,144);
1433 else if (! _stricmp(colour, "palegreen3")) return RGB(124,205,124);
1434 else if (! _stricmp(colour, "palegreen4")) return RGB(84,139,84);
1435 else if (! _stricmp(colour, "palevioletred1")) return RGB(255,130,171);
1436 else if (! _stricmp(colour, "palevioletred2")) return RGB(238,121,159);
1437 else if (! _stricmp(colour, "palevioletred3")) return RGB(205,104,137);
1438 else if (! _stricmp(colour, "palevioletred4")) return RGB(139,71,93);
1439 else if (! _stricmp(colour, "paleturquoise1")) return RGB(187,255,255);
1440 else if (! _stricmp(colour, "paleturquoise2")) return RGB(174,238,238);
1441 else if (! _stricmp(colour, "paleturquoise3")) return RGB(150,205,205);
1442 else if (! _stricmp(colour, "paleturquoise4")) return RGB(102,139,139);
1443 else if (! _stricmp(colour, "peachpuff1")) return RGB(255,218,185);
1444 else if (! _stricmp(colour, "peachpuff2")) return RGB(238,203,173);
1445 else if (! _stricmp(colour, "peachpuff3")) return RGB(205,175,149);
1446 else if (! _stricmp(colour, "peachpuff4")) return RGB(139,119,101);
1447 else if (! _stricmp(colour, "pink1")) return RGB(255,181,197);
1448 else if (! _stricmp(colour, "pink2")) return RGB(238,169,184);
1449 else if (! _stricmp(colour, "pink3")) return RGB(205,145,158);
1450 else if (! _stricmp(colour, "pink4")) return RGB(139,99,108);
1451 else if (! _stricmp(colour, "plum1")) return RGB(255,187,255);
1452 else if (! _stricmp(colour, "plum2")) return RGB(238,174,238);
1453 else if (! _stricmp(colour, "plum3")) return RGB(205,150,205);
1454 else if (! _stricmp(colour, "plum4")) return RGB(139,102,139);
1455 else if (! _stricmp(colour, "purple1")) return RGB(155,48,255);
1456 else if (! _stricmp(colour, "purple2")) return RGB(145,44,238);
1457 else if (! _stricmp(colour, "purple3")) return RGB(125,38,205);
1458 else if (! _stricmp(colour, "purple4")) return RGB(85,26,139);
1459*/
1460 }
1461 case 'r': //====================
1462 {
1463 if (! _stricmp(colour, "red")) return RGB(255,0,0);
1464 else if (! _stricmp(colour, "rosybrown")) return RGB(188,143,143);
1465 else if (! _stricmp(colour, "royalblue")) return RGB(65,105,225);
1466/*
1467 else if (! _stricmp(colour, "red1")) return RGB(255,0,0);
1468 else if (! _stricmp(colour, "red2")) return RGB(238,0,0);
1469 else if (! _stricmp(colour, "red3")) return RGB(205,0,0);
1470 else if (! _stricmp(colour, "red4")) return RGB(139,0,0);
1471 else if (! _stricmp(colour, "rosybrown1")) return RGB(255,193,193);
1472 else if (! _stricmp(colour, "rosybrown2")) return RGB(238,180,180);
1473 else if (! _stricmp(colour, "rosybrown3")) return RGB(205,155,155);
1474 else if (! _stricmp(colour, "rosybrown4")) return RGB(139,105,105);
1475 else if (! _stricmp(colour, "royalblue1")) return RGB(72,118,255);
1476 else if (! _stricmp(colour, "royalblue2")) return RGB(67,110,238);
1477 else if (! _stricmp(colour, "royalblue3")) return RGB(58,95,205);
1478 else if (! _stricmp(colour, "royalblue4")) return RGB(39,64,139);
1479*/
1480 }
1481 case 's': //====================
1482 {
1483 if (! _stricmp(colour, "saddlebrown")) return RGB(139,69,19);
1484 else if (! _stricmp(colour, "salmon")) return RGB(250,128,114);
1485 else if (! _stricmp(colour, "sandybrown")) return RGB(244,164,96);
1486 else if (! _stricmp(colour, "seagreen")) return RGB(46,139,87);
1487 else if (! _stricmp(colour, "seashell")) return RGB(255,245,238);
1488 else if (! _stricmp(colour, "sienna")) return RGB(160,82,45);
1489 else if (! _stricmp(colour, "skyblue")) return RGB(135,206,235);
1490 else if (! _stricmp(colour, "slateblue")) return RGB(106,90,205);
1491 else if (! _stricmp(colour, "slategray")) return RGB(112,128,144);
1492 else if (! _stricmp(colour, "slategrey")) return RGB(112,128,144);
1493 else if (! _stricmp(colour, "springgreen")) return RGB(0,255,127);
1494 else if (! _stricmp(colour, "steelblue")) return RGB(70,130,180);
1495/*
1496 else if (! _stricmp(colour, "salmon1")) return RGB(255,140,105);
1497 else if (! _stricmp(colour, "salmon2")) return RGB(238,130,98);
1498 else if (! _stricmp(colour, "salmon3")) return RGB(205,112,84);
1499 else if (! _stricmp(colour, "salmon4")) return RGB(139,76,57);
1500 else if (! _stricmp(colour, "seagreen1")) return RGB(84,255,159);
1501 else if (! _stricmp(colour, "seagreen2")) return RGB(78,238,148);
1502 else if (! _stricmp(colour, "seagreen3")) return RGB(67,205,128);
1503 else if (! _stricmp(colour, "seagreen4")) return RGB(46,139,87);
1504 else if (! _stricmp(colour, "seashell1")) return RGB(255,245,238);
1505 else if (! _stricmp(colour, "seashell2")) return RGB(238,229,222);
1506 else if (! _stricmp(colour, "seashell3")) return RGB(205,197,191);
1507 else if (! _stricmp(colour, "seashell4")) return RGB(139,134,130);
1508 else if (! _stricmp(colour, "sienna1")) return RGB(255,130,71);
1509 else if (! _stricmp(colour, "sienna2")) return RGB(238,121,66);
1510 else if (! _stricmp(colour, "sienna3")) return RGB(205,104,57);
1511 else if (! _stricmp(colour, "sienna4")) return RGB(139,71,38);
1512 else if (! _stricmp(colour, "skyblue1")) return RGB(135,206,255);
1513 else if (! _stricmp(colour, "skyblue2")) return RGB(126,192,238);
1514 else if (! _stricmp(colour, "skyblue3")) return RGB(108,166,205);
1515 else if (! _stricmp(colour, "skyblue4")) return RGB(74,112,139);
1516 else if (! _stricmp(colour, "slateblue1")) return RGB(131,111,255);
1517 else if (! _stricmp(colour, "slateblue2")) return RGB(122,103,238);
1518 else if (! _stricmp(colour, "slateblue3")) return RGB(105,89,205);
1519 else if (! _stricmp(colour, "slateblue4")) return RGB(71,60,139);
1520 else if (! _stricmp(colour, "slategray1")) return RGB(198,226,255);
1521 else if (! _stricmp(colour, "slategray2")) return RGB(185,211,238);
1522 else if (! _stricmp(colour, "slategray3")) return RGB(159,182,205);
1523 else if (! _stricmp(colour, "slategray4")) return RGB(108,123,139);
1524 else if (! _stricmp(colour, "snow1")) return RGB(255,250,250);
1525 else if (! _stricmp(colour, "snow2")) return RGB(238,233,233);
1526 else if (! _stricmp(colour, "snow3")) return RGB(205,201,201);
1527 else if (! _stricmp(colour, "snow4")) return RGB(139,137,137);
1528 else if (! _stricmp(colour, "springgreen1")) return RGB(0,255,127);
1529 else if (! _stricmp(colour, "springgreen2")) return RGB(0,238,118);
1530 else if (! _stricmp(colour, "springgreen3")) return RGB(0,205,102);
1531 else if (! _stricmp(colour, "springgreen4")) return RGB(0,139,69);
1532 else if (! _stricmp(colour, "steelblue1")) return RGB(99,184,255);
1533 else if (! _stricmp(colour, "steelblue2")) return RGB(92,172,238);
1534 else if (! _stricmp(colour, "steelblue3")) return RGB(79,148,205);
1535 else if (! _stricmp(colour, "steelblue4")) return RGB(54,100,139);
1536*/
1537 }
1538 case 't': //====================
1539 {
1540 if (! _stricmp(colour, "tan")) return RGB(210,180,140);
1541 else if (! _stricmp(colour, "thistle")) return RGB(216,191,216);
1542 else if (! _stricmp(colour, "tomato")) return RGB(255,99,71);
1543 else if (! _stricmp(colour, "turquoise")) return RGB(64,224,208);
1544/*
1545 else if (! _stricmp(colour, "tan1")) return RGB(255,165,79);
1546 else if (! _stricmp(colour, "tan2")) return RGB(238,154,73);
1547 else if (! _stricmp(colour, "tan3")) return RGB(205,133,63);
1548 else if (! _stricmp(colour, "tan4")) return RGB(139,90,43);
1549 else if (! _stricmp(colour, "thistle1")) return RGB(255,225,255);
1550 else if (! _stricmp(colour, "thistle2")) return RGB(238,210,238);
1551 else if (! _stricmp(colour, "thistle3")) return RGB(205,181,205);
1552 else if (! _stricmp(colour, "thistle4")) return RGB(139,123,139);
1553 else if (! _stricmp(colour, "tomato1")) return RGB(255,99,71);
1554 else if (! _stricmp(colour, "tomato2")) return RGB(238,92,66);
1555 else if (! _stricmp(colour, "tomato3")) return RGB(205,79,57);
1556 else if (! _stricmp(colour, "tomato4")) return RGB(139,54,38);
1557 else if (! _stricmp(colour, "turquoise1")) return RGB(0,245,255);
1558 else if (! _stricmp(colour, "turquoise2")) return RGB(0,229,238);
1559 else if (! _stricmp(colour, "turquoise3")) return RGB(0,197,205);
1560 else if (! _stricmp(colour, "turquoise4")) return RGB(0,134,139);
1561*/
1562 }
1563 case 'v': //====================
1564 {
1565 if (! _stricmp(colour, "violet")) return RGB(238,130,238);
1566 else if (! _stricmp(colour, "violetred")) return RGB(208,32,144);
1567/*
1568 else if (! _stricmp(colour, "violetred1")) return RGB(255,62,150);
1569 else if (! _stricmp(colour, "violetred2")) return RGB(238,58,140);
1570 else if (! _stricmp(colour, "violetred3")) return RGB(205,50,120);
1571 else if (! _stricmp(colour, "violetred4")) return RGB(139,34,82);
1572*/
1573 }
1574 case 'w': //====================
1575 {
1576 if (! _stricmp(colour, "wheat")) return RGB(245,222,179);
1577 else if (! _stricmp(colour, "white")) return RGB(255,255,255);
1578 else if (! _stricmp(colour, "whitesmoke")) return RGB(245,245,245);
1579/*
1580 else if (! _stricmp(colour, "wheat1")) return RGB(255,231,186);
1581 else if (! _stricmp(colour, "wheat2")) return RGB(238,216,174);
1582 else if (! _stricmp(colour, "wheat3")) return RGB(205,186,150);
1583 else if (! _stricmp(colour, "wheat4")) return RGB(139,126,102);
1584*/
1585 }
1586 case 'y': //====================
1587 {
1588 if (! _stricmp(colour, "yellow")) return RGB(255,255,0);
1589 else if (! _stricmp(colour, "yellowgreen")) return RGB(154,205,50);
1590/*
1591 else if (! _stricmp(colour, "yellow1")) return RGB(255,255,0);
1592 else if (! _stricmp(colour, "yellow2")) return RGB(238,238,0);
1593 else if (! _stricmp(colour, "yellow3")) return RGB(205,205,0);
1594 else if (! _stricmp(colour, "yellow4")) return RGB(139,139,0);
1595*/
1596 }
1597
1598 //====================
1599
1600 default:
1601 return 0x000000;
1602 }
1603}

◆ GetBBVersion()

LPCSTR GetBBVersion ( )
106{
107 char buffer[MAX_LINE_LENGTH];
108 ULONG *size = 0;
109 DWORD number = GetFileVersionInfoSize("Blackbox.exe", size);
110 GetFileVersionInfo("Blackbox.exe", NULL, number, (LPVOID)buffer);
111
112 void *value;
113 UINT bytes;
114 // Make sure the correct version encoding is used (currently "000004b0" = language neutral)
115 VerQueryValue(buffer, TEXT("\\StringFileInfo\\000004b0\\ProductVersion"), &value, &bytes);
116 strcpy(tempBuf, (LPCSTR)value);
117
118 return tempBuf;
119}
static char tempBuf[MAX_LINE_LENGTH]
Definition BBApi.cpp:82
#define MAX_LINE_LENGTH
Definition BBApi.h:64

◆ GetBBWnd()

HWND GetBBWnd ( )
129{
130 if (!hBlackbox) hBlackbox = FindWindow("xoblite", NULL);
131 return hBlackbox;
132}
HWND hBlackbox
Definition BBApi.cpp:91

◆ GetOSInfo()

LPCSTR GetOSInfo ( void )
142{
143 char buffer[MAX_LINE_LENGTH];
144
145 OSVERSIONINFO osv;
146 ZeroMemory(&osv, sizeof(osv));
147 osv.dwOSVersionInfoSize = sizeof(osv);
148 GetVersionEx(&osv);
149
150 if (IsWindows10OrGreater())
151 {
152 if (osv.dwBuildNumber >= 22000) strcpy(buffer, "Windows 11"); // PLACEHOLDER - No IsWindows11OrGreater() function available in the Windows API yet (?)
153 else strcpy(buffer, "Windows 10");
154 }
155 else if (IsWindows8Point1OrGreater()) strcpy(buffer, "Windows 8.1");
156 else if (IsWindows8OrGreater()) strcpy(buffer, "Windows 8");
157 else if (IsWindows7OrGreater()) strcpy(buffer, "Windows 7");
158 else if (IsWindowsVistaOrGreater()) strcpy(buffer, "Windows Vista");
159 else
160 {
161 // As per Microsoft: "In Windows 8.1 and Windows 10, the GetVersion and GetVersionEx functions have been deprecated.
162 // In Windows 10, the VerifyVersionInfo function has also been deprecated. While you can still call the
163 // deprecated functions, if your application does not specifically target Windows 8.1 or Windows 10,
164 // the functions will return the Windows 8 version (6.2)."
165 // ### -> Added a basic application manifest with compatibility settings, see Resources/Compatbility.manifest ###
166
167 if (osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) // Windows 9x/ME
168 {
169 if (osv.dwMinorVersion >= 90) strcpy(buffer, "Windows ME");
170 else if (osv.dwMinorVersion >= 10) strcpy(buffer, "Windows 98");
171 else strcpy(buffer, "Windows 95");
172 }
173 else // Windows NT/2000/XP/Vista/7/8/8.1/10/11... (nb. not including server variants here as alternative shells are really only for clients anyway)
174 {
175 sprintf(buffer, "Windows NT %d.%d", osv.dwMajorVersion, osv.dwMinorVersion); // Fallback in case of unknown Windows version...
176
177 if (osv.dwMajorVersion == 10)
178 {
179 if (osv.dwMinorVersion == 0)
180 {
181 if (osv.dwBuildNumber >= 22000) strcpy(buffer, "Windows 11");
182 else strcpy(buffer, "Windows 10");
183 }
184 }
185 else if (osv.dwMajorVersion == 6)
186 {
187 if (osv.dwMinorVersion == 3) strcpy(buffer, "Windows 8.1");
188 else if (osv.dwMinorVersion == 2) strcpy(buffer, "Windows 8");
189 else if (osv.dwMinorVersion == 1) strcpy(buffer, "Windows 7");
190 else if (osv.dwMinorVersion == 0) strcpy(buffer, "Windows Vista");
191 }
192 else if (osv.dwMajorVersion == 5)
193 {
194 if (osv.dwMinorVersion == 2) strcpy(buffer, "Windows XP (64-bit)");
195 else if (osv.dwMinorVersion == 1) strcpy(buffer, "Windows XP (32-bit)");
196 else if (osv.dwMinorVersion == 0) strcpy(buffer, "Windows 2000");
197 }
198 }
199 }
200
201 strcpy(tempBuf, buffer);
202
203 return tempBuf;
204}

◆ GetBlackboxPath()

bool WINAPI GetBlackboxPath ( LPSTR pszPath,
int nMaxLen )
215{
216 static char szPath[MAX_PATH] = "";
217
218 if (!szPath[0])
219 {
220 GetModuleFileName(NULL, szPath, MAX_PATH);
221// int nLen = strlen(szPath) - 1;
222// while (nLen > 0 && szPath[nLen] != '\\') nLen--;
223// szPath[nLen+1] = 0;
224 GetParentFolder(szPath);
225 }
226
227 strncpy(pszPath, szPath, nMaxLen);
228
229 return true;
230}
int GetParentFolder(LPSTR path)
Definition BBApi.cpp:3853

◆ FileOpen()

FILE * FileOpen ( LPCSTR szPath)
240{
241 FILE *file = NULL;
242 if (FileExists(szPath)) file = fopen(szPath, "r");
243
244 return (file);
245}
bool FileExists(LPCSTR szFileName)
Definition BBApi.cpp:819

◆ FileClose()

bool FileClose ( FILE * fp)
255{
256 if (fp)
257 {
258 if (fclose(fp)) return false;
259 else return true;
260 }
261 else return false;
262}

◆ Tokenize()

LPSTR Tokenize ( LPCSTR string,
LPSTR buf,
LPSTR delims )
274{
275 static char remaining[MAX_LINE_LENGTH];
276 strcpy(remaining, string);
277
278 char character, quoted = 0, *b = buf, *r = remaining;
279
280 while ((character = *r) != 0)
281 {
282 r++;
283
284 if (!quoted)
285 {
286 if (strchr(delims, character)) break; // User-specified delimiter
287 else if (character == '\"' || character == '\'') quoted = character;
288 else if (((unsigned char)character <= 32) && (b == buf)) continue;
289 }
290 else if (character == quoted) quoted = 0;
291
292 *b++ = character;
293 }
294
295 while ((b > buf) && ((unsigned char)b[-1] <= 32)) b--;
296
297 *b = '\0';
298
299 while (((unsigned char)*r <= 32) && (*r)) r++;
300
301 strcpy(remaining, r);
302
303 return remaining;
304}

◆ BBTokenize()

int BBTokenize ( LPCSTR szString,
char * lpszBuffers[],
DWORD dwNumBuffers,
LPSTR szExtraParameters )
317{
318 int inputIndex = 0, outputIndex, numberOfTokens = 0;
319 DWORD dwBufferCount = 0;
320 char quoteChar = 0, currentChar, *outputBuffer;
321
322 //====================
323
324 while (dwBufferCount < dwNumBuffers)
325 {
326 outputBuffer = lpszBuffers[dwBufferCount];
327 outputIndex = 0;
328
329 //====================
330
331 while ((currentChar = szString[inputIndex]) != 0)
332 {
333 inputIndex++;
334
335 switch (currentChar)
336 {
337 //====================
338
339 case ' ':
340 case '\t':
341 {
342 if (quoteChar) goto storeThisChar; // We're inside a quoted string, store spaces/tabs just like other characters...
343 if (outputIndex) goto finishedToken; // ...otherwise a space/tab specifies the end of a token
344 continue;
345 }
346
347 //====================
348
349 case '"':
350 case '\'':
351 {
352 if (quoteChar == 0) // Quoted string begins here...
353 {
354 // Remember which quote character was used...
355 quoteChar = currentChar;
356 continue;
357 }
358 else if (quoteChar == currentChar) // Quoted string ends here...
359 {
360 // Reset quote character and finish parsing of the current token...
361 quoteChar = 0;
362 goto finishedToken;
363 }
364 else goto storeThisChar;
365 }
366
367 //====================
368
369 storeThisChar:
370 default:
371 {
372 // Write current character to output buffer...
373 outputBuffer[outputIndex] = currentChar;
374 outputIndex++;
375 continue;
376 }
377
378 //====================
379 }
380 }
381
382 //====================
383
384 // Finish parsing of the current token...
385 if (outputIndex) finishedToken: numberOfTokens++;
386 outputBuffer[outputIndex]=0;
387 dwBufferCount++;
388 }
389
390 //====================
391
392 if (szExtraParameters) strcpy(szExtraParameters, szString + inputIndex);
393
394 return numberOfTokens;
395}

◆ StrRemoveEncap()

LPSTR StrRemoveEncap ( LPSTR string)
407{
408 int nLen = strlen(string);
409 nLen--;
410 memmove(string, string+1, nLen-1);
411 *(string+nLen-1) = '\0';
412 return string;
413}

◆ ReadValue()

LPSTR ReadValue ( LPCSTR fp,
LPCSTR keyword,
LPLONG ptr )
434{
435 FILE *f = FileOpen(fp);
436 if (!f) return NULL;
437
438 //====================
439
440 // Move to starting position if specified...
441 if (ptr && *ptr != 0) fseek(f, *ptr, SEEK_SET);
442 else fseek(f, 0, SEEK_SET);
443
444 //====================
445
446 LONG fpos = 0;
447 char* currentLine;
448
449 while (FileRead(f, lineFromFile))
450 {
451 lineFromFile[MAX_LINE_LENGTH-1] = '\0'; // Failsafe
452
453 currentLine = lineFromFile;
454 currentLine += strspn(currentLine, " \t\r\n");
455
456 // Is the current line a comment line?
457 if (*currentLine == '#' || *currentLine == '!')
458 {
459 fpos = ftell(f);
460 continue;
461 }
462 // If not, look for the keyword a the beginning of the string...
463 else if (!_strnicmp(currentLine, keyword, strlen(keyword)))
464 {
465 // We're only interested in the string after the keyword...
466 currentLine += strlen(keyword);
467 // Remove any space characters, tabs or returns...
468 currentLine += strspn(currentLine, " \t\r\n");
469 // Remove any trailing space characters...
470 int nLen = strlen(currentLine) - 1;
471 while (nLen >0 && currentLine[nLen] == ' ') nLen--;
472 currentLine[nLen+1] = 0;
473
474 if (ptr) *ptr = fpos;
475 FileClose(f);
476
477 return (char*)currentLine;
478 }
479
480 fpos = ftell(f);
481 }
482
483 //====================
484
485 FileClose(f);
486
487 return NULL;
488}
bool FileRead(FILE *stream, LPSTR string)
Definition BBApi.cpp:665
FILE * FileOpen(LPCSTR szPath)
Definition BBApi.cpp:239
static char lineFromFile[MAX_LINE_LENGTH+1]
Definition BBApi.cpp:83
bool FileClose(FILE *fp)
Definition BBApi.cpp:254

◆ ReadBool()

bool ReadBool ( LPCSTR fp,
LPCSTR szString,
bool szDefault )
500{
501/*
502 // NULL/empty filepointers are not supported for ReadBool,
503 // but since it is the only Read* function that does not
504 // support them I have added a safeguard here to prevent
505 // a borked plugin from crashing the core... <g>
506 if(!fp || ! _stricmp(fp, "")) return szDefault;
507
508 LPSTR buffer = ReadValue(fp, szString);
509 if (buffer)
510 {
511 if (! _stricmp(buffer, "true")) return true;
512 else if (! _stricmp(buffer, "false")) return false;
513 else return szDefault;
514 }
515
516 return szDefault;
517*/
518 return pSettings->GetBool(fp, NULL, szString, szDefault);
519}
Settings * pSettings
Definition Blackbox.cpp:46

◆ ReadInt()

int ReadInt ( LPCSTR fp,
LPCSTR szString,
int szDefault )
531{
532 return pSettings->GetInt(fp, NULL, szString, szDefault);
533}

◆ ReadString()

LPSTR ReadString ( LPCSTR fp,
LPCSTR szString,
LPSTR szDefault )
545{
546 return pSettings->GetString(fp, NULL, szString, szDefault);
547}

◆ ReadColor()

COLORREF ReadColor ( LPCSTR fp,
LPCSTR szString,
LPCSTR szDefault )
559{
560 return pSettings->GetColor(fp, NULL, szString, szDefault, NULL, false);
561}

◆ GetSettingPtr()

void * GetSettingPtr ( int index)
571{
572 switch (index)
573 {
574 case SN_TOOLBAR : return (void*) pSettings->Toolbar;
575 case SN_TOOLBARBUTTON : return (void*) pSettings->ToolbarButton;
576 case SN_TOOLBARBUTTONP : return (void*) pSettings->ToolbarButtonPressed;
577 case SN_TOOLBARLABEL : return (void*) pSettings->ToolbarLabel;
578 case SN_TOOLBARWINDOWLABEL : return (void*) pSettings->ToolbarWindowLabel;
579 case SN_TOOLBARCLOCK : return (void*) pSettings->ToolbarClock;
580 case SN_MENUTITLE : return (void*) pSettings->MenuTitle;
581 case SN_MENUFRAME : return (void*) pSettings->MenuFrame;
582 case SN_MENUHILITE : return (void*) pSettings->MenuActive;
583
584 case SN_BORDERWIDTH : return (void*) &pSettings->borderWidth;
585 case SN_BORDERCOLOR : return (void*) &pSettings->borderColor;
586 case SN_BEVELWIDTH : return (void*) &pSettings->bevelWidth;
587
588 case SN_METRICSUNIX : return (void*) false;
589 case SN_BULLETUNIX : return (void*) false;
590 case SN_ROOTCOMMAND : return (void*) &pSettings->rootCommand;
591
592 case SN_MENUBULLET : return (void*) &pSettings->menuBullet;
593 case SN_MENUBULLETPOS : return (void*) &pSettings->menuBulletPosition;
594 case SN_FRAMEWIDTH : return (void*) &pSettings->frameWidth;
595 case SN_HANDLEWIDTH : return (void*) &pSettings->handleHeight; // Note: Same index as SN_HANDLEHEIGHT
596
597 case SN_MENUALPHA : return (void*) &pSettings->menuTransparencyAlpha;
598 case SN_TOOLBARALPHA : return (void*) &pSettings->toolbarTransparencyAlpha;
599
600 case SN_WINFOCUS_TITLE : return (void*) pSettings->WindowTitleFocus;
601 case SN_WINFOCUS_LABEL : return (void*) pSettings->WindowLabelFocus;
602 case SN_WINFOCUS_HANDLE : return (void*) pSettings->WindowHandleFocus;
603 case SN_WINFOCUS_GRIP : return (void*) pSettings->WindowGripFocus;
604 case SN_WINFOCUS_BUTTON : return (void*) pSettings->WindowButtonFocus;
605 case SN_WINFOCUS_BUTTONP : return (void*) pSettings->WindowButtonPressed;
606
607 case SN_WINUNFOCUS_TITLE : return (void*) pSettings->WindowTitleUnfocus;
608 case SN_WINUNFOCUS_LABEL : return (void*) pSettings->WindowLabelUnfocus;
609 case SN_WINUNFOCUS_HANDLE : return (void*) pSettings->WindowHandleUnfocus;
610 case SN_WINUNFOCUS_GRIP : return (void*) pSettings->WindowGripUnfocus;
611 case SN_WINUNFOCUS_BUTTON : return (void*) pSettings->WindowButtonUnfocus;
612/*
613 case SN_WINFOCUS_FRAME_COLOR : return (void*) &pSettings->borderColor;
614 case SN_WINUNFOCUS_FRAME_COLOR : return (void*) &pSettings->borderColor;
615*/
616 case SN_NEWMETRICS : return (void*) false;
617
618 case SN_ISSTYLE070 : return (void*) true; // ...OK?
619 case SN_SLIT : return (void*) pSettings->Dock;
620
621 case SN_MENUSEPMARGIN : return (void*) 1; // PLACEHOLDER (for basic API compatibility only)
622 case SN_MENUSEPCOLOR : return (void*) &pSettings->MenuSeparator->Color;
623 case SN_MENUSEPSHADOWCOLOR : return (void*) &pSettings->MenuSeparator->Color; // PLACEHOLDER (for basic API compatibility only)
624 case SN_MENUGRIP : return (void*) pSettings->MenuGrip;
625 }
626
627 return NULL;
628}
@ SN_WINUNFOCUS_GRIP
Definition BBApi.h:353
@ SN_HANDLEWIDTH
Definition BBApi.h:328
@ SN_TOOLBARCLOCK
Definition BBApi.h:316
@ SN_TOOLBAR
Definition BBApi.h:311
@ SN_ROOTCOMMAND
Definition BBApi.h:330
@ SN_WINFOCUS_GRIP
Definition BBApi.h:346
@ SN_MENUTITLE
Definition BBApi.h:317
@ SN_MENUSEPMARGIN
Definition BBApi.h:369
@ SN_MENUBULLET
Definition BBApi.h:321
@ SN_BEVELWIDTH
Definition BBApi.h:326
@ SN_WINFOCUS_TITLE
Definition BBApi.h:343
@ SN_TOOLBARLABEL
Definition BBApi.h:314
@ SN_WINFOCUS_LABEL
Definition BBApi.h:344
@ SN_BULLETUNIX
Definition BBApi.h:336
@ SN_WINUNFOCUS_BUTTON
Definition BBApi.h:354
@ SN_MENUSEPSHADOWCOLOR
Definition BBApi.h:371
@ SN_TOOLBARWINDOWLABEL
Definition BBApi.h:315
@ SN_MENUGRIP
Definition BBApi.h:372
@ SN_WINFOCUS_HANDLE
Definition BBApi.h:345
@ SN_BORDERWIDTH
Definition BBApi.h:324
@ SN_TOOLBARBUTTON
Definition BBApi.h:312
@ SN_TOOLBARBUTTONP
Definition BBApi.h:313
@ SN_MENUFRAME
Definition BBApi.h:318
@ SN_METRICSUNIX
Definition BBApi.h:335
@ SN_MENUHILITE
Definition BBApi.h:319
@ SN_NEWMETRICS
Definition BBApi.h:359
@ SN_SLIT
Definition BBApi.h:367
@ SN_WINFOCUS_BUTTON
Definition BBApi.h:347
@ SN_FRAMEWIDTH
Definition BBApi.h:327
@ SN_WINUNFOCUS_HANDLE
Definition BBApi.h:352
@ SN_ISSTYLE070
Definition BBApi.h:366
@ SN_WINUNFOCUS_TITLE
Definition BBApi.h:350
@ SN_TOOLBARALPHA
Definition BBApi.h:333
@ SN_BORDERCOLOR
Definition BBApi.h:325
@ SN_MENUBULLETPOS
Definition BBApi.h:322
@ SN_MENUALPHA
Definition BBApi.h:332
@ SN_WINFOCUS_BUTTONP
Definition BBApi.h:348
@ SN_WINUNFOCUS_LABEL
Definition BBApi.h:351
@ SN_MENUSEPCOLOR
Definition BBApi.h:370

◆ Log()

void Log ( LPCSTR des,
LPCSTR line )
639{
640 char date[9], time[9];
643 strcat(tempBuf, "xoblite.log");
644
645 FILE *f = fopen(tempBuf, "a+");
646 if (f)
647 {
648 _strdate(date);
649 _strtime(time);
650 if (strlen(line)) fprintf(f, "%s %s - %s: %s\n", date, time, des, line);
651 else fprintf(f, "%s %s - %s\n", date, time, des);
652 fclose(f);
653 }
655}
int MBoxErrorFile(LPCSTR szFile)
Definition BBApi.cpp:1612
bool WINAPI GetBlackboxPath(LPSTR pszPath, int nMaxLen)
Definition BBApi.cpp:214

◆ FileRead()

bool FileRead ( FILE * stream,
LPSTR string )
666{
667 int ch, // Character read from file
668 cnbr; // Index into returned string
669
670 cnbr = 0; // Start at the beginning...
671 memset(string, ' ', MAX_LINE_LENGTH); // ...and prepare the entire line
672
673 for (;;)
674 {
675 ch = fgetc(stream); // Get next character from the file...
676
677 if (ch == '\t') // Jump if the character is a tab...
678 {
679 cnbr = ((cnbr >> 3) << 3) + 8;
680 }
681 // If the character is end of line, end of file, or MS-DOS Ctrl-Z...
682 /*else*/ if ((ch == '\n') || (ch == EOF) || (ch == 26))
683 {
684 string[cnbr] = '\0'; // ...terminate the string...
685 return(ch == '\n' || cnbr); // ...and return true/false
686 }
687 else if (cnbr < MAX_LINE_LENGTH)
688 {
689 // ...otherwise add the character to the output string
690 string[cnbr++] = (char) ch;
691 }
692
693 // Return in any case if line is too long, the line will be cut into pieces...
694 if (cnbr >= MAX_LINE_LENGTH)
695 {
696 string[MAX_LINE_LENGTH] = '\0';
697 return true;
698 }
699 }
700}

◆ ReadNextCommand()

bool ReadNextCommand ( FILE * f,
LPSTR szBuffer,
DWORD dwLength )
714{
715 if (!f) return false;
716
717 while (FileRead(f, szTempBuffer))
718 {
719 while (isspace(*szTempBuffer) && *szTempBuffer) memmove(szTempBuffer, szTempBuffer+1, strlen(szTempBuffer)); // Clean out initial spaces...
720
721 if (szTempBuffer[0] && szTempBuffer[0] != '#' && szTempBuffer != 0 && szTempBuffer[0] != '!') // Check for comment lines...
722 {
723 strncpy(szBuffer, szTempBuffer, dwLength);
724 return true;
725 }
726
727 if (!strcmp(szTempBuffer, "[end]")) strncpy(szBuffer, szTempBuffer, dwLength);
728 }
729
730 return false;
731}
static char szTempBuffer[MAX_LINE_LENGTH]
Definition BBApi.cpp:711

◆ GetConfigFilePath()

bool GetConfigFilePath ( LPSTR filePath,
LPCSTR setPath,
LPCSTR checkName1,
LPCSTR checkName2 )
740{
741 if (setPath != NULL)
742 {
743 strcpy(filePath, setPath);
744 if (strchr(filePath, '\"')) StrRemoveEncap(filePath);
745 }
746
747 else if (strlen(filePath) == 0) // We only need to do this once!
748 {
749 // Check for the file specified by checkName1 in the
750 // Blackbox and $UserAppData$\Blackbox directories...
751 strcpy(filePath, ConfigFileExists(checkName1, NULL));
752 if (!_stricmp(filePath, ""))
753 {
754 if (checkName2 != NULL)
755 {
756 // If not found, check for the file specified
757 // by checkName2 in the same directories...
758 strcpy(filePath, ConfigFileExists(checkName2, NULL));
759 if (!_stricmp(filePath, "")) return false;
760 }
761 else return false;
762 }
763 }
764
765 return true;
766}
LPCSTR ConfigFileExists(LPCSTR filename, LPCSTR pluginDir)
Definition BBApi.cpp:776
LPSTR StrRemoveEncap(LPSTR string)
Definition BBApi.cpp:406

◆ ConfigFileExists()

LPCSTR ConfigFileExists ( LPCSTR filename,
LPCSTR pluginDir )
777{
778 // First we look for the file in the $UserAppData$\Blackbox directory
779 // (previously C:\Documents and Settings\username\Application Data\Blackbox ,
780 // nowadays more often C:\Users\username\AppData\Blackbox ),
781 // i.e. allowing per-user specific configuration for a given file:
782 strcpy(tempBuf, pSettings->SF_userAppData);
783 strcat(tempBuf, "\\Blackbox\\");
784 strcat(tempBuf, filename);
785 if (!FileExists(tempBuf))
786 {
787 // If not found, we check the root of the current theme folder,
788 // i.e. allowing per theme configuration data while re-using
789 // shared plugin .dll's located in another folder for all themes:
790 sprintf(tempBuf, "%s\\%s", pSettings->SF_currentThemePath, filename);
791 if (FileExists(tempBuf)) return tempBuf;
792
793 // If still not found, and if a pluginDir was specified,
794 // we look for the file in this directory... (note: this would typically be the same
795 // folder as the plugin .dll, i.e. not allowing plugin re-use across themes like above)
796 if (pluginDir != NULL)
797 {
798 strcpy(tempBuf, pluginDir);
799 strcat(tempBuf, filename);
800 if (FileExists(tempBuf)) return tempBuf;
801 }
802
803 // Finally, if *still* not found, we look for the file in the Blackbox directory...
805 strcat(tempBuf, filename);
806 if (!FileExists(tempBuf)) strcpy(tempBuf, "");
807 }
808
809 return tempBuf;
810}

◆ FileExists()

bool FileExists ( LPCSTR szFileName)
820{
821 HANDLE handle;
822 WIN32_FIND_DATA findData;
823
824 handle = FindFirstFile(szFileName, &findData);
825 if (handle != INVALID_HANDLE_VALUE)
826 {
827 FindClose(handle);
828 if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
829 return true;
830 }
831
832 return false;
833}

◆ FolderExists()

bool FolderExists ( LPCSTR szFolderPath)
843{
844 HANDLE handle;
845 WIN32_FIND_DATA findData;
846
847 handle = FindFirstFile(szFolderPath, &findData);
848 if (handle != INVALID_HANDLE_VALUE)
849 {
850 FindClose(handle);
851 if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
852 return true;
853 }
854
855 return false;
856}

◆ bbrcPath()

LPCSTR bbrcPath ( LPCSTR other)
864{
865 // Check for xoblite.rc/blackbox.rc in the main Blackbox and $UserAppData$\Blackbox directories...
866 if (!GetConfigFilePath(pSettings->bbrcFile, other, "xoblite.rc", "blackbox.rc"))
867 {
868 // If still not found, we create a new default
869 // blackbox.rc (legacy fallback!) in the main Blackbox directory...
870 pSettings->WriteDefaultRCSettings();
871 }
872
873 return pSettings->bbrcFile;
874}
bool GetConfigFilePath(LPSTR filePath, LPCSTR setPath, LPCSTR checkName1, LPCSTR checkName2)
Definition BBApi.cpp:739

◆ extensionsrcPath()

LPCSTR extensionsrcPath ( LPCSTR other)
882{
883 // Check for xoblite.rc/extensions.rc in the main Blackbox and $UserAppData$\Blackbox directories...
884 if (!GetConfigFilePath(pSettings->xobrcFile, other, "xoblite.rc", "extensions.rc"))
885 {
886 // If still not found, set the default path
887 // -> xoblite.rc in the main Blackbox directory...
888 GetBlackboxPath(pSettings->xobrcFile, sizeof(pSettings->xobrcFile));
889 strcat(pSettings->xobrcFile, "xoblite.rc");
890 }
891
892 return pSettings->xobrcFile;
893}

◆ plugrcPath()

LPCSTR plugrcPath ( LPCSTR other)
901{
902/*
903 // Check for plugins.rc in the Blackbox and $UserAppData$\Blackbox directories...
904 if (!GetConfigFilePath(pSettings->pluginsFile, other, "plugins.rc", NULL))
905 {
906 // If still not found, set the default path
907 // -> plugins.rc in the main Blackbox directory...
908 GetBlackboxPath(pSettings->pluginsFile, sizeof(pSettings->pluginsFile));
909 strcat(pSettings->pluginsFile, "plugins.rc");
910 }
911*/
912 return pSettings->pluginsFile;
913}

◆ menuPath()

LPCSTR menuPath ( LPCSTR other)
921{
922 if (other != NULL)
923 {
924 strcpy(pSettings->menuFile, other);
925 if (strchr(pSettings->menuFile, '\"')) StrRemoveEncap(pSettings->menuFile);
926 if (strchr(pSettings->menuFile, '$')) ReplaceShellFolders(pSettings->menuFile);
927
928 // If the full path to the menu file is specified and it is in a subfolder
929 // to the Blackbox folder, extract the relative path to the menu file
930 // -> full path with the Blackbox folder replaced by an environment variable.
931 // Example: "C:\Blackbox\menu.rc" becomes "$Blackbox$\menu.rc"
932 // This way the Blackbox folder can be moved, and the menu path will still work! :D
933
934 if (IsInString(pSettings->menuFile, pSettings->SF_blackboxPath))
935 {
936 char relativePath[MAX_LINE_LENGTH];
937 strcpy(relativePath, "$Blackbox$");
938 strcat(relativePath, &pSettings->menuFile[(strlen(pSettings->SF_blackboxPath))]);
939 WriteString(pSettings->xobrcDefaultFile, "xoblite.menuFile:", relativePath);
940 }
941 else if (IsInString(pSettings->menuFile, pSettings->SF_userAppData))
942 {
943 char relativePath[MAX_LINE_LENGTH];
944 strcpy(relativePath, "$UserAppData$");
945 strcat(relativePath, &pSettings->menuFile[(strlen(pSettings->SF_userAppData))]);
946 WriteString(pSettings->xobrcDefaultFile, "xoblite.menuFile:", relativePath);
947 }
948 else WriteString(pSettings->xobrcDefaultFile, "xoblite.menuFile:", pSettings->menuFile);
949 }
950
951 return pSettings->menuFile;
952}
void WriteString(LPCSTR fp, LPCSTR keyword, LPSTR value)
Definition BBApi.cpp:3156
bool IsInString(LPCSTR inputString, LPCSTR searchString)
Definition BBApi.cpp:2519
void ReplaceShellFolders(LPSTR string)
Definition BBApi.cpp:2633

◆ stylePath()

LPCSTR stylePath ( LPCSTR other)
960{
961 if (other != NULL)
962 {
963 strcpy(pSettings->styleFile, other);
964 if (strchr(pSettings->styleFile, '\"')) StrRemoveEncap(pSettings->styleFile);
965 if (strchr(pSettings->styleFile, '$')) ReplaceShellFolders(pSettings->styleFile);
966
967 // If the full path to the style is specified and it is in a subfolder
968 // to the Blackbox folder, extract the relative path to the style
969 // -> full path with the Blackbox folder replaced by an environment variable.
970 // Example: "C:\Blackbox\styles\charcoal" becomes "$Blackbox$\styles\charcoal"
971 // This way the Blackbox folder can be moved, and the style path will still work! :D
972
973 if (!pSettings->usingDefaultTheme && IsInString(pSettings->styleFile, pSettings->SF_currentThemePath))
974 {
975 char relativePath[MAX_LINE_LENGTH];
976 strcpy(relativePath, "$CurrentTheme$");
977 strcat(relativePath, &pSettings->styleFile[(strlen(pSettings->SF_currentThemePath))]);
978 WriteString(pSettings->xobrcFile, "xoblite.styleFile:", relativePath);
979 }
980 else if (IsInString(pSettings->styleFile, pSettings->SF_blackboxPath))
981 {
982 char relativePath[MAX_LINE_LENGTH];
983 strcpy(relativePath, "$Blackbox$");
984 strcat(relativePath, &pSettings->styleFile[(strlen(pSettings->SF_blackboxPath))]);
985 WriteString(pSettings->xobrcFile, "xoblite.styleFile:", relativePath);
986 }
987 else WriteString(pSettings->xobrcFile, "xoblite.styleFile:", pSettings->styleFile);
988 }
989
990 return pSettings->styleFile;
991}

◆ GetBlackboxEditor()

void GetBlackboxEditor ( LPSTR editor)
1001{
1002 strncpy_s(editor, MAX_PATH, pSettings->preferredEditor, _TRUNCATE); // Yes, this is still unsafe... (legacy API function)
1003}

◆ MBoxErrorFile()

int MBoxErrorFile ( LPCSTR szFile)
1613{
1614 sprintf(tempBuf, "Error: Unable to open file \"%s\". Please check location and try again.", szFile);
1615 Log("MBoxErrorFile Called", szFile);
1616
1617 return MessageBox(GetBBWnd(), tempBuf, "xoblite", MB_OK | MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
1618}
void Log(LPCSTR des, LPCSTR line)
Definition BBApi.cpp:638
HWND GetBBWnd()
Definition BBApi.cpp:128

◆ MBoxErrorValue()

int MBoxErrorValue ( LPCSTR szValue)
1628{
1629 sprintf(tempBuf, "Error: %s", szValue);
1630 Log("MBoxErrorValue Called", szValue);
1631
1632 return MessageBox(GetBBWnd(), tempBuf, "xoblite", MB_OK | MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
1633}

◆ BBExecute()

HINSTANCE BBExecute ( HWND Owner,
LPCSTR szOperation,
LPCSTR szCommand,
LPCSTR szArgs,
LPCSTR szDirectory,
int nShowCmd,
bool noErrorMsgs )
1649{
1650 if (!strlen(szCommand)) return HINSTANCE(32);
1651
1652 //====================
1653
1654 HINSTANCE retValue;
1655 PVOID oldRedirectionValue;
1656
1657 //====================
1658
1659 if (pSettings->runningUnderWOW64)
1660 {
1661 LPFN_WOW64_DISABLE_REDIRECTION BBWow64DisableRedirection = (LPFN_WOW64_DISABLE_REDIRECTION)GetProcAddress(GetModuleHandle("kernel32"),"Wow64DisableWow64FsRedirection");
1662 BBWow64DisableRedirection(&oldRedirectionValue);
1663 }
1664
1665 //====================
1666
1667 DWORD type = GetFileAttributes(szCommand);
1668
1669 if (type & FILE_ATTRIBUTE_DIRECTORY && type != 0xFFFFFFFF)
1670 {
1671 retValue = ShellExecute(Owner, szOperation, szCommand, szArgs, NULL, nShowCmd ? nShowCmd : SW_SHOWNORMAL);
1672 }
1673 else
1674 {
1675 SHELLEXECUTEINFO si;
1676 ZeroMemory(&si, sizeof(si));
1677 si.cbSize = sizeof(SHELLEXECUTEINFO);
1678 si.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI;
1679 si.hwnd = Owner;
1680 si.lpVerb = szOperation;
1681
1682 if ((strlen(szCommand) >= 4) && (!_stricmp(&szCommand[strlen(szCommand)-4], ".lnk")))
1683 {
1684 // Let Explorer execute .lnk shortcuts to (hopefully?)
1685 // avoid some potential WoW64 redirection related issues...
1686 si.lpFile = "explorer";
1687 si.lpParameters = szCommand;
1688 si.lpDirectory = NULL;
1689 }
1690 else
1691 {
1692 // ...otherwise use ShellExecuteEx as usual...
1693 si.lpFile = szCommand;
1694 si.lpParameters = szArgs;
1695 si.lpDirectory = szDirectory;
1696 }
1697 si.nShow = nShowCmd ? nShowCmd : SW_SHOWNORMAL;
1698
1699 BOOL result = ShellExecuteEx(&si);
1700
1701 if (((result == FALSE) || ((int)si.hInstApp <= 32)) && !noErrorMsgs)
1702 {
1703 DWORD error = GetLastError();
1704
1705 char msg[MAX_LINE_LENGTH];
1706 _snprintf_s(msg, sizeof(msg), _TRUNCATE, "%s %s (%s)", szCommand, szArgs, szDirectory);
1707 Log("BBExecute failed", msg);
1708
1709 strcpy(msg, "ERROR: Could not execute ");
1710 strncat_s(msg, sizeof(msg), szCommand, 128);
1711 if (strlen(szCommand) >= 128) strcat(msg, "..."); // ...truncating long paths for the console error message...
1712
1713 switch (error)
1714 {
1715 case ERROR_PATH_NOT_FOUND: { strcat(msg, " -> Path not found!"); break; }
1716 case ERROR_DDE_FAIL: { strcat(msg, " -> DDE transaction failed!"); break; }
1717 case ERROR_NO_ASSOCIATION: { strcat(msg, " -> No application associated with extension!"); break; }
1718 case ERROR_ACCESS_DENIED: { strcat(msg, " -> Access denied!"); break; }
1719 case ERROR_DLL_NOT_FOUND: { strcat(msg, " -> DLL not found!"); break; }
1720 case ERROR_CANCELLED: { strcat(msg, " -> Cancelled!"); break; }
1721 case ERROR_NOT_ENOUGH_MEMORY: { strcat(msg, " -> Not enough memory!"); break; }
1722 case ERROR_SHARING_VIOLATION: { strcat(msg, " -> Sharing violation!"); break; }
1723 default: { strcat(msg, " -> File not found!"); break; } // ERROR_FILE_NOT_FOUND
1724 }
1725
1726 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)msg);
1727/*
1728 if (pSettings->debugLogging)
1729 {
1730 sprintf(msg, "DEBUG -> Command: %s / Arguments: %s / Directory: %s", szCommand, szArgs, szDirectory);
1731 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1732 }
1733*/
1734/*
1735 strcpy(msg, "Could not execute...\n\nCommand:\n");
1736
1737 if (szCommand != NULL) strcat(msg, szCommand);
1738 strcat(msg, " \n\nArguments:\n");
1739 if (szArgs != NULL) strcat(msg, szArgs);
1740 strcat(msg, " \n\nWorking directory:\n");
1741 if (szDirectory != NULL) strcat(msg, szDirectory);
1742 strcat(msg, " ");
1743
1744 MessageBox(GetBBWnd(), msg, "xoblite", MB_OK | MB_ICONERROR | MB_TOPMOST);
1745*/
1746 }
1747
1748 retValue = si.hInstApp;
1749 }
1750
1751 //====================
1752
1753 if (pSettings->runningUnderWOW64)
1754 {
1755 LPFN_WOW64_REVERT_REDIRECTION BBWow64RevertRedirection = (LPFN_WOW64_REVERT_REDIRECTION)GetProcAddress(GetModuleHandle("kernel32"),"Wow64RevertWow64FsRedirection");
1756 BBWow64RevertRedirection(&oldRedirectionValue);
1757 }
1758
1759 return retValue;
1760}
BOOL(WINAPI * LPFN_WOW64_DISABLE_REDIRECTION)(PVOID)
Definition BBApi.cpp:95
BOOL(WINAPI * LPFN_WOW64_REVERT_REDIRECTION)(PVOID)
Definition BBApi.cpp:96
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define CONSOLE_ERROR_MESSAGE
Definition BBApi.h:300
LPFN_WOW64_DISABLE_REDIRECTION BBWow64DisableRedirection
Definition Blackbox.cpp:96
LPFN_WOW64_REVERT_REDIRECTION BBWow64RevertRedirection
Definition Blackbox.cpp:98

◆ BBSmartExecute()

void BBSmartExecute ( LPSTR inputString)
1768{
1769 if (!strlen(inputString)) return;
1770
1771 //====================
1772
1773 if (inputString[0] == '@') // Broadcast message (bro@m)
1774 {
1775 // Note: We need to use SendMessage() here for any "parent" @Script scripts to be executing sequentially!
1776 // (i.e. if we had used PostMessage() here any @Script "child" bro@ms would be more like executing in parallel...)
1777 SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)inputString);
1778 }
1779
1780 //====================
1781
1782 else if (!_strnicmp(inputString, "Pause", 5)) // @Script Pause <milliseconds> command
1783 {
1784 Sleep(atoi(&inputString[6]));
1785 }
1786
1787 //====================
1788
1789 else if ((!_strnicmp(inputString, "? ", 2)) && (strlen(inputString) > 2))
1790 {
1791 // Open the default browser to perform a web search using DuckDuckGo...
1792 char searchString[MAX_LINE_LENGTH];
1793 sprintf(searchString, "https://duckduckgo.com/?q=\"%s\"", &inputString[2]);
1794 BBSmartExecute(searchString);
1795 }
1796
1797 else if ((!_strnicmp(inputString, "http", 4)) && pPluginManager->IsPluginLoaded("xWebViewer"))
1798// else if ((!_strnicmp(inputString, "http://xoblite.net/", 19)) && pPluginManager->IsPluginLoaded("xWebViewer"))
1799 {
1800 // Open the URL in the xWebViewer plugin... (nb. if the plugin is *not* loaded, the URL will open in the default browser instead)
1801 char broam[MAX_LINE_LENGTH];
1802 sprintf(broam, "@xWebViewer URL %s", inputString);
1803 BBSmartExecute(broam);
1804 }
1805
1806 //====================
1807
1808 else // Regular command - extract working directory, arguments etc from input string
1809 {
1810 if (strchr(inputString, '$')) ReplaceShellFolders(inputString);
1811 if (strchr(inputString, '%')) ReplaceEnvVars(inputString);
1812
1813 char command[MAX_LINE_LENGTH], arguments[MAX_LINE_LENGTH], workingdir[MAX_LINE_LENGTH];
1814 LPSTR tokens[1];
1815 tokens[0] = command;
1816 command[0] = arguments[0] = workingdir[0] = '\0';
1817 BBTokenize (inputString, tokens, 1, arguments);
1818
1819 if (command[1] == ':')
1820 {
1821 strcpy(workingdir, command);
1822 GetParentFolder(workingdir);
1823 }
1824
1825 BBExecute(GetDesktopWindow(), NULL, command, arguments, workingdir, SW_SHOWNORMAL, false);
1826
1827// PlaySoundFX(SFX_MENU_CLICK);
1828 }
1829}
void BBSmartExecute(LPSTR inputString)
Definition BBApi.cpp:1767
int BBTokenize(LPCSTR szString, char *lpszBuffers[], DWORD dwNumBuffers, LPSTR szExtraParameters)
Definition BBApi.cpp:316
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
void ReplaceEnvVars(LPSTR string)
Definition BBApi.cpp:2594
PluginManager * pPluginManager
Definition Blackbox.cpp:43
#define BB_BROADCAST
Definition BBApi.h:245

◆ IsAppWindow()

bool IsAppWindow ( HWND hWnd)
1837{
1838 if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_SYSMENU))
1839 {
1840 char windowClass[MAX_LINE_LENGTH];
1841 GetClassName(hWnd, windowClass, sizeof(windowClass));
1842 if (!_strnicmp(windowClass, "BBAppPlugin", 11)) return true; // Allow specific "application-like" plugins to show up on the taskbar...
1843
1844 char windowText[MAX_LINE_LENGTH];
1845 GetWindowText(hWnd, windowText, sizeof(windowText));
1846
1847 // Below: Workarounds for various application not having the WS_SYSMENU flag set...
1848 // (nb. it remains to be seen if other such apps need to be added to this list too)
1849
1850 if (!_stricmp(windowClass, "MozillaWindowClass"))
1851 {
1852 // ##### Some newer Mozilla Firefox builds (at least version >= 135.0 as of this writing) #####
1853 return true;
1854 }
1855 else if (!_stricmp(windowClass, "Chrome_WidgetWin_1"))
1856 {
1857 // ##### Visual Studio Code, Microsoft Teams and Termius main window (all window class "Chrome_WidgetWin_1") #####
1858 if (IsInString(windowText, "Visual Studio Code") || IsInString(windowText, "Microsoft Teams")) return true;
1859 else if (IsInString(windowText, "Termius -") && _stricmp(windowText, "Termius - Settings")) return true; // ...but not the Termius settings child window
1860
1861 if (pSettings->debugLogging)
1862 {
1863 char msg[MAX_LINE_LENGTH];
1864 if (hWnd && (strlen(windowText) > 0)) sprintf(msg, "DEBUG -> BBApi::IsAppWindow (Chrome_WidgetWin_1 specific checks) -> WS_SYSMENU check failed! -> %s", windowText);
1865 else strcpy(msg, "DEBUG -> BBApi::IsAppWindow (Chrome_WidgetWin_1 specific checks) -> No HWND!");
1866 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)msg);
1867 Log(msg, "");
1868 }
1869
1870 return false;
1871 }
1872 else
1873 {
1874 // ##### Any other applications not having the WS_SYSMENU flag set #####
1875/*
1876 if (pSettings->debugLogging)
1877 {
1878 char msg[MAX_LINE_LENGTH];
1879 if (hWnd)
1880 {
1881 if (strlen(windowText) > 0) sprintf(msg, "DEBUG -> BBApi::IsAppWindow (non application specific checks) -> WS_SYSMENU check failed! -> %s %s", windowClass, windowText);
1882// else sprintf(msg, "DEBUG -> BBApi::IsAppWindow (non application specific checks) -> WS_SYSMENU check failed! -> %s <None>", windowClass); // Not really of any interest?
1883 }
1884 else strcpy(msg, "DEBUG -> BBApi::IsAppWindow (non application specific checks) -> No HWND!");
1885 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)msg);
1886 Log(msg, "");
1887 }
1888*/
1889 return false;
1890 }
1891 }
1892
1893 //====================
1894
1895// if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_VISIBLE)) return false;
1896// if (GetWindowLong(hWnd, GWL_STYLE) & WS_DISABLED) return false;
1897
1898 char windowClass[MAX_LINE_LENGTH];
1899 GetClassName(hWnd, windowClass, sizeof(windowClass));
1900 if (strlen(windowClass) == 0) return false;
1901 if (!_stricmp(windowClass, "AcrobatOffscreenDocumentWnd")) return false; // Check for Adobe Acrobat 7.0 offscreen windows...
1902
1903 char windowText[MAX_LINE_LENGTH];
1904 GetWindowText(hWnd, windowText, sizeof(windowText));
1905 if (strlen(windowText) == 0)
1906 {
1907/*
1908 if (pSettings->debugLogging)
1909 {
1910 char msg[MAX_LINE_LENGTH];
1911 sprintf(msg, "DEBUG -> BBApi::IsAppWindow -> GetWindowText failed! -> %s", windowClass);
1912 // SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1913 Log(msg, "");
1914 }
1915*/
1916 return false;
1917 }
1918
1919 // if (IsInString(windowText, " Powerpoint - [")) return false; // Check for Microsoft Powerpoint non-document windows... (-> "Microsoft Powerpoint - [" or "Microsoft Office PowerPoint - [" )
1920
1921 // The Windows 10 Cortana window is seemingly odd, non-cloaking but also non-closeable etc, so shouldn't be shown on the taskbar...
1922 if (!_stricmp(windowText, "Cortana")) return false;
1923
1924 //====================
1925
1926 if (IsWindowVisible(hWnd))
1927 {
1928 if (!(GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
1929 {
1930 if (!GetParent(hWnd))
1931 {
1932 HWND hwndOwner = GetWindow(hWnd, GW_OWNER);
1933 if (!hwndOwner ||
1934 ((GetWindowLong(hwndOwner, GWL_STYLE) & (WS_VISIBLE | WS_CLIPCHILDREN)) != (WS_VISIBLE | WS_CLIPCHILDREN)) ||
1935 GetWindowLong(hwndOwner, GWL_EXSTYLE) & WS_EX_TOOLWINDOW )
1936 {
1937 return true;
1938 }
1939// else if (pSettings->debugLogging && IsInString(windowClass, "Chrome_WidgetWin")) Log("...Chrome_WidgetWin -> IsWindowVisible GetWindow etc checks failed!", "");
1940 }
1941// else if (pSettings->debugLogging && IsInString(windowClass, "Chrome_WidgetWin")) Log("...Chrome_WidgetWin -> IsWindowVisible GetParent check failed!", "");
1942 }
1943// else if (pSettings->debugLogging && IsInString(windowClass, "Chrome_WidgetWin")) Log("...Chrome_WidgetWin -> IsWindowVisible GetWindowLong check failed!", "");
1944 }
1945/*
1946 else if (pSettings->debugLogging)
1947 {
1948 if (IsInString(windowClass, "Chrome_WidgetWin"))
1949 {
1950 char msg[MAX_LINE_LENGTH];
1951 if (!strlen(windowText)) strcpy(windowText, "NULL");
1952 sprintf(msg, "DEBUG -> BBApi::IsAppWindow -> IsWindowVisible etc checks failed! -> %s | %s", windowText, windowClass);
1953 // SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1954 Log(msg, "");
1955 }
1956 }
1957*/
1958 return false;
1959}
#define CONSOLE_WARNING_MESSAGE
Definition BBApi.h:299

◆ SnapWindowToEdge()

void SnapWindowToEdge ( WINDOWPOS * pwPos,
int nDist,
bool bUseScreenSize )
1971{
1972 RECT workArea;
1973 ZeroMemory(&workArea, sizeof(workArea));
1974 int nTemp;
1975
1976 //====================
1977
1978 if (bUseScreenSize)
1979 {
1980 workArea.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
1981 workArea.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
1982 }
1983 else
1984 {
1985 SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
1986 }
1987
1988 //====================
1989
1990 // Left edge
1991 nTemp = pwPos->x - workArea.left;
1992 if (nTemp < nDist && nTemp > -nDist)
1993 pwPos->x = workArea.left;
1994
1995 // Top edge
1996 nTemp = pwPos->y - workArea.top;
1997 if (nTemp < nDist && nTemp > -nDist)
1998 pwPos->y = workArea.top;
1999
2000 // Right edge
2001 nTemp = workArea.right - (pwPos->x + pwPos->cx);
2002 if (nTemp < nDist && nTemp > -nDist)
2003 pwPos->x = workArea.right - pwPos->cx;
2004
2005 // Bottom edge
2006 nTemp = workArea.bottom - (pwPos->y + pwPos->cy);
2007 if (nTemp < nDist && nTemp > -nDist)
2008 pwPos->y = workArea.bottom - pwPos->cy;
2009}

◆ GetPositionEvolved()

void GetPositionEvolved ( LPSTR placement,
SIZE size,
POINT * pt )
2017{
2018 Placement tempPlacement;
2019 tempPlacement.width = size.cx;
2020 tempPlacement.height = size.cy;
2021
2022 pSettings->ParsePlacement(placement, &tempPlacement);
2023 pSettings->PositionFromPlacement(&tempPlacement);
2024
2025 pt->x = tempPlacement.x;
2026 pt->y = tempPlacement.y;
2027}
Definition Settings.h:87
int height
Definition Settings.h:97
int width
Definition Settings.h:96
int x
Definition Settings.h:94
int y
Definition Settings.h:95

◆ FindStyleElement()

StyleItem * FindStyleElement ( LPSTR styleElement)
2036{
2037 if (IsInString(styleElement, "toolbar"))
2038 {
2039 if (IsInString(styleElement, "windowLabel")) return pSettings->ToolbarWindowLabel; // toolbar.windowLabel
2040 else if (IsInString(styleElement, "label")) return pSettings->ToolbarLabel; // toolbar.label
2041 else if (IsInString(styleElement, "clock")) return pSettings->ToolbarClock; // toolbar.clock
2042 else if (IsInString(styleElement, "pressed")) return pSettings->ToolbarButtonPressed; // toolbar.button.pressed
2043 else if (IsInString(styleElement, "button")) return pSettings->ToolbarButton; // toolbar.button
2044 else return pSettings->Toolbar; // toolbar (i.e. the background)
2045 }
2046 else if (IsInString(styleElement, "menu"))
2047 {
2048 if (IsInString(styleElement, "title")) return pSettings->MenuTitle; // menu.title
2049 else if (IsInString(styleElement, "hilite")) return pSettings->MenuActive; // menu.hilite (i.e. legacy bb4nix syntax menu.active)
2050 else if (IsInString(styleElement, "active")) return pSettings->MenuActive; // menu.active (i.e. bb4nix 0.70 syntax menu.hilite)
2051 else if (IsInString(styleElement, "grip")) return pSettings->MenuGrip; // menu.grip
2052 else return pSettings->MenuFrame; // menu.frame
2053 }
2054 else if (IsInString(styleElement, "dock")) return pSettings->Dock; // dock
2055 else if (IsInString(styleElement, "slit")) return pSettings->Dock; // + backwards compatibility with old "slit" syntax
2056 else if (IsInString(styleElement, "console")) return pSettings->Console; // console
2057 else if (IsInString(styleElement, "window"))
2058 {
2059 if (IsInString(styleElement, "title"))
2060 {
2061 if (IsInString(styleElement, "unfocus")) return pSettings->WindowTitleUnfocus; // window.title.unfocus
2062 else return pSettings->WindowTitleFocus; // window.title.focus
2063 }
2064 else if (IsInString(styleElement, "label"))
2065 {
2066 if (IsInString(styleElement, "unfocus")) return pSettings->WindowLabelUnfocus; // window.label.unfocus
2067 else return pSettings->WindowLabelFocus; // window.label.focus
2068 }
2069 else if (IsInString(styleElement, "button"))
2070 {
2071 if (IsInString(styleElement, "pressed")) return pSettings->WindowButtonPressed; // window.button.pressed
2072 else if (IsInString(styleElement, "unfocus")) return pSettings->WindowButtonUnfocus; // window.button.unfocus
2073 else return pSettings->WindowButtonFocus; //window.button.focus
2074 }
2075 else if (IsInString(styleElement, "grip"))
2076 {
2077 if (IsInString(styleElement, "unfocus")) return pSettings->WindowGripUnfocus; // window.grip.unfocus
2078 else return pSettings->WindowGripFocus; // window.grip.focus
2079 }
2080 else if (IsInString(styleElement, "handle"))
2081 {
2082 if (IsInString(styleElement, "unfocus")) return pSettings->WindowHandleUnfocus; // window.handle.unfocus
2083 else return pSettings->WindowHandleFocus; // window.handle.focus
2084 }
2085// else if (IsInString(styleElement, "frame")) return pSettings->WindowFrame; // window.frame
2086 }
2087
2088 return NULL;
2089}

◆ GetMetricsEvolved()

int GetMetricsEvolved ( LPSTR styleElement,
int metricsToInclude )
2098{
2099 StyleItem* element = FindStyleElement(styleElement);
2100
2101 if (element != NULL) // -> Supported style element found!
2102 {
2103 int padding = 0;
2104 if (metricsToInclude & METRIC_BORDER) padding += element->borderWidth;
2105 if (metricsToInclude & METRIC_MARGIN) padding += element->marginWidth;
2106 if (metricsToInclude & METRIC_BEVEL)
2107 {
2108 if (element->bevelstyle != BEVEL_FLAT)
2109 {
2110 if (element->bevelposition == BEVEL2) padding += 2;
2111 else padding += 1;
2112 }
2113 }
2114 return padding;
2115 }
2116 else return 0; // -> Unsupported style element...
2117}
StyleItem * FindStyleElement(LPSTR styleElement)
Definition BBApi.cpp:2035
#define METRIC_MARGIN
Definition BBApi.h:132
#define METRIC_BORDER
Definition BBApi.h:131
#define BEVEL_FLAT
Definition BBApi.h:105
#define METRIC_BEVEL
Definition BBApi.h:133
#define BEVEL2
Definition BBApi.h:109
Definition BBApi.h:398
int borderWidth
Definition BBApi.h:417
int bevelstyle
Definition BBApi.h:400
int bevelposition
Definition BBApi.h:401
int marginWidth
Definition BBApi.h:416

◆ MakeGradientSuper()

void MakeGradientSuper ( HDC hdc,
RECT rect,
int type,
COLORREF color1,
COLORREF color2,
COLORREF color3,
COLORREF color4,
COLORREF color5,
COLORREF color6,
COLORREF color7,
COLORREF color8,
bool bInterlaced,
int bevelStyle,
int bevelPosition,
int bevelWidth,
COLORREF borderColour,
int borderWidth )
2128{
2129 if (borderWidth > 0)
2130 {
2131 gradientRect.left = rect.left + borderWidth;
2132 gradientRect.top = rect.top + borderWidth;
2133 gradientRect.right = rect.right - borderWidth;
2134 gradientRect.bottom = rect.bottom - borderWidth;
2135
2136 pBImage->DrawBorder(hdc, rect, borderColour, borderWidth);
2137 pBImage->DrawGradient(hdc, gradientRect, type, color1, color2, color3, color4, color5, color6, color7, color8, bInterlaced, bevelStyle, bevelPosition, bevelWidth);
2138 }
2139 else pBImage->DrawGradient(hdc, rect, type, color1, color2, color3, color4, color5, color6, color7, color8, bInterlaced, bevelStyle, bevelPosition, bevelWidth);
2140}
BImage * pBImage
Definition Blackbox.cpp:35
RECT gradientRect
Definition BBApi.cpp:2125

◆ MakeGradientEx()

void MakeGradientEx ( HDC hdc,
RECT rect,
int type,
COLORREF color1,
COLORREF color2,
COLORREF split1,
COLORREF split2,
bool bInterlaced,
int bevelStyle,
int bevelPosition,
int bevelWidth,
COLORREF borderColour,
int borderWidth )
2145{
2146 // Below: Allow limited "forwards compatibility" by supporting down-parsing of newer, otherwise normally 8-colour gradients,
2147 // to use only the 4 supplied input colours (i.e. at least avoiding partially "black" renders)
2148 int allowedType = type;
2149 if (type == B_SUPERHORIZONTAL || type == B_SUPERVERTICAL) allowedType -= 50; // -> Converted to 4-colour B_SPLITHORIZONTAL and B_SPLITVERTICAL respectively
2150
2151 MakeGradientSuper(hdc, rect, allowedType, color1, color2, split1, split2, 0, 0, 0, 0, bInterlaced, bevelStyle, bevelPosition, bevelWidth, borderColour, borderWidth);
2152}
void MakeGradientSuper(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth)
Definition BBApi.cpp:2127
#define B_SUPERVERTICAL
Definition BBApi.h:92
#define B_SUPERHORIZONTAL
Definition BBApi.h:91

◆ MakeGradient()

void MakeGradient ( HDC hdc,
RECT rect,
int type,
COLORREF color1,
COLORREF color2,
bool interlaced,
int bevelStyle,
int bevelPosition,
int bevelWidth,
COLORREF borderColor,
int borderWidth )
2157{
2158 // Below: Allow limited "forwards compatibility" by supporting down-parsing of newer, otherwise normally 4- or 8-colour gradients,
2159 // to use only the 2 supplied input colours (i.e. at least avoiding partially "black" renders)
2160 int allowedType = type;
2161 if (type == B_SUPERHORIZONTAL || type == B_SUPERVERTICAL) allowedType -= 150; // -> Converted to 2-colour B_HORIZONTAL and B_VERTICAL respectively
2162 else if (type == B_SPLITHORIZONTAL || type == B_SPLITVERTICAL || type == B_SPLITSOLID) allowedType -= 100; // (etc)
2163
2164 MakeGradientSuper(hdc, rect, allowedType, color1, color2, 0, 0, 0, 0, 0, 0, interlaced, bevelStyle, bevelPosition, bevelWidth, borderColor, borderWidth);
2165}
#define B_SPLITSOLID
Definition BBApi.h:88
#define B_SPLITHORIZONTAL
Definition BBApi.h:86
#define B_SPLITVERTICAL
Definition BBApi.h:87

◆ MakeGradientEvolved()

bool MakeGradientEvolved ( HDC hdc,
RECT rect,
LPSTR styleElement,
bool drawBevel,
bool drawBorder )
2170{
2171 StyleItem* element = FindStyleElement(styleElement);
2172
2173 if (element != NULL) // -> Supported style element found!
2174 {
2175 if (!element->parentRelative)
2176 {
2177 // Make sure the requested gradient will actually fit within the target RECT; if not then deny the request...
2178 int borderSpace = element->borderWidth * 2;
2179 int availableSpace = rect.right - rect.left - 4;
2180 if ((borderSpace > availableSpace) || (availableSpace <= 0)) return false;
2181 availableSpace = rect.bottom - rect.top - 4;
2182 if ((borderSpace > availableSpace) || (availableSpace <= 0)) return false;
2183
2184 // Let's draw the gradient... (including any *regular* border)
2185// if ((element->type == B_IMAGEFROMFILE) && (element->Image.bitmap != NULL)) DrawImageIntoRect(hdc, rect, element, false, drawBorder);
2186 if ((element->type == B_IMAGEFROMFILE) && (element->Image.bitmap != NULL))
2187 {
2188/*
2189 if ((element == pSettings->Toolbar) ||
2190 (element == pSettings->MenuTitle) || (element == pSettings->MenuFrame) || (element == pSettings->MenuGrip) ||
2191 (element == pSettings->Dock) ||
2192 (element == pSettings->WindowTitleFocus) || (element == pSettings->WindowTitleUnfocus) ||
2193 (element == pSettings->WindowGripFocus) || (element == pSettings->WindowGripUnfocus) ||
2194 (element == pSettings->WindowHandleFocus) || (element == pSettings->WindowHandleUnfocus))
2195 {
2196 DrawImageIntoRect(hdc, rect, element, false, drawBorder);
2197 }
2198 else DrawImageIntoRect(hdc, rect, element, true, drawBorder); // -> Only allow ARGB image drawing for "non parent" elements (e.g. buttons)
2199*/
2200 if ((element == pSettings->ToolbarButton) || (element == pSettings->ToolbarButtonPressed) ||
2201 (element == pSettings->WindowButtonFocus) || (element == pSettings->WindowButtonPressed) || (element == pSettings->WindowButtonUnfocus))
2202 {
2203 DrawImageIntoRect(hdc, rect, element, true, drawBorder); // -> Only allow ARGB images drawing for button elements (assuming these are always drawn on top of a parent element)
2204 }
2205 else DrawImageIntoRect(hdc, rect, element, false, drawBorder);
2206 }
2207 else if (!drawBevel) MakeGradientSuper(hdc, rect, element->type, element->Color1, element->Color2, element->Color3, element->Color4, element->Color5, element->Color6, element->Color7, element->Color8, element->interlaced, BEVEL_FLAT, 0, 0, element->borderColor, drawBorder ? element->borderWidth : 0);
2208 else MakeGradientSuper(hdc, rect, element->type, element->Color1, element->Color2, element->Color3, element->Color4, element->Color5, element->Color6, element->Color7, element->Color8, element->interlaced, element->bevelstyle, element->bevelposition, pSettings->bevelWidth, element->borderColor, drawBorder ? element->borderWidth : 0);
2209
2210 // Should we draw a *gradient* border around the gradient? (introduced in xoblite bb5 RC4)
2211 if (drawBorder)
2212 {
2213 StyleItem* elementBorder = NULL;
2214 if ((element == pSettings->Toolbar) && (pSettings->ToolbarBorder->type != B_PARENTRELATIVE)) elementBorder = pSettings->ToolbarBorder;
2215 else if ((element == pSettings->MenuFrame) && (pSettings->MenuFrameBorder->type != B_PARENTRELATIVE)) elementBorder = pSettings->MenuFrameBorder;
2216 else if ((element == pSettings->Dock) && (pSettings->DockBorder->type != B_PARENTRELATIVE)) elementBorder = pSettings->DockBorder;
2217
2218 if (elementBorder != NULL) CreateBorderSuper(hdc, rect, elementBorder->type, elementBorder->Color1, elementBorder->Color2, elementBorder->Color3, elementBorder->Color4, elementBorder->Color5, elementBorder->Color6, elementBorder->Color7, elementBorder->Color8, element->borderWidth);
2219 }
2220
2221 return true;
2222 }
2223 else return false; // Style element is parentRelative, nothing drawn...
2224 }
2225 else return false; // -> Unsupported style element, nothing drawn...
2226}
void DrawImageIntoRect(HDC hdc, RECT r, StyleItem *styleItem, bool useAlpha, bool drawBorder)
Definition BBApi.cpp:2333
void CreateBorderSuper(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, int borderWidth)
Definition BBApi.cpp:2250
#define B_IMAGEFROMFILE
Definition BBApi.h:83
#define B_PARENTRELATIVE
Definition BBApi.h:69
COLORREF Color5
Definition BBApi.h:436
COLORREF Color4
Definition BBApi.h:434
bool parentRelative
Definition BBApi.h:403
COLORREF Color6
Definition BBApi.h:437
int type
Definition BBApi.h:402
COLORREF Color7
Definition BBApi.h:438
COLORREF Color8
Definition BBApi.h:439
StyleItemImage Image
Definition BBApi.h:441
bool interlaced
Definition BBApi.h:404
COLORREF Color3
Definition BBApi.h:433
COLORREF borderColor
Definition BBApi.h:418
HBITMAP bitmap
Definition BBApi.h:386

◆ MakeStyleGradient()

void MakeStyleGradient ( HDC hdc,
RECT * rect,
StyleItem * item,
bool withBorder )
2231{
2232 // Note: Currently for basic API compatibility only, e.g. not yet accessing StyleItem info beyond "safe" classic 2-colour gradients etc, hence re-parsing via MakeGradient here...
2233 // (read: possibly subject to change later on, pending renewed API version handling across branches? (note: not currently specified in e.g. the StyleItem definition))
2234 if (item->nVersion == CORE_SHELL_STYLEITEM) MakeGradientSuper(hdc, *rect, item->type, item->Color1, item->Color2, item->Color3, item->Color4, item->Color5, item->Color6, item->Color7, item->Color8, item->interlaced, item->bevelstyle, item->bevelposition, 0, pSettings->borderColor, withBorder ? pSettings->borderWidth : 0);
2235 else MakeGradient(hdc, *rect, item->type, item->Color, item->ColorTo, item->interlaced, item->bevelstyle, item->bevelposition, 0, pSettings->borderColor, withBorder ? pSettings->borderWidth : 0);
2236}
void MakeGradient(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, bool interlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColor, int borderWidth)
Definition BBApi.cpp:2156
#define CORE_SHELL_STYLEITEM
Definition BBApi.h:453
int nVersion
Definition BBApi.h:415
COLORREF Color
Definition BBApi.h:406
COLORREF ColorTo
Definition BBApi.h:407

◆ CreateBorder()

void CreateBorder ( HDC hdc,
RECT * rect,
int borderColour,
int borderWidth )
2244{
2245 pBImage->DrawBorder(hdc, *rect, borderColour, borderWidth);
2246}

◆ CreateBorderSuper()

void CreateBorderSuper ( HDC hdc,
RECT rect,
int type,
COLORREF color1,
COLORREF color2,
COLORREF color3,
COLORREF color4,
COLORREF color5,
COLORREF color6,
COLORREF color7,
COLORREF color8,
int borderWidth )
2251{
2252 // ##################################################################################################
2253 // ##### BELOW: EXPERIMENTAL SUPPORT FOR GRADIENT BORDERS, NOT YET MEANT FOR PUBLIC CONSUMPTION #####
2254 // ##################################################################################################
2255
2256 RECT borderRectLeft, borderRectTop, borderRectRight, borderRectBottom;
2257 SetRect(&borderRectLeft, rect.left, rect.top, rect.left + borderWidth, rect.bottom);
2258 SetRect(&borderRectTop, rect.left, rect.top, rect.right, rect.top + borderWidth);
2259 SetRect(&borderRectRight, rect.right - borderWidth, rect.top, rect.right, rect.bottom);
2260 SetRect(&borderRectBottom, rect.left, rect.bottom - borderWidth, rect.right, rect.bottom);
2261
2262 int overlap = borderWidth - 1;
2263
2264 if ((type == B_SUPERHORIZONTAL) || (type == B_SPLITHORIZONTAL) || (type == B_MIRRORHORIZONTAL) || (type == B_HORIZONTAL))
2265 {
2266 InflateRect(&borderRectTop, -overlap, 0);
2267 InflateRect(&borderRectBottom, -overlap, 0);
2268
2269 COLORREF borderColorRight;
2270 if (type == B_SUPERHORIZONTAL) borderColorRight = color8;
2271 else if (type == B_SPLITHORIZONTAL) borderColorRight = color4;
2272 else if (type == B_MIRRORHORIZONTAL) borderColorRight = color1;
2273 else borderColorRight = color2;
2274
2275 MakeGradientSuper(hdc, borderRectLeft, B_SOLID, color1, 0, 0, 0, 0, 0, 0, 0, false, BEVEL_FLAT, 0, 0, 0, 0);
2276 MakeGradientSuper(hdc, borderRectRight, B_SOLID, borderColorRight, 0, 0, 0, 0, 0, 0, 0, false, BEVEL_FLAT, 0, 0, 0, 0);
2277 MakeGradientSuper(hdc, borderRectTop, type, color1, color2, color3, color4, color5, color6, color7, color8, false, BEVEL_FLAT, 0, 0, 0, 0);
2278 MakeGradientSuper(hdc, borderRectBottom, type, color1, color2, color3, color4, color5, color6, color7, color8, false, BEVEL_FLAT, 0, 0, 0, 0);
2279 }
2280 else if ((type == B_SUPERVERTICAL) || (type == B_SPLITVERTICAL) || (type == B_MIRRORVERTICAL) || (type == B_VERTICAL))
2281 {
2282 InflateRect(&borderRectLeft, 0, -overlap);
2283 InflateRect(&borderRectRight, 0, -overlap);
2284
2285 COLORREF borderColorBottom;
2286 if (type == B_SUPERVERTICAL) borderColorBottom = color8;
2287 else if (type == B_SPLITVERTICAL) borderColorBottom = color4;
2288 else if (type == B_MIRRORVERTICAL) borderColorBottom = color1;
2289 else borderColorBottom = color2;
2290
2291 MakeGradientSuper(hdc, borderRectTop, B_SOLID, color1, 0, 0, 0, 0, 0, 0, 0, false, BEVEL_FLAT, 0, 0, 0, 0);
2292 MakeGradientSuper(hdc, borderRectBottom, B_SOLID, borderColorBottom, 0, 0, 0, 0, 0, 0, 0, false, BEVEL_FLAT, 0, 0, 0, 0);
2293 MakeGradientSuper(hdc, borderRectLeft, type, color1, color2, color3, color4, color5, color6, color7, color8, false, BEVEL_FLAT, 0, 0, 0, 0);
2294 MakeGradientSuper(hdc, borderRectRight, type, color1, color2, color3, color4, color5, color6, color7, color8, false, BEVEL_FLAT, 0, 0, 0, 0);
2295 }
2296}
#define B_VERTICAL
Definition BBApi.h:73
#define B_MIRRORHORIZONTAL
Definition BBApi.h:95
#define B_SOLID
Definition BBApi.h:80
#define B_MIRRORVERTICAL
Definition BBApi.h:96
#define B_HORIZONTAL
Definition BBApi.h:72

◆ CreateElementImage()

void CreateElementImage ( StyleItem * styleItem)
2304{
2305 if (styleItem->Image.bitmap != NULL) return;
2306
2307// if (pSettings->debugLogging) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)styleItem->Image.path);
2308
2309 // Load the image using GDI+ to add support for JPG, PNG etc...
2310 // (nb. regular GDI LoadImage() only supports BMP images. GDI+ startup/shutdown is performed "globally" in Blackbox.cpp.)
2311 wchar_t imagePathWC[MAX_PATH];
2312 MultiByteToWideChar(CP_ACP, 0, styleItem->Image.path, strlen(styleItem->Image.path)+1, imagePathWC, MAX_PATH);
2313 Bitmap* bitmap = new Bitmap(imagePathWC, FALSE);
2314
2315 // ...fetch some of its properties...
2316 styleItem->Image.width = bitmap->GetWidth();
2317 styleItem->Image.height = bitmap->GetHeight();
2318 PixelFormat pf = bitmap->GetPixelFormat();
2319 if ((pf == PixelFormat32bppARGB) || (pf == PixelFormat32bppPARGB) || (pf == PixelFormat64bppARGB) || (pf == PixelFormat64bppPARGB)) styleItem->Image.argb = true;
2320 else styleItem->Image.argb = false;
2321
2322 // ...and finally create our target GDI HBITMAP from the loaded GDI+ Bitmap...
2323 bitmap->GetHBITMAP(0, &styleItem->Image.bitmap);
2324
2325 delete bitmap;
2326}
int width
Definition BBApi.h:389
bool argb
Definition BBApi.h:387
char path[MAX_PATH]
Definition BBApi.h:385
int height
Definition BBApi.h:390

◆ DrawImageIntoRect()

void DrawImageIntoRect ( HDC hdc,
RECT r,
StyleItem * styleItem,
bool useAlpha,
bool drawBorder )
2334{
2335 if (styleItem->Image.bitmap == NULL) return;
2336
2337 RECT tempRect;
2338 CopyRect(&tempRect, &r);
2339
2340 if (drawBorder)
2341 {
2342 // Draw border...
2343 CreateBorder(hdc, &tempRect, styleItem->borderColor, styleItem->borderWidth);
2344 InflateRect(&tempRect, -styleItem->borderWidth, -styleItem->borderWidth);
2345 }
2346
2347 // Draw image...
2348 HDC buf = CreateCompatibleDC(hdc);
2349 DeleteObject(SelectObject(buf, styleItem->Image.bitmap));
2350 SetStretchBltMode(hdc, HALFTONE);
2351
2352 int itemWidth = tempRect.right - tempRect.left;
2353 int itemHeight = tempRect.bottom - tempRect.top;
2354 int edgesLeftRight = styleItem->Image.left + styleItem->Image.right;
2355 int edgesTopBottom = styleItem->Image.top + styleItem->Image.bottom;
2356
2357 if (useAlpha && styleItem->Image.argb) // -> Should we draw an ARGB image using alpha blending on top of something else? (e.g. menu bullets)
2358 {
2359 // ### Note: While AlphaBlend() can be used to draw 32bpp ARGB images with per pixel alpha transparency, it also scales images down
2360 // much less smoothly than StretchBlt() as it reverts from HALFTONE (i.e. pixel averaging) to COLORONCOLOR (i.e. pixel deleting) mode;
2361 // for more information see https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-alphablend ###
2362 BLENDFUNCTION bf;
2363 ZeroMemory(&bf, sizeof(BLENDFUNCTION));
2364 bf.BlendOp = AC_SRC_OVER;
2365 bf.SourceConstantAlpha = 255;
2366 bf.AlphaFormat = AC_SRC_ALPHA;
2367 AlphaBlend(hdc, tempRect.left, tempRect.top, itemWidth, itemHeight, buf, 0, 0, styleItem->Image.width, styleItem->Image.height, bf);
2368 }
2369 else // -> If not, use the regular BitBlt/StretchBlt functions for RGB images as these provide better scaling quality... (see explanation above)
2370 {
2371 if ((styleItem->Image.width < edgesLeftRight) || (styleItem->Image.height < edgesTopBottom))
2372 {
2373 StretchBlt(hdc, tempRect.left, tempRect.top, itemWidth, itemHeight, buf, 0, 0, styleItem->Image.width, styleItem->Image.height, SRCCOPY);
2374 }
2375 else
2376 {
2377 if (styleItem->Image.left > 0)
2378 {
2379 if (styleItem->Image.top > 0) BitBlt(hdc, tempRect.left, tempRect.top, styleItem->Image.left, styleItem->Image.top, buf, 0, 0, SRCCOPY);
2380 if (styleItem->Image.bottom > 0) BitBlt(hdc, tempRect.left, (tempRect.bottom-styleItem->Image.bottom), styleItem->Image.left, styleItem->Image.bottom, buf, 0, (styleItem->Image.height-styleItem->Image.bottom), SRCCOPY);
2381 StretchBlt(hdc, tempRect.left, (tempRect.top+styleItem->Image.top), styleItem->Image.left, (itemHeight-edgesTopBottom), buf, 0, styleItem->Image.top, styleItem->Image.left, (styleItem->Image.height-edgesTopBottom), SRCCOPY);
2382 }
2383
2384 if (styleItem->Image.right > 0)
2385 {
2386 if (styleItem->Image.top > 0) BitBlt(hdc, tempRect.right-styleItem->Image.right, tempRect.top, styleItem->Image.right, styleItem->Image.top, buf, (styleItem->Image.width-styleItem->Image.right), 0, SRCCOPY);
2387 if (styleItem->Image.bottom > 0) BitBlt(hdc, tempRect.right-styleItem->Image.right, (tempRect.bottom-styleItem->Image.bottom), styleItem->Image.right, styleItem->Image.bottom, buf, (styleItem->Image.width-styleItem->Image.right), (styleItem->Image.height-styleItem->Image.bottom), SRCCOPY);
2388 StretchBlt(hdc, tempRect.right-styleItem->Image.right, (tempRect.top+styleItem->Image.top), styleItem->Image.right, (itemHeight-edgesTopBottom), buf, (styleItem->Image.width-styleItem->Image.right), styleItem->Image.top, styleItem->Image.right, (styleItem->Image.height-edgesTopBottom), SRCCOPY);
2389 }
2390
2391 if (styleItem->Image.top > 0)
2392 {
2393 if (styleItem->Image.left > 0) BitBlt(hdc, tempRect.left, tempRect.top, styleItem->Image.left, styleItem->Image.top, buf, 0, 0, SRCCOPY);
2394 if (styleItem->Image.right > 0) BitBlt(hdc, tempRect.right-styleItem->Image.right, tempRect.top, styleItem->Image.right, styleItem->Image.top, buf, (styleItem->Image.width-styleItem->Image.right), 0, SRCCOPY);
2395 StretchBlt(hdc, (tempRect.left+styleItem->Image.left), tempRect.top, (itemWidth-edgesLeftRight), (tempRect.top+styleItem->Image.top), buf, styleItem->Image.left, 0, (styleItem->Image.width-edgesLeftRight), styleItem->Image.top, SRCCOPY);
2396 }
2397
2398 if (styleItem->Image.bottom > 0)
2399 {
2400 if (styleItem->Image.left > 0) BitBlt(hdc, tempRect.left, (tempRect.bottom-styleItem->Image.bottom), styleItem->Image.left, styleItem->Image.bottom, buf, 0, (styleItem->Image.height-styleItem->Image.bottom), SRCCOPY);
2401 if (styleItem->Image.right > 0) BitBlt(hdc, tempRect.right-styleItem->Image.right, (tempRect.bottom-styleItem->Image.bottom), styleItem->Image.right, styleItem->Image.bottom, buf, (styleItem->Image.width-styleItem->Image.right), (styleItem->Image.height-styleItem->Image.bottom), SRCCOPY);
2402 StretchBlt(hdc, (tempRect.left+styleItem->Image.left), (tempRect.bottom-styleItem->Image.bottom), (itemWidth-edgesLeftRight), styleItem->Image.bottom, buf, styleItem->Image.left, (styleItem->Image.height-styleItem->Image.bottom), (styleItem->Image.width-edgesLeftRight), styleItem->Image.bottom, SRCCOPY);
2403 }
2404
2405 StretchBlt(hdc, (tempRect.left+styleItem->Image.left), (tempRect.top+styleItem->Image.top), (itemWidth-edgesLeftRight), (itemHeight-edgesTopBottom), buf, styleItem->Image.left, styleItem->Image.top, (styleItem->Image.width-edgesLeftRight), (styleItem->Image.height-edgesTopBottom), SRCCOPY);
2406 }
2407 }
2408
2409 DeleteDC(buf);
2410}
void CreateBorder(HDC hdc, RECT *rect, int borderColour, int borderWidth)
Definition BBApi.cpp:2243
int right
Definition BBApi.h:393
int bottom
Definition BBApi.h:394
int top
Definition BBApi.h:392
int left
Definition BBApi.h:391

◆ AlphaRect()

void AlphaRect ( HDC hdc,
RECT rect,
unsigned char alpha )
2420{
2421 // Note: Use alpha == 255 as input value to remove
2422 // per pixel alpha i.e. make the rect fully opaque.
2423 pBImage->AlphaRect(hdc, rect, alpha);
2424}

◆ AlphaBorder()

void AlphaBorder ( HDC hdc,
RECT rect,
unsigned char alpha,
int borderWidth )
2427{
2428 pBImage->AlphaBorder(hdc, rect, alpha, borderWidth);
2429}

◆ AlphaCorner()

void AlphaCorner ( HDC hdc,
RECT rect,
int corner,
int bevelStyle,
int bevelPosition,
int bevelWidth,
int borderWidth,
unsigned char minAlpha,
unsigned char maxAlpha )
2432{
2433 // Note: All input parameters are not currently used, but have been included
2434 // in the function definition to avoid API changes if/when the implementation
2435 // is improved (which is tricky given the numerous rendering options available)
2436 pBImage->AlphaCorner(hdc, rect, corner, borderWidth, minAlpha, maxAlpha);
2437}

◆ AlphaFromRGB()

void AlphaFromRGB ( HDC hdc,
RECT rect,
unsigned char minAlpha,
unsigned char maxAlpha,
bool recolor,
COLORREF color )
2440{
2441 pBImage->AlphaFromRGB(hdc, rect, minAlpha, maxAlpha, recolor, color);
2442}

◆ AlphaMask()

void AlphaMask ( HDC destHdc,
RECT destRect,
HDC srcHdc,
RECT srcRect,
bool useSrcRGBAsAlpha )
2445{
2446 pBImage->AlphaMask(destHdc, destRect, srcHdc, srcRect, useSrcRGBAsAlpha);
2447}

◆ AlphaApply()

void AlphaApply ( HDC hdc,
RECT rect )
2450{
2451 // "AlphaApplyToRGB"
2452 // -> Pre-applies the per pixel alpha to the RGB values of each pixel
2453 // (required by related Windows API functions before processing).
2454 pBImage->AlphaApply(hdc, rect);
2455}

◆ PrepareCorner()

void PrepareCorner ( HDC hdc,
RECT rect,
int corner,
int bevelStyle,
int bevelPosition,
int bevelWidth,
int borderWidth )
2463{
2464 pBImage->PrepareCorner(hdc, rect, corner, bevelStyle, bevelPosition, bevelWidth, borderWidth);
2465}

◆ PrepareCornerEvolved()

int PrepareCornerEvolved ( HDC hdc,
RECT rect,
int corner,
LPSTR styleElement )
2468{
2469 StyleItem* element = FindStyleElement(styleElement);
2470 if (element != NULL)
2471 {
2472 pBImage->PrepareCorner(hdc, rect, corner, element->bevelstyle, element->bevelposition, 1, element->borderWidth);
2473 return element->borderWidth;
2474 }
2475 else return 0;
2476}

◆ EnumFontFamProc()

static int CALLBACK EnumFontFamProc ( ENUMLOGFONT * lpelf,
NEWTEXTMETRIC * lpntm,
int FontType,
LPARAM lParam )
static
2489{
2490 (*(int*)lParam)++;
2491 return 0;
2492}

◆ CreateStyleFont()

HFONT CreateStyleFont ( StyleItem * item)
2497{
2498 char *face = item->Font;
2499 int height = item->FontHeight;
2500 int weight = item->FontWeight;
2501
2502 HDC hdc = CreateCompatibleDC(NULL);
2503 int data = 0;
2504 EnumFontFamilies(hdc, face, (FONTENUMPROC)EnumFontFamProc, (LPARAM)&data);
2505 DeleteDC(hdc);
2506 if (!data) face = "verdana";
2507
2508 return CreateFont(height, 0, 0, 0, weight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, face);
2509}
static int CALLBACK EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, int FontType, LPARAM lParam)
Definition BBApi.cpp:2483
int FontWeight
Definition BBApi.h:410
int FontHeight
Definition BBApi.h:409
char Font[128]
Definition BBApi.h:413

◆ IsInString()

bool IsInString ( LPCSTR inputString,
LPCSTR searchString )
2520{
2521 // StrStrIA -> ANSI version of StrStrI, a case insensitive strstr (Win32 shlwapi.lib)
2522 if (StrStrIA(inputString, searchString) != NULL) return true;
2523 else return false;
2524}

◆ IsInStringUnicode()

bool IsInStringUnicode ( LPWSTR inputString,
LPWSTR searchString )
2527{
2528 // StrStrIW -> Unicode version of StrStrI, a case insensitive strstr (Win32 shlwapi.lib)
2529 if (StrStrIW(inputString, searchString) != NULL) return true;
2530 else return false;
2531}

◆ ParseItem()

void ParseItem ( LPCSTR szItem,
StyleItem * item )
2542{
2543 // Default settings
2544 item->type = B_SOLID;
2545 item->bevelstyle = BEVEL_FLAT;
2546 item->bevelposition = BEVEL1;
2547 item->parentRelative = false;
2548 item->interlaced = false;
2549
2550 if (strchr(szItem, '\\') || IsInString(szItem, "image")) // -> Simple (path in .appearance), or more advanced (path in .image, plus related options specified in .appearance)
2551 {
2552 item->type = B_IMAGEFROMFILE;
2553 return;
2554 }
2555
2556 if (IsInString(szItem, "solid")) item->type = B_SOLID;
2557 else if (IsInString(szItem, "vertical")) item->type = B_VERTICAL;
2558 else if (IsInString(szItem, "horizontal")) item->type = B_HORIZONTAL;
2559 else if (IsInString(szItem, "crossdiagonal")) item->type = B_CROSSDIAGONAL; // Must be checked before diagonal!
2560 else if (IsInString(szItem, "diagonal")) item->type = B_DIAGONAL;
2561 else if (IsInString(szItem, "pipecross")) item->type = B_PIPECROSS;
2562 else if (IsInString(szItem, "elliptic")) item->type = B_ELLIPTIC;
2563 else if (IsInString(szItem, "rectangle")) item->type = B_RECTANGLE;
2564 else if (IsInString(szItem, "pyramid")) item->type = B_PYRAMID;
2565
2566 if (IsInString(szItem, "split")) item->type += 100; // 4-colour "split" gradients (i.e. SplitHorizontal/SplitVertical)
2567 else if (IsInString(szItem, "super")) item->type += 150; // 8-colour "super" gradients (i.e. SuperHorizontal/SuperVertical)
2568 else if (IsInString(szItem, "mirror")) item->type += 200; // 2-colour "mirrored" gradients (i.e. MirrorHorizontal/MirrorVertical)
2569
2570 if (IsInString(szItem, "flat")) item->bevelstyle=BEVEL_FLAT;
2571 else if (IsInString(szItem, "raised")) item->bevelstyle=BEVEL_RAISED;
2572 else if (IsInString(szItem, "sunken")) item->bevelstyle=BEVEL_SUNKEN;
2573
2574 if (IsInString(szItem, "bevel2")) item->bevelposition=BEVEL2;
2575 else if (IsInString(szItem, "bevel1")) item->bevelposition=BEVEL1;
2576
2577 if (IsInString(szItem, "interlaced")) item->interlaced = true;
2578
2579 if (IsInString(szItem, "parentrelative"))
2580 {
2581 item->type = B_PARENTRELATIVE;
2582 item->parentRelative = true;
2583 }
2584}
#define BEVEL1
Definition BBApi.h:108
#define B_CROSSDIAGONAL
Definition BBApi.h:75
#define B_ELLIPTIC
Definition BBApi.h:77
#define B_DIAGONAL
Definition BBApi.h:74
#define B_PIPECROSS
Definition BBApi.h:76
#define BEVEL_RAISED
Definition BBApi.h:106
#define BEVEL_SUNKEN
Definition BBApi.h:107
#define B_PYRAMID
Definition BBApi.h:79
#define B_RECTANGLE
Definition BBApi.h:78

◆ ReplaceEnvVars()

void ReplaceEnvVars ( LPSTR string)
2595{
2596 LPSTR pos0 = string, pos1 = strchr(pos0+1,'%');
2597 if (pos1 == NULL) return; // Failsafe (only a single % character found in the string)
2598
2599 while ((pos0 = strchr(pos0,'%')) && (pos1 = strchr(++pos0,'%')))
2600 {
2601 if (pos0 == pos1) continue; // ...this means that we have "%%"
2602
2603 char var_name[MAX_LINE_LENGTH]="", var_value[MAX_LINE_LENGTH]="";
2604 memcpy(var_name,pos0,pos1-pos0);
2605
2606 // Grab the variable name(s) from the string...
2607 int nSize = GetEnvironmentVariable(var_name, var_value, MAX_LINE_LENGTH);
2608 if (GetLastError() == ERROR_ENVVAR_NOT_FOUND)
2609 {
2610 SetLastError(ERROR_SUCCESS);
2611 continue;
2612 }
2613
2614 if ((nSize + strlen(string) + 1 - (pos1-pos0+2)) > MAX_LINE_LENGTH)
2615 {
2616 //TODO signal some sort of error
2617 continue;
2618 }
2619
2620 // Perform the substitution...
2621 memmove(pos0-1+nSize,pos1+1,strlen(pos1)+1); // Don't forget the \0 !!!
2622 memcpy(pos0-1,var_value,nSize);
2623 }
2624}

◆ ReplaceShellFolders()

void ReplaceShellFolders ( LPSTR string)
2634{
2635 LPSTR pos0 = string, pos1 = strchr(pos0+1,'$');
2636 if (pos1 == NULL) return; // Failsafe (only a single $ character found in the string)
2637
2638 char folderpath[MAX_LINE_LENGTH];
2639
2640 while ((pos0 = strchr(pos0,'$')) && (pos1 = strchr(pos0+1,'$')))
2641 {
2642 if(pos0 == pos1) continue; // ...this means that we have "$$"
2643
2644 // Note that there can be more than one shell folder
2645 // variable in a string, check current position only!
2646 if (!_strnicmp(pos0, "$ProgramFiles$", 14)) strcpy(folderpath, pSettings->SF_programFiles);
2647 else if (!_strnicmp(pos0, "$Blackbox$", 10)) strcpy(folderpath, pSettings->SF_blackboxPath);
2648 else if (!_strnicmp(pos0, "$CurrentTheme$", 14)) strcpy(folderpath, pSettings->SF_currentThemePath);
2649 else if (!_strnicmp(pos0, "$StartMenu$", 11)) strcpy(folderpath, pSettings->SF_startMenu);
2650 else if (!_strnicmp(pos0, "$CommonStartMenu$", 17)) strcpy(folderpath, pSettings->SF_commonStartMenu);
2651 else if (!_strnicmp(pos0, "$Desktop$", 9)) strcpy(folderpath, pSettings->SF_desktop);
2652 else if (!_strnicmp(pos0, "$UserAppData$", 13)) strcpy(folderpath, pSettings->SF_userAppData);
2653 else if (!_strnicmp(pos0, "$UserProfile$", 13)) strcpy(folderpath, pSettings->SF_userProfile);
2654 else if (!_strnicmp(pos0, "$Clipboard$", 11)) RetrieveStringFromClipboard(folderpath);
2655 else folderpath[0] = '\0'; // Failsafe
2656
2657 memmove(pos0+strlen(folderpath), pos1+1, strlen(pos1)+1); // Don't forget the \0 !!!
2658 memcpy(pos0, folderpath, strlen(folderpath));
2659 }
2660}
bool RetrieveStringFromClipboard(LPSTR target)
Definition BBApi.cpp:3480

◆ ParseFontString()

void ParseFontString ( LPSTR string,
StyleItem * item )
2670{
2671 char height[MAX_LINE_LENGTH];
2672 strcpy(tempBuf, string);
2673
2674 strcpy(tempBuf, Tokenize(tempBuf, item->Font, "/"));
2676
2677 if (strlen(tempBuf))
2678 {
2679 strcpy(tempBuf, Tokenize(tempBuf, height, "/"));
2680 item->FontHeight = atoi(height);
2681
2682 if (IsInString(tempBuf, "Bold")) item->FontWeight = FW_BOLD;
2683 else item->FontWeight = FW_NORMAL;
2684
2685 if (IsInString(tempBuf, "Outline")) item->FontOutline = true;
2686 else item->FontOutline = false;
2687
2688 if (IsInString(tempBuf, "Shadow")) item->FontShadow = true;
2689 else item->FontShadow = false;
2690 }
2691 else
2692 {
2693 item->FontHeight = 12;
2694 item->FontWeight = FW_NORMAL;
2695 item->FontOutline = item->FontShadow = false;
2696 }
2697}
LPSTR Tokenize(LPCSTR string, LPSTR buf, LPSTR delims)
Definition BBApi.cpp:273
void CheckFontSubstitution(LPSTR font)
Definition BBApi.cpp:2706
bool FontOutline
Definition BBApi.h:430
bool FontShadow
Definition BBApi.h:423

◆ CheckFontSubstitution()

void CheckFontSubstitution ( LPSTR font)
2707{
2708 // We can save a few IsInString's by checking for "-" in the font name...
2709 if (strchr(font, '-'))
2710 {
2711 if (IsInString(font, "lucidasans-")) strcpy(font, "verdana");
2712 else if (IsInString(font, "-lucidatypewriter-")) strcpy(font, "verdana");
2713 else if (IsInString(font, "-lucida-")) strcpy(font, "verdana");
2714 else if (IsInString(font, "-snap-")) strcpy(font, "snap");
2715 else if (IsInString(font, "-verdana-")) strcpy(font, "verdana");
2716 else if (IsInString(font, "-helvetica-")) strcpy(font, "verdana");
2717 else if (IsInString(font, "-arial-")) strcpy(font, "arial");
2718 }
2719 else
2720 {
2721 if (IsInString(font, "lucidatypewriter")) strcpy(font, "verdana");
2722 else if (IsInString(font, "helvetica")) strcpy(font, "verdana");
2723 else if (IsInString(font, "fixed")) strcpy(font, "terminal");
2724 }
2725
2726 // No idea what to substitute with:
2727 // shine -beatbox- bright outcast -clean- seeds
2728}

◆ MakeMenu()

Menu * MakeMenu ( LPCSTR HeaderText)
2736{
2737 Menu *newMenu = new Menu(pMenuCommon->hInst);
2738 pMenuCommon->AddHeaderItem(newMenu, (LPSTR)HeaderText);
2739 return newMenu;
2740}
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
Definition Menu.h:66

◆ MakeNamedMenu()

Menu * MakeNamedMenu ( LPCSTR HeaderText,
LPCSTR MenuId,
bool popup )
2745{
2746 if (popup)
2747 {
2748 hideNamedMenu = false;
2749 return MakeMenu(HeaderText);
2750 }
2751 else
2752 {
2753 hideNamedMenu = true;
2754 return NULL;
2755 }
2756}
Menu * MakeMenu(LPCSTR HeaderText)
Definition BBApi.cpp:2735
bool hideNamedMenu
Definition BBApi.cpp:93

◆ MakeSubmenu()

MenuItem * MakeSubmenu ( Menu * ParentMenu,
Menu * ChildMenu,
LPCSTR Title )
2798{
2799 if (!ParentMenu) return NULL;
2800
2801 MenuItem *newMenuItem = NULL;
2802
2803 if (ChildMenu)
2804 {
2805 pMenuCommon->AddFooterItem(ChildMenu, "");
2806
2807 ChildMenu->Invalidate();
2808 ChildMenu->Validate();
2809
2810 if (ParentMenu)
2811 {
2812 newMenuItem = new FolderItem(ChildMenu, (LPSTR)Title, NULL);
2813 newMenuItem->SetHeight(pMenuCommon->m_nSubmenuHeight);
2814 ParentMenu->AddMenuItem(newMenuItem);
2815 }
2816 }
2817
2818 return newMenuItem;
2819}
Definition FolderItem.h:44
void Validate()
Definition Menu.cpp:1325
void Invalidate()
Definition Menu.cpp:1318
void AddMenuItem(MenuItem *m)
Definition Menu.cpp:1061
Definition MenuItem.h:67
virtual void SetHeight(int nHeight)
Definition MenuItem.h:121

◆ DelMenu()

void DelMenu ( Menu * PluginMenu)
2824{
2825 if (PluginMenu == pMenuCommon->m_pPluginMenu)
2826 {
2827 delete pMenuCommon->m_pPluginMenu;
2828 pMenuCommon->m_pPluginMenu = NULL;
2829 }
2830}
Definition PluginsMenu.h:40

◆ MakeMenuItem()

MenuItem * MakeMenuItem ( Menu * PluginMenu,
LPCSTR Title,
LPCSTR Cmd,
bool ShowIndicator )
2839{
2840 if (!PluginMenu) return NULL;
2841// if (strchr(Cmd, '[') && strchr(Cmd, ']')) pMenuCommon->CreateMenuItem(PluginMenu, (LPSTR)Cmd, (LPSTR)Cmd, (LPSTR)Title, ShowIndicator);
2842// else pMenuCommon->CreateMenuItem(PluginMenu, "[exec]", (LPSTR)Cmd, (LPSTR)Title, ShowIndicator);
2843 return pMenuCommon->CreateMenuItem(PluginMenu, MENUITEM_COMMAND, "[exec]", (LPSTR)Cmd, (LPSTR)Title, ShowIndicator);
2844}
#define MENUITEM_COMMAND
Definition MenuItem.h:42

◆ MakeMenuItemBool()

MenuItem * MakeMenuItemBool ( Menu * PluginMenu,
LPCSTR Title,
LPCSTR Cmd,
bool state,
int selectionGroup )
2847{
2848 if (!PluginMenu) return NULL;
2849 MenuItem* newItem = pMenuCommon->CreateMenuItem(PluginMenu, MENUITEM_BOOLEAN, "[exec]", (LPSTR)Cmd, (LPSTR)Title, state);
2850 if (selectionGroup > 0) newItem->AddToSelectionGroup((1000+selectionGroup)); // Add the new menu item to a mutually exclusive group of boolean items (nb. often useful for e.g. placement menus where only one item is "true" at a time)
2851 return newItem;
2852}
#define MENUITEM_BOOLEAN
Definition MenuItem.h:45
void AddToSelectionGroup(int group)
Definition MenuItem.cpp:534

◆ MakeMenuNOP()

MenuItem * MakeMenuNOP ( Menu * PluginMenu,
LPCSTR Title )
2857{
2858 if (!PluginMenu) return NULL;
2859
2860 if (Title != NULL)
2861 {
2862 if (!_strnicmp(Title, "---", 3)) // If the first three characters are --- we convert the NOP into a separator
2863 {
2864 if (!pSettings->menuSeparators) return NULL;
2865 else return pMenuCommon->CreateMenuItem(PluginMenu, MENUITEM_SEPARATOR, NULL, NULL, (LPSTR)Title, false);
2866 }
2867 }
2868
2869 return pMenuCommon->CreateMenuItem(PluginMenu, MENUITEM_NOP, NULL, NULL, (LPSTR)Title, false);
2870}
#define MENUITEM_NOP
Definition MenuItem.h:46
#define MENUITEM_SEPARATOR
Definition MenuItem.h:47

◆ MakeMenuItemString()

MenuItem * MakeMenuItemString ( Menu * PluginMenu,
LPCSTR Title,
LPCSTR Cmd,
LPCSTR init_string )
2875{
2876 if (!PluginMenu) return NULL;
2877
2878 char TitleColonInitString[MAX_LINE_LENGTH];
2879
2880 if (strlen(Title) > 0)
2881 {
2882 if ((strlen(Title) >= 3) && !_strnicmp(&Title[strlen(Title)-3], "...", 3))
2883 {
2884 // Hidden init_string -> Just copy the title...
2885 strcpy(TitleColonInitString, Title);
2886 }
2887 else
2888 {
2889 // Visible init_string -> Make sure there's a colon after the title for consistency... :)
2890 if (Title[strlen(Title)-1] == ':') sprintf(TitleColonInitString, "%s <%s>", Title, init_string);
2891 else sprintf(TitleColonInitString, "%s: <%s>", Title, init_string);
2892 }
2893 }
2894 else sprintf(TitleColonInitString, "<%s>", init_string); // No title specified, so no colon needed...
2895
2896 return pMenuCommon->CreateMenuItem(PluginMenu, MENUITEM_EDITSTRING, (LPSTR)Cmd, (LPSTR)init_string, (LPSTR)TitleColonInitString, false);
2897}
#define MENUITEM_EDITSTRING
Definition MenuItem.h:43

◆ MakeMenuItemInt()

MenuItem * MakeMenuItemInt ( Menu * PluginMenu,
LPCSTR Title,
LPCSTR Cmd,
int val,
int minval,
int maxval )
2902{
2903 if (!PluginMenu) return NULL;
2904
2905 char TitleWithColon [MAX_LINE_LENGTH], CmdValues[MAX_LINE_LENGTH];
2906
2907 // Make sure there's a colon after the title for consistency... :)
2908 if (Title[strlen(Title)-1] == ':') sprintf(TitleWithColon, "%s", Title);
2909 else sprintf(TitleWithColon, "%s:", Title);
2910 // Does the command string includes spaces?
2911 if (strstr(Cmd, " ")) sprintf(CmdValues, "\"%s\" %d %d %d", Cmd, val, minval, maxval);
2912 else sprintf(CmdValues, "%s %d %d %d", Cmd, val, minval, maxval);
2913
2914 bool enabled = false;
2915// if ((val>=minval) && (val<=maxval)) enabled = true;
2916
2917 return pMenuCommon->CreateMenuItem(PluginMenu, MENUITEM_EDITINT, (LPSTR)CmdValues, NULL, (LPSTR)TitleWithColon, enabled);
2918}
#define MENUITEM_EDITINT
Definition MenuItem.h:44

◆ ShowMenu()

void ShowMenu ( Menu * PluginMenu)
2926{
2927 if (!PluginMenu) return;
2928
2929 //====================
2930
2931 if (hideNamedMenu && pMenuCommon->m_pPluginMenu)
2932 {
2933 if (PluginMenu == pMenuCommon->m_pPluginMenu)
2934 {
2935// pMenuCommon->Hide();
2936 pMenuCommon->m_pPluginMenu->Hide(HIDE_CHILDREN);
2937 ShowWindow(pMenuCommon->m_pPluginMenu->GetWindow(), SW_HIDE);
2938 DelMenu(pMenuCommon->m_pPluginMenu);
2939 }
2940 hideNamedMenu = false;
2941 return;
2942 }
2943
2944 //====================
2945
2946 pMenuCommon->Hide();
2947 if (pMenuCommon->m_pPluginMenu) DelMenu(pMenuCommon->m_pPluginMenu);
2948 pMenuCommon->m_pPluginMenu = PluginMenu;
2949
2950 pMenuCommon->AddFooterItem(PluginMenu, "");
2951
2952 PluginMenu->Invalidate();
2953 PluginMenu->Validate();
2954
2955 PluginMenu->Show();
2957}
void DelMenu(Menu *PluginMenu)
Definition BBApi.cpp:2823
#define HIDE_CHILDREN
Definition Menu.h:39
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_MENU_SHOW
Definition Sounds.h:42

◆ MakeSticky()

void MakeSticky ( HWND window)
2966{
2967 stickyWindows.push_back(window); // Note: This step applies also to non-taskbar windows...
2968
2969 if (pTaskbar)
2970 {
2971 int i = pTaskbar->FindTask(window);
2972 if (i >= 0) pTaskbar->taskList[i]->workspace = 254; // Making the window sticky -> "Visible on all workspaces"
2973 }
2974}
Taskbar * pTaskbar
Definition Blackbox.cpp:47
StickyWindowsVector stickyWindows
Definition BBApi.cpp:86

◆ RemoveSticky()

void RemoveSticky ( HWND window)
2979{
2980 for (int i=0; i < (int)stickyWindows.size(); i++)
2981 {
2982 if (stickyWindows[i] == window) stickyWindows.erase(stickyWindows.begin() + i); // Note: This step applies also to non-taskbar windows...
2983 }
2984
2985 if (pTaskbar)
2986 {
2987 int i = pTaskbar->FindTask(window);
2988 if (i >= 0) pTaskbar->taskList[i]->workspace = pSettings->currentWorkspace; // Making the window non-sticky -> "Visible only on this particular workspace"
2989 }
2990}

◆ CheckSticky()

bool CheckSticky ( HWND window)
2995{
2996 for (int i=0; i < (int)stickyWindows.size(); i++)
2997 {
2998 if (stickyWindows[i] == window) return true; // Note: This step applies also to non-taskbar windows...
2999 }
3000
3001 return false;
3002}

◆ ToggleSticky()

void ToggleSticky ( HWND window)
3007{
3008 if (!CheckSticky(window)) MakeSticky(window);
3009 else RemoveSticky(window);
3010}
void RemoveSticky(HWND window)
Definition BBApi.cpp:2978
bool CheckSticky(HWND window)
Definition BBApi.cpp:2994
void MakeSticky(HWND window)
Definition BBApi.cpp:2965

◆ ClearSticky()

void ClearSticky ( )
3015{
3016 stickyWindows.clear(); // Clean up...
3017}

◆ SetTransparencyEx()

bool SetTransparencyEx ( HWND hwnd,
COLORREF crKey,
BYTE bAlpha,
DWORD dwFlags )
3027{
3028 slwaFunc SLWA = (slwaFunc)GetProcAddress(GetModuleHandle("USER32"), "SetLayeredWindowAttributes");
3029 if (!SLWA) return false;
3030
3031 //====================
3032
3033 if (dwFlags == LWA_ALPHA)
3034 {
3035 if (bAlpha < 255)
3036 {
3037 LONG windowStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
3038 windowStyle = windowStyle | WS_EX_LAYERED;
3039 SetWindowLong(hwnd, GWL_EXSTYLE, windowStyle);
3040 return SLWA(hwnd, NULL, bAlpha, LWA_ALPHA);
3041 }
3042 else
3043 {
3044 LONG windowStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
3045 windowStyle = windowStyle & ~WS_EX_LAYERED;
3046 SetWindowLong(hwnd, GWL_EXSTYLE, windowStyle);
3047 return false;
3048 }
3049 }
3050
3051 //====================
3052
3053 else if (dwFlags == LWA_COLORKEY)
3054 {
3055 LONG windowStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
3056 windowStyle = windowStyle | WS_EX_LAYERED;
3057 SetWindowLong(hwnd, GWL_EXSTYLE, windowStyle);
3058 return SLWA(hwnd, crKey, 255, LWA_COLORKEY);
3059 }
3060
3061 //====================
3062
3063 return false;
3064}
bool(__stdcall * slwaFunc)(HWND, COLORREF, BYTE, DWORD)
Definition BBApi.cpp:3024
#define LWA_COLORKEY
Definition BBApi.cpp:64
#define WS_EX_LAYERED
Definition BBApi.cpp:61
#define LWA_ALPHA
Definition BBApi.cpp:67

◆ SetTransparency()

bool SetTransparency ( HWND hwnd,
BYTE alpha )
3069{
3070 return SetTransparencyEx(hwnd, 0, alpha, LWA_ALPHA);
3071}
bool SetTransparencyEx(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
Definition BBApi.cpp:3026

◆ WriteValue()

void WriteValue ( LPCSTR fp,
LPCSTR keyword,
LPCSTR value )
3079{
3080 if (pSettings)
3081 {
3082 if (pSettings->writeProtection) return;
3083 }
3084
3085 vector <string> fileContents;
3086 char fileLine[MAX_LINE_LENGTH];
3087 int pointer;
3088 bool written = false;
3089
3090 FILE *file = fopen(fp, "r");
3091 if (file)
3092 {
3093 fseek(file, 0, SEEK_SET);
3094 while (fgets(fileLine, sizeof(fileLine)-2, file))
3095 {
3096 if (!IsInString(fileLine, "\n")) strcat(fileLine, "\n");
3097 fileLine[sizeof(fileLine)-1] = '\0'; // Additional failsafe
3098
3099 // Check for the specified keyword, disregarding lines beginning with ! (comments)
3100 if (IsInString(fileLine, keyword) && fileLine[0] != '!')
3101 {
3102 sprintf(fileLine, "%s %s\n", keyword, value);
3103 written = true;
3104 }
3105
3106 fileContents.push_back(fileLine);
3107 }
3108 fclose(file);
3109 }
3110
3111 if (!written)
3112 {
3113 sprintf(fileLine, "%s %s\n", keyword, value);
3114 fileContents.push_back(fileLine);
3115 }
3116
3117 file = fopen(fp, "w");
3118 if (file)
3119 {
3120 fseek(file, 0, SEEK_SET);
3121 for (pointer = 0; pointer < (int)fileContents.size(); pointer++)
3122 {
3123 fputs(fileContents[pointer].c_str(), file);
3124 }
3125 fclose(file);
3126 }
3127}

◆ WriteBool()

void WriteBool ( LPCSTR fp,
LPCSTR keyword,
bool value )
3132{
3133 if (pSettings->writeProtection) return;
3134
3135 char tmp[50];
3136 if (value) strcpy(tmp, "true");
3137 else strcpy(tmp, "false");
3138
3139 WriteValue(fp, keyword, tmp);
3140}
void WriteValue(LPCSTR fp, LPCSTR keyword, LPCSTR value)
Definition BBApi.cpp:3078

◆ WriteInt()

void WriteInt ( LPCSTR fp,
LPCSTR keyword,
int value )
3145{
3146 if (pSettings->writeProtection) return;
3147
3148 char tmp[50];
3149 sprintf(tmp, "%d", value);
3150
3151 WriteValue(fp, keyword, tmp);
3152}

◆ WriteString()

void WriteString ( LPCSTR fp,
LPCSTR keyword,
LPSTR value )
3157{
3158 if (pSettings->writeProtection) return;
3159
3160 WriteValue(fp, keyword, value);
3161}

◆ WriteColor()

void WriteColor ( LPCSTR fp,
LPCSTR keyword,
COLORREF value )
3166{
3167 if (pSettings->writeProtection) return;
3168
3169 char tmp[MAX_LINE_LENGTH];
3170 sprintf(tmp, "#%02x%02x%02x", GetRValue(value), GetGValue(value), GetBValue(value));
3171
3172 WriteValue(fp, keyword, tmp);
3173}

◆ GetTraySize()

int GetTraySize ( )
3182{ return 0; }

◆ GetTrayIcon()

trayIconItem * GetTrayIcon ( int pointer)
3183{ return NULL; }

◆ GetUnderExplorer()

bool GetUnderExplorer ( )
3184{ return pSettings->underExplorer; }; // Note: Even in xoblite bb5, we do a check for Explorer at startup for other purposes, so we might just return that boolean here even if typically always "true"...

◆ GetDesktopInfo()

void GetDesktopInfo ( DesktopInfo * deskInfo)
3192{
3193 strncpy(deskInfo->name, pWorkspaces->workspaceNames[pSettings->currentWorkspace].c_str(), 32);
3194 deskInfo->name[31] = 0;
3195 deskInfo->isCurrent = true;
3196 deskInfo->number = pSettings->currentWorkspace;
3197 deskInfo->ScreensX = pSettings->numberOfWorkspaces;
3198 // deskInfo->deskNames is currently not supported
3199}
Workspaces * pWorkspaces
Definition Blackbox.cpp:51
bool isCurrent
Definition BBApi.h:647
char name[32]
Definition BBApi.h:646
int ScreensX
Definition BBApi.h:649
int number
Definition BBApi.h:648

◆ GetTaskListSize()

int GetTaskListSize ( )
3208{
3209 if (pTaskbar) return (int)pTaskbar->taskList.size();
3210 else return 0;
3211}

◆ SetTaskWorkspace()

void SetTaskWorkspace ( HWND hwnd,
int workspace )
3216{
3217 if (pWorkspaces) pWorkspaces->MoveWindowToWorkspace(hwnd, workspace);
3218}

◆ GetTaskWorkspace()

int GetTaskWorkspace ( HWND hwnd)
3223{
3224 if (pWorkspaces) return pWorkspaces->GetWorkspaceByWindow(hwnd);
3225 else return 0;
3226}

◆ GetTask()

HWND GetTask ( int pointer)
3231{
3232 if (pTaskbar)
3233 {
3234 if ((pointer >= 0) && (pointer <= (int)pTaskbar->taskList.size()))
3235 {
3236 return pTaskbar->taskList[pointer]->hwnd;
3237 }
3238 }
3239
3240 return NULL;
3241}

◆ GetActiveTask()

int GetActiveTask ( )
3246{
3247 if (pTaskbar)
3248 {
3249 int index = pTaskbar->GetActiveTask();
3250 if (index != NULL) return index;
3251 }
3252
3253 return -1;
3254}

◆ IsOnTaskbar()

bool IsOnTaskbar ( HWND hwnd)
3263{
3264 if (pTaskbar)
3265 {
3266 if (pTaskbar->FindTask(hwnd) >= 0) return true;
3267 }
3268
3269 return false;
3270}

◆ IsAppRunning()

HWND IsAppRunning ( LPSTR path)
3279{
3280 if (pTaskbar)
3281 {
3282 for (int i=0; i < (int)pTaskbar->taskList.size(); i++)
3283 {
3284 if (!_stricmp(pTaskbar->taskList[i]->path, path)) return pTaskbar->taskList[i]->hwnd;
3285 }
3286 }
3287
3288 return NULL;
3289}

◆ DownloadFile()

bool DownloadFile ( LPCSTR url,
LPCSTR path )
3297{
3298 // DownloadFile will accept an input string containing multiple URLs
3299 // (using space as the delimiter), in which case it will merge all
3300 // the files together into a single output file! :D
3301
3302 HANDLE file = NULL;
3303 HINTERNET iopen = NULL, iopenurl = NULL;
3304 bool status = true; // Will be set to false if any of the specified downloads fail
3305
3306 char remaining[MAX_LINE_LENGTH], token[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
3307 LPSTR tokens[1];
3308 tokens[0] = token;
3309
3310 strcpy(remaining, url);
3311
3312 //====================
3313
3314 while (strlen(remaining))
3315 {
3316 // Get the next token from the list of URLs...
3317 token[0] = extra[0] = '\0';
3318 BBTokenize (remaining, tokens, 1, extra);
3319 strcpy(remaining, extra);
3320
3321 // ...then try fetching the file from the web...
3322 iopen = InternetOpen("xoblite", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);//INTERNET_FLAG_ASYNC);
3323 if (iopen)
3324 {
3325 iopenurl = InternetOpenUrl(iopen, token, NULL, 0, INTERNET_FLAG_RELOAD, 0);
3326 if (iopenurl)
3327 {
3328 // unsigned int size = 0;
3329 // InternetQueryDataAvailable(iopenurl, (LPDWORD)&size, 0, 0);
3330
3331 char buffer[1024];
3332 DWORD bytesRead = 0, retLength = 0;
3333
3334 // Create the file if we haven't done so already...
3335 if (!file) file = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
3336
3337 if (file)
3338 {
3339 // Download data in chunks of 1024 bytes...
3340 while (InternetReadFile(iopenurl, (LPVOID)buffer, 1024, &bytesRead))
3341 {
3342 if (bytesRead == 0) break;
3343
3344 // Stop downloading if the file seems to be 404...
3345// if (strstr(buffer, "<title>404 Not Found</title>")) break;
3346
3347 WriteFile(file, buffer, bytesRead, &retLength, NULL);
3348 }
3349
3350 InternetCloseHandle(iopenurl);
3351 InternetCloseHandle(iopen);
3352 }
3353 else
3354 {
3355 status = false;
3356 InternetCloseHandle(iopenurl);
3357 InternetCloseHandle(iopen);
3358 }
3359 }
3360 else
3361 {
3362 status = false;
3363 InternetCloseHandle(iopen);
3364 }
3365 }
3366 }
3367
3368 //====================
3369
3370 // Close the file...
3371 if (file) CloseHandle(file);
3372
3373 return status;
3374}

◆ ParseDropFiles()

int ParseDropFiles ( HWND hwnd,
WPARAM wParam )
3382{
3383 static TCHAR filename[MAX_LINE_LENGTH];
3384 DragQueryFile((HDROP)wParam, 0, filename, sizeof(filename));
3385
3386 char path[MAX_LINE_LENGTH];
3387 strncpy(path, filename, MAX_LINE_LENGTH-1);
3388 if (path[0] == '\"') StrRemoveEncap(path);
3389
3390 //====================
3391
3392 if (pDesktop)
3393 {
3394 // Relay drag to desktop information to interrested plugins...
3395 if (hwnd == pDesktop->hDesktopWnd) SendMessage(GetBBWnd(), BB_DRAGTODESKTOP, 0, (LPARAM)path);
3396 }
3397
3398 //====================
3399
3400 // Make sure the dropped file isn't a directory...
3401 if (PathIsDirectory(filename))
3402 {
3403 DragFinish((HDROP)wParam);
3404 return 0;
3405 }
3406
3407 //====================
3408
3409 // We only need to check the last 4 characters to get the extension...
3410 int pointer = strlen(path) - 4;
3411
3412 if (! _stricmp(&path[pointer], ".dll"))
3413 {
3414 // Load plugin...
3415 if (pPluginManager) pPluginManager->LoadPlugin(filename);
3416 }
3417 else if (! _stricmp(&path[pointer], ".jpg")
3418 || ! _stricmp(&path[pointer], ".png")
3419 || ! _stricmp(&path[pointer], ".bmp")
3420 || ! _stricmp(&path[pointer], "jpeg"))
3421 {
3422 // If the file is a JPG/JPEG, PNG or BMP we set it as wallpaper...
3423 if (GetAsyncKeyState(VK_CONTROL) & 0x8000) pWallpaper->SetWallpaper(path, "center"); // Is the control key held down? -> center mode
3424 else if (GetAsyncKeyState(VK_MENU) & 0x8000) pWallpaper->SetWallpaper(path, "tile"); // Is the alt key held down? -> tile mode
3425 else if (GetAsyncKeyState(VK_SHIFT) & 0x8000) pWallpaper->SetWallpaper(path, "span"); // Is the shift key held down? -> span mode
3426 else pWallpaper->SetWallpaper(path, "stretch"); // Default -> stretch/full mode
3427 }
3428 else
3429 {
3430 // Look for a line that should "always" exist in a style file...
3431 if (strlen(ReadString(filename, "menu.frame.", "")))
3432 {
3433 // Set new style...
3434 PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)filename);
3435 }
3436 }
3437
3438 //====================
3439
3440 DragFinish((HDROP)wParam);
3441
3442 return 0;
3443}
Desktop * pDesktop
Definition Blackbox.cpp:37
LPSTR ReadString(LPCSTR fp, LPCSTR szString, LPSTR szDefault)
Definition BBApi.cpp:544
Wallpaper * pWallpaper
Definition Blackbox.cpp:50
#define BB_SETSTYLE
Definition BBApi.h:148
#define BB_DRAGTODESKTOP
Definition BBApi.h:191

◆ CopyStringToClipboard()

bool CopyStringToClipboard ( LPSTR string)
3451{
3452 HGLOBAL hGlobal = GlobalAlloc(GHND | GMEM_SHARE, strlen(string)+1) ;
3453 if (hGlobal == NULL) return false;
3454
3455 char* pGlobal = (LPSTR)GlobalLock(hGlobal) ;
3456 if (pGlobal == NULL) return false;
3457
3458 strcpy(pGlobal, string);
3459 GlobalUnlock (hGlobal);
3460
3461 if (OpenClipboard(GetBBWnd()))
3462 {
3463 if (EmptyClipboard())
3464 {
3465 if (SetClipboardData(CF_TEXT, hGlobal) != NULL)
3466 {
3467 CloseClipboard();
3468 return true;
3469 }
3470 }
3471
3472 CloseClipboard();
3473 }
3474
3475 return false;
3476}

◆ RetrieveStringFromClipboard()

bool RetrieveStringFromClipboard ( LPSTR target)
3481{
3482 HANDLE handle;
3483
3484 if (IsClipboardFormatAvailable(CF_TEXT))
3485 {
3486 if (OpenClipboard(GetBBWnd()))
3487 {
3488 handle = GetClipboardData(CF_TEXT);
3489 if (handle != NULL)
3490 {
3491 strncpy(target, (char*)handle, MAX_LINE_LENGTH-1);
3492 CloseClipboard();
3493 return true;
3494 }
3495
3496 CloseClipboard();
3497 }
3498 }
3499
3500 strcpy(target, ""); // Failed or nothing was found on the clipboard...
3501
3502 return false;
3503}

◆ DrawTextWithEffectsEx()

void DrawTextWithEffectsEx ( HDC hdc,
RECT r,
LPWSTR textUnicode,
LPSTR textANSI,
unsigned int format,
COLORREF textColor,
bool outline,
COLORREF outlineColor,
bool shadow,
COLORREF shadowColor,
int shadowX,
int shadowY )
3512{
3513 if (textUnicode != NULL) DrawTextWithEffectsUnicode(hdc, r, textUnicode, format, textColor, outline, outlineColor, shadow, shadowColor, shadowX, shadowY);
3514 else DrawTextWithEffects(hdc, r, textANSI, format, textColor, outline, outlineColor, shadow, shadowColor, shadowX, shadowY);
3515}
void DrawTextWithEffectsUnicode(HDC hdc, RECT r, LPWSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3528
void DrawTextWithEffects(HDC hdc, RECT r, LPSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3519

◆ DrawTextWithEffects()

void DrawTextWithEffects ( HDC hdc,
RECT r,
LPSTR text,
unsigned int format,
COLORREF textColor,
bool outline,
COLORREF outlineColor,
bool shadow,
COLORREF shadowColor,
int shadowX,
int shadowY )
3520{
3521 wchar_t textInUnicode[MAX_LINE_LENGTH*10]; // (nb. this much text is typically only remotely happening in e.g. logging popup dialogs, cf. matching size used in PopupDialog.h)
3522 MultiByteToWideChar(CP_ACP, 0, text, strlen(text)+1, textInUnicode, sizeof(textInUnicode)); // We need to use the system default Windows ANSI code page (CP_ACP) for conversion here...
3523 DrawTextWithEffectsUnicode(hdc, r, textInUnicode, format, textColor, outline, outlineColor, shadow, shadowColor, shadowX, shadowY);
3524}

◆ DrawTextWithEffectsUnicode()

void DrawTextWithEffectsUnicode ( HDC hdc,
RECT r,
LPWSTR text,
unsigned int format,
COLORREF textColor,
bool outline,
COLORREF outlineColor,
bool shadow,
COLORREF shadowColor,
int shadowX,
int shadowY )
3529{
3530 // Note#1: As the text itself should be topmost, below that the outline, and below that the shadow,
3531 // we need to draw it in the opposite order i.e. shadow->outline->text, see below.
3532 // Note#2: Yes, this way is quite compute-intensive, but also the best looking, so... ;)
3533
3534 RECT s;
3535
3536 //====================
3537
3538 if (outline && shadow)
3539 {
3540 CopyRect(&s, &r);
3541// if (pSettings->doubleScaleHiDPI) OffsetRect(&s, shadowX*2, shadowY*2);
3542// else OffsetRect(&s, shadowX, shadowY);
3543 if (pSettings->doubleScaleHiDPI && (shadowX==1) && (shadowY==1)) OffsetRect(&s, 2, 2);
3544 else OffsetRect(&s, shadowX, shadowY);
3545// OffsetRect(&s, shadowX, shadowY);
3546 DrawTextWithEffectsUnicode(hdc, s, text, format, shadowColor, true, shadowColor, false, 0, 0, 0); // Draw [bigger due to the outline] shadow...
3547 DrawTextWithEffectsUnicode(hdc, r, text, format, textColor, true, outlineColor, false, 0, 0, 0); // ...with outline and regular text on top...
3548 }
3549 else if (shadow)
3550 {
3551 // Draw shadow... (1 pixel thick for non-HiDPI, 2 pixels thick for HiDPI,
3552 // with its position adjusted for outlined text if so applicable)
3553
3554 SetTextColor(hdc, shadowColor);
3555
3556 if (outline) // -> Outlined text -> Shadow offset positon adjusted accordingly
3557 {
3558 if (pSettings->doubleScaleHiDPI)
3559 {
3560 CopyRect(&s, &r);
3561 OffsetRect(&s, 4, 0);
3562 DrawTextW(hdc, text, wcslen(text), &s, format);
3563 OffsetRect(&s, 0, 1);
3564 DrawTextW(hdc, text, wcslen(text), &s, format);
3565 OffsetRect(&s, 0, 1);
3566 DrawTextW(hdc, text, wcslen(text), &s, format);
3567 OffsetRect(&s, 0, 1);
3568 DrawTextW(hdc, text, wcslen(text), &s, format);
3569 OffsetRect(&s, 0, 1);
3570 DrawTextW(hdc, text, wcslen(text), &s, format);
3571 OffsetRect(&s, -1, 0);
3572 DrawTextW(hdc, text, wcslen(text), &s, format);
3573 OffsetRect(&s, -1, 0);
3574 DrawTextW(hdc, text, wcslen(text), &s, format);
3575 OffsetRect(&s, -1, 0);
3576 DrawTextW(hdc, text, wcslen(text), &s, format);
3577 OffsetRect(&s, -1, 0);
3578 DrawTextW(hdc, text, wcslen(text), &s, format);
3579
3580 CopyRect(&s, &r);
3581 OffsetRect(&s, 3, -1);
3582 DrawTextW(hdc, text, wcslen(text), &s, format);
3583 OffsetRect(&s, 0, 1);
3584 DrawTextW(hdc, text, wcslen(text), &s, format);
3585 OffsetRect(&s, 0, 1);
3586 DrawTextW(hdc, text, wcslen(text), &s, format);
3587 OffsetRect(&s, 0, 1);
3588 DrawTextW(hdc, text, wcslen(text), &s, format);
3589 OffsetRect(&s, 0, 1);
3590 DrawTextW(hdc, text, wcslen(text), &s, format);
3591 OffsetRect(&s, -1, 0);
3592 DrawTextW(hdc, text, wcslen(text), &s, format);
3593 OffsetRect(&s, -1, 0);
3594 DrawTextW(hdc, text, wcslen(text), &s, format);
3595 OffsetRect(&s, -1, 0);
3596 DrawTextW(hdc, text, wcslen(text), &s, format);
3597 OffsetRect(&s, -1, 0);
3598 DrawTextW(hdc, text, wcslen(text), &s, format);
3599 }
3600 else
3601 {
3602 CopyRect(&s, &r);
3603 OffsetRect(&s, 2, 0);
3604 DrawTextW(hdc, text, wcslen(text), &s, format);
3605 OffsetRect(&s, 0, 1);
3606 DrawTextW(hdc, text, wcslen(text), &s, format);
3607 OffsetRect(&s, 0, 1);
3608 DrawTextW(hdc, text, wcslen(text), &s, format);
3609 OffsetRect(&s, -1, 0);
3610 DrawTextW(hdc, text, wcslen(text), &s, format);
3611 OffsetRect(&s, -1, 0);
3612 DrawTextW(hdc, text, wcslen(text), &s, format);
3613 }
3614 }
3615 else // -> Non-outlined text -> Shadow offset position as per the input parameters
3616 {
3617 CopyRect(&s, &r);
3618//// OffsetRect(&s, 2, 2);
3619// if (pSettings->doubleScaleHiDPI) OffsetRect(&s, shadowX*2, shadowY*2);
3620// else OffsetRect(&s, shadowX, shadowY);
3621 OffsetRect(&s, shadowX, shadowY);
3622 DrawTextW(hdc, text, wcslen(text), &s, format);
3623 }
3624 }
3625
3626 //====================
3627
3628 if (outline)
3629 {
3630 // Draw outline... (1 pixel thick for non-HiDPI, 2 pixels thick for HiDPI)
3631
3632 SetTextColor(hdc, outlineColor);
3633
3634 if (pSettings->doubleScaleHiDPI)
3635 {
3636 CopyRect(&s, &r);
3637 OffsetRect(&s, 0, -2);
3638 DrawTextW(hdc, text, wcslen(text), &s, format);
3639 OffsetRect(&s, 1, 0);
3640 DrawTextW(hdc, text, wcslen(text), &s, format);
3641 OffsetRect(&s, 1, 0);
3642 DrawTextW(hdc, text, wcslen(text), &s, format);
3643 OffsetRect(&s, 0, 1);
3644 DrawTextW(hdc, text, wcslen(text), &s, format);
3645 OffsetRect(&s, 0, 1);
3646 DrawTextW(hdc, text, wcslen(text), &s, format);
3647 OffsetRect(&s, 0, 1);
3648 DrawTextW(hdc, text, wcslen(text), &s, format);
3649 OffsetRect(&s, 0, 1);
3650 DrawTextW(hdc, text, wcslen(text), &s, format);
3651 OffsetRect(&s, -1, 0);
3652 DrawTextW(hdc, text, wcslen(text), &s, format);
3653 OffsetRect(&s, -1, 0);
3654 DrawTextW(hdc, text, wcslen(text), &s, format);
3655 OffsetRect(&s, -1, 0);
3656 DrawTextW(hdc, text, wcslen(text), &s, format);
3657 OffsetRect(&s, -1, 0);
3658 DrawTextW(hdc, text, wcslen(text), &s, format);
3659 OffsetRect(&s, 0, -1);
3660 DrawTextW(hdc, text, wcslen(text), &s, format);
3661 OffsetRect(&s, 0, -1);
3662 DrawTextW(hdc, text, wcslen(text), &s, format);
3663 OffsetRect(&s, 0, -1);
3664 DrawTextW(hdc, text, wcslen(text), &s, format);
3665 OffsetRect(&s, 0, -1);
3666 DrawTextW(hdc, text, wcslen(text), &s, format);
3667 OffsetRect(&s, 1, 0);
3668 DrawTextW(hdc, text, wcslen(text), &s, format);
3669 }
3670
3671 CopyRect(&s, &r);
3672 OffsetRect(&s, 0, -1);
3673 DrawTextW(hdc, text, wcslen(text), &s, format);
3674 OffsetRect(&s, 1, 0);
3675 DrawTextW(hdc, text, wcslen(text), &s, format);
3676 OffsetRect(&s, 0, 1);
3677 DrawTextW(hdc, text, wcslen(text), &s, format);
3678 OffsetRect(&s, 0, 1);
3679 DrawTextW(hdc, text, wcslen(text), &s, format);
3680 OffsetRect(&s, -1, 0);
3681 DrawTextW(hdc, text, wcslen(text), &s, format);
3682 OffsetRect(&s, -1, 0);
3683 DrawTextW(hdc, text, wcslen(text), &s, format);
3684 OffsetRect(&s, 0, -1);
3685 DrawTextW(hdc, text, wcslen(text), &s, format);
3686 OffsetRect(&s, 0, -1);
3687 DrawTextW(hdc, text, wcslen(text), &s, format);
3688 }
3689
3690 //====================
3691
3692 // Draw text...
3693 SetTextColor(hdc, textColor);
3694 DrawTextW(hdc, text, wcslen(text), &r, format);
3695}

◆ DrawTextEvolved()

bool DrawTextEvolved ( HDC hdc,
RECT * rect,
LPSTR styleElement,
LPWSTR textUnicode,
LPSTR textANSI,
unsigned int fontHeightOverride,
unsigned int format,
bool getSize )
3700{
3701 StyleItem* element = FindStyleElement(styleElement);
3702
3703 if (element != NULL) // -> Supported style element found!
3704 {
3705 unsigned int fontHeight;
3706 if (fontHeightOverride > 0) fontHeight = fontHeightOverride;
3707 else fontHeight = element->FontHeight;
3708
3709 if (getSize) // -> Find out the necessary size RECT to draw the text... (i.e. element-aware GetTextExtentPoint32 wrapper)
3710 {
3711 SIZE size;
3712 HDC fonthdc = CreateDC("DISPLAY", NULL, NULL, NULL);
3713 HFONT font = CreateFont(fontHeight, 0, 0, 0, element->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, element->Font);
3714 HGDIOBJ oldfont = SelectObject(fonthdc, font);
3715
3716 if (textUnicode != NULL) GetTextExtentPoint32W(fonthdc, textUnicode, wcslen(textUnicode), &size);
3717 else GetTextExtentPoint32(fonthdc, textANSI, strlen(textANSI), &size);
3718
3719 if (element->FontOutline) size.cx += 2;
3720 else if (element->FontShadow) size.cx += 1;
3721 size.cx += (element->marginWidth * 2) + (element->borderWidth * 2);
3722 size.cy += (element->marginWidth * 2) + (element->borderWidth * 2);
3723
3724 SetRect(rect, 0, 0, size.cx, size.cy);
3725
3726 DeleteObject(SelectObject(fonthdc, oldfont));
3727 DeleteDC(fonthdc);
3728
3729 return true;
3730 }
3731 else // -> Draw the text...
3732 {
3733 unsigned int textFormat = format;
3734 if (format == NULL) textFormat = element->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS;
3735 HFONT font = CreateFont(fontHeight, 0, 0, 0, element->FontWeight, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, element->Font);
3736 HGDIOBJ oldfont = SelectObject(hdc, font);
3737 SetBkMode(hdc, TRANSPARENT);
3738 if (textUnicode != NULL) DrawTextWithEffectsUnicode(hdc, *rect, textUnicode, textFormat, element->TextColor, element->FontOutline, element->OutlineColor, element->FontShadow, element->ShadowColor, element->ShadowX, element->ShadowY);
3739 else DrawTextWithEffects(hdc, *rect, textANSI, textFormat, element->TextColor, element->FontOutline, element->OutlineColor, element->FontShadow, element->ShadowColor, element->ShadowX, element->ShadowY);
3740 DeleteObject(SelectObject(hdc, oldfont));
3741 return true;
3742 }
3743 }
3744 else return false; // -> Unsupported style element, nothing drawn...
3745}
COLORREF TextColor
Definition BBApi.h:408
char ShadowX
Definition BBApi.h:426
char ShadowY
Definition BBApi.h:426
int Justify
Definition BBApi.h:411
COLORREF OutlineColor
Definition BBApi.h:431
COLORREF ShadowColor
Definition BBApi.h:429

◆ DrawSatHueIcon()

void DrawSatHueIcon ( HDC hdc,
RECT r,
HICON icon,
int size,
int saturation,
int hue )
3766{
3767 // Should we apply saturation or hue?
3768 if (saturation < 255 || hue > 0)
3769 {
3770 HDC iconhdc = CreateCompatibleDC(hdc);
3771 HBITMAP iconbufbmp = ::CreateCompatibleBitmap(hdc, size, size*2);
3772 HBITMAP oldiconbuf = (HBITMAP) ::SelectObject(iconhdc, iconbufbmp);
3773
3774 // An icon drawn using DI_NORMAL doesn't always seem to be masked properly,
3775 // so we perform the masking manually by drawing the icon and mask side-by-side
3776 // into a temporary buffer, applying saturation and hue to the icon's non-masked
3777 // pixels, and copying them into the destination HDC...
3778 DrawIconEx(iconhdc, 0, 0, icon, size, size, 0, NULL, DI_MASK);
3779 DrawIconEx(iconhdc, 0, size, icon, size, size, 0, NULL, DI_NORMAL);
3780
3781 invsat = 255 - saturation;
3782 invhue = 255 - hue;
3783
3784 for (int y=0; y < size; y++)
3785 {
3786 for (int x=0; x < size; x++)
3787 {
3788 // Check if the mask pixel is a transparent pixel...
3789// if (!GetPixel(iconhdc, x, y))
3790 if (GetPixel(iconhdc, x, y) == 0x000000)
3791 {
3792 // If not, we read the icon pixel color...
3793 pixel = GetPixel(iconhdc, (x), (size+y));
3794 red = GetRValue(pixel);
3795 green = GetGValue(pixel);
3796 blue = GetBValue(pixel);
3797
3798 // ...apply saturation...
3799 if (saturation < 255)
3800 {
3801 greyscale = (BYTE)(red*0.3086 + green*0.6094 + blue*0.0820);
3802 red = (BYTE)((red*saturation + greyscale*invsat + 255)>>8);
3803 green = (BYTE)((green*saturation + greyscale*invsat + 255)>>8);
3804 blue = (BYTE)((blue*saturation + greyscale*invsat + 255)>>8);
3805 }
3806 // ...and hue...
3807 if (hue > 0)
3808 {
3809 // ...based on the colour of the destination pixel (i.e. the background)...
3810 pixel = GetPixel(hdc, (r.left + x), (r.top + y));
3811 destred = GetRValue(pixel);
3812 destgreen = GetGValue(pixel);
3813 destblue = GetBValue(pixel);
3814
3815 // ...and the hue intensity...
3816 red = (BYTE)((red*invhue + destred*hue + 255)>>8);
3817 green = (BYTE)((green*invhue + destgreen*hue + 255)>>8);
3818 blue = (BYTE)((blue*invhue + destblue*hue + 255)>>8);
3819 }
3820 // ...and finally we copy the sat'n'hue icon pixel to the destination...
3821 SetPixel(hdc, (r.left + x), (r.top + y), RGB(red, green, blue));
3822 }
3823// else if (pSettings->debugLogging && saturation==0 && hue==255) SetPixel(hdc, (r.left + x), (r.top + y), 0xff00ff);
3824 }
3825 }
3826
3827 SelectObject(iconhdc, oldiconbuf);
3828 DeleteObject(iconbufbmp);
3829 DeleteDC(iconhdc);
3830 }
3831 else
3832 {
3833 // No saturation or hue modifications, just draw the icon...
3834 DrawIconEx(hdc, r.left, r.top, icon, size, size, 0, NULL, DI_NORMAL);
3835 }
3836}
BYTE red
Definition BBApi.cpp:3761
BYTE destred
Definition BBApi.cpp:3761
int invsat
Definition BBApi.cpp:3763
BYTE greyscale
Definition BBApi.cpp:3761
BYTE destgreen
Definition BBApi.cpp:3761
COLORREF pixel
Definition BBApi.cpp:3762
int invhue
Definition BBApi.cpp:3763
BYTE blue
Definition BBApi.cpp:3761
BYTE green
Definition BBApi.cpp:3761
BYTE destblue
Definition BBApi.cpp:3761

◆ DrawGlyph()

void DrawGlyph ( HDC hdc,
RECT r,
int glyph,
COLORREF glyphColor )
3844{
3845 pBImage->DrawGlyph(hdc, r, glyph, glyphColor);
3846}

◆ GetParentFolder()

int GetParentFolder ( LPSTR path)
3854{
3855 int nLen = strlen(path) - 1;
3856 if (path[nLen] == '\\') nLen--; // Looking for the parent folder of a folder?
3857
3858 // Extract the parent folder from the specified path...
3859 while (nLen > 0 && path[nLen] != '\\') nLen--;
3860 path[nLen+1] = 0;
3861
3862 return nLen+1; // Return the position of the file name following the folder path...
3863}

◆ GetMonitorRect()

HMONITOR GetMonitorRect ( void * from,
RECT * r,
int Flags )
3872{
3873 return MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
3874}

Variable Documentation

◆ pBImage

BImage* pBImage
extern

◆ pMenu

Menu* pMenu
extern

◆ pMenuCommon

MenuCommon* pMenuCommon
extern

◆ pPluginManager

PluginManager* pPluginManager
extern

◆ pTaskbar

Taskbar* pTaskbar
extern

◆ pWorkspaces

Workspaces* pWorkspaces
extern

◆ pSettings

Settings* pSettings
extern

◆ pDesktop

Desktop* pDesktop
extern

◆ pWallpaper

Wallpaper* pWallpaper
extern

◆ tempBuf

char tempBuf[MAX_LINE_LENGTH]
static

◆ lineFromFile

char lineFromFile[MAX_LINE_LENGTH+1]
static

◆ stickyWindows

StickyWindowsVector stickyWindows

◆ hBlackbox

HWND hBlackbox = NULL

◆ hideNamedMenu

bool hideNamedMenu = false

◆ szTempBuffer

char szTempBuffer[MAX_LINE_LENGTH]
static

◆ gradientRect

RECT gradientRect

◆ red

BYTE red

◆ green

BYTE green

◆ blue

BYTE blue

◆ greyscale

BYTE greyscale

◆ destred

BYTE destred

◆ destgreen

BYTE destgreen

◆ destblue

BYTE destblue

◆ pixel

COLORREF pixel

◆ invsat

int invsat

◆ invhue

int invhue