From 5c1d9b28c4a0ef3cef93dba25d3ccee66237df8d Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 23 Dec 2006 15:37:33 +0000 Subject: [PATCH] Added stdwx.cpp/.h, for use with Precompiled Headers. See comments on files on how to use them. Also fixed setup.h support for many files. Originally committed to SVN as r595. --- FexTrackerSource/FexImgPyramid.cpp | 6 +- FexTrackerSource/FexTracker.cpp | 12 +++- core/aspell_wrap.h | 7 +-- core/audio_provider.cpp | 2 +- core/audio_provider_lavc.cpp | 3 +- core/audio_provider_lavc.h | 8 +-- core/dialog_spellcheck.h | 3 +- core/frame_main_events.cpp | 2 +- core/lavc_file.cpp | 4 +- core/lavc_file.h | 7 +-- core/stdwx.cpp | 49 ++++++++++++++++ core/stdwx.h | 94 ++++++++++++++++++++++++++++++ core/video_provider_lavc.cpp | 3 +- core/video_provider_lavc.h | 12 +--- 14 files changed, 177 insertions(+), 35 deletions(-) create mode 100644 core/stdwx.cpp create mode 100644 core/stdwx.h diff --git a/FexTrackerSource/FexImgPyramid.cpp b/FexTrackerSource/FexImgPyramid.cpp index 492a27151..903c5fcbf 100644 --- a/FexTrackerSource/FexImgPyramid.cpp +++ b/FexTrackerSource/FexImgPyramid.cpp @@ -13,6 +13,10 @@ void BaseFloatImage_GaussEdgeDetect( float* Img, int sizx, int sizy, float sigma void BaseFloatImage_GaussSmooth( float* Img, int sizx, int sizy, float sigma, float* Out ); void BaseFloatImage_LanczosRescale( float* in, int inSx, int inSy, float* out, int outSx, int outSy ); +#ifndef MIN +#define MIN(a,b) ((a)<(b))?(a):(b) +#endif + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// @@ -72,7 +76,7 @@ FexImgPyramid::FexImgPyramid( float* Img, int SizX, int SizY, float EdgeDetectSi if( Levels == -1 ) Levels = 999; int mLvl = 0; - int tsm = min(SizX,SizY); + int tsm = MIN(SizX,SizY); while( tsm>1 && tsm%2==0 ) { tsm/=Subsampling; diff --git a/FexTrackerSource/FexTracker.cpp b/FexTrackerSource/FexTracker.cpp index 1033e9530..f6b338686 100644 --- a/FexTrackerSource/FexTracker.cpp +++ b/FexTrackerSource/FexTracker.cpp @@ -4,6 +4,14 @@ // FexTracker.cpp : Defines the entry point for the DLL application. // +#ifndef MIN +#define MIN(a,b) ((a)<(b))?(a):(b) +#endif + +#ifndef MAX +#define MAX(a,b) ((a)>(b))?(a):(b) +#endif + #include "StdAfx.h" #include "stdio.h" @@ -22,7 +30,7 @@ FexTracker::FexTracker( int sx, int sy, int inFeatures ) bDebug = 0; - float subsampling = float(Cfg.SearchRange) / min(Cfg.WindowX,Cfg.WindowY); + float subsampling = float(Cfg.SearchRange) / float(MIN(Cfg.WindowX,Cfg.WindowY)); if (subsampling < 1.0) { /* 1.0 = 0+1 */ PyramidMaxLevels = 1; @@ -303,7 +311,7 @@ void FexTracker::FindFeatures( int minFeatures ) // Subtract 1 from the start time of all newly found features for( int j=oldN;j -#ifdef USE_LAVC #include "utils.h" #include "audio_provider_lavc.h" #include "video_provider_lavc.h" diff --git a/core/audio_provider_lavc.h b/core/audio_provider_lavc.h index 73f92d0f6..c74592e00 100644 --- a/core/audio_provider_lavc.h +++ b/core/audio_provider_lavc.h @@ -36,10 +36,8 @@ #pragma once -#ifndef AUDIO_PROVIDER_LAVC_H -#define AUDIO_PROVIDER_LAVC_H - -#ifdef USE_LAVC +#include "setup.h" +#if USE_LAVC == 1 #define EMULATE_INTTYPES #include "audio_provider.h" @@ -67,5 +65,3 @@ public: #endif /* USE_LAVC */ -#endif /* AUDIO_PROVIDER_LAVC_H */ - diff --git a/core/dialog_spellcheck.h b/core/dialog_spellcheck.h index d0d9af588..7e0e41b06 100644 --- a/core/dialog_spellcheck.h +++ b/core/dialog_spellcheck.h @@ -34,7 +34,8 @@ // -#ifndef NO_SPELLCHECKER +#include "setup.h" +#if USE_ASPELL == 1 #pragma once #include diff --git a/core/frame_main_events.cpp b/core/frame_main_events.cpp index 3d3e8e5d0..a64e36750 100644 --- a/core/frame_main_events.cpp +++ b/core/frame_main_events.cpp @@ -806,7 +806,7 @@ void FrameMain::OnOpenTranslation(wxCommandEvent& WXUNUSED(event)) { // Open Spell Checker void FrameMain::OnOpenSpellCheck (wxCommandEvent &event) { videoBox->videoDisplay->Stop(); - #ifndef NO_SPELLCHECKER + #if USE_ASPELL == 1 wxArrayInt selList = SubsBox->GetSelection(); if (selList.GetCount() == 1){ AssDialogue * a = SubsBox->GetDialogue(selList.Item(0)); diff --git a/core/lavc_file.cpp b/core/lavc_file.cpp index 04e9c81b7..f93a51b32 100644 --- a/core/lavc_file.cpp +++ b/core/lavc_file.cpp @@ -34,11 +34,11 @@ // +#include "setup.h" +#if USE_LAVC == 1 #include #include "lavc_file.h" -#ifdef USE_LAVC - LAVCFile::Initializer LAVCFile::init; LAVCFile::Initializer::Initializer() diff --git a/core/lavc_file.h b/core/lavc_file.h index 09a3b24a3..936685ce5 100644 --- a/core/lavc_file.h +++ b/core/lavc_file.h @@ -36,9 +36,8 @@ #pragma once -#ifndef LAVC_FILE_H -#define LAVC_FILE_H -#ifdef USE_LAVC +#include "setup.h" +#if USE_LAVC == 1 #define EMULATE_INTTYPES #include @@ -67,5 +66,3 @@ public: }; #endif /* USE_LAVC */ -#endif /* LAVC_FILE_H */ - diff --git a/core/stdwx.cpp b/core/stdwx.cpp new file mode 100644 index 000000000..c404c8d9b --- /dev/null +++ b/core/stdwx.cpp @@ -0,0 +1,49 @@ +// Copyright (c) 2006, Rodrigo Braz Monteiro +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of the Aegisub Group nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// ----------------------------------------------------------------------------- +// +// AEGISUB +// +// Website: http://aegisub.cellosoft.com +// Contact: mailto:zeratul@cellosoft.com +// + + +// +// Precompiled Header Source File +// +// In order to use it, set the project to use stdwx.h as precompiled header and +// insert it in every source file (under C/C++ -> Advanced -> Force Includes), +// then set this file to generate the precompiled header +// +// Note: make sure that you disable use of precompiled headers on md5.c and +// MatroskaParser.c, as well as any possible future .c files. +// + + +#include "stdwx.h" diff --git a/core/stdwx.h b/core/stdwx.h new file mode 100644 index 000000000..ae4cd202e --- /dev/null +++ b/core/stdwx.h @@ -0,0 +1,94 @@ +// Copyright (c) 2006, Rodrigo Braz Monteiro +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of the Aegisub Group nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// ----------------------------------------------------------------------------- +// +// AEGISUB +// +// Website: http://aegisub.cellosoft.com +// Contact: mailto:zeratul@cellosoft.com +// + + +// +// Precompiled Header File +// +// In order to use it, set the project to use this header as precompiled and +// insert it in every source file (under C/C++ -> Advanced -> Force Includes), +// then set stdwx.cpp to generate the precompiled header +// +// Note: make sure that you disable use of precompiled headers on md5.c and +// MatroskaParser.c, as well as any possible future .c files. +// + + +//////////// +// C++ only +#ifdef __cplusplus + +///////// +// Setup +#include "setup.h" + + +///////////////////// +// wxWidgets headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/////////////// +// STD headers +#include +#include +#include + + +/////////////////////// +// Optional components +#if USE_DIRECTSOUND == 1 +#include +#endif + + +#endif // C++ diff --git a/core/video_provider_lavc.cpp b/core/video_provider_lavc.cpp index 3cbfd2164..dbecd8d89 100644 --- a/core/video_provider_lavc.cpp +++ b/core/video_provider_lavc.cpp @@ -36,7 +36,8 @@ /////////// // Headers -#ifdef USE_LAVC +#include "setup.h" +#if USE_LAVC == 1 #include #include #include diff --git a/core/video_provider_lavc.h b/core/video_provider_lavc.h index 4848be665..ff3d39d7d 100644 --- a/core/video_provider_lavc.h +++ b/core/video_provider_lavc.h @@ -36,18 +36,10 @@ #pragma once -/////////////////////////////////// -// Auto-enable LAVC on non-windows -#ifndef __WINDOWS__ -#ifndef USE_LAVC -#define USE_LAVC -#endif -#endif - - /////////// // Headers -#ifdef USE_LAVC +#include "setup.h" +#if USE_LAVC == 1 #define EMULATE_INTTYPES #include #include