Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CAddProfileDialog Class Reference

#include <devprop.h>

List of all members.

Public Member Functions

 CAddProfileDialog (HWND hwndOwner, HINSTANCE hi)
 ~CAddProfileDialog ()
unsigned ProfileCount ()
LPCTSTR ProfileName (unsigned u)
CString ProfileNameAndExtension (unsigned u)
void AddProfile (LPCTSTR str)

Static Private Member Functions

UINT_PTR APIENTRY OpenFileHookProc (HWND hDlg, UINT uMessage, WPARAM wp, LPARAM lp)

Private Attributes

CStringArray csa_Files


Constructor & Destructor Documentation

CAddProfileDialog::CAddProfileDialog HWND  hwndOwner,
HINSTANCE  hi
 

Definition at line 604 of file devprop.cpp.

References AddProfile(), AddProfileAssociation, AllProfileFilterString, CAddProfileDialog(), csa_Files, DWORD, CStringArray::Empty(), FNERR_BUFFERTOOSMALL, gacColorDir, gacFilter, IccProfileFilterString, CString::Load(), MAX_PATH, NULL, OpenFileHookProc(), and TooManyFileSelected.

Referenced by CAddProfileDialog().

00604 { 00605 00606 TCHAR tempBuffer[MAX_PATH*10]; 00607 00608 // Empty the profile list. 00609 00610 csa_Files.Empty(); 00611 00612 // Prepare file filter (if not yet). 00613 00614 if (gacFilter[0] == NULL) { 00615 00616 ULONG offset; /* 32bits is enough even for sundown */ 00617 CString csIccFilter; CString csAllFilter; 00618 00619 // If the filter is not built yet, build it here. 00620 00621 csIccFilter.Load(IccProfileFilterString); 00622 csAllFilter.Load(AllProfileFilterString); 00623 offset = 0; 00624 lstrcpy(gacFilter+offset, csIccFilter); 00625 offset += lstrlen(csIccFilter)+1; 00626 lstrcpy(gacFilter+offset, TEXT("*.icm;*.icc")); 00627 offset += lstrlen(TEXT("*.icm;*.icc"))+1; 00628 lstrcpy(gacFilter+offset, csAllFilter); 00629 offset += lstrlen(csAllFilter)+1; 00630 lstrcpy(gacFilter+offset, TEXT("*.*")); 00631 offset += lstrlen(TEXT("*.*"))+1; 00632 *(gacFilter+offset) = TEXT('\0'); 00633 } 00634 00635 if (gacColorDir[0] == _TEXT('\0')) { 00636 DWORD dwcbDir = MAX_PATH; 00637 GetColorDirectory(NULL, gacColorDir, &dwcbDir); 00638 } 00639 00640 // Time to do the old OpenFile dialog stuff... 00641 CString csTitle; csTitle.Load(AddProfileAssociation); 00642 00643 // Set initial filename as null. 00644 memset(tempBuffer, 0, sizeof tempBuffer); 00645 00646 OPENFILENAME ofn = { 00647 sizeof ofn, hwndOwner, hi, 00648 gacFilter, 00649 NULL, 0, 1, 00650 tempBuffer, sizeof tempBuffer / sizeof tempBuffer[0], 00651 NULL, 0, 00652 gacColorDir, 00653 csTitle, 00654 OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_HIDEREADONLY | 00655 OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ENABLEHOOK, 00656 0, 0, 00657 _TEXT("icm"), 00658 (LPARAM) this, OpenFileHookProc, NULL}; 00659 00660 if (!GetOpenFileName(&ofn)) { 00661 if (CommDlgExtendedError() == FNERR_BUFFERTOOSMALL) { 00662 CGlobals::Report(TooManyFileSelected); 00663 } 00664 } else { 00665 if (tempBuffer[0] != TEXT('\0')) { 00666 00667 TCHAR *pPath = tempBuffer; 00668 TCHAR *pFile = tempBuffer + lstrlen(tempBuffer) + 1; 00669 00670 // remember the last access-ed directory. 00671 00672 memset(gacColorDir, 0, sizeof pPath); 00673 memcpy(gacColorDir, pPath, ofn.nFileOffset*sizeof(TCHAR)); 00674 00675 if (*pFile) { 00676 TCHAR workBuffer[MAX_PATH]; 00677 00678 // This is multiple-selection 00679 // Work through the buufer to build profile file list. 00680 00681 while (*pFile) { 00682 00683 lstrcpy(workBuffer,pPath); 00684 lstrcat(workBuffer,TEXT("\\")); 00685 lstrcat(workBuffer,pFile); 00686 00687 // Insert built profile pathname 00688 AddProfile(workBuffer); 00689 00690 // Move on to next. 00691 pFile = pFile + lstrlen(pFile) + 1; 00692 } 00693 } 00694 else { 00695 // Single selection case. 00696 AddProfile(pPath); 00697 00698 #if HIDEYUKN_DBG 00699 MessageBox(NULL,pPath,TEXT(""),MB_OK); 00700 #endif 00701 } 00702 } 00703 } 00704 00705 return; 00706 }

CAddProfileDialog::~CAddProfileDialog  )  [inline]
 

Definition at line 113 of file devprop.h.

References csa_Files, and CStringArray::Empty().

00113 { csa_Files.Empty(); }


Member Function Documentation

void CAddProfileDialog::AddProfile LPCTSTR  str  )  [inline]
 

Definition at line 119 of file devprop.h.

References CStringArray::Add(), AddProfile(), and csa_Files.

Referenced by AddProfile(), and CAddProfileDialog().

00119 { csa_Files.Add(str); }

UINT_PTR APIENTRY CAddProfileDialog::OpenFileHookProc HWND  hDlg,
UINT  uMessage,
WPARAM  wp,
LPARAM  lp
[static, private]
 

Definition at line 579 of file devprop.cpp.

References AddButtonText, APIENTRY, FALSE, GetParent(), CString::Load(), OpenFileHookProc(), SetDlgItemText(), TRUE, and UINT.

Referenced by CAddProfileDialog(), and OpenFileHookProc().

00580 { 00581 switch (uMessage) { 00582 00583 case WM_INITDIALOG: { 00584 00585 CString csAddButton; 00586 00587 OPENFILENAME *pofn = (OPENFILENAME *) lp; 00588 00589 csAddButton.Load(AddButtonText); 00590 00591 SetDlgItemText(GetParent(hDlg), IDOK, csAddButton); 00592 return TRUE; 00593 } 00594 } 00595 00596 return FALSE; 00597 }

unsigned CAddProfileDialog::ProfileCount  )  [inline]
 

Definition at line 115 of file devprop.h.

References CStringArray::Count(), and csa_Files.

Referenced by CDeviceProfileManagement::OnCommand().

00115 { return csa_Files.Count(); }

LPCTSTR CAddProfileDialog::ProfileName unsigned  u  )  [inline]
 

Definition at line 116 of file devprop.h.

References csa_Files, and ProfileName().

Referenced by CDeviceProfileManagement::OnCommand(), and ProfileName().

00116 { return csa_Files[u]; }

CString CAddProfileDialog::ProfileNameAndExtension unsigned  u  )  [inline]
 

Definition at line 117 of file devprop.h.

References csa_Files, and ProfileNameAndExtension().

Referenced by CDeviceProfileManagement::OnCommand(), and ProfileNameAndExtension().

00118 { return csa_Files[u].NameAndExtension(); }


Member Data Documentation

CStringArray CAddProfileDialog::csa_Files [private]
 

Definition at line 105 of file devprop.h.

Referenced by AddProfile(), CAddProfileDialog(), ProfileCount(), ProfileName(), ProfileNameAndExtension(), and ~CAddProfileDialog().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:26 2004 for test by doxygen 1.3.7