123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793 |
- // ShowPic3.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "ShowPic3.h"
- #include "ShowPic22.h"
- #include "JPEG.h"
- #include "MyLock.h"
- #define THUMBNAIL_WIDTH 100
- #define THUMBNAIL_HEIGHT 90
- ShowPic3::ShowPic3(CWnd* pParent /*=NULL*/) : CDialog(ShowPic3::IDD, pParent)
- {
- m_bTerminate = false;
- m_bRunning = false;
- m_hThread = NULL;
- }
- void ShowPic3::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ShowPic3)
- DDX_Control(pDX, IDC_LIST2, m_List2);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- //}}AFX_DATA_MAP
- DDX_Control(pDX, IDC_COMBO1, m_combobox);
- }
- BEGIN_MESSAGE_MAP(ShowPic3, CDialog)
- //{{AFX_MSG_MAP(ShowPic3)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
- ON_WM_DESTROY()
- ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
- ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
- ON_LBN_SELCHANGE(IDC_LIST2, OnSelchangeList2)
- ON_BN_CLICKED(IDC_BTNshow1, OnBTNshow1)
- ON_BN_CLICKED(IDC_BTNshow2, OnBTNshow2)
- ON_BN_CLICKED(IDC_BTNshow3, OnBTNshow3)
- ON_BN_CLICKED(IDC_BTNshow4, OnBTNshow4)
- ON_BN_CLICKED(IDC_BUTdel1, OnBUTdel1)
- ON_BN_CLICKED(IDC_BUTdel2, OnBUTdel2)
- ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3)
- ON_BN_CLICKED(IDC_BUTdel4, OnBUTdel4)
- //}}AFX_MSG_MAP
- ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
- ON_BN_CLICKED(Btn_NextOne, OnBnClickedNextone)
- ON_MESSAGE(OWNER_MSG_SHOWPHOTO, ShowPhoto2Found)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // ShowPic3 message handlers
- BOOL ShowPic3::OnInitDialog()
- {
- CDialog::OnInitDialog();
- CRect rc, rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
- GetClientRect(rc);
- m_List2.GetWindowRect(rc2);
- ScreenToClient(rc2);
- int dt = rc2.left;
- rc2.bottom = rc.bottom - dt;
- m_List2.MoveWindow(rc2);
- m_List1.GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.bottom = rc.bottom - dt;
- rc2.right = rc.right - dt;
- m_List1.MoveWindow(rc2);
- #if JEFF_TEST_ON
- CString strFilters = _T("[status3] = 'OK'");
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 217; // case 217:dindan表;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(strFilters);
- #else
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 217; // case 217:dindan表;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- #endif
- if (g_bSendOK == 0)
- {
- CDialog::OnCancel();
- return 0;
- }
- DataToArray(&g_List1array);
- LoadPhotos();// Jeff.获取客户原片里的所有订单文件夹名称;
- CString str;
- for (int i = 0; i < g_List1array.GetSize(); i++)
- {
- str = g_List1array.ElementAt(i).ElementAt(0); // Jeff.nIndex==0,为订单号id;
- if (FindArray(&m_dirarray1, str) == -1)
- {
- if (FindArray(&m_dirarray2, str) == -1)
- {
- if (FindArray(&m_dirarray3, str) == -1)
- {
- if (FindArray(&m_dirarray4, str) == -1)
- {
- continue;
- }
- }
- }
- }
- str += "\r\n";
- str += g_List1array.ElementAt(i).ElementAt(1); // Jeff.nIndex==1,为订单客户姓名1;
- str += g_List1array.ElementAt(i).ElementAt(2); // Jeff.nIndex==2,为订单客户姓名2;
- m_strArrayName.Add(str);
- m_combobox.AddString(g_List1array.ElementAt(i).ElementAt(1) + g_List1array.ElementAt(i).ElementAt(2));
- if (m_List2.GetCount() % 2)
- m_List2.AddEntry(str, g_gridcol1, m_List2.GetCount());
- else
- m_List2.AddEntry(str, g_gridcol2, m_List2.GetCount());
- }
- m_List2.Invalidate();
- // CenterWindow();
- m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
- m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
- return TRUE;
- }
- unsigned __stdcall LoadThumbNail20(LPVOID lpParam)
- {
- try
- {
- ShowPic3 *pDlg = (ShowPic3*)lpParam;
- CListCtrl *ListCtrl = &pDlg->m_List1;
- CImageList* pImgList = &pDlg->m_ImageListThumb;
- // reset our image list
- for (int i = 0; i < pImgList->GetImageCount(); i++)
- pImgList->Remove(i);
- // remove all items from list view
- ListCtrl->DeleteAllItems();
- pImgList->SetImageCount(pDlg->m_vFileName.size());
- TCHAR path[MAX_PATH];
- vector<CString>::iterator iter;
- // Set redraw to FALSE to avoid flickering during adding new items
- ListCtrl->SetRedraw(FALSE);
- int nIndex = 0;
- CString str, spath;
- for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
- {
- str = *iter;
- spath.Empty();
- if (str.Left(str.ReverseFind('\\') + 1) != pDlg->m_path)
- {
- spath = str.Left(str.ReverseFind('\\') + 1);
- spath = spath.Right(spath.GetLength() - pDlg->m_path.GetLength());
- }
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- str = spath + str.Left(str.GetLength() - 4);
- ListCtrl->InsertItem(nIndex, str, nIndex);
- }
- ListCtrl->SetRedraw(TRUE);
- ListCtrl->Invalidate();
- const float fRatio = (float)THUMBNAIL_HEIGHT / THUMBNAIL_WIDTH;
- int XDest, YDest, nDestWidth, nDestHeight;
- nIndex = 0;
- SolidBrush whitebrush(Color(255, 255, 255, 255));
- for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
- {
- // Load Image File
- Image *image = NULL;
- Bitmap *pBmp = NULL;
- str = *iter;
- spath = str.Left(str.ReverseFind('\\') + 1);
- spath += "s";
- spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- if (PathFileExists(spath))
- ::LoadImageFromBuf(&image, spath);
- else
- {
- str.MakeLower();
- if (str.Right(3) != "jpg")continue;
- ::LoadImageFromBuf(&image, str);
- }
- if (image == NULL)continue;
- int orientation = GetOrientation(image);
- if (orientation == 8)
- image->RotateFlip(Rotate270FlipNone);
- else if (orientation == 6)
- image->RotateFlip(Rotate90FlipNone);
- if (image->GetWidth() == 0)
- continue;
- // Calculate Rect to fit to canvas
- const float fImgRatio = (float)image->GetHeight() / image->GetWidth();
- if (fImgRatio > fRatio)
- {
- nDestWidth = THUMBNAIL_HEIGHT / fImgRatio;
- XDest = (THUMBNAIL_WIDTH - nDestWidth) / 2;
- YDest = 0;
- nDestHeight = THUMBNAIL_HEIGHT;
- }
- else
- {
- XDest = 0;
- nDestWidth = THUMBNAIL_WIDTH;
- nDestHeight = THUMBNAIL_WIDTH*fImgRatio;
- YDest = (THUMBNAIL_HEIGHT - nDestHeight) / 2;
- }
- pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
- Graphics graph2(pBmp);
- graph2.Clear(Color(255, 192, 192, 192));
- graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
- Graphics graph(pBmp);
- Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
- // Draw Image
- graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
- delete image;
- // Attach to Bitmap and Replace image in CImageList
- CBitmap bitmap;
- HBITMAP hbmp;
- pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
- bitmap.Attach(hbmp);
- pImgList->Replace(nIndex, &bitmap, NULL);
- delete pBmp;
- // Redraw only a current item for removing flickering and fast speed.
- ListCtrl->RedrawItems(nIndex, nIndex);
- // Release used DC and Object
- }
- ListCtrl->Invalidate();
- pDlg->m_bRunning = false;
- pDlg->m_bTerminate = false;
- _endthreadex(0);
- return 0;
- }
- catch (...)
- {
- }
- }
- void ShowPic3::LoadThumbImages()
- {
- TerminateThread();
- m_hThread = (HANDLE)_beginthreadex(NULL, 0, LoadThumbNail20, (LPVOID)this, 0/* CREATE_SUSPENDED*/, &m_dwThreadID);
- m_bRunning = true;
- }
- BOOL ShowPic3::TerminateThread()
- {
- if (!m_bRunning)
- return TRUE;
- m_bTerminate = true;
- for (;;)
- {
- if (::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0)
- break;
- MSG msg;
- while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
- {
- if (!AfxGetApp()->PumpMessage())
- break;
- }
- }
- ::CloseHandle(m_hThread);
- return TRUE;
- }
- void ShowPic3::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- ShowPic22 dlg;
- dlg.m_pos = iItem;
- dlg.m_pPathArray = &m_patharray1;
- dlg.DoModal();
- *pResult = 0;
- }
- void ShowPic3::OnDestroy()
- {
- TerminateThread();
- CDialog::OnDestroy();
- }
- void ShowPic3::LoadPhotos()
- {
- CString str;
- if (1)
- {
- // printf("Jeff:g_path1=%s\n\n",g_path1);//Jeff.获取客户原片里的所有订单文件夹名称;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(g_path1), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str == g_path1 + "\\")continue;
- str.TrimRight("\\");
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- // printf("Jeff:str=%s\n\n",str);
- m_dirarray1.Add(str);
- }
- }
- return;
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(g_path2), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str == g_path2 + "\\")continue;
- str.TrimRight("\\");
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- m_dirarray2.Add(str);
- }
- }
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(g_path3), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str == g_path3 + "\\")continue;
- str.TrimRight("\\");
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- m_dirarray3.Add(str);
- }
- }
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(g_path4), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str == g_path4 + "\\")continue;
- str.TrimRight("\\");
- str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
- m_dirarray4.Add(str);
- }
- }
- return;
- }
- void ShowPic3::OnBUTdel()
- {
- }
- void ShowPic3::OnSelchangeList2()
- {
- UpdateData();
- int pos = m_List2.GetCurSel();
- if (pos == -1)return;
- CString str;
- m_List2.GetText(pos, str);
- pos = str.Find("\r\n");
- if (pos == -1)return;;
- m_strOrderNumber = str.Left(pos);
- // printf("Jeff:欲显示的订单号=%s\n\n",m_strOrderNumber);
- ShowPhoto1();
- if (m_patharray1.GetSize() == 0)OnBTNshow2();
- if (m_patharray1.GetSize() == 0)OnBTNshow3();
- if (m_patharray1.GetSize() == 0)OnBTNshow4();
- }
- void ShowPic3::ShowPhoto1()
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return;
- }
- CString str;
- m_path = g_path1 + "\\" + m_strOrderNumber + "\\";
- m_patharray1.RemoveAll();
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- str.MakeLower();
- m_patharray1.Add(str);
- }
- }
- if (m_bRunning)return;
- CStringArray *pArray = &m_patharray1;
- m_vFileName.clear();
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- filePath.MakeLower();
- m_vFileName.push_back(filePath);
- }
- LoadThumbImages();
- }
- void ShowPic3::ShowPhoto2()
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return;
- }
- CString str;
- m_path = g_path2 + "\\" + m_strOrderNumber + "\\";
- m_patharray1.RemoveAll();
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- str.MakeLower();
- m_patharray1.Add(str);
- }
- }
- if (m_bRunning)return;
- CStringArray *pArray = &m_patharray1;
- m_vFileName.clear();
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- filePath.MakeLower();
- m_vFileName.push_back(filePath);
- }
- LoadThumbImages();
- }
- void ShowPic3::ShowPhoto3()
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return;
- }
- CString str;
- m_path = g_path3 + "\\" + m_strOrderNumber + "\\";
- m_patharray1.RemoveAll();
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- str.MakeLower();
- m_patharray1.Add(str);
- }
- }
- if (m_bRunning)return;
- CStringArray *pArray = &m_patharray1;
- m_vFileName.clear();
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- filePath.MakeLower();
- m_vFileName.push_back(filePath);
- }
- LoadThumbImages();
- }
- void ShowPic3::ShowPhoto4()
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中客人!", MB_ICONINFORMATION); return;
- }
- CString str;
- m_path = g_path4 + "\\" + m_strOrderNumber + "\\";
- m_patharray1.RemoveAll();
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(m_path), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- str.MakeLower();
- m_patharray1.Add(str);
- }
- }
- if (m_bRunning)return;
- CStringArray *pArray = &m_patharray1;
- m_vFileName.clear();
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- CString filePath = pArray->ElementAt(i);
- filePath.MakeLower();
- m_vFileName.push_back(filePath);
- }
- LoadThumbImages();
- }
- void ShowPic3::OnBTNshow1()
- {
- ShowPhoto1();
- }
- void ShowPic3::OnBTNshow2()
- {
- ShowPhoto2();
- }
- void ShowPic3::OnBTNshow3()
- {
- ShowPhoto4();
- }
- void ShowPic3::OnBTNshow4()
- {
- ShowPhoto3();
- }
- void ShowPic3::OnBUTdelall() // 全部删除;
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return;
- }
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- WriteLog(_T(" 客照管理中心:") + m_strOrderNumber + _T(":全部相片被删除"));
- DeleteDirectory(g_path1 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单原片;
- DeleteDirectory(g_path2 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单初修;
- DeleteDirectory(g_path3 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单精修;
- DeleteDirectory(g_path4 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单设计;
- OnBTNshow1();
- }
- void ShowPic3::OnBUTdel1() // 原片删除按钮;
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return;
- }
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- WriteLog(_T(" 客照管理中心:") + m_strOrderNumber + _T(":原片被删除"));
- DeleteDirectory(g_path1 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单原片;
- OnBTNshow1();
- }
- void ShowPic3::OnBUTdel2() // 初修删除按钮;
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return;
- }
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- WriteLog(_T(" 客照管理中心:") + m_strOrderNumber + _T(":初修片被删除"));
- DeleteDirectory(g_path2 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单初修;
- OnBTNshow2();
- }
- void ShowPic3::OnBUTdel3() // 精修删除按钮;
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return;
- }
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- WriteLog(_T(" 客照管理中心:") + m_strOrderNumber + _T(":精修片被删除"));
- DeleteDirectory(g_path4 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单精修;
- OnBTNshow3();
- }
- void ShowPic3::OnBUTdel4() // 设计片删除按钮;
- {
- if (m_strOrderNumber == "")
- {
- AfxMessageBox("请先选中您要删除的客人!", MB_ICONINFORMATION); return;
- }
- if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- WriteLog(_T(" 客照管理中心:") + m_strOrderNumber + _T(":设计片被删除"));
- DeleteDirectory(g_path3 + "\\" + m_strOrderNumber + "\\"); // 递归删除订单设计;
- OnBTNshow4();
- }
- void ShowPic3::OnCbnSelchangeCombo1()
- {
- static int nIndex = 0;
- if (nIndex)
- m_List2.SetSel(nIndex, FALSE);
- int i = 0;
- int nSelCount = m_List2.GetSelCount();
- for (i = 0; i < nSelCount; i++)//去除还处于选择状态的项;
- {
- int nSelItem;
- m_List2.GetSelItems(nSelCount, &nSelItem);
- m_List2.SetSel(nSelItem, FALSE);
- }
- int nPos = m_combobox.GetCurSel();
- CString strName;
- //m_combobox.GetWindowText(strName);
- m_combobox.GetLBText(nPos, strName);
- // printf("Jeff:****当前查找内容=%s\n\n",strName);
- int nSize = m_strArrayName.GetSize();
- for (i = 0; i < nSize; i++)
- {
- CString str = m_strArrayName.ElementAt(i);
- if (str.Find(strName) != -1)
- {
- // printf("Jeff:****当前查找内容=%s\n\n",str);
- //nIndex = m_List2.SelectString(-1,str);
- nIndex = i;
- if (nIndex == LB_ERR)
- {
- break;
- }
- m_List2.SetSel(nIndex, TRUE);
- PostMessage(OWNER_MSG_SHOWPHOTO, nIndex);
- break;
- }
- }
- }
- void ShowPic3::OnBnClickedNextone()
- {
- static int nIndex = 0;
- static CString strOld = "";
- m_List2.SetSel(nIndex - 1, FALSE);
- int i = 0;
- int nSelCount = m_List2.GetSelCount();
- for (i = 0; i < nSelCount; i++)//去除还处于选择状态的项;
- {
- int nSelItem;
- m_List2.GetSelItems(nSelCount, &nSelItem);
- m_List2.SetSel(nSelItem, FALSE);
- }
- CString strFind = "";
- m_combobox.GetWindowText(strFind);
- if (strOld != strFind)
- {
- strOld = strFind;
- nIndex = 0;
- }
- // printf("Jeff:当前查找内容=%s\n\n",strFind);
- CString str;
- BOOL bFind = FALSE;
- int nSize = m_strArrayName.GetSize();
- for (i = nIndex; i < nSize; i++)
- {
- str = m_strArrayName.ElementAt(i);
- // printf("Jeff:匹配内容=%s\n\n",str);
- if (str.Find(strFind) != -1)
- {
- nIndex = i;
- // printf("Jeff:nIndex=%d,找到内容=%s\n\n",i,str);
- bFind = TRUE;
- break;
- }
- }
- if (bFind == FALSE)
- {
- nIndex = 0;
- AfxMessageBox("未找到查找匹配的内容,将再次从头开始查找");
- }
- else
- {
- m_List2.SetSel(nIndex++, TRUE);
- PostMessage(OWNER_MSG_SHOWPHOTO, -1);
- }
- }
- void ShowPic3::ShowPhoto2Found(WPARAM wParam, LPARAM lParam)
- {
- UpdateData();
- int nPos = m_List2.GetCurSel();
- if (wParam != -1)
- nPos = wParam;
- if (nPos == -1) return;
- CString str;
- m_List2.GetText(nPos, str);
- nPos = str.Find("\r\n");
- if (nPos == -1)return;;
- m_strOrderNumber = str.Left(nPos);
- // printf("Jeff:欲显示的订单号=%s\n\n",m_strOrderNumber);
- ShowPhoto1();
- if (m_patharray1.GetSize() == 0)OnBTNshow2();
- if (m_patharray1.GetSize() == 0)OnBTNshow3();
- if (m_patharray1.GetSize() == 0)OnBTNshow4();
- }
|