Skip to content

Commit b20dffe

Browse files
committed
Updated to XP look-and-feel, more stuff re moving blending defines
1 parent 3998532 commit b20dffe

File tree

4 files changed

+26
-56
lines changed

4 files changed

+26
-56
lines changed

dialogs/TipDlg.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ HBRUSH CTipDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
167167
{
168168
if (pWnd->GetDlgCtrlID() == IDC_TIPSTRING)
169169
return (HBRUSH)GetStockObject(WHITE_BRUSH);
170+
else if (pWnd->GetDlgCtrlID() == IDC_STARTUP)
171+
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
172+
else if (nCtlColor == CTLCOLOR_STATIC)
173+
/* Visual styles enabled causes the things we draw in our WM_PAINT
174+
* to get cleared (and not redrawn) if we do not use a hollow brush here.
175+
* Likely the default behaviour differs when using theming. -JW */
176+
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
170177

171178
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
172179
}

install/mushclient.nsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Section "-MUSHclient program (required)"
8585
File "Readme.txt" ; in install directory
8686

8787
File "..\WinRel\mushclient.exe"
88-
; File "..\MUSHclient.exe.manifest"
88+
File "..\MUSHclient.exe.manifest"
8989
File "..\WinRel\lua5.1.dll"
9090
File "..\lua5.1.lib"
9191
File "..\mushclient.HLP"
@@ -496,7 +496,7 @@ Section Uninstall
496496

497497
; program
498498
Delete "$INSTDIR\MUSHclient.exe"
499-
; Delete "$INSTDIR\MUSHclient.exe.manifest"
499+
Delete "$INSTDIR\MUSHclient.exe.manifest"
500500
Delete "$INSTDIR\StatusBar.exe"
501501
Delete "$INSTDIR\lua5.1.dll"
502502
Delete "$INSTDIR\lua5.1.lib"

miniwindow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "scripting\errors.h"
1010
#include "color.h"
1111
#include "mainfrm.h"
12+
#include "blending.h"
1213

1314
#define PNG_NO_CONSOLE_IO
1415
#include "png\png.h"

stdafx.h

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -816,60 +816,6 @@ long ValidateBrushStyle (const long BrushStyle,
816816
// ascii to double
817817
int myAtoF(const char *z, double *pResult);
818818

819-
// colour stuff
820-
821-
#define CLAMP(x) (((x) < 0) ? 0 : (x > 255) ? 255 : (x))
822-
823-
824-
// see: http://www.nathanm.com/photoshop-blending-math/
825-
// and: http://www.pegtop.net/delphi/articles/blendmodes/
826-
827-
#define uint8 unsigned char
828-
#define sqr(x) ((x)*(x)) // square of x
829-
830-
// A = blend, B = base
831-
832-
#define Blend_Normal(A,B) ((uint8)(A))
833-
#define Blend_Lighten(A,B) ((uint8)((B > A) ? B:A))
834-
#define Blend_Darken(A,B) ((uint8)((B > A) ? A:B))
835-
#define Blend_Multiply(A,B) ((uint8)((A * B) / 255))
836-
#define Blend_Average(A,B) ((uint8)((A + B) / 2))
837-
#define Blend_Add(A,B) ((uint8)((A + B > 255) ? 255:(A + B)))
838-
#define Blend_Subtract(A,B) ((uint8)((A + B < 255) ? 0:(A + B - 255)))
839-
#define Blend_Difference(A,B) ((uint8)(abs(A - B)))
840-
#define Blend_Negation(A,B) ((uint8)(255 - abs(255 - A - B)))
841-
#define Blend_Screen(A,B) ((uint8)(255 - (((255 - A) * (255 - B)) >> 8)))
842-
#define Blend_Exclusion(A,B) ((uint8)(A + B - 2 * A * B / 255))
843-
#define Blend_Overlay(A,B) ((uint8)((B < 128) ? (2 * A * B / 255):(255 - 2 * (255 - A) * (255 - B) / 255)))
844-
#define Blend_SoftLight(A,B) ((uint8) ((A * B) >> 8) + ((B * (255 - (((255 - B) * (255-A)) >> 8) - ((A * B) >> 8) )) >> 8) ) // c = ((A * B) >> 8)
845-
#define Blend_HardLight(A,B) (Blend_Overlay(B,A))
846-
#define Blend_ColorDodge(A,B) ((uint8)((A == 255) ? A:((((unsigned long) B) << 8 ) / (255 - A) > 255) ? 255:((((unsigned long) B) << 8 ) / (255 - A))))
847-
#define Blend_ColorBurn(A,B) ((uint8)((A == 0) ? 0:((255 - (( ((unsigned long)(255 - B)) << 8 ) / A)) < 0) ? 0:(255 - (( ((unsigned long)(255 - B)) << 8 ) / A))))
848-
#define Blend_LinearDodge(A,B) (Blend_Add(A,B))
849-
#define Blend_LinearBurn(A,B) (Blend_Subtract(A,B))
850-
#define Blend_LinearLight(A,B) ((uint8)(A < 128) ? Blend_LinearBurn((2 * A),B):Blend_LinearDodge((2 * (A - 128)),B))
851-
#define Blend_VividLight(A,B) ((uint8)(A < 128) ? Blend_ColorBurn((2 * A),B):Blend_ColorDodge((2 * (A - 128)),B))
852-
#define Blend_PinLight(A,B) ((uint8)(A < 128) ? Blend_Darken((2 * A),B):Blend_Lighten((2 *(A - 128)),B))
853-
#define Blend_HardMix(A,B) ((uint8)(A < 255 - B) ? 0:255)
854-
#define Blend_Reflect(A,B) ((uint8)((B == 255) ? B:((A * A / (255 - B) > 255) ? 255:(A * A / (255 - B)))))
855-
#define Blend_Glow(A,B) (Blend_Reflect(B,A))
856-
#define Blend_Phoenix(A,B) ((uint8)(min(A,B) - max(A,B) + 255))
857-
#define Blend_Opacity(A,B,F,O) ((uint8)(O * F(A,B) + (1 - O) * B))
858-
859-
#define Simple_Opacity(B,X,O) ((uint8)(O * X + (1 - O) * B))
860-
861-
#define Blend_InverseColorDodge(A,B) Blend_ColorDodge (B, A)
862-
#define Blend_InverseColorBurn(A,B) Blend_ColorBurn (B, A)
863-
#define Blend_Freeze(A,B) ((uint8)((A == 0) ? A:((255 - sqr(255 - B)/ A < 0) ? 0:(255 - sqr(255 - B) / A))))
864-
#define Blend_Heat(A,B) Blend_Freeze (B, A)
865-
#define Blend_Stamp(A,B) ((uint8)((B + 2*A - 256 < 0) ? 0 : (B + 2*A - 256 > 255) ? 255 : (B + 2*A - 256) ))
866-
#define Blend_Interpolate(A,B) ((uint8)((cos_table [A] + cos_table [B]> 255) ? 255 : (cos_table [A] + cos_table [B]) ))
867-
868-
#define Blend_Xor(A,B) ((uint8) A ^ B )
869-
#define Blend_And(A,B) ((uint8) A & B )
870-
#define Blend_Or(A,B) ((uint8) A | B )
871-
#define Blend_A(A,B) ((uint8) (A))
872-
#define Blend_B(A,B) ((uint8) (B))
873819

874820

875821
long LoadPng (LPCTSTR FileName, HBITMAP & hbmp); // load a PNG file into a bitmap
@@ -903,3 +849,19 @@ typedef struct
903849
#ifndef BIF_NEWDIALOGSTYLE
904850
#define BIF_NEWDIALOGSTYLE 0x00000040
905851
#endif
852+
853+
/* Manifest instructions for the linker.
854+
* Originally there is an '#IFDEF _UNICODE' statement around these pragmas, but we don't compile as _UNICODE.
855+
* Research shows this #IFDEF seems to exist by default due to a bug in CEditView in MBCS mode, but I do not
856+
* believe this bug can affect us at present as it involves 'loading from files'. Testing thus far seems to
857+
* confirm there is no different behaviour in/around the command window with this enabled. -JW
858+
*/
859+
#if _MSC_VER > 1200 // doesn't work with Visual Studio 6
860+
#if defined _M_IX86
861+
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
862+
#elif defined _M_X64
863+
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
864+
#else
865+
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
866+
#endif
867+
#endif // _MSC_VER > 1200

0 commit comments

Comments
 (0)