Merge branch 'master' of github.com:buggins/dlangui

This commit is contained in:
Vadim Lopatin 2015-01-12 14:46:46 +04:00
commit ddcf57257a
66 changed files with 1633 additions and 901 deletions

View File

@ -2834,14 +2834,14 @@ static if (_WIN32_IE >= 0x400) {
struct NMCBEDRAGBEGINW {
NMHDR hdr;
int iItemid;
WCHAR szText[CBEMAXSTRLEN];
WCHAR[CBEMAXSTRLEN] szText;
}
alias NMCBEDRAGBEGINW* LPNMCBEDRAGBEGINW, PNMCBEDRAGBEGINW;
struct NMCBEDRAGBEGINA {
NMHDR hdr;
int iItemid;
char szText[CBEMAXSTRLEN];
char[CBEMAXSTRLEN] szText;
}
alias NMCBEDRAGBEGINA* LPNMCBEDRAGBEGINA, PNMCBEDRAGBEGINA;
@ -2962,7 +2962,7 @@ struct NMCBEENDEDITW {
NMHDR hdr;
BOOL fChanged;
int iNewSelection;
WCHAR szText[CBEMAXSTRLEN];
WCHAR[CBEMAXSTRLEN] szText;
int iWhy;
}
alias NMCBEENDEDITW* LPNMCBEENDEDITW, PNMCBEENDEDITW;
@ -2971,7 +2971,7 @@ struct NMCBEENDEDITA {
NMHDR hdr;
BOOL fChanged;
int iNewSelection;
char szText[CBEMAXSTRLEN];
char[CBEMAXSTRLEN] szText;
int iWhy;
}
alias NMCBEENDEDITA* LPNMCBEENDEDITA, PNMCBEENDEDITA;
@ -2995,9 +2995,9 @@ struct TBBUTTON {
BYTE fsState;
BYTE fsStyle;
version(Win64){
BYTE bReserved[6];
BYTE[6] bReserved;
} else {
BYTE bReserved[2];
BYTE[2] bReserved;
}
DWORD_PTR dwData;
INT_PTR iString;
@ -3172,7 +3172,7 @@ struct HD_LAYOUT {
RECT* prc;
WINDOWPOS* pwpos;
}
alias HDLAYOUT* LPHDLAYOUT;
alias HD_LAYOUT* LPHDLAYOUT;
deprecated alias HD_LAYOUT HDLAYOUT;
struct HD_HITTESTINFO {
@ -3543,7 +3543,7 @@ static if (_WIN32_IE >= 0x300) {
struct NMTTDISPINFOA {
NMHDR hdr;
LPSTR lpszText;
char szText[80];
char[80] szText;
HINSTANCE hinst;
UINT uFlags;
LPARAM lParam;
@ -3552,7 +3552,7 @@ static if (_WIN32_IE >= 0x300) {
struct NMTTDISPINFOW {
NMHDR hdr;
LPWSTR lpszText;
WCHAR szText[80];
WCHAR[80] szText;
HINSTANCE hinst;
UINT uFlags;
LPARAM lParam;
@ -3561,7 +3561,7 @@ static if (_WIN32_IE >= 0x300) {
struct NMTTDISPINFOA {
NMHDR hdr;
LPSTR lpszText;
char szText[80];
char[80] szText;
HINSTANCE hinst;
UINT uFlags;
}
@ -3569,7 +3569,7 @@ static if (_WIN32_IE >= 0x300) {
struct NMTTDISPINFOW {
NMHDR hdr;
LPWSTR lpszText;
WCHAR szText[80];
WCHAR[80] szText;
HINSTANCE hinst;
UINT uFlags;
}

View File

@ -302,7 +302,7 @@ interface LPDIRECT3DDEVICE9 : IUnknown
D3DMATRIX ProjectionMatrix;
D3DMATRIX ViewMatrix;
D3DMATRIX WorldMatrix;
D3DMATRIX TextureMatrices[8];
D3DMATRIX[8] TextureMatrices;
DWORD FVF;
UINT VertexSize;
@ -311,8 +311,8 @@ interface LPDIRECT3DDEVICE9 : IUnknown
BOOL SoftwareVertexProcessing;
D3DMATERIAL9 Material;
D3DLIGHT9 Lights[16];
BOOL LightsEnabled[16];
D3DLIGHT9[16] Lights;
BOOL[16] LightsEnabled;
D3DGAMMARAMP GammaRamp;
RECT ScissorRect;

View File

@ -1708,8 +1708,8 @@ const D3DRTYPECOUNT = D3DRTYPE_INDEXBUFFER+1;
struct D3DDEVINFO_RESOURCEMANAGER
{
//#ifndef WOW64_ENUM_WORKAROUND
// D3DRESOURCESTATS stats[D3DRTYPECOUNT];
D3DRESOURCESTATS stats[8];
// D3DRESOURCESTATS[D3DRTYPECOUNT] stats;
D3DRESOURCESTATS[8] stats;
}
alias D3DDEVINFO_RESOURCEMANAGER* LPD3DDEVINFO_RESOURCEMANAGER;

View File

@ -160,7 +160,7 @@ align(4) struct D3DXFONT_DESCA
BYTE OutputPrecision;
BYTE Quality;
BYTE PitchAndFamily;
CHAR FaceName[LF_FACESIZE];
CHAR[LF_FACESIZE] FaceName;
}
align(4) struct D3DXFONT_DESCW
@ -174,7 +174,7 @@ align(4) struct D3DXFONT_DESCW
BYTE OutputPrecision;
BYTE Quality;
BYTE PitchAndFamily;
WCHAR FaceName[LF_FACESIZE];
WCHAR[LF_FACESIZE] FaceName;
}
align(4) struct TEXTMETRICA
@ -1744,36 +1744,36 @@ const char[] XSKINEXP_TEMPLATES =
<B8D65549-D7C9-4995-89CF-53A9A8B031E3>
DWORD nIndices;
DWORD nOriginalVertices;
array DWORD indices[nIndices];
array DWORD[nIndices] indices;
}
template FaceAdjacency
{
<A64C844A-E282-4756-8B80-250CDE04398C>
DWORD nIndices;
array DWORD indices[nIndices];
array DWORD[nIndices] indices;
}
template SkinWeights
{
<6F0D123B-BAD2-4167-A0D0-80224F25FABB>
STRING transformNodeName;
DWORD nWeights;
array DWORD vertexIndices[nWeights];
array float weights[nWeights];
array DWORD[nWeights] vertexIndices;
array float[nWeights] weights;
Matrix4x4 matrixOffset;
}
template Patch
{
<A3EB5D44-FC22-429D-9AFB-3221CB9719A6>
DWORD nControlIndices;
array DWORD controlIndices[nControlIndices];
array DWORD[nControlIndices] controlIndices;
}
template PatchMesh
{
<D02C95CC-EDBA-4305-9B5D-1820D7704BBF>
DWORD nVertices;
array Vector vertices[nVertices];
array Vector[nVertices] vertices;
DWORD nPatches;
array Patch patches[nPatches];
array Patch[nPatches] patches;
[ ... ]
}
template PatchMesh9
@ -1783,16 +1783,16 @@ const char[] XSKINEXP_TEMPLATES =
DWORD Degree;
DWORD Basis;
DWORD nVertices;
array Vector vertices[nVertices];
array Vector[nVertices] vertices;
DWORD nPatches;
array Patch patches[nPatches];
array Patch[nPatches] patches;
[ ... ]
} "
"template EffectFloats
{
<F1CFE2B3-0DE3-4e28-AFA1-155A750A282D>
DWORD nFloats;
array float Floats[nFloats];
array float[nFloats] Floats;
}
template EffectString
{
@ -1809,7 +1809,7 @@ const char[] XSKINEXP_TEMPLATES =
<3014B9A0-62F5-478c-9B86-E4AC9F4E418B>
STRING ParamName;
DWORD nFloats;
array float Floats[nFloats];
array float[nFloats] Floats;
} "
"template EffectParamString
{
@ -1841,7 +1841,7 @@ const char[] XSKINEXP_TEMPLATES =
FLOAT TicksPerSec;
DWORD PlaybackType;
DWORD BufferLength;
array DWORD CompressedData[BufferLength];
array DWORD[BufferLength] CompressedData;
} ";
const char[] XEXTENSIONS_TEMPLATES =
@ -1851,7 +1851,7 @@ const char[] XEXTENSIONS_TEMPLATES =
<B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897>
DWORD dwFVF;
DWORD nDWords;
array DWORD data[nDWords];
array DWORD[nDWords] data;
}
template VertexElement
{
@ -1865,9 +1865,9 @@ const char[] XEXTENSIONS_TEMPLATES =
{
<BF22E553-292C-4781-9FEA-62BD554BDD93>
DWORD nElements;
array VertexElement Elements[nElements];
array VertexElement[nElements] Elements;
DWORD nDWords;
array DWORD data[nDWords];
array DWORD[nDWords] data;
}
template PMAttributeRange
{
@ -1890,14 +1890,14 @@ const char[] XEXTENSIONS_TEMPLATES =
{
<B6C3E656-EC8B-4b92-9B62-681659522947>
DWORD nAttributes;
array PMAttributeRange attributeRanges[nAttributes];
array PMAttributeRange[nAttributes] attributeRanges;
DWORD nMaxValence;
DWORD nMinLogicalVertices;
DWORD nMaxLogicalVertices;
DWORD nVSplits;
array PMVSplitRecord splitRecords[nVSplits];
array PMVSplitRecord[nVSplits] splitRecords;
DWORD nAttributeMispredicts;
array DWORD attributeMispredicts[nAttributeMispredicts];
array DWORD[nAttributeMispredicts] attributeMispredicts;
} ";
enum : uint

View File

@ -24,8 +24,8 @@ struct DIDEVICEINSTANCEA
GUID guidInstance;
GUID guidProduct;
DWORD dwDevType;
CHAR tszInstanceName[MAX_PATH];
CHAR tszProductName[MAX_PATH];
CHAR[MAX_PATH] tszInstanceName;
CHAR[MAX_PATH] tszProductName;
GUID guidFFDriver;
WORD wUsagePage;
WORD wUsage;
@ -39,7 +39,7 @@ struct DIDEVICEOBJECTINSTANCEA
DWORD dwOfs;
DWORD dwType;
DWORD dwFlags;
CHAR tszName[MAX_PATH];
CHAR[MAX_PATH] tszName;
DWORD dwFFMaxForce;
DWORD dwFFForceResolution;
WORD wCollectionNumber;
@ -103,7 +103,7 @@ struct DIACTIONFORMATA
HINSTANCE hInstString;
FILETIME ftTimeStamp;
DWORD dwCRC;
CHAR tszActionMap[MAX_PATH];
CHAR[MAX_PATH] tszActionMap;
}
struct DIDEVCAPS
@ -182,7 +182,7 @@ struct DIEFFECTINFOA
DWORD dwEffType;
DWORD dwStaticParams;
DWORD dwDynamicParams;
CHAR tszName[MAX_PATH];
CHAR[MAX_PATH] tszName;
}
struct DIFILEEFFECT
@ -190,21 +190,21 @@ struct DIFILEEFFECT
DWORD dwSize;
GUID GuidEffect;
DIEFFECT* lpDiEffect;
CHAR szFriendlyName[MAX_PATH];
CHAR[MAX_PATH] szFriendlyName;
}
struct DIDEVICEIMAGEINFOA
{
CHAR tszImagePath[MAX_PATH];
DWORD dwFlags;
CHAR[MAX_PATH] tszImagePath;
DWORD dwFlags;
// These are valid if DIDIFT_OVERLAY is present in dwFlags.
DWORD dwViewID;
RECT rcOverlay;
DWORD dwObjID;
DWORD dwcValidPts;
POINT rgptCalloutLine[5];
RECT rcCalloutRect;
DWORD dwTextAlign;
DWORD dwViewID;
RECT rcOverlay;
DWORD dwObjID;
DWORD dwcValidPts;
POINT[5] rgptCalloutLine;
RECT rcCalloutRect;
DWORD dwTextAlign;
}
struct DIDEVICEIMAGEINFOHEADERA
@ -250,20 +250,20 @@ struct DIMOUSESTATE2
LONG lX;
LONG lY;
LONG lZ;
BYTE rgbButtons[8];
BYTE[8] rgbButtons;
}
struct DIJOYSTATE
{
LONG lX; /* x-axis position */
LONG lY; /* y-axis position */
LONG lZ; /* z-axis position */
LONG lRx; /* x-axis rotation */
LONG lRy; /* y-axis rotation */
LONG lRz; /* z-axis rotation */
LONG rglSlider[2]; /* extra axes positions */
DWORD rgdwPOV[4]; /* POV directions */
BYTE rgbButtons[32]; /* 32 buttons */
LONG lX; /* x-axis position */
LONG lY; /* y-axis position */
LONG lZ; /* z-axis position */
LONG lRx; /* x-axis rotation */
LONG lRy; /* y-axis rotation */
LONG lRz; /* z-axis rotation */
LONG[2] rglSlider; /* extra axes positions */
DWORD[4] rgdwPOV; /* POV directions */
BYTE[32] rgbButtons; /* 32 buttons */
}
struct DIPROPRANGE

View File

@ -74,7 +74,7 @@ struct OLECMDTEXT {
DWORD cmdtextf;
ULONG cwActual;
ULONG cwBuf;
wchar rgwz[1];
wchar[1] rgwz;
}
struct OLECMD {

10
3rdparty/win32/imm.d vendored
View File

@ -301,7 +301,7 @@ struct CANDIDATELIST{
DWORD dwSelection;
DWORD dwPageStart;
DWORD dwPageSize;
DWORD dwOffset[1];
DWORD[1] dwOffset;
}
alias CANDIDATELIST* PCANDIDATELIST, LPCANDIDATELIST;
@ -319,13 +319,13 @@ alias REGISTERWORDW* PREGISTERWORDW, LPREGISTERWORDW;
struct STYLEBUFA{
DWORD dwStyle;
CHAR szDescription[STYLE_DESCRIPTION_SIZE];
CHAR[STYLE_DESCRIPTION_SIZE] szDescription;
}
alias STYLEBUFA* PSTYLEBUFA, LPSTYLEBUFA;
struct STYLEBUFW{
DWORD dwStyle;
WCHAR szDescription[STYLE_DESCRIPTION_SIZE];
WCHAR[STYLE_DESCRIPTION_SIZE] szDescription;
}
alias STYLEBUFW* PSTYLEBUFW, LPSTYLEBUFW;
@ -337,7 +337,7 @@ struct IMEMENUITEMINFOA{
HBITMAP hbmpChecked;
HBITMAP hbmpUnchecked;
DWORD dwItemData;
CHAR szString[IMEMENUITEM_STRING_SIZE];
CHAR[IMEMENUITEM_STRING_SIZE] szString;
HBITMAP hbmpItem;
}
alias IMEMENUITEMINFOA* PIMEMENUITEMINFOA, LPIMEMENUITEMINFOA;
@ -350,7 +350,7 @@ struct IMEMENUITEMINFOW{
HBITMAP hbmpChecked;
HBITMAP hbmpUnchecked;
DWORD dwItemData;
WCHAR szString[IMEMENUITEM_STRING_SIZE];
WCHAR[IMEMENUITEM_STRING_SIZE] szString;
HBITMAP hbmpItem;
}
alias IMEMENUITEMINFOW* PIMEMENUITEMINFOW, LPIMEMENUITEMINFOW;

View File

@ -352,13 +352,13 @@ struct USER_INFO_20 {
alias USER_INFO_20* PUSER_INFO_20, LPUSER_INFO_20;
struct USER_INFO_21 {
BYTE usri21_password[ENCRYPTED_PWLEN];
BYTE[ENCRYPTED_PWLEN] usri21_password;
}
alias USER_INFO_21* PUSER_INFO_21, LPUSER_INFO_21;
struct USER_INFO_22{
LPWSTR usri22_name;
BYTE usri22_password[ENCRYPTED_PWLEN];
BYTE[ENCRYPTED_PWLEN] usri22_password;
DWORD usri22_password_age;
DWORD usri22_priv;
LPWSTR usri22_home_dir;

View File

@ -1036,7 +1036,7 @@ struct MMTIME {
BYTE frame;
BYTE fps;
BYTE dummy;
BYTE pad[2];
BYTE[2] pad;
};
struct midi {
DWORD songptrpos;
@ -1100,7 +1100,7 @@ struct WAVEOUTCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
DWORD dwFormats;
WORD wChannels;
WORD wReserved1;
@ -1112,7 +1112,7 @@ struct WAVEOUTCAPSW {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
DWORD dwFormats;
WORD wChannels;
WORD wReserved1;
@ -1124,7 +1124,7 @@ struct WAVEINCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
DWORD dwFormats;
WORD wChannels;
WORD wReserved1;
@ -1135,7 +1135,7 @@ struct WAVEINCAPSW {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
DWORD dwFormats;
WORD wChannels;
WORD wReserved1;
@ -1179,16 +1179,16 @@ alias HMIDIIN* LPHMIDIIN;
alias HMIDIOUT* LPHMIDIOUT;
alias HMIDISTRM* LPHMIDISTRM;
alias WORD PATCHARRAY[MIDIPATCHSIZE];
alias WORD[MIDIPATCHSIZE] PATCHARRAY;
alias WORD* LPPATCHARRAY;
alias WORD KEYARRAY[MIDIPATCHSIZE];
alias WORD[MIDIPATCHSIZE] KEYARRAY;
alias WORD* LPKEYARRAY;
struct MIDIOUTCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
WORD wTechnology;
WORD wVoices;
WORD wNotes;
@ -1201,7 +1201,7 @@ struct MIDIOUTCAPSW {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
WORD wTechnology;
WORD wVoices;
WORD wNotes;
@ -1214,7 +1214,7 @@ struct MIDIINCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
DWORD dwSupport;
}
alias MIDIINCAPSA* PMIDIINCAPSA, LPMIDIINCAPSA;
@ -1223,7 +1223,7 @@ struct MIDIINCAPSW {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
DWORD dwSupport;
}
alias MIDIINCAPSW* PMIDIINCAPSW, LPMIDIINCAPSW;
@ -1237,7 +1237,7 @@ struct MIDIHDR {
MIDIHDR *lpNext;
DWORD reserved;
DWORD dwOffset;
DWORD dwReserved[8];
DWORD[8] dwReserved;
}
alias MIDIHDR* PMIDIHDR, LPMIDIHDR;
@ -1245,7 +1245,7 @@ struct MIDIEVENT {
DWORD dwDeltaTime;
DWORD dwStreamID;
DWORD dwEvent;
DWORD dwParms[1];
DWORD[1] dwParms;
}
struct MIDISTRMBUFFVER {
@ -1270,7 +1270,7 @@ struct AUXCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
WORD wTechnology;
WORD wReserved1;
DWORD dwSupport;
@ -1281,7 +1281,7 @@ struct AUXCAPSW {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
WORD wTechnology;
WORD wReserved1;
DWORD dwSupport;
@ -1298,7 +1298,7 @@ struct MIXERCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
DWORD fdwSupport;
DWORD cDestinations;
}
@ -1308,7 +1308,7 @@ struct MIXERCAPSW {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
DWORD fdwSupport;
DWORD cDestinations;
}
@ -1325,15 +1325,15 @@ struct MIXERLINEA {
DWORD cChannels;
DWORD cConnections;
DWORD cControls;
CHAR szShortName[MIXER_SHORT_NAME_CHARS];
CHAR szName[MIXER_LONG_NAME_CHARS];
CHAR[MIXER_SHORT_NAME_CHARS] szShortName;
CHAR[MIXER_LONG_NAME_CHARS] szName;
struct Target {
DWORD dwType;
DWORD dwDeviceID;
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
}
}
alias MIXERLINEA* PMIXERLINEA, LPMIXERLINEA;
@ -1349,15 +1349,15 @@ struct MIXERLINEW {
DWORD cChannels;
DWORD cConnections;
DWORD cControls;
WCHAR szShortName[MIXER_SHORT_NAME_CHARS];
WCHAR szName[MIXER_LONG_NAME_CHARS];
WCHAR[MIXER_SHORT_NAME_CHARS] szShortName;
WCHAR[MIXER_LONG_NAME_CHARS] szName;
struct Target {
DWORD dwType;
DWORD dwDeviceID;
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
}
}
alias MIXERLINEW* PMIXERLINEW, LPMIXERLINEW;
@ -1368,8 +1368,8 @@ struct MIXERCONTROLA {
DWORD dwControlType;
DWORD fdwControl;
DWORD cMultipleItems;
CHAR szShortName[MIXER_SHORT_NAME_CHARS];
CHAR szName[MIXER_LONG_NAME_CHARS];
CHAR[MIXER_SHORT_NAME_CHARS] szShortName;
CHAR[MIXER_LONG_NAME_CHARS] szName;
union _Bounds {
struct {
LONG lMinimum;
@ -1379,13 +1379,13 @@ struct MIXERCONTROLA {
DWORD dwMinimum;
DWORD dwMaximum;
}
DWORD dwReserved[6];
DWORD[6] dwReserved;
}
_Bounds Bounds;
union _Metrics {
DWORD cSteps;
DWORD cbCustomData;
DWORD dwReserved[6];
DWORD[6] dwReserved;
}
_Metrics Metrics;
}
@ -1397,8 +1397,8 @@ struct MIXERCONTROLW {
DWORD dwControlType;
DWORD fdwControl;
DWORD cMultipleItems;
WCHAR szShortName[MIXER_SHORT_NAME_CHARS];
WCHAR szName[MIXER_LONG_NAME_CHARS];
WCHAR[MIXER_SHORT_NAME_CHARS] szShortName;
WCHAR[MIXER_LONG_NAME_CHARS] szName;
union _Bounds {
struct {
LONG lMinimum;
@ -1408,13 +1408,13 @@ struct MIXERCONTROLW {
DWORD dwMinimum;
DWORD dwMaximum;
}
DWORD dwReserved[6];
DWORD[6] dwReserved;
}
_Bounds Bounds;
union _Metrics {
DWORD cSteps;
DWORD cbCustomData;
DWORD dwReserved[6];
DWORD[6] dwReserved;
}
_Metrics Metrics;
}
@ -1463,14 +1463,14 @@ alias MIXERCONTROLDETAILS* PMIXERCONTROLDETAILS, LPMIXERCONTROLDETAILS;
struct MIXERCONTROLDETAILS_LISTTEXTA {
DWORD dwParam1;
DWORD dwParam2;
CHAR szName[MIXER_LONG_NAME_CHARS];
CHAR[MIXER_LONG_NAME_CHARS] szName;
}
alias MIXERCONTROLDETAILS_LISTTEXTA* PMIXERCONTROLDETAILS_LISTTEXTA, LPMIXERCONTROLDETAILS_LISTTEXTA;
struct MIXERCONTROLDETAILS_LISTTEXTW {
DWORD dwParam1;
DWORD dwParam2;
WCHAR szName[MIXER_LONG_NAME_CHARS];
WCHAR[MIXER_LONG_NAME_CHARS] szName;
}
alias MIXERCONTROLDETAILS_LISTTEXTW* PMIXERCONTROLDETAILS_LISTTEXTW, LPMIXERCONTROLDETAILS_LISTTEXTW;
@ -1500,7 +1500,7 @@ alias TIMECAPS* PTIMECAPS, LPTIMECAPS;
struct JOYCAPSA {
WORD wMid;
WORD wPid;
CHAR szPname[MAXPNAMELEN];
CHAR[MAXPNAMELEN] szPname;
UINT wXmin;
UINT wXmax;
UINT wYmin;
@ -1520,15 +1520,15 @@ struct JOYCAPSA {
UINT wMaxAxes;
UINT wNumAxes;
UINT wMaxButtons;
CHAR szRegKey[MAXPNAMELEN];
CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
CHAR[MAXPNAMELEN] szRegKey;
CHAR[MAX_JOYSTICKOEMVXDNAME] szOEMVxD;
}
alias JOYCAPSA* PJOYCAPSA, LPJOYCAPSA;
struct JOYCAPSW {
WORD wMid;
WORD wPid;
WCHAR szPname[MAXPNAMELEN];
WCHAR[MAXPNAMELEN] szPname;
UINT wXmin;
UINT wXmax;
UINT wYmin;
@ -1548,8 +1548,8 @@ struct JOYCAPSW {
UINT wMaxAxes;
UINT wNumAxes;
UINT wMaxButtons;
WCHAR szRegKey[MAXPNAMELEN];
WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
WCHAR[MAXPNAMELEN] szRegKey;
WCHAR[MAX_JOYSTICKOEMVXDNAME] szOEMVxD;
}
alias JOYCAPSW* PJOYCAPSW, LPJOYCAPSW;
@ -1598,7 +1598,7 @@ struct MMIOINFO {
HPSTR pchEndWrite;
LONG lBufOffset;
LONG lDiskOffset;
DWORD adwInfo[3];
DWORD[3] adwInfo;
DWORD dwReserved1;
DWORD dwReserved2;
HMMIO hmmio;

View File

@ -212,7 +212,7 @@ struct NCB {
extern (Windows) void function(NCB*) ncb_post;
UCHAR ncb_lana_num;
UCHAR ncb_cmd_cplt;
UCHAR ncb_reserve[10];
UCHAR[10] ncb_reserve;
HANDLE ncb_event;
}
alias NCB* PNCB;

View File

@ -112,7 +112,7 @@ struct SECPKG_SUPPLEMENTAL_CRED {
alias SECPKG_SUPPLEMENTAL_CRED* PSECPKG_SUPPLEMENTAL_CRED;
struct SECPKG_SUPPLEMENTAL_CRED_ARRAY {
ULONG CredentialCount;
SECPKG_SUPPLEMENTAL_CRED Credentials[1];
SECPKG_SUPPLEMENTAL_CRED[1] Credentials;
}
alias SECPKG_SUPPLEMENTAL_CRED_ARRAY* PSECPKG_SUPPLEMENTAL_CRED_ARRAY;
struct SECPKG_PARAMETERS {
@ -145,12 +145,12 @@ alias SECURITY_USER_DATA* PSECURITY_USER_DATA,PSecurityUserData;
alias SECURITY_USER_DATA SecurityUserData;
struct SECPKG_GSS_INFO {
ULONG EncodedIdLength;
UCHAR EncodedId[4];
UCHAR[4] EncodedId;
}
alias SECPKG_GSS_INFO* PSECPKG_GSS_INFO;
struct SECPKG_CONTEXT_THUNKS {
ULONG InfoLevelCount;
ULONG Levels[1];
ULONG[1] Levels;
}
alias SECPKG_CONTEXT_THUNKS* PSECPKG_CONTEXT_THUNKS;
struct SECPKG_MUTUAL_AUTH_LEVEL {

View File

@ -161,7 +161,7 @@ struct _wireSAFEARRAY {
ULONG cbElements;
ULONG cLocks;
SAFEARRAYUNION uArrayStructs;
SAFEARRAYBOUND rgsabound[1];
SAFEARRAYBOUND[1] rgsabound;
}
alias _wireSAFEARRAY* wireSAFEARRAY;
@ -173,7 +173,7 @@ struct SAFEARRAY {
ULONG cbElements;
ULONG cLocks;
PVOID pvData;
SAFEARRAYBOUND rgsabound[1];
SAFEARRAYBOUND[1] rgsabound;
}
alias SAFEARRAY* LPSAFEARRAY;
@ -316,7 +316,7 @@ struct TYPEDESC {
struct ARRAYDESC {
TYPEDESC tdescElem;
USHORT cDims;
SAFEARRAYBOUND rgbounds[1];
SAFEARRAYBOUND[1] rgbounds;
}
struct PARAMDESCEX {

View File

@ -91,7 +91,7 @@ struct DVTARGETDEVICE {
WORD tdDeviceNameOffset;
WORD tdPortNameOffset;
WORD tdExtDevmodeOffset;
BYTE tdData[1];
BYTE[1] tdData;
}
struct FORMATETC {
@ -109,7 +109,7 @@ struct RemSTGMEDIUM {
ULONG pData;
uint pUnkForRelease;
uint cbData;
BYTE data[1];
BYTE[1] data;
}
struct HLITEM {
@ -226,7 +226,7 @@ struct RPCOLEMESSAGE {
PVOID Buffer;
ULONG cbBuffer;
ULONG iMethod;
PVOID reserved2[5];
PVOID[5] reserved2;
ULONG rpcFlags;
}
alias RPCOLEMESSAGE* PRPCOLEMESSAGE;
@ -250,7 +250,7 @@ enum MKREDUCE {
struct RemSNB {
uint ulCntStr;
uint ulCntChar;
OLECHAR rgString[1];
OLECHAR[1] rgString;
}
enum ADVF {

View File

@ -543,7 +543,7 @@ struct OLEUICHANGEICONW {
HRSRC hResource;
HGLOBAL hMetaPict;
CLSID clsid;
WCHAR szIconExe[MAX_PATH];
WCHAR[MAX_PATH] szIconExe;
int cchIconExe;
}
alias OLEUICHANGEICONW* POLEUICHANGEICONW, LPOLEUICHANGEICONW;
@ -560,7 +560,7 @@ struct OLEUICHANGEICONA {
HRSRC hResource;
HGLOBAL hMetaPict;
CLSID clsid;
CHAR szIconExe[MAX_PATH];
CHAR[MAX_PATH] szIconExe;
int cchIconExe;
}
alias OLEUICHANGEICONA* POLEUICHANGEICONA, LPOLEUICHANGEICONA;
@ -658,7 +658,7 @@ struct OLEUICHANGESOURCEW {
LPCWSTR lpszTemplate;
HRSRC hResource;
OPENFILENAMEW* lpOFN;
DWORD dwReserved1[4];
DWORD[4] dwReserved1;
LPOLEUILINKCONTAINERW lpOleUILinkContainer;
DWORD dwLink;
LPWSTR lpszDisplayName;
@ -679,7 +679,7 @@ struct OLEUICHANGESOURCEA {
LPCSTR lpszTemplate;
HRSRC hResource;
OPENFILENAMEA *lpOFN;
DWORD dwReserved1[4];
DWORD[4] dwReserved1;
LPOLEUILINKCONTAINERA lpOleUILinkContainer;
DWORD dwLink;
LPSTR lpszDisplayName;
@ -752,10 +752,10 @@ alias IOleUILinkInfoA LPOLEUILINKINFOA;
struct OLEUIGNRLPROPSW {
DWORD cbStruct;
DWORD dwFlags;
DWORD dwReserved1[2];
DWORD[2] dwReserved1;
LPFNOLEUIHOOK lpfnHook;
LPARAM lCustData;
DWORD dwReserved2[3];
DWORD[3] dwReserved2;
OLEUIOBJECTPROPSW* lpOP;
}
alias OLEUIGNRLPROPSW* POLEUIGNRLPROPSW, LPOLEUIGNRLPROPSW;
@ -763,10 +763,10 @@ alias OLEUIGNRLPROPSW* POLEUIGNRLPROPSW, LPOLEUIGNRLPROPSW;
struct OLEUIGNRLPROPSA {
DWORD cbStruct;
DWORD dwFlags;
DWORD dwReserved1[2];
DWORD[2] dwReserved1;
LPFNOLEUIHOOK lpfnHook;
LPARAM lCustData;
DWORD dwReserved2[3];
DWORD[3] dwReserved2;
OLEUIOBJECTPROPSA* lpOP;
}
alias OLEUIGNRLPROPSA* POLEUIGNRLPROPSA, LPOLEUIGNRLPROPSA;
@ -774,10 +774,10 @@ alias OLEUIGNRLPROPSA* POLEUIGNRLPROPSA, LPOLEUIGNRLPROPSA;
struct OLEUIVIEWPROPSW {
DWORD cbStruct;
DWORD dwFlags;
DWORD dwReserved1[2];
DWORD[2] dwReserved1;
LPFNOLEUIHOOK lpfnHook;
LPARAM lCustData;
DWORD dwReserved2[3];
DWORD[3] dwReserved2;
OLEUIOBJECTPROPSW* lpOP;
int nScaleMin;
int nScaleMax;
@ -787,10 +787,10 @@ alias OLEUIVIEWPROPSW* POLEUIVIEWPROPSW, LPOLEUIVIEWPROPSW;
struct OLEUIVIEWPROPSA {
DWORD cbStruct;
DWORD dwFlags;
DWORD dwReserved1[2];
DWORD[2] dwReserved1;
LPFNOLEUIHOOK lpfnHook;
LPARAM lCustData;
DWORD dwReserved2[3];
DWORD[3] dwReserved2;
OLEUIOBJECTPROPSA *lpOP;
int nScaleMin;
int nScaleMax;
@ -800,10 +800,10 @@ alias OLEUIVIEWPROPSA* POLEUIVIEWPROPSA, LPOLEUIVIEWPROPSA;
struct OLEUILINKPROPSW {
DWORD cbStruct;
DWORD dwFlags;
DWORD dwReserved1[2];
DWORD[2] dwReserved1;
LPFNOLEUIHOOK lpfnHook;
LPARAM lCustData;
DWORD dwReserved2[3];
DWORD[3] dwReserved2;
OLEUIOBJECTPROPSW *lpOP;
}
alias OLEUILINKPROPSW* POLEUILINKPROPSW, LPOLEUILINKPROPSW;
@ -811,10 +811,10 @@ alias OLEUILINKPROPSW* POLEUILINKPROPSW, LPOLEUILINKPROPSW;
struct OLEUILINKPROPSA {
DWORD cbStruct;
DWORD dwFlags;
DWORD dwReserved1[2];
DWORD[2] dwReserved1;
LPFNOLEUIHOOK lpfnHook;
LPARAM lCustData;
DWORD dwReserved2[3];
DWORD[3] dwReserved2;
OLEUIOBJECTPROPSA* lpOP;
}
alias OLEUILINKPROPSA* POLEUILINKPROPSA, LPOLEUILINKPROPSA;

View File

@ -55,7 +55,7 @@ enum DROPEFFECT {
}
struct OLEMENUGROUPWIDTHS {
LONG width[6];
LONG[6] width;
}
alias OLEMENUGROUPWIDTHS* LPOLEMENUGROUPWIDTHS;

28
3rdparty/win32/ras.d vendored
View File

@ -233,7 +233,7 @@ struct RASCONNW {
WCHAR szDeviceType[RAS_MaxDeviceType + 1];
WCHAR szDeviceName[RAS_MaxDeviceName + 1];
static if (_WIN32_WINNT >= 0x401) {
WCHAR szPhonebook[MAX_PATH];
WCHAR[MAX_PATH] szPhonebook;
DWORD dwSubEntry;
}
static if (_WIN32_WINNT >= 0x500) {
@ -253,7 +253,7 @@ struct RASCONNA {
CHAR szDeviceType[RAS_MaxDeviceType + 1];
CHAR szDeviceName[RAS_MaxDeviceName + 1];
static if (_WIN32_WINNT >= 0x401) {
CHAR szPhonebook[MAX_PATH];
CHAR[MAX_PATH] szPhonebook;
DWORD dwSubEntry;
}
static if (_WIN32_WINNT >= 0x500) {
@ -451,7 +451,7 @@ struct RASPPPLCPW{
BOOL fMultilink;
DWORD dwTerminateReason;
DWORD dwServerTerminateReason;
WCHAR szReplyMessage[RAS_MaxReplyMessage];
WCHAR[RAS_MaxReplyMessage] szReplyMessage;
DWORD dwOptions;
DWORD dwServerOptions;
}
@ -472,7 +472,7 @@ struct RASPPPLCPA{
BOOL fMultilink;
DWORD dwTerminateReason;
DWORD dwServerTerminateReason;
CHAR szReplyMessage[RAS_MaxReplyMessage];
CHAR[RAS_MaxReplyMessage] szReplyMessage;
DWORD dwOptions;
DWORD dwServerOptions;
}
@ -542,9 +542,9 @@ struct RASENTRYW {
DWORD dwFrameSize;
DWORD dwfNetProtocols;
DWORD dwFramingProtocol;
WCHAR szScript[MAX_PATH];
WCHAR szAutodialDll[MAX_PATH];
WCHAR szAutodialFunc[MAX_PATH];
WCHAR[MAX_PATH] szScript;
WCHAR[MAX_PATH] szAutodialDll;
WCHAR[MAX_PATH] szAutodialFunc;
WCHAR szDeviceType[RAS_MaxDeviceType + 1];
WCHAR szDeviceName[RAS_MaxDeviceName + 1];
WCHAR szX25PadType[RAS_MaxPadType + 1];
@ -568,7 +568,7 @@ struct RASENTRYW {
DWORD dwEncryptionType;
DWORD dwCustomAuthKey;
GUID guidId;
WCHAR szCustomDialDll[MAX_PATH];
WCHAR[MAX_PATH] szCustomDialDll;
DWORD dwVpnStrategy;
}
}
@ -590,9 +590,9 @@ struct RASENTRYA {
DWORD dwFrameSize;
DWORD dwfNetProtocols;
DWORD dwFramingProtocol;
CHAR szScript[MAX_PATH];
CHAR szAutodialDll[MAX_PATH];
CHAR szAutodialFunc[MAX_PATH];
CHAR[MAX_PATH] szScript;
CHAR[MAX_PATH] szAutodialDll;
CHAR[MAX_PATH] szAutodialFunc;
CHAR szDeviceType[RAS_MaxDeviceType + 1];
CHAR szDeviceName[RAS_MaxDeviceName + 1];
CHAR szX25PadType[RAS_MaxPadType + 1];
@ -616,7 +616,7 @@ struct RASENTRYA {
DWORD dwEncryptionType;
DWORD dwCustomAuthKey;
GUID guidId;
CHAR szCustomDialDll[MAX_PATH];
CHAR[MAX_PATH] szCustomDialDll;
DWORD dwVpnStrategy;
}
}
@ -702,14 +702,14 @@ static if (_WIN32_WINNT >= 0x500) {
struct RASEAPUSERIDENTITYW{
WCHAR szUserName[UNLEN + 1];
DWORD dwSizeofEapInfo;
BYTE pbEapInfo[1];
BYTE[1] pbEapInfo;
}
alias RASEAPUSERIDENTITYW* LPRASEAPUSERIDENTITYW;
struct RASEAPUSERIDENTITYA{
CHAR szUserName[UNLEN + 1];
DWORD dwSizeofEapInfo;
BYTE pbEapInfo[1];
BYTE[1] pbEapInfo;
}
alias RASEAPUSERIDENTITYA* LPRASEAPUSERIDENTITYA;

View File

@ -317,7 +317,7 @@ struct CHARFORMATA {
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
char szFaceName[LF_FACESIZE];
char[LF_FACESIZE] szFaceName;
}
struct CHARFORMATW {
UINT cbSize = this.sizeof;
@ -328,7 +328,7 @@ struct CHARFORMATW {
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
WCHAR szFaceName[LF_FACESIZE];
WCHAR[LF_FACESIZE] szFaceName;
}
struct CHARFORMAT2A {
@ -340,7 +340,7 @@ struct CHARFORMAT2A {
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
char szFaceName[LF_FACESIZE];
char[LF_FACESIZE] szFaceName;
WORD wWeight;
SHORT sSpacing;
COLORREF crBackColor;
@ -362,7 +362,7 @@ struct CHARFORMAT2W {
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
WCHAR szFaceName[LF_FACESIZE];
WCHAR[LF_FACESIZE] szFaceName;
WORD wWeight;
SHORT sSpacing;
COLORREF crBackColor;
@ -486,7 +486,7 @@ struct PARAFORMAT {
LONG dxOffset;
WORD wAlignment;
SHORT cTabCount;
LONG rgxTabs[MAX_TAB_STOPS];
LONG[MAX_TAB_STOPS] rgxTabs;
}
struct PARAFORMAT2 {
@ -499,7 +499,7 @@ struct PARAFORMAT2 {
LONG dxOffset;
WORD wAlignment;
SHORT cTabCount;
LONG rgxTabs[MAX_TAB_STOPS];
LONG[MAX_TAB_STOPS] rgxTabs;
LONG dySpaceBefore;
LONG dySpaceAfter;
LONG dyLineSpacing;

View File

@ -118,7 +118,7 @@ alias RPC_BINDING_HANDLE handle_t;
struct RPC_BINDING_VECTOR {
uint Count;
RPC_BINDING_HANDLE BindingH[1];
RPC_BINDING_HANDLE[1] BindingH;
}
alias RPC_BINDING_HANDLE rpc_binding_handle_t;
@ -127,7 +127,7 @@ alias RPC_BINDING_VECTOR rpc_binding_vector_t;
struct UUID_VECTOR {
uint Count;
UUID* Uuid[1];
UUID*[1] Uuid;
}
alias void* RPC_IF_HANDLE;

View File

@ -100,8 +100,8 @@ const cbNDRContext=20;
alias void * NDR_CCONTEXT;
struct tagNDR_SCONTEXT {
void *pad[2];
void *userContext;
void*[2] pad;
void* userContext;
}
alias tagNDR_SCONTEXT * NDR_SCONTEXT;
@ -211,7 +211,7 @@ struct MIDL_STUB_MESSAGE {
uint * SizePtrLengthArray;
void* pArgQueue;
uint dwStubPhase;
uint w2kReserved[5];
uint[5] w2kReserved;
}
alias MIDL_STUB_MESSAGE * PMIDL_STUB_MESSAGE;
@ -317,7 +317,7 @@ alias void * PMIDL_XMIT_TYPE;
struct MIDL_FORMAT_STRING {
short Pad;
ubyte Format[1];
ubyte[1] Format;
}
struct MIDL_SERVER_INFO {

View File

@ -881,10 +881,10 @@ struct INFCONTEXT {
alias INFCONTEXT* PINFCONTEXT;
struct SP_INF_INFORMATION {
DWORD InfStyle;
DWORD InfCount;
BYTE _VersionData[1];
BYTE* VersionData() { return _VersionData.ptr; }
DWORD InfStyle;
DWORD InfCount;
BYTE[1] _VersionData;
BYTE* VersionData() { return _VersionData.ptr; }
}
alias SP_INF_INFORMATION* PSP_INF_INFORMATION;
@ -899,16 +899,16 @@ struct SP_ALTPLATFORM_INFO {
alias SP_ALTPLATFORM_INFO* PSP_ALTPLATFORM_INFO;
struct SP_ORIGINAL_FILE_INFO_A {
DWORD cbSize = SP_ORIGINAL_FILE_INFO_A.sizeof;
CHAR OriginalInfName[MAX_PATH];
CHAR OriginalCatalogName[MAX_PATH];
DWORD cbSize = SP_ORIGINAL_FILE_INFO_A.sizeof;
CHAR[MAX_PATH] OriginalInfName;
CHAR[MAX_PATH] OriginalCatalogName;
}
alias SP_ORIGINAL_FILE_INFO_A* PSP_ORIGINAL_FILE_INFO_A;
struct SP_ORIGINAL_FILE_INFO_W {
DWORD cbSize = SP_ORIGINAL_FILE_INFO_W.sizeof;
WCHAR OriginalInfName[MAX_PATH];
WCHAR OriginalCatalogName[MAX_PATH];
DWORD cbSize = SP_ORIGINAL_FILE_INFO_W.sizeof;
WCHAR[MAX_PATH] OriginalInfName;
WCHAR[MAX_PATH] OriginalCatalogName;
}
alias SP_ORIGINAL_FILE_INFO_W* PSP_ORIGINAL_FILE_INFO_W;
@ -967,24 +967,24 @@ struct CABINET_INFO_W {
alias CABINET_INFO_W* PCABINET_INFO_W;
struct FILE_IN_CABINET_INFO_A {
PCSTR NameInCabinet;
DWORD FileSize;
DWORD Win32Error;
WORD DosDate;
WORD DosTime;
WORD DosAttribs;
CHAR FullTargetName[MAX_PATH];
PCSTR NameInCabinet;
DWORD FileSize;
DWORD Win32Error;
WORD DosDate;
WORD DosTime;
WORD DosAttribs;
CHAR[MAX_PATH] FullTargetName;
}
alias FILE_IN_CABINET_INFO_A* PFILE_IN_CABINET_INFO_A;
struct FILE_IN_CABINET_INFO_W {
PCWSTR NameInCabinet;
DWORD FileSize;
DWORD Win32Error;
WORD DosDate;
WORD DosTime;
WORD DosAttribs;
WCHAR FullTargetName[MAX_PATH];
PCWSTR NameInCabinet;
DWORD FileSize;
DWORD Win32Error;
WORD DosDate;
WORD DosTime;
WORD DosAttribs;
WCHAR[MAX_PATH] FullTargetName;
}
alias FILE_IN_CABINET_INFO_W* PFILE_IN_CABINET_INFO_W;
@ -1039,16 +1039,16 @@ deprecated alias SP_DEVICE_INTERFACE_DATA SP_INTERFACE_DEVICE_DATA;
deprecated alias SP_DEVICE_INTERFACE_DATA* PSP_INTERFACE_DEVICE_DATA;
struct SP_DEVICE_INTERFACE_DETAIL_DATA_A {
DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_A.sizeof;
CHAR _DevicePath[1];
CHAR* DevicePath() { return _DevicePath.ptr; }
DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_A.sizeof;
CHAR[1] _DevicePath;
CHAR* DevicePath() { return _DevicePath.ptr; }
}
alias SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_DEVICE_INTERFACE_DETAIL_DATA_A;
struct SP_DEVICE_INTERFACE_DETAIL_DATA_W {
DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_W.sizeof;
WCHAR _DevicePath[1];
WCHAR* DevicePath() { return _DevicePath.ptr; }
DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_W.sizeof;
WCHAR[1] _DevicePath;
WCHAR* DevicePath() { return _DevicePath.ptr; }
}
alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_DEVICE_INTERFACE_DETAIL_DATA_W;
@ -1058,18 +1058,18 @@ deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DA
deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_INTERFACE_DEVICE_DETAIL_DATA_W;
struct SP_DEVINFO_LIST_DETAIL_DATA_A {
DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_A.sizeof;
GUID ClassGuid;
HANDLE RemoteMachineHandle;
CHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH];
DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_A.sizeof;
GUID ClassGuid;
HANDLE RemoteMachineHandle;
CHAR[SP_MAX_MACHINENAME_LENGTH] RemoteMachineName;
}
alias SP_DEVINFO_LIST_DETAIL_DATA_A* PSP_DEVINFO_LIST_DETAIL_DATA_A;
struct SP_DEVINFO_LIST_DETAIL_DATA_W {
DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_W.sizeof;
GUID ClassGuid;
HANDLE RemoteMachineHandle;
WCHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH];
DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_W.sizeof;
GUID ClassGuid;
HANDLE RemoteMachineHandle;
WCHAR[SP_MAX_MACHINENAME_LENGTH] RemoteMachineName;
}
alias SP_DEVINFO_LIST_DETAIL_DATA_W* PSP_DEVINFO_LIST_DETAIL_DATA_W;
@ -1086,7 +1086,7 @@ struct SP_DEVINSTALL_PARAMS_A {
HSPFILEQ FileQueue;
ULONG_PTR ClassInstallReserved;
DWORD Reserved;
CHAR DriverPath[MAX_PATH];
CHAR[MAX_PATH] DriverPath;
}
alias SP_DEVINSTALL_PARAMS_A* PSP_DEVINSTALL_PARAMS_A;
@ -1100,7 +1100,7 @@ struct SP_DEVINSTALL_PARAMS_W {
HSPFILEQ FileQueue;
ULONG_PTR ClassInstallReserved;
DWORD Reserved;
WCHAR DriverPath[MAX_PATH];
WCHAR[MAX_PATH] DriverPath;
}
alias SP_DEVINSTALL_PARAMS_W* PSP_DEVINSTALL_PARAMS_W;
@ -1146,21 +1146,21 @@ struct SP_UNREMOVEDEVICE_PARAMS {
alias SP_UNREMOVEDEVICE_PARAMS* PSP_UNREMOVEDEVICE_PARAMS;
struct SP_SELECTDEVICE_PARAMS_A {
SP_CLASSINSTALL_HEADER ClassInstallHeader;
CHAR Title[MAX_TITLE_LEN];
CHAR Instructions[MAX_INSTRUCTION_LEN];
CHAR ListLabel[MAX_LABEL_LEN];
CHAR SubTitle[MAX_SUBTITLE_LEN];
BYTE Reserved[2];
SP_CLASSINSTALL_HEADER ClassInstallHeader;
CHAR[MAX_TITLE_LEN] Title;
CHAR[MAX_INSTRUCTION_LEN] Instructions;
CHAR[MAX_LABEL_LEN] ListLabel;
CHAR[MAX_SUBTITLE_LEN] SubTitle;
BYTE[2] Reserved;
}
alias SP_SELECTDEVICE_PARAMS_A* PSP_SELECTDEVICE_PARAMS_A;
struct SP_SELECTDEVICE_PARAMS_W {
SP_CLASSINSTALL_HEADER ClassInstallHeader;
WCHAR Title[MAX_TITLE_LEN];
WCHAR Instructions[MAX_INSTRUCTION_LEN];
WCHAR ListLabel[MAX_LABEL_LEN];
WCHAR SubTitle[MAX_SUBTITLE_LEN];
SP_CLASSINSTALL_HEADER ClassInstallHeader;
WCHAR[MAX_TITLE_LEN] Title;
WCHAR[MAX_INSTRUCTION_LEN] Instructions;
WCHAR[MAX_LABEL_LEN] ListLabel;
WCHAR[MAX_SUBTITLE_LEN] SubTitle;
}
alias SP_SELECTDEVICE_PARAMS_W* PSP_SELECTDEVICE_PARAMS_W;
@ -1174,23 +1174,23 @@ struct SP_DETECTDEVICE_PARAMS {
alias SP_DETECTDEVICE_PARAMS* PSP_DETECTDEVICE_PARAMS;
struct SP_INSTALLWIZARD_DATA {
SP_CLASSINSTALL_HEADER ClassInstallHeader;
DWORD Flags;
HPROPSHEETPAGE DynamicPages[MAX_INSTALLWIZARD_DYNAPAGES];
DWORD NumDynamicPages;
DWORD DynamicPageFlags;
DWORD PrivateFlags;
LPARAM PrivateData;
HWND hwndWizardDlg;
SP_CLASSINSTALL_HEADER ClassInstallHeader;
DWORD Flags;
HPROPSHEETPAGE[MAX_INSTALLWIZARD_DYNAPAGES] DynamicPages;
DWORD NumDynamicPages;
DWORD DynamicPageFlags;
DWORD PrivateFlags;
LPARAM PrivateData;
HWND hwndWizardDlg;
}
alias SP_INSTALLWIZARD_DATA* PSP_INSTALLWIZARD_DATA;
struct SP_NEWDEVICEWIZARD_DATA {
SP_CLASSINSTALL_HEADER ClassInstallHeader;
DWORD Flags;
HPROPSHEETPAGE DynamicPages[MAX_INSTALLWIZARD_DYNAPAGES];
DWORD NumDynamicPages;
HWND hwndWizardDlg;
SP_CLASSINSTALL_HEADER ClassInstallHeader;
DWORD Flags;
HPROPSHEETPAGE[MAX_INSTALLWIZARD_DYNAPAGES] DynamicPages;
DWORD NumDynamicPages;
HWND hwndWizardDlg;
}
alias SP_NEWDEVICEWIZARD_DATA* PSP_NEWDEVICEWIZARD_DATA;
alias SP_NEWDEVICEWIZARD_DATA SP_ADDPROPERTYPAGE_DATA;
@ -1198,15 +1198,15 @@ alias SP_NEWDEVICEWIZARD_DATA* PSP_ADDPROPERTYPAGE_DATA;
struct SP_TROUBLESHOOTER_PARAMS_A {
SP_CLASSINSTALL_HEADER ClassInstallHeader;
CHAR ChmFile[MAX_PATH];
CHAR HtmlTroubleShooter[MAX_PATH];
CHAR[MAX_PATH] ChmFile;
CHAR[MAX_PATH] HtmlTroubleShooter;
}
alias SP_TROUBLESHOOTER_PARAMS_A* PSP_TROUBLESHOOTER_PARAMS_A;
struct SP_TROUBLESHOOTER_PARAMS_W {
SP_CLASSINSTALL_HEADER ClassInstallHeader;
WCHAR ChmFile[MAX_PATH];
WCHAR HtmlTroubleShooter[MAX_PATH];
WCHAR[MAX_PATH] ChmFile;
WCHAR[MAX_PATH] HtmlTroubleShooter;
}
alias SP_TROUBLESHOOTER_PARAMS_W* PSP_TROUBLESHOOTER_PARAMS_W;
@ -1223,46 +1223,46 @@ struct SP_POWERMESSAGEWAKE_PARAMS_W {
alias SP_POWERMESSAGEWAKE_PARAMS_W* PSP_POWERMESSAGEWAKE_PARAMS_W;
struct SP_DRVINFO_DATA_V2_A {
DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
CHAR Description[LINE_LEN];
CHAR MfgName[LINE_LEN];
CHAR ProviderName[LINE_LEN];
FILETIME DriverDate;
DWORDLONG DriverVersion;
DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
CHAR[LINE_LEN] Description;
CHAR[LINE_LEN] MfgName;
CHAR[LINE_LEN] ProviderName;
FILETIME DriverDate;
DWORDLONG DriverVersion;
}
alias SP_DRVINFO_DATA_V2_A* PSP_DRVINFO_DATA_V2_A;
struct SP_DRVINFO_DATA_V2_W {
DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
WCHAR Description[LINE_LEN];
WCHAR MfgName[LINE_LEN];
WCHAR ProviderName[LINE_LEN];
FILETIME DriverDate;
DWORDLONG DriverVersion;
DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
WCHAR[LINE_LEN] Description;
WCHAR[LINE_LEN] MfgName;
WCHAR[LINE_LEN] ProviderName;
FILETIME DriverDate;
DWORDLONG DriverVersion;
}
alias SP_DRVINFO_DATA_V2_W* PSP_DRVINFO_DATA_V2_W;
struct SP_DRVINFO_DATA_V1_A {
DWORD cbSize = SP_DRVINFO_DATA_V1_A.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
CHAR Description[LINE_LEN];
CHAR MfgName[LINE_LEN];
CHAR ProviderName[LINE_LEN];
DWORD cbSize = SP_DRVINFO_DATA_V1_A.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
CHAR[LINE_LEN] Description;
CHAR[LINE_LEN] MfgName;
CHAR[LINE_LEN] ProviderName;
}
alias SP_DRVINFO_DATA_V1_A* PSP_DRVINFO_DATA_V1_A;
struct SP_DRVINFO_DATA_V1_W {
DWORD cbSize = SP_DRVINFO_DATA_V1_W.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
WCHAR Description[LINE_LEN];
WCHAR MfgName[LINE_LEN];
WCHAR ProviderName[LINE_LEN];
DWORD cbSize = SP_DRVINFO_DATA_V1_W.sizeof;
DWORD DriverType;
ULONG_PTR Reserved;
WCHAR[LINE_LEN] Description;
WCHAR[LINE_LEN] MfgName;
WCHAR[LINE_LEN] ProviderName;
}
alias SP_DRVINFO_DATA_V1_W* PSP_DRVINFO_DATA_V1_W;
@ -1295,29 +1295,29 @@ static if(USE_SP_DRVINFO_DATA_V1) {
extern(Windows) alias DWORD function(HDEVINFO, PSP_DEVINFO_DATA, PSP_DEVINFO_DATA, PVOID) PSP_DETSIG_CMPPROC;
struct SP_DRVINFO_DETAIL_DATA_A {
DWORD cbSize = SP_DRVINFO_DETAIL_DATA_A.sizeof;
FILETIME InfDate;
DWORD CompatIDsOffset;
DWORD CompatIDsLength;
ULONG_PTR Reserved;
CHAR SectionName[LINE_LEN];
CHAR InfFileName[MAX_PATH];
CHAR DrvDescription[LINE_LEN];
CHAR _HardwareID[1];
DWORD cbSize = SP_DRVINFO_DETAIL_DATA_A.sizeof;
FILETIME InfDate;
DWORD CompatIDsOffset;
DWORD CompatIDsLength;
ULONG_PTR Reserved;
CHAR[LINE_LEN] SectionName;
CHAR[MAX_PATH] InfFileName;
CHAR[LINE_LEN] DrvDescription;
CHAR[1] _HardwareID;
CHAR* HardwareID() { return _HardwareID.ptr; }
}
alias SP_DRVINFO_DETAIL_DATA_A* PSP_DRVINFO_DETAIL_DATA_A;
struct SP_DRVINFO_DETAIL_DATA_W {
DWORD cbSize = SP_DRVINFO_DETAIL_DATA_W.sizeof;
FILETIME InfDate;
DWORD CompatIDsOffset;
DWORD CompatIDsLength;
ULONG_PTR Reserved;
WCHAR SectionName[LINE_LEN];
WCHAR InfFileName[MAX_PATH];
WCHAR DrvDescription[LINE_LEN];
WCHAR _HardwareID[1];
DWORD cbSize = SP_DRVINFO_DETAIL_DATA_W.sizeof;
FILETIME InfDate;
DWORD CompatIDsOffset;
DWORD CompatIDsLength;
ULONG_PTR Reserved;
WCHAR[LINE_LEN] SectionName;
WCHAR[MAX_PATH] InfFileName;
WCHAR[LINE_LEN] DrvDescription;
WCHAR[1] _HardwareID;
WCHAR* HardwareID() { return _HardwareID.ptr; }
}
alias SP_DRVINFO_DETAIL_DATA_W* PSP_DRVINFO_DETAIL_DATA_W;
@ -1354,16 +1354,16 @@ struct SP_PROPSHEETPAGE_REQUEST {
alias SP_PROPSHEETPAGE_REQUEST* PSP_PROPSHEETPAGE_REQUEST;
struct SP_BACKUP_QUEUE_PARAMS_A {
DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_A.sizeof;
CHAR FullInfPath[MAX_PATH];
INT FilenameOffset;
DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_A.sizeof;
CHAR[MAX_PATH] FullInfPath;
INT FilenameOffset;
}
alias SP_BACKUP_QUEUE_PARAMS_A* PSP_BACKUP_QUEUE_PARAMS_A;
struct SP_BACKUP_QUEUE_PARAMS_W {
DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_W.sizeof;
WCHAR FullInfPath[MAX_PATH];
INT FilenameOffset;
DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_W.sizeof;
WCHAR[MAX_PATH] FullInfPath;
INT FilenameOffset;
}
alias SP_BACKUP_QUEUE_PARAMS_W* PSP_BACKUP_QUEUE_PARAMS_W;

View File

@ -477,7 +477,7 @@ struct STRRET {
union {
LPWSTR pOleStr;
UINT uOffset;
char cStr[MAX_PATH];
char[MAX_PATH] cStr;
}
}
alias STRRET* LPSTRRET;
@ -504,7 +504,7 @@ struct FILEDESCRIPTORA {
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
CHAR cFileName[MAX_PATH];
CHAR[MAX_PATH] cFileName;
}
alias FILEDESCRIPTORA* LPFILEDESCRIPTORA;
@ -519,19 +519,19 @@ struct FILEDESCRIPTORW {
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
WCHAR cFileName[MAX_PATH];
WCHAR[MAX_PATH] cFileName;
}
alias FILEDESCRIPTORW* LPFILEDESCRIPTORW;
struct FILEGROUPDESCRIPTORA {
UINT cItems;
FILEDESCRIPTORA fgd[1];
FILEDESCRIPTORA[1] fgd;
}
alias FILEGROUPDESCRIPTORA* LPFILEGROUPDESCRIPTORA;
struct FILEGROUPDESCRIPTORW {
UINT cItems;
FILEDESCRIPTORW fgd[1];
FILEDESCRIPTORW[1] fgd;
}
alias FILEGROUPDESCRIPTORW* LPFILEGROUPDESCRIPTORW;
@ -591,13 +591,13 @@ struct FVSHOWINFO {
DWORD dwFlags;
RECT rect;
LPUNKNOWN punkRel;
OLECHAR strNewFile[MAX_PATH];
OLECHAR[MAX_PATH] strNewFile;
}
alias FVSHOWINFO* LPFVSHOWINFO;
struct NRESARRAY {
UINT cItems;
NETRESOURCE nr[1];
NETRESOURCE[1] nr;
}
alias NRESARRAY* LPNRESARRAY;
@ -629,8 +629,8 @@ static if (_WIN32_IE >= 0x500) {
struct EXTRASEARCH
{
GUID guidSearch;
WCHAR wszFriendlyName[80];
WCHAR wszUrl[2084];
WCHAR[80] wszFriendlyName;
WCHAR[2084] wszUrl;
}
alias EXTRASEARCH* LPEXTRASEARCH;
@ -653,8 +653,8 @@ static if (_WIN32_IE >= 0x500) {
struct PERSIST_FOLDER_TARGET_INFO
{
LPITEMIDLIST pidlTargetFolder;
WCHAR szTargetParsingName[MAX_PATH];
WCHAR szNetworkProvider[MAX_PATH];
WCHAR[MAX_PATH] szTargetParsingName;
WCHAR[MAX_PATH] szNetworkProvider;
DWORD dwAttributes;
int csidl;
}
@ -696,7 +696,7 @@ static if (_WIN32_IE >= 0x500) {
struct SHCOLUMNINIT {
ULONG dwFlags;
ULONG dwReserved;
WCHAR wszFolder[MAX_PATH];
WCHAR[MAX_PATH] wszFolder;
}
alias SHCOLUMNINIT* LPSHCOLUMNINIT;
alias const(SHCOLUMNINIT)* LPCSHCOLUMNINIT;
@ -706,7 +706,7 @@ static if (_WIN32_IE >= 0x500) {
DWORD dwFileAttributes;
ULONG dwReserved;
WCHAR *pwszExt;
WCHAR wszFile[MAX_PATH];
WCHAR[MAX_PATH] wszFile;
}
alias SHCOLUMNDATA* LPSHCOLUMNDATA;
alias const(SHCOLUMNDATA)* LPCSHCOLUMNDATA;
@ -721,8 +721,8 @@ static if (_WIN32_IE >= 0x500) {
DWORD fmt;
UINT cChars;
DWORD csFlags;
WCHAR wszTitle[MAX_COLUMN_NAME_LEN];
WCHAR wszDescription[MAX_COLUMN_DESC_LEN];
WCHAR[MAX_COLUMN_NAME_LEN] wszTitle;
WCHAR[MAX_COLUMN_DESC_LEN] wszDescription;
}
alias SHCOLUMNINFO* LPSHCOLUMNINFO;
alias const(SHCOLUMNINFO)* LPCSHCOLUMNINFO;

View File

@ -137,7 +137,7 @@ struct SQL_NUMERIC_STRUCT {
SQLCHAR precision;
SQLSCHAR scale;
SQLCHAR sign;
SQLCHAR val[SQL_MAX_NUMERIC_LEN];
SQLCHAR[SQL_MAX_NUMERIC_LEN] val;
}
// } ODBCVER >= 0x0300
alias GUID SQLGUID;

View File

@ -132,22 +132,22 @@ const USER_SESSION_KEY_LENGTH = CYPHER_BLOCK_LENGTH * 2;
const CLEAR_BLOCK_LENGTH = 8;
struct CYPHER_BLOCK {
CHAR data[CYPHER_BLOCK_LENGTH];
CHAR[CYPHER_BLOCK_LENGTH] data;
}
alias CYPHER_BLOCK* PCYPHER_BLOCK;
struct CLEAR_BLOCK {
CHAR data[CLEAR_BLOCK_LENGTH];
CHAR[CLEAR_BLOCK_LENGTH] data;
}
alias CLEAR_BLOCK* PCLEAR_BLOCK;
struct LM_OWF_PASSWORD {
CYPHER_BLOCK data[2];
CYPHER_BLOCK[2] data;
}
alias LM_OWF_PASSWORD* PLM_OWF_PASSWORD;
struct USER_SESSION_KEY {
CYPHER_BLOCK data[2];
CYPHER_BLOCK[2] data;
}
alias USER_SESSION_KEY* PUSER_SESSION_KEY;

View File

@ -67,7 +67,7 @@ struct PROCESSENTRY32W {
DWORD th32ParentProcessID;
LONG pcPriClassBase;
DWORD dwFlags;
WCHAR szExeFile[MAX_PATH];
WCHAR[MAX_PATH] szExeFile;
}
alias PROCESSENTRY32W* PPROCESSENTRY32W;
alias PROCESSENTRY32W* LPPROCESSENTRY32W;
@ -94,7 +94,7 @@ struct MODULEENTRY32W {
DWORD modBaseSize;
HMODULE hModule;
WCHAR szModule[MAX_MODULE_NAME32 + 1];
WCHAR szExePath[MAX_PATH];
WCHAR[MAX_PATH] szExePath;
}
alias MODULEENTRY32W* PMODULEENTRY32W;
alias MODULEENTRY32W* LPMODULEENTRY32W;
@ -118,7 +118,7 @@ version(Unicode) {
DWORD th32ParentProcessID;
LONG pcPriClassBase;
DWORD dwFlags;
CHAR szExeFile[MAX_PATH];
CHAR[MAX_PATH] szExeFile;
}
alias PROCESSENTRY32* PPROCESSENTRY32;
alias PROCESSENTRY32* LPPROCESSENTRY32;
@ -133,7 +133,7 @@ version(Unicode) {
DWORD modBaseSize;
HMODULE hModule;
char szModule[MAX_MODULE_NAME32 + 1];
char szExePath[MAX_PATH];
char[MAX_PATH] szExePath;
}
alias MODULEENTRY32* PMODULEENTRY32;
alias MODULEENTRY32* LPMODULEENTRY32;

30
3rdparty/win32/vfw.d vendored
View File

@ -181,15 +181,15 @@ struct ICOPEN {
}
struct ICINFO {
DWORD dwSize;
DWORD fccType;
DWORD fccHandler;
DWORD dwFlags;
DWORD dwVersion;
DWORD dwVersionICM;
WCHAR szName[16];
WCHAR szDescription[128];
WCHAR szDriver[128];
DWORD dwSize;
DWORD fccType;
DWORD fccHandler;
DWORD dwFlags;
DWORD dwVersion;
DWORD dwVersionICM;
WCHAR[16] szName;
WCHAR[128] szDescription;
WCHAR[128] szDriver;
}
enum {
@ -819,7 +819,7 @@ struct MainAVIHeader {
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwReserved[4];
DWORD[4] dwReserved;
}
const AVISF_DISABLED = 0x00000001;
@ -885,7 +885,7 @@ struct AVISTREAMINFOW {
RECT rcFrame;
DWORD dwEditCount;
DWORD dwFormatChangeCount;
WCHAR szName[64];
WCHAR[64] szName;
}
alias AVISTREAMINFOW* LPAVISTREAMINFOW;
@ -907,7 +907,7 @@ struct AVISTREAMINFOA {
RECT rcFrame;
DWORD dwEditCount;
DWORD dwFormatChangeCount;
char szName[64];
char[64] szName;
}
alias AVISTREAMINFOA* LPAVISTREAMINFOA;
@ -934,7 +934,7 @@ struct AVIFILEINFOW {
DWORD dwRate;
DWORD dwLength;
DWORD dwEditCount;
WCHAR szFileType[64];
WCHAR[64] szFileType;
}
alias AVIFILEINFOW* LPAVIFILEINFOW;
@ -950,7 +950,7 @@ struct AVIFILEINFOA {
DWORD dwRate;
DWORD dwLength;
DWORD dwEditCount;
char szFileType[64];
char[64] szFileType;
}
alias AVIFILEINFOA* LPAVIFILEINFOA;
@ -1887,7 +1887,7 @@ struct VIDEOHDR {
DWORD dwTimeCaptured;
DWORD_PTR dwUser;
DWORD dwFlags;
DWORD_PTR dwReserved[4];
DWORD_PTR[4] dwReserved;
}
alias VIDEOHDR* PVIDEOHDR, LPVIDEOHDR;

View File

@ -1960,7 +1960,7 @@ struct GUID {
uint Data1;
ushort Data2;
ushort Data3;
ubyte Data4[8];
ubyte[8] Data4;
}
alias GUID* REFGUID, LPGUID;
*/
@ -2164,9 +2164,9 @@ version (X86) {
WORD Reserved3;
DWORD MxCsr;
DWORD MxCsr_Mask;
M128A FloatRegisters[8];
M128A XmmRegisters[16];
BYTE Reserved4[96];
M128A[8] FloatRegisters;
M128A[16] XmmRegisters;
BYTE[96] Reserved4;
}
alias XMM_SAVE_AREA32 PXMM_SAVE_AREA32;
const LEGACY_SAVE_AREA_LENGTH = XMM_SAVE_AREA32.sizeof;
@ -2217,8 +2217,8 @@ version (X86) {
XMM_SAVE_AREA32 FloatSave;
struct
{
M128A Header[2];
M128A Legacy[8];
M128A[2] Header;
M128A[8] Legacy;
M128A Xmm0;
M128A Xmm1;
M128A Xmm2;
@ -2237,7 +2237,7 @@ version (X86) {
M128A Xmm15;
};
};
M128A VectorRegister[26];
M128A[26] VectorRegister;
DWORD64 VectorControl;
DWORD64 DebugControl;
DWORD64 LastBranchToRip;

View File

@ -83,7 +83,7 @@ const PERF_RAW_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DI
const PERF_ELAPSED_TIME=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_ELAPSED|PERF_OBJECT_TIMER|PERF_DISPLAY_SECONDS);
struct PERF_DATA_BLOCK {
WCHAR Signature[4];
WCHAR[4] Signature;
DWORD LittleEndian;
DWORD Version;
DWORD Revision;

View File

@ -636,7 +636,7 @@ struct PRINTER_NOTIFY_INFO_DATA {
DWORD Reserved;
DWORD Id;
union _NotifyData {
DWORD adwData[2];
DWORD[2] adwData;
struct Data {
DWORD cbBuf;
PVOID pBuf;
@ -650,7 +650,7 @@ struct PRINTER_NOTIFY_INFO {
DWORD Version;
DWORD Flags;
DWORD Count;
PRINTER_NOTIFY_INFO_DATA aData[1];
PRINTER_NOTIFY_INFO_DATA[1] aData;
}
alias PRINTER_NOTIFY_INFO* PPRINTER_NOTIFY_INFO, LPPRINTER_NOTIFY_INFO;

View File

@ -3051,7 +3051,7 @@ struct MENUITEMTEMPLATEHEADER {
struct MENUITEMTEMPLATE {
WORD mtOption;
WORD mtID;
WCHAR mtString[1];
WCHAR[1] mtString;
}
alias void MENUTEMPLATE, MENUTEMPLATEA, MENUTEMPLATEW;
@ -3309,7 +3309,7 @@ struct WINDOWPOS {
alias WINDOWPOS* PWINDOWPOS, LPWINDOWPOS;
struct NCCALCSIZE_PARAMS {
RECT rgrc[3];
RECT[3] rgrc;
PWINDOWPOS lppos;
}
alias NCCALCSIZE_PARAMS* LPNCCALCSIZE_PARAMS;
@ -3381,14 +3381,14 @@ alias DWORD HELPPOLY;
struct MULTIKEYHELPA {
DWORD mkSize;
CHAR mkKeylist;
CHAR szKeyphrase[1];
CHAR[1] szKeyphrase;
}
alias MULTIKEYHELPA* PMULTIKEYHELPA, LPMULTIKEYHELPA;
struct MULTIKEYHELPW {
DWORD mkSize;
WCHAR mkKeylist;
WCHAR szKeyphrase[1];
WCHAR[1] szKeyphrase;
}
alias MULTIKEYHELPW* PMULTIKEYHELPW, LPMULTIKEYHELPW;
@ -3399,7 +3399,7 @@ struct HELPWININFOA {
int dx;
int dy;
int wMax;
CHAR rgchMember[2];
CHAR[2] rgchMember;
}
alias HELPWININFOA* PHELPWININFOA, LPHELPWININFOA;
@ -3410,7 +3410,7 @@ struct HELPWININFOW {
int dx;
int dy;
int wMax;
WCHAR rgchMember[2];
WCHAR[2] rgchMember;
}
alias HELPWININFOW* PHELPWININFOW, LPHELPWININFOW;
@ -3489,7 +3489,7 @@ struct SCROLLBARINFO {
int xyThumbTop;
int xyThumbBottom;
int reserved;
DWORD rgstate[CCHILDREN_SCROLLBAR+1];
DWORD[CCHILDREN_SCROLLBAR+1] rgstate;
}
alias SCROLLBARINFO* PSCROLLBARINFO, LPSCROLLBARINFO;

View File

@ -326,38 +326,38 @@ static if (_WIN32_WINNT >= 0x600) {
}
struct WTSINFOW {
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
DWORD IncomingBytes;
DWORD OutgoingBytes;
DWORD IncomingCompressedBytes;
DWORD OutgoingCompressedBytes;
WCHAR WinStationName[WINSTATIONNAME_LENGTH];
WCHAR Domain[DOMAIN_LENGTH];
WCHAR UserName[USERNAME_LENGTH+1];
LARGE_INTEGER ConnectTime;
LARGE_INTEGER DisconnectTime;
LARGE_INTEGER LastInputTime;
LARGE_INTEGER LogonTime;
LARGE_INTEGER CurrentTime;
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
DWORD IncomingBytes;
DWORD OutgoingBytes;
DWORD IncomingCompressedBytes;
DWORD OutgoingCompressedBytes;
WCHAR[WINSTATIONNAME_LENGTH] WinStationName;
WCHAR[DOMAIN_LENGTH] Domain;
WCHAR UserName[USERNAME_LENGTH+1];
LARGE_INTEGER ConnectTime;
LARGE_INTEGER DisconnectTime;
LARGE_INTEGER LastInputTime;
LARGE_INTEGER LogonTime;
LARGE_INTEGER CurrentTime;
}
alias WTSINFOW* PWTSINFOW;
struct WTSINFOA {
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
DWORD IncomingBytes;
DWORD OutgoingBytes;
DWORD IncomingCompressedBytes;
DWORD OutgoingCompressedBytes;
CHAR WinStationName[WINSTATIONNAME_LENGTH];
CHAR Domain[DOMAIN_LENGTH];
CHAR UserName[USERNAME_LENGTH+1];
LARGE_INTEGER ConnectTime;
LARGE_INTEGER DisconnectTime;
LARGE_INTEGER LastInputTime;
LARGE_INTEGER LogonTime;
LARGE_INTEGER CurrentTime;
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
DWORD IncomingBytes;
DWORD OutgoingBytes;
DWORD IncomingCompressedBytes;
DWORD OutgoingCompressedBytes;
CHAR[WINSTATIONNAME_LENGTH] WinStationName;
CHAR[DOMAIN_LENGTH] Domain;
CHAR UserName[USERNAME_LENGTH+1];
LARGE_INTEGER ConnectTime;
LARGE_INTEGER DisconnectTime;
LARGE_INTEGER LastInputTime;
LARGE_INTEGER LogonTime;
LARGE_INTEGER CurrentTime;
}
alias WTSINFOA* PWTSINFOA;

View File

@ -77,7 +77,7 @@ enum MSHLFLAGS {
struct FLAGGED_WORD_BLOB {
uint fFlags;
uint clSize;
ushort asData[1];
ushort[1] asData;
}
alias WCHAR OLECHAR;

View File

@ -13,6 +13,9 @@ Some screenshots: http://buggins.github.io/dlangui/screenshots.html
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/buggins/dlangui?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/buggins/dlangui.svg?branch=master)](https://travis-ci.org/buggins/dlangui)
Main features:
* Crossplatform (Win32 and Linux are supported in current version); can use SDL2 as a backend.
@ -120,16 +123,18 @@ Run Tetris game example
dub run dlangui:tetris --build=release
To develop using Visual-D, download sources for dlabgui and dependencies into some directory:
To develop using Visual-D or MonoD, download sources for dlabgui and dependencies into some directory:
git clone https://github.com/buggins/dlangui.git
git clone https://github.com/DerelictOrg/DerelictUtil.git
git clone https://github.com/DerelictOrg/DerelictGL3.git
git clone https://github.com/DerelictOrg/DerelictFI.git
git clone https://github.com/DerelictOrg/DerelictFT.git
git clone https://github.com/DerelictOrg/DerelictSDL2.git
git clone https://github.com/gecko0307/dlib.git
git clone https://github.com/Devisualization/image.git de_image
Then open .sln using Visual D.
Then open dlangui.sln using Visual D (or dlangui-monod.sln for MonoD)

View File

@ -66,7 +66,7 @@
<debuglevel>0</debuglevel>
<debugids>DebugFocus</debugids>
<versionlevel>0</versionlevel>
<versionids>USE_SDL USE_OPENGL</versionids>
<versionids>USE_OPENGL USE_SDL Unicode</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>1</createImplib>

View File

@ -21,6 +21,7 @@
"targetType": "staticLibrary",
"versions-posix": ["USE_SDL", "USE_OPENGL"],
"versions-windows": ["Unicode"],
"copyFiles": ["res"],

View File

@ -16,9 +16,66 @@
"copyFiles": ["res"],
"versions-posix": ["USE_SDL", "USE_OPENGL"],
"versions-windows": ["Unicode"],
"mainSourceFile": "src/main.d",
"sourceFiles-windows": [
"../../3rdparty/win32/basetsd.d",
"../../3rdparty/win32/basetyps.d",
"../../3rdparty/win32/cderr.d",
"../../3rdparty/win32/cguid.d",
"../../3rdparty/win32/commdlg.d",
"../../3rdparty/win32/commctrl.d",
"../../3rdparty/win32/core.d",
"../../3rdparty/win32/dde.d",
"../../3rdparty/win32/ddeml.d",
"../../3rdparty/win32/dlgs.d",
"../../3rdparty/win32/imm.d",
"../../3rdparty/win32/lzexpand.d",
"../../3rdparty/win32/mmsystem.d",
"../../3rdparty/win32/nb30.d",
"../../3rdparty/win32/oaidl.d",
"../../3rdparty/win32/objbase.d",
"../../3rdparty/win32/objfwd.d",
"../../3rdparty/win32/objidl.d",
"../../3rdparty/win32/ole.d",
"../../3rdparty/win32/ole2.d",
"../../3rdparty/win32/oleauto.d",
"../../3rdparty/win32/olectlid.d",
"../../3rdparty/win32/oleidl.d",
"../../3rdparty/win32/prsht.d",
"../../3rdparty/win32/rpc.d",
"../../3rdparty/win32/rpcdce.d",
"../../3rdparty/win32/rpcdcep.d",
"../../3rdparty/win32/rpcndr.d",
"../../3rdparty/win32/rpcnsi.d",
"../../3rdparty/win32/rpcnsip.d",
"../../3rdparty/win32/rpcnterr.d",
"../../3rdparty/win32/shellapi.d",
"../../3rdparty/win32/shlobj.d",
"../../3rdparty/win32/shlguid.d",
"../../3rdparty/win32/unknwn.d",
"../../3rdparty/win32/uuid.d",
"../../3rdparty/win32/w32api.d",
"../../3rdparty/win32/winbase.d",
"../../3rdparty/win32/wincon.d",
"../../3rdparty/win32/windef.d",
"../../3rdparty/win32/windows.d",
"../../3rdparty/win32/winerror.d",
"../../3rdparty/win32/wingdi.d",
"../../3rdparty/win32/winnetwk.d",
"../../3rdparty/win32/winnls.d",
"../../3rdparty/win32/winnt.d",
"../../3rdparty/win32/winperf.d",
"../../3rdparty/win32/winsock2.d",
"../../3rdparty/win32/winspool.d",
"../../3rdparty/win32/winsvc.d",
"../../3rdparty/win32/winuser.d",
"../../3rdparty/win32/winver.d",
"../../3rdparty/win32/ws2tcpip.d",
"../../3rdparty/win32/wtypes.d",
],
"dependencies": {
"dlangui:dlanguilib": "~master",
"derelict-sdl2": "~master",

View File

@ -66,7 +66,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>USE_SDL USE_OPENGL</versionids>
<versionids>USE_OPENGL USE_SDL Unicode</versionids>
<dump_source>0</dump_source>
<mapverbosity>3</mapverbosity>
<createImplib>0</createImplib>

View File

@ -294,10 +294,15 @@ extern (C) int UIAppMain(string[] args) {
UIString caption;
caption = "Open Text File"d;
FileDialog dlg = new FileDialog(caption, window, null);
dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*.*)"d), "*.*"));
dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt"));
dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp"));
//dlg.filterIndex = 2;
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
Log.d("FileDialog.onDialogResult: ", result, " param=", result.stringParam);
window.showMessageBox(UIString("FileOpen result"d), UIString(toUTF32(result.stringParam)));
import dlangui.core.stdaction;
if (result.id == ACTION_OPEN.id) {
Log.d("FileDialog.onDialogResult: ", result, " param=", result.stringParam);
window.showMessageBox(UIString("FileOpen result"d), UIString(toUTF32(result.stringParam)));
}
};
dlg.show();

View File

@ -10,6 +10,7 @@
"targetType": "executable",
"versions-posix": ["USE_SDL", "USE_OPENGL"],
"versions-windows": ["USE_OPENGL"],
"sourceFiles": [
"src/app.d"

View File

@ -66,7 +66,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>USE_SDL USE_OPENGL</versionids>
<versionids>USE_OPENGL</versionids>
<dump_source>0</dump_source>
<mapverbosity>3</mapverbosity>
<createImplib>0</createImplib>
@ -89,6 +89,7 @@
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<useStdLibPath>1</useStdLibPath>
<cRuntime>2</cRuntime>
<additionalOptions>-profile</additionalOptions>
<preBuildCommand />
<postBuildCommand />
@ -183,6 +184,7 @@
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<useStdLibPath>1</useStdLibPath>
<cRuntime>1</cRuntime>
<additionalOptions />
<preBuildCommand />
<postBuildCommand />

View File

@ -16,9 +16,67 @@
"copyFiles": ["res"],
"versions-posix": ["USE_SDL", "USE_OPENGL"],
"versions-windows": ["Unicode"],
"mainSourceFile": "src/main.d",
"sourceFiles-windows": [
"../../3rdparty/win32/basetsd.d",
"../../3rdparty/win32/basetyps.d",
"../../3rdparty/win32/cderr.d",
"../../3rdparty/win32/cguid.d",
"../../3rdparty/win32/commdlg.d",
"../../3rdparty/win32/commctrl.d",
"../../3rdparty/win32/core.d",
"../../3rdparty/win32/dde.d",
"../../3rdparty/win32/ddeml.d",
"../../3rdparty/win32/dlgs.d",
"../../3rdparty/win32/imm.d",
"../../3rdparty/win32/lzexpand.d",
"../../3rdparty/win32/mmsystem.d",
"../../3rdparty/win32/nb30.d",
"../../3rdparty/win32/oaidl.d",
"../../3rdparty/win32/objbase.d",
"../../3rdparty/win32/objfwd.d",
"../../3rdparty/win32/objidl.d",
"../../3rdparty/win32/ole.d",
"../../3rdparty/win32/ole2.d",
"../../3rdparty/win32/oleauto.d",
"../../3rdparty/win32/olectlid.d",
"../../3rdparty/win32/oleidl.d",
"../../3rdparty/win32/prsht.d",
"../../3rdparty/win32/rpc.d",
"../../3rdparty/win32/rpcdce.d",
"../../3rdparty/win32/rpcdcep.d",
"../../3rdparty/win32/rpcndr.d",
"../../3rdparty/win32/rpcnsi.d",
"../../3rdparty/win32/rpcnsip.d",
"../../3rdparty/win32/rpcnterr.d",
"../../3rdparty/win32/shellapi.d",
"../../3rdparty/win32/shlobj.d",
"../../3rdparty/win32/shlguid.d",
"../../3rdparty/win32/unknwn.d",
"../../3rdparty/win32/uuid.d",
"../../3rdparty/win32/w32api.d",
"../../3rdparty/win32/winbase.d",
"../../3rdparty/win32/wincon.d",
"../../3rdparty/win32/windef.d",
"../../3rdparty/win32/windows.d",
"../../3rdparty/win32/winerror.d",
"../../3rdparty/win32/wingdi.d",
"../../3rdparty/win32/winnetwk.d",
"../../3rdparty/win32/winnls.d",
"../../3rdparty/win32/winnt.d",
"../../3rdparty/win32/winperf.d",
"../../3rdparty/win32/winsock2.d",
"../../3rdparty/win32/winspool.d",
"../../3rdparty/win32/winsvc.d",
"../../3rdparty/win32/winuser.d",
"../../3rdparty/win32/winver.d",
"../../3rdparty/win32/ws2tcpip.d",
"../../3rdparty/win32/wtypes.d",
],
"dependencies": {
"dlangui:dlanguilib": "~master"
}

View File

@ -66,7 +66,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>USE_SDL USE_OPENGL</versionids>
<versionids>USE_OPENGL</versionids>
<dump_source>0</dump_source>
<mapverbosity>3</mapverbosity>
<createImplib>0</createImplib>
@ -89,6 +89,7 @@
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<useStdLibPath>1</useStdLibPath>
<cRuntime>2</cRuntime>
<additionalOptions>-profile</additionalOptions>
<preBuildCommand />
<postBuildCommand />
@ -183,6 +184,7 @@
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<useStdLibPath>1</useStdLibPath>
<cRuntime>1</cRuntime>
<additionalOptions />
<preBuildCommand />
<postBuildCommand />

View File

@ -143,6 +143,23 @@
fontFamily="SansSerif"
fontSize="16"
/>
<style id="COMBO_BOX"
backgroundImageId="editbox_background"
padding="2,2,2,2"
margins="2,2,2,2"
minWidth="40"
fontFace="Arial"
fontFamily="SansSerif"
fontSize="16"
/>
<style id="COMBO_BOX_BODY"
padding="2,2,2,2"
minWidth="40"
fontFace="Arial"
fontFamily="SansSerif"
fontSize="16"
align="Left|VCenter"
/>
<style id="EDIT_BOX"
backgroundImageId="editbox_background"
padding="5,6,5,6"

View File

@ -50,6 +50,7 @@ public import dlangui.core.logger;
public import dlangui.core.types;
public import dlangui.core.i18n;
public import dlangui.core.files;
public import dlangui.core.stdaction;
public import dlangui.graphics.images;
public import dlangui.widgets.widget;
public import dlangui.widgets.controls;

View File

@ -151,9 +151,31 @@ bool isRoot(string path) {
return false;
}
/// returns parent directory for specified path
string parentDir(string path) {
return buildNormalizedPath(path, "..");
}
/// check filename with pattern (currently only *.ext pattern is supported)
bool filterFilename(string filename, string pattern) {
if (pattern.equal("*.*"))
return true; // matches any
if (pattern.length < 3)
return false;
if (pattern[0] != '*' || pattern[1] != '.')
return false;
return filename.endsWith(pattern[1..$]);
}
/// Filters file name by pattern list
bool filterFilename(string filename, string[] filters) {
return true;
if (filters.length == 0)
return true; // no filters - show all
foreach(pattern; filters) {
if (filterFilename(filename, pattern))
return true;
}
return false;
}
/** List directory content

View File

@ -36,14 +36,18 @@ import dlangui.core.i18n;
// use global i18n object to get translation for string ID
dstring translated = i18n.get("STR_FILE_OPEN");
// as well, you can specify fallback value - to return if translation is not found
dstring translated = i18n.get("STR_FILE_OPEN", "Open..."d);
// UIString type can hold either string resource id or dstring raw value.
UIString text;
// assign resource id as string
// assign resource id as string (will remove dstring value if it was here)
text = "ID_FILE_EXIT";
// or assign raw value as dstring
// or assign raw value as dstring (will remove id if it was here)
text = "some text"d;
// assign both resource id and fallback value - to use if string resource is not found
text = UIString("ID_FILE_EXIT", "Exit"d);
// i18n.get() will automatically be invoked when getting UIString value (e.g. using alias this).
dstring translated = text;
@ -83,6 +87,11 @@ struct UIString {
this(dstring value) {
_value = value;
}
/** create string with resource id and raw value as fallback for missing translations */
this(string id, dstring fallbackValue) {
_id = id;
_value = fallbackValue;
}
/// Returns string resource id
@ -94,12 +103,9 @@ struct UIString {
}
/** Get value (either raw or translated by id) */
@property dstring value() const {
if (_value !is null)
return _value;
if (_id is null)
return null;
// translate ID to dstring
return i18n.get(_id);
if (_id !is null) // translate ID to dstring
return i18n.get(_id, _value); // get from resource, use _value as fallback
return _value;
}
/** Set raw value using property */
@property void value(dstring newValue) {
@ -311,7 +317,7 @@ synchronized class UIStringTranslator {
}
/** Translate string ID to string (returns "UNTRANSLATED: id" for missing values) */
dstring get(string id) {
dstring get(string id, dstring fallbackValue = null) {
if (id is null)
return null;
dstring s = _main.get(id);
@ -320,6 +326,8 @@ synchronized class UIStringTranslator {
s = _fallback.get(id);
if (s !is null)
return s;
if (fallbackValue.length > 0)
return fallbackValue;
return "UNTRANSLATED: "d ~ toUTF32(id);
}
}

View File

@ -33,6 +33,8 @@ import dlangui.widgets.popup;
import dlangui.widgets.layouts;
import dlangui.widgets.grid;
import dlangui.widgets.editors;
import dlangui.widgets.menu;
import dlangui.widgets.combobox;
import dlangui.platforms.common.platform;
import dlangui.dialogs.dialog;
@ -41,6 +43,7 @@ private import std.file;
private import std.path;
private import std.utf;
private import std.conv : to;
private import std.array : split;
/// flags for file dialog options
@ -55,17 +58,30 @@ enum FileDialogFlag : uint {
Save = ConfirmOverwrite,
}
/// filetype filter entry for FileDialog
struct FileFilterEntry {
UIString label;
string[] filter;
this(UIString displayLabel, string filterList) {
label = displayLabel;
if (filterList.length)
filter = split(filterList, ";");
}
}
/// File open / save dialog
class FileDialog : Dialog, CustomGridCellAdapter {
protected EditLine _edPath;
protected FilePathPanel _edPath;
protected EditLine _edFilename;
protected ComboBox _cbFilters;
protected StringGridWidget _fileList;
//protected StringGridWidget places;
protected VerticalLayout leftPanel;
protected VerticalLayout rightPanel;
protected Action _action;
protected RootEntry[] _roots;
protected FileFilterEntry[] _filters;
protected int _filterIndex;
protected string _path;
protected string _filename;
protected DirEntry[] _entries;
@ -85,6 +101,38 @@ class FileDialog : Dialog, CustomGridCellAdapter {
_action = action;
}
/// filter list for file type filter combo box
@property FileFilterEntry[] filters() {
return _filters;
}
/// filter list for file type filter combo box
@property void filters(FileFilterEntry[] values) {
_filters = values;
}
/// add new filter entry
void addFilter(FileFilterEntry value) {
_filters ~= value;
}
/// filter index
@property int filterIndex() {
return _filterIndex;
}
/// filter index
@property void filterIndex(int index) {
_filterIndex = index;
}
/// return currently selected filter value - array of patterns like ["*.txt", "*.rtf"]
@property string[] selectedFilter() {
if (_filterIndex >= 0 && _filterIndex < _filters.length)
return _filters[_filterIndex].filter;
return null;
}
/// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
override void layout(Rect rc) {
super.layout(rc);
@ -93,19 +141,22 @@ class FileDialog : Dialog, CustomGridCellAdapter {
}
protected bool upLevel() {
return openDirectory(buildNormalizedPath(_path, ".."), _path);
return openDirectory(parentDir(_path), _path);
}
protected bool reopenDirectory() {
return openDirectory(_path, null);
}
protected bool openDirectory(string dir, string selectedItemPath) {
dir = buildNormalizedPath(dir);
Log.d("FileDialog.openDirectory(", dir, ")");
_fileList.rows = 0;
string[] filters;
if (!listDirectory(dir, true, true, false, filters, _entries))
if (!listDirectory(dir, true, true, false, selectedFilter, _entries))
return false;
_path = dir;
_isRoot = isRoot(dir);
_edPath.text = toUTF32(_path);
_edPath.path = _path; //toUTF32(_path);
_fileList.rows = cast(int)_entries.length;
int selectionIndex = -1;
for (int i = 0; i < _entries.length; i++) {
@ -247,6 +298,10 @@ class FileDialog : Dialog, CustomGridCellAdapter {
return super.handleAction(action);
}
bool onPathSelected(string path) {
//
return openDirectory(path, null);
}
/// override to implement creation of dialog controls
override void init() {
@ -272,15 +327,35 @@ class FileDialog : Dialog, CustomGridCellAdapter {
content.addChild(leftPanel);
content.addChild(rightPanel);
_edPath = new EditLine("path");
_edPath = new FilePathPanel("path");
_edPath.layoutWidth(FILL_PARENT);
_edPath.layoutWeight = 0;
_edPath.onPathSelectionListener = &onPathSelected;
HorizontalLayout fnlayout = new HorizontalLayout();
fnlayout.layoutWidth(FILL_PARENT);
_edFilename = new EditLine("filename");
_edFilename.layoutWidth(FILL_PARENT);
_edFilename.layoutWeight = 0;
//_edFilename.layoutWeight = 0;
fnlayout.addChild(_edFilename);
if (_filters.length) {
dstring[] filterLabels;
foreach(f; _filters)
filterLabels ~= f.label.value;
_cbFilters = new ComboBox("filter", filterLabels);
_cbFilters.selectedItemIndex = _filterIndex;
_cbFilters.onItemClickListener = delegate(Widget source, int itemIndex) {
_filterIndex = itemIndex;
reopenDirectory();
return true;
};
_cbFilters.layoutWidth(WRAP_CONTENT);
_cbFilters.layoutWeight(0);
//_cbFilters.backgroundColor = 0xFFC0FF;
fnlayout.addChild(_cbFilters);
//fnlayout.backgroundColor = 0xFFFFC0;
}
rightPanel.addChild(_edPath);
_fileList = new StringGridWidget("files");
_fileList.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
_fileList.resize(4, 3);
@ -290,8 +365,10 @@ class FileDialog : Dialog, CustomGridCellAdapter {
_fileList.setColTitle(3, "Modified"d);
_fileList.showRowHeaders = false;
_fileList.rowSelect = true;
rightPanel.addChild(_edPath);
rightPanel.addChild(_fileList);
rightPanel.addChild(_edFilename);
rightPanel.addChild(fnlayout);
addChild(content);
@ -314,3 +391,264 @@ class FileDialog : Dialog, CustomGridCellAdapter {
_fileList.setFocus();
}
}
interface OnPathSelectionHandler {
bool onPathSelected(string path);
}
class FilePathPanelItem : HorizontalLayout {
protected string _path;
protected TextWidget _text;
protected ImageButton _button;
Listener!OnPathSelectionHandler onPathSelectionListener;
this(string path) {
super(null);
styleId = "LIST_ITEM";
_path = path;
string fname = isRoot(path) ? path : baseName(path);
_text = new TextWidget(null, toUTF32(fname));
_text.styleId = "BUTTON_TRANSPARENT";
_text.clickable = true;
_text.onClickListener = &onTextClick;
//_text.backgroundColor = 0xC0FFFF;
_text.state = State.Parent;
_button = new ImageButton(null, "scrollbar_btn_right");
_button.styleId = "BUTTON_TRANSPARENT";
_button.focusable = false;
_button.onClickListener = &onButtonClick;
//_button.backgroundColor = 0xC0FFC0;
_button.state = State.Parent;
trackHover(true);
addChild(_text);
addChild(_button);
margins(Rect(2,0,2,0));
}
private bool onTextClick(Widget src) {
if (onPathSelectionListener.assigned)
return onPathSelectionListener(_path);
return false;
}
private bool onButtonClick(Widget src) {
// show popup menu with subdirs
string[] filters;
DirEntry[] entries;
if (!listDirectory(_path, true, false, false, filters, entries))
return false;
if (entries.length == 0)
return false;
MenuItem dirs = new MenuItem();
int itemId = 25000;
foreach(ref DirEntry e; entries) {
string fullPath = e.name;
string d = baseName(fullPath);
Action a = new Action(itemId++, toUTF32(d));
MenuItem item = new MenuItem(a);
item.onMenuItemClick = delegate(MenuItem item) {
if (onPathSelectionListener.assigned)
return onPathSelectionListener(fullPath);
return false;
};
dirs.add(item);
}
PopupMenu menuWidget = new PopupMenu(dirs);
PopupWidget popup = window.showPopup(menuWidget, this, PopupAlign.Below);
popup.flags = PopupFlags.CloseOnClickOutside;
return true;
}
}
/// Panel with buttons - path segments - for fast navigation to subdirs.
class FilePathPanelButtons : WidgetGroup {
protected string _path;
Listener!OnPathSelectionHandler onPathSelectionListener;
protected bool onPathSelected(string path) {
if (onPathSelectionListener.assigned) {
return onPathSelectionListener(path);
}
return false;
}
this(string ID = null) {
super(ID);
layoutWidth = FILL_PARENT;
clickable = true;
}
protected void init(string path) {
_path = path;
_children.clear();
string itemPath = path;
for (;;) {
FilePathPanelItem item = new FilePathPanelItem(itemPath);
item.onPathSelectionListener = &onPathSelected;
addChild(item);
if (isRoot(itemPath)) {
break;
}
itemPath = parentDir(itemPath);
}
}
/// Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
override void measure(int parentWidth, int parentHeight) {
Rect m = margins;
Rect p = padding;
// calc size constraints for children
int pwidth = parentWidth;
int pheight = parentHeight;
if (parentWidth != SIZE_UNSPECIFIED)
pwidth -= m.left + m.right + p.left + p.right;
if (parentHeight != SIZE_UNSPECIFIED)
pheight -= m.top + m.bottom + p.top + p.bottom;
int reservedForEmptySpace = parentWidth / 20;
if (reservedForEmptySpace > 40)
reservedForEmptySpace = 40;
Point sz;
sz.x += reservedForEmptySpace;
// measure children
bool exceeded = false;
for (int i = 0; i < _children.count; i++) {
Widget item = _children.get(i);
item.visibility = Visibility.Visible;
item.measure(pwidth, pheight);
if (sz.y < item.measuredHeight)
sz.y = item.measuredHeight;
if (sz.x + item.measuredWidth > pwidth) {
exceeded = true;
}
if (!exceeded || i == 0) // at least one item must be visible
sz.x += item.measuredWidth;
else
item.visibility = Visibility.Gone;
}
measuredContent(parentWidth, parentHeight, sz.x, sz.y);
}
/// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
override void layout(Rect rc) {
//Log.d("tabControl.layout enter");
_needLayout = false;
if (visibility == Visibility.Gone) {
return;
}
_pos = rc;
applyMargins(rc);
applyPadding(rc);
int reservedForEmptySpace = rc.width / 20;
if (reservedForEmptySpace > 40)
reservedForEmptySpace = 40;
int maxw = rc.width - reservedForEmptySpace;
int totalw = 0;
int visibleItems = 0;
bool exceeded = false;
// measure and update visibility
for (int i = 0; i < _children.count; i++) {
Widget item = _children.get(i);
item.visibility = Visibility.Visible;
item.measure(rc.width, rc.height);
if (totalw + item.measuredWidth > rc.width) {
exceeded = true;
}
if (!exceeded || i == 0) { // at least one item must be visible
totalw += item.measuredWidth;
visibleItems++;
} else
item.visibility = Visibility.Gone;
}
// layout visible items
// backward order
Rect itemRect = rc;
for (int i = visibleItems - 1; i >= 0; i--) {
Widget item = _children.get(i);
int w = item.measuredWidth;
if (i == visibleItems - 1 && w > maxw)
w = maxw;
itemRect.right = itemRect.left + w;
item.layout(itemRect);
itemRect.left += w;
}
}
/// Draw widget at its position to buffer
override void onDraw(DrawBuf buf) {
if (visibility != Visibility.Visible)
return;
super.onDraw(buf);
Rect rc = _pos;
applyMargins(rc);
applyPadding(rc);
auto saver = ClipRectSaver(buf, rc);
for (int i = 0; i < _children.count; i++) {
Widget item = _children.get(i);
if (item.visibility != Visibility.Visible)
continue;
item.onDraw(buf);
}
}
}
interface PathSelectedHandler {
bool onPathSelected(string path);
}
/// Panel - either path segment buttons or text editor line
class FilePathPanel : FrameLayout {
Listener!OnPathSelectionHandler onPathSelectionListener;
static const ID_SEGMENTS = "SEGMENTS";
static const ID_EDITOR = "ED_PATH";
protected FilePathPanelButtons _segments;
protected EditLine _edPath;
protected string _path;
Signal!PathSelectedHandler pathListener;
this(string ID = null) {
super(ID);
_segments = new FilePathPanelButtons(ID_SEGMENTS);
_edPath = new EditLine(ID_EDITOR);
_edPath.layoutWidth = FILL_PARENT;
_edPath.editorActionListener = &onEditorAction;
_edPath.onFocusChangeListener = &onEditorFocusChanged;
_segments.onClickListener = &onSegmentsClickOutside;
_segments.onPathSelectionListener = &onPathSelected;
addChild(_segments);
addChild(_edPath);
}
protected bool onEditorFocusChanged(Widget source, bool focused) {
if (!focused) {
_edPath.text = toUTF32(_path);
showChild(ID_SEGMENTS);
}
return true;
}
protected bool onPathSelected(string path) {
if (onPathSelectionListener.assigned) {
if (exists(path))
return onPathSelectionListener(path);
}
return false;
}
protected bool onSegmentsClickOutside(Widget w) {
// switch to editor
_edPath.text = toUTF32(_path);
showChild(ID_EDITOR);
_edPath.setFocus();
return true;
}
protected bool onEditorAction(const Action action) {
if (action.id == EditorActions.InsertNewLine) {
string fn = buildNormalizedPath(toUTF8(_edPath.text));
if (exists(fn) && isDir(fn))
return onPathSelected(fn);
}
return false;
}
@property void path(string value) {
_segments.init(value);
_edPath.text = toUTF32(value);
_path = value;
showChild(ID_SEGMENTS);
}
@property string path() {
return _path;
}
}

View File

@ -205,6 +205,8 @@ private class FreeTypeFontFile {
case 0x2039:
return '<';
case 0x203A:
case '‣':
case '►':
return '>';
case 0x2044:
return '/';

View File

@ -62,9 +62,9 @@ class GLDrawBuf : DrawBuf {
/// reserved for hardware-accelerated drawing - ends drawing batch
override void afterDrawing() {
setOrthoProjection(_dx, _dy);
glSupport.setOrthoProjection(_dx, _dy);
_scene.draw();
flushGL();
glSupport.flushGL();
destroy(_scene);
_scene = null;
}
@ -244,7 +244,7 @@ private class GLImageCache {
_drawbuf = null;
}
if (_textureId != 0) {
deleteTexture(_textureId);
glSupport.deleteTexture(_textureId);
_textureId = 0;
}
}
@ -254,14 +254,14 @@ private class GLImageCache {
return; // no draw buffer!!!
if (_textureId == 0) {
//CRLog::debug("updateTexture - new texture");
_textureId = genTexture();
_textureId = glSupport.genTexture();
if (!_textureId)
return;
}
//CRLog::debug("updateTexture - setting image %dx%d", _drawbuf.width, _drawbuf.height);
uint * pixels = _drawbuf.scanLine(0);
if (!setTextureImage(_textureId, _drawbuf.width, _drawbuf.height, cast(ubyte*)pixels)) {
deleteTexture(_textureId);
if (!glSupport.setTextureImage(_textureId, _drawbuf.width, _drawbuf.height, cast(ubyte*)pixels)) {
glSupport.deleteTexture(_textureId);
_textureId = 0;
return;
}
@ -339,7 +339,7 @@ private class GLImageCache {
if (_needUpdateTexture)
updateTexture();
if (_textureId != 0) {
if (!isTexture(_textureId)) {
if (!glSupport.isTexture(_textureId)) {
Log.e("Invalid texture ", _textureId);
return;
}
@ -371,12 +371,12 @@ private class GLImageCache {
dstrc.bottom -= clip.bottom;
}
if (!dstrc.empty)
drawColorAndTextureRect(_textureId, _tdx, _tdy, srcrc, dstrc, color, srcrc.width() != dstrc.width() || srcrc.height() != dstrc.height());
glSupport.drawColorAndTextureRect(_textureId, _tdx, _tdy, srcrc, dstrc, color, srcrc.width() != dstrc.width() || srcrc.height() != dstrc.height());
//drawColorAndTextureRect(vertices, texcoords, color, _textureId);
if (rotationAngle) {
// unset rotation
setRotation(rx, ry, 0);
glSupport.setRotation(rx, ry, 0);
// glMatrixMode(GL_PROJECTION);
// glPopMatrix();
// checkError("pop matrix");
@ -576,7 +576,7 @@ private class GLGlyphCache {
_drawbuf = null;
}
if (_textureId != 0) {
deleteTexture(_textureId);
glSupport.deleteTexture(_textureId);
_textureId = 0;
}
}
@ -589,7 +589,7 @@ private class GLGlyphCache {
return; // no draw buffer!!!
if (_textureId == 0) {
//CRLog::debug("updateTexture - new texture");
_textureId = genTexture();
_textureId = glSupport.genTexture();
if (!_textureId)
return;
}
@ -600,8 +600,8 @@ private class GLGlyphCache {
_rgbaBuffer.length = len;
for (int i = 0; i < len; i++)
_rgbaBuffer[i] = ((cast(uint)pixels[i]) << 24) | 0x00FFFFFF;
if (!setTextureImage(_textureId, _drawbuf.width, _drawbuf.height, cast(ubyte*)_rgbaBuffer.ptr)) {
deleteTexture(_textureId);
if (!glSupport.setTextureImage(_textureId, _drawbuf.width, _drawbuf.height, cast(ubyte*)_rgbaBuffer.ptr)) {
glSupport.deleteTexture(_textureId);
_textureId = 0;
return;
}
@ -667,7 +667,7 @@ private class GLGlyphCache {
if (_needUpdateTexture)
updateTexture();
if (_textureId != 0) {
if (!isTexture(_textureId)) {
if (!glSupport.isTexture(_textureId)) {
Log.e("Invalid texture ", _textureId);
return;
}
@ -693,7 +693,7 @@ private class GLGlyphCache {
}
if (!dstrc.empty) {
//Log.d("drawing glyph with color ", color);
drawColorAndTextureRect(_textureId, _tdx, _tdy, srcrc, dstrc, color, false);
glSupport.drawColorAndTextureRect(_textureId, _tdx, _tdy, srcrc, dstrc, color, false);
}
}
@ -818,7 +818,7 @@ class SolidRectSceneItem : SceneItem {
_color = color;
}
override void draw() {
drawSolidFillRect(_rc, _color, _color, _color, _color);
glSupport.drawSolidFillRect(_rc, _color, _color, _color, _color);
}
}

View File

@ -53,7 +53,8 @@ static this() {
0x0505: "GL_OUT_OF_MEMORY"
];
}
/* Convenient wrapper around glGetError()
/**
* Convenient wrapper around glGetError()
* TODO use one of the DEBUG extensions instead
*/
bool checkError(string context="", string file=__FILE__, int line=__LINE__)
@ -67,295 +68,6 @@ bool checkError(string context="", string file=__FILE__, int line=__LINE__)
return false;
}
immutable float Z_2D = -2.0f;
void drawSolidFillRect(Rect rc, uint color1, uint color2, uint color3, uint color4) {
float[6 * 4] colors;
LVGLFillColor(color1, colors.ptr + 4*0, 1);
LVGLFillColor(color4, colors.ptr + 4*1, 1);
LVGLFillColor(color3, colors.ptr + 4*2, 1);
LVGLFillColor(color1, colors.ptr + 4*3, 1);
LVGLFillColor(color3, colors.ptr + 4*4, 1);
LVGLFillColor(color2, colors.ptr + 4*5, 1);
float x0 = cast(float)(rc.left);
float y0 = cast(float)(bufferDy-rc.top);
float x1 = cast(float)(rc.right);
float y1 = cast(float)(bufferDy-rc.bottom);
// don't flip for framebuffer
if (currentFramebufferId) {
y0 = cast(float)(rc.top);
y1 = cast(float)(rc.bottom);
}
float[3 * 6] vertices = [
x0,y0,Z_2D,
x0,y1,Z_2D,
x1,y1,Z_2D,
x0,y0,Z_2D,
x1,y1,Z_2D,
x1,y0,Z_2D];
if (_solidFillProgram !is null) {
//Log.d("solid fill: vertices ", vertices, " colors ", colors);
_solidFillProgram.execute(vertices, colors);
} else
Log.e("No program");
}
void drawColorAndTextureRect(uint textureId, int tdx, int tdy, Rect srcrc, Rect dstrc, uint color, bool linear) {
//Log.v("drawColorAndTextureRect tx=", textureId, " src=", srcrc, " dst=", dstrc);
drawColorAndTextureRect(textureId, tdx, tdy, srcrc.left, srcrc.top, srcrc.width(), srcrc.height(), dstrc.left, dstrc.top, dstrc.width(), dstrc.height(), color, linear);
}
void drawColorAndTextureRect(uint textureId, int tdx, int tdy, int srcx, int srcy, int srcdx, int srcdy, int xx, int yy, int dx, int dy, uint color, bool linear) {
float colors[6*4];
LVGLFillColor(color, colors.ptr, 6);
float dstx0 = cast(float)xx;
float dsty0 = cast(float)(bufferDy - (yy));
float dstx1 = cast(float)(xx + dx);
float dsty1 = cast(float)(bufferDy - (yy + dy));
// don't flip for framebuffer
if (currentFramebufferId) {
dsty0 = cast(float)((yy));
dsty1 = cast(float)((yy + dy));
}
float srcx0 = srcx / cast(float)tdx;
float srcy0 = srcy / cast(float)tdy;
float srcx1 = (srcx + srcdx) / cast(float)tdx;
float srcy1 = (srcy + srcdy) / cast(float)tdy;
float[3 * 6] vertices = [dstx0,dsty0,Z_2D,
dstx0,dsty1,Z_2D,
dstx1,dsty1,Z_2D,
dstx0,dsty0,Z_2D,
dstx1,dsty1,Z_2D,
dstx1,dsty0,Z_2D];
float[2 * 6] texcoords = [srcx0,srcy0, srcx0,srcy1, srcx1,srcy1, srcx0,srcy0, srcx1,srcy1, srcx1,srcy0];
_textureProgram.execute(vertices, texcoords, colors, textureId, linear);
//drawColorAndTextureRect(vertices, texcoords, colors, textureId, linear);
}
/// generate new texture ID
uint genTexture() {
GLuint textureId = 0;
glGenTextures(1, &textureId);
return textureId;
}
/// delete OpenGL texture
void deleteTexture(ref uint textureId) {
if (!textureId)
return;
if (glIsTexture(textureId) != GL_TRUE) {
Log.e("Invalid texture ", textureId);
return;
}
GLuint id = textureId;
glDeleteTextures(1, &id);
checkError("glDeleteTextures");
textureId = 0;
}
/// call glFlush
void flushGL() {
glFlush();
checkError("glFlush");
}
bool setTextureImage(uint textureId, int dx, int dy, ubyte * pixels) {
//checkError("before setTextureImage");
glActiveTexture(GL_TEXTURE0);
checkError("updateTexture - glActiveTexture");
glBindTexture(GL_TEXTURE_2D, 0);
checkError("updateTexture - glBindTexture(0)");
glBindTexture(GL_TEXTURE_2D, textureId);
checkError("updateTexture - glBindTexture");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
checkError("updateTexture - glPixelStorei");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkError("updateTexture - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkError("updateTexture - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
checkError("updateTexture - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
checkError("updateTexture - glTexParameteri");
if (!glIsTexture(textureId))
Log.e("second test - invalid texture passed to CRGLSupportImpl::setTextureImage");
// ORIGINAL: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dx, dy, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dx, dy, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
checkError("updateTexture - glTexImage2D");
if (glGetError() != GL_NO_ERROR) {
Log.e("Cannot set image for texture");
return false;
}
checkError("after setTextureImage");
return true;
}
bool setTextureImageAlpha(uint textureId, int dx, int dy, ubyte * pixels) {
checkError("before setTextureImageAlpha");
glActiveTexture(GL_TEXTURE0);
checkError("updateTexture - glActiveTexture");
glBindTexture(GL_TEXTURE_2D, 0);
checkError("updateTexture - glBindTexture(0)");
glBindTexture(GL_TEXTURE_2D, textureId);
checkError("setTextureImageAlpha - glBindTexture");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
checkError("setTextureImageAlpha - glPixelStorei");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkError("setTextureImageAlpha - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkError("setTextureImageAlpha - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
checkError("setTextureImageAlpha - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
checkError("setTextureImageAlpha - glTexParameteri");
if (!glIsTexture(textureId))
Log.e("second test: invalid texture passed to CRGLSupportImpl::setTextureImageAlpha");
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, dx, dy, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);
checkError("setTextureImageAlpha - glTexImage2D");
if (glGetError() != GL_NO_ERROR) {
Log.e("Cannot set image for texture");
return false;
}
glBindTexture(GL_TEXTURE_2D, 0);
checkError("updateTexture - glBindTexture(0)");
checkError("after setTextureImageAlpha");
return true;
}
private uint currentFramebufferId;
/// returns texture ID for buffer, 0 if failed
bool createFramebuffer(ref uint textureId, ref uint framebufferId, int dx, int dy) {
checkError("before createFramebuffer");
bool res = true;
textureId = framebufferId = 0;
textureId = genTexture();
if (!textureId)
return false;
GLuint fid = 0;
glGenFramebuffers(1, &fid);
if (checkError("createFramebuffer glGenFramebuffersOES")) return false;
framebufferId = fid;
glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
if (checkError("createFramebuffer glBindFramebuffer")) return false;
glBindTexture(GL_TEXTURE_2D, textureId);
checkError("glBindTexture(GL_TEXTURE_2D, _textureId)");
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dx, dy, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, null);
checkError("glTexImage2D");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkError("texParameter");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkError("texParameter");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
checkError("texParameter");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
checkError("texParameter");
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0);
checkError("glFramebufferTexture2D");
// Always check that our framebuffer is ok
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
Log.e("glFramebufferTexture2D failed");
res = false;
}
checkError("glCheckFramebufferStatus");
//glClearColor(0.5f, 0, 0, 1);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
checkError("glClearColor");
glClear(GL_COLOR_BUFFER_BIT);
checkError("glClear");
checkError("after createFramebuffer");
//CRLog::trace("CRGLSupportImpl::createFramebuffer %d,%d texture=%d, buffer=%d", dx, dy, textureId, framebufferId);
currentFramebufferId = framebufferId;
glBindTexture(GL_TEXTURE_2D, 0);
checkError("createFramebuffer - glBindTexture(0)");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
checkError("createFramebuffer - glBindFramebuffer(0)");
return res;
}
void deleteFramebuffer(ref uint framebufferId) {
//CRLog::debug("GLDrawBuf::deleteFramebuffer");
if (framebufferId != 0) {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
checkError("deleteFramebuffer - glBindFramebuffer");
GLuint fid = framebufferId;
glDeleteFramebuffers(1, &fid);
checkError("deleteFramebuffer - glDeleteFramebuffer");
}
//CRLog::trace("CRGLSupportImpl::deleteFramebuffer(%d)", framebufferId);
framebufferId = 0;
checkError("after deleteFramebuffer");
currentFramebufferId = 0;
}
bool bindFramebuffer(uint framebufferId) {
//CRLog::trace("CRGLSupportImpl::bindFramebuffer(%d)", framebufferId);
glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
currentFramebufferId = framebufferId;
return !checkError("glBindFramebuffer");
}
/// projection matrix
//private mat4 m;
/// current gl buffer width
private int bufferDx;
/// current gl buffer height
private int bufferDy;
//private float[16] matrix;
private float[16] qtmatrix;
void QMatrix4x4_ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane)
{
// Bail out if the projection volume is zero-sized.
if (left == right || bottom == top || nearPlane == farPlane)
return;
// Construct the projection.
float width = right - left;
float invheight = top - bottom;
float clip = farPlane - nearPlane;
float[4][4] m;
m[0][0] = 2.0f / width;
m[1][0] = 0.0f;
m[2][0] = 0.0f;
m[3][0] = -(left + right) / width;
m[0][1] = 0.0f;
m[1][1] = 2.0f / invheight;
m[2][1] = 0.0f;
m[3][1] = -(top + bottom) / invheight;
m[0][2] = 0.0f;
m[1][2] = 0.0f;
m[2][2] = -2.0f / clip;
m[3][2] = -(nearPlane + farPlane) / clip;
m[0][3] = 0.0f;
m[1][3] = 0.0f;
m[2][3] = 0.0f;
m[3][3] = 1.0f;
for (int y = 0; y < 4; y++)
for (int x = 0; x < 4; x++)
qtmatrix[y * 4 + x] = m[y][x];
}
void setOrthoProjection(int dx, int dy) {
bufferDx = dx;
bufferDy = dy;
QMatrix4x4_ortho(0, dx, 0, dy, 0.5f, 50.0f);
glViewport(0, 0, dx, dy);
checkError("glViewport");
}
class GLProgram {
@property abstract string vertexSource();
@ -503,7 +215,7 @@ class SolidFillProgram : GLProgram {
bind();
//glUniformMatrix4fv(matrixLocation, 1, false, m.value_ptr);
//glUniformMatrix4fv(matrixLocation, 1, false, matrix.ptr);
glUniformMatrix4fv(matrixLocation, 1, false, qtmatrix.ptr);
glUniformMatrix4fv(matrixLocation, 1, false, glSupport.qtmatrix.ptr);
checkError("glUniformMatrix4fv");
}
@ -704,57 +416,366 @@ class TextureProgram : SolidFillProgram {
}
}
__gshared TextureProgram _textureProgram;
__gshared SolidFillProgram _solidFillProgram;
__gshared GLSupport _glSupport;
@property GLSupport glSupport() {
if (!_glSupport) {
Log.f("GLSupport is not initialized");
assert(false, "GLSupport is not initialized");
}
if (!_glSupport.valid) {
Log.e("GLSupport programs are not initialized");
}
return _glSupport;
}
bool initShaders() {
if (_textureProgram is null) {
_textureProgram = new TextureProgram();
if (!_textureProgram.compile())
class GLSupport {
TextureProgram _textureProgram;
SolidFillProgram _solidFillProgram;
@property bool valid() {
return _textureProgram && _solidFillProgram;
}
bool initShaders() {
if (_textureProgram is null) {
_textureProgram = new TextureProgram();
if (!_textureProgram.compile())
return false;
}
if (_solidFillProgram is null) {
_solidFillProgram = new SolidFillProgram();
if (!_solidFillProgram.compile())
return false;
}
Log.d("Shaders compiled successfully");
return true;
}
bool uninitShaders() {
Log.d("Uniniting shaders");
if (_textureProgram !is null) {
destroy(_textureProgram);
_textureProgram = null;
}
if (_solidFillProgram !is null) {
destroy(_solidFillProgram);
_solidFillProgram = null;
}
return true;
}
bool isTexture(uint textureId) {
return glIsTexture(textureId) == GL_TRUE;
}
void setRotation(int x, int y, int rotationAngle) {
/*
this->rotationAngle = rotationAngle;
rotationX = x;
rotationY = y;
if (!currentFramebufferId) {
rotationY = bufferDy - rotationY;
}
QMatrix4x4 matrix2;
matrix2.ortho(0, bufferDx, 0, bufferDy, 0.5f, 5.0f);
if (rotationAngle) {
matrix2.translate(rotationX, rotationY, 0);
matrix2.rotate(rotationAngle, 0, 0, 1);
matrix2.translate(-rotationX, -rotationY, 0);
}
matrix2.copyDataTo(m);
*/
}
static immutable float Z_2D = -2.0f;
void drawSolidFillRect(Rect rc, uint color1, uint color2, uint color3, uint color4) {
float[6 * 4] colors;
LVGLFillColor(color1, colors.ptr + 4*0, 1);
LVGLFillColor(color4, colors.ptr + 4*1, 1);
LVGLFillColor(color3, colors.ptr + 4*2, 1);
LVGLFillColor(color1, colors.ptr + 4*3, 1);
LVGLFillColor(color3, colors.ptr + 4*4, 1);
LVGLFillColor(color2, colors.ptr + 4*5, 1);
float x0 = cast(float)(rc.left);
float y0 = cast(float)(bufferDy-rc.top);
float x1 = cast(float)(rc.right);
float y1 = cast(float)(bufferDy-rc.bottom);
// don't flip for framebuffer
if (currentFramebufferId) {
y0 = cast(float)(rc.top);
y1 = cast(float)(rc.bottom);
}
float[3 * 6] vertices = [
x0,y0,Z_2D,
x0,y1,Z_2D,
x1,y1,Z_2D,
x0,y0,Z_2D,
x1,y1,Z_2D,
x1,y0,Z_2D];
if (_solidFillProgram !is null) {
//Log.d("solid fill: vertices ", vertices, " colors ", colors);
_solidFillProgram.execute(vertices, colors);
} else
Log.e("No program");
}
void drawColorAndTextureRect(uint textureId, int tdx, int tdy, Rect srcrc, Rect dstrc, uint color, bool linear) {
//Log.v("drawColorAndTextureRect tx=", textureId, " src=", srcrc, " dst=", dstrc);
drawColorAndTextureRect(textureId, tdx, tdy, srcrc.left, srcrc.top, srcrc.width(), srcrc.height(), dstrc.left, dstrc.top, dstrc.width(), dstrc.height(), color, linear);
}
void drawColorAndTextureRect(uint textureId, int tdx, int tdy, int srcx, int srcy, int srcdx, int srcdy, int xx, int yy, int dx, int dy, uint color, bool linear) {
float[6*4] colors;
LVGLFillColor(color, colors.ptr, 6);
float dstx0 = cast(float)xx;
float dsty0 = cast(float)(bufferDy - (yy));
float dstx1 = cast(float)(xx + dx);
float dsty1 = cast(float)(bufferDy - (yy + dy));
// don't flip for framebuffer
if (currentFramebufferId) {
dsty0 = cast(float)((yy));
dsty1 = cast(float)((yy + dy));
}
float srcx0 = srcx / cast(float)tdx;
float srcy0 = srcy / cast(float)tdy;
float srcx1 = (srcx + srcdx) / cast(float)tdx;
float srcy1 = (srcy + srcdy) / cast(float)tdy;
float[3 * 6] vertices = [dstx0,dsty0,Z_2D,
dstx0,dsty1,Z_2D,
dstx1,dsty1,Z_2D,
dstx0,dsty0,Z_2D,
dstx1,dsty1,Z_2D,
dstx1,dsty0,Z_2D];
float[2 * 6] texcoords = [srcx0,srcy0, srcx0,srcy1, srcx1,srcy1, srcx0,srcy0, srcx1,srcy1, srcx1,srcy0];
_textureProgram.execute(vertices, texcoords, colors, textureId, linear);
//drawColorAndTextureRect(vertices, texcoords, colors, textureId, linear);
}
/// generate new texture ID
uint genTexture() {
GLuint textureId = 0;
glGenTextures(1, &textureId);
return textureId;
}
/// delete OpenGL texture
void deleteTexture(ref uint textureId) {
if (!textureId)
return;
if (glIsTexture(textureId) != GL_TRUE) {
Log.e("Invalid texture ", textureId);
return;
}
GLuint id = textureId;
glDeleteTextures(1, &id);
checkError("glDeleteTextures");
textureId = 0;
}
/// call glFlush
void flushGL() {
glFlush();
checkError("glFlush");
}
bool setTextureImage(uint textureId, int dx, int dy, ubyte * pixels) {
//checkError("before setTextureImage");
glActiveTexture(GL_TEXTURE0);
checkError("updateTexture - glActiveTexture");
glBindTexture(GL_TEXTURE_2D, 0);
checkError("updateTexture - glBindTexture(0)");
glBindTexture(GL_TEXTURE_2D, textureId);
checkError("updateTexture - glBindTexture");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
checkError("updateTexture - glPixelStorei");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkError("updateTexture - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkError("updateTexture - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
checkError("updateTexture - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
checkError("updateTexture - glTexParameteri");
if (!glIsTexture(textureId))
Log.e("second test - invalid texture passed to CRGLSupportImpl::setTextureImage");
// ORIGINAL: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dx, dy, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dx, dy, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
checkError("updateTexture - glTexImage2D");
if (glGetError() != GL_NO_ERROR) {
Log.e("Cannot set image for texture");
return false;
}
checkError("after setTextureImage");
return true;
}
if (_solidFillProgram is null) {
_solidFillProgram = new SolidFillProgram();
if (!_solidFillProgram.compile())
bool setTextureImageAlpha(uint textureId, int dx, int dy, ubyte * pixels) {
checkError("before setTextureImageAlpha");
glActiveTexture(GL_TEXTURE0);
checkError("updateTexture - glActiveTexture");
glBindTexture(GL_TEXTURE_2D, 0);
checkError("updateTexture - glBindTexture(0)");
glBindTexture(GL_TEXTURE_2D, textureId);
checkError("setTextureImageAlpha - glBindTexture");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
checkError("setTextureImageAlpha - glPixelStorei");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkError("setTextureImageAlpha - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkError("setTextureImageAlpha - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
checkError("setTextureImageAlpha - glTexParameteri");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
checkError("setTextureImageAlpha - glTexParameteri");
if (!glIsTexture(textureId))
Log.e("second test: invalid texture passed to CRGLSupportImpl::setTextureImageAlpha");
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, dx, dy, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);
checkError("setTextureImageAlpha - glTexImage2D");
if (glGetError() != GL_NO_ERROR) {
Log.e("Cannot set image for texture");
return false;
}
Log.d("Shaders compiled successfully");
return true;
}
bool uninitShaders() {
Log.d("Uniniting shaders");
if (_textureProgram !is null) {
destroy(_textureProgram);
_textureProgram = null;
}
if (_solidFillProgram !is null) {
destroy(_solidFillProgram);
_solidFillProgram = null;
}
return true;
}
bool isTexture(uint textureId) {
return glIsTexture(textureId) == GL_TRUE;
}
void setRotation(int x, int y, int rotationAngle) {
/*
this->rotationAngle = rotationAngle;
rotationX = x;
rotationY = y;
if (!currentFramebufferId) {
rotationY = bufferDy - rotationY;
}
glBindTexture(GL_TEXTURE_2D, 0);
checkError("updateTexture - glBindTexture(0)");
checkError("after setTextureImageAlpha");
return true;
}
QMatrix4x4 matrix2;
matrix2.ortho(0, bufferDx, 0, bufferDy, 0.5f, 5.0f);
if (rotationAngle) {
matrix2.translate(rotationX, rotationY, 0);
matrix2.rotate(rotationAngle, 0, 0, 1);
matrix2.translate(-rotationX, -rotationY, 0);
private uint currentFramebufferId;
/// returns texture ID for buffer, 0 if failed
bool createFramebuffer(ref uint textureId, ref uint framebufferId, int dx, int dy) {
checkError("before createFramebuffer");
bool res = true;
textureId = framebufferId = 0;
textureId = genTexture();
if (!textureId)
return false;
GLuint fid = 0;
glGenFramebuffers(1, &fid);
if (checkError("createFramebuffer glGenFramebuffersOES")) return false;
framebufferId = fid;
glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
if (checkError("createFramebuffer glBindFramebuffer")) return false;
glBindTexture(GL_TEXTURE_2D, textureId);
checkError("glBindTexture(GL_TEXTURE_2D, _textureId)");
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dx, dy, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, null);
checkError("glTexImage2D");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkError("texParameter");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkError("texParameter");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
checkError("texParameter");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
checkError("texParameter");
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0);
checkError("glFramebufferTexture2D");
// Always check that our framebuffer is ok
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
Log.e("glFramebufferTexture2D failed");
res = false;
}
checkError("glCheckFramebufferStatus");
//glClearColor(0.5f, 0, 0, 1);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
checkError("glClearColor");
glClear(GL_COLOR_BUFFER_BIT);
checkError("glClear");
checkError("after createFramebuffer");
//CRLog::trace("CRGLSupportImpl::createFramebuffer %d,%d texture=%d, buffer=%d", dx, dy, textureId, framebufferId);
currentFramebufferId = framebufferId;
glBindTexture(GL_TEXTURE_2D, 0);
checkError("createFramebuffer - glBindTexture(0)");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
checkError("createFramebuffer - glBindFramebuffer(0)");
return res;
}
matrix2.copyDataTo(m);
*/
void deleteFramebuffer(ref uint framebufferId) {
//CRLog::debug("GLDrawBuf::deleteFramebuffer");
if (framebufferId != 0) {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
checkError("deleteFramebuffer - glBindFramebuffer");
GLuint fid = framebufferId;
glDeleteFramebuffers(1, &fid);
checkError("deleteFramebuffer - glDeleteFramebuffer");
}
//CRLog::trace("CRGLSupportImpl::deleteFramebuffer(%d)", framebufferId);
framebufferId = 0;
checkError("after deleteFramebuffer");
currentFramebufferId = 0;
}
bool bindFramebuffer(uint framebufferId) {
//CRLog::trace("CRGLSupportImpl::bindFramebuffer(%d)", framebufferId);
glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
currentFramebufferId = framebufferId;
return !checkError("glBindFramebuffer");
}
/// projection matrix
//private mat4 m;
/// current gl buffer width
private int bufferDx;
/// current gl buffer height
private int bufferDy;
//private float[16] matrix;
private float[16] qtmatrix;
void QMatrix4x4_ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane)
{
// Bail out if the projection volume is zero-sized.
if (left == right || bottom == top || nearPlane == farPlane)
return;
// Construct the projection.
float width = right - left;
float invheight = top - bottom;
float clip = farPlane - nearPlane;
float[4][4] m;
m[0][0] = 2.0f / width;
m[1][0] = 0.0f;
m[2][0] = 0.0f;
m[3][0] = -(left + right) / width;
m[0][1] = 0.0f;
m[1][1] = 2.0f / invheight;
m[2][1] = 0.0f;
m[3][1] = -(top + bottom) / invheight;
m[0][2] = 0.0f;
m[1][2] = 0.0f;
m[2][2] = -2.0f / clip;
m[3][2] = -(nearPlane + farPlane) / clip;
m[0][3] = 0.0f;
m[1][3] = 0.0f;
m[2][3] = 0.0f;
m[3][3] = 1.0f;
for (int y = 0; y < 4; y++)
for (int x = 0; x < 4; x++)
qtmatrix[y * 4 + x] = m[y][x];
}
void setOrthoProjection(int dx, int dy) {
bufferDx = dx;
bufferDy = dy;
QMatrix4x4_ortho(0, dx, 0, dy, 0.5f, 50.0f);
glViewport(0, 0, dx, dy);
checkError("glViewport");
}
}

View File

@ -34,7 +34,7 @@ version (USE_DEIMAGE) {
version (USE_DLIBIMAGE) {
import dlib.image.io.io;
import dlib.image.image;
//version = ENABLE_DLIBIMAGE_JPEG;
version = ENABLE_DLIBIMAGE_JPEG;
}
import dlangui.core.logger;
@ -142,8 +142,8 @@ version (USE_FREEIMAGE) {
FREE_IMAGE_LOADED = true;
}
ubyte imagebuf[];
ubyte readbuf[4096];
ubyte[] imagebuf;
ubyte[4096] readbuf;
for (;;) {
size_t bytesRead = stream.read(readbuf);
if (!bytesRead)

View File

@ -452,7 +452,7 @@ class StateDrawable : Drawable {
private static uint colorTransformFromStringAdd(string value) {
if (value is null)
return COLOR_TRANSFORM_OFFSET_NONE;
int n[4];
int [4]n;
if (!parseList4(value, n))
return COLOR_TRANSFORM_OFFSET_NONE;
foreach (ref item; n) {
@ -467,8 +467,8 @@ class StateDrawable : Drawable {
private static uint colorTransformFromStringMult(string value) {
if (value is null)
return COLOR_TRANSFORM_MULTIPLY_NONE;
float n[4];
uint nn[4];
float[4] n;
uint[4] nn;
if (!parseList4!float(value, n))
return COLOR_TRANSFORM_MULTIPLY_NONE;
for(int i = 0; i < 4; i++) {

View File

@ -97,6 +97,8 @@ class SDLWindow : Window {
version(USE_OPENGL) {
if (_enableOpengl)
windowFlags |= SDL_WINDOW_OPENGL;
if (!_glSupport)
_glSupport = new GLSupport();
}
_win = SDL_CreateWindow(toUTF8(_caption).toStringz, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
700, 500,
@ -127,7 +129,7 @@ class SDLWindow : Window {
} else if (!_gl3Reloaded) {
DerelictGL3.reload();
_gl3Reloaded = true;
if (!initShaders())
if (!glSupport.valid && !glSupport.initShaders())
_enableOpengl = false;
}
}

View File

@ -167,7 +167,7 @@ class Win32Font : Font {
g.glyph = new ubyte[g.blackBoxX * g.blackBoxY];
if (gs>0)
{
ubyte glyph[] = new ubyte[gs];
ubyte[] glyph = new ubyte[gs];
res = GetGlyphOutlineW( _drawbuf.dc, cast(wchar)ch,
GGO_GRAY8_BITMAP, //GGO_METRICS
&metrics,

View File

@ -1,24 +1,24 @@
// Written in the D programming language.
/**
This module contains implementation of Win32 platform support
Provides Win32Window and Win32Platform classes.
Usually you don't need to use this module directly.
Synopsis:
----
import dlangui.platforms.windows.winapp;
----
Copyright: Vadim Lopatin, 2014
License: Boost License 1.0
Authors: Vadim Lopatin, coolreader.org@gmail.com
*/
// Written in the D programming language.
/**
This module contains implementation of Win32 platform support
Provides Win32Window and Win32Platform classes.
Usually you don't need to use this module directly.
Synopsis:
----
import dlangui.platforms.windows.winapp;
----
Copyright: Vadim Lopatin, 2014
License: Boost License 1.0
Authors: Vadim Lopatin, coolreader.org@gmail.com
*/
module dlangui.platforms.windows.winapp;
version (USE_SDL) { }
else version (Windows) {
@ -39,15 +39,15 @@ import dlangui.graphics.drawbuf;
import dlangui.graphics.images;
import dlangui.graphics.fonts;
import dlangui.core.logger;
import dlangui.core.files;
import dlangui.core.files;
version (USE_OPENGL) {
import dlangui.graphics.glsupport;
}
// specify debug=DebugMouseEvents for logging mouse handling
// specify debug=DebugRedraw for logging drawing and layouts handling
// specify debug=DebugKeys for logging of key events
// specify debug=DebugMouseEvents for logging mouse handling
// specify debug=DebugRedraw for logging drawing and layouts handling
// specify debug=DebugKeys for logging of key events
pragma(lib, "gdi32.lib");
pragma(lib, "user32.lib");
@ -154,10 +154,12 @@ version (USE_OPENGL) {
class Win32Window : Window {
Win32Platform _platform;
HWND _hwnd;
version (USE_OPENGL) {
HGLRC _hGLRC; // opengl context
HPALETTE _hPalette;
GLSupport _gl;
}
dstring _caption;
Win32ColorDrawBuf _drawbuf;
@ -167,6 +169,7 @@ class Win32Window : Window {
Win32Window w32parent = cast(Win32Window)parent;
HWND parenthwnd = w32parent ? w32parent._hwnd : null;
_platform = platform;
_gl = new GLSupport();
_caption = windowCaption;
_flags = flags;
uint ws = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
@ -199,7 +202,9 @@ class Win32Window : Window {
_hPalette = setupPalette(hDC);
_hGLRC = wglCreateContext(hDC);
if (_hGLRC) {
wglMakeCurrent(hDC, _hGLRC);
_glSupport = _gl;
if (!DERELICT_GL3_RELOADED) {
// run this code only once
@ -208,7 +213,7 @@ class Win32Window : Window {
import derelict.opengl3.gl3;
DerelictGL3.reload();
// successful
if (initShaders()) {
if (glSupport.initShaders()) {
setOpenglEnabled();
useOpengl = true;
} else {
@ -218,7 +223,7 @@ class Win32Window : Window {
Log.e("Derelict exception", e);
}
} else {
if (initShaders()) {
if (glSupport.initShaders()) {
setOpenglEnabled();
useOpengl = true;
} else {
@ -252,6 +257,7 @@ class Win32Window : Window {
//scope(exit) EndPaint(_hwnd, &ps);
HDC hdc = GetDC(_hwnd);
wglMakeCurrent(hdc, _hGLRC);
_glSupport = _gl;
glDisable(GL_DEPTH_TEST);
glViewport(0, 0, _dx, _dy);
float a = 1.0f;
@ -288,7 +294,10 @@ class Win32Window : Window {
version (USE_OPENGL) {
import derelict.opengl3.wgl;
if (_hGLRC) {
uninitShaders();
glSupport.uninitShaders();
delete _glSupport;
_glSupport = null;
_gl = null;
wglMakeCurrent (null, null) ;
wglDeleteContext(_hGLRC);
_hGLRC = null;
@ -335,8 +344,10 @@ class Win32Window : Window {
override @property void windowCaption(dstring caption) {
_caption = caption;
if (_hwnd)
if (_hwnd) {
Log.d("windowCaption ", caption);
SetWindowTextW(_hwnd, toUTF16z(_caption));
}
}
void onCreate() {
Log.d("Window onCreate");
@ -370,59 +381,59 @@ class Win32Window : Window {
void onSetCursorType() {
HANDLE winCursor = null;
switch (_cursorType) {
case CursorType.None:
winCursor = null;
break;
case CursorType.Parent:
break;
case CursorType.Arrow:
winCursor = loadCursor(IDC_ARROW);
break;
case CursorType.IBeam:
winCursor = loadCursor(IDC_IBEAM);
break;
case CursorType.Wait:
winCursor = loadCursor(IDC_WAIT);
break;
case CursorType.Crosshair:
winCursor = loadCursor(IDC_CROSS);
break;
case CursorType.WaitArrow:
winCursor = loadCursor(IDC_APPSTARTING);
break;
case CursorType.SizeNWSE:
winCursor = loadCursor(IDC_SIZENWSE);
break;
case CursorType.SizeNESW:
winCursor = loadCursor(IDC_SIZENESW);
break;
case CursorType.SizeWE:
winCursor = loadCursor(IDC_SIZEWE);
break;
case CursorType.SizeNS:
winCursor = loadCursor(IDC_SIZENS);
break;
case CursorType.SizeAll:
winCursor = loadCursor(IDC_SIZEALL);
break;
case CursorType.No:
winCursor = loadCursor(IDC_NO);
break;
case CursorType.Hand:
winCursor = loadCursor(IDC_HAND);
break;
default:
break;
case CursorType.None:
winCursor = null;
break;
case CursorType.Parent:
break;
case CursorType.Arrow:
winCursor = loadCursor(IDC_ARROW);
break;
case CursorType.IBeam:
winCursor = loadCursor(IDC_IBEAM);
break;
case CursorType.Wait:
winCursor = loadCursor(IDC_WAIT);
break;
case CursorType.Crosshair:
winCursor = loadCursor(IDC_CROSS);
break;
case CursorType.WaitArrow:
winCursor = loadCursor(IDC_APPSTARTING);
break;
case CursorType.SizeNWSE:
winCursor = loadCursor(IDC_SIZENWSE);
break;
case CursorType.SizeNESW:
winCursor = loadCursor(IDC_SIZENESW);
break;
case CursorType.SizeWE:
winCursor = loadCursor(IDC_SIZEWE);
break;
case CursorType.SizeNS:
winCursor = loadCursor(IDC_SIZENS);
break;
case CursorType.SizeAll:
winCursor = loadCursor(IDC_SIZEALL);
break;
case CursorType.No:
winCursor = loadCursor(IDC_NO);
break;
case CursorType.Hand:
winCursor = loadCursor(IDC_HAND);
break;
default:
break;
}
SetCursor(winCursor);
}
/// sets cursor type for window
override protected void setCursorType(uint cursorType) {
// override to support different mouse cursors
_cursorType = cursorType;
onSetCursorType();
}
/// sets cursor type for window
override protected void setCursorType(uint cursorType) {
// override to support different mouse cursors
_cursorType = cursorType;
onSetCursorType();
}
/// sets window icon
@property override void windowIcon(DrawBufRef buf) {
@ -468,7 +479,7 @@ class Win32Window : Window {
}
void onPaint() {
Log.d("onPaint()");
debug(DebugRedraw) Log.d("onPaint()");
long paintStart = currentTimeMillis;
version (USE_OPENGL) {
if (useOpengl && _hGLRC) {
@ -480,7 +491,7 @@ class Win32Window : Window {
paintUsingGDI();
}
long paintEnd = currentTimeMillis;
Log.d("WM_PAINT handling took ", paintEnd - paintStart, " ms");
debug(DebugRedraw) Log.d("WM_PAINT handling took ", paintEnd - paintStart, " ms");
}
protected ButtonDetails _lbutton;
@ -852,7 +863,7 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
FreeTypeFontManager ftfontMan = new FreeTypeFontManager();
string fontsPath = "c:\\Windows\\Fonts\\";
static if (false) { // SHGetFolderPathW not found in shell32.lib
WCHAR szPath[MAX_PATH];
WCHAR[MAX_PATH] szPath;
const CSIDL_FLAG_NO_ALIAS = 0x1000;
const CSIDL_FLAG_DONT_UNEXPAND = 0x2000;
if(SUCCEEDED(SHGetFolderPathW(NULL,

View File

@ -118,7 +118,7 @@ class XCBWindow : Window {
import std.c.linux.X11.Xlib;
uint mask;
uint values[3];
uint[3] values;
// disable opengl for testing
_enableOpengl = false;
@ -139,7 +139,7 @@ class XCBWindow : Window {
Log.d("window=", _w, " gc=", _g);
version (USE_OPENGL) {
if (_enableOpengl) {
int visual_attribs[] = [
int[] visual_attribs = [
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_DOUBLEBUFFER, 1,
@ -385,7 +385,7 @@ class XCBWindow : Window {
Log.e("glXCreateContextAttribsARB function is not found");
_context = glXCreateNewContext(_display, _fb_config, GLX_RGBA_TYPE, null, true);
} else {
int context_attribs[] =
int[] context_attribs =
[
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,

View File

@ -55,7 +55,7 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
} else {
res = new Widget("COMBOBOX_BODY");
}
res.layoutWidth = FILL_PARENT;
res.layoutWidth = WRAP_CONTENT;
res.layoutHeight = WRAP_CONTENT;
return res;
}
@ -80,6 +80,7 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
protected ImageButton createButton() {
ImageButton res = new ImageButton("COMBOBOX_BUTTON", "scrollbar_btn_down");
res.layoutWeight = 0;
res.onClickListener = this;
return res;
}
@ -120,16 +121,20 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
super(ID);
_adapter = adapter;
_ownAdapter = ownAdapter;
init();
}
protected void init() {
_body = createSelectedItemWidget();
_body.onClickListener = this;
_button = createButton();
//_body.state = State.Parent;
//focusable = true;
_button.focusable = false;
_body.focusable = true;
//_body.focusable = true;
addChild(_body);
addChild(_button);
}
}
}
@ -137,8 +142,12 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
class ComboBox : ComboBoxBase {
protected StringListAdapter _adapter;
protected EditLine _edit;
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID, (_adapter = new StringListAdapter()), true);
}
@ -151,17 +160,8 @@ class ComboBox : ComboBoxBase {
super(ID, (_adapter = new StringListAdapter(items)), true);
}
@property bool readOnly() {
return _edit.readOnly;
}
@property ComboBox readOnly(bool ro) {
_edit.readOnly = ro;
return this;
}
@property override dstring text() {
return _edit.text;
return _body.text;
}
@property override Widget text(dstring txt) {
@ -169,11 +169,9 @@ class ComboBox : ComboBoxBase {
if (idx >= 0) {
selectedItemIndex = idx;
} else {
if (!readOnly) {
// not found
_selectedItemIndex = -1;
_edit.text = txt;
}
// not found
_selectedItemIndex = -1;
_body.text = txt;
}
return this;
}
@ -183,18 +181,76 @@ class ComboBox : ComboBoxBase {
if (idx >= 0) {
selectedItemIndex = idx;
} else {
if (!readOnly) {
// not found
_selectedItemIndex = -1;
_edit.text = txt;
}
// not found
_selectedItemIndex = -1;
_body.text = txt;
}
return this;
}
override @property void selectedItemIndex(int index) {
_selectedItemIndex = index;
_edit.text = _adapter.items[index];
_body.text = _adapter.items[index];
super.selectedItemIndex(index);
}
override void init() {
super.init();
_body.focusable = false;
_body.clickable = true;
focusable = true;
//styleId = "COMBO_BOX";
clickable = true;
onClickListener = this;
}
override protected Widget createSelectedItemWidget() {
TextWidget res = new TextWidget("COMBOBOX_BODY");
res.styleId = "COMBO_BOX";
res.clickable = true;
res.layoutWidth = FILL_PARENT;
res.layoutHeight = WRAP_CONTENT;
int maxItemWidth = 0;
for(int i = 0; i < _adapter.itemCount; i++) {
Widget item = _adapter.itemWidget(i);
item.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
if (maxItemWidth < item.measuredWidth)
maxItemWidth = item.measuredWidth;
}
res.minWidth = maxItemWidth;
return res;
}
}
/** Editable ComboBox with list of strings. */
class ComboEdit : ComboBox {
protected EditLine _edit;
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
}
this(string ID, string[] items) {
super(ID, items);
}
this(string ID, dstring[] items) {
super(ID, items);
}
@property bool readOnly() {
return _edit.readOnly;
}
@property ComboBox readOnly(bool ro) {
_edit.readOnly = ro;
return this;
}
override protected Widget createSelectedItemWidget() {
@ -206,4 +262,11 @@ class ComboBox : ComboBoxBase {
return res;
}
override void init() {
super.init();
focusable = false;
_body.focusable = true;
}
}

View File

@ -344,33 +344,40 @@ class Button : Widget {
override @property Widget text(dstring s) { _text = s; requestLayout(); return this; }
override @property Widget text(UIString s) { _text = s; requestLayout(); return this; }
@property Widget textResource(string s) { _text = s; requestLayout(); return this; }
this(string ID = null) {
super(ID);
/// empty parameter list constructor - for usage by factory
this() {
super(null);
init(UIString());
}
private void init(UIString label) {
styleId = "BUTTON";
_text = label;
clickable = true;
focusable = true;
trackHover = true;
}
/// create with ID parameter
this(string ID) {
super(ID);
init(UIString());
}
this(string ID, UIString label) {
super(ID);
init(label);
}
this(string ID, dstring label) {
super(ID);
_text = label;
styleId = "BUTTON";
clickable = true;
focusable = true;
trackHover = true;
init(UIString(label));
}
this(string ID, string labelResourceId) {
super(ID);
_text = labelResourceId;
styleId = "BUTTON";
clickable = true;
focusable = true;
trackHover = true;
init(UIString(labelResourceId));
}
/// constructor from action
this(const Action a) {
this("button-action" ~ to!string(a.id));
_text = a.labelValue;
this("button-action" ~ to!string(a.id), a.labelValue);
action = a;
}
@ -408,6 +415,7 @@ class AbstractSlider : WidgetGroup {
protected int _pageSize = 30;
protected int _position = 20;
/// create with ID parameter
this(string ID) {
super(ID);
}
@ -656,7 +664,12 @@ class ScrollBar : AbstractSlider, OnClickHandler {
return this;
}
this(string ID = null, Orientation orient = Orientation.Vertical) {
/// empty parameter list constructor - for usage by factory
this() {
this(null, Orientation.Vertical);
}
/// create with ID parameter
this(string ID, Orientation orient = Orientation.Vertical) {
super(ID);
styleId = "SCROLLBAR";
_orientation = orient;

View File

@ -1708,10 +1708,20 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
}
interface EditorActionHandler {
bool onEditorAction(const Action action);
}
/// single line editor
class EditLine : EditWidgetBase {
Signal!EditorActionHandler editorActionListener;
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID, dstring initialContent = null) {
super(ID, ScrollBarMode.Invisible, ScrollBarMode.Invisible);
_content = new EditableContent(false);
@ -1792,6 +1802,12 @@ class EditLine : EditWidgetBase {
override protected bool handleAction(const Action a) {
switch (a.id) {
case EditorActions.InsertNewLine:
case EditorActions.PrependNewLine:
if (editorActionListener.assigned) {
return editorActionListener(a);
}
break;
case EditorActions.Up:
break;
case EditorActions.Down:
@ -1880,6 +1896,11 @@ class EditLine : EditWidgetBase {
/// single line editor
class EditBox : EditWidgetBase {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID, dstring initialContent = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
super(ID, hscrollbarMode, vscrollbarMode);
_content = new EditableContent(true); // multiline

View File

@ -1163,7 +1163,12 @@ class StringGridWidget : StringGridWidgetBase {
protected dstring[] _rowTitles;
protected dstring[] _colTitles;
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
styleId = "EDIT_BOX";
}

View File

@ -278,7 +278,12 @@ class ResizerWidget : Widget {
protected string _styleVertical;
protected string _styleHorizontal;
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
_styleVertical = "RESIZER_VERTICAL";
_styleHorizontal = "RESIZER_HORIZONTAL";
@ -461,7 +466,7 @@ class ResizerWidget : Widget {
}
/// Arranges items either vertically or horizontally
class LinearLayout : WidgetGroup {
protected Orientation _orientation = Orientation.Vertical;
/// returns linear layout orientation (Vertical, Horizontal)
@ -469,7 +474,12 @@ class LinearLayout : WidgetGroup {
/// sets linear layout orientation
@property LinearLayout orientation(Orientation value) { _orientation = value; requestLayout(); return this; }
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
_layoutItems = new LayoutItems();
}
@ -523,15 +533,27 @@ class LinearLayout : WidgetGroup {
}
/// Arranges children vertically
class VerticalLayout : LinearLayout {
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
orientation = Orientation.Vertical;
}
}
/// Arranges children horizontally
class HorizontalLayout : LinearLayout {
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
orientation = Orientation.Horizontal;
}
@ -539,6 +561,11 @@ class HorizontalLayout : LinearLayout {
/// place all children into same place (usually, only one child should be visible at a time)
class FrameLayout : WidgetGroup {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
}

View File

@ -298,7 +298,12 @@ class ListWidget : WidgetGroup, OnScrollHandler {
requestLayout();
}
this(string ID = null, Orientation orientation = Orientation.Vertical) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID, Orientation orientation = Orientation.Vertical) {
super(ID);
_orientation = orientation;
focusable = true;

View File

@ -88,7 +88,7 @@ class MenuItem {
}
/// set new MenuItemType
@property MenuItem type(MenuItemType type) {
@property MenuItem type(MenuItemType type) {
_type = type;
return this;
}
@ -342,8 +342,14 @@ class MenuItemWidget : WidgetGroup {
addChild(_label);
// accelerator
dstring acc = _item.acceleratorText;
if (_item.isSubmenu && !mainMenu)
acc = "‣"d;
if (_item.isSubmenu && !mainMenu) {
version (Windows) {
acc = ">"d;
//acc = "►"d;
} else {
acc = "‣"d;
}
}
if (acc !is null) {
_accel = new TextWidget("MENU_ACCEL");
_accel.styleId = "MENU_ACCEL";

View File

@ -304,7 +304,12 @@ class ScrollWidget : ScrollWidgetBase {
requestLayout();
return this;
}
this(string ID = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
super(ID, hscrollbarMode, vscrollbarMode);
}

View File

@ -177,6 +177,11 @@ class TabControl : WidgetGroup {
/// signal of tab change (e.g. by clicking on tab header)
Signal!TabHandler onTabChangedListener;
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
_items = new TabItemList();
@ -373,6 +378,11 @@ class TabControl : WidgetGroup {
/// container for widgets controlled by TabControl
class TabHost : FrameLayout, TabHandler {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID, TabControl tabControl = null) {
super(ID);
_tabControl = tabControl;
@ -458,6 +468,11 @@ class TabHost : FrameLayout, TabHandler {
class TabWidget : VerticalLayout, TabHandler {
protected TabControl _tabControl;
protected TabHost _tabHost;
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
_tabControl = new TabControl("TAB_CONTROL");

View File

@ -549,7 +549,12 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
protected bool _needUpdateWidgets;
protected bool _needUpdateWidgetStates;
this(string ID = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
super(ID, hscrollbarMode, vscrollbarMode);
contentWidget = new VerticalLayout("TREE_CONTENT");
_tree = new TreeItems();
@ -737,7 +742,12 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
/// Tree widget with items which can have icons and labels
class TreeWidget : TreeWidgetBase {
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
}
}

View File

@ -177,8 +177,12 @@ class Widget {
private static int _instanceCount = 0;
private static bool _appShuttingDown = false;
}
/// create widget, with optional id
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
_id = ID;
_state = State.Enabled;
debug(resalloc) _instanceCount++;
@ -258,7 +262,7 @@ class Widget {
/// override to handle focus changes
protected void handleFocusChange(bool focused) {
invalidate();
onFocusChangeListener(this, checked);
onFocusChangeListener(this, focused);
}
/// override to handle check changes
protected void handleCheckChange(bool checked) {
@ -1327,7 +1331,12 @@ alias WidgetList = ObjectList!Widget;
/** Base class for widgets which have children. */
class WidgetGroup : Widget {
this(string ID = null) {
/// empty parameter list constructor - for usage by factory
this() {
this(null);
}
/// create with ID parameter
this(string ID) {
super(ID);
}