示例#1
0
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);
}
示例#2
0
//------------------------------------------------------------------------------
Integer If::GetIntegerParameter(const wxString &label) const
{
   return GetIntegerParameter(GetParameterID(label));
}
示例#3
0
void AwtDesktopProperties::GetCaretParameters() {
    SetIntegerProperty(TEXT("win.caret.width"), GetIntegerParameter(SPI_GETCARETWIDTH));
}
示例#4
0
//------------------------------------------------------------------------------
Integer     CalculatedPoint::GetIntegerParameter(const std::string &label) const
{
   return GetIntegerParameter(GetParameterID(label)); 
}
示例#5
0
//------------------------------------------------------------------------------
Integer Array::GetIntegerParameter(const std::string &label) const
{
   return GetIntegerParameter(GetParameterID(label));
}
示例#6
0
//------------------------------------------------------------------------------
std::string Array::GetInitialValueString(const std::string &prefix)
{
   #ifdef DEBUG_INITIAL_VALUE
   MessageInterface::ShowMessage
      ("Array::GetInitialValueString() '%s' entered\n", GetName().c_str());
   #endif
   
   std::stringstream data;
   bool writeGmatKeyword = GmatGlobal::Instance()->IsWritingGmatKeyword();
   
   Integer row = GetIntegerParameter("NumRows");
   Integer col = GetIntegerParameter("NumCols");
   
   for (Integer i = 0; i < row; ++i)
   {
      //loj: Do not write if value is zero since default is zero(03/27/07)
      for (Integer j = 0; j < col; ++j)
      {
         Real realVal = GetRealParameter(SINGLE_VALUE, i, j);
         #ifdef DEBUG_INITIAL_VALUE
         MessageInterface::ShowMessage("   value = %f\n", realVal);
         #endif
         
         if (realVal != 0.0)
         {
            //========================================================
            #ifndef __WRITE_INITIAL_VALUE_STRING__
            //========================================================
            
            // This writes out actual value
            // We now write out GMAT prefix on option from the startup file (see GMT-3233)
            if (writeGmatKeyword)
               data << "GMAT " << instanceName << "(" << i+1 << ", " << j+1 <<
                  ") = " <<  GmatStringUtil::ToString(realVal, 16, false, 1) << ";";
            else
               data << instanceName << "(" << i+1 << ", " << j+1 <<
                  ") = " <<  GmatStringUtil::ToString(realVal, 16, false, 1) << ";";
            data << GetInlineComment() + "\n";
            
            //========================================================
            #else
            //========================================================
            
            // This writes out initial value string (LOJ: 2010.09.21)
            std::string mapstr = GmatStringUtil::ToString(i+1, 1) + "," +
               GmatStringUtil::ToString(j+1, 1);
            
            #ifdef DEBUG_INITIAL_VALUE
            MessageInterface::ShowMessage
               ("Array::GetInitialValueString() mapstr='%s'\n", mapstr.c_str());
            #endif
            
            std::string initialVal = "No Initial Value";
            bool writeData = false;
            
            if (initialValueMap.find(mapstr) != initialValueMap.end())
               initialVal = initialValueMap[mapstr];
            
            #ifdef DEBUG_INITIAL_VALUE
            MessageInterface::ShowMessage("   initialVal='%s'\n", initialVal.c_str());
            #endif
            
            if (GmatStringUtil::IsNumber(initialVal))
               if (mInitialValueType == 1)
                  writeData = true;
               else
                  writeData = false;
            else
               if (mInitialValueType == 1)
                  writeData = false;
               else
                  writeData = true;
            
            if (writeData)
            {
               // We now write out GMAT prefix on option from the startup file (see GMT-3233)
               if (writeGmatKeyword)
                  data << prefix << "GMAT " << instanceName << "(" << i+1 << ", " << j+1 << ") = " << initialVal;
               else
                  data << prefix << instanceName << "(" << i+1 << ", " << j+1 << ") = " << initialVal;
               data << GetInlineComment() + "\n";
            }
            
            //========================================================
            #endif
            //========================================================
         }
      }
   }
   
   return data.str();
}