void CBApp::CollectSearchPaths ( CBDirInfoList* searchPaths ) const { searchPaths->DeleteAll(); searchPaths->SetCompareFunction(CBDirInfo::ComparePathNames); JPtrArray<CBProjectDocument>* docList = (CBGetDocumentManager())->GetProjectDocList(); const JSize docCount = docList->GetElementCount(); JString truePath; JBoolean recurse; for (JIndex j=1; j<=docCount; j++) { CBProjectDocument* doc = docList->NthElement(j); const CBDirList& dirList = doc->GetDirectories(); const JSize count = dirList.GetElementCount(); for (JIndex i=1; i<=count; i++) { if (dirList.GetTruePath(i, &truePath, &recurse)) { CBDirInfo newInfo(jnew JString(truePath), recurse); assert( newInfo.path != NULL ); newInfo.projIndex = j; JBoolean found; const JIndex index = searchPaths->SearchSorted1(newInfo, JOrderedSetT::kAnyMatch, &found); if (found) { // compute OR of recurse flags CBDirInfo existingInfo = searchPaths->GetElement(index); if (newInfo.recurse && !existingInfo.recurse) { existingInfo.recurse = kJTrue; searchPaths->SetElement(index, existingInfo); } jdelete newInfo.path; } else { searchPaths->InsertElementAtIndex(index, newInfo); } } } } searchPaths->SetCompareFunction(CBDirInfo::CompareProjIndex); searchPaths->Sort(); }
void CBSearchTextDialog::UpdateBasePath() { CBProjectDocument* doc; if ((CBGetDocumentManager())->GetActiveProjectDocument(&doc)) { itsDirInput->SetBasePath(doc->GetFilePath()); } else { itsDirInput->ClearBasePath(); } }
CBCommandTable::CBCommandTable ( const CBCommandManager::CmdList& cmdList, JXTextButton* addCmdButton, JXTextButton* removeCmdButton, JXTextButton* duplicateCmdButton, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1,1, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h) { itsTextInput = NULL; itsDNDRowIndex = 0; itsCommandXAtom = (GetDisplay())->RegisterXAtom(CBCommandSelection::GetCommandXAtomName()); // font (CBGetPrefsManager())->GetDefaultFont(&itsFontName, &itsFontSize); const JSize rowHeight = 2*kVMarginWidth + JMax( (GetFontManager())->GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()), (GetFontManager())->GetLineHeight(itsFontName, itsFontSize, JFontStyle())); SetDefaultRowHeight(rowHeight); // buttons itsAddCmdButton = addCmdButton; itsRemoveCmdButton = removeCmdButton; itsDuplicateCmdButton = duplicateCmdButton; ListenTo(itsAddCmdButton); ListenTo(itsRemoveCmdButton); ListenTo(itsDuplicateCmdButton); // type menu itsOptionsMenu = new JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10); assert( itsOptionsMenu != NULL ); itsOptionsMenu->SetToHiddenPopupMenu(); itsOptionsMenu->SetMenuItems(kOptionsMenuStr); itsOptionsMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsOptionsMenu); // base path CBProjectDocument* doc = NULL; if ((CBGetDocumentManager())->GetActiveProjectDocument(&doc)) { itsBasePath = doc->GetFilePath(); } // data itsCmdList = new CBCommandManager::CmdList(cmdList); assert( itsCmdList != NULL ); FinishCmdListCopy(itsCmdList); for (JIndex i=1; i<=kColCount; i++) { AppendCols(1, kInitColWidth[i-1]); } AppendRows(itsCmdList->GetElementCount()); UpdateButtons(); ListenTo(&(GetTableSelection())); }