From be507bc365776015a81a32698ac10ec0be872cc3 Mon Sep 17 00:00:00 2001 From: Paul W Date: Sat, 2 Feb 2019 10:36:52 -0500 Subject: [PATCH] Move scalableresource.h When @jsakkine was doing linux resources, he and I realized that I had put this file in the wrong directory. It should be in windows and conditionally included. Addresses issue #453 --- scripts/win/emit-vector-rc.py | 2 +- src/common/gui/CScalableBitmap.cpp | 5 ++++- src/common/resource.h | 6 +++++- src/{common => windows}/scalableresource.h | 0 4 files changed, 10 insertions(+), 3 deletions(-) rename src/{common => windows}/scalableresource.h (100%) diff --git a/scripts/win/emit-vector-rc.py b/scripts/win/emit-vector-rc.py index 7e923a5677a..c6030e3052d 100644 --- a/scripts/win/emit-vector-rc.py +++ b/scripts/win/emit-vector-rc.py @@ -68,7 +68,7 @@ scaleToOffset[ matchscale.group( 1 ) ] = int( matchscale.group( 2 ) ) -subRes = open( "src\\common\\scalableresource.h", "w" ) +subRes = open( "src\\windows\\scalableresource.h", "w" ) subRes.write( """ /* ** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT IT diff --git a/src/common/gui/CScalableBitmap.cpp b/src/common/gui/CScalableBitmap.cpp index e836ac6bbc5..3bd232b5e1a 100644 --- a/src/common/gui/CScalableBitmap.cpp +++ b/src/common/gui/CScalableBitmap.cpp @@ -56,13 +56,16 @@ CScalableBitmap::CScalableBitmap(CResourceDescription desc) scaleFilePostfixes[ 300 ] = "@3x"; scaleFilePostfixes[ 400 ] = "@4x"; +#if WINDOWS + // Only windows uses this integer indexing and knows these offsets std::map< int, int > scaleIDOffsets; scaleIDOffsets[ 100 ] = SCALABLE_100_OFFSET; scaleIDOffsets[ 150 ] = SCALABLE_150_OFFSET; scaleIDOffsets[ 200 ] = SCALABLE_200_OFFSET; scaleIDOffsets[ 300 ] = SCALABLE_300_OFFSET; scaleIDOffsets[ 400 ] = SCALABLE_400_OFFSET; - +#endif + for(auto sc : scales) { CBitmap *scBmp = NULL; diff --git a/src/common/resource.h b/src/common/resource.h index 0e491e1dea1..ae6f69c4e38 100644 --- a/src/common/resource.h +++ b/src/common/resource.h @@ -71,11 +71,14 @@ #endif #endif +#if WINDOWS /* ** Each of the bitmaps is also available in scaled form. The ID of the scaled bitmaps ** is ID_BG+SCALABLE_200_OFFSET for the 200% image. ** ** Do NOT change the values of these constants without understanding scripts/win/emit-vector-rc.py +** +** This is windows only. Mac and Linux use different resource approaches */ #define SCALABLE_100_OFFSET 70000 #define SCALABLE_150_OFFSET 71000 @@ -83,4 +86,5 @@ #define SCALABLE_300_OFFSET 73000 #define SCALABLE_400_OFFSET 74000 -#include "scalableresource.h" +#include "scalableresource.h" // found in src/windows +#endif diff --git a/src/common/scalableresource.h b/src/windows/scalableresource.h similarity index 100% rename from src/common/scalableresource.h rename to src/windows/scalableresource.h