ShaderAutoCompleteDlg.cpp

00001 // ShaderAutoCompleteDlg.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "mplayerc.h"
00006 #include "ShaderAutoCompleteDlg.h"
00007 
00008 
00009 // CShaderAutoCompleteDlg dialog
00010 
00011 CShaderAutoCompleteDlg::CShaderAutoCompleteDlg(CWnd* pParent /*=NULL*/)
00012         : CResizableDialog(CShaderAutoCompleteDlg::IDD, pParent)
00013 {
00014         m_text[0] = 0;
00015 
00016         m_inst[_T("abs")] = _T("abs(value a)|Absolute value (per component). ");
00017         m_inst[_T("acos")] = _T("acos(x)|Returns the arccosine of each component of x. Each component should be in the range [-1, 1]. ");
00018         m_inst[_T("all")] = _T("all(x)|Test if all components of x are nonzero. ");
00019         m_inst[_T("any")] = _T("any(x)|Test is any component of x is nonzero. ");
00020         m_inst[_T("asin")] = _T("asin(x)|Returns the arcsine of each component of x. Each component should be in the range [-pi/2, pi/2]. ");
00021         m_inst[_T("atan")] = _T("atan(x)|Returns the arctangent of x. The return values are in the range [-pi/2, pi/2]. ");
00022         m_inst[_T("atan2")] = _T("atan2(y, x)|Returns the arctangent of y/x. The signs of y and x are used to determine the quadrant of the return values in the range [-pi, pi]. atan2 is well-defined for every point other than the origin, even if x equals 0 and y does not equal 0. ");
00023         m_inst[_T("ceil")] = _T("ceil(x)|Returns the smallest integer which is greater than or equal to x. ");
00024         m_inst[_T("clamp")] = _T("clamp(x, min, max)|Clamps x to the range [min, max]. ");
00025         m_inst[_T("clip")] = _T("clip(x)|Discards the current pixel, if any component of x is less than zero. This can be used to simulate clip planes, if each component of x represents the distance from a plane. ");
00026         m_inst[_T("cos")] = _T("cos(x)|Returns the cosine of x. ");
00027         m_inst[_T("cosh")] = _T("cosh(x)|Returns the hyperbolic cosine of x. ");
00028         m_inst[_T("cross")] = _T("cross(a, b)|Returns the cross product of two 3-D vectors a and b. ");
00029         m_inst[_T("d3dcolortoubyte4")] = _T("D3DCOLORtoUBYTE4(x)|Swizzles and scales components of the 4-D vector x to compensate for the lack of UBYTE4 support in some hardware. ");
00030         m_inst[_T("ddx")] = _T("ddx(x)|Returns the partial derivative of x with respect to the screen-space x-coordinate. ");
00031         m_inst[_T("ddy")] = _T("ddy(x)|Returns the partial derivative of x with respect to the screen-space y-coordinate. ");
00032         m_inst[_T("degrees")] = _T("degrees(x)|Converts x from radians to degrees. ");
00033         m_inst[_T("determinant")] = _T("determinant(m)|Returns the determinant of the square matrix m. ");
00034         m_inst[_T("distance")] = _T("distance(a, b)|Returns the distance between two points a and b. ");
00035         m_inst[_T("dot")] = _T("dot(a, b)|Returns the dot product of two vectors a and b. ");
00036         m_inst[_T("exp")] = _T("exp(x)|Returns the base-e exponent ex. ");
00037         m_inst[_T("exp2")] = _T("exp2(value a)|Base 2 Exp (per component). ");
00038         m_inst[_T("faceforward")] = _T("faceforward(n, i, ng)|Returns -n * sign(dot(i, ng)). ");
00039         m_inst[_T("floor")] = _T("floor(x)|Returns the greatest integer which is less than or equal to x. ");
00040         m_inst[_T("fmod")] = _T("fmod(a, b)|Returns the floating point remainder f of a / b such that a = i * b + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of b. ");
00041         m_inst[_T("frac")] = _T("frac(x)|Returns the fractional part f of x, such that f is a value greater than or equal to 0, and less than 1. ");
00042         m_inst[_T("frc")] = _T("frc(value a)|Fractional part (per component). ");
00043         m_inst[_T("frexp")] = _T("frexp(x, out exp)|Returns the mantissa and exponent of x. frexp returns the mantissa, and the exponent is stored in the output parameter exp. If x is 0, the function returns 0 for both the mantissa and the exponent. ");
00044         m_inst[_T("fwidth")] = _T("fwidth(x)|Returns abs(ddx(x))+abs(ddy(x)). ");
00045         m_inst[_T("isfinite")] = _T("isfinite(x)|Returns true if x is finite, false otherwise. ");
00046         m_inst[_T("isinf")] = _T("isinf(x)|Returns true if x is +INF or -INF, false otherwise. ");
00047         m_inst[_T("isnan")] = _T("isnan(x)|Returns true if x is NAN or QNAN, false otherwise. ");
00048         m_inst[_T("ldexp")] = _T("ldexp(x, exp)|Returns x * 2exp. ");
00049         m_inst[_T("len")] = _T("len(value a)|Vector length. ");
00050         m_inst[_T("length")] = _T("length(v)|Returns the length of the vector v. ");
00051         m_inst[_T("lerp")] = _T("lerp(a, b, s)|Returns a + s(b - a). This linearly interpolates between a and b, such that the return value is a when s is 0, and b when s is 1. ");
00052         m_inst[_T("lit")] = _T("lit(ndotl, ndoth, m)|Returns a lighting vector (ambient, diffuse, specular, 1): ambient = 1; diffuse = (ndotl < 0) ? 0 : ndotl; specular = (ndotl < 0) || (ndoth < 0) ? 0 : (ndoth * m); ");
00053         m_inst[_T("log")] = _T("log(x)|Returns the base-e logarithm of x. If x is negative, the function returns indefinite. If x is 0, the function returns +INF. ");
00054         m_inst[_T("log10")] = _T("log10(x)|Returns the base-10 logarithm of x. If x is negative, the function returns indefinite. If x is 0, the function returns +INF. ");
00055         m_inst[_T("log2")] = _T("log2(x)|Returns the base-2 logarithm of x. If x is negative, the function returns indefinite. If x is 0, the function returns +INF. ");
00056         m_inst[_T("max")] = _T("max(a, b)|Selects the greater of a and b. ");
00057         m_inst[_T("min")] = _T("min(a, b)|Selects the lesser of a and b. ");
00058         m_inst[_T("modf")] = _T("modf(x, out ip)|Splits the value x into fractional and integer parts, each of which has the same sign and x. The signed fractional portion of x is returned. The integer portion is stored in the output parameter ip. ");
00059         m_inst[_T("mul")] = _T("mul(a, b)|Performs matrix multiplication between a and b. If a is a vector, it treated as a row vector. If b is a vector, it is treated as a column vector. The inner dimension acolumns and brows must be equal. The result has the dimension arows x bcolumns. ");
00060         m_inst[_T("noise")] = _T("noise(x)|Not yet implemented. ");
00061         m_inst[_T("normalize")] = _T("normalize(v)|Returns the normalized vector v / length(v). If the length of v is 0, the result is indefinite. ");
00062         m_inst[_T("pow")] = _T("pow(x, y)|Returns xy. ");
00063         m_inst[_T("radians")] = _T("radians(x)|Converts x from degrees to radians. ");
00064         m_inst[_T("reflect")] = _T("reflect(i, n)|Returns the reflection vector v, given the entering ray direction i, and the surface normal n. Such that v = i - 2 * dot(i, n) * n ");
00065         m_inst[_T("refract")] = _T("refract(i, n, eta)|Returns the refraction vector v, given the entering ray direction i, the surface normal n, and the relative index of refraction eta. If the angle between i and n is too great for a given eta, refract returns (0,0,0). ");
00066         m_inst[_T("round")] = _T("round(x)|Rounds x to the nearest integer. ");
00067         m_inst[_T("rsqrt")] = _T("rsqrt(x)|Returns 1 / sqrt(x). ");
00068         m_inst[_T("saturate")] = _T("saturate(x)|Clamps x to the range [0, 1]. ");
00069         m_inst[_T("sign")] = _T("sign(x)|Computes the sign of x. Returns -1 if x is less than 0, 0 if x equals 0, and 1 if x is greater than zero. ");
00070         m_inst[_T("sin")] = _T("sin(x)|Returns the sine of x. ");
00071         m_inst[_T("sincos")] = _T("sincos(x, out s, out c)|Returns the sine and cosine of x. sin(x) is stored in the output parameter s. cos(x) is stored in the output parameter c. ");
00072         m_inst[_T("sinh")] = _T("sinh(x)|Returns the hyperbolic sine of x. ");
00073         m_inst[_T("smoothstep")] = _T("smoothstep(min, max, x)|Returns 0 if x < min. Returns 1 if x > max. Returns a smooth Hermite interpolation between 0 and 1, if x is in the range [min, max]. ");
00074         m_inst[_T("sqrt")] = _T("sqrt(value a)|Square root (per component). ");
00075         m_inst[_T("step")] = _T("step(a, x)|Returns (x >= a) ? 1 : 0. ");
00076         m_inst[_T("tan")] = _T("tan(x)|Returns the tangent of x. ");
00077         m_inst[_T("tanh")] = _T("tanh(x)|Returns the hyperbolic tangent of x. ");
00078         m_inst[_T("tex1d")] = _T("tex1D(s, t)|1-D texture lookup. s is a sampler or a sampler1D object. t is a scalar. ");
00079         m_inst[_T("tex1d(")] = _T("tex1D(s, t, ddx, ddy)|1-D texture lookup, with derivatives. s is a sampler or sampler1D object. t, ddx, and ddy are scalars. ");
00080         m_inst[_T("tex1dproj")] = _T("tex1Dproj(s, t)|1-D projective texture lookup. s is a sampler or sampler1D object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
00081         m_inst[_T("tex1dbias")] = _T("tex1Dbias(s, t)|1-D biased texture lookup. s is a sampler or sampler1D object. t is a 4-D vector. The mip level is biased by t.w before the lookup takes place. ");
00082         m_inst[_T("tex2d")] = _T("tex2D(s, t)|2-D texture lookup. s is a sampler or a sampler2D object. t is a 2-D texture coordinate. ");
00083         m_inst[_T("tex2d(")] = _T("tex2D(s, t, ddx, ddy)|2-D texture lookup, with derivatives. s is a sampler or sampler2D object. t, ddx, and ddy are 2-D vectors. ");
00084         m_inst[_T("tex2dproj")] = _T("tex2Dproj(s, t)|2-D projective texture lookup. s is a sampler or sampler2D object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
00085         m_inst[_T("tex2dbias")] = _T("tex2Dbias(s, t)|2-D biased texture lookup. s is a sampler or sampler2D object. t is a 4-D vector. The mip level is biased by t.w before the lookup takes place. ");
00086         m_inst[_T("tex3d")] = _T("tex3D(s, t)|3-D volume texture lookup. s is a sampler or a sampler3D object. t is a 3-D texture coordinate. ");
00087         m_inst[_T("tex3d(")] = _T("tex3D(s, t, ddx, ddy)|3-D volume texture lookup, with derivatives. s is a sampler or sampler3D object. t, ddx, and ddy are 3-D vectors. ");
00088         m_inst[_T("tex3dproj")] = _T("tex3Dproj(s, t)|3-D projective volume texture lookup. s is a sampler or sampler3D object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
00089         m_inst[_T("tex3dbias")] = _T("tex3Dbias(s, t)|3-D biased texture lookup. s is a sampler or sampler3D object. t is a 4-D vector. The mip level is biased by t.w before the lookup takes place. ");
00090         m_inst[_T("texcube")] = _T("texCUBE(s, t)|3-D cube texture lookup. s is a sampler or a samplerCUBE object. t is a 3-D texture coordinate. ");
00091         m_inst[_T("texcube(")] = _T("texCUBE(s, t, ddx, ddy)|3-D cube texture lookup, with derivatives. s is a sampler or samplerCUBE object. t, ddx, and ddy are 3-D vectors. ");
00092         m_inst[_T("texcubeproj")] = _T("texCUBEproj(s, t)|3-D projective cube texture lookup. s is a sampler or samplerCUBE object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
00093         m_inst[_T("texcubebias")] = _T("texCUBEbias(s, t)|3-D biased cube texture lookup. s is a sampler or samplerCUBE object. t is a 4-dimensional vector. The mip level is biased by t.w before the lookup takes place.  ");
00094         m_inst[_T("transpose")] = _T("transpose(m)|Returns the transpose of the matrix m. If the source is dimension mrows x mcolumns, the result is dimension mcolumns x mrows. ");
00095 }
00096 
00097 CShaderAutoCompleteDlg::~CShaderAutoCompleteDlg()
00098 {
00099 }
00100 
00101 void CShaderAutoCompleteDlg::DoDataExchange(CDataExchange* pDX)
00102 {
00103         __super::DoDataExchange(pDX);
00104         DDX_Control(pDX, IDC_LIST1, m_list);
00105 }
00106 
00107 
00108 BEGIN_MESSAGE_MAP(CShaderAutoCompleteDlg, CResizableDialog)
00109         ON_WM_SETFOCUS()
00110         ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
00111         ON_WM_SHOWWINDOW()
00112 END_MESSAGE_MAP()
00113 
00114 
00115 // CShaderAutoCompleteDlg message handlers
00116 
00117 BOOL CShaderAutoCompleteDlg::OnInitDialog()
00118 {
00119         CResizableDialog::OnInitDialog();
00120 
00121         AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
00122 
00123         m_hToolTipWnd = CreateWindowEx(
00124                 WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, TTS_NOPREFIX | TTS_ALWAYSTIP,
00125                 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
00126                 NULL, NULL, NULL, NULL);
00127 
00128         memset(&m_ti, 0, sizeof(m_ti));
00129         m_ti.cbSize = sizeof(TOOLINFO);
00130         m_ti.uFlags = TTF_ABSOLUTE|TTF_TRACK;
00131         m_ti.hwnd = m_hWnd;
00132         m_ti.lpszText = m_text;
00133 
00134         ::SendMessage(m_hToolTipWnd, TTM_ADDTOOL, 0, (LPARAM)&m_ti);
00135         ::SendMessage(m_hToolTipWnd, TTM_SETMAXTIPWIDTH, 0, (LPARAM)400);
00136 
00137         return TRUE;  // return TRUE unless you set the focus to a control
00138         // EXCEPTION: OCX Property Pages should return FALSE
00139 }
00140 
00141 void CShaderAutoCompleteDlg::OnSetFocus(CWnd* pOldWnd)
00142 {
00143         __super::OnSetFocus(pOldWnd);
00144 
00145         GetParent()->SetFocus();
00146 }
00147 
00148 void CShaderAutoCompleteDlg::OnLbnSelchangeList1()
00149 {
00150         ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
00151 
00152         int i = m_list.GetCurSel();
00153         if(i < 0) return;
00154 
00155         if(POSITION pos = (POSITION)m_list.GetItemData(i))
00156         {
00157                 CString str, desc;
00158                 m_inst.GetNextAssoc(pos, str, desc);
00159                 CList<CString> sl;
00160                 Explode(desc, sl, '|', 2);
00161                 if(sl.GetCount() != 2) return;
00162                 _tcscpy(m_ti.lpszText, sl.RemoveTail());
00163                 CRect r;
00164                 GetWindowRect(r);
00165                 ::SendMessage(m_hToolTipWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)&m_ti);
00166                 ::SendMessage(m_hToolTipWnd, TTM_TRACKPOSITION, 0, (LPARAM)MAKELONG(r.left, r.bottom+1));
00167                 ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, TRUE, (LPARAM)&m_ti);
00168         }
00169 }
00170 
00171 void CShaderAutoCompleteDlg::OnShowWindow(BOOL bShow, UINT nStatus)
00172 {
00173         CResizableDialog::OnShowWindow(bShow, nStatus);
00174 
00175         if(!bShow)
00176         {
00177                 ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
00178         }
00179 }

Generated on Tue Dec 13 14:47:04 2005 for guliverkli by  doxygen 1.4.5