This commit is contained in:
Oliver Duis
2011-08-06 20:31:33 +02:00
parent f7d5b97428
commit 418b4ca983
3 changed files with 12 additions and 19 deletions

View File

@@ -223,7 +223,6 @@ void Crop::update (int todo) {
// this in output space held in parallel to allow analysis like shadow/highlight // this in output space held in parallel to allow analysis like shadow/highlight
Glib::ustring outProfile=params.icm.output; Glib::ustring outProfile=params.icm.output;
if (params.icm.output=="" || params.icm.output==ColorManagementParams::NoICMString) outProfile="sRGB"; if (params.icm.output=="" || params.icm.output==ColorManagementParams::NoICMString) outProfile="sRGB";
printf("Using profile %s\n", outProfile.c_str());
Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, outProfile); Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, outProfile);
int finalW = rqcropw; int finalW = rqcropw;

View File

@@ -30,36 +30,31 @@ static void CALLBACK current_directory_monitor_callback (DWORD error, DWORD nByt
} }
bool notify = false; bool notify = false;
// Analysis of the modifications // Analysis of the modifications. Let only parsed file extensions emit a notify, not PP3 changes
do { do {
Glib::ustring fname = "";
int strLen = 0;
// Get a pointer to the first change record... // Get a pointer to the first change record...
pInfo = (FILE_NOTIFY_INFORMATION*) &monData->file_notify_buffer[dwOffset]; pInfo = (FILE_NOTIFY_INFORMATION*) &monData->file_notify_buffer[dwOffset];
char fnameC[(MAX_PATH+1)*2] = {0}; char fnameC[(MAX_PATH+1)*2] = {0};
strLen = WideCharToMultiByte(CP_UTF8,0,pInfo->FileName,pInfo->FileNameLength/sizeof(WCHAR),fnameC,sizeof(fnameC),0,0); int strLen = WideCharToMultiByte(CP_UTF8,0,pInfo->FileName,pInfo->FileNameLength/sizeof(WCHAR),fnameC,sizeof(fnameC),0,0);
fnameC[strLen] = 0; fnameC[strLen] = 0;
fname = fnameC; Glib::ustring fname = fnameC;
// See http://msdn.microsoft.com/en-us/library/aa364391(v=vs.85).aspx for available event type if necessary
if (options.has_retained_extention(fname)) if (options.has_retained_extention(fname))
notify = true; notify = true;
// More than one change may happen at the same time. Load the next change and continue... // More than one change may happen at the same time. Load the next change and continue...
dwOffset += pInfo->NextEntryOffset; dwOffset += pInfo->NextEntryOffset;
} } while (!notify && pInfo->NextEntryOffset != 0);
while (pInfo->NextEntryOffset != 0);
// ReadDirectoryChangesW sometimes emits multiple events per change (one for each change type) // ReadDirectoryChangesW sometimes emits multiple events per change (one for each change type)
// To make sure it's not flooding update, this gets filtered. // To make sure it's not flooding update, this gets filtered.
time_t curTime= ::time(NULL); DWORD curTick = GetTickCount();
if (notify && monData->listener && ::difftime(curTime, monData->lastTimeUpdateDir)>1.0) { if (notify && monData->listener && (curTick-monData->lastTimeUpdateTick)>500) {
monData->lastTimeUpdateTick = curTick;
monData->listener->winDirChanged (); monData->listener->winDirChanged ();
monData->lastTimeUpdateDir = curTime;
} }
ReadDirectoryChangesW (monData->hDirectory, ReadDirectoryChangesW (monData->hDirectory,
monData->file_notify_buffer, monData->file_notify_buffer,
monData->buffer_allocated_bytes, monData->buffer_allocated_bytes,
@@ -72,7 +67,7 @@ static void CALLBACK current_directory_monitor_callback (DWORD error, DWORD nByt
current_directory_monitor_callback); current_directory_monitor_callback);
} }
WinDirMonitor::WinDirMonitor (Glib::ustring dirName, WinDirChangeListener* listener) : monData(NULL) { WinDirMonitor::WinDirMonitor (Glib::ustring dirName, WinDirChangeListener* listener) : monData(NULL) {
wchar_t* wdirname = (wchar_t*)g_utf8_to_utf16 (dirName.c_str(), -1, NULL, NULL, NULL); wchar_t* wdirname = (wchar_t*)g_utf8_to_utf16 (dirName.c_str(), -1, NULL, NULL, NULL);
HANDLE hDirectory = CreateFileW (wdirname, FILE_LIST_DIRECTORY,FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL); HANDLE hDirectory = CreateFileW (wdirname, FILE_LIST_DIRECTORY,FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL);
g_free (wdirname); g_free (wdirname);
@@ -84,9 +79,8 @@ WinDirMonitor::WinDirMonitor (Glib::ustring dirName, WinDirChangeListener* liste
monData->buffer_allocated_bytes = 32768; monData->buffer_allocated_bytes = 32768;
monData->file_notify_buffer = new char [monData->buffer_allocated_bytes]; monData->file_notify_buffer = new char [monData->buffer_allocated_bytes];
monData->hDirectory = hDirectory; monData->hDirectory = hDirectory;
monData->lastTimeUpdateDir = ::time(NULL); monData->lastTimeUpdateTick = GetTickCount();
// printf ("mondata=%d\n", monData);
ReadDirectoryChangesW (monData->hDirectory, ReadDirectoryChangesW (monData->hDirectory,
monData->file_notify_buffer, monData->file_notify_buffer,
monData->buffer_allocated_bytes, monData->buffer_allocated_bytes,

View File

@@ -39,7 +39,7 @@ class WinDirMonitor : public Glib::Object {
HANDLE hDirectory; HANDLE hDirectory;
WinDirChangeListener* listener; WinDirChangeListener* listener;
int bigyo; int bigyo;
time_t lastTimeUpdateDir; // for filtering multiple updates events DWORD lastTimeUpdateTick; // for filtering multiple updates events
}; };
private: private: