[477] | 1 | #include "stdafx.h"
|
---|
[763] | 2 | #include <uxtheme.h>
|
---|
[477] | 3 |
|
---|
[478] | 4 | std::string ActiveBasic::Common::Environment::rootPath;
|
---|
[637] | 5 | bool ActiveBasic::Common::Environment::isRemoveExternal = false;
|
---|
[477] | 6 |
|
---|
| 7 | using namespace ActiveBasic::Common;
|
---|
| 8 |
|
---|
| 9 | void Environment::SetAbdevRootPath( const std::string &rootPath )
|
---|
| 10 | {
|
---|
| 11 | Environment::rootPath = Jenga::Common::Path::MakeFullPath( rootPath, Jenga::Common::Environment::GetAppDir() );
|
---|
| 12 | }
|
---|
[478] | 13 | const std::string Environment::GetAbdevRootPath()
|
---|
| 14 | {
|
---|
| 15 | if( rootPath.empty() )
|
---|
| 16 | {
|
---|
| 17 | SetAbdevRootPath( "" );
|
---|
| 18 | }
|
---|
| 19 | return rootPath;
|
---|
| 20 | }
|
---|
[719] | 21 |
|
---|
| 22 | const std::string Environment::GetUserAppDir()
|
---|
| 23 | {
|
---|
| 24 | return Jenga::Common::Environment::GetUserAppDir() + "\\ActiveBasic";
|
---|
| 25 | }
|
---|
| 26 |
|
---|
[477] | 27 | const std::string Environment::GetCompilerExePath( Platform::EnumType platform )
|
---|
| 28 | {
|
---|
| 29 | switch( platform )
|
---|
| 30 | {
|
---|
| 31 | case Platform::X86:
|
---|
| 32 | return rootPath + "\\bin\\x86\\abc.exe";
|
---|
| 33 | case Platform::X64:
|
---|
| 34 | return rootPath + "\\bin\\x64\\abc.exe";
|
---|
| 35 | }
|
---|
| 36 | throw;
|
---|
| 37 | }
|
---|
[751] | 38 |
|
---|
[763] | 39 | BOOL EnableLFH(HANDLE hHeap)
|
---|
| 40 | {
|
---|
| 41 | ULONG enableLFH = 2;
|
---|
| 42 | return HeapSetInformation(hHeap, HeapCompatibilityInformation, &enableLFH, sizeof enableLFH);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[751] | 45 | void* operator new( std::size_t n )
|
---|
| 46 | {
|
---|
| 47 | if ( void* p = dlmalloc(n) ){
|
---|
| 48 | return p;
|
---|
| 49 | }
|
---|
| 50 | else{
|
---|
| 51 | throw std::bad_alloc();
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | void* operator new[]( std::size_t n )
|
---|
| 56 | {
|
---|
| 57 | return ::operator new( n );
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | void operator delete( void* p )
|
---|
| 61 | {
|
---|
| 62 | dlfree( p );
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | void operator delete[]( void* p )
|
---|
| 66 | {
|
---|
| 67 | ::operator delete( p );
|
---|
| 68 | }
|
---|
[763] | 69 |
|
---|
| 70 | typedef HRESULT (WINAPI* PFN_EnableThemeDialogTexture)(HWND, DWORD);
|
---|
| 71 |
|
---|
| 72 | HMODULE hmodUxTheme = LoadLibrary("uxtheme");
|
---|
| 73 |
|
---|
| 74 | HRESULT ApplyDialogTexture( HWND hwnd )
|
---|
| 75 | {
|
---|
| 76 | if( hmodUxTheme )
|
---|
| 77 | {
|
---|
| 78 | if( PFN_EnableThemeDialogTexture pfn = reinterpret_cast<PFN_EnableThemeDialogTexture>(
|
---|
| 79 | GetProcAddress(hmodUxTheme, "EnableThemeDialogTexture")) )
|
---|
| 80 | {
|
---|
| 81 | return pfn(hwnd, ETDT_ENABLETAB);
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 | return E_NOTIMPL;
|
---|
| 85 | }
|
---|