Пример #1
0
void
GMApp::Receive
(
    JBroadcaster*					sender,
    const JBroadcaster::Message&	message
)
{
    if (sender == itsAboutDialog && message.Is(JXDialogDirector::kDeactivated))
    {
        const JXDialogDirector::Deactivated* info =
            dynamic_cast(const JXDialogDirector::Deactivated*, &message);
        assert(info != NULL);
        if (info->Successful() && itsOpenPrefsAfterAbout)
        {
            if (!itsPrefsNew)
            {
                JGetUserNotification()->DisplayMessage("Your mail preferences have been converted, please verify that they are correct.");
            }
            GGetAccountMgr()->EditAccounts();
        }
        itsAboutDialog			= NULL;
        itsOpenPrefsAfterAbout	= kJFalse;
        itsPrefsNew				= kJFalse;
    }

    else
    {
Пример #2
0
void
SMTPMessage::Receive
	(
	JBroadcaster*					sender,
	const JBroadcaster::Message&	message
	)
{
	if (sender == itsLink && !itsIsFinished)
		{
		if (message.Is(JMessageProtocolT::kMessageReady))
			{
			itsSomethingRead = kJTrue;
			if (itsTimeoutTask != NULL)
				{
				delete itsTimeoutTask;
				itsTimeoutTask	= NULL;
				}
			ReadReturnValue();
			}
		else if (message.Is(JMessageProtocolT::kReceivedDisconnect))
			{
			JGetUserNotification()->ReportError("The connection to sendmail closed early.");
			Broadcast(SendFailure());
			itsDeleteTask = new JXTimerTask(1000,kJTrue);
			assert( itsDeleteTask != NULL );
			itsDeleteTask->Start();
			ListenTo(itsDeleteTask);
//			itsLink = NULL;
			}
		}
	else if (sender == itsTimeoutTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		JGetUserNotification()->ReportError("The connection to the SMTP server timed out.");
		Broadcast(SendFailure());
		itsLink		= NULL;
		itsTimeoutTask	= NULL;
		delete this;
		}
	else if (sender == itsDeleteTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		itsDeleteTask	= NULL;
		delete this;
		}
}
void
SMTPDebugDir::Receive
	(
	JBroadcaster* sender,
	const JBroadcaster::Message& message
	)
{
	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 == itsFileMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileMenu();
		}

	GMManagedDirector::Receive(sender, message);
}
void
GloveCursorTableDir::Receive
	(
	JBroadcaster* sender,
	const JBroadcaster::Message& message
	)
{
	if (sender == itsCloseButton && message.Is(JXButton::kPushed))
		{
		Deactivate();
		}
		
	if (sender == itsSessionButton && message.Is(JXButton::kPushed))
		{
		SendToSession();
		}	
		
	else
		{
		JXWindowDirector::Receive(sender, message);
		}
}
void
GMessageViewDir::Receive
	(
	JBroadcaster* sender,
	const JBroadcaster::Message& message
	)
{
	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))
Пример #6
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);
		}
}