Changeset 249:b3dbd786541a
- Timestamp:
- 07/06/08 11:23:35 (2 months ago)
- Files:
-
- dwt/graphics/GC.d (modified) (1 diff)
- dwt/graphics/TextLayout.d (modified) (9 diffs)
- dwt/internal/win32/OS.d (modified) (10 diffs)
- dwt/internal/win32/WINAPI.d (modified) (5 diffs)
- dwt/internal/win32/WINTYPES.d (modified) (2 diffs)
- dwt/widgets/Button.d (modified) (1 diff)
- dwt/widgets/DateTime.d (modified) (3 diffs)
- dwt/widgets/Display.d (modified) (3 diffs)
- dwt/widgets/Group.d (modified) (3 diffs)
- dwt/widgets/Table.d (modified) (6 diffs)
- dwt/widgets/Tree.d (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/graphics/GC.d
r246 r249 1485 1485 1486 1486 /* Find the RGB values for the transparent pixel. */ 1487 bool isDib = bm.bmBits !is 0;1487 bool isDib = bm.bmBits !is null; 1488 1488 auto hBitmap = srcImage.handle; 1489 1489 auto srcHdc = OS.CreateCompatibleDC(handle); dwt/graphics/TextLayout.d
r246 r249 18 18 import dwt.internal.gdip.Gdip; 19 19 20 import dwt.internal.win32.EMR;21 import dwt.internal.win32.EMREXTCREATEFONTINDIRECTW;22 20 import dwt.internal.win32.OS; 23 21 … … 512 510 } 513 511 514 SCRIPT_ANALYSIS cloneScriptAnalysis ( SCRIPT_ANALYSIS src) {515 SCRIPT_ANALYSIS dst = new SCRIPT_ANALYSIS();512 SCRIPT_ANALYSIS cloneScriptAnalysis ( inout SCRIPT_ANALYSIS src) { 513 SCRIPT_ANALYSIS dst; 516 514 dst.eScript = src.eScript; 517 515 dst.fRTL = src.fRTL; … … 521 519 dst.fLogicalOrder = src.fLogicalOrder; 522 520 dst.fNoGlyphIndex = src.fNoGlyphIndex; 523 dst.s = new SCRIPT_STATE();524 521 dst.s.uBidiLevel = src.s.uBidiLevel; 525 522 dst.s.fOverrideDirection = src.s.fOverrideDirection; … … 2784 2781 } 2785 2782 2786 bool shape (HDC hdc, StyleItem run, char[] chars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIESsp) {2787 wchar[] wchars = StrToWCHARs( chars );2783 bool shape (HDC hdc, StyleItem run, wchar[] wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) { 2784 //wchar[] wchars = StrToWCHARs( chars ); 2788 2785 bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex; 2789 2786 if (useCMAPcheck) { 2790 short[] glyphs = new short[chars.length]; 2791 if (OS.ScriptGetCMap(hdc, run.psc, chars, chars.length, 0, glyphs) !is OS.S_OK) { 2792 if (run.psc !is 0) { 2787 ushort[] glyphs = new ushort[wchars.length]; 2788 scope(exit) delete glyphs; 2789 if (OS.ScriptGetCMap(hdc, run.psc, wchars.ptr, wchars.length, 0, glyphs.ptr) !is OS.S_OK) { 2790 if (run.psc !is null) { 2793 2791 OS.ScriptFreeCache(run.psc); 2794 2792 glyphCount[0] = 0; 2795 OS.MoveMemory(run.psc, new int /*long*/ [1], OS.PTR_SIZEOF);2793 *cast(int*)run.psc = 1; 2796 2794 } 2797 2795 return false; … … 2840 2838 segmentsText.getChars(run.start, run.start + run.length, chars, 0); 2841 2839 wchar[] wchars = StrToWCHARs( chars ); 2842 int maxGlyphs = ( chars.length * 3 / 2) + 16;2840 int maxGlyphs = (wchars.length * 3 / 2) + 16; 2843 2841 auto hHeap = OS.GetProcessHeap(); 2844 2842 run.glyphs = cast(ushort*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, maxGlyphs * 2); … … 2850 2848 run.psc = cast(SCRIPT_CACHE*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, (void*).sizeof); 2851 2849 if (run.psc is null) DWT.error(DWT.ERROR_NO_HANDLES); 2852 final short script = run.analysis.eScript; 2853 final SCRIPT_PROPERTIES sp = new SCRIPT_PROPERTIES(); 2854 OS.MoveMemory(sp, device.scripts[script], SCRIPT_PROPERTIES.sizeof); 2855 bool shapeSucceed = shape(hdc, run, chars, buffer, maxGlyphs, sp); 2850 short script = run.analysis.eScript; 2851 auto sp = device.scripts[script]; 2852 bool shapeSucceed = shape(hdc, run, wchars, buffer, maxGlyphs, sp); 2856 2853 if (!shapeSucceed) { 2857 int /*long*/hFont = OS.GetCurrentObject(hdc, OS.OBJ_FONT);2858 int /*long*/ ssa = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, OS.SCRIPT_STRING_ANALYSIS_sizeof());2859 int /*long*/metaFileDc = OS.CreateEnhMetaFile(hdc, null, null, null);2860 int /*long*/oldMetaFont = OS.SelectObject(metaFileDc, hFont);2854 auto hFont = OS.GetCurrentObject(hdc, OS.OBJ_FONT); 2855 auto ssa = cast(SCRIPT_STRING_ANALYSIS*) OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_STRING_ANALYSIS.sizeof); 2856 auto metaFileDc = OS.CreateEnhMetaFile(hdc, null, null, null); 2857 auto oldMetaFont = OS.SelectObject(metaFileDc, hFont); 2861 2858 int flags = OS.SSA_METAFILE | OS.SSA_FALLBACK | OS.SSA_GLYPHS | OS.SSA_LINK; 2862 if (OS.ScriptStringAnalyse(metaFileDc, chars, chars.length, 0, -1, flags, 0, null, null, 0, 0, 0, ssa) is OS.S_OK) {2859 if (OS.ScriptStringAnalyse(metaFileDc, wchars.ptr, wchars.length, 0, -1, flags, 0, null, null, null, null, null, ssa) is OS.S_OK) { 2863 2860 OS.ScriptStringOut(ssa, 0, 0, 0, null, 0, 0, false); 2864 2861 OS.ScriptStringFree(ssa); … … 2866 2863 OS.HeapFree(hHeap, 0, ssa); 2867 2864 OS.SelectObject(metaFileDc, oldMetaFont); 2868 int /*long*/ metaFile = OS.CloseEnhMetaFile(metaFileDc); 2869 final EMREXTCREATEFONTINDIRECTW emr = new EMREXTCREATEFONTINDIRECTW(); 2870 class MetaFileEnumProc { 2871 int /*long*/ metaFileEnumProc (int /*long*/ hDC, int /*long*/ table, int /*long*/ record, int /*long*/ nObj, int /*long*/ lpData) { 2872 OS.MoveMemory(emr.emr, record, EMR.sizeof); 2873 switch (emr.emr.iType) { 2874 case OS.EMR_EXTCREATEFONTINDIRECTW: 2875 OS.MoveMemory(emr, record, EMREXTCREATEFONTINDIRECTW.sizeof); 2876 break; 2877 case OS.EMR_EXTTEXTOUTW: 2878 return 0; 2879 } 2880 return 1; 2881 } 2882 }; 2883 MetaFileEnumProc object = new MetaFileEnumProc(); 2884 /* Avoid compiler warnings */ 2885 if (false) object.metaFileEnumProc(0, 0, 0, 0, 0); 2886 Callback callback = new Callback(object, "metaFileEnumProc", 5); 2887 int /*long*/ address = callback.getAddress(); 2888 if (address is 0) DWT.error(DWT.ERROR_NO_MORE_CALLBACKS); 2889 OS.EnumEnhMetaFile(0, metaFile, address, 0, null); 2865 auto metaFile = OS.CloseEnhMetaFile(metaFileDc); 2866 EMREXTCREATEFONTINDIRECTW emr; 2867 static extern(Windows) int metaFileEnumProc (HDC hDC, HANDLETABLE* table, ENHMETARECORD* record, int nObj, LPARAM lpData) { 2868 EMREXTCREATEFONTINDIRECTW* emr_; 2869 OS.MoveMemory(&emr_.emr, record, EMR.sizeof); 2870 switch (emr_.emr.iType) { 2871 case OS.EMR_EXTCREATEFONTINDIRECTW: 2872 OS.MoveMemory(emr_, record, EMREXTCREATEFONTINDIRECTW.sizeof); 2873 break; 2874 case OS.EMR_EXTTEXTOUTW: 2875 return 0; 2876 } 2877 return 1; 2878 } 2879 OS.EnumEnhMetaFile(null, metaFile, &metaFileEnumProc, &emr, null); 2890 2880 OS.DeleteEnhMetaFile(metaFile); 2891 callback.dispose(); 2892 2893 int /*long*/ newFont = OS.CreateFontIndirectW(emr.elfw.elfLogFont); 2881 2882 auto newFont = OS.CreateFontIndirectW(&emr.elfw.elfLogFont); 2894 2883 OS.SelectObject(hdc, newFont); 2895 if ( shapeSucceed = shape(hdc, run, chars, buffer, maxGlyphs, sp)) {2884 if ((shapeSucceed = shape(hdc, run, wchars, buffer, maxGlyphs, sp)) is true ) { 2896 2885 run.fallbackFont = newFont; 2897 2886 } … … 2899 2888 if (!sp.fComplex) { 2900 2889 run.analysis.fNoGlyphIndex = true; 2901 if ( shapeSucceed = shape(hdc, run, chars, buffer, maxGlyphs, sp)) {2890 if ((shapeSucceed = shape(hdc, run, wchars, buffer, maxGlyphs, sp)) is true ) { 2902 2891 run.fallbackFont = newFont; 2903 2892 } else { … … 2918 2907 /* ReleaseFont() */ 2919 2908 OS.VtblCall(8, mLangFontLink2, cast(int)hNewFont); 2920 auto mLangFont = OS.CreateFontIndirect( logFont);2909 auto mLangFont = OS.CreateFontIndirect(&logFont); 2921 2910 auto oldFont = OS.SelectObject(hdc, mLangFont); 2922 if ( shapeSucceed = shape(hdc, run, chars, buffer, maxGlyphs, sp)) {2911 if ((shapeSucceed = shape(hdc, run, wchars, buffer, maxGlyphs, sp)) is true ) { 2923 2912 run.fallbackFont = mLangFont; 2924 2913 } else { dwt/internal/win32/OS.d
r245 r249 811 811 public static const int EDGE_ETCHED = (BDR_SUNKENOUTER | BDR_RAISEDINNER); 812 812 public static const int EDGE_BUMP = (BDR_RAISEDOUTER | BDR_SUNKENINNER); 813 public static const int ELF_VENDOR_SIZE = 4; 813 814 public static const int EM_CANUNDO = 0xc6; 814 815 public static const int EM_CHARFROMPOS = 0xd7; … … 841 842 public static const int EM_SETTABSTOPS = 0xcb; 842 843 public static const int EM_UNDO = 199; 844 public static const int EMR_EXTCREATEFONTINDIRECTW = 82; 845 public static const int EMR_EXTTEXTOUTW = 84; 843 846 public static const int EN_ALIGN_LTR_EC = 0x0700; 844 847 public static const int EN_ALIGN_RTL_EC = 0x0701; … … 1108 1111 public static const int LB_SETSEL = 0x185; 1109 1112 public static const int LB_SETTOPINDEX = 0x197; 1113 public static const int LF_FULLFACESIZE = 64; 1110 1114 public static const int LF_FACESIZE = 32; 1111 1115 public static const int LGRPID_ARABIC = 0xd; … … 1700 1704 public static const int SS_REALSIZEIMAGE = 0x800; 1701 1705 public static const int SS_RIGHT = 0x2; 1706 public static const int SSA_FALLBACK = 0x00000020; 1707 public static const int SSA_GLYPHS = 0x00000080; 1708 public static const int SSA_METAFILE = 0x00000800; 1709 public static const int SSA_LINK = 0x00001000; 1702 1710 public static const int STANDARD_RIGHTS_READ = 0x20000; 1703 1711 public static const int STARTF_USESHOWWINDOW = 0x1; … … 2329 2337 alias WINAPI.CreateAcceleratorTableA CreateAcceleratorTable; 2330 2338 alias WINAPI.CreateDCA CreateDC; 2339 alias WINAPI.CreateEnhMetaFileA CreateEnhMetaFile; 2331 2340 alias WINAPI.CreateEventA CreateEvent; 2332 2341 alias WINAPI.CreateFileA CreateFile; … … 2434 2443 alias WINAPI.CreateAcceleratorTableW CreateAcceleratorTable; 2435 2444 alias WINAPI.CreateDCW CreateDC; 2445 alias WINAPI.CreateEnhMetaFileW CreateEnhMetaFile; 2436 2446 alias WINAPI.CreateEventW CreateEvent; 2437 2447 alias WINAPI.CreateFileW CreateFile; … … 2825 2835 alias WINAPI.CloseHandle CloseHandle; 2826 2836 alias WINAPI.CloseClipboard CloseClipboard; 2837 alias WINAPI.CloseEnhMetaFile CloseEnhMetaFile; 2838 alias WINAPI.CloseMetaFile CloseMetaFile; 2827 2839 alias WINAPI.CombineRgn CombineRgn; 2828 2840 alias WINAPI.CommDlgExtendedError CommDlgExtendedError; … … 2874 2886 alias WINAPI.DeferWindowPos DeferWindowPos; 2875 2887 alias WINAPI.DeleteDC DeleteDC; 2888 alias WINAPI.DeleteEnhMetaFile DeleteEnhMetaFile; 2876 2889 alias WINAPI.DeleteMenu DeleteMenu; 2877 2890 alias WINAPI.DeleteObject DeleteObject; … … 2907 2920 alias WINAPI.EndPath EndPath; 2908 2921 alias WINAPI.EnumDisplayMonitors EnumDisplayMonitors; 2922 alias WINAPI.EnumEnhMetaFile EnumEnhMetaFile; 2909 2923 alias WINAPI.EnumFontFamiliesA EnumFontFamiliesA; 2910 2924 alias WINAPI.EnumFontFamiliesExA EnumFontFamiliesExA; … … 3226 3240 alias WINAPI.ScriptPlace ScriptPlace; 3227 3241 alias WINAPI.ScriptRecordDigitSubstitution ScriptRecordDigitSubstitution; 3242 alias WINAPI.ScriptGetCMap ScriptGetCMap; 3228 3243 alias WINAPI.ScriptShape ScriptShape; 3244 alias WINAPI.ScriptStringAnalyse ScriptStringAnalyse; 3245 alias WINAPI.ScriptStringOut ScriptStringOut; 3246 alias WINAPI.ScriptStringFree ScriptStringFree; 3229 3247 alias WINAPI.ScriptTextOut ScriptTextOut; 3230 3248 alias WINAPI.ScriptXtoCP ScriptXtoCP; dwt/internal/win32/WINAPI.d
r214 r249 274 274 // WINBOOL RemoveFontResourceA(LPCSTR); 275 275 // HENHMETAFILE CopyEnhMetaFileA(HENHMETAFILE, LPCSTR); 276 //HDC CreateEnhMetaFileA(HDC, LPCSTR, LPRECT, LPCSTR);276 HDC CreateEnhMetaFileA(HDC, LPCSTR, LPRECT, LPCSTR); 277 277 // HENHMETAFILE GetEnhMetaFileA(LPCSTR); 278 278 // UINT GetEnhMetaFileDescriptionA(HENHMETAFILE, UINT, LPSTR); … … 665 665 // WINBOOL RemoveFontResourceW(LPCWSTR); 666 666 // HENHMETAFILE CopyEnhMetaFileW(HENHMETAFILE, LPCWSTR); 667 //HDC CreateEnhMetaFileW(HDC, LPCWSTR, LPRECT, LPCWSTR);667 HDC CreateEnhMetaFileW(HDC, LPCWSTR, LPRECT, LPCWSTR); 668 668 // HENHMETAFILE GetEnhMetaFileW(LPCWSTR); 669 669 // UINT GetEnhMetaFileDescriptionW(HENHMETAFILE, UINT, LPWSTR); … … 1370 1370 // WINBOOL CancelDC(HDC); 1371 1371 // WINBOOL Chord(HDC, int, int, int, int, int, int, int, int); 1372 //HMETAFILE CloseMetaFile(HDC);1372 HMETAFILE CloseMetaFile(HDC); 1373 1373 // int CombineRgn(HRGN, HRGN, HRGN, int); 1374 1374 // HBITMAP CreateBitmap(int, int, UINT, UINT, POINTER); … … 1507 1507 // WINBOOL PlayMetaFileRecord(HDC, LPHANDLETABLE, LPMETARECORD, UINT); 1508 1508 // WINBOOL EnumMetaFile(HDC, HMETAFILE, ENUMMETAFILEPROC, LPARAM); 1509 //HENHMETAFILE CloseEnhMetaFile(HDC);1510 //WINBOOL DeleteEnhMetaFile(HENHMETAFILE);1511 //WINBOOL EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMETAFILEPROC, LPVOID, RECT*);1509 HENHMETAFILE CloseEnhMetaFile(HDC); 1510 WINBOOL DeleteEnhMetaFile(HENHMETAFILE); 1511 WINBOOL EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMETAFILEPROC, LPVOID, RECT*); 1512 1512 // UINT GetEnhMetaFileHeader(HENHMETAFILE, UINT, LPENHMETAHEADER); 1513 1513 // UINT GetEnhMetaFilePaletteEntries(HENHMETAFILE, UINT, LPPALETTEENTRY); … … 3464 3464 int *piNumScripts 3465 3465 ); 3466 HRESULT ScriptGetCMap( 3467 HDC hdc, 3468 SCRIPT_CACHE* psc, 3469 WCHAR* pwcInChars, 3470 int cChars, 3471 DWORD dwFlags, 3472 WORD* pwOutGlyphs 3473 ); 3474 HRESULT ScriptStringAnalyse( 3475 HDC hdc, 3476 void* pString, 3477 int cString, 3478 int cGlyphs, 3479 int iCharset, 3480 DWORD dwFlags, 3481 int iReqWidth, 3482 SCRIPT_CONTROL* psControl, 3483 SCRIPT_STATE* psState, 3484 int* piDx, 3485 SCRIPT_TABDEF* pTabdef, 3486 BYTE* pbInClass, 3487 SCRIPT_STRING_ANALYSIS* pssa 3488 ); 3489 HRESULT ScriptStringOut( 3490 SCRIPT_STRING_ANALYSIS ssa, 3491 int iX, 3492 int iY, 3493 UINT uOptions, 3494 RECT* prc, 3495 int iMinSel, 3496 int iMaxSel, 3497 BOOL fDisabled 3498 ); 3499 HRESULT ScriptStringFree( 3500 SCRIPT_STRING_ANALYSIS* pssa 3501 ); 3502 3466 3503 HRESULT ScriptItemize( 3467 3504 WCHAR *pwcInChars, dwt/internal/win32/WINTYPES.d
r247 r249 13455 13455 extern(Windows){ 13456 13456 alias int (*ENUMMETAFILEPROC)(HDC, HANDLETABLE, METARECORD, int, LPARAM); 13457 alias int (*ENHMETAFILEPROC)(HDC, HANDLETABLE , ENHMETARECORD, int, LPARAM);13457 alias int (*ENHMETAFILEPROC)(HDC, HANDLETABLE*, ENHMETARECORD*, int, LPARAM); 13458 13458 alias int (*ENUMFONTSPROC)(LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM); 13459 13459 alias int (*FONTENUMPROC)(ENUMLOGFONT*, NEWTEXTMETRIC*, int, LPARAM); … … 15754 15754 15755 15755 alias DWORD ASSOCF; 15756 15757 // usp10 15758 //import dwt.dwthelper.bitfield; 15759 alias void* SCRIPT_STRING_ANALYSIS; 15760 struct SCRIPT_TABDEF { 15761 int cTabStops; 15762 int iScale; 15763 int* pTabStops; 15764 int iTabOrigin; 15765 } 15766 15767 //struct SCRIPT_ANALYSIS { 15768 // mixin(bitfields!( 15769 // ushort, "eScript", 10, 15770 // bool, "fRTL", 1, 15771 // bool, "fLayoutRTL", 1, 15772 // bool, "fLinkBefore", 1, 15773 // bool, "fLinkAfter", 1, 15774 // bool, "fLogicalOrder", 1, 15775 // bool, "fNoGlyphIndex", 1)); 15776 // SCRIPT_STATE s ; 15777 //} 15778 //struct SCRIPT_STATE { 15779 // mixin(bitfields!( 15780 // ubyte, "uBidiLevel", 5, 15781 // bool, "fOverrideDirection", 1, 15782 // bool, "fInhibitSymSwap", 1, 15783 // bool, "fCharShape", 1, 15784 // bool, "fDigitSubstitute", 1, 15785 // bool, "fInhibitLigate", 1, 15786 // bool, "fDisplayZWG", 1, 15787 // bool, "fArabicNumContext", 1, 15788 // bool, "fGcpClusters", 1, 15789 // bool, "fReserved", 1, 15790 // ubyte, "fEngineReserved", 2)); 15791 //} 15792 // 15793 //struct SCRIPT_CONTROL { 15794 // mixin(bitfields!( 15795 // ushort, "uDefaultLanguage", 16, 15796 // bool, "fContextDigits", 1, 15797 // bool, "fInvertPreBoundDir", 1, 15798 // bool, "fInvertPostBoundDir", 1, 15799 // bool, "fLinkStringBefore", 1, 15800 // bool, "fLinkStringAfter", 1, 15801 // bool, "fNeutralOverride", 1, 15802 // bool, "fNumericOverride", 1, 15803 // bool, "fLegacyBidiClass", 1, 15804 // ubyte, "fReserved", 8)); 15805 //} 15806 // dwt/widgets/Button.d
r246 r249 805 805 * fails for browser controls when the browser has focus. 806 806 */ 807 int /*long*/hDC = gc.handle;807 auto hDC = gc.handle; 808 808 if (!OS.PrintWindow (hwnd, hDC, 0)) { 809 809 int flags = OS.PRF_CLIENT | OS.PRF_NONCLIENT | OS.PRF_ERASEBKGND | OS.PRF_CHILDREN; dwt/widgets/DateTime.d
r246 r249 68 68 SYSTEMTIME time; // only used in calendar mode 69 69 static /+const+/ WNDPROC DateTimeProc; 70 static const TCHAR * DateTimeClass = OS.DATETIMEPICK_CLASS.ptr;70 static const TCHAR[] DateTimeClass = OS.DATETIMEPICK_CLASS; 71 71 static /+const+/ WNDPROC CalendarProc; 72 static const TCHAR * CalendarClass = OS.MONTHCAL_CLASS.ptr;72 static const TCHAR[] CalendarClass = OS.MONTHCAL_CLASS; 73 73 74 74 private static bool static_this_completed = false; … … 85 85 icex.dwICC = OS.ICC_DATE_CLASSES; 86 86 OS.InitCommonControlsEx (&icex); 87 }88 static { //TODO review89 87 WNDCLASS lpWndClass; 90 OS.GetClassInfo (null, DateTimeClass , &lpWndClass);88 OS.GetClassInfo (null, DateTimeClass.ptr, &lpWndClass); 91 89 DateTimeProc = lpWndClass.lpfnWndProc; 92 /*93 * Feature in Windows. The date time window class94 * does not include CS_DBLCLKS. This means that these95 * controls will not get double click messages such as96 * WM_LBUTTONDBLCLK. The fix is to register a new97 * window class with CS_DBLCLKS.98 *99 * NOTE: Screen readers look for the exact class name100 * of the control in order to provide the correct kind101 * of assistance. Therefore, it is critical that the102 * new window class have the same name. It is possible103 * to register a local window class with the same name104 * as a global class. Since bits that affect the class105 * are being changed, it is possible that other native106 * code, other than DWT, could create a control with107 * this class name, and fail unexpectedly.108 */109 int /*long*/hInstance = OS.GetModuleHandle (null);110 int /*long*/hHeap = OS.GetProcessHeap ();111 lpWndClass.hInstance = hInstance;112 lpWndClass.style &= ~OS.CS_GLOBALCLASS;113 lpWndClass.style |= OS.CS_DBLCLKS;114 int byteCount = DateTimeClass.length ()* TCHAR.sizeof;115 int /*long*/ lpszClassName =OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);116 OS.MoveMemory (lpszClassName, DateTimeClass, byteCount);117 lpWndClass.lpszClassName = lpszClassName;118 OS.RegisterClass (lpWndClass);119 OS.HeapFree (hHeap, 0, lpszClassName);120 OS.GetClassInfo (null, CalendarClass , &lpWndClass);90 /* 91 * Feature in Windows. The date time window class 92 * does not include CS_DBLCLKS. This means that these 93 * controls will not get double click messages such as 94 * WM_LBUTTONDBLCLK. The fix is to register a new 95 * window class with CS_DBLCLKS. 96 * 97 * NOTE: Screen readers look for the exact class name 98 * of the control in order to provide the correct kind 99 * of assistance. Therefore, it is critical that the 100 * new window class have the same name. It is possible 101 * to register a local window class with the same name 102 * as a global class. Since bits that affect the class 103 * are being changed, it is possible that other native 104 * code, other than DWT, could create a control with 105 * this class name, and fail unexpectedly. 106 */ 107 auto hInstance = OS.GetModuleHandle (null); 108 auto hHeap = OS.GetProcessHeap (); 109 lpWndClass.hInstance = hInstance; 110 lpWndClass.style &= ~OS.CS_GLOBALCLASS; 111 lpWndClass.style |= OS.CS_DBLCLKS; 112 int byteCount = DateTimeClass.length * TCHAR.sizeof; 113 auto lpszClassName = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 114 OS.MoveMemory (lpszClassName, DateTimeClass.ptr, byteCount); 115 lpWndClass.lpszClassName = lpszClassName; 116 OS.RegisterClass (&lpWndClass); 117 OS.HeapFree (hHeap, 0, lpszClassName); 118 OS.GetClassInfo (null, CalendarClass.ptr, &lpWndClass); 121 119 CalendarProc = lpWndClass.lpfnWndProc; 122 /*123 * Feature in Windows. The date time window class124 * does not include CS_DBLCLKS. This means that these125 * controls will not get double click messages such as126 * WM_LBUTTONDBLCLK. The fix is to register a new127 * window class with CS_DBLCLKS.128 *129 * NOTE: Screen readers look for the exact class name130 * of the control in order to provide the correct kind131 * of assistance. Therefore, it is critical that the132 * new window class have the same name. It is possible133 * to register a local window class with the same name134 * as a global class. Since bits that affect the class135 * are being changed, it is possible that other native136 * code, other than DWT, could create a control with137 * this class name, and fail unexpectedly.138 */139 int /*long*/hInstance = OS.GetModuleHandle (null);140 int /*long*/hHeap = OS.GetProcessHeap ();141 lpWndClass.hInstance = hInstance;142 lpWndClass.style &= ~OS.CS_GLOBALCLASS;143 lpWndClass.style |= OS.CS_DBLCLKS;144 int byteCount = CalendarClass.length ()* TCHAR.sizeof;145 int /*long*/ lpszClassName =OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);146 OS.MoveMemory (lpszClassName, CalendarClass, byteCount);147 lpWndClass.lpszClassName = lpszClassName;148 OS.RegisterClass (lpWndClass);149 OS.HeapFree (hHeap, 0, lpszClassName);120 /* 121 * Feature in Windows. The date time window class 122 * does not include CS_DBLCLKS. This means that these 123 * controls will not get double click messages such as 124 * WM_LBUTTONDBLCLK. The fix is to register a new 125 * window class with CS_DBLCLKS. 126 * 127 * NOTE: Screen readers look for the exact class name 128 * of the control in order to provide the correct kind 129 * of assistance. Therefore, it is critical that the 130 * new window class have the same name. It is possible 131 * to register a local window class with the same name 132 * as a global class. Since bits that affect the class 133 * are being changed, it is possible that other native 134 * code, other than DWT, could create a control with 135 * this class name, and fail unexpectedly. 136 */ 137 hInstance = OS.GetModuleHandle (null); 138 hHeap = OS.GetProcessHeap (); 139 lpWndClass.hInstance = hInstance; 140 lpWndClass.style &= ~OS.CS_GLOBALCLASS; 141 lpWndClass.style |= OS.CS_DBLCLKS; 142 byteCount = CalendarClass.length * TCHAR.sizeof; 143 lpszClassName = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 144 OS.MoveMemory (lpszClassName, CalendarClass.ptr, byteCount); 145 lpWndClass.lpszClassName = lpszClassName; 146 OS.RegisterClass (&lpWndClass); 147 OS.HeapFree (hHeap, 0, lpszClassName); 150 148 static_this_completed = true; 151 149 } … … 942 940 943 941 override String windowClass () { 944 return (style & DWT.CALENDAR) !is 0 ? TCHAR zToStr(CalendarClass) : TCHARzToStr(DateTimeClass);942 return (style & DWT.CALENDAR) !is 0 ? TCHARsToStr(CalendarClass) : TCHARsToStr(DateTimeClass); 945 943 } 946 944 dwt/widgets/Display.d
r246 r249 2077 2077 *keyMsg = *msg; 2078 2078 OS.PostMessage (hwndMessage, SWT_KEYMSG, wParam, cast(int)keyMsg); 2079 switch ( (int)/*64*/msg.wParam) {2079 switch (msg.wParam) { 2080 2080 case OS.VK_SHIFT: 2081 2081 case OS.VK_MENU: … … 3053 3053 } 3054 3054 } 3055 switch ( (int)/*64*/keyMsg.wParam) {3055 switch (keyMsg.wParam) { 3056 3056 case OS.VK_SHIFT: 3057 3057 case OS.VK_MENU: … … 3061 3061 case OS.VK_SCROLL: 3062 3062 consumed = true; 3063 default: 3063 3064 } 3064 3065 if (consumed) { dwt/widgets/Group.d
r246 r249 22 22 import dwt.internal.win32.OS; 23 23 import dwt.widgets.Composite; 24 import dwt.widgets.Control; 24 25 25 26 import dwt.dwthelper.utils; … … 321 322 } 322 323 323 void printWidget ( int /*long*/hwnd, GC gc) {324 void printWidget (HWND hwnd, GC gc) { 324 325 /* 325 326 * Bug in Windows. For some reason, PrintWindow() fails … … 329 330 * fails for browser controls when the browser has focus. 330 331 */ 331 int /*long*/hDC = gc.handle;332 auto hDC = gc.handle; 332 333 if (!OS.PrintWindow (hwnd, hDC, 0)) { 333 334 /* dwt/widgets/Table.d
r246 r249 24 24 import dwt.graphics.Rectangle; 25 25 import dwt.internal.ImageList; 26 import dwt.internal.win32.BITMAPINFOHEADER;27 26 import dwt.internal.win32.OS; 28 27 … … 5443 5442 */ 5444 5443 if ((!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) || hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) { 5445 int topIndex = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);5446 int selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, topIndex - 1, OS.LVNI_SELECTED);5444 int topIndex = OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0); 5445 int selection = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, topIndex - 1, OS.LVNI_SELECTED); 5447 5446 if (selection is -1) return 0; 5448 POINT mousePos = new POINT ();5447 POINT mousePos; 5449 5448 OS.POINTSTOPOINT (mousePos, OS.GetMessagePos ()); 5450 OS.MapWindowPoints( 0, handle,mousePos, 1);5451 RECT clientRect = new RECT ();5452 OS.GetClientRect (handle, clientRect);5449 OS.MapWindowPoints(null, handle, &mousePos, 1); 5450 RECT clientRect; 5451 OS.GetClientRect (handle, &clientRect); 5453 5452 TableItem item = _getItem (selection); 5454 5453 RECT rect = item.getBounds (selection, 0, true, true, true); … … 5463 5462 } 5464 5463 } 5465 int /*long*/hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);5466 while ((selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) !is -1) {5464 auto hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom); 5465 while ((selection = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) !is -1) { 5467 5466 if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break; 5468 5467 if (rect.bottom > clientRect.bottom) break; 5469 5468 RECT itemRect = item.getBounds (selection, 0, true, true, true); 5470 int /*long*/rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom);5469 auto rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom); 5471 5470 OS.CombineRgn (hRgn, hRgn, rectRgn, OS.RGN_OR); 5472 5471 OS.DeleteObject (rectRgn); 5473 5472 rect.bottom = itemRect.bottom; 5474 5473 } 5475 OS.GetRgnBox (hRgn, rect);5474 OS.GetRgnBox (hRgn, &rect); 5476 5475 5477 5476 /* Create resources */ 5478 int /*long*/hdc = OS.GetDC (handle);5479 int /*long*/memHdc = OS.CreateCompatibleDC (hdc);5480 BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ();5477 auto hdc = OS.GetDC (handle); 5478 auto memHdc = OS.CreateCompatibleDC (hdc); 5479 BITMAPINFOHEADER bmiHeader; 5481 5480 bmiHeader.biSize = BITMAPINFOHEADER.sizeof; 5482 5481 bmiHeader.biWidth = rect.right - rect.left; … … 5486 5485 bmiHeader.biCompression = OS.BI_RGB; 5487 5486 byte [] bmi = new byte [BITMAPINFOHEADER.sizeof]; 5488 OS.MoveMemory (bmi ,bmiHeader, BITMAPINFOHEADER.sizeof);5489 int /*long*/ [] pBits = new int /*long*/ [1];5490 int /*long*/ memDib = OS.CreateDIBSection (0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);5491 if (memDib is 0) DWT.error (DWT.ERROR_NO_HANDLES);5492 int /*long*/oldMemBitmap = OS.SelectObject (memHdc, memDib);5487 OS.MoveMemory (bmi.ptr, &bmiHeader, BITMAPINFOHEADER.sizeof); 5488 void*[1] pBits; 5489 auto memDib = OS.CreateDIBSection (null, cast(BITMAPINFO*) bmi.ptr, OS.DIB_RGB_COLORS, pBits.ptr, null, 0); 5490 if (memDib is null) DWT.error (DWT.ERROR_NO_HANDLES); 5491 auto oldMemBitmap = OS.SelectObject (memHdc, memDib); 5493 5492 int colorKey = 0x0000FD; 5494 POINT pt = new POINT();5495 OS.SetWindowOrgEx (memHdc, rect.left, rect.top, pt);5496 OS.FillRect (memHdc, rect, findBrush (colorKey, OS.BS_SOLID));5493 POINT pt; 5494 OS.SetWindowOrgEx (memHdc, rect.left, rect.top, &pt); 5495 OS.FillRect (memHdc, &rect, findBrush (colorKey, OS.BS_SOLID)); 5497 5496 OS.OffsetRgn (hRgn, -rect.left, -rect.top); 5498 5497 OS.SelectClipRgn (memHdc, hRgn); … … 5501 5500 OS.SelectObject (memHdc, oldMemBitmap); 5502 5501 OS.DeleteDC (memHdc); 5503 OS.ReleaseDC ( 0, hdc);5502 OS.ReleaseDC (null, hdc); 5504 5503 OS.DeleteObject (hRgn); 5505 5504 5506 SHDRAGIMAGE shdi = new SHDRAGIMAGE ();5505 SHDRAGIMAGE shdi; 5507 5506 shdi.hbmpDragImage = memDib; 5508 5507 shdi.crColorKey = colorKey; … … 5514 5513 shdi.ptOffset.x = shdi.sizeDragImage.cx - shdi.ptOffset.x; 5515 5514 } 5516 OS.MoveMemory ( lParam,shdi, SHDRAGIMAGE.sizeof);5515 OS.MoveMemory (cast(void*)lParam, &shdi, SHDRAGIMAGE.sizeof); 5517 5516 return 1; 5518 5517 } dwt/widgets/Tree.d
r246 r249 26 26 import dwt.graphics.Rectangle; 27 27 import dwt.internal.ImageList; 28 import dwt.internal.win32.BITMAPINFOHEADER;29 28 import dwt.internal.win32.OS; 30 29 … … 5766 5765 */ 5767 5766 if ((style & DWT.MULTI) !is 0 || hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) { 5768 int /*long*/ hItem =OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);5767 auto hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0); 5769 5768 TreeItem [] items = new TreeItem [10]; 5770 TVITEM tvItem = new TVITEM ();5769 TVITEM tvItem; 5771 5770 tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE; 5772 int count = getSelection (hItem, tvItem, items, 0, 10, false, true);5771 int count = getSelection (hItem, &tvItem, items, 0, 10, false, true); 5773 5772 if (count is 0) return 0; 5774 POINT mousePos = new POINT ();5773 POINT mousePos; 5775 5774 OS.POINTSTOPOINT (mousePos, OS.GetMessagePos ()); 5776 OS.MapWindowPoints ( 0, handle,mousePos, 1);5777 RECT clientRect = new RECT ();5778 OS.GetClientRect(handle, clientRect);5779 RECT rect = items [0].getBounds (0, true, true, false);5775 OS.MapWindowPoints (null, handle, &mousePos, 1); 5776 RECT clientRect; 5777 OS.GetClientRect(handle, &clientRect); 5778 RECT rect = *(items [0].getBounds (0, true, true, false)); 5780 5779 if ((style & DWT.FULL_SELECTION) !is 0) { 5781 5780 int width = DRAG_IMAGE_SIZE; … … 5788 5787 } 5789 5788 } 5790 int /*long*/hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);5789 auto hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom); 5791 5790 for (int i = 1; i < count; i++) { 5792 5791 if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break; 5793 5792 if (rect.bottom > clientRect.bottom) break; 5794 RECT itemRect = items[i].getBounds (0, true, true, false);5793 RECT itemRect = *(items[i].getBounds (0, true, true, false)); 5795 5794 if ((style & DWT.FULL_SELECTION) !is 0) { 5796 5795 itemRect.left = rect.left; 5797 5796 itemRect.right = rect.right; 5798 5797 } 5799 int /*long*/rectRgn = OS.CreateRectRgn (itemRect.left, itemRect.top, itemRect.right, itemRect.bottom);5798 auto rectRgn = OS.CreateRectRgn (itemRect.left, itemRect.top, itemRect.right, itemRect.bottom); 5800 5799 OS.CombineRgn (hRgn, hRgn, rectRgn, OS.RGN_OR); 5801 5800 OS.DeleteObject (rectRgn); … … 5803 5802 5804 5803 } 5805 OS.GetRgnBox (hRgn, rect);5804 OS.GetRgnBox (hRgn, &rect); 5806 5805 5807 5806 /* Create resources */ 5808 int /*long*/hdc = OS.GetDC (handle);5809 int /*long*/memHdc = OS.CreateCompatibleDC (hdc);5810 BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ();5807 auto hdc = OS.GetDC (handle); 5808 auto memHdc = OS.CreateCompatibleDC (hdc); 5809 BITMAPINFOHEADER bmiHeader; 5811 5810 bmiHeader.biSize = BITMAPINFOHEADER.sizeof; 5812 5811 bmiHeader.biWidth = rect.right - rect.left; … … 5816 5815 bmiHeader.biCompression = OS.BI_RGB; 5817 5816 byte [] bmi = new byte [BITMAPINFOHEADER.sizeof]; 5818 OS.MoveMemory (bmi ,bmiHeader, BITMAPINFOHEADER.sizeof);5819 int /*long*/ [] pBits = new int /*long*/ [1];5820 int /*long*/ memDib = OS.CreateDIBSection (0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);5821 if (memDib is 0) DWT.error (DWT.ERROR_NO_HANDLES);5822 int /*long*/oldMemBitmap = OS.SelectObject (memHdc, memDib);5817 OS.MoveMemory (bmi.ptr, &bmiHeader, BITMAPINFOHEADER.sizeof); 5818 void* [1] pBits; 5819 auto memDib = OS.CreateDIBSection (null, cast(BITMAPINFO*) bmi.ptr, OS.DIB_RGB_COLORS, pBits.ptr, null, 0); 5820 if (memDib is null) DWT.error (DWT.ERROR_NO_HANDLES); 5821 auto oldMemBitmap = OS.SelectObject (memHdc, memDib); 5823 5822 int colorKey = 0x0000FD; 5824 POINT pt = new POINT ();5825 OS.SetWindowOrgEx (memHdc, rect.left, rect.top, pt);5826 OS.FillRect (memHdc, rect, findBrush (colorKey, OS.BS_SOLID));5823 POINT pt; 5824 OS.SetWindowOrgEx (memHdc, rect.left, rect.top, &pt); 5825 OS.FillRect (memHdc, &rect, findBrush (colorKey, OS.BS_SOLID)); 5827 5826 OS.OffsetRgn (hRgn, -rect.left, -rect.top); 5828 5827 OS.SelectClipRgn (memHdc, hRgn); … … 5831 5830 OS.SelectObject (memHdc, oldMemBitmap); 5832 5831 OS.DeleteDC (memHdc); 5833 OS.ReleaseDC ( 0, hdc);5832 OS.ReleaseDC (null, hdc); 5834 5833 OS.DeleteObject (hRgn); 5835 5834 5836 SHDRAGIMAGE shdi = new SHDRAGIMAGE ();5835 SHDRAGIMAGE shdi; 5837 5836 shdi.hbmpDragImage = memDib; 5838 5837 shdi.crColorKey = colorKey; … … 5844 5843 shdi.ptOffset.x = shdi.sizeDragImage.cx - shdi.ptOffset.x; 5845 5844 } 5846 OS.MoveMemory ( lParam,shdi, SHDRAGIMAGE.sizeof);5845 OS.MoveMemory (cast(void*)lParam, &shdi, SHDRAGIMAGE.sizeof); 5847 5846 return 1; 5848 5847 } … … 6507 6506 ignoreDeselect = ignoreSelect = true; 6508 6507 int /*long*/ code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam); 6509 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS. buildVERSION (6, 0)) {6508 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { 6510 6509 if (OS.GetFocus () !is handle) OS.SetFocus (handle); 6511 6510 }
