Ejemplo n.º 1
0
void readSettings()
{
	settings.showErrors = GetRCBoolDef("LSActiveDesktopShowErrors", TRUE) != FALSE;

	char line[MAX_LINE_LENGTH + 1];
	const char *tokenStart = line;
	char token[MAX_LINE_LENGTH + 1];
	GetRCLine("LSActiveDesktopWebWindows", line, MAX_LINE_LENGTH + 1, NULL);
	while (GetToken(tokenStart, token, &tokenStart, false)) {
		std::string name(token);
		std::transform(name.begin(), name.end(), name.begin(), tolower);

		LSADWebWndProp props;
		props.x = GetRCCoordinate((name + "X").c_str(), 0, GetSystemMetrics(SM_CXVIRTUALSCREEN));
		props.y = GetRCCoordinate((name + "Y").c_str(), 0, GetSystemMetrics(SM_CYVIRTUALSCREEN));
		props.width = GetRCInt((name + "Width").c_str(), 100);
		props.height = GetRCInt((name + "Height").c_str(), 100);
		props.showScrollbars = !(GetRCBool((name + "HideScrollbars").c_str(), TRUE) != FALSE);

		char url[MAX_LINE_LENGTH + 1];
		GetRCString((name + "URL").c_str(), url, "http://tlundberg.com", MAX_LINE_LENGTH + 1);
		props.url = url;

		settings.windowProperties.insert(make_pair(name, props));
	}
}
Ejemplo n.º 2
0
void Label::ReadConfig()
{
    // Background and Borders
    TCHAR backgroundImageFile[MAX_PATH];
    
    mBackgroundColor = GetRCColor(mName, "BackgroundColor", RGB(255, 255, 255));
    GetRCString(mName, "BackgroundImage", backgroundImageFile, NULL, MAX_PATH);
    mBackgroundImage = LoadLSImage(backgroundImageFile, NULL);
    mBackgroundImageBorderTop = GetRCInt(mName, "BackgroundImageBorderTop", 0);
    mBackgroundImageBorderRight = GetRCInt(mName, "BackgroundImageBorderRight", 0);
    mBackgroundImageBorderBottom = GetRCInt(mName, "BackgroundImageBorderBottom", 0);
    mBackgroundImageBorderLeft = GetRCInt(mName, "BackgroundImageBorderLeft", 0);
    mBackgroundImageTile = GetRCEnum(mName, "BackgroundImageTile", gBackgroundImageTileEnum);
    mBorderColorTop = GetRCColor(mName, "BorderColorTop", RGB(0, 0, 0));
    mBorderColorRight = GetRCColor(mName, "BorderColorRight", RGB(0, 0, 0));
    mBorderColorBottom = GetRCColor(mName, "BorderColorBottom", RGB(0, 0, 0));
    mBorderColorLeft = GetRCColor(mName, "BorderColorLeft", RGB(0, 0, 0));
    mBorderTop = GetRCInt(mName, "BorderTop", 0);
    mBorderRight = GetRCInt(mName, "BorderRight", 0);
    mBorderBottom = GetRCInt(mName, "BorderBottom", 0);
    mBorderLeft = GetRCInt(mName, "BorderLeft", 0);
    
    // Font
    TCHAR fontName[LF_FACESIZE];
    int fontHeight;
    bool fontBold;
    bool fontItalic;
    bool fontUnderline;
    
    GetRCString(mName, "Font", fontName, "Arial", LF_FACESIZE);
    fontHeight = GetRCInt(mName, "FontHeight", 15);
    fontBold = GetRCBoolDef(mName, "FontBold", FALSE);
    fontItalic = GetRCBoolDef(mName, "FontItalic", FALSE);
    fontUnderline = GetRCBoolDef(mName, "FontUnderline", FALSE);
    mFont = CreateSimpleFont(fontName, fontHeight, fontBold, fontItalic, fontUnderline);
    mFontColor = GetRCColor(mName, "FontColor", RGB(0, 0, 0));
    mFontShadow = GetRCBoolDef(mName, "FontShadow", FALSE);
    mFontShadowColor = GetRCColor(mName, "FontShadowColor", RGB(128, 128, 128));
    mFontShadowOffsetX = GetRCInt(mName, "FontShadowOffsetX", 1);
    mFontShadowOffsetY = GetRCInt(mName, "FontShadowOffsetY", 1);
    
    // Layout
    mAlign = GetRCEnum(mName, "Align", gAlignEnum);
    mImagePosition = GetRCEnum(mName, "ImagePosition", gImagePositionEnum);
    mImageTextGap = GetRCInt(mName, "ImageTextGap", 4);
    mPaddingLeft = GetRCInt(mName, "PaddingLeft", 0);
    mPaddingTop = GetRCInt(mName, "PaddingTop", 0);
    mPaddingRight = GetRCInt(mName, "PaddingRight", 0);
    mPaddingBottom = GetRCInt(mName, "PaddingBottom", 0);
    mVerticalAlign = GetRCEnum(mName, "VerticalAlign", gVerticalAlignEnum);
    
    // Content
    TCHAR imageFile[MAX_PATH];
    
    GetRCString(mName, "Image", imageFile, NULL, MAX_PATH);
    mImage = LoadLSImage(imageFile, NULL);
    GetRCString(mName, "Text", mText, NULL, MAX_TEXT);
    
    // Position and Size
    mAlwaysOnTop = GetRCBoolDef(mName, "AlwaysOnTop", FALSE);
    mVisible = !GetRCBoolDef(mName, "StartHidden", FALSE);
    mX = GetRCInt(mName, "X", 0);
    mY = GetRCInt(mName, "Y", 0);
    mWidth = GetRCInt(mName, "Width", 64);
    mHeight = GetRCInt(mName, "Height", 64);
}