void AwtDesktopProperties::GetIconParameters() { // // icon properties // ICONMETRICS iconmetrics; iconmetrics.cbSize = sizeof(iconmetrics); VERIFY( SystemParametersInfo(SPI_GETICONMETRICS, iconmetrics.cbSize, &iconmetrics, FALSE) ); SetIntegerProperty(TEXT("win.icon.hspacing"), iconmetrics.iHorzSpacing); SetIntegerProperty(TEXT("win.icon.vspacing"), iconmetrics.iVertSpacing); SetBooleanProperty(TEXT("win.icon.titleWrappingOn"), iconmetrics.iTitleWrap != 0); SetFontProperty(TEXT("win.icon.font"), iconmetrics.lfFont); }
// // Reads Windows parameters and sets the corresponding values // in WDesktopProperties // void AwtDesktopProperties::GetWindowsParameters() { if (GetEnv()->EnsureLocalCapacity(MAX_PROPERTIES) < 0) { DASSERT(0); return; } // this number defines the set of properties available, it is incremented // whenever more properties are added (in a public release of course) // for example, version 1 defines the properties available in Java SDK version 1.3. SetIntegerProperty( TEXT("win.properties.version"), AWT_DESKTOP_PROPERTIES_VERSION); GetNonClientParameters(); GetIconParameters(); GetColorParameters(); GetOtherParameters(); GetSoundEvents(); GetSystemProperties(); if (IS_WINXP) { GetXPStyleProperties(); } }
void AwtDesktopProperties::GetOtherParameters() { // TODO BEGIN: On NT4, some setttings don't trigger WM_SETTINGCHANGE -- // check whether this has been fixed on Windows 2000 and Windows 98 // ECH 10/6/2000 seems to be fixed on NT4 SP5, but not on 98 SetBooleanProperty(TEXT("win.frame.fullWindowDragsOn"), GetBooleanParameter(SPI_GETDRAGFULLWINDOWS)); SetBooleanProperty(TEXT("win.text.fontSmoothingOn"), GetBooleanParameter(SPI_GETFONTSMOOTHING)); // TODO END if (IS_WINXP) { SetIntegerProperty(TEXT("win.text.fontSmoothingType"), GetIntegerParameter(SPI_GETFONTSMOOTHINGTYPE)); SetIntegerProperty(TEXT("win.text.fontSmoothingContrast"), GetIntegerParameter(SPI_GETFONTSMOOTHINGCONTRAST)); SetIntegerProperty(TEXT("win.text.fontSmoothingOrientation"), GetLCDSubPixelOrder()); } int cxdrag = GetSystemMetrics(SM_CXDRAG); int cydrag = GetSystemMetrics(SM_CYDRAG); SetIntegerProperty(TEXT("win.drag.width"), cxdrag); SetIntegerProperty(TEXT("win.drag.height"), cydrag); SetIntegerProperty(TEXT("DnD.gestureMotionThreshold"), max(cxdrag, cydrag)/2); SetIntegerProperty(TEXT("awt.mouse.numButtons"), GetSystemMetrics(SM_CMOUSEBUTTONS)); SetIntegerProperty(TEXT("awt.multiClickInterval"), GetDoubleClickTime()); // BEGIN cross-platform properties // Note that these are cross-platform properties, but are being stuck into // WDesktopProperties. WToolkit.lazilyLoadDesktopProperty() can find them, // but if a Toolkit subclass uses the desktopProperties // member, these properties won't be there. -bchristi, echawkes // This property is called "win.frame.fullWindowDragsOn" above // This is one of the properties that don't trigger WM_SETTINGCHANGE SetBooleanProperty(TEXT("awt.dynamicLayoutSupported"), GetBooleanParameter(SPI_GETDRAGFULLWINDOWS)); // 95 MouseWheel support // More or less copied from the MSH_MOUSEWHEEL MSDN entry if (IS_WIN95 && !IS_WIN98) { HWND hdlMSHWHEEL = NULL; UINT msgMSHWheelSupported = NULL; BOOL wheelSupported = FALSE; msgMSHWheelSupported = RegisterWindowMessage(MSH_WHEELSUPPORT); hdlMSHWHEEL = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE); if (hdlMSHWHEEL && msgMSHWheelSupported) { wheelSupported = (BOOL)::SendMessage(hdlMSHWHEEL, msgMSHWheelSupported, 0, 0); } SetBooleanProperty(TEXT("awt.wheelMousePresent"), wheelSupported); } else { SetBooleanProperty(TEXT("awt.wheelMousePresent"), ::GetSystemMetrics(SM_MOUSEWHEELPRESENT)); } // END cross-platform properties if (IS_WIN98 || IS_WIN2000) { //DWORD menuShowDelay; //SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &menuShowDelay, 0); // SetIntegerProperty(TEXT("win.menu.showDelay"), menuShowDelay); SetBooleanProperty(TEXT("win.frame.captionGradientsOn"), GetBooleanParameter(SPI_GETGRADIENTCAPTIONS)); SetBooleanProperty(TEXT("win.item.hotTrackingOn"), GetBooleanParameter(SPI_GETHOTTRACKING)); } if (IS_WIN2000) { SetBooleanProperty(TEXT("win.menu.keyboardCuesOn"), GetBooleanParameter(SPI_GETKEYBOARDCUES)); } // High contrast accessibility property HIGHCONTRAST contrast; contrast.cbSize = sizeof(HIGHCONTRAST); if (SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST), &contrast, 0) != 0 && (contrast.dwFlags & HCF_HIGHCONTRASTON) == HCF_HIGHCONTRASTON) { SetBooleanProperty(TEXT("win.highContrast.on"), TRUE); } else { SetBooleanProperty(TEXT("win.highContrast.on"), FALSE); } if (fn_SHGetSettings != NULL) { SHELLFLAGSTATE sfs; fn_SHGetSettings(&sfs, SSF_SHOWALLOBJECTS | SSF_SHOWATTRIBCOL); if (sfs.fShowAllObjects) { SetBooleanProperty(TEXT("awt.file.showHiddenFiles"), TRUE); } else { SetBooleanProperty(TEXT("awt.file.showHiddenFiles"), FALSE); } if (sfs.fShowAttribCol) { SetBooleanProperty(TEXT("awt.file..showAttribCol"), TRUE); } else { SetBooleanProperty(TEXT("awt.file.showAttribCol"), FALSE); } } LPTSTR value; DWORD valueType; // Shell Icon BPP - only honored on platforms before XP value = getWindowsPropFromReg(TEXT("Control Panel\\Desktop\\WindowMetrics"), TEXT("Shell Icon BPP"), &valueType); if (value != NULL) { if (valueType == REG_SZ) { SetStringProperty(TEXT("win.icon.shellIconBPP"), value); } free(value); } // The following registry settings control the file chooser places bar // under the Windows L&F. These settings are not present by default, but // can be enabled using the TweakUI tool from Microsoft. For more info, // see http://msdn.microsoft.com/msdnmag/issues/1100/Registry/ // NoPlacesBar is a REG_DWORD, with values 0 or 1 value = getWindowsPropFromReg(TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\comdlg32"), TEXT("NoPlacesBar"), &valueType); if (value != NULL) { if (valueType == REG_DWORD) { SetBooleanProperty(TEXT("win.comdlg.noPlacesBar"), (BOOL)((int)*value != 0)); } free(value); } LPTSTR valueName = TEXT("PlaceN"); LPTSTR valueNameBuf = (LPTSTR)safe_Malloc((lstrlen(valueName) + 1) * sizeof(TCHAR)); lstrcpy(valueNameBuf, valueName); LPTSTR propKey = TEXT("win.comdlg.placesBarPlaceN"); LPTSTR propKeyBuf = (LPTSTR)safe_Malloc((lstrlen(propKey) + 1) * sizeof(TCHAR)); lstrcpy(propKeyBuf, propKey); int i = 0; do { valueNameBuf[5] = _T('0' + i++); propKeyBuf[25] = valueNameBuf[5]; LPTSTR key = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\comdlg32\\PlacesBar"); if ((value = getWindowsPropFromReg(key, valueNameBuf, &valueType)) != NULL) { if (valueType == REG_DWORD) { // Value is a CSIDL SetIntegerProperty(propKeyBuf, (int)*value); } else { // Value is a path SetStringProperty(propKeyBuf, value); } free(value); } } while (value != NULL); free(valueNameBuf); free(propKeyBuf); }
void AwtDesktopProperties::GetNonClientParameters() { // // general window properties // NONCLIENTMETRICS ncmetrics; ncmetrics.cbSize = sizeof(ncmetrics); VERIFY( SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncmetrics.cbSize, &ncmetrics, FALSE) ); SetFontProperty( TEXT("win.frame.captionFont"), ncmetrics.lfCaptionFont ); SetIntegerProperty( TEXT("win.frame.captionHeight"), ncmetrics.iCaptionHeight ); SetIntegerProperty( TEXT("win.frame.captionButtonWidth"), ncmetrics.iCaptionWidth ); SetIntegerProperty( TEXT("win.frame.captionButtonHeight"), ncmetrics.iCaptionHeight ); SetFontProperty( TEXT("win.frame.smallCaptionFont"), ncmetrics.lfSmCaptionFont ); SetIntegerProperty( TEXT("win.frame.smallCaptionHeight"), ncmetrics.iSmCaptionHeight ); SetIntegerProperty( TEXT("win.frame.smallCaptionButtonWidth"), ncmetrics.iSmCaptionWidth ); SetIntegerProperty( TEXT("win.frame.smallCaptionButtonHeight"), ncmetrics.iSmCaptionHeight ); SetIntegerProperty( TEXT("win.frame.sizingBorderWidth"), ncmetrics.iBorderWidth ); // menu properties SetFontProperty( TEXT("win.menu.font"), ncmetrics.lfMenuFont ); SetIntegerProperty( TEXT("win.menu.height"), ncmetrics.iMenuHeight ); SetIntegerProperty( TEXT("win.menu.buttonWidth"), ncmetrics.iMenuWidth ); // scrollbar properties SetIntegerProperty( TEXT("win.scrollbar.width"), ncmetrics.iScrollWidth ); SetIntegerProperty( TEXT("win.scrollbar.height"), ncmetrics.iScrollHeight ); // status bar and tooltip properties SetFontProperty( TEXT("win.status.font"), ncmetrics.lfStatusFont ); SetFontProperty( TEXT("win.tooltip.font"), ncmetrics.lfStatusFont ); // message box properties SetFontProperty( TEXT("win.messagebox.font"), ncmetrics.lfMessageFont ); }
void MP4File::Make3GPCompliant(const char* fileName, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount, bool deleteIodsAtom) { char brand[5] = "3gp5"; char* _3gpSupportedBrands[1] = { (char*)&brand }; if (majorBrand) { if (!supportedBrands || !supportedBrandsCount) { throw new MP4Error("Invalid parameters", "MP4File::Make3GPCompliant"); } } m_fileName = MP4Stralloc(fileName); m_mode = 'r'; // first load meta-info into memory Open("rb"); ReadFromFile(); CacheProperties(); // of moov atom // now switch over to writing the new file MP4Free(m_fileName); // create a temporary file m_fileName = MP4Stralloc(TempFileName()); MakeFtypAtom( majorBrand ? majorBrand : (char*)brand, majorBrand ? minorVersion : _3GP_MINOR_VERSION, majorBrand ? supportedBrands : (char**)_3gpSupportedBrands, majorBrand ? supportedBrandsCount : 1); if (deleteIodsAtom) { // Delete the iods atom, if it exists.... MP4Atom* iodsAtom = m_pRootAtom->FindAtom("moov.iods"); if (iodsAtom) { MP4Atom* moovAtom = m_pRootAtom->FindAtom("moov"); ASSERT(moovAtom); moovAtom->DeleteChildAtom(iodsAtom); } } FILE* pReadFile = m_pFile; m_pFile = NULL; m_mode = 'w'; Open("wb"); SetIntegerProperty("moov.mvhd.modificationTime", MP4GetAbsTimestamp()); // writing meta info in the optimal order ((MP4RootAtom*)m_pRootAtom)->BeginOptimalWrite(); // write data in optimal order RewriteMdat(pReadFile, m_pFile); // finish writing ((MP4RootAtom*)m_pRootAtom)->FinishOptimalWrite(); // cleanup fclose(m_pFile); m_pFile = NULL; fclose(pReadFile); // move temporary file into place Rename(m_fileName, fileName); }
void AwtDesktopProperties::GetCaretParameters() { SetIntegerProperty(TEXT("win.caret.width"), GetIntegerParameter(SPI_GETCARETWIDTH)); }
void AwtDesktopProperties::GetNonClientParameters() { // // general window properties // NONCLIENTMETRICS ncmetrics; // Fix for 6944516: specify correct size for ncmetrics on WIN2K/XP // Microsoft recommend to subtract the size of 'iPaddedBorderWidth' field // when running on XP. However this can't be referenced at compile time // with the older SDK, so there use 'lfMessageFont' plus its size. if (!IS_WINVISTA) { #if defined(_MSC_VER) && (_MSC_VER >= 1600) ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth); #else ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT); #endif } else { ncmetrics.cbSize = sizeof(ncmetrics); } VERIFY( SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncmetrics.cbSize, &ncmetrics, FALSE) ); float invScaleX; float invScaleY; getInvScale(invScaleX, invScaleY); SetFontProperty(TEXT("win.frame.captionFont"), ncmetrics.lfCaptionFont, invScaleY); SetIntegerProperty(TEXT("win.frame.captionHeight"), rescale(ncmetrics.iCaptionHeight, invScaleY)); SetIntegerProperty(TEXT("win.frame.captionButtonWidth"), rescale(ncmetrics.iCaptionWidth, invScaleX)); SetIntegerProperty(TEXT("win.frame.captionButtonHeight"), rescale(ncmetrics.iCaptionHeight, invScaleY)); SetFontProperty(TEXT("win.frame.smallCaptionFont"), ncmetrics.lfSmCaptionFont, invScaleY); SetIntegerProperty(TEXT("win.frame.smallCaptionHeight"), rescale(ncmetrics.iSmCaptionHeight, invScaleY)); SetIntegerProperty(TEXT("win.frame.smallCaptionButtonWidth"), rescale(ncmetrics.iSmCaptionWidth, invScaleX)); SetIntegerProperty(TEXT("win.frame.smallCaptionButtonHeight"), rescale(ncmetrics.iSmCaptionHeight, invScaleY)); SetIntegerProperty(TEXT("win.frame.sizingBorderWidth"), rescale(ncmetrics.iBorderWidth, invScaleX)); // menu properties SetFontProperty(TEXT("win.menu.font"), ncmetrics.lfMenuFont, invScaleY); SetIntegerProperty(TEXT("win.menu.height"), rescale(ncmetrics.iMenuHeight, invScaleY)); SetIntegerProperty(TEXT("win.menu.buttonWidth"), rescale(ncmetrics.iMenuWidth, invScaleX)); // scrollbar properties SetIntegerProperty(TEXT("win.scrollbar.width"), rescale(ncmetrics.iScrollWidth, invScaleX)); SetIntegerProperty(TEXT("win.scrollbar.height"), rescale(ncmetrics.iScrollHeight, invScaleY)); // status bar and tooltip properties SetFontProperty(TEXT("win.status.font"), ncmetrics.lfStatusFont, invScaleY); SetFontProperty(TEXT("win.tooltip.font"), ncmetrics.lfStatusFont, invScaleY); // message box properties SetFontProperty(TEXT("win.messagebox.font"), ncmetrics.lfMessageFont, invScaleY); }