Browse Source

Formated code alt-F8

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@65 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 21 years ago
parent
commit
feec83faab
10 changed files with 1452 additions and 1452 deletions
  1. 22 22
      DataTable.cpp
  2. 123 123
      DatabaseUtilities.cpp
  3. 2 2
      InternetUpdate.cpp
  4. 191 191
      Misc.cpp
  5. 211 211
      ProcessCopy.cpp
  6. 176 176
      ProcessPaste.cpp
  7. 195 195
      QListCtrl.cpp
  8. 251 251
      QPasteWnd.cpp
  9. 19 19
      QuickPaste.cpp
  10. 262 262
      WndEx.cpp

+ 22 - 22
DataTable.cpp

@@ -60,7 +60,7 @@ void CDataTable::AddNew()
 {
 	CDaoRecordset::AddNew();
 	// get the new, automatically assigned ID
-COleVariant varID;
+	COleVariant varID;
 	GetFieldValue("lID", varID);
 	m_lID = varID.lVal;
 }
@@ -74,11 +74,11 @@ HGLOBAL CDataTable::TakeData()
 	// if there is nothing to take
 	if( m_ooData.m_hData == 0 || m_ooData.m_dwDataLength == 0 )
 		return 0;
-
+	
 	// Unlock the handle that was locked by DaoLongBinaryAllocCallback()
 	//  (through DFX_LongBinary()).
 	::GlobalUnlock( m_ooData.m_hData );
-
+	
 	// we have to do a realloc in order to make the hGlobal m_dwDataLength
 	HGLOBAL hGlobal = ::GlobalReAlloc(m_ooData.m_hData, m_ooData.m_dwDataLength, GMEM_MOVEABLE );
 	if( !hGlobal || ::GlobalSize(hGlobal) == 0 )
@@ -104,60 +104,60 @@ BOOL CDataTable::ReplaceData( HGLOBAL hgData, UINT len )
 	if( hgData != NULL )
 	{
 		VERIFY( len > 0 );
-	UINT size = ::GlobalSize( hgData );
+		UINT size = ::GlobalSize( hgData );
 		VERIFY( size >= len );
 		VERIFY( IsValid(hgData) );
 	}
 	else
 		VERIFY( len == 0 );
-
+	
 	// free the old HGLOBAL
 	if( m_ooData.m_hData )
 		::GlobalFree( m_ooData.m_hData );
-
+	
 	m_ooData.m_hData = hgData;
 	m_ooData.m_dwDataLength = len;
-
+	
 	//Set the fields dirty
 	SetFieldDirty(&m_ooData);
 	SetFieldNull(&m_ooData,FALSE);
-
+	
 	return TRUE;
 }
 
 // copies hgData into m_ooData
 BOOL CDataTable::SetData( HGLOBAL hgData, UINT size )
 {
-UINT unSize = (size < 0)? ::GlobalSize(hgData) : size;
-
+	UINT unSize = (size < 0)? ::GlobalSize(hgData) : size;
+	
 	//Reallocate m_ooData.m_hData
 	if(m_ooData.m_hData)
 		m_ooData.m_hData = ::GlobalReAlloc(m_ooData.m_hData, unSize, GMEM_MOVEABLE);
 	else
 		m_ooData.m_hData = ::GlobalAlloc(GHND, unSize);
-
+	
 	m_ooData.m_dwDataLength = unSize;
-
+	
 	::CopyToGlobalHH( m_ooData.m_hData, hgData, unSize );
-
+	
 	//Set the fields dirty
 	SetFieldDirty(&m_ooData);
 	SetFieldNull(&m_ooData,FALSE);
-
+	
 	return TRUE;
 }
 
 // allocates a new copy of the data
 HGLOBAL CDataTable::LoadData()
 {
-HGLOBAL hGlobal;
-ULONG ulBufLen = m_ooData.m_dwDataLength; //Retrieve size of array
-
+	HGLOBAL hGlobal;
+	ULONG ulBufLen = m_ooData.m_dwDataLength; //Retrieve size of array
+	
 	if( ulBufLen == 0 || m_ooData.m_hData == 0 )
 		return 0;
-
+	
 	hGlobal = NewGlobalH( m_ooData.m_hData, ulBufLen );
-
+	
 	return hGlobal;
 }
 
@@ -181,17 +181,17 @@ BOOL CDataTable::DeleteAll()
 		AfxMessageBox(e->m_pErrorInfo->m_strDescription);
 		e->Delete();
 	}
-
+	
 	return bRet;
 }
 
 void CDataTable::Open(LPCTSTR lpszFormat,...) 
 {
 	m_pDatabase = theApp.EnsureOpenDB();
-
+	
 	CString csText;
 	va_list vlist;
-
+	
 	ASSERT(AfxIsValidString(lpszFormat));
 	va_start(vlist,lpszFormat);
 	csText.FormatV(lpszFormat,vlist);

+ 123 - 123
DatabaseUtilities.cpp

@@ -14,8 +14,8 @@
 
 BOOL CreateBackup(CString csPath)
 {
-CString csOriginal;
-int count = 0;
+	CString csOriginal;
+	int count = 0;
 	// create a backup of the existing database
 	do
 	{
@@ -28,7 +28,7 @@ int count = 0;
 			return FALSE;
 		}
 	} while( !::CopyFile(csPath, csOriginal, TRUE) );
-
+	
 	return TRUE;
 }
 
@@ -45,15 +45,15 @@ CString GetDefaultDBName()
 	if(SUCCEEDED(::SHGetMalloc(&pMalloc))) 
 	{ 
 		LPITEMIDLIST pidlPrograms;
-
+		
 		SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidlPrograms);
-
+		
 		char string[MAX_PATH];
 		SHGetPathFromIDList(pidlPrograms, string);
-
+		
 		pMalloc->Free(pidlPrograms);
 		pMalloc->Release();
-
+		
 		csDefaultPath = string;		
 		csDefaultPath += "\\Ditto\\";
 		
@@ -62,7 +62,7 @@ CString GetDefaultDBName()
 		
 		csDefaultPath += DEFAULT_DB_NAME;
 	}
-
+	
 	return csDefaultPath;
 }
 
@@ -76,39 +76,39 @@ BOOL CheckDBExists(CString csDBPath)
 		// -- create a new one
 		return CreateDB(GetDefaultDBName());
 	}
-
+	
 	BOOL bRet = FALSE;
-
+	
 	if(ValidDB(csDBPath) == FALSE)
 	{
 		theApp.CloseDB();
 		
 		CGetSetOptions::SetDBPath("");
-
+		
 		//Db existed but was bad
-
+		
 		CString csMarkAsBad;
 		
 		csMarkAsBad = csDBPath;
 		csMarkAsBad.Replace(".", "_BAD.");
 		
 		CString csPath = GetDefaultDBName();
-
+		
 		CString cs;
 		cs.Format("Unrecognized Database Format \"%s\",\n"
-					"the file will be renamed \"%s\",\n"
-					"and a new database will be created,\n"
-					"\"%s\"", csDBPath, csMarkAsBad, csPath);
-
+			"the file will be renamed \"%s\",\n"
+			"and a new database will be created,\n"
+			"\"%s\"", csDBPath, csMarkAsBad, csPath);
+		
 		AfxMessageBox(cs);
 		
 		CFile::Rename(csDBPath, csMarkAsBad);
-
+		
 		bRet = CreateDB(csPath);
 	}
 	else
 		bRet = TRUE;
-
+	
 	return bRet;
 }
 
@@ -119,28 +119,28 @@ BOOL CheckDBExists(CString csDBPath)
 #define ON_FIELD_ABSENT(name,onabsent) \
 	try { table.GetFieldInfo(name,info); } \
 	catch(CDaoException* e) \
-	{ \
-		if( !bUpgrade || e->m_pErrorInfo->m_lErrorCode != 0x00000cc1 ) \
-			throw e; \
-		if( bUpgraded == FALSE ) \
-			CreateBackup(csPath); \
-		bResult &= onabsent; \
-		bUpgraded = TRUE; \
-		e->Delete(); \
-	}
+{ \
+	if( !bUpgrade || e->m_pErrorInfo->m_lErrorCode != 0x00000cc1 ) \
+	throw e; \
+	if( bUpgraded == FALSE ) \
+	CreateBackup(csPath); \
+	bResult &= onabsent; \
+	bUpgraded = TRUE; \
+	e->Delete(); \
+}
 
 BOOL ValidDB(CString csPath, BOOL bUpgrade)
 {
-BOOL bResult = TRUE;
-BOOL bUpgraded = FALSE;
+	BOOL bResult = TRUE;
+	BOOL bUpgraded = FALSE;
 	try
 	{
 		CDaoDatabase db;
 		db.Open(csPath);
-
+		
 		CDaoTableDef table(&db);
 		CDaoFieldInfo info;
-
+		
 		table.Open("Main");
 		table.GetFieldInfo("lID", info);
 		table.GetFieldInfo("lDate", info);
@@ -153,14 +153,14 @@ BOOL bUpgraded = FALSE;
 		table.GetFieldInfo("dOrder", info);  // part of Upgrade_Groups
 		ON_FIELD_ABSENT("lDataID", Upgrade_ShareData(db)); // +lDataID, -lParentID
 		table.Close();
-
+		
 		table.Open("Data");
 		table.GetFieldInfo("lID", info);
 		table.GetFieldInfo("lDataID", info); // part of Upgrade_ShareData()
 		table.GetFieldInfo("strClipBoardFormat", info);
 		table.GetFieldInfo("ooData", info);
 		table.Close();
-
+		
 		table.Open("Types");
 		table.GetFieldInfo("ID", info);
 		table.GetFieldInfo("TypeText", info);
@@ -173,11 +173,11 @@ BOOL bUpgraded = FALSE;
 		e->Delete();
 		return FALSE;
 	}
-
+	
 	// if we upgraded, perform full validation again without upgrading
 	if( bUpgraded )
 		return ValidDB( csPath, FALSE);
-
+	
 	return bResult;
 }
 
@@ -185,11 +185,11 @@ BOOL CreateDB(CString csPath)
 {
 	try
 	{
-	CDaoDatabase db;
+		CDaoDatabase db;
 		EnsureDirectory(csPath);
 		db.Create(csPath);
-
-	CDaoTableDefEx table(&db);
+		
+		CDaoTableDefEx table(&db);
 		//Create the Main table
 		table.Create("Main");
 		table.CreateField("lID", dbLong, 4, dbAutoIncrField);
@@ -211,10 +211,10 @@ BOOL CreateDB(CString csPath)
 		// for sharing data amongst multiple clips
 		table.CreateField("lDataID", dbLong, 4, 0, "0"); // corresponds to Data.lDataID
 		table.CreateIndex(FALSE, "lDataID");
-
+		
 		table.Append();
 		table.Close();
-
+		
 		//Create the Data Table
 		table.Create("Data");
 		
@@ -224,18 +224,18 @@ BOOL CreateDB(CString csPath)
 		table.CreateIndex(FALSE, "lDataID");
 		table.CreateField("strClipBoardFormat", dbText, 50, dbVariableField);
 		table.CreateField("ooData", dbLongBinary, 0);
-
+		
 		table.Append();
 		table.Close();
-
+		
 		//Create the Types table
 		table.Create("Types");
 		table.CreateField("ID", dbLong, 4, dbAutoIncrField);
 		table.CreateField("TypeText", dbText, 50, dbVariableField);
-
+		
 		table.Append();
 		table.Close();
-
+		
 		db.Close();
 		
 		return TRUE;
@@ -246,7 +246,7 @@ BOOL CreateDB(CString csPath)
 		ASSERT(FALSE);
 		e->Delete();
 	}
-
+	
 	return FALSE;
 }
 
@@ -261,14 +261,14 @@ BOOL Upgrade_mText(CDaoDatabase& db)
 		db.Execute("ALTER TABLE Main DROP COLUMN strType", dbFailOnError);
 	}
 	CATCHDAO
-	return TRUE;
+		return TRUE;
 }
 
 BOOL Upgrade_Groups(CDaoDatabase& db)
 {
 	try
 	{
-	CDaoTableDefEx table(&db);
+		CDaoTableDefEx table(&db);
 		table.Open("Main");
 		// Groups
 		table.CreateField("bIsGroup", dbBoolean, 1, 0, "0"); // for Groups
@@ -282,66 +282,66 @@ BOOL Upgrade_Groups(CDaoDatabase& db)
 		db.Execute("UPDATE Main SET bIsGroup = 0, lParentID = 0, dOrder = 0", dbFailOnError);
 	}
 	CATCHDAO
-	return TRUE;
+		return TRUE;
 }
 
 BOOL Upgrade_ShareData(CDaoDatabase& db)
 {
-CPopup status(10000,10000); // peg at the bottom-right corner of screen
+	CPopup status(10000,10000); // peg at the bottom-right corner of screen
 	try
 	{
-	CDaoTableDefEx table(&db);
-
+		CDaoTableDefEx table(&db);
+		
 		table.Open("Main");
 		table.CreateField("lDataID", dbLong, 4, 0, "0"); // corresponds to Data.lDataID
 		table.CreateIndex(FALSE, "lDataID");
 		table.Close();
-
+		
 		table.Open("Data");
 		table.CreateField("lDataID", dbLong, 4, 0, "0"); // parent Group Main.lID
 		table.CreateIndex(FALSE, "lDataID");
 		table.Close();
-
+		
 		// set defaults
 		db.Execute(	"UPDATE Main SET lDataID = 0", dbFailOnError );
 		db.Execute( "UPDATE Data SET lDataID = 0", dbFailOnError );
-
+		
 		// update Main.lDataID and Data.lParentID for sharing Data
 		//
 		// - multiple Formats (Data.lID) exist for a single ClipData (Data.lDataID)
 		// - The value of lDataID is arbitrary, but must be unique to the ClipData.
 		//   - In order to ensure uniqueness, lDataID is assigned the lID of
 		//     the first Format in the Clip's set.
-
-	COleVariant var((long)0);
-	CDaoRecordset main(&db);
-	long main_fldID;
-	long main_fldDataID;
-	long main_lID;
-
-	CDaoRecordset data(&db);
-	long data_fldID;
-	long data_fldDataID;
-	long lDataID;
-	int count = 0;
-	int i = 0;
-	int percentPrev = -1;
-	int percent = -1;
-
+		
+		COleVariant var((long)0);
+		CDaoRecordset main(&db);
+		long main_fldID;
+		long main_fldDataID;
+		long main_lID;
+		
+		CDaoRecordset data(&db);
+		long data_fldID;
+		long data_fldDataID;
+		long lDataID;
+		int count = 0;
+		int i = 0;
+		int percentPrev = -1;
+		int percent = -1;
+		
 		main.Open(dbOpenDynaset,"SELECT lID, lDataID FROM Main");
-
+		
 		main_fldID = GetFieldPos(main,"lID");
 		VERIFY(main_fldID == 0);
 		main_fldDataID = GetFieldPos(main,"lDataID");
 		VERIFY(main_fldDataID == 1);
-
+		
 		if( !main.IsEOF() )
 		{
 			main.MoveLast();
 			count = main.GetRecordCount();
 			main.MoveFirst();
 		}
-
+		
 		// for each record in Main and its corresponding records in Data,
 		//  assign a new unique lDataID.
 		while( !main.IsEOF() )
@@ -351,19 +351,19 @@ CPopup status(10000,10000); // peg at the bottom-right corner of screen
 			percent = (i*100)/count;
 			if( percent != percentPrev )
 				status.Show(StrF("Ditto: Upgrading database (%d%%)",percent));
-
+			
 			main.GetFieldValue(main_fldID,var);
 			main_lID = var.lVal;
-
+			
 			data.Open(dbOpenDynaset, StrF(
 				"SELECT lID, lDataID "
 				"FROM Data WHERE lParentID = %d", main_lID) );
-
+			
 			data_fldID = GetFieldPos(data,"lID");
 			VERIFY(data_fldID == 0);
 			data_fldDataID = GetFieldPos(data,"lDataID");
 			VERIFY(data_fldDataID == 1);
-
+			
 			// lDataID = the first data record lID
 			lDataID = 0;
 			if( !data.IsEOF() )
@@ -380,36 +380,36 @@ CPopup status(10000,10000); // peg at the bottom-right corner of screen
 				data.Update();
 				data.MoveNext();
 			}
-
+			
 			// assign Main.lDataID
 			var.lVal = lDataID;
 			main.Edit();
 			main.SetFieldValue(1,var); // 1 == lDataID field
 			main.Update();
 			main.MoveNext();
-
+			
 			data.Close();
 		}
-
+		
 		main.Close();
-
+		
 		// delete the old field
 		db.Execute("ALTER TABLE Data DROP CONSTRAINT lParentID", dbFailOnError);
 		db.Execute("ALTER TABLE Data DROP COLUMN lParentID", dbFailOnError);
 	}
 	CATCHDAO
-	return TRUE;
+		return TRUE;
 }
 
 BOOL CompactDatabase()
 {
 	if(!theApp.CloseDB())
 		return FALSE;
-
+	
 	CString csDBName = GetDBName();
 	CString csTempDBName = csDBName;
 	csTempDBName.Replace(".mdb", "TempDBName.mdb");
-
+	
 	//Compact the database			
 	try
 	{
@@ -429,7 +429,7 @@ BOOL CompactDatabase()
 		e->Delete();
 		return FALSE;
 	}
-
+	
 	//Since compacting the database creates a new db delete the old one and replace it
 	//with the compacted db
 	if(DeleteFile(csDBName))
@@ -447,7 +447,7 @@ BOOL CompactDatabase()
 	}
 	else
 		AfxMessageBox("Error Compacting Database");
-
+	
 	return TRUE;
 }
 
@@ -455,7 +455,7 @@ BOOL RepairDatabase()
 {
 	if(!theApp.CloseDB())
 		return FALSE;
-
+	
 	try
 	{
 		CDaoWorkspace::RepairDatabase(GetDBName());
@@ -466,7 +466,7 @@ BOOL RepairDatabase()
 		e->Delete();
 		return FALSE;
 	}
-
+	
 	return TRUE;
 }
 
@@ -475,57 +475,57 @@ BOOL RemoveOldEntries()
 	if(CGetSetOptions::GetCheckForMaxEntries())
 	{
 		long lMax = CGetSetOptions::GetMaxEntries();
-
+		
 		CMainTable recset;
 		recset.Open("SELECT * FROM Main ORDER BY lDate DESC");
 		if(!recset.IsEOF())
 		{
 			recset.MoveLast();
-
+			
 			long lCount = recset.GetRecordCount();
-
+			
 			CClipIDs IDs;
-
+			
 			while((lCount > lMax) && (!recset.IsBOF()))
 			{
 				//Only delete entries that have no shortcut and don't have the flag set
 				if(recset.m_lShortCut == 0 && recset.m_lDontAutoDelete == 0)
 					IDs.Add(recset.m_lID);
-
+				
 				lCount--;
 				recset.MovePrev();
 			}
-
+			
 			IDs.DeleteIDs();
 		}
 	}
-
+	
 	if(CGetSetOptions::GetCheckForExpiredEntries())
 	{
 		long lExpire = CGetSetOptions::GetExpiredEntries();
-
+		
 		if(lExpire)
 		{
 			CTime now = CTime::GetCurrentTime();
 			now -= CTimeSpan(lExpire, 0, 0, 0);
-
+			
 			CMainTable recset;
 			recset.Open("SELECT * FROM Main "
-						"WHERE lDate < %d AND "
-						"lShortCut = 0 AND lDontAutoDelete = 0", now.GetTime());
-
+				"WHERE lDate < %d AND "
+				"lShortCut = 0 AND lDontAutoDelete = 0", now.GetTime());
+			
 			CClipIDs IDs;
-
+			
 			while(!recset.IsEOF())
 			{
 				IDs.Add(recset.m_lID);
 				recset.MoveNext();
 			}
-
+			
 			IDs.DeleteIDs();
 		}
 	}
-
+	
 	return TRUE;
 }
 
@@ -535,12 +535,12 @@ BOOL EnsureDirectory(CString csPath)
 	char dir[_MAX_DIR];
 	char fname[_MAX_FNAME];
 	char ext[_MAX_EXT];
-
+	
 	_splitpath(csPath, drive, dir, fname, ext);
-
+	
 	CString csDir(drive);
 	csDir += dir;
-
+	
 	if(_access(csDir, 0) == -1)
 	{
 		if(CreateDirectory(csDir, NULL))
@@ -548,7 +548,7 @@ BOOL EnsureDirectory(CString csPath)
 	}
 	else
 		return TRUE;
-
+	
 	return FALSE;
 }
 
@@ -563,37 +563,37 @@ BOOL ExecuteSQL( CString csSQL, BOOL bReportError, CDaoException** ppEx )
 	{
 		if( bReportError )
 			e->ReportError();
-
+		
 		if( ppEx )
 			*ppEx = e;
 		else
 			e->Delete();
-
+		
 		return FALSE;
 	}
-
+	
 	return TRUE;
 }
 
 int GetFieldPos(CDaoRecordset& recs, LPCTSTR fieldName)
 {
-CDaoFieldInfo fi;
-int count = recs.GetFieldCount();
-
+	CDaoFieldInfo fi;
+	int count = recs.GetFieldCount();
+	
 	for( int i = 0; i < count; i++ )
 	{
 		recs.GetFieldInfo(i, fi);
 		if( fi.m_strName.Compare( fieldName ) == 0 )
 			return i; // when found a match, return it
 	}
-
+	
 	return -1;
 }
 
 void VerifyFieldPos(CDaoRecordset& recs, LPCTSTR fieldName, int index)
 {
-CDaoFieldInfo fi;
-int count = recs.GetFieldCount();
+	CDaoFieldInfo fi;
+	int count = recs.GetFieldCount();
 	VERIFY( index >= 0 && index < count );
 	recs.GetFieldInfo(index, fi);
 	VERIFY( fi.m_strName.Compare( fieldName ) == 0 );
@@ -601,17 +601,17 @@ int count = recs.GetFieldCount();
 
 CString GetFieldList(CDaoRecordset& recs)
 {
-CString field;
-CString list;
-CDaoFieldInfo fi;
-int count = recs.GetFieldCount();
-
+	CString field;
+	CString list;
+	CDaoFieldInfo fi;
+	int count = recs.GetFieldCount();
+	
 	for( int i = 0; i < count; i++ )
 	{
 		recs.GetFieldInfo(i, fi);
 		field = StrF("\n%d: ",i) + fi.m_strName;
 		list += field;
 	}
-
+	
 	return list;
 }

+ 2 - 2
InternetUpdate.cpp

@@ -177,7 +177,7 @@ long CInternetUpdate::GetUpdateVersion()
 
 	//if nothing there get the default
 	if(csPath.IsEmpty())
-		csPath = "osdn.dl.sourceforge.net/sourceforge/ditto-cp/DittoVersion.txt";
+		csPath = "www.sourceforge.net/update/DittoVersion.txt";
 	
 	CString csUrl = "http://" + csPath;
 	
@@ -278,7 +278,7 @@ CString CInternetUpdate::DownloadUpdate()
 
 	//if nothing there get the default
 	if(csPath.IsEmpty())
-		csPath = "osdn.dl.sourceforge.net/sourceforge/ditto-cp/DittoSetup.exe";
+		csPath = "www.sourceforge.net/update/DittoSetup.exe";
 
 	CString csUrl = "http://" + csPath;
 	

File diff suppressed because it is too large
+ 191 - 191
Misc.cpp


File diff suppressed because it is too large
+ 211 - 211
ProcessCopy.cpp


+ 176 - 176
ProcessPaste.cpp

@@ -14,19 +14,19 @@ static char THIS_FILE[]=__FILE__;
 double GetFitIncrement( int count, double dStart, double dEnd )
 {
 	VERIFY( count > 0 && dStart <= dEnd );
-
-double dIncrement = (dEnd - dStart) / ((double) (count+1));
-
+	
+	double dIncrement = (dEnd - dStart) / ((double) (count+1));
+	
 	if( dIncrement == 0 )
 		return 0;
-
+	
 	// verify that each element is unique
 	// I'm not sure if this is necessary, but I'm doing it just to be on the safe side
 	// I think the resolution of floating points are variable.
 	// i.e. we cannot depend upon an increment always effecting a change.
-int i = 0;
-double dPrev = dStart;
-double dOrder = dStart + dIncrement;
+	int i = 0;
+	double dPrev = dStart;
+	double dOrder = dStart + dIncrement;
 	while( dOrder < dEnd )
 	{
 		i++;
@@ -35,27 +35,27 @@ double dOrder = dStart + dIncrement;
 		dPrev = dOrder;
 		dOrder = dOrder + dIncrement;
 	}
-
+	
 	// verify count (and that we're not too close to dEnd)
 	if( i < count )
 		return 0;
-
+	
 	return dIncrement;
 }
 
 
 /*------------------------------------------------------------------*\
-	ID based Globals
+ID based Globals
 \*------------------------------------------------------------------*/
 
 BOOL MarkClipAsPasted(long lID)
 {
 	CGetSetOptions::SetTripPasteCount(-1);
 	CGetSetOptions::SetTotalPasteCount(-1);
-
+	
 	if( !g_Opt.m_bUpdateTimeOnPaste )
 		return FALSE;
-
+	
 	try
 	{	
 		//Update the time it was copied so that it appears at the top of the 
@@ -63,13 +63,13 @@ BOOL MarkClipAsPasted(long lID)
 		CMainTable ctMain;
 		ctMain.Open("SELECT * FROM Main WHERE lID = %d", lID);
 		ctMain.Edit();
-	
+		
 		CTime now = CTime::GetCurrentTime();
 		ctMain.m_lDate = (long)now.GetTime();
-	
+		
 		ctMain.Update();
 		ctMain.Close();
-
+		
 		return TRUE;
 	}
 	catch(CDaoException *e)
@@ -77,41 +77,41 @@ BOOL MarkClipAsPasted(long lID)
 		ASSERT(FALSE);
 		e->Delete();
 	}
-
+	
 	return FALSE;
 }
 
 long NewGroupID( long lParentID, CString text )
 {
-long lID=0;
-CTime time;
+	long lID=0;
+	CTime time;
 	time = CTime::GetCurrentTime();
-
+	
 	try
 	{
-	CMainTable recset;
+		CMainTable recset;
 		recset.Open(dbOpenTable, "Main");
-
+		
 		recset.AddNew(); // overridden to set m_lID to the new autoincr number
-
+		
 		lID = recset.m_lID;
-
+		
 		recset.m_lDate = (long) time.GetTime();
 		recset.m_lDontAutoDelete = (long) time.GetTime();
-
+		
 		if( text != "" )
 			recset.m_strText = text;
 		else
 			recset.m_strText = time.Format("NewGroup %y/%m/%d %H:%M:%S");
-
+		
 		recset.m_bIsGroup = TRUE;
 		recset.m_lParentID = lParentID;
-
+		
 		recset.Update();
-
-//		recset.SetBookmark( recset.GetLastModifiedBookmark() );
-//		lID = recset.m_lID;
-
+		
+		//		recset.SetBookmark( recset.GetLastModifiedBookmark() );
+		//		lID = recset.m_lID;
+		
 		recset.Close();
 	}
 	catch(CDaoException* e)
@@ -121,7 +121,7 @@ CTime time;
 		e->Delete();
 		return 0;
 	}
-
+	
 	return lID;
 }
 
@@ -129,55 +129,55 @@ CTime time;
 // creates copies of all lSrc Data and returns the copy's lDataID (or 0 on fail)
 long NewCopyDataID( long lSrc )
 {
-long lDataID = 0;
-CString sql;
-
+	long lDataID = 0;
+	CString sql;
+	
 	// create the copies
 	sql.Format(
 		"INSERT INTO Data (strClipBoardFormat, ooData) "
 		"SELECT strClipBoardFormat, ooData FROM Data "
 		"WHERE lDataID = %d", lSrc );
-
+	
 	// each lID should be assigned a unique ID (autoinc)
 	// lDataID should be assigned to 0 (default value) or NULL
 	ExecuteSQL( sql );
-
+	
 	// assign lDataID to the first record's lID
 	try
 	{
-	CDataTable recs;
+		CDataTable recs;
 		recs.Open("SELECT * FROM Data WHERE lDataID = 0 OR lDataID IS NULL");
 		if( !recs.IsEOF() )
 			lDataID = recs.m_lID;
 		recs.Close();
 	}
 	CATCHDAO
-
-	// assign the copies to lDest
-	sql.Format(
+		
+		// assign the copies to lDest
+		sql.Format(
 		"UPDATE Data "
 		"SET lDataID = %d "
 		"WHERE lDataID = 0 OR lDataID IS NULL", lDataID );
-
+	
 	ExecuteSQL( sql );
-
+	
 	return lDataID;
 }
 
 // deletes the given item
 BOOL DeleteID( long lID, bool bDisband )
 {
-BOOL bIsGroup;
-long lDataID = 0;
-int i = 0;
-COleVariant varKey( (long) 0 ); // VT_I4
-
+	BOOL bIsGroup;
+	long lDataID = 0;
+	int i = 0;
+	COleVariant varKey( (long) 0 ); // VT_I4
+	
 	try
 	{
-	CMainTable recs;
+		CMainTable recs;
 		recs.Open( dbOpenTable, "Main" );
 		recs.SetCurrentIndex("lID"); // set "Seek" to use this index.
-
+		
 		varKey.lVal = lID;
 		// Goto the record whose [lID] field == varKey
 		if( !recs.Seek( _T("="), &varKey ) )
@@ -185,24 +185,24 @@ COleVariant varKey( (long) 0 ); // VT_I4
 			ASSERT(0);
 			return FALSE;
 		}
-
+		
 		lDataID = recs.m_lDataID;
 		bIsGroup = recs.m_bIsGroup;
-
+		
 		// must delete this record first so that DeleteDataID can properly
 		//  determine if any other Clip is using the same Data.
 		recs.Delete(); 
-
+		
 		if( bIsGroup )
 			DeleteGroupID( lID, bDisband );
 		else
 			DeleteDataID( lDataID );
-
+		
 		recs.Close();
 	}
 	CATCHDAO
-
-	return TRUE;
+		
+		return TRUE;
 }
 
 // deletes all items in the group
@@ -213,23 +213,23 @@ BOOL DeleteGroupID( long lGroupID, bool bDisband )
 		return ExecuteSQL( 
 			StrF("UPDATE Main SET lParentID = 0 WHERE lParentID = %d", lGroupID) );
 	}
-
+	
 	try
 	{
-	CMainTable recs;
+		CMainTable recs;
 		recs.Open( "SELECT * FROM Main WHERE lParentID = %d", lGroupID );
-
+		
 		while( !recs.IsEOF() )
 		{
 			DeleteID( recs.m_lID );
 			recs.MoveNext();
 		}
-
+		
 		recs.Close();
 	}
 	CATCHDAO
-
-	return TRUE;
+		
+		return TRUE;
 }
 
 // deletes all data for the given ID
@@ -238,8 +238,8 @@ BOOL DeleteGroupID( long lGroupID, bool bDisband )
 // THEREFORE, Main records should be deleted BEFORE calling this function.
 BOOL DeleteDataID( long lDataID )
 {
-CMainTable recs;
-BOOL bEmpty;
+	CMainTable recs;
+	BOOL bEmpty;
 	// check to see if the data is referenced by any Clips
 	recs.Open( "SELECT * FROM Main WHERE lDataID = %d", lDataID );
 	bEmpty = recs.IsEOF();
@@ -253,8 +253,8 @@ BOOL bEmpty;
 
 BOOL DeleteAllIDs()
 {
-CMainTable MainTable;
-CDataTable DataTable;
+	CMainTable MainTable;
+	CDataTable DataTable;
 	MainTable.DeleteAll();
 	DataTable.DeleteAll();
 	if( CompactDatabase() )
@@ -267,18 +267,18 @@ CDataTable DataTable;
 // all "formatIDs" (Data.lID) must be elements of the "lDataID" (Data.lDataID) set
 BOOL DeleteFormats( long lDataID, ARRAY& formatIDs )
 {
-long lNewTotalSize = 0;
-bool bIsHeadDeleted = false;
-long lNewDataID = 0;
-
+	long lNewTotalSize = 0;
+	bool bIsHeadDeleted = false;
+	long lNewDataID = 0;
+	
 	if( formatIDs.GetSize() <= 0 )
 		return TRUE;
-
+	
 	formatIDs.SortAscending();
-
+	
 	try
 	{
-	CDataTable recs;
+		CDataTable recs;
 		recs.Open("SELECT * FROM Data WHERE lDataID = %d", lDataID);
 		//Go through the data table and find the deleted items
 		recs.MoveFirst();
@@ -291,15 +291,15 @@ long lNewDataID = 0;
 				//  lID autoincr field never reuses IDs.
 				if( lDataID == recs.m_lID )
 					bIsHeadDeleted = true;
-
+				
 				recs.Delete();
 			}
 			else
 				lNewTotalSize += recs.m_ooData.m_dwDataLength;
-
+			
 			recs.MoveNext();
 		}
-
+		
 		if( bIsHeadDeleted )
 		{
 			recs.MoveFirst();
@@ -324,13 +324,13 @@ long lNewDataID = 0;
 		}
 	}
 	CATCHDAO
-
-	return TRUE;
+		
+		return TRUE;
 }
 
 
 /*------------------------------------------------------------------*\
-	CClipIDs
+CClipIDs
 \*------------------------------------------------------------------*/
 
 //-------------------
@@ -340,7 +340,7 @@ long lNewDataID = 0;
 // allocate an HGLOBAL of the given Format Type representing these Clip IDs.
 HGLOBAL CClipIDs::Render( UINT cfType )
 {
-int count = GetSize();
+	int count = GetSize();
 	if( count <= 0 )
 		return 0;
 	if( count == 1 )
@@ -351,7 +351,7 @@ int count = GetSize();
 
 void CClipIDs::GetTypes( CClipTypes& types )
 {
-int count = GetSize();
+	int count = GetSize();
 	types.RemoveAll();
 	if( count > 1 )
 		types.Add( CF_TEXT );
@@ -370,24 +370,24 @@ CString CClipIDs::AggregateText( UINT cfType, char* pSeparator )
 	char* pData = NULL;
 	DWORD len;
 	DWORD maxLen;
-
+	
 	// maybe we should sum up the "recset.m_ooData.m_dwDataLength" of all IDs first
 	//  in order to determine the max space required??  Or would that be wastefull?
-
+	
 	// allocate a large initial buffer to minimize realloc for concatenations
 	text.GetBuffer(1000);
 	text.ReleaseBuffer(0);
-
+	
 	int numIDs = GetSize();
 	int* pIDs = GetData();
-
+	
 	csSQL.Format(
 		"SELECT Data.* FROM Data "
 		"INNER JOIN Main ON Main.lDataID = Data.lDataID "
 		"WHERE Data.strClipBoardFormat = \'%s\' "
 		"AND Main.lID = %%d",
 		GetFormatName(cfType));
-
+	
 	try
 	{
 		for( int i=0; i < numIDs; i++ )
@@ -400,7 +400,7 @@ CString CClipIDs::AggregateText( UINT cfType, char* pSeparator )
 					continue;
 				pData = (char*) GlobalLock(recset.m_ooData.m_hData);
 				ASSERT( pData );
-
+				
 				// verify that pData is null terminated 
 				// do a quick check to see if the last character is null
 				if( pData[maxLen-1] != '\0' )
@@ -410,10 +410,10 @@ CString CClipIDs::AggregateText( UINT cfType, char* pSeparator )
 					if( len >= maxLen )
 						continue;
 				}
-
+				
 				text += pData;
 				GlobalUnlock(recset.m_ooData.m_hData);
-
+				
 				if( pSeparator )
 					text += pSeparator;
 			}
@@ -421,8 +421,8 @@ CString CClipIDs::AggregateText( UINT cfType, char* pSeparator )
 		}
 	}
 	CATCHDAO
-
-	return text;
+		
+		return text;
 }
 
 //----------------------------------------------
@@ -432,8 +432,8 @@ CString CClipIDs::AggregateText( UINT cfType, char* pSeparator )
 // returns the address of the given id in this array or NULL.
 long* CClipIDs::FindID( long lID )
 {
-int count = GetSize();
-long* pID = (long*) GetData();
+	int count = GetSize();
+	long* pID = (long*) GetData();
 	for( int i=0; i < count; i++ )
 	{
 		if( *pID == lID )
@@ -448,18 +448,18 @@ long* pID = (long*) GetData();
 // if( dIncrement < 0 ), this does not change the order
 BOOL CClipIDs::MoveTo( long lParentID, double dFirst, double dIncrement )
 {
-int count = GetSize();
-int i = 0;
-COleVariant varKey( (long) 0 ); // VT_I4
-double dOrder = dFirst;
-BOOL bChangeOrder = (dIncrement >= 0);
-
+	int count = GetSize();
+	int i = 0;
+	COleVariant varKey( (long) 0 ); // VT_I4
+	double dOrder = dFirst;
+	BOOL bChangeOrder = (dIncrement >= 0);
+	
 	try
 	{
-	CMainTable recs;
+		CMainTable recs;
 		recs.Open( dbOpenTable, "Main" );
 		recs.SetCurrentIndex("lID"); // set "Seek" to use this index.
-
+		
 		// for each id, assign lParentID
 		while( i < count )
 		{
@@ -470,7 +470,7 @@ BOOL bChangeOrder = (dIncrement >= 0);
 				ASSERT(0);
 				break;
 			}
-
+			
 			// don't allow an item to become its own parent
 			// NOTE!: deeper recursion is not checked, so it is theoretically
 			//  possible for: A -> B -> A
@@ -478,40 +478,40 @@ BOOL bChangeOrder = (dIncrement >= 0);
 			{
 				recs.Edit();
 				recs.m_lParentID = lParentID;
-
+				
 				recs.m_lDontAutoDelete = (long)CTime::GetCurrentTime().GetTime();
 				if( bChangeOrder )
 					recs.m_dOrder = dOrder;
 				recs.Update();
 				dOrder = dOrder + dIncrement;
 			}
-
+			
 			i++;
 		}
 		recs.Close();
 	}
 	CATCHDAO
-
-	return (i == count);
+		
+		return (i == count);
 }
 
 // reorders the "lParentID" Group, inserting before the given id.
 //  if the id cannot be found, this appends the IDs.
 BOOL CClipIDs::ReorderGroupInsert( long lParentID, long lInsertBeforeID )
 {
-int count = GetSize();
-int i = 1; // start the enumeration
-int insert = 0;
-BOOL bResult;
-
+	int count = GetSize();
+	int i = 1; // start the enumeration
+	int insert = 0;
+	BOOL bResult;
+	
 	try
 	{
 		MoveTo(-1); // move all elements outside any group
-
-	CMainTable recs;
+		
+		CMainTable recs;
 		recs.m_strSort = "dOrder ASC";
 		recs.Open( "SELECT * FROM Main WHERE lParentID = %d", lParentID );
-
+		
 		while( !recs.IsEOF() )
 		{
 			if( recs.m_lID == lInsertBeforeID )
@@ -519,58 +519,58 @@ BOOL bResult;
 				insert = i;
 				i = insert + count;
 			}
-
+			
 			recs.Edit();
 			recs.m_dOrder = i;
 			recs.Update();
-
+			
 			i++;
 			recs.MoveNext();
 		}
-
+		
 		recs.Close();
-
+		
 		if( insert == 0 )
 			insert = i;
-
+		
 		// move the elements into their proper position in the group
 		bResult = MoveTo( lParentID, (double) insert, (double) 1 );
 	}
 	CATCHDAO
-
-	return bResult;
+		
+		return bResult;
 }
 
 // Empties this array and fills it with the elements of the given group ID
 BOOL CClipIDs::LoadElementsOf( long lGroupID )
 {
-int fldID; // index of the lID field
-COleVariant varID; // value of the lID field
-int count = 0;
-
+	int fldID; // index of the lID field
+	COleVariant varID; // value of the lID field
+	int count = 0;
+	
 	SetSize(0);
-
+	
 	try
 	{
-	CMainTable recs;
+		CMainTable recs;
 		recs.SetBindFields(false);
 		recs.Open("SELECT lID FROM Main WHERE lParentID = %d", lGroupID);
-
+		
 		fldID = GetFieldPos(recs,"lID");
 		VERIFY( fldID == 0 ); // should be 0 since it is the only field
-
+		
 		while( !recs.IsEOF() )
 		{
 			recs.GetFieldValue( fldID, varID );
 			Add( varID.lVal );
 			recs.MoveNext();
 		}
-
+		
 		recs.Close();
 	}
 	CATCHDAO
-
-	return GetSize();
+		
+		return GetSize();
 }
 
 // Creates copies (duplicates) of all items in this array and assigns the
@@ -582,9 +582,9 @@ int count = 0;
 //   an alternative design would be to have one CMainTable per level deep,
 //   but I thought that might be too costly, so I implemented it this way.
 BOOL CClipIDs::CopyTo( long lParentID, CClipIDs* pCopies,
-                       CMainTable* pAddNewTable, CMainTable* pSeekTable )
+					  CMainTable* pAddNewTable, CMainTable* pSeekTable )
 {
-int count = GetSize();
+	int count = GetSize();
 	if( pCopies )
 	{
 		pCopies->SetSize( count );
@@ -594,18 +594,18 @@ int count = GetSize();
 	}
 	if( count == 0 )
 		return TRUE;
-
-// for Seeking
-BOOL bSeekFailed = FALSE;
-COleVariant varID( (long) 0, VT_I4 );
-
-// for recursing into groups
-CMainTable* pAddTable = pAddNewTable;
-CMainTable* pTable = pSeekTable;
-CClipIDs groupIDs;
-
-long lCopyID;
-
+	
+	// for Seeking
+	BOOL bSeekFailed = FALSE;
+	COleVariant varID( (long) 0, VT_I4 );
+	
+	// for recursing into groups
+	CMainTable* pAddTable = pAddNewTable;
+	CMainTable* pTable = pSeekTable;
+	CClipIDs groupIDs;
+	
+	long lCopyID;
+	
 	try
 	{
 		if( pTable == NULL )
@@ -614,14 +614,14 @@ long lCopyID;
             pTable->Open(dbOpenTable,"Main");
 			pTable->SetCurrentIndex("lID");
 		}
-
+		
 		if( pAddTable == NULL )
 		{
 			pAddTable = new CMainTable;
             pAddTable->Open(dbOpenTable,"Main");
-//			pAddTable->SetCurrentIndex("lID");
+			//			pAddTable->SetCurrentIndex("lID");
 		}
-
+		
 		for( int i=0; i < count; i++ )
 		{
 			varID.lVal = ElementAt(i);
@@ -654,7 +654,7 @@ long lCopyID;
 			if( pCopies )
 				pCopies->ElementAt(i) = lCopyID;
 		}
-
+		
 		// if we were not given the table, then we created it, so we must delete it
 		if( pAddTable && pAddNewTable == NULL )
 		{
@@ -668,35 +668,35 @@ long lCopyID;
 		}
 	}
 	CATCHDAO
-
-	return !bSeekFailed;
+		
+		return !bSeekFailed;
 }
 
 BOOL CClipIDs::DeleteIDs( bool bDisband )
 {
-CPopup status(0,0,::GetForegroundWindow());
-bool bAllowShow;
+	CPopup status(0,0,::GetForegroundWindow());
+	bool bAllowShow;
 	bAllowShow = IsAppWnd(::GetForegroundWindow());
-
-BOOL bRet = TRUE;
-int count = GetSize();
-
+	
+	BOOL bRet = TRUE;
+	int count = GetSize();
+	
 	if(count <= 0)
 		return FALSE;
-
+	
 	for( int i=0; i < count; i++ )
 	{
 		if( bAllowShow )
 			status.Show( StrF("Deleting %d out of %d...",i+1,count) );
 		bRet = bRet && DeleteID( ElementAt(i), bDisband );
 	}
-
+	
 	return bRet;
 }
 
 
 /*------------------------------------------------------------------*\
-	COleClipSource
+COleClipSource
 \*------------------------------------------------------------------*/
 //IMPLEMENT_DYNAMIC(COleClipSource, COleDataSource)
 COleClipSource::COleClipSource()
@@ -711,23 +711,23 @@ BOOL COleClipSource::DoDelayRender()
 {
 	CClipTypes types;
 	m_ClipIDs.GetTypes( types );
-
+	
 	int count = types.GetSize();
 	for( int i=0; i < count; i++ )
 		DelayRenderData( types[i] );
-
+	
 	return count;
 }
 
 BOOL COleClipSource::DoImmediateRender()
 {
-int count = m_ClipIDs.GetSize();
+	int count = m_ClipIDs.GetSize();
 	if( count <= 0 )
 		return 0;
 	if( count == 1 )
 	{
-	CClipFormats formats;
-	CClipFormat* pCF;
+		CClipFormats formats;
+		CClipFormat* pCF;
 		CClip::LoadFormats( m_ClipIDs[0], formats );
 		count = formats.GetSize(); // reusing "count"
 		for( int i=0; i < count; i++ )
@@ -739,9 +739,9 @@ int count = m_ClipIDs.GetSize();
 		formats.RemoveAll();
 		return count;
 	}
-
-HGLOBAL hGlobal;
-CString text = m_ClipIDs.AggregateText( CF_TEXT, "\r\n" );
+	
+	HGLOBAL hGlobal;
+	CString text = m_ClipIDs.AggregateText( CF_TEXT, "\r\n" );
 	hGlobal = NewGlobalP( (void*)(LPCSTR) text, text.GetLength()+1 );
 	CacheGlobalData( CF_TEXT, hGlobal );
 	return hGlobal != 0;
@@ -756,10 +756,10 @@ END_MESSAGE_MAP()
 BOOL COleClipSource::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal)
 {
 	HGLOBAL hData = m_ClipIDs.Render( lpFormatEtc->cfFormat );
-
+	
 	if( !hData )
 		return FALSE;
-
+	
 	// if phGlobal is null, we can just give the allocated mem
 	// else, our data must fit within the GlobalSize(*phGlobal)
 	if( *phGlobal == 0 )
@@ -776,7 +776,7 @@ BOOL COleClipSource::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlob
 
 
 /*------------------------------------------------------------------*\
-	CProcessPaste
+CProcessPaste
 \*------------------------------------------------------------------*/
 
 CProcessPaste::CProcessPaste()
@@ -798,7 +798,7 @@ BOOL CProcessPaste::DoPaste()
 		//  m_pOle->m_ClipIDs and m_pOle is inaccessible after
 		//  SetClipboard is called.
 		MarkAsPasted();
-
+		
 		// Ignore the clipboard change that we will cause IF:
 		// 1) we are pasting a single element, since the element is already
 		//    in the db and its lDate was updated by MarkAsPasted().
@@ -806,13 +806,13 @@ BOOL CProcessPaste::DoPaste()
 		// 2) we are pasting multiple, but g_Opt.m_bSaveMultiPaste is false
 		if( GetClipIDs().GetSize() == 1 || !g_Opt.m_bSaveMultiPaste )
 			m_pOle->CacheGlobalData(theApp.m_cfIgnoreClipboard, NewGlobalP("Ignore", sizeof("Ignore")));
-
+		
 		m_pOle->SetClipboard(); // m_pOle is now managed by the OLE clipboard
 		m_pOle = NULL; // m_pOle should not be accessed past this point
-
+		
 		if(m_bSendPaste)
 			theApp.SendPaste();
-
+		
 		return TRUE;
 	}
 	return FALSE;
@@ -832,7 +832,7 @@ BOOL CProcessPaste::DoDrag()
 
 void CProcessPaste::MarkAsPasted()
 {
-CClipIDs& clips = GetClipIDs();
+	CClipIDs& clips = GetClipIDs();
 	if( clips.GetSize() == 1 )
 		MarkClipAsPasted( clips.ElementAt(0) );
 }

+ 195 - 195
QListCtrl.cpp

@@ -24,7 +24,7 @@ CQListCtrl::CQListCtrl()
 {
 	m_pchTip = NULL;
 	m_pwchTip = NULL;
-
+	
 	LOGFONT lf;
 	
 	lf.lfHeight = -9;
@@ -41,9 +41,9 @@ CQListCtrl::CQListCtrl()
 	lf.lfQuality = DEFAULT_QUALITY;
 	lf.lfPitchAndFamily = VARIABLE_PITCH | FF_DONTCARE;
 	lstrcpy(lf.lfFaceName, "Small Font");
-
+	
 	m_SmallFont = ::CreateFontIndirect(&lf);
-
+	
 	m_bShowTextForFirstTenHotKeys = true;
 	m_bStartTop = true;
 }
@@ -52,23 +52,23 @@ CQListCtrl::~CQListCtrl()
 {
 	if(m_pchTip != NULL)
 		delete m_pchTip;
-
+	
 	if(m_pwchTip != NULL)
 		delete m_pwchTip;
-
+	
 	if( m_SmallFont )
 		::DeleteObject( m_SmallFont );
-
+	
 	DestroyAndCreateAccelerator(FALSE);
 }
 
 // returns the position 1-10 if the index is in the FirstTen block else -1
 int CQListCtrl::GetFirstTenNum( int index )
 {
-// set firstTenNum to the first ten number (1-10) corresponding to the given index
-int firstTenNum = -1; // -1 means that nItem is not in the FirstTen block.
-int count = GetItemCount();
-
+	// set firstTenNum to the first ten number (1-10) corresponding to the given index
+	int firstTenNum = -1; // -1 means that nItem is not in the FirstTen block.
+	int count = GetItemCount();
+	
 	if( m_bStartTop )
 	{
 		if( 0 <= index && index <= 9 )
@@ -76,7 +76,7 @@ int count = GetItemCount();
 	}
 	else // we are starting at the bottom and going up
 	{
-	int idxStartFirstTen = count-10; // start of the FirstTen block
+		int idxStartFirstTen = count-10; // start of the FirstTen block
 		// if index is within the FirstTen block
 		if( idxStartFirstTen <= index && index < count )
 			firstTenNum = count - index;
@@ -90,33 +90,33 @@ int CQListCtrl::GetFirstTenIndex( int num )
 {
 	if( num <= 0 || num > 10 )
 		return -1;
-
+	
 	if( m_bStartTop )
 		return num-1;
 	// else we are starting at the bottom and going up
-int count = GetItemCount();
+	int count = GetItemCount();
 	return count - num;
 }
 
 
 BEGIN_MESSAGE_MAP(CQListCtrl, CListCtrl)
-	//{{AFX_MSG_MAP(CQListCtrl)
-	ON_NOTIFY_REFLECT(LVN_KEYDOWN, OnKeydown)
-	ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
-	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdrawList)
-	ON_WM_SYSKEYDOWN()
-	ON_WM_ERASEBKGND()
-	ON_WM_CREATE()
-	ON_WM_VSCROLL()
-	ON_WM_HSCROLL()
-	ON_WM_TIMER()
-	ON_WM_WINDOWPOSCHANGED()
-	ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnSelectionChange)
-	ON_WM_SIZE()
-	//}}AFX_MSG_MAP
-	ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
-	ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
-	ON_WM_KILLFOCUS()
+//{{AFX_MSG_MAP(CQListCtrl)
+ON_NOTIFY_REFLECT(LVN_KEYDOWN, OnKeydown)
+ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
+ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdrawList)
+ON_WM_SYSKEYDOWN()
+ON_WM_ERASEBKGND()
+ON_WM_CREATE()
+ON_WM_VSCROLL()
+ON_WM_HSCROLL()
+ON_WM_TIMER()
+ON_WM_WINDOWPOSCHANGED()
+ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnSelectionChange)
+ON_WM_SIZE()
+//}}AFX_MSG_MAP
+ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
+ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
+ON_WM_KILLFOCUS()
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -135,11 +135,11 @@ void CQListCtrl::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 			SendSelection(arr);
 		}
 		break;
-
+		
 	case VK_ESCAPE:
 		GetParent()->SendMessage(NM_END, 0, 0);
 		break;
-
+		
 	case VK_RIGHT:
 		{
 			int nItem = GetNextItem(-1, LVNI_SELECTED);
@@ -147,7 +147,7 @@ void CQListCtrl::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 				GetParent()->SendMessage(NM_RIGHT, nItem, 0);
 		}
 		break;
-
+		
 	case VK_LEFT:
 		GetParent()->SendMessage(NM_LEFT, 0, 0);
 		break;
@@ -155,7 +155,7 @@ void CQListCtrl::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 		GetParent()->SendMessage(NM_DELETE, 0, 0);
 		break;
 	}
-
+	
 	*pResult = 0;
 }
 
@@ -170,7 +170,7 @@ void CQListCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
 		if (Flags | LVHT_ONITEM)
 			SendSelection(nItem);
 	}
-
+	
 	*pResult = 0;
 }
 
@@ -187,26 +187,26 @@ void CQListCtrl::SendSelection(ARRAY &arrItems)
 void CQListCtrl::GetSelectionIndexes(ARRAY &arr)
 {
 	arr.RemoveAll();
-
+	
 	POSITION pos = GetFirstSelectedItemPosition();
 	while (pos)
 		arr.Add(GetNextSelectedItem(pos));
 	
-
-	/*
-	int nItem = GetNextItem(-1, LVNI_SELECTED);
-	while (nItem != -1)
-	{
+	
+		/*
+		int nItem = GetNextItem(-1, LVNI_SELECTED);
+		while (nItem != -1)
+		{
 		arr.Add(nItem);
 		nItem = GetNextItem(nItem, LVNI_SELECTED);
-	}
+		}
 	*/
 }
 
 void CQListCtrl::GetSelectionItemData(ARRAY &arr)
 {
-DWORD dwData;
-int i;
+	DWORD dwData;
+	int i;
 	arr.RemoveAll();
 	POSITION pos = GetFirstSelectedItemPosition();
 	while (pos)
@@ -220,8 +220,8 @@ int i;
 	int nItem = GetNextItem(-1, LVNI_SELECTED);
 	while (nItem != -1)
 	{
-		arr.Add((int)GetItemData(nItem));
-		nItem = GetNextItem(nItem, LVNI_SELECTED);
+	arr.Add((int)GetItemData(nItem));
+	nItem = GetNextItem(nItem, LVNI_SELECTED);
 	}
 	*/
 }
@@ -266,7 +266,7 @@ BOOL CQListCtrl::SetListPos( int index )
 {
 	if( index < 0 || index >= GetItemCount() )
 		return FALSE;
-
+	
 	RemoveAllSelection();
 	SetCaret(index);
 	SetSelection(index);
@@ -278,31 +278,31 @@ BOOL CQListCtrl::SetFormattedText(int nRow, int nCol, LPCTSTR lpszFormat,...)
 {
 	CString csText;
 	va_list vlist;
-
+	
 	ASSERT(AfxIsValidString(lpszFormat));
 	va_start(vlist,lpszFormat);
 	csText.FormatV(lpszFormat,vlist);
 	va_end(vlist);
-
+	
 	return SetText(nRow,nCol,csText);
 }
 
 void CQListCtrl::SetNumberOfLinesPerRow(int nLines)
 {
 	CDC *pDC = GetDC();
-
+	
 	CRect crRect(0, 0, 0, 0);
-
+	
 	CFont *pOldFont = pDC->SelectObject(GetFont());
-
+	
 	//Get the height to draw one character
 	pDC->DrawText("W", crRect, DT_VCENTER | DT_EXPANDTABS | DT_CALCRECT);
-
+	
 	pDC->SelectObject(pOldFont);
-
+	
 	//Get the total height of each row
 	int nHeight = (crRect.Height() * nLines) + ROW_BOTTOM_BORDER;
-
+	
 	//Create a image list of that height and set it to the list box
 	CImageList imglist;
 	imglist.Create(DUMMY_COL_WIDTH, nHeight, ILC_COLOR16 | ILC_MASK, 1, 1);
@@ -314,7 +314,7 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
     
     *pResult = 0;
-
+	
     // Request item-specific notifications if this is the
     // beginning of the paint cycle.
     if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
@@ -329,7 +329,7 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
         COLORREF crBkgnd;
         BOOL     bListHasFocus;
         CRect    rcItem;
-                		
+		
         bListHasFocus = ( GetSafeHwnd() == ::GetFocus() );
         
         // Get the image index and selected/focused state of the
@@ -339,17 +339,17 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
         rItem.iItem = nItem;
         rItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
         GetItem(&rItem);
-				
+		
         // Get the rect that bounds the text label.
         GetItemRect(nItem, rcItem, LVIR_LABEL);
 		rcItem.left -= DUMMY_COL_WIDTH;
-
+		
 		CPen cpWhite;
 		cpWhite.CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
 		CPen *pOldPen = NULL;
 		COLORREF OldColor = -1;
 		int nOldBKMode = -1;
-
+		
 		// Draw the background of the list item.  Colors are selected 
 		// according to the item's state.
 		if(rItem.state & LVIS_SELECTED)
@@ -386,12 +386,12 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 		
         // Draw the text.
         //CString csText = GetItemText(nItem, 0);
-
+		
 		CString csText;
 		LPTSTR lpszText = csText.GetBufferSetLength(g_Opt.m_bDescTextSize);
 		GetItemText(nItem, 0, lpszText, g_Opt.m_bDescTextSize);
 		csText.ReleaseBuffer();
-
+		
 		// extract symbols
 		CString strSymbols;
 		int nSymEnd = csText.Find('|');
@@ -400,57 +400,57 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 			strSymbols = csText.Left(nSymEnd);
 			csText = csText.Mid(nSymEnd+1);
 		}
-
+		
 		// set firstTenNum to the first ten number (1-10) corresponding to
 		//  the current nItem.
 		// -1 means that nItem is not in the FirstTen block.
 		int firstTenNum = GetFirstTenNum(nItem);
-
+		
 		if( m_bShowTextForFirstTenHotKeys && firstTenNum > 0 )
 		{
 			rcText.left += 12;
 		}
-
+		
 		// if we are inside a group, don't display the "in group" flag
 		if( theApp.m_GroupID > 0 )
 		{
-		int nFlag = strSymbols.Find("!");
+			int nFlag = strSymbols.Find("!");
 			if( nFlag >= 0 )
 				strSymbols.Delete(nFlag);
 		}
-
+		
 		// draw the symbol box
 		if( strSymbols.GetLength() > 0 )
 		{
 			strSymbols = " " + strSymbols + " "; // leave space for box
 			// add spaces to leave room for the symbols
-		CRect rectSym(rcText.left, rcText.top+1, rcText.left, rcText.top+1);
-		CRect rectSpace(0,0,0,0);
+			CRect rectSym(rcText.left, rcText.top+1, rcText.left, rcText.top+1);
+			CRect rectSpace(0,0,0,0);
 			//Get text bounds
 			pDC->DrawText(" ", &rectSpace, DT_VCENTER | DT_EXPANDTABS | DT_CALCRECT);
 			pDC->DrawText(strSymbols, &rectSym, DT_VCENTER | DT_EXPANDTABS | DT_CALCRECT);
 			VERIFY( rectSpace.Width() > 0 );
-
-		int numSpaces = rectSym.Width() / rectSpace.Width();
+			
+			int numSpaces = rectSym.Width() / rectSpace.Width();
 			numSpaces++;
 			csText = CString(' ',numSpaces) + csText;
-
+			
 			// draw the symbols
 			pDC->FillSolidRect( rectSym, GetSysColor(COLOR_ACTIVECAPTION) );
 			//pDC->FillSolidRect( rectSym, RGB(0,255,255) );
-	        pDC->Draw3dRect(rectSym, GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_3DDKSHADOW));
-//		COLORREF crOld = pDC->SetTextColor(GetSysColor(COLOR_INFOTEXT));
-		COLORREF crOld = pDC->SetTextColor(RGB(255, 255, 255));
+			pDC->Draw3dRect(rectSym, GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_3DDKSHADOW));
+			//		COLORREF crOld = pDC->SetTextColor(GetSysColor(COLOR_INFOTEXT));
+			COLORREF crOld = pDC->SetTextColor(RGB(255, 255, 255));
 			pDC->DrawText(strSymbols, rectSym, DT_VCENTER | DT_EXPANDTABS);
 			pDC->SetTextColor(crOld);
 		}
-
+		
 		pDC->DrawText(csText, rcText, DT_VCENTER | DT_EXPANDTABS);
-
+		
         // Draw a focus rect around the item if necessary.
         if(bListHasFocus && (rItem.state & LVIS_FOCUSED))
 			pDC->DrawFocusRect(rcItem);
-
+		
 		if( m_bShowTextForFirstTenHotKeys && firstTenNum > 0 )
 		{
 			CString cs;
@@ -458,7 +458,7 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 				cs = "0";
 			else
 				cs.Format("%d", firstTenNum);
-
+			
 			CRect crClient;
 			
 			GetWindowRect(crClient);
@@ -469,27 +469,27 @@ void CQListCtrl::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
 			crHotKey.right = crHotKey.left + 11;
 			crHotKey.left += 2;
 			crHotKey.top += 2;
-
+			
 			HFONT hOldFont = (HFONT)pDC->SelectObject(m_SmallFont);
-
+			
 			pDC->DrawText(cs, crHotKey, DT_BOTTOM);
-
+			
 			pDC->MoveTo(CPoint(rcItem.left + 11, rcItem.top));
 			pDC->LineTo(CPoint(rcItem.left + 11, rcItem.bottom));
 			
 			pDC->SelectObject(hOldFont);
 		}
-
+		
 		// restore the previous values
 		if(pOldPen)
 			pDC->SelectObject(pOldPen);
-
+		
 		if(OldColor > -1)
 			pDC->SetTextColor(OldColor);
-
+		
 		if(nOldBKMode > -1)
 			pDC->SetBkMode(nOldBKMode);
-
+		
         *pResult = CDRF_SKIPDEFAULT;    // We've painted everything.
 	}
 }
@@ -516,10 +516,10 @@ BOOL CQListCtrl::OnEraseBkgnd(CDC* pDC)
 	//	painting.  However, there is a pixel buffer around the
 	//	border of this control (not within the item rects)
 	//	which becomes visually corrupt if it is not erased.
-
+	
 	// In most cases, I do not notice the erasure, so I have kept
 	//	the call to CListCtrl::OnEraseBkgnd(pDC);
-
+	
 	// However, for some reason, bulk erasure is very noticeable when
 	//	shift-scrolling the page to select a block of items, so
 	//	I made a special case for that:
@@ -534,21 +534,21 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
 	TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
 	CString strTipText;
-
+	
 	UINT nID = pNMHDR->idFrom;
-
+	
 	if(nID == 0)	  	// Notification in NT from automatically
 		return FALSE;   	// created tooltip
 	
 	::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 500);
-
+	
 	// Use Item's name as the tool tip. Change this for something different.
 	// Like use its file size, etc.
 	GetToolTipText(nID-1, strTipText);
-
+	
 	//Replace the tabs with spaces, the tooltip didn't like the \t s
 	strTipText.Replace("\t", "  ");
-
+	
 #ifndef _UNICODE
 	if (pNMHDR->code == TTN_NEEDTEXTA)
 	{
@@ -564,7 +564,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	{
 		if(m_pwchTip != NULL)
 			delete m_pwchTip;
-
+		
 		m_pwchTip = new WCHAR[strTipText.GetLength()+1];
 		_mbstowcsz(m_pwchTip, strTipText, strTipText.GetLength());
 		m_pwchTip[strTipText.GetLength()] = 0; // end of text
@@ -575,7 +575,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	{
 		if(m_pchTip != NULL)
 			delete m_pchTip;
-
+		
 		m_pchTip = new TCHAR[strTipText.GetLength()+1];
 		_wcstombsz(m_pchTip, strTipText, strTipText.GetLength());
 		m_pchTip[strTipText.GetLength()] = 0; // end of text
@@ -585,7 +585,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	{
 		if(m_pwchTip != NULL)
 			delete m_pwchTip;
-
+		
 		m_pwchTip = new WCHAR[strTipText.GetLength()+1];
 		lstrcpyn(m_pwchTip, strTipText, strTipText.GetLength());
 		m_pwchTip[strTipText.GetLength()] = 0;
@@ -593,7 +593,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	}
 #endif
 	*pResult = 0;
-
+	
 	return TRUE;    // message was handled
 }
 
@@ -622,7 +622,7 @@ int CQListCtrl::OnToolHitTest(CPoint point, TOOLINFO * pTI) const
 			}
 		}
 	}
-
+	
 	return -1;
 }
 
@@ -632,114 +632,114 @@ int CQListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
 		return -1;
 	
 	EnableToolTips();
-
+	
 	m_Popup.Init();
-//	m_Popup.SetTTWnd( GetToolTips()->m_hWnd );
-//	m_Popup.m_TI.hwnd = m_hWnd;
+	//	m_Popup.SetTTWnd( GetToolTips()->m_hWnd );
+	//	m_Popup.m_TI.hwnd = m_hWnd;
     
 	return 0;
 }
 
 BOOL CQListCtrl::PreTranslateMessage(MSG* pMsg) 
 {
-DWORD dID;
+	DWORD dID;
 	if(m_Accels.OnMsg(pMsg, dID))
 		if(GetParent()->SendMessage(NM_SELECT_DB_ID, dID, 0) )
 			return TRUE;
-
-	switch(pMsg->message) 
-	{
-	case WM_KEYDOWN:
-		WPARAM vk = pMsg->wParam;
 		
-		if(m_Popup.m_bIsShowing)
+		switch(pMsg->message) 
 		{
-			m_Popup.Hide();
-
-			if(vk == VK_ESCAPE)
-				return TRUE;
-		}
-
-		// if a number key was pressed
-		if( '0' <= vk && vk <= '9' )
-		{
-			// if <Ctrl> is required but is absent, then break
-			if( g_Opt.m_bUseCtrlNumAccel && !(GetKeyState(VK_CONTROL) & 0x8000) )
-				break;
-
-			int index = vk - '0';
-			// '0' is actually 10 in the ditto window
-			if( index == 0 )
-				index = 10;
-			// translate num 1-10 into the actual index (based upon m_bStartTop)
-			index = GetFirstTenIndex( index );
-			GetParent()->SendMessage(NM_SELECT_INDEX, index, 0);
-			return TRUE;
-		}
-
-		switch( vk )
-		{
-		case 'X': // Ctrl-X = Cut (prepare for moving the items into a Group)
-			if(GetKeyState(VK_CONTROL) & 0x8000)
-			{
-				LoadCopyOrCutToClipboard();		
-
-				theApp.IC_Cut(); // uses selection
-				return TRUE;
-			}
-			break;
-
-		case 'C': // Ctrl-C = Copy (prepare for copying the items into a Group)
-			if(GetKeyState(VK_CONTROL) & 0x8000)
+		case WM_KEYDOWN:
+			WPARAM vk = pMsg->wParam;
+			
+			if(m_Popup.m_bIsShowing)
 			{
-				LoadCopyOrCutToClipboard();
-
-				theApp.IC_Copy(); // uses selection
-				return TRUE;
+				m_Popup.Hide();
+				
+				if(vk == VK_ESCAPE)
+					return TRUE;
 			}
-			break;
-
-		case 'V': // Ctrl-V = Paste (actually performs the copy or move of items into the current Group)
-			if(GetKeyState(VK_CONTROL) & 0x8000)
+			
+			// if a number key was pressed
+			if( '0' <= vk && vk <= '9' )
 			{
-				theApp.IC_Paste();
+				// if <Ctrl> is required but is absent, then break
+				if( g_Opt.m_bUseCtrlNumAccel && !(GetKeyState(VK_CONTROL) & 0x8000) )
+					break;
+				
+				int index = vk - '0';
+				// '0' is actually 10 in the ditto window
+				if( index == 0 )
+					index = 10;
+				// translate num 1-10 into the actual index (based upon m_bStartTop)
+				index = GetFirstTenIndex( index );
+				GetParent()->SendMessage(NM_SELECT_INDEX, index, 0);
 				return TRUE;
 			}
-			break;
-
-		case 'A': // Ctrl-A = Select All
-			if(GetKeyState(VK_CONTROL) & 0x8000)
+			
+			switch( vk )
 			{
-				int nCount = GetItemCount();
-				for(int i = 0; i < nCount; i++)
+			case 'X': // Ctrl-X = Cut (prepare for moving the items into a Group)
+				if(GetKeyState(VK_CONTROL) & 0x8000)
 				{
-					SetSelection(i);
+					LoadCopyOrCutToClipboard();		
+					
+					theApp.IC_Cut(); // uses selection
+					return TRUE;
 				}
+				break;
+				
+			case 'C': // Ctrl-C = Copy (prepare for copying the items into a Group)
+				if(GetKeyState(VK_CONTROL) & 0x8000)
+				{
+					LoadCopyOrCutToClipboard();
+					
+					theApp.IC_Copy(); // uses selection
+					return TRUE;
+				}
+				break;
+				
+			case 'V': // Ctrl-V = Paste (actually performs the copy or move of items into the current Group)
+				if(GetKeyState(VK_CONTROL) & 0x8000)
+				{
+					theApp.IC_Paste();
+					return TRUE;
+				}
+				break;
+				
+			case 'A': // Ctrl-A = Select All
+				if(GetKeyState(VK_CONTROL) & 0x8000)
+				{
+					int nCount = GetItemCount();
+					for(int i = 0; i < nCount; i++)
+					{
+						SetSelection(i);
+					}
+					return TRUE;
+				}
+				break;
+				
+			case VK_F3:
+				{
+					ShowFullDescription();
+					return TRUE;
+				}
+			case VK_BACK:
+				theApp.EnterGroupID( theApp.m_GroupParentID );
 				return TRUE;
-			}
-			break;
-
-		case VK_F3:
-			{
-				ShowFullDescription();
-				return TRUE;
-			}
-		case VK_BACK:
-			theApp.EnterGroupID( theApp.m_GroupParentID );
-			return TRUE;
-		case VK_SPACE:
-			if(GetKeyState(VK_CONTROL) & 0x8000)
-			{
-				theApp.ShowPersistent( !g_Opt.m_bShowPersistent );
-				return TRUE;
-			}
-			break;
-		} // end switch(vk)
-
-		break; // end case WM_KEYDOWN
-	} // end switch(pMsg->message)
-
-	return CListCtrl::PreTranslateMessage(pMsg);
+			case VK_SPACE:
+				if(GetKeyState(VK_CONTROL) & 0x8000)
+				{
+					theApp.ShowPersistent( !g_Opt.m_bShowPersistent );
+					return TRUE;
+				}
+				break;
+			} // end switch(vk)
+			
+			break; // end case WM_KEYDOWN
+		} // end switch(pMsg->message)
+		
+		return CListCtrl::PreTranslateMessage(pMsg);
 }
 
 void CQListCtrl::LoadCopyOrCutToClipboard()
@@ -751,7 +751,7 @@ void CQListCtrl::LoadCopyOrCutToClipboard()
 		return;
 	
 	CProcessPaste paste;
-
+	
 	//Don't send the paste just load it into memory
 	paste.m_bSendPaste = false;
 	
@@ -759,7 +759,7 @@ void CQListCtrl::LoadCopyOrCutToClipboard()
 		paste.GetClipIDs().Copy(arr);
 	else
 		paste.GetClipIDs().Add(arr[0]);
-
+	
 	paste.DoPaste();
 }
 
@@ -770,7 +770,7 @@ void CQListCtrl::ShowFullDescription(bool bFromAuto)
 	GetWindowRect(&crWindow);
 	GetItemRect(nItem, rc, LVIR_BOUNDS);
 	ClientToScreen(rc);
-
+	
 	if(bFromAuto == false)
 	{
 		m_Popup.m_Pos = CPoint(rc.left, rc.bottom);
@@ -798,9 +798,9 @@ void CQListCtrl::GetToolTipText(int nItem, CString &csText)
 			//plus 100 for extra info - shortcut and such
 			info.cchTextMax = g_Opt.m_bDescTextSize + 100;
 			info.pszText = csText.GetBufferSetLength(info.cchTextMax);
-
+			
 			pParent->SendMessage(WM_NOTIFY,(WPARAM)info.hdr.idFrom,(LPARAM)&info);
-
+			
 			csText.ReleaseBuffer();			
 		}
 	}
@@ -818,17 +818,17 @@ DWORD CQListCtrl::GetItemData(int nItem)
 			info.hdr.code = LVN_GETDISPINFO;
 			info.hdr.hwndFrom = GetSafeHwnd();
 			info.hdr.idFrom = GetDlgCtrlID();
-
+			
 			info.item.iItem = nItem;
 			info.item.lParam = -1;
 			info.item.mask = LVIF_PARAM;
-		
+			
 			pParent->SendMessage(WM_NOTIFY,(WPARAM)info.hdr.idFrom,(LPARAM)&info);
-
+			
 			return info.item.lParam;
 		}
 	}
-
+	
 	return CListCtrl::GetItemData(nItem);
 }
 
@@ -865,7 +865,7 @@ BOOL CQListCtrl::SetItemCountEx(int iCount, DWORD dwFlags /* = LVSICF_NOINVALIDA
 void CQListCtrl::OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult)
 {
 	NMLISTVIEW *pnmv = (NMLISTVIEW *) pNMHDR;
-
+	
 	if((pnmv->uNewState == 3) ||
 		(pnmv->uNewState == 1))
 	{

File diff suppressed because it is too large
+ 251 - 251
QPasteWnd.cpp


+ 19 - 19
QuickPaste.cpp

@@ -30,14 +30,14 @@ CQuickPaste::~CQuickPaste()
 		delete m_pwndPaste;
 		m_pwndPaste = NULL;
 	}
-
+	
 }
 
 void CQuickPaste::Create(CWnd *pParent)
 {
-CPoint point;
-CSize csSize;
-
+	CPoint point;
+	CSize csSize;
+	
 	ASSERT(!m_pwndPaste);
 	m_pwndPaste = new CQPasteWnd;
 	ASSERT(m_pwndPaste);
@@ -56,14 +56,14 @@ BOOL CQuickPaste::CloseQPasteWnd()
 	{
 		if(m_pwndPaste->IsWindowVisible())
 			return FALSE;
-
+		
 		if(m_pwndPaste)
 			m_pwndPaste->SendMessage(WM_CLOSE, 0, 0);
-
+		
 		delete m_pwndPaste;
 		m_pwndPaste = NULL;
 	}
-
+	
 	return TRUE;
 }
 
@@ -80,27 +80,27 @@ void CQuickPaste::ShowQPasteWnd(CWnd *pParent, BOOL bAtPrevPos)
 			return;
 		}
 	}
-
-
+	
+	
 	CPoint ptCaret;
 	GetFocusWnd(&ptCaret); // get caret position relative to screen
 	ptCaret.Offset(-12, 12);
-
+	
 	int nPosition = CGetSetOptions::GetQuickPastePosition();
-
+	
 	CPoint point;
 	CRect rcPrev;
 	CSize csSize;
-
+	
 	if(!m_pwndPaste)
 		m_pwndPaste = new CQPasteWnd;
-
+	
 	if(!m_pwndPaste)
 	{
 		ASSERT(FALSE);
 		return;
 	}
-
+	
 	//If it is a window get the rect otherwise get the saved point and size
 	if (IsWindow(m_pwndPaste->m_hWnd))
 	{
@@ -112,7 +112,7 @@ void CQuickPaste::ShowQPasteWnd(CWnd *pParent, BOOL bAtPrevPos)
 		CGetSetOptions::GetQuickPastePoint(point);
 		CGetSetOptions::GetQuickPasteSize(csSize);
 	}
-
+	
 	if(bAtPrevPos)
 	{
 		CGetSetOptions::GetQuickPastePoint(point);
@@ -124,22 +124,22 @@ void CQuickPaste::ShowQPasteWnd(CWnd *pParent, BOOL bAtPrevPos)
 		GetCursorPos(&point);
 	else if(nPosition == POS_AT_PREVIOUS)
 		CGetSetOptions::GetQuickPastePoint(point);
-		
+	
 	if( !IsWindow(m_pwndPaste->m_hWnd) )
 	{
 		// Create the window   
 		VERIFY( m_pwndPaste->Create(point, pParent) );
 	}
-
+	
 	m_pwndPaste->MinMaxWindow(FORCE_MAX);
-
+	
 	if((nPosition == POS_AT_CARET) ||
 		(nPosition == POS_AT_CURSOR) ||
 		(bAtPrevPos))
 	{
 		m_pwndPaste->MoveWindow(CRect(point, csSize));
 	}
-		
+	
 	// Show the window
 	m_pwndPaste->ShowQPasteWindow();
 	m_pwndPaste->SetForegroundWindow();

File diff suppressed because it is too large
+ 262 - 262
WndEx.cpp


Some files were not shown because too many files changed in this diff