Example #1
0
void LevelWorker::registerSettingsImpl()
{
    hashSetting(LevelSettings::Blackpoint);
    hashSetting(LevelSettings::Midpoint);
    hashSetting(LevelSettings::Whitepoint);
    hashSetting(LevelSettings::Brightness);
    hashSetting(LevelSettings::Saturation);
}
Example #2
0
void UfrawWorker::registerSettingsImpl()
{
    hashSetting(UfrawSettings::Fuse);
    hashSetting(UfrawSettings::ExposureSigma);
    hashSetting(UfrawSettings::Exposure);
    hashSetting(UfrawSettings::WbTemperature);
    hashSetting(UfrawSettings::WbGreen);
}
Example #3
0
/**
 * name:	CtrlContactWriteItemToDB
 * desc:	write a item from combobox to database
 * param:	none
 * return:	always 0
 **/
int CtrlContactWriteItemToDB(
				HWND hCtrl,
				MCONTACT hContact,
				LPCSTR pszModule,
				LPCSTR pszProto,
				LPCSTR pszSetting)
{
	TCHAR szVal[MAXDATASIZE];
	CBEXITEM cbi;

	if (!CtrlContactWndProc(hCtrl, CBEXM_ISCHANGED, NULL, NULL)) return 1;

	cbi.wMask = CBEXIM_ID|CBEXIM_VAL|CBEXIM_FLAGS;
	cbi.pszVal = szVal;
	cbi.ccVal = MAXDATASIZE - 4;
	cbi.iItem = 0;
	cbi.dwID = hashSetting(pszSetting);
	if (!CtrlContactWndProc(hCtrl, CBEXM_GETITEM, NULL, (LPARAM)&cbi)) return 1;
	if (!(cbi.wFlags & CTRLF_CHANGED)) return 0;
	if (!hContact && !(pszModule = pszProto)) return 1;
	if (!*szVal)
		db_unset(hContact, pszModule, pszSetting);
	else {
		if (cbi.wFlags & CBEXIF_SMS)
			mir_tstrncat(szVal, _T(" SMS"), _countof(szVal) - mir_tstrlen(szVal));

		if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
	}
	cbi.wFlags &= ~CTRLF_CHANGED;
	cbi.wMask = CBEXIM_FLAGS;
	CtrlContactWndProc(hCtrl, CBEXM_SETITEM, NULL, (LPARAM)&cbi);
	InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), NULL, TRUE);
	return 0;
}
Example #4
0
/**
 * name:	CtrlContactAddItemFromDB
 * desc:	add a item read from db to the combobox
 * param:	hCtrl			- windowhandle to extended combobox control
 *			hIcon			- icon to use for custom items
 *			szItem			- category text for the item
 *			wForcedFlags	- force flag for each new entry
 *			hContact		- handle to contact whose settings to add
 *			pszModule		- primary module to search the setting in
 *			pszProto		- contacts protocol module
 *			szSettingVal	- value holding setting
 * return:	TRUE	- if the item is not updated, because its changed flag is set
 *			FALSE	- if item is added or updated successfully
 **/
int CtrlContactAddItemFromDB(
				HWND hCtrl,
				LPCSTR szIcon,
				LPTSTR szItem,
				MCONTACT hContact,
				LPCSTR pszModule,
				LPCSTR pszProto,
				LPCSTR szSettingVal)
{
	DBVARIANT dbv;
	CBEXITEM cbi;

	cbi.pszVal = NULL;
	cbi.dwID = hashSetting(szSettingVal);
	cbi.wFlags = CBEXIF_CATREADONLY|DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, szSettingVal, &dbv);
	if (dbv.type >= DBVT_WCHAR) {
		// no value read from database
		if (cbi.wFlags == CBEXIF_CATREADONLY)
			cbi.pszVal = NULL;
		else { // check the database value
			cbi.pszVal = dbv.ptszVal;
			if (LPTSTR sms = _tcsstr(cbi.pszVal, _T(" SMS"))) {
				cbi.wFlags |= CBEXIF_SMS;
				*sms = 0;
			}
		}
	}
	cbi.pszCat = szItem;
	cbi.iItem = -1;
	cbi.wMask = CBEXIM_ALL;
	cbi.pszIcon = szIcon;
	SendMessage(hCtrl, CBEXM_ADDITEM, NULL, (LPARAM)&cbi);
	db_free(&dbv);
	return (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED;
}
Example #5
0
/**
 * name:	CtrlContactAddMyItemsFromDB
 * desc:	add a item read from db to the combobox
 * param:	hCtrl			- windowhandle to extended combobox control
 *			hIcon			- icon to use for custom items
 *			wForcedFlags	- force flag for each new entry
 *			hContact		- handle to contact whose settings to add
 *			pszModule		- primary module to search the setting in
 *			pszProto		- contacts protocol module
 *			szFormatCat		- format for the category holding setting
 *			szFormatVal		- format for the value holding setting
 * return:	TRUE	- if one of the items was not updated, because its changed flag is set
 *			FALSE	- if all items were added or updated successfully
 **/
int CtrlContactAddMyItemsFromDB(
				HWND hCtrl,
				LPCSTR szIcon,
				WORD wForcedFlags,
				MCONTACT hContact,
				LPCSTR pszModule,
				LPCSTR pszProto,
				LPCSTR szFormatCat,
				LPCSTR szFormatVal)
{
	CBEXITEM cbi;
	DBVARIANT dbv;
	CHAR pszSetting[MAXSETTING];
	WORD i;
	LPTSTR sms;
	int bAnyItemIsChanged = 0;

	memset(&cbi, 0, sizeof(cbi));
	cbi.iItem = -1;
	cbi.wMask = CBEXIM_ALL;
	cbi.pszIcon = szIcon;

	for (i = 0;
		SUCCEEDED(mir_snprintf(pszSetting, szFormatVal, i)) &&
		(cbi.wFlags = DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, pszSetting, &dbv));
		i++)
	{
		// read value
		cbi.dwID = hashSetting(pszSetting);
		cbi.pszVal = dbv.ptszVal;
		dbv.type = DBVT_DELETED;
		dbv.ptszVal = NULL;

		// read category
		if (SUCCEEDED(mir_snprintf(pszSetting, szFormatCat, i))) {
			if (cbi.wFlags & CTRLF_HASCUSTOM) {
				if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbv))
					dbv.type = DBVT_DELETED;
			}
			else
			if (cbi.wFlags & CTRLF_HASPROTO) {
				if (DB::Setting::GetTString(hContact, pszProto, pszSetting, &dbv))
					dbv.type = DBVT_DELETED;
			}

			if (dbv.type > DBVT_DELETED && dbv.ptszVal && *dbv.ptszVal) {
				cbi.pszCat = dbv.ptszVal;
				dbv.type = DBVT_DELETED;
				dbv.ptszVal = NULL;
			}
		}
		if (sms = _tcsstr(cbi.pszVal, _T(" SMS"))) {
			cbi.wFlags |= CBEXIF_SMS;
			*sms = 0;
		}
		cbi.wFlags |= wForcedFlags;
		if (CB_ERR == SendMessage(hCtrl, CBEXM_ADDITEM, NULL, (LPARAM)&cbi)) 
			break;
		bAnyItemIsChanged |= (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED;
		if (cbi.pszCat) { 
			mir_free(cbi.pszCat);
			cbi.pszCat = NULL; 
		}
		if (cbi.pszVal) {
			mir_free(cbi.pszVal);
			cbi.pszVal = NULL;
		}
	}
	SendMessage(hCtrl, CBEXM_SORT, NULL, NULL);
	return bAnyItemIsChanged;
}