Esempio n. 1
0
JBoolean
SyGCreateGlobals
	(
	SyGApplication* app
	)
{
	theApplication = app;

	SyGCreateIcons();

	JString oldPrefsFile, newPrefsFile;
	if (JGetPrefsDirectory(&oldPrefsFile))
		{
		oldPrefsFile = JCombinePathAndName(oldPrefsFile, ".gSystemG.pref");
		if (JFileExists(oldPrefsFile) &&
			(JPrefsFile::GetFullName(app->GetSignature(), &newPrefsFile)).OK() &&
			!JFileExists(newPrefsFile))
			{
			JRenameFile(oldPrefsFile, newPrefsFile);
			}
		}

	JBoolean isNew;
	thePrefsMgr = new SyGPrefsMgr(&isNew);
	assert(thePrefsMgr != NULL);

	JXInitHelp(kSyGTOCHelpName, kSyGHelpSectionCount, kSyGHelpSectionName);

	JXWDManager* wdMgr = new JXWDManager(app->GetCurrentDisplay(), kJTrue);
	assert( wdMgr != NULL );
	// registers itself

	theMDIServer = new SyGMDIServer;
	assert( theMDIServer != NULL );

	theManPageDialog = new SyGViewManPageDialog(JXGetPersistentWindowOwner());
	assert( theManPageDialog != NULL );

	theFindFileDialog = new SyGFindFileDialog(JXGetPersistentWindowOwner());
	assert( theFindFileDialog != NULL );

	theAltChooseSaveFile = new SyGChooseSaveFile(thePrefsMgr, kSAltCSSetupID);
	assert( theAltChooseSaveFile != NULL );

	JString trashDir;
	SyGGetTrashDirectory(&trashDir, kJFalse);	// silently creates it

	return isNew;
}
JXSearchTextDialog::JXSearchTextDialog
	(
	const JCharacter* searchTextHelpName
	)
	:
	JXWindowDirector(JXGetPersistentWindowOwner())
{
	itsTE = NULL;

	itsRegex = new JRegex;
	assert( itsRegex != NULL );
	itsRegex->SetLineBegin(kJTrue);				// ^ matches beginning of line, not text
	itsRegex->SetLineEnd(kJTrue);				// $ matches end of line, not text
	(itsRegex->GetMatchInterpolator())->SetWhitespaceEscapes();

	itsUpdateTask = new JXTimerTask(kUpdatePeriod);
	assert( itsUpdateTask != NULL );
	ListenTo(itsUpdateTask);

	itsNeedXSearchBcastFlag    = kJFalse;
	itsIgnoreXSearchChangeFlag = kJTrue;			// until InitXSearch() is called

	itsVersionWindow = None;
	itsDataWindow    = None;

	JXSetSearchTextDialog(this);
	SetSearchTextHelpName(searchTextHelpName);

	(JXGetHelpManager())->RegisterSection(kJXSearchTextHelpName);
	(JXGetHelpManager())->RegisterSection(kJXRegexHelpName);
	(JXGetHelpManager())->RegisterSection(kJXRegexQRefHelpName);
}
JXTipOfTheDayDialog::JXTipOfTheDayDialog
	(
	const JBoolean showStartupCB,
	const JBoolean showAtStartup
	)
	:
	JXDialogDirector(JXGetPersistentWindowOwner(), kJFalse)
{
	itsTipList = new JPtrArray<JString>(JPtrArrayT::kDeleteAll);
	assert( itsTipList != NULL );

	itsTipIndex = 1;

	BuildWindow(showStartupCB, showAtStartup);
	ParseTips();
}
JBoolean
CBCreateGlobals
	(
	CBApp*			app,
	const JBoolean	useMDI
	)
{
	if (JAssertBase::GetAction() == JAssertBase::kAskUser)
		{
		JAssertBase::SetAction(JAssertBase::kAbort);
		}

	theApplication = app;

	CBCreateIcons();

	// prefs must be created first so everybody can read from it

	JBoolean isNew;
	thePrefsManager = new CBPrefsManager(&isNew);
	assert( thePrefsManager != NULL );

	JXInitHelp(kCBTOCHelpName, kCBHelpSectionCount, kCBHelpSectionName);
	thePrefsManager->UpgradeHelpPrefs();

	theDocManager = new CBDocumentManager;
	assert( theDocManager != NULL );

	if (useMDI)
		{
		CBDockManager* dockManager = new CBDockManager();
		assert( dockManager != NULL );
		dockManager->JPrefObject::ReadPrefs();

		theMDIServer = new CBMDIServer;
		assert( theMDIServer != NULL );
		}

	theSearchTextDialog = CBSearchTextDialog::Create();
	assert( theSearchTextDialog != NULL );

	theRunTEScriptDialog = new CBRunTEScriptDialog(JXGetPersistentWindowOwner());
	assert( theRunTEScriptDialog != NULL );

	theViewManPageDialog = new CBViewManPageDialog(JXGetPersistentWindowOwner());
	assert( theViewManPageDialog != NULL );

	theFindFileDialog = new CBFindFileDialog(JXGetPersistentWindowOwner());
	assert( theFindFileDialog != NULL );

	theDiffFileDialog = new CBDiffFileDialog(JXGetPersistentWindowOwner());
	assert( theDiffFileDialog != NULL );

	// widgets hidden in permanent window

	JXWindow* permWindow = theSearchTextDialog->GetWindow();

	theDocManager->CreateFileHistoryMenus(permWindow);

	// global commands

	theCmdManager = new CBCommandManager(theDocManager);
	assert( theCmdManager != NULL );
	theCmdManager->JPrefObject::ReadPrefs();

	// fn menu updater

	theFnMenuUpdater = new CBFnMenuUpdater;
	assert( theFnMenuUpdater != NULL );

	// symbol type list

	theSymbolTypeList = new CBSymbolTypeList(permWindow->GetColormap());
	assert( theSymbolTypeList != NULL );

	// printers

	thePTTextPrinter = new CBPTPrinter;
	assert( thePTTextPrinter != NULL );

	thePSTextPrinter = new CBPSPrinter(permWindow->GetDisplay());
	assert( thePSTextPrinter != NULL );

	return isNew;
}