Exemple #1
0
/*
	Use the state returned by ReadCurrentState and check that the state was not changed during the read operation.
	The operation is lock-free since there is no intermediate state in the write operation that could cause the
	read to loop forever.
*/
void JackFrameTimer::ReadFrameTime(JackTimer* timer)
{
    UInt16 next_index = GetCurrentIndex();
    UInt16 cur_index;
    do {
        cur_index = next_index;
        memcpy(timer, ReadCurrentState(), sizeof(JackTimer));
        next_index = GetCurrentIndex();
    } while (cur_index != next_index); // Until a coherent state has been read
}
Exemple #2
0
// Client
void JackTransportEngine::ReadCurrentPos(jack_position_t* pos)
{
    UInt16 next_index = GetCurrentIndex();
    UInt16 cur_index;
    do {
        cur_index = next_index;
        memcpy(pos, ReadCurrentState(), sizeof(jack_position_t));
        next_index = GetCurrentIndex();
    } while (cur_index != next_index); // Until a coherent state has been read
}
Exemple #3
0
void
TaskMiscPanel::ReClick()
{
  if (GetCurrentIndex() > 0)
    SetCurrent(0);
  else
    PagerWidget::ReClick();
}
Exemple #4
0
static void UpdatePos(DmOpenRef db)
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormMain)) return;
	char posbuf[20];
	StrPrintF(posbuf, "%d/%d", GetCurrentIndex() + 1,
		(UInt16) GetSMSCount(db, g_SelectedCategory));
	FrmCopyLabel(form, LabelPosition, posbuf);
}
Exemple #5
0
void SelectPackageDlg::ListCursor()
{
	int c = GetCurrentIndex();
	if(c >= 0 && c < packages.GetCount()) {
		String pp = PackagePath(GetCurrentName());
		Package pkg;
		pkg.Load(pp);
		description <<= pkg.description;
	}
	else
		description <<= Null;
}
Exemple #6
0
static Err ReplyCurrentRecord(DmOpenRef db)
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return frmErrNotTheForm;

	MemHandle memHandle = 0;
	SMSDbRecordType smsRecord;
	
	Err err = GetSMSRecord(db, g_SelectedCategory, GetCurrentIndex(), 
		smsRecord, memHandle, true);
	RETURN_ERR_ON_ERR(err);
	CheckNullPointer(memHandle);
	
	SetFieldText((FieldPtr) GetObjectPtr(form, FieldTo), smsRecord.phoneNumber);
	SetFieldText((FieldPtr) GetObjectPtr(form, FieldReference), smsRecord.content);
	FrmSetFocus(form, FrmGetObjectIndex(form, FieldCompose));

	MemHandleUnlock(memHandle);	
	
	return errNone;
}
Exemple #7
0
void SelectPackageDlg::ChangeDescription()
{
	int ii = GetCurrentIndex();
	if(ii >= 0 && ii < packages.GetCount()) {
		PkInfo& p = packages[ii];
		WithDescriptionLayout<TopWindow> dlg;
		CtrlLayoutOKCancel(dlg, "Package description");
		String pp = PackagePath(p.package);
		Package pkg;
		if(!pkg.Load(pp)) {
			Exclamation("Package does not exist.");
			return;
		}
		dlg.text <<= pkg.description;
		if(dlg.Run() != IDOK)
			return;
		pkg.description = ~dlg.text;
		pkg.Save(pp);
		p.description = description <<= ~dlg.text;
		if(alist.IsCursor())
			alist.Set(2, ~dlg.text);
	}
}
Exemple #8
0
void DeleteCurrentRecord(DmOpenRef db)
{
	DeleteRecordInCategory(db, GetCurrentIndex(), g_SelectedCategory);
}
Exemple #9
0
void SetCurrentRecordCategory(DmOpenRef db, Int16 category)
{
	MoveRecordCategory(db, GetCurrentIndex(), g_SelectedCategory, category);
}
Exemple #10
0
Err DisplayCurrentRecord(DmOpenRef db)
{
	return DisplayRecord(db, g_SelectedCategory, GetCurrentIndex());
}