void
GAddressBookTreeDir::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsCloseButton && message.Is(JXButton::kPushed))
		{
		Deactivate();
		}
	else if (sender == itsTimerTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		itsWidget->Update();
		}
	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		 const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}
	else
		{
		GMManagedDirector::Receive(sender, message);
		}
}
void
SCCircuitDocument::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsHelpMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateHelpMenu();
		}
	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}
	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsAnalysisMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateAnalysisMenu();
		}
	else if (sender == itsAnalysisMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleAnalysisMenu(selection->GetIndex());
		}

	else if (sender == itsVarList &&
			 (message.Is(JVariableList::kVarInserted) ||
			  message.Is(JVariableList::kVarNameChanged) ||
			  message.Is(JVariableList::kVarValueChanged)))
		{
		DataModified();
		}

	else
		{
		JXFileDocument::Receive(sender, message);
		}
}
Esempio n. 3
0
void
CMRegistersDir::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == CMGetLink() &&
		(message.Is(CMLink::kProgramFinished) ||
		 message.Is(CMLink::kCoreCleared)     ||
		 message.Is(CMLink::kDetachedFromProcess)))
		{
		Update("");
		}
	else if (sender == CMGetLink() &&
			 (message.Is(CMLink::kProgramStopped) ||
			  CMVarNode::ShouldUpdate(message)))
		{
		itsNeedsUpdateFlag = kJTrue;
		Update();
		}

	else if (sender == CMGetLink() && message.Is(CMLink::kSymbolsLoaded))
		{
		const CMLink::SymbolsLoaded* info =
			dynamic_cast<const CMLink::SymbolsLoaded*>(&message);
		assert( info != NULL );
		UpdateWindowTitle(info->GetProgramName());
		}

	else if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}
	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}
void
GPMMainDirector::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}
	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsProcessMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateProcessMenu();
		}
	else if (sender == itsProcessMenu && message.Is(JXMenu::kItemSelected))
		{
		 const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleProcessMenu(selection->GetIndex());
		}

	else if (sender == itsPrefsMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdatePrefsMenu();
		}
	else if (sender == itsPrefsMenu && message.Is(JXMenu::kItemSelected))
		{
		 const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandlePrefsMenu(selection->GetIndex());
		}

	else if (sender == itsHelpMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateHelpMenu();
		}
	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else if (sender == itsTimerTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		itsProcessList->Update();
		}

	else if (sender == itsTabGroup->GetCardEnclosure() &&
			 message.Is(JXCardFile::kCardIndexChanged))
		{
		JIndex index;
		const JBoolean ok = itsTabGroup->GetCurrentTabIndex(&index);
		assert( ok );

		const GPMProcessEntry* entry;
		if (index == kListTabIndex && itsProcessTree->GetSelectedProcess(&entry))
			{
			itsProcessTable->SelectProcess(*entry);
			}
		else if (index == kTreeTabIndex && itsProcessTable->GetSelectedProcess(&entry))
			{
			itsProcessTree->SelectProcess(*entry);
			}
		}

	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}
void
GXDataDocument::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}
	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsExportMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleExportMenu(selection->GetIndex());
		}

	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else if (sender == itsPrinter &&
			 message.Is(JPrinter::kPrintSetupFinished))
		{
		const JPrinter::PrintSetupFinished* info =
			dynamic_cast<const JPrinter::PrintSetupFinished*>(&message);
		assert(info != NULL);
		if (info->Successful())
			{
			itsTable->PrintRealTable(*itsPrinter);
			}
		}

	else if (sender == itsFileImportDialog && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			LoadImportFile();
			}
		itsFileImportDialog = NULL;
		}

	else if (sender == itsDelimiterDialog && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			LoadDelimitedFile();
			}
		itsDelimiterDialog = NULL;
		}

	else if (sender == itsData && itsListenToData)
		{
		DataModified();
		}

	else if (message.Is(J2DPlotWidget::kPlotChanged) ||
			 message.Is(J2DPlotWidget::kTitleChanged) ||
			 message.Is(J2DPlotWidget::kIsEmpty))
		{
		DataModified();
		}

	else
		{
		JXFileDocument::Receive(sender, message);
		}
}
void
GLFitDirector::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsFitMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFitMenu(selection->GetIndex());
		}
	else if (sender == itsFitMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFitMenu();
		}
	else if (sender == itsPrefsMenu && message.Is(JXMenu::kItemSelected))
		{
		 const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandlePrefsMenu(selection->GetIndex());
		}
	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}
	else if (sender == itsCurveList && message.Is(GLCurveNameList::kCurveSelected))
		{
		const GLCurveNameList::CurveSelected* info = 
			dynamic_cast<const GLCurveNameList::CurveSelected*>(&message);
		assert(info != NULL);
		JPlotDataBase& curve = itsPlot->GetCurve(info->GetIndex());

		RemoveFit();
		RemoveCurves();

		itsParameterTable->ClearValues();
		itsChiSq->SetText("");

		// add new curve.
		itsFitPlot->AddCurve(&curve, kJFalse, itsPlot->GetCurveName(info->GetIndex()));
		itsFitPlot->ProtectCurve(1, kJTrue);
		}
	else if (sender == itsFitList && message.Is(GLFitDescriptionList::kFitSelected))
		{
		const GLFitDescriptionList::FitSelected* info = 
			dynamic_cast<const GLFitDescriptionList::FitSelected*>(&message);
		assert(info != NULL);
		const GLFitDescription& fd	= GetFitManager()->GetFitDescription(info->GetIndex());
		itsParameterTable->SetFitDescription(fd);
		RemoveFit();
		itsChiSq->SetText("");
		JFunction* f;
		if (JParseFunction(fd.GetFitFunctionString(), const_cast<GLFitDescription&>(fd).GetVarList(), &f))
			{
			itsExprWidget->SetFunction(const_cast<GLFitDescription&>(fd).GetVarList(), f);
			itsExprWidget->Show();
			}		
		}
	else if (sender == itsFitList && message.Is(GLFitDescriptionList::kFitInitiated))
		{
		const GLFitDescriptionList::FitInitiated* info = 
			dynamic_cast<const GLFitDescriptionList::FitInitiated*>(&message);
		assert(info != NULL);
		const GLFitDescription& fd	= GetFitManager()->GetFitDescription(info->GetIndex());
		if (!itsParameterTable->BeginEditingStartValues())
			{
			Fit();
			AddHistoryText();
			}
		}
	else if (sender == itsParameterTable && message.Is(GLFitParameterTable::kValueChanged))
		{
		const GLFitParameterTable::ValueChanged* info =
			dynamic_cast<const GLFitParameterTable::ValueChanged*>(&message);
		assert(info != NULL);
		JIndex index;
		JBoolean ok	= itsFitList->GetCurrentFitIndex(&index);
		assert(ok);
		GLFitDescription& fd	= GetFitManager()->GetFitDescription(index);
		const JArray<JFloat>& parms	= itsParameterTable->GetStartValues();
		const JSize count	= parms.GetElementCount();
		for (JIndex i = 1; i <= count; i++)
			{
			fd.GetVarList()->SetValue(i + 1, parms.GetElement(i));
			}
		GetWindow()->Refresh();
		}
	else if (sender == itsNLFitDialog && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert(info != NULL);
		if (info->Successful())
			{
			GLNonLinearFitDescription* fit	= 
				new GLNonLinearFitDescription(itsNLFitDialog->GetFitName(), 
					itsNLFitDialog->GetFunctionString(), 
					itsNLFitDialog->GetDerivativeString(),
					itsNLFitDialog->GetVarList().GetVariables());
			assert(fit != NULL);
			GetFitManager()->AddFitDescription(fit);
			}
		itsNLFitDialog	= NULL;	
		}
	else if (sender == itsPolyFitDialog && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert(info != NULL);
		if (info->Successful())
			{
			JArray<JIndex> powers;
			itsPolyFitDialog->GetPowers(&powers);
			GLPolyFitDescription* fit	= 
				new GLPolyFitDescription(itsPolyFitDialog->GetFitName(), 
					powers);
			assert(fit != NULL);
			GetFitManager()->AddFitDescription(fit);
			}
		itsPolyFitDialog	= NULL;	
		}
	else if (sender == itsPrinter &&
			 message.Is(JPrinter::kPrintSetupFinished))
		{
		const JPrinter::PrintSetupFinished* info =
			dynamic_cast<const JPrinter::PrintSetupFinished*>(&message);
		assert(info != NULL);
		if (info->Successful())
			{
			Print();
			}
		}
	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}
void
CMSourceDirector::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (IsMainSourceWindow() &&
		sender == itsLink && message.Is(CMLink::kDebuggerStarted))
		{
		ClearDisplay();
		}
	else if (sender == itsLink && message.Is(CMLink::kPrepareToLoadSymbols))
		{
		if (!itsCurrentFile.IsEmpty())		// reload file, in case it changed
			{
			const JString fileName = itsCurrentFile;
			const JIndex lineIndex = itsText->HasSelection() ?
									 itsText->GetLineForChar(itsText->GetInsertionIndex()) :
									 itsTable->GetCurrentLine();
			itsCurrentFile.Clear();			// force reload
			DisplayFile(fileName, lineIndex);
			}
		}
	else if (IsMainSourceWindow() &&
			 sender == itsLink && message.Is(CMLink::kSymbolsLoaded))
		{
		const CMLink::SymbolsLoaded* info =
			dynamic_cast<const CMLink::SymbolsLoaded*>(&message);
		assert( info != NULL );
		UpdateWindowTitle(info->GetProgramName());
		}
	else if (IsMainSourceWindow() &&
			 sender == itsLink && message.Is(CMLink::kProgramStopped))
		{
		const CMLink::ProgramStopped* info =
			dynamic_cast<const CMLink::ProgramStopped*>(&message);
		assert( info != NULL);
		const CMLocation* loc;
		const JBoolean hasFile = info->GetLocation(&loc);
		if (itsType == kMainSourceType && hasFile)
			{
			DisplayFile(loc->GetFileName(), loc->GetLineNumber());
			}
		else if (itsType == kMainAsmType &&
				 !loc->GetFunctionName().IsEmpty() &&
				 !loc->GetMemoryAddress().IsEmpty())
			{
			DisplayDisassembly(*loc);
			}
		else if (itsType == kMainAsmType)
			{
			// wait for kProgramStopped2
			}
		else
			{
			#ifdef _J_OLD_OSX
			itsTable->SetCurrentLine(0);	// we get blank location the first time
			#else
			ClearDisplay();
			(CMGetCommandDirector())->GetStackDir()->Activate();
			#endif
			}
		}
	else if (itsType == kMainAsmType && sender == itsLink &&
			 message.Is(CMLink::kProgramStopped2))
		{
		const CMLink::ProgramStopped2* info =
			dynamic_cast<const CMLink::ProgramStopped2*>(&message);
		assert( info != NULL);
		const CMLocation* loc;
		info->GetLocation(&loc);
		if (!loc->GetFunctionName().IsEmpty() &&
			!loc->GetMemoryAddress().IsEmpty())
			{
			DisplayDisassembly(*loc);
			}
		else
			{
			ClearDisplay();
			}
		}

	else if (sender == itsLink &&
			 (message.Is(CMLink::kProgramFinished) ||
			  message.Is(CMLink::kCoreCleared)     ||
			  message.Is(CMLink::kDetachedFromProcess)))
		{
		if (itsSrcMainCmd != NULL)
			{
			itsSrcMainCmd->CMCommand::Send();
			}
		else if (itsType == kMainAsmType)
			{
			ClearDisplay();
			}
		}

	else if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}
	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsDebugMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		itsCommandDir->UpdateDebugMenu(itsDebugMenu, itsText, NULL);
		}
	else if (sender == itsDebugMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		itsCommandDir->HandleDebugMenu(itsDebugMenu, selection->GetIndex(), itsText, NULL);
		}

	else if (sender == itsPrefsMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdatePrefsMenu();
		}
	else if (sender == itsPrefsMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandlePrefsMenu(selection->GetIndex());
		}

	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else if (sender == CMGetPrefsManager() && message.Is(CMPrefsManager::kFileTypesChanged))
		{
		UpdateFileType();
		}
	else if (sender == CMGetPrefsManager() && message.Is(CMPrefsManager::kCustomCommandsChanged))
		{
		itsCommandDir->AdjustDebugMenu(itsDebugMenu);
		}

	else
		{
		JXWindowDirector::Receive(sender,message);
		}
}
void
CMLocalVarsDir::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsLink &&
		(message.Is(CMLink::kValueChanged)   ||
		 message.Is(CMLink::kThreadChanged)  ||
		 message.Is(CMLink::kFrameChanged)   ||
		 message.Is(CMLink::kCoreLoaded)     ||
		 message.Is(CMLink::kAttachedToProcess)))
		{
		Rebuild();
		}
	else if (sender == itsLink && message.Is(CMLink::kProgramStopped))
		{
		const CMLink::ProgramStopped& info =
			dynamic_cast<const CMLink::ProgramStopped&>(message);

		const CMLocation* loc;
		if (info.GetLocation(&loc) && !(loc->GetFileName()).IsEmpty())
			{
			Rebuild();
			}
		}
	else if (sender == itsLink &&
			 (message.Is(CMLink::kProgramFinished) ||
			  message.Is(CMLink::kCoreCleared)     ||
			  message.Is(CMLink::kDetachedFromProcess)))
		{
		// can't listen for CMLink::kProgramRunning because this happens
		// every time the user executes another line of code

		FlushOldData();
		}

	else if (sender == itsLink && message.Is(CMLink::kSymbolsLoaded))
		{
		const CMLink::SymbolsLoaded* info =
			dynamic_cast<const CMLink::SymbolsLoaded*>(&message);
		assert( info != NULL );
		UpdateWindowTitle(info->GetProgramName());
		}

	else if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}
	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		 const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsActionMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateActionMenu();
		}
	else if (sender == itsActionMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleActionMenu(selection->GetIndex());
		}

	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else if (sender == GetWindow() && message.Is(JXWindow::kDeiconified))
		{
		Update();
		}

	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}
Esempio n. 9
0
void
PlotDir::Receive
	(
	JBroadcaster* sender,
	const JBroadcaster::Message& message
	)
{
	if (sender == itsPlot && message.Is(J2DPlotWidget::kTitleChanged))
		{
		JString title = itsFileName + ":  " + itsPlot->GetTitle();
		GetWindow()->SetTitle(title);
		JString sessiontitle = "Glove session  -  " + title;
		(itsSessionDir->GetWindow())->SetTitle(sessiontitle);
		}

	else if (sender == itsPlot && message.Is(J2DPlotWidget::kPlotChanged))
		{
		itsSupervisor->DataModified();
		}

	else if (sender == itsSessionDir && message.Is(GloveHistoryDir::kSessionChanged))
		{
		itsSupervisor->DataModified();
		}

	else if (sender == itsPlot && message.Is(J2DPlotWidget::kIsEmpty))
		{
		if (!itsPlotIsClosing)
			{
			GLClosePlotDirTask* task = jnew GLClosePlotDirTask(this);
			assert(task != NULL);
			task->Go();
			}
		}

	else if (sender == itsPlot && message.Is(J2DPlotWidget::kCurveAdded))
		{
		HandleCurveAdded();
		}

	else if (sender == itsPlot && message.Is(J2DPlotWidget::kCurveRemoved))
		{
		const J2DPlotWidget::CurveRemoved* info =
			dynamic_cast<const J2DPlotWidget::CurveRemoved*>(&message);
		assert( info != NULL );
		HandleCurveRemoved(info->GetIndex());
		}

	else if (sender == itsPlotMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandlePlotMenu(selection->GetIndex());
		}
	else if (sender == itsAnalysisMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleAnalysisMenu(selection->GetIndex());
		}
	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else if (sender == itsFits &&
		( 	message.Is(JOrderedSetT::kElementsInserted) ||
			message.Is(JOrderedSetT::kElementsRemoved)))
		{
		UpdateFitParmsMenu();
		}

	else if (sender == itsDiffDirs &&
		( 	message.Is(JOrderedSetT::kElementsInserted) ||
			message.Is(JOrderedSetT::kElementsRemoved)))
		{
		UpdateDiffMenu();
		}


	else if (sender == itsFitParmsMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		itsFitParmsDir->Activate();
		itsFitParmsDir->ShowFit(selection->GetIndex());
		}

	else if (sender == itsDiffMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		PlotDir* dir = itsDiffDirs->NthElement(selection->GetIndex());
		dir->Activate();
//		(itsDiffDirs->NthElement(selection->GetIndex()))->Activate();
		}


	else if (sender == itsFunctionDialog && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			JString fnStr = itsFunctionDialog->GetFunctionString();
			JFunction* f;
			if (JParseFunction(fnStr, itsVarList, &f))
				{
				PlotFunction(f);
				}
			}
		itsFunctionDialog = NULL;
		}

	else if (sender == itsFitModuleDialog && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			JIndex index = itsFitModuleDialog->GetFilterIndex();
			JPlotDataBase* data = &(itsPlot->GetCurve(itsCurveForFit));
			FitModule* fm;
			JString modName;
			(GLGetApplication())->GetFitModulePath(index, &modName);
			JBoolean success = FitModule::Create(&fm, this, data, modName);
			if (!success)
				{
				JGetUserNotification()->ReportError("Unknown module error.");
				}
			}
		itsFitModuleDialog = NULL;
		}

	else if (sender == itsPrinter &&
			 message.Is(JPrinter::kPageSetupFinished))
		{
		const JPrinter::PageSetupFinished* info =
			dynamic_cast<const JPrinter::PageSetupFinished*>(&message);
		assert(info != NULL);
		if (info->Changed())
			{
			itsSupervisor->DataModified();
			// for WYSISYG: adjust display to match new paper size
			}
		}

	else if (sender == itsPrinter &&
			 message.Is(JPrinter::kPrintSetupFinished))
		{
		const JPrinter::PrintSetupFinished* info =
			dynamic_cast<const JPrinter::PrintSetupFinished*>(&message);
		assert(info != NULL);
		if (info->Successful())
			{
			itsPlot->Print(*itsPrinter);
			if (itsIsPrintAll)
				{
				itsFitParmsDir->SendAllToSession();
				itsSessionDir->Print();
				}
			}
		}
	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}
void
CMArray1DDir::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsExprInput &&
		(message.Is(JXWidget::kLostFocus) ||
		 message.Is(CMArrayExprInput::kReturnKeyPressed)))
		{
		if (itsExprInput->GetText() != itsExpr)
			{
			itsExpr = itsExprInput->GetText();
			UpdateWindowTitle();
			itsDisplayRange.SetToEmptyAt(0);
			BeginCreateNodes();
			}
		}
	else if (sender == itsStartIndex &&
			 (message.Is(JXWidget::kLostFocus) ||
			  message.Is(CMArrayIndexInput::kReturnKeyPressed)))
		{
		JInteger value;
		if (itsStartIndex->GetValue(&value) && value != itsRequestRange.first)
			{
			itsRequestRange.first = value;
			BeginCreateNodes();
			}
		}
	else if (sender == itsEndIndex &&
			 (message.Is(JXWidget::kLostFocus) ||
			  message.Is(CMArrayIndexInput::kReturnKeyPressed)))
		{
		JInteger value;
		if (itsEndIndex->GetValue(&value) && value != itsRequestRange.last)
			{
			itsRequestRange.last = value;
			BeginCreateNodes();
			}
		}

	else if (sender == itsTree && message.Is(JTree::kNodeChanged))
		{
		const JTree::NodeChanged* info =
			dynamic_cast<const JTree::NodeChanged*>(&message);
		assert(info != NULL);
		if (info->GetNode() == itsCurrentNode)
			{
			itsCurrentNode = NULL;
			CreateNextNode();
			}
		}

	else if (sender == itsStopButton && message.Is(JXButton::kPushed))
		{
		itsRequestRange = itsDisplayRange;
		itsStartIndex->SetValue(itsRequestRange.first);
		itsEndIndex->SetValue(itsRequestRange.last);
		CreateNodesFinished();
		}

	else if (sender == itsLink && message.Is(CMLink::kDebuggerRestarted))
		{
		itsWaitingForReloadFlag = kJTrue;
		}
	else if (sender == itsLink && message.Is(CMLink::kDebuggerStarted))
		{
		if (!itsWaitingForReloadFlag)
			{
			JXCloseDirectorTask::Close(this);	// close after bcast is finished
			}
		itsWaitingForReloadFlag = kJFalse;
		}

	else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileMenu(selection->GetIndex());
		}

	else if (sender == itsActionMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateActionMenu();
		}
	else if (sender == itsActionMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleActionMenu(selection->GetIndex());
		}

	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}

	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}