⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nxdetail.cxx

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CXX
📖 第 1 页 / 共 2 页
字号:
    pThis->time_callback(detailTimePicked_callback);}voidNxSchedule::cancelEdit_callback(Fl_Widget * w, void *l){    NxSchedule *pThis = (NxSchedule *) l;    pThis->pCalendar->SetPickedDate(0);    pThis->show_window(dayWindow->GetWindowPtr());    pThis->UpdateDateDisplay();}voidNxSchedule::deleteEdit_callback(Fl_Widget * w, void *l){    NxSchedule *pThis = (NxSchedule *) l;    if ((REPEAT_NONE) & pThis->m_pCurrentItem->repeatFlag_1 ||	pThis->m_pCurrentItem->repeatFlag_1 == 0)	NxApp::Instance()->show_window(deleteWindow->GetWindowPtr(),				       DEACTIVATE,				       detailsWindow->GetWindowPtr());    else {	pThis->g_EditFlag = DELETE_FLAG;	NxApp::Instance()->show_window(repeatEventWindow->GetWindowPtr(),				       DEACTIVATE,				       detailsWindow->GetWindowPtr());    }}voidNxSchedule::doneEdit_callback(Fl_Widget * w, void *l){    NxSchedule *pThis = (NxSchedule *) l;    strcpy(pThis->m_pCurrentItem->szDescription,	   pThis->m_pDetails_DescBox->value());    if (!(g_EditFlag & CHANGED_NEW)) {	NxTodo *n = new NxTodo;	int recno = pThis->m_pCurrentItem->recno;	int rec_array[1];	char c_recno[16];	rec_array[0] = -1;	sprintf(c_recno, "%d", recno);	pThis->db->Select(SCHEDULE, c_recno, 0, rec_array, 1);	pThis->ExtractRecord(n, rec_array[0]);#ifdef DO_ALARM	if (0 == strcmp("", pThis->m_pDetailsAlarmInput->value()) ||	    0 == strcmp(" ", pThis->m_pDetailsAlarmInput->value())) {	    pThis->m_pCurrentItem->alarmInt = 0;	}	if (n->alarmFlags != pThis->m_pCurrentItem->alarmFlags ||	    n->alarmInt != pThis->m_pCurrentItem->alarmInt) {	    // need to delete old alarm and set new one	    if ((REPEAT_NONE == pThis->m_pCurrentItem->repeatFlag_1)) {		DPRINT("changed alarm\n");		DPRINT("send message to alarmd\n");		pThis->DeleteAlarm(n);		pThis->SetAlarm(pThis->m_pCurrentItem, 0);	    } else		g_EditFlag |= CHANGED_ALARM;	}#endif	delete n;	n = 0;    } else {#ifdef DO_ALARM	if (pThis->m_pCurrentItem->alarmInt != NO_ALARM) {	    DPRINT("setting alarm for new item\n");	    pThis->SetAlarm(pThis->m_pCurrentItem, 0);	}#endif    }    if (((CHANGED_DATE_FLAG & g_EditFlag)	 || (CHANGED_TIME_FLAG & g_EditFlag)#ifdef DO_ALARM	 || (CHANGED_ALARM & g_EditFlag)#endif	) &&	(REPEAT_NONE != pThis->m_pCurrentItem->repeatFlag_1) &&	!(CHANGED_NEW & g_EditFlag)) {	NxApp::Instance()->show_window(repeatEventWindow->GetWindowPtr(),				       DEACTIVATE,				       detailsWindow->GetWindowPtr());    } else {	save(pThis->m_pCurrentItem);	pThis->show_window(dayWindow->GetWindowPtr());    }    g_EditFlag = g_EditFlag & ~CHANGED_NEW;    pThis->UpdateDateDisplay();}static char *_FormatDate(NxTodo * n){    static char buf[30];    NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());    time_t date = pThis->GetCurrentDay();    int year = 0;    int mon = 0;    int day = 0;    tm *tt = NULL;    int flag = pThis->GetEditFlag();    tt = localtime(&date);    day = tt->tm_mday;    mon = tt->tm_mon;    year = tt->tm_year;    if ((REPEAT_NONE & n->repeatFlag_1)) {	//strftime(buf,29,"%b %d, %Y",localtime(&n->startTime));	pThis->GetDateString(buf, localtime(&n->startTime), sizeof(buf),			     LONG_YEAR);	return buf;    }    if (flag & CHANGED_DATE_FLAG) {	date = pThis->GetpCalendar()->GetPickedDate();	if (date == 0)	    date = pThis->GetCurrentDay();	//strftime(buf,29,"%b %d, %Y",localtime(&date));	pThis->GetDateString(buf, localtime(&date), sizeof(buf), LONG_YEAR);    } else {	//strftime(buf,29,"%b %d, %Y",localtime(&date));	pThis->GetDateString(buf, localtime(&date), sizeof(buf), LONG_YEAR);    }    return buf;}// This function will fill the detail form as well as set// the "Current" schedule item to be edited.voidNxSchedule::FillDetailForm(NxTodo * n, int flags){#ifdef DO_ALARM    char buf[16];#endif    if (!n)	return;    m_pCurrentItem = n;    m_pDetails_TimeBox->label(_FormatTimeRange(n));    m_pDetails_TimeBox->redraw();    m_pDetails_DateBox->label(_FormatDate(n));    m_pDetails_DateBox->redraw();    switch (n->repeatFlag_1) {    case REPEAT_YEARLY:	m_pDetails_RepeatBox->label("Yearly");	break;    case REPEAT_MONTHLY:	m_pDetails_RepeatBox->label("Monthly");	break;    case REPEAT_WEEKLY:	m_pDetails_RepeatBox->label("Weekly");	break;    case REPEAT_DAILY:	m_pDetails_RepeatBox->label("Daily");	break;    default:    case REPEAT_NONE:	m_pDetails_RepeatBox->label("None");	break;    }    if (DESC_NEW & flags)	m_pDetails_DescBox->value("");    else if (DESC_KEEP & flags);    else	m_pDetails_DescBox->value(n->szDescription);#ifdef DO_ALARM    sprintf(buf, "%d", n->alarmInt);    m_pDetailsAlarmInput->value(buf);    if (n->alarmInt != NO_ALARM)	showAlarmUi();    else	hideAlarmUi();#endif}#ifdef DO_ALARMvoidNxSchedule::hideAlarmUi(){    m_pDetailsAlarmCheck->value(0);    m_pDetailsAlarmInput->hide();    m_pDetailsAlarmInt->hide();}voidNxSchedule::showAlarmUi(){    static char buf[3];    m_pDetailsAlarmCheck->value(1);    switch (m_pCurrentItem->alarmFlags) {    case ALARM_MIN:	m_pDetailsAlarmInt->label("Minutes");	break;    case ALARM_HOUR:	m_pDetailsAlarmInt->label("Hours");	break;    case ALARM_DAY:	m_pDetailsAlarmInt->label("Days");	break;    default:	m_pDetailsAlarmInt->label("Minutes");	break;    }    sprintf(buf, "%d", m_pCurrentItem->alarmInt);    m_pDetailsAlarmInput->value(buf);    m_pDetailsAlarmInput->hide();    m_pDetailsAlarmInput->show();    m_pDetailsAlarmInt->show();}#endifvoidNxSchedule::MakeDetailsWindow(){    detailsWindow =	new NxPimPopWindow("Event Details",			   NxApp::Instance()->getGlobalColor(APP_FG), 5, 5,			   W_W - 10, 205);    add_window((Fl_Window *) detailsWindow->GetWindowPtr());    // for the time input    {	NxOutput *o = new NxOutput(20, 35, 0, 0, "Time:");	NxApp::Instance()->def_font(o);	detailsWindow->add(o);	o->align(FL_ALIGN_RIGHT);    }    {	NxButton *o = new NxButton(55, 27, 120, BUTTON_HEIGHT);	o->box(FL_THIN_UP_BOX);	o->label("11:00am - 10:00pm");	o->callback(detailTime_callback, this);	detailsWindow->add(o);	m_pDetails_TimeBox = o;    }    // for the date input    {	NxOutput *o = new NxOutput(20, 60, 0, 0, "Date:");	detailsWindow->add(o);	o->align(FL_ALIGN_RIGHT);    }    {	NxButton *o = new NxButton(58, 52, 110, BUTTON_HEIGHT);	o->box(FL_THIN_UP_BOX);	o->label("Aug 10, 2001");	o->callback(detailDate_callback, this);	detailsWindow->add(o);	m_pDetails_DateBox = o;    }    // for the repeat    {	NxOutput *o = new NxOutput(8, 85, 0, 0, "Repeat:");	detailsWindow->add(o);	o->align(FL_ALIGN_RIGHT);    }    {	NxButton *o = new NxButton(58, 77, 70, BUTTON_HEIGHT);	o->box(FL_THIN_UP_BOX);	o->label("Monthly");	detailsWindow->add(o);	m_pDetails_RepeatBox = o;	o->callback(detailRepeat_callback, this);    }#ifdef DO_ALARM    {	NxOutput *o = new NxOutput(14, 110, 0, 0, "Alarm:");	detailsWindow->add(o);	o->align(FL_ALIGN_RIGHT);    }    {	NxCheckButton *o = new NxCheckButton(58, 99, "");	o->callback(alarmToggle_callback, this);	detailsWindow->add((Fl_Widget *) o);	m_pDetailsAlarmCheck = o;    }    {	NxIntInput *o = new NxIntInput(70, 99, 30, 20, "");	detailsWindow->add(o);	o->maximum_size(2);	o->callback(alarmIntChanged_callback, this);	o->when(FL_WHEN_CHANGED);	m_pDetailsAlarmInput = o;    }    {	NxMenuButton *o = new NxMenuButton(103, 101, 60, BUTTON_HEIGHT);	o->label("Minutes");	o->menu(alarmMenuItems);	detailsWindow->add(o);	m_pDetailsAlarmInt = o;    }#endif    {	NxMultilineInput *o = new NxMultilineInput(3, 127,						   detailsWindow->						   GetWindowPtr()->w() - 6,						   50);	o->maximum_size(99);	o->align(FL_ALIGN_WRAP);	detailsWindow->add(o);	m_pDetails_DescBox = o;    }    {	NxButton *o = new NxButton(POP_BUTTON_X, POP_BUTTON_Y(detailsWindow),				   BUTTON_WIDTH, BUTTON_HEIGHT, "Ok");	o->callback(doneEdit_callback, this);	detailsWindow->add((Fl_Widget *) o);    }    {	NxButton *o = new NxButton(POP_BUTTON_X + BUTTON_WIDTH + 2,				   POP_BUTTON_Y(detailsWindow),				   BUTTON_WIDTH, BUTTON_HEIGHT, "Cancel");	o->callback(cancelEdit_callback, this);	detailsWindow->add((Fl_Widget *) o);    }    {	NxButton *o = new NxButton(POP_BUTTON_X + (BUTTON_WIDTH * 2) + 4,				   POP_BUTTON_Y(detailsWindow),				   BUTTON_WIDTH, BUTTON_HEIGHT, "Delete");	o->callback(deleteEdit_callback, this);	detailsDeleteButton = o;	detailsWindow->add((Fl_Widget *) o);    }    detailsWindow->GetWindowPtr()->end();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -