Fixed issue #375: Implement --date/time option gui interface in the commit dialog
[TortoiseGit.git] / src / Utils / ACListWnd.cpp
blobd991aacdfb6d9289fa5b57620868c64c88470f86
1 // ACWnd.cpp: Implementierungsdatei
2 //
4 #include "stdafx.h"
5 #include "ACListWnd.h"
7 #ifdef _DEBUG
8 #define new DEBUG_NEW
9 #undef THIS_FILE
10 static char THIS_FILE[] = __FILE__;
11 #endif
13 static UINT auIDStatusBar[] =
15 ID_SEPARATOR
18 #define _MAX_ENTRYS_ 8
19 #define _MODE_FIND_ALL_ (1L << 5)
21 /////////////////////////////////////////////////////////////////////////////
22 // CACListWnd
24 void DoPaintMessageLoop()
26 MSG message1;
27 while(::PeekMessage(&message1,NULL,WM_PAINT,WM_PAINT, PM_REMOVE))
29 ::TranslateMessage(&message1);
30 ::DispatchMessage(&message1);
34 /**********************************************************************/
36 CACListWnd::CACListWnd()
38 m_lTopIndex = 0;
39 m_lCount = 0;
40 m_ItemHeight = 16;
41 m_lSelItem = -1;
42 m_VisibleItems = 0;
43 m_pEditParent = NULL;
44 m_LastSize.SetRectEmpty();
45 m_PrefixChar = 0;
46 m_lMode = 0;
49 /**********************************************************************/
51 CACListWnd::~CACListWnd()
53 m_SearchList.RemoveAll();
54 m_DisplayList.RemoveAll();
55 DestroyWindow();
58 /*********************************************************************/
60 void CACListWnd::OnActivateApp(BOOL bActive, DWORD dwThreadID)
62 #if (_MSC_VER >= 1300)
63 CWnd::OnActivateApp(bActive, dwThreadID); //vc7 FIX 1.2
64 #else
65 CWnd::OnActivateApp(bActive, (HTASK)dwThreadID); //vc6 FIX 1.2
66 #endif
68 ShowWindow(false);
72 BEGIN_MESSAGE_MAP(CACListWnd, CWnd)
73 //{{AFX_MSG_MAP(CACListWnd)
74 ON_WM_PAINT()
75 ON_WM_SIZE()
76 ON_WM_ERASEBKGND()
77 ON_WM_NCPAINT()
78 ON_WM_KEYDOWN()
79 ON_WM_NCCALCSIZE()
80 ON_WM_VSCROLL()
81 ON_WM_ACTIVATEAPP()
82 ON_WM_NCHITTEST()
83 ON_WM_LBUTTONDOWN()
84 ON_WM_RBUTTONDOWN()
85 ON_WM_SETCURSOR()
86 ON_WM_SHOWWINDOW()
87 ON_WM_NCLBUTTONDOWN()
88 ON_WM_MOUSEMOVE()
89 ON_WM_TIMER()
90 ON_WM_GETMINMAXINFO()
91 //}}AFX_MSG_MAP
92 END_MESSAGE_MAP()
95 /////////////////////////////////////////////////////////////////////////////
96 // Behandlungsroutinen für Nachrichten CACListWnd
98 void CACListWnd::DrawItem(CDC* pDC,long m_lItem,long width)
100 long y = m_lItem - m_lTopIndex;
101 CRect rcLabel(2,y*m_ItemHeight,width,(y+1)*m_ItemHeight);
103 pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
105 if(m_lItem == m_lSelItem)
107 rcLabel.left = 0;
108 pDC->FillSolidRect(rcLabel,::GetSysColor(COLOR_HIGHLIGHT));
109 pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
110 rcLabel.left = 2;
113 if(m_PrefixChar)
114 m_DisplayStr = m_PrefixChar + m_DisplayList.GetAt(m_lItem);
115 else
116 m_DisplayStr = m_DisplayList.GetAt(m_lItem);
118 pDC->DrawText(m_DisplayStr, -1, rcLabel, DT_LEFT | DT_SINGLELINE |
119 DT_NOPREFIX | DT_VCENTER | DT_END_ELLIPSIS);
122 /*********************************************************************/
124 void CACListWnd::OnPaint()
126 CPaintDC dc(this);
127 CRect rcWnd,m_rect, rc;
128 CDC MemDC,*pDC=NULL;
129 CBitmap m_bitmap, *m_pOldBitmap;
130 int i;
132 GetClientRect(rc);
133 rcWnd = m_rect = rc;
135 rc.left = rc.right-GetSystemMetrics(SM_CXHSCROLL);
136 rc.top = rc.bottom-GetSystemMetrics(SM_CYVSCROLL);
138 m_rect.right -= ScrollBarWidth();
140 MemDC.CreateCompatibleDC(&dc);
142 m_bitmap.CreateCompatibleBitmap(&dc, m_rect.Width(), m_rect.Height());
143 m_pOldBitmap = MemDC.SelectObject(&m_bitmap);
145 MemDC.SetWindowOrg(m_rect.left, m_rect.top);
147 long width = rcWnd.Width() - ScrollBarWidth();
149 MemDC.FillSolidRect(rcWnd,::GetSysColor(COLOR_WINDOW));
150 MemDC.SelectObject(GetStockObject(DEFAULT_GUI_FONT));
151 MemDC.SetBkMode(TRANSPARENT);
153 for(i = m_lTopIndex; i < m_lCount;i++)
155 DrawItem(&MemDC,i,width);
159 CPen m_Pen1(PS_SOLID, 1, ::GetSysColor(COLOR_WINDOW));
160 CPen m_Pen2(PS_SOLID, 1, ::GetSysColor(COLOR_BTNFACE));
161 CPen m_Pen3(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
163 pDC = &dc;
165 if(m_VertBar.IsWindowVisible())
166 dc.FillSolidRect(rc, ::GetSysColor(COLOR_BTNFACE) );
167 else
168 pDC = &MemDC;
170 CPen *pOldPen = (CPen*)pDC->SelectObject(&m_Pen1);
171 int a = 1,bottom;
173 width = GetSystemMetrics(SM_CXHSCROLL);
174 bottom = (rcWnd.bottom-GetSystemMetrics(SM_CXHSCROLL))-1;
176 //gripper
177 for( i = 0; i < 20 ;i++,a++)
179 if(a==1)
180 pDC->SelectObject(&m_Pen1);
181 if(a==2)
182 pDC->SelectObject(&m_Pen2);
183 if(a==3)
184 pDC->SelectObject(&m_Pen3);
185 if(a > 3)
186 a = 0;
188 pDC->MoveTo(rc.left + i - 1, rcWnd.bottom);
189 pDC->LineTo(rc.left + i + width, bottom);
192 dc.BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
193 &MemDC, m_rect.left, m_rect.top, SRCCOPY);
195 pDC->SelectObject( pOldPen );
196 MemDC.SelectObject(m_pOldBitmap);
199 /*********************************************************************/
201 void CACListWnd::Init(CWnd *pWnd)
203 VERIFY(m_VertBar.Create(WS_VISIBLE|SBS_VERT|SBS_LEFTALIGN,
204 CRect(0,0,GetSystemMetrics(SM_CYVSCROLL),100),this,0));
206 SetScroller();
207 m_pEditParent = (CEdit*)pWnd;
209 m_lCount = m_DisplayList.GetSize();
210 m_VertBar.SetScrollPos(0,false);
211 SetProp();
213 CDC *m_pDC;
214 m_pDC = GetDC();
215 if(m_pDC)
217 m_pDC->SelectObject(GetStockObject(DEFAULT_GUI_FONT));
218 CSize m_Size = m_pDC->GetOutputTextExtent(_T("Hg"));
219 m_ItemHeight = m_Size.cy;
220 ReleaseDC(m_pDC);
224 /*********************************************************************/
226 void CACListWnd::SetScroller()
228 CRect rcWnd,rcBar;
229 GetClientRect(rcWnd);
231 if(m_VertBar.GetSafeHwnd())
233 rcBar = rcWnd;
234 rcBar.top=-1;
235 rcBar.left = (rcWnd.Width()-GetSystemMetrics(SM_CYVSCROLL));
236 rcBar.bottom-= GetSystemMetrics(SM_CYHSCROLL);
237 m_VertBar.MoveWindow(rcBar);
238 rcBar.top = rcWnd.bottom-20;
239 rcBar.bottom = rcWnd.bottom;
241 m_VertBar.SetScrollPos(m_lTopIndex,true);
246 /*********************************************************************/
248 void CACListWnd::OnSize(UINT nType, int cx, int cy)
250 CWnd::OnSize(nType, cx, cy);
251 SetScroller();
252 SetProp();
254 if(!m_LastSize.IsRectEmpty())
255 GetWindowRect(m_LastSize);
258 /*********************************************************************/
260 long CACListWnd::ScrollBarWidth()
262 if(m_VertBar.IsWindowVisible())
263 return GetSystemMetrics(SM_CYVSCROLL);
264 else
265 return 0;
268 /*********************************************************************/
270 void CACListWnd::SetProp()
272 CRect rcWnd,rcBar;
274 if(!m_lCount)
275 return;
277 CWnd::GetWindowRect(rcWnd);
278 ScreenToClient(rcWnd);
280 SCROLLINFO si;
281 si.cbSize = sizeof(SCROLLINFO);
282 si.fMask = SIF_PAGE|SIF_RANGE;
283 si.nMin = 0;
284 si.nMax = m_lCount-1;
285 m_VisibleItems = si.nPage = rcWnd.Height()/m_ItemHeight;
286 si.nTrackPos = 2;
287 m_VertBar.SetScrollRange(0,m_lCount-1);
288 m_VertBar.SetScrollInfo(&si);
290 if(m_VisibleItems > m_lCount-1)
291 m_VertBar.ShowWindow(false);
292 else
293 m_VertBar.ShowWindow(true);
295 if(m_lTopIndex+m_VisibleItems > m_lCount)
297 m_lTopIndex = m_lCount-m_VisibleItems;
298 if(m_lTopIndex < 0)
299 m_lTopIndex = 0;
300 m_VertBar.SetScrollPos(m_lTopIndex,true);
304 /*********************************************************************/
306 BOOL CACListWnd::OnEraseBkgnd(CDC* /*pDC*/)
308 return false;
311 /*********************************************************************/
313 void CACListWnd::OnNcPaint()
315 CWindowDC dc(this);
316 CRect rectClient, rectWindow,rcWnd;
318 GetClientRect(rectClient);
319 GetWindowRect(rectWindow);
320 ScreenToClient(rectWindow);
322 rectClient.OffsetRect(-(rectWindow.left), -(rectWindow.top));
323 dc.ExcludeClipRect(rectClient);
325 rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
327 dc.FillSolidRect(rectWindow,::GetSysColor(COLOR_WINDOWTEXT));
330 /*********************************************************************/
332 void CACListWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
334 CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
336 if (nChar == VK_ESCAPE)
337 ShowWindow(false);
340 /*********************************************************************/
342 void CACListWnd::OnNcCalcSize(BOOL /*bCalcValidRects*/, NCCALCSIZE_PARAMS FAR* lpncsp)
344 ::InflateRect(lpncsp->rgrc,
345 -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
348 /*********************************************************************/
350 int CACListWnd::HitTest(CPoint point)
352 CRect rcItem;
353 CRect rcWnd;
355 GetClientRect(rcWnd);
356 long width = rcWnd.Width() - ScrollBarWidth();
358 for(int i = m_lTopIndex; i < m_lCount; i++)
360 long y = i - m_lTopIndex;
361 rcItem.SetRect(2,y*m_ItemHeight,width,(y+1)*m_ItemHeight);
363 if(PtInRect(&rcItem, point))
364 return (m_lSelItem = (y+m_lTopIndex));
367 return -1;
370 /*********************************************************************/
372 LRESULT CACListWnd::OnNcHitTest(CPoint point)
374 CRect rectClient;
375 GetWindowRect(rectClient);
377 rectClient.left = rectClient.right - GetSystemMetrics(SM_CYVSCROLL);
378 rectClient.top = rectClient.bottom - GetSystemMetrics(SM_CXVSCROLL);
380 if(rectClient.PtInRect(point))
381 return HTBOTTOMRIGHT;
382 else
383 return HTCLIENT;
386 /*********************************************************************/
388 void CACListWnd::OnLButtonDown(UINT nFlags, CPoint point)
390 CWnd::OnLButtonDown(nFlags, point);
391 int sel = HitTest(point);
393 if(sel >= 0)
395 if(!EnsureVisible(sel,true))
396 Invalidate();
397 m_lSelItem = sel;
398 m_pEditParent->SendMessage(ENAC_UPDATE, WM_KEYDOWN, GetDlgCtrlID());
399 DoPaintMessageLoop();
400 Sleep(500);
401 ShowWindow(false);
403 else
405 CRect rc;
406 GetClientRect(rc);
407 if(!rc.PtInRect(point))
408 ShowWindow(false);
412 /*********************************************************************/
414 void CACListWnd::OnRButtonDown(UINT nFlags, CPoint point)
416 CWnd::OnRButtonDown(nFlags, point);
417 ShowWindow(false);
420 /*********************************************************************/
422 BOOL CACListWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
424 CRect rectClient;
425 CPoint ptCursor;
427 GetWindowRect(rectClient);
428 ScreenToClient(&rectClient);
430 rectClient.left = rectClient.right - GetSystemMetrics(SM_CYVSCROLL);
431 rectClient.top = rectClient.bottom - GetSystemMetrics(SM_CXVSCROLL);
434 GetCursorPos(&ptCursor);
435 ScreenToClient(&ptCursor);
437 if(rectClient.PtInRect(ptCursor)) // Vergrößerungs-Cursor
439 return CWnd::OnSetCursor(pWnd, nHitTest, message);
442 ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
443 return TRUE;
446 /*********************************************************************/
448 void CACListWnd::InvalidateAndScroll()
450 m_VertBar.SetScrollPos(m_lTopIndex,true);
451 Invalidate();
452 DoPaintMessageLoop();
455 /*********************************************************************/
457 bool CACListWnd::EnsureVisible(int item, bool m_bWait)
459 if(item > m_lTopIndex && item < m_lTopIndex + m_VisibleItems)
460 return false; // ist visible
462 if(item > m_lTopIndex) // scroll down
464 long m_len = item;
465 for(int i = m_lTopIndex; i < m_len; i++)
467 if(i >= m_lCount-m_VisibleItems)
468 break;
469 if(i >= m_lCount-m_VisibleItems || i + m_VisibleItems > item)
471 break;
474 m_lTopIndex++;
476 if(m_bWait)
478 InvalidateAndScroll();
479 Sleep(10);
480 DoPaintMessageLoop();
483 InvalidateAndScroll();
484 return true;
487 if(item < m_lTopIndex) // scroll up
489 while(item < m_lTopIndex)
491 if(m_lTopIndex > 0)
492 m_lTopIndex--;
493 else
495 break;
498 if(m_bWait)
500 InvalidateAndScroll();
501 Sleep(10);
502 DoPaintMessageLoop();
506 InvalidateAndScroll();
507 return true;
510 return false;
513 /*********************************************************************/
515 bool CACListWnd::SelectItem(int item)
517 if(item > m_lCount)
518 return false;
520 if(item == -1)
522 EnsureVisible(m_lSelItem,false);
523 Invalidate();
524 return false;
527 m_lSelItem = item;
529 if(!EnsureVisible(item,true))
530 Invalidate();
532 return true;
535 /*********************************************************************/
537 int CACListWnd::FindStringExact( int nStartAfter, LPCTSTR lpszString )
539 if(nStartAfter > m_SearchList.GetSize())
540 return -1;
542 for(int i = nStartAfter+1; i < m_SearchList.GetSize(); i++)
543 if(m_SearchList.GetAt(i).Compare(lpszString) == 0)
544 return i;
545 return -1;
548 /*********************************************************************/
550 ** Vers. 1.1
551 * NEW: m_bDisplayOnly
553 int CACListWnd::FindString(int nStartAfter, LPCTSTR lpszString, bool m_bDisplayOnly)
555 long m_AktCount = m_DisplayList.GetSize();
557 if(!m_bDisplayOnly)
559 CString m_Str1,m_Str2 = lpszString;
560 if(!m_pEditParent)
562 ShowWindow(false);
563 return -1;
566 if(nStartAfter > m_SearchList.GetSize())
568 ShowWindow(false);
569 return -1;
572 if(m_Str2.IsEmpty())
574 ShowWindow(false);
575 return -1;
578 m_DisplayList.RemoveAll();
580 m_Str2.MakeUpper();
582 for(int i = nStartAfter+1; i < m_SearchList.GetSize(); i++)
584 if(m_PrefixChar)
585 m_Str1 = m_PrefixChar;
586 else
587 m_Str1 = _T("");
589 m_Str1 += m_SearchList.GetAt(i);
591 m_Str1.MakeUpper();
593 if(m_lMode & _MODE_FIND_ALL_)
595 if(m_Str1.Find(m_Str2) >= 0)
597 m_DisplayList.Add(m_SearchList.GetAt(i));
600 else // _MODE_FIND_EXACT_
602 if(m_Str1.Find(m_Str2) == 0)
604 m_DisplayList.Add(m_SearchList.GetAt(i));
609 m_lCount = m_DisplayList.GetSize();
611 if(m_lCount)
613 CRect rcWnd;
614 int iHeight,iWight;
616 m_pEditParent->GetWindowRect(rcWnd);
618 SetScroller();
619 SetProp();
621 ShowWindow(true);
622 Invalidate();
624 iHeight = m_lCount*m_ItemHeight+(GetSystemMetrics(SM_CYBORDER)*2);
626 if(m_lCount > _MAX_ENTRYS_)
627 iHeight = _MAX_ENTRYS_*m_ItemHeight+(GetSystemMetrics(SM_CYBORDER)*2);
629 if(!m_LastSize.IsRectEmpty())
631 iWight = m_LastSize.Width();
632 iHeight = m_LastSize.Height();
633 rcWnd.top += rcWnd.Height();
634 rcWnd.right = rcWnd.left+iWight;
635 rcWnd.bottom = rcWnd.top+iHeight;
637 SetWindowPos(&CWnd::wndTopMost, rcWnd.left,
638 rcWnd.top,
639 rcWnd.Width(),
640 rcWnd.Height(), 0);
642 else
644 SetWindowPos(&CWnd::wndTopMost, rcWnd.left,
645 rcWnd.top + rcWnd.Height(),
646 rcWnd.Width(),
647 iHeight, 0);
650 if(m_AktCount != m_DisplayList.GetSize())
651 m_lSelItem = -1;
653 SortList(m_DisplayList);
655 else
657 ShowWindow(false);
660 return 1;
663 /*********************************************************************/
665 int CACListWnd::SelectString(LPCTSTR lpszString )
667 int item = FindString(-1, lpszString);
668 SelectItem(item);
669 return item;
672 /*********************************************************************/
674 bool CACListWnd::GetText(int item, CString& m_Text)
676 if(item < 0 || item > m_SearchList.GetSize())
677 return false;
678 m_Text = m_SearchList.GetAt(item);
679 return true;
682 /*********************************************************************/
684 void CACListWnd::OnShowWindow(BOOL bShow, UINT nStatus)
686 if(bShow)
688 m_nIDTimer = SetTimer( IDTimerInstall, 200, NULL);
689 m_pEditParent->GetParent()->GetWindowRect(m_ParentRect);
691 else
693 if(m_nIDTimer)
694 KillTimer(IDTimerInstall);
695 m_nIDTimer = 0;
696 m_lSelItem = -1;
697 m_lTopIndex = 0;
700 CWnd::OnShowWindow(bShow, nStatus);
701 ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
704 /*********************************************************************/
706 void CACListWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
709 if(OnNcHitTest(point) == HTBOTTOMRIGHT)
710 GetWindowRect(m_LastSize);
711 CWnd::OnNcLButtonDown(nHitTest, point);
714 /*********************************************************************/
716 CString CACListWnd::GetString()
718 int i = m_DisplayList.GetSize();
720 if(!i)
721 return _T("");
722 if(i <= m_lSelItem || m_lSelItem == -1)
723 i = 0;
724 else
725 i = m_lSelItem;
727 return m_DisplayList.GetAt(i);
730 /*********************************************************************/
732 void CACListWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
734 CWnd::OnVScroll(nSBCode, nPos, pScrollBar);
735 long m_oldlTopIndex = m_lTopIndex;
737 switch(nSBCode)
739 case SB_ENDSCROLL:
740 break;
742 case SB_PAGEUP:
743 m_lTopIndex -= m_VisibleItems;
744 if(m_lTopIndex < 0)
745 m_lTopIndex = 0;
746 break;
748 case SB_PAGEDOWN:
749 m_lTopIndex += m_VisibleItems;
750 if(m_lTopIndex >= m_lCount-m_VisibleItems)
751 m_lTopIndex = m_lCount-m_VisibleItems;
752 break;
754 case SB_LINEUP:
755 m_lTopIndex--;
756 if(m_lTopIndex < 0)
757 m_lTopIndex = 0;
758 break;
760 case SB_LINEDOWN:
761 m_lTopIndex++;
762 if(m_lTopIndex >= m_lCount-m_VisibleItems)
763 m_lTopIndex = m_lCount-m_VisibleItems;
764 break;
766 case SB_THUMBTRACK:
767 m_lTopIndex = nPos;
768 break;
771 m_VertBar.SetScrollPos(m_lTopIndex,true);
773 if(m_oldlTopIndex != m_lTopIndex)
774 Invalidate();
777 /*********************************************************************/
779 CString CACListWnd::GetNextString(int nChar)
781 switch(nChar)
783 case VK_DOWN:
784 m_lSelItem++;
785 break;
787 case VK_UP:
788 m_lSelItem--;
789 break;
791 case VK_PRIOR:
792 m_lSelItem -= m_VisibleItems;
793 if(m_lSelItem < 0)
794 m_lSelItem = 0;
795 break;
797 case VK_NEXT:
798 m_lSelItem += m_VisibleItems;
799 if(m_lSelItem >= m_lCount-1)
800 m_lSelItem = m_lCount-1;
801 break;
803 case VK_HOME:
804 m_lSelItem = 0;
805 break;
807 case VK_END:
808 m_lSelItem = m_lCount-1;
809 break;
812 if(m_lSelItem < 0)
813 m_lSelItem = m_lCount-1;
815 if(m_lSelItem >= m_lCount)
816 m_lSelItem = 0;
818 if(EnsureVisible(m_lSelItem,(m_lCount > 50) ? false : true))
819 InvalidateAndScroll();
821 return GetString();
824 /*********************************************************************/
826 void CACListWnd::OnMouseMove(UINT nFlags, CPoint point)
828 CWnd::OnMouseMove(nFlags, point);
829 int sel = HitTest(point);
830 if(sel >= 0)
832 Invalidate();
836 /*********************************************************************/
838 void CACListWnd::OnTimer(UINT_PTR nIDEvent)
840 CWnd::OnTimer(nIDEvent);
842 CRect m_ParentRect1;
843 m_pEditParent->GetParent()->GetWindowRect(m_ParentRect1);
844 if(!m_ParentRect1.EqualRect(m_ParentRect))
845 ShowWindow(false);
848 /*********************************************************************/
850 void CACListWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
852 if(GetSafeHwnd())
854 // Vers. 1.2
855 long m_lMinY1 = GetSystemMetrics(SM_CYHSCROLL)*2 + GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXHTHUMB),
856 m_lMinY2 = m_lCount * m_ItemHeight + (GetSystemMetrics(SM_CYBORDER)*2);
858 if(m_VisibleItems > m_lCount-1 && m_lMinY2 < m_lMinY1)
859 lpMMI->ptMinTrackSize.y = m_lMinY2;
860 else
861 lpMMI->ptMinTrackSize.y = m_lMinY1;
862 //---------
864 lpMMI->ptMinTrackSize.x = GetSystemMetrics(SM_CXHSCROLL)*4;
867 // Vers. 1.2
868 if(m_pEditParent != NULL)
870 RECT rc;
871 m_pEditParent->GetWindowRect (&rc);
872 lpMMI->ptMinTrackSize.x = rc.right - rc.left;
875 else
876 CWnd::OnGetMinMaxInfo(lpMMI);
879 /*********************************************************************/
881 int CACListWnd::CompareString(const void* p1, const void* p2)
883 return _stricmp( * ( char** ) p1, * ( char** ) p2 );
886 /*********************************************************************/
888 void CACListWnd::SortList(CStringArray& m_List)
890 int m_Count = m_List.GetSize();
891 int i;
893 if (m_Count > 1)
895 CStringArray m_Liste1;
896 m_Liste1.Copy(m_List);
898 LPCTSTR* ppSortArray = new LPCTSTR[m_Count+1];
901 for(i=0; i < m_Count; i++)
903 ppSortArray[i] = (LPCTSTR)m_Liste1.GetAt(i);
906 m_List.RemoveAll();
908 qsort(ppSortArray, m_Count, sizeof(LPCTSTR), CompareString);
910 for(i=0; i < m_Count; i++)
912 m_List.Add((LPCTSTR) ppSortArray[i]);
914 m_Liste1.RemoveAll();
915 delete [] ppSortArray;
919 /*********************************************************************/
921 ** Vers. 1.1
922 ** NEW: CopyList()
924 void CACListWnd::CopyList()
926 m_DisplayList.Copy(m_SearchList);
927 m_lCount = m_DisplayList.GetSize();
928 if(m_lCount)
929 FindString(0,_T(""),true);
932 /*********************************************************************/