static BOOL GetStringFromRegistry(const char *name, char *result, size_t length, int where) { if (GetFromRegistry(name, where, REG_SZ, result, (DWORD)length)) { return (TRUE); } return (FALSE); }
static int GetIntFromRegistry(const char *name, int defvalue, int where) { DWORD param; if (GetFromRegistry(name, where, REG_DWORD, ¶m, sizeof(param))) { return ((int)param); } return (defvalue); }
int LuaScript::ExecChunkFromReg( LuaRegRef r, UINT args ) { GetFromRegistry( Lst, r ); int i = lua_gettop( Lst ) - args; if (i <= 0) i = 1; lua_insert( Lst, i ); return ExecChunk( args ); }
HRESULT GetFromRegistry(TCHAR* szRegValueName, WCHAR wzValue[MAX_PATH]) { return GetFromRegistry(HKEY_CURRENT_USER, REG_GScrollKey, szRegValueName, wzValue); }
HRESULT GetFromRegistry(TCHAR* szRegValueName, DWORD *pdwValue) { return GetFromRegistry(HKEY_CURRENT_USER, REG_GScrollKey, szRegValueName, pdwValue); }
void ButtonLabel::GetButtonPosition(unsigned i, RECT rc, int *x, int *y, int *sizex, int *sizey) { TCHAR reggeompx[50]; TCHAR reggeompy[50]; TCHAR reggeomsx[50]; TCHAR reggeomsy[50]; _stprintf(reggeompx, TEXT("ScreenButtonPosX%d"), i); _stprintf(reggeompy, TEXT("ScreenButtonPosY%d"), i); _stprintf(reggeomsx, TEXT("ScreenButtonSizeX%d"), i); _stprintf(reggeomsy, TEXT("ScreenButtonSizeY%d"), i); GetFromRegistry(reggeompx,*x); GetFromRegistry(reggeompy,*y); GetFromRegistry(reggeomsx,*sizex); GetFromRegistry(reggeomsy,*sizey); bool geometrychanged = true; // JMW testing if ((*sizex == 0) || (*sizey == 0) || geometrychanged) { // not defined in registry so go with defaults // these will be saved back to registry int hwidth = (rc.right - rc.left) / 4; int hheight = (rc.bottom - rc.top) / 4; switch (ButtonLabelGeometry) { case 0: // portrait if (i == 0) { *sizex = IBLSCALE(52); *sizey = IBLSCALE(37); *x = rc.left - (*sizex); // JMW make it offscreen for now *y = rc.bottom - (*sizey); } else { if (i < 5) { *sizex = IBLSCALE(52); *sizey = IBLSCALE(40); *x = rc.left + 3 + hwidth * (i - 1); *y = rc.bottom - (*sizey); } else { *sizex = IBLSCALE(80); *sizey = IBLSCALE(40); *x = rc.right - (*sizex); int k = rc.bottom - rc.top - IBLSCALE(46); if (is_altair()) { k = rc.bottom - rc.top; // JMW need upside down button order for rotated Altair *y = rc.bottom - (i - 5) * k / 5 - (*sizey) - IBLSCALE(20); } else { *y = rc.top + (i - 5) * k / 6 + (*sizey / 2 + IBLSCALE(3)); } } } break; case 1: // landscape hwidth = (rc.right - rc.left) / 5; hheight = (rc.bottom - rc.top) / 5; if (i == 0) { *sizex = IBLSCALE(52); *sizey = IBLSCALE(20); *x = rc.left - (*sizex); // JMW make it offscreen for now *y = (rc.top); } else { if (i < 5) { *sizex = IBLSCALE(52); *sizey = is_altair() ? IBLSCALE(20) : IBLSCALE(35); *x = rc.left + 3; *y = (rc.top + hheight * i - (*sizey) / 2); } else { *sizex = IBLSCALE(60); *sizey = is_altair() ? IBLSCALE(40) : IBLSCALE(35); *x = rc.left + hwidth * (i - 5); *y = (rc.bottom - (*sizey)); } } break; } SetToRegistry(reggeompx, *x); SetToRegistry(reggeompy, *y); SetToRegistry(reggeomsx, *sizex); SetToRegistry(reggeomsy, *sizey); } }