Ejemplo n.º 1
0
void RegistryWriteFont(CHARFORMAT* cf)
{
    RegWriteStr("FontName", cf->szFaceName);
    RegWriteInt("FontSize", cf->yHeight);
    RegWriteInt("FontWeight", (cf->dwEffects & CFE_BOLD ? 1 : 0));
    RegWriteInt("FontItalic", (cf->dwEffects & CFE_ITALIC ? 1 : 0));
}
Ejemplo n.º 2
0
void WcmConfig::Save( NCWin* nc )
{
	if ( nc )
	{
		leftPanelPath = new_char_str( nc->GetLeftPanel()->GetPath().GetUtf8() );
		rightPanelPath = new_char_str( nc->GetRightPanel()->GetPath().GetUtf8() );
		crect Rect = nc->ScreenRect();
		windowX = Rect.top;
		windowY = Rect.left;
		windowWidth = Rect.Width();
		windowHeight = Rect.Height();
	}
	
#ifdef _WIN32
	for (int i = 0; i<mapList.count(); i++)
	{
		Node &node = mapList[i];
		if (node.type == MT_BOOL && node.ptr.pBool != 0)
			RegWriteInt(node.section, node.name, *node.ptr.pBool);
		else
		if (node.type == MT_INT && node.ptr.pInt != 0)
			RegWriteInt(node.section, node.name, *node.ptr.pInt);
		else
		if (node.type == MT_STR && node.ptr.pStr != 0)
			RegWriteString(node.section, node.name, node.ptr.pStr->ptr());
	}
#else 
	IniHash hash;
	FSPath path = configDirPath;
	path.Push(CS_UTF8, "config");
	hash.Load((sys_char_t*)path.GetString(sys_charset_id));

	for (int i = 0; i<mapList.count(); i++)
	{
		Node &node = mapList[i];
		if (node.type == MT_BOOL && node.ptr.pBool != 0)
			hash.SetBoolValue(node.section, node.name, *node.ptr.pBool);
		else
		if (node.type == MT_INT && node.ptr.pInt != 0)
			hash.SetIntValue(node.section, node.name, *node.ptr.pInt);
		else
		if (node.type == MT_STR && node.ptr.pStr != 0)
			hash.SetStrValue(node.section, node.name, node.ptr.pStr->ptr());
	}
	
	hash.Save((sys_char_t*)path.GetString(sys_charset_id));
#endif
}
bool SaveViewerSettings (const char *filename)
{
	LONG lResult;           // Registry function result code
	DWORD dwDisposition;    // Type of key opening event

	HKEY hModelKey;
	lResult = RegViewerSettingsKey( filename, &hModelKey, &dwDisposition);

	if (lResult != ERROR_SUCCESS)  // Failure
		return false;

	RegWriteQAngle( hModelKey, "Rot", g_viewerSettings.rot );
	RegWriteVector( hModelKey, "Trans", g_viewerSettings.trans );
	RegWriteColor( hModelKey, "bgColor", g_viewerSettings.bgColor );
	RegWriteColor( hModelKey, "gColor", g_viewerSettings.gColor );
	RegWriteColor( hModelKey, "lColor", g_viewerSettings.lColor );
	RegWriteColor( hModelKey, "aColor", g_viewerSettings.aColor );
	RegWriteQAngle( hModelKey, "lightrot", g_viewerSettings.lightrot );
	RegWriteInt( hModelKey, "sequence", g_viewerSettings.sequence );
	RegWriteInt( hModelKey, "overlaySequence0", g_viewerSettings.overlaySequence[0] );
	RegWriteFloat( hModelKey, "overlayWeight0", g_viewerSettings.overlayWeight[0] );
	RegWriteInt( hModelKey, "overlaySequence1", g_viewerSettings.overlaySequence[1] );
	RegWriteFloat( hModelKey, "overlayWeight1", g_viewerSettings.overlayWeight[1] );
	RegWriteInt( hModelKey, "overlaySequence2", g_viewerSettings.overlaySequence[2] );
	RegWriteFloat( hModelKey, "overlayWeight2", g_viewerSettings.overlayWeight[2] );
	RegWriteInt( hModelKey, "overlaySequence3", g_viewerSettings.overlaySequence[3] );
	RegWriteFloat( hModelKey, "overlayWeight3", g_viewerSettings.overlayWeight[3] );
	RegWriteInt( hModelKey, "renderwidth", g_viewerSettings.width );
	RegWriteInt( hModelKey, "renderheight", g_viewerSettings.height );
	RegWriteFloat( hModelKey, "speedscale", g_viewerSettings.speedScale );
	RegWriteInt( hModelKey, "viewermode", g_viewerSettings.application_mode );
	RegWriteInt( hModelKey, "thumbnailsize", g_viewerSettings.thumbnailsize );
	RegWriteInt( hModelKey, "speechapiindex", g_viewerSettings.speechapiindex );




	return true;
}
bool SaveViewerSettingsInt ( const char *keyname, int value )
{
	LONG lResult;           // Registry function result code
	DWORD dwDisposition;    // Type of key opening event

	HKEY hModelKey;
	lResult = RegViewerSettingsKey( "hlfaceposer", &hModelKey, &dwDisposition);

	if (lResult != ERROR_SUCCESS)  // Failure
		return false;

	RegWriteInt( hModelKey, keyname, value );
	return true;
}
Ejemplo n.º 5
0
void RegistryWriteWindowPos(HWND hWnd)
{
    RECT rc;
    int Maximized;

    // The user has closed while the app is minimized
    // The current values are wrong, who knows what the correct
    // ones are, so just be safe and store nothing
    if (IsIconic(hWnd))
        return;

    Maximized = (IsZoomed(hWnd) ? 1 : 0);
    RegWriteInt("WindowMaximized", Maximized);

    if (Maximized)
        return;

    GetWindowRect(hWnd, &rc);
    RegWriteInt("WindowLeft", rc.left);
    RegWriteInt("WindowTop", rc.top);
    RegWriteInt("WindowWidth", rc.right - rc.left);
    RegWriteInt("WindowHeight", rc.bottom - rc.top);
}
Ejemplo n.º 6
0
bool SaveViewerSettings (const char *filename, StudioModel *pModel )
{
	LONG lResult;           // Registry function result code
	DWORD dwDisposition;    // Type of key opening event

	if (filename == NULL || pModel == NULL)
		return false;

	HKEY hModelKey;
	lResult = RegViewerSettingsKey( filename, &hModelKey, &dwDisposition);

	if (lResult != ERROR_SUCCESS)  // Failure
		return false;

	MDLCACHE_CRITICAL_SECTION_( g_pMDLCache );
	CStudioHdr *hdr = pModel->GetStudioHdr();

	RegWriteQAngle( hModelKey, "Rot", pModel->m_angles );
	RegWriteVector( hModelKey, "Trans", pModel->m_origin );
	RegWriteColor( hModelKey, "bgColor", g_viewerSettings.bgColor );
	RegWriteColor( hModelKey, "gColor", g_viewerSettings.gColor );
	RegWriteColor( hModelKey, "lColor", g_viewerSettings.lColor );
	RegWriteColor( hModelKey, "aColor", g_viewerSettings.aColor );
	RegWriteQAngle( hModelKey, "lightrot", g_viewerSettings.lightrot );
	RegWriteString( hModelKey, "sequence", hdr->pSeqdesc( pModel->GetSequence() ).pszLabel() );
	RegWriteString( hModelKey, "overlaySequence0", hdr->pSeqdesc( pModel->GetOverlaySequence( 0 ) ).pszLabel() );
	RegWriteFloat( hModelKey, "overlayWeight0", pModel->GetOverlaySequenceWeight( 0 ) );
	RegWriteString( hModelKey, "overlaySequence1", hdr->pSeqdesc( pModel->GetOverlaySequence( 1 ) ).pszLabel() );
	RegWriteFloat( hModelKey, "overlayWeight1", pModel->GetOverlaySequenceWeight( 1 ) );
	RegWriteString( hModelKey, "overlaySequence2", hdr->pSeqdesc( pModel->GetOverlaySequence( 2 ) ).pszLabel() );
	RegWriteFloat( hModelKey, "overlayWeight2", pModel->GetOverlaySequenceWeight( 2 ) );
	RegWriteString( hModelKey, "overlaySequence3", hdr->pSeqdesc( pModel->GetOverlaySequence( 3 ) ).pszLabel() );
	RegWriteFloat( hModelKey, "overlayWeight3", pModel->GetOverlaySequenceWeight( 3 ) );
	RegWriteInt( hModelKey, "renderwidth", g_viewerSettings.width );
	RegWriteInt( hModelKey, "renderheight", g_viewerSettings.height );
	RegWriteFloat( hModelKey, "speedscale", g_viewerSettings.speedScale );
	RegWriteInt( hModelKey, "viewermode", g_viewerSettings.application_mode );
	RegWriteInt( hModelKey, "thumbnailsize", g_viewerSettings.thumbnailsize );
	RegWriteInt( hModelKey, "thumbnailsizeanim", g_viewerSettings.thumbnailsizeanim );
	RegWriteInt( hModelKey, "speechapiindex", g_viewerSettings.speechapiindex );
	RegWriteInt( hModelKey, "cclanguageid", g_viewerSettings.cclanguageid );
	RegWriteInt( hModelKey, "showground", g_viewerSettings.showGround );
	RegWriteInt( hModelKey, "showbackground", g_viewerSettings.showBackground );
	RegWriteInt( hModelKey, "showshadow", g_viewerSettings.showShadow );
	RegWriteInt( hModelKey, "showillumpos", g_viewerSettings.showIllumPosition );
	RegWriteInt( hModelKey, "enablenormalmapping", g_viewerSettings.enableNormalMapping );

	RegWriteString( hModelKey, "merge0", g_viewerSettings.mergeModelFile[0] );
	RegWriteString( hModelKey, "merge1", g_viewerSettings.mergeModelFile[1] );
	RegWriteString( hModelKey, "merge2", g_viewerSettings.mergeModelFile[2] );
	RegWriteString( hModelKey, "merge3", g_viewerSettings.mergeModelFile[3] );

	return true;
}