From: Guy H <da...@us...> - 2005-02-09 21:15:23
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17852/AnyEditv2 Modified Files: AnyEdit.rc QuickJump.cpp QuickJump.h Log Message: 1. Fixed filter type to be drop-down combo 2. Fixed file filtering 3. Filter combo is now sorted Index: QuickJump.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/QuickJump.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** QuickJump.cpp 25 Sep 2004 13:10:08 -0000 1.16 --- QuickJump.cpp 9 Feb 2005 21:15:13 -0000 1.17 *************** *** 117,124 **** CClassTree::CreateClassImageList(m_imglist); - ((CComboBox*)GetDlgItem(IDC_TYPE))->SetCurSel(m_nType); if (m_bSingleFile) ! ((CComboBox*)GetDlgItem(IDC_TYPE))->DeleteString(5); m_qlist.ModifyStyle(LVS_ALIGNTOP,LVS_ALIGNTOP|LVS_SHOWSELALWAYS|LVS_SINGLESEL); --- 117,133 ---- CClassTree::CreateClassImageList(m_imglist); + CComboBox* pTypeBox = ((CComboBox*)GetDlgItem(IDC_TYPE)); + for (int i=0;i<pTypeBox->GetCount();i++) + pTypeBox->SetItemData(i, i); if (m_bSingleFile) ! { ! // No need for projects filter ! pTypeBox->DeleteString(5); ! // No need for files filter ! pTypeBox->DeleteString(1); ! if ((m_nType == 1) || (m_nType == 5)) ! m_nType = 0; ! } m_qlist.ModifyStyle(LVS_ALIGNTOP,LVS_ALIGNTOP|LVS_SHOWSELALWAYS|LVS_SINGLESEL); *************** *** 138,145 **** m_pTags->AddNotifier(this); ! if (FillTagList()) ! m_edit.SetFocus(); ! else ! PostMessage(WM_CLOSE); return FALSE; --- 147,165 ---- m_pTags->AddNotifier(this); ! // Select current type: ! for (i=0;i<pTypeBox->GetCount();i++) ! { ! if (pTypeBox->GetItemData(i) == m_nType) ! { ! pTypeBox->SetCurSel(i); ! break; ! } ! } ! if (i == pTypeBox->GetCount()) ! pTypeBox->SetCurSel(0); ! m_nType = -1; ! OnSelchangeType(); ! ! m_edit.SetFocus(); return FALSE; *************** *** 384,391 **** void CQuickJump::OnSelchangeType() { ! int nSel = ((CComboBox*)GetDlgItem(IDC_TYPE))->GetCurSel(); ! if (nSel == m_nType) return; ! m_nType = nSel; if ((m_nType < 1) || (m_bSingleFile && (m_nType == 1))) { --- 404,411 ---- void CQuickJump::OnSelchangeType() { ! int nType = GetSelectedType(); ! if (nType == m_nType) return; ! m_nType = nType; if ((m_nType < 1) || (m_bSingleFile && (m_nType == 1))) { *************** *** 407,415 **** } void CQuickJump::FillFilter() { m_cbFilter.ResetContent(); int i, nIndex; ! int nIndexAll = m_cbFilter.AddString("All"); if (nIndexAll != CB_ERR) m_cbFilter.SetItemData(nIndexAll, FILTER_ALL); --- 427,461 ---- } + void CQuickJump::AddFilesToFilter(const AEPROJECTITEMLIST& holder, const std::string& sProjectName) + { + int nIndex; + for (AEPROJECTITEMLIST::const_iterator i = holder.begin(); i != holder.end(); i++) + { + const AEProjectItemHolder* pInnerHolder = dynamic_cast<const AEProjectItemHolder*>(*i); + if (pInnerHolder != NULL) + { + AddFilesToFilter(pInnerHolder->operator const AEPROJECTITEMLIST&(), sProjectName); + continue; + } + const AEProjectFile* pFile = dynamic_cast<const AEProjectFile*>(*i); + if (pFile != NULL) + { + std::string sName = pFile->GetName(); + if (!sProjectName.empty()) + sName += " [" + sProjectName + "]"; + nIndex = m_cbFilter.AddString(sName.c_str()); + if (nIndex != CB_ERR) + m_cbFilter.SetItemData(nIndex, (DWORD)pFile); + } + } + } + void CQuickJump::FillFilter() { m_cbFilter.ResetContent(); int i, nIndex; ! // Note: the 'All' item MUST have a space before it so it will appear at the ! // top of the sorted combo. Ugly hack but it works. ! int nIndexAll = m_cbFilter.AddString(" All"); if (nIndexAll != CB_ERR) m_cbFilter.SetItemData(nIndexAll, FILTER_ALL); *************** *** 418,422 **** case 1: // Files ! break; case 2: --- 464,472 ---- case 1: // Files ! { ! const PROJECTLIST& list = theApp.GetWorkspace()->operator const PROJECTLIST&(); ! for (PROJECTLIST::const_iterator j = list.begin(); j != list.end(); j++) ! AddFilesToFilter((*j)->operator const AEPROJECTITEMLIST&(), list.size() > 1 ? (*j)->GetName() : _T("")); ! } break; case 2: *************** *** 480,481 **** --- 530,539 ---- m_bSelfChanging = false; } + + int CQuickJump::GetSelectedType() + { + int nSel = ((CComboBox*)GetDlgItem(IDC_TYPE))->GetCurSel(); + if (nSel == CB_ERR) + return -1; + return ((CComboBox*)GetDlgItem(IDC_TYPE))->GetItemData(nSel); + } Index: QuickJump.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/QuickJump.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** QuickJump.h 9 Sep 2004 18:54:48 -0000 1.9 --- QuickJump.h 9 Feb 2005 21:15:13 -0000 1.10 *************** *** 72,75 **** --- 72,77 ---- BOOL FillTagList(); void FillFilter(); + int GetSelectedType(); + void AddFilesToFilter(const AEPROJECTITEMLIST& holder, const std::string& sProjectName); void AddTag(AETag* pTag); Index: AnyEdit.rc =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEdit.rc,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** AnyEdit.rc 1 Feb 2005 07:02:55 -0000 1.113 --- AnyEdit.rc 9 Feb 2005 21:15:10 -0000 1.114 *************** *** 2040,2044 **** STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Quick Jump" ! FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Choose Location",IDC_STATIC,7,7,294,64 --- 2040,2044 ---- STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Quick Jump" ! FONT 8, "MS Sans Serif" BEGIN GROUPBOX "Choose Location",IDC_STATIC,7,7,294,64 *************** *** 2048,2056 **** GROUPBOX "Filters",IDC_STATIC,13,35,281,30 LTEXT "&Type:",IDC_STATIC,19,48,19,8 ! COMBOBOX IDC_TYPE,45,46,85,73,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "&Filter:",IDC_STATIC_FILTER,136,49,18,8,NOT WS_VISIBLE ! COMBOBOX IDC_FILTER,157,46,129,83,CBS_DROPDOWNLIST | NOT ! WS_VISIBLE | WS_VSCROLL | WS_TABSTOP CONTROL "List1",IDC_QJ_LIST,"SysListView32",LVS_REPORT | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,7,70,294,116 --- 2048,2056 ---- GROUPBOX "Filters",IDC_STATIC,13,35,281,30 LTEXT "&Type:",IDC_STATIC,19,48,19,8 ! COMBOBOX IDC_TYPE,45,46,85,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "&Filter:",IDC_STATIC_FILTER,136,49,18,8,NOT WS_VISIBLE ! COMBOBOX IDC_FILTER,157,46,129,83,CBS_DROPDOWNLIST | CBS_SORT | ! NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP CONTROL "List1",IDC_QJ_LIST,"SysListView32",LVS_REPORT | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,7,70,294,116 |