JBoolean
CBSymbolList::UpdateFinished
	(
	const JArray<JFAID_t>&	deadFileList,
	JProgressDisplay&		pg
	)
{
	DeleteProcess();

	// reset to lenient search

	itsSymbolList->SetCompareFunction(CompareSymbols);

	// toss files that no longer exist

	const JSize fileCount = deadFileList.GetElementCount();
	if (fileCount > 0)
		{
		pg.FixedLengthProcessBeginning(fileCount, JGetString(kCleaningUpID), kJFalse, kJTrue);

		for (JIndex i=1; i<=fileCount; i++)
			{
			RemoveFile(deadFileList.GetElement(i));
			pg.IncrementProgress();
			}

		pg.ProcessFinished();
		}

	if (itsChangedDuringParseFlag && !CBInUpdateThread())
		{
		itsReparseAllFlag = kJFalse;
		Broadcast(Changed());
		}

	return itsChangedDuringParseFlag;
}
void
CBFileListTable::ScanAll
	(
	CBProjectTree*		fileTree,
	const CBDirList&	dirList,
	CBSymbolList*		symbolList,
	CBCTree*			cTree,
	CBJavaTree*			javaTree,
	JProgressDisplay&	pg
	)
{
	const JSize dirCount = dirList.GetElementCount();
	if (dirCount > 0 || (fileTree->GetProjectRoot())->HasChildren())
		{
		pg.VariableLengthProcessBeginning(JGetString(kParsingFilesID), kJFalse, kJTrue);

		JPtrArray<JString> allSuffixList(JPtrArrayT::kDeleteAll);
		(CBGetPrefsManager())->GetAllFileSuffixes(&allSuffixList);

		JString fullPath;
		JBoolean recurse;
		for (JIndex i=1; i<=dirCount; i++)
			{
			if (dirList.GetFullPath(i, &fullPath, &recurse))
				{
				ScanDirectory(fullPath, recurse,
							  allSuffixList, symbolList,
							  cTree, javaTree,
							  pg);
				}
			}

		fileTree->ParseFiles(this, allSuffixList, symbolList, cTree, javaTree, pg);

		pg.ProcessFinished();
		}
}
void
CBEditTextPrefsDialog::UpdateSettings()
{
	CBTextEditor* te = itsDoc->GetTextEditor();

	JString fontName;
	JSize fontSize;
	itsFontMenu->GetFont(&fontName, &fontSize);
	const JBoolean fontChanged = JI2B(
		fontName != te->GetDefaultFont().GetName() ||
		fontSize != te->GetDefaultFont().GetSize() );

	JFloat vScrollScale = 1.0;
	if (fontChanged)
		{
		const JFontManager* fontMgr = te->GetFontManager();
		const JFloat h1 = te->GetDefaultFont().GetLineHeight();
		const JFloat h2 = fontMgr->GetFont(fontName, fontSize).GetLineHeight();
		vScrollScale    = h2 / h1;
		}

	JInteger tabCharCount;
	JBoolean ok = itsTabCharCountInput->GetValue(&tabCharCount);
	assert( ok );

	JInteger crmLineWidth;
	ok = itsCRMLineWidthInput->GetValue(&crmLineWidth);
	assert( ok );

	JInteger undoDepth;
	ok = itsUndoDepthInput->GetValue(&undoDepth);
	assert( ok );

	JInteger rightMargin;
	ok = itsRightMarginInput->GetValue(&rightMargin);
	assert( ok );

	CBPrefsManager* prefsMgr = CBGetPrefsManager();
	const JBoolean textColorChanged = JNegate(
		itsColor[ CBPrefsManager::kTextColorIndex-1 ] ==
		prefsMgr->GetColor(CBPrefsManager::kTextColorIndex));

	// set colors before RecalcStyles() so stylers update themselves

	prefsMgr->SetDefaultFont(fontName, fontSize);
	for (JIndex j=1; j<=CBPrefsManager::kColorCount; j++)
		{
		prefsMgr->SetColor(j, itsColor[j-1]);
		}

	JPtrArray<CBTextDocument>* docList = (CBGetDocumentManager())->GetTextDocList();
	const JSize docCount = docList->GetElementCount();

	JProgressDisplay* pg = JNewPG();
	pg->FixedLengthProcessBeginning(docCount, "Updating preferences...", kJFalse, kJFalse);

	for (JIndex i=1; i<=docCount; i++)
		{
		CBTextDocument* doc = docList->NthElement(i);

		doc->ShouldMakeBackupFile(itsCreateBackupCB->IsChecked());
		doc->ShouldMakeNewBackupEveryOpen(!itsOnlyBackupIfNoneCB->IsChecked());
		doc->ShouldAllocateTitleSpace(itsExtraSpaceWindTitleCB->IsChecked());
		doc->ShouldOpenComplFileOnTop(itsOpenComplFileOnTopCB->IsChecked());

		te = doc->GetTextEditor();

		if (itsEmulatorIndex != itsOrigEmulatorIndex)
			{
			JTEKeyHandler* handler;
			CBInstallEmulator(kMenuIndexToEmulator[ itsEmulatorIndex-1 ], te, &handler);
			}

		te->ShouldAutoIndent(itsAutoIndentCB->IsChecked());
		te->CBShouldAllowDragAndDrop(itsUseDNDCB->IsChecked());
		te->ShouldMoveToFrontOfText(itsLeftToFrontOfTextCB->IsChecked());

		te->ShouldBalanceWhileTyping(itsBalanceWhileTypingCB->IsChecked());
		te->ShouldScrollToBalance(itsScrollToBalanceCB->IsChecked());
		te->ShouldBeepWhenTypeUnbalanced(itsBeepWhenTypeUnbalancedCB->IsChecked());

		te->TabShouldBeSmart(itsSmartTabCB->IsChecked());
		te->TabShouldInsertSpaces(itsTabToSpacesCB->IsChecked());

		if (fontChanged)
			{
			JXScrollbar *hScrollbar, *vScrollbar;
			const JBoolean ok = te->GetScrollbars(&hScrollbar, &vScrollbar);
			assert( ok );
			vScrollbar->PrepareForScaledMaxValue(vScrollScale);

			te->SetFont(fontName, fontSize, tabCharCount);
			}
		else
			{
			te->SetTabCharCount(tabCharCount);
			}

		te->SetCRMLineWidth(crmLineWidth);
		te->SetUndoDepth(undoDepth);
		te->SetRightMarginWidth(itsRightMarginCB->IsChecked(), rightMargin);

		te->SetDefaultFontStyle(itsColor [ CBPrefsManager::kTextColorIndex-1 ]);
		te->SetBackColor(itsColor [ CBPrefsManager::kBackColorIndex-1 ]);
		te->SetFocusColor(itsColor [ CBPrefsManager::kBackColorIndex-1 ]);
		te->SetCaretColor(itsColor [ CBPrefsManager::kCaretColorIndex-1 ]);
		te->SetSelectionColor(itsColor [ CBPrefsManager::kSelColorIndex-1 ]);
		te->SetSelectionOutlineColor(itsColor [ CBPrefsManager::kSelLineColorIndex-1 ]);
		te->SetRightMarginColor(itsColor [ CBPrefsManager::kRightMarginColorIndex-1 ]);

		if (textColorChanged)
			{
			te->RecalcStyles();
			}

		// force update of insertion font

		JIndex caretIndex;
		if (te->GetCaretLocation(&caretIndex))
			{
			te->SetCaretLocation(caretIndex);
			}

		pg->IncrementProgress();
		}

	CBFnMenuUpdater* updater = CBGetFnMenuUpdater();
	updater->ShouldSortFnNames(itsSortFnMenuCB->IsChecked());
	updater->ShouldIncludeNamespace(itsNSInFnMenuCB->IsChecked());
	updater->ShouldPackFnNames(itsPackFnMenuCB->IsChecked());

	JXTEBase::SetPartialWordModifier(
		(JXTEBase::PartialWordModifier) itsPWModRG->GetSelectedItem());

	JXTEBase::ShouldUseWindowsHomeEnd(itsHomeEndCB->IsChecked());
	CBTextEditor::CaretShouldFollowScroll(itsScrollCaretCB->IsChecked());
	JTextEditor::ShouldCopyWhenSelect(itsCopyWhenSelectCB->IsChecked());
	JXTEBase::MiddleButtonShouldPaste(itsMiddleButtonPasteCB->IsChecked());

	CBSearchTextDialog* dlog = CBGetSearchTextDialog();
	dlog->SetFont(fontName, fontSize);

	itsDoc->JPrefObject::WritePrefs();

	if (itsEmulatorIndex != itsOrigEmulatorIndex)
		{
		prefsMgr->SetEmulator(kMenuIndexToEmulator[ itsEmulatorIndex-1 ]);
		}

	CBMWriteSharedPrefs(kJTrue);

	pg->ProcessFinished();
	jdelete pg;
}