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

📄 .#task.c.1.29

📁 个人日程管理系统
💻 29
📖 第 1 页 / 共 5 页
字号:
/* -*-Mode:C; tab-width:4; indent-tabs-mode:t; c-file-style:"stroustrup";-*- */// $Id: task.c,v 1.29 2003/08/04 03:19:20 rick_price Exp $#include <PalmOS.h>#include "task.h"#include "progect.h"#include "xb.h"#include "progectdb.h"#include "progectRsc.h"#include "ToDoDB.h"#include "MemoDB.h"#include "AddressDB.h"void dbgPrintTask(DmOpenRef dbP, UInt16 index){	MemHandle h;	TaskRecordType *p;	DBGMSG((DBB, "dbgPrintTask"));	h = DmQueryRecord(dbP, index);	p = MemHandleLock(h);	DBGMSG((DBB, "Complete record next line"));	DBGMSGBIN((DBB, p, MemHandleSize(h)));	MemHandleUnlock(h);}/**************************************************************************** * Name : TaskSetAttr * Desc : set the attributes of a task * Parm :  * 			-> db to search * 			-> index of record * 			-> new attributes * Out  : pgErr * Auth : lb, 22.08.2000 * Mod  : lb, 2001-01-21 * 			changing attr should not set dirty (move or change level) ***************************************************************************/pgErr TaskSetAttr(DmOpenRef dbP, UInt16 index, TaskAttrType attr){	MemHandle h;	TaskRecordType *p;	DBGMSG((DBB, "TaskSetAttr"));	h = DmGetRecord(dbP, index);	p = MemHandleLock(h);	DmWrite(p, OffsetOf(TaskRecordType, attr), &attr, sizeof(UInt16));	MemHandleUnlock(h);	DmReleaseRecord(dbP, index, false);	return pgOK;} // pgErr TaskSetAttr(DmOpenRef dbP, UInt16 index, TaskAttrType attr)/**************************************************************************** * Name : TaskGetAttr * Desc : get the attributes of a task * Parm :  * 			-> db to search * 			-> index of record * Out  : attributes * Auth : lb, 22.08.2000 ***************************************************************************/TaskAttrType TaskGetAttr(DmOpenRef dbP, UInt16 index){	MemHandle h;	TaskRecordType *p;	TaskAttrType attr;	DBGMSG((DBB, "TaskGetAttr"));	h = DmQueryRecord(dbP, index);	p = MemHandleLock(h);	attr = p->attr.bits;	MemHandleUnlock(h);	return attr;} // UInt16 TaskGetAttr(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetFormat * Desc : set the format of a task * Parm :  * 			-> db to search * 			-> index of record * 			-> new format * Out  : pgErr * Auth : lb, 22.08.2000 ***************************************************************************/pgErr TaskSetFormat(DmOpenRef dbP, UInt16 index, TaskFormatType format){	MemHandle h;	TaskRecordType *p;	DBGMSG((DBB, "TaskSetFormat"));	h = DmGetRecord(dbP, index);	p = MemHandleLock(h);	DmWrite(p, OffsetOf(TaskRecordType, format), &format, sizeof(UInt16));	MemHandleUnlock(h);	DmReleaseRecord(dbP, index, true);	return pgOK;} // pgErr TaskSetFormat(DmOpenRef dbP, UInt16 index, TaskFormatType format)/**************************************************************************** * Name : TaskGetFormat * Desc : get the format of a task * Parm :  * 			-> db to search * 			-> index of record * Out  : format * Auth : lb, 26.08.2000 ***************************************************************************/TaskFormatType TaskGetFormat(DmOpenRef dbP, UInt16 index){	MemHandle h;	TaskRecordType *p;	TaskFormatType format;	DBGMSG((DBB, "TaskGetFormat"));	h = DmQueryRecord(dbP, index);	p = MemHandleLock(h);	format = p->format.bits;	MemHandleUnlock(h);	return format;} // TaskFormatType TaskGetFormat(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetLevel * Desc : set the level of a task * Parm :  * 			-> db to search * 			-> index of record * 			-> new level (0-31) * Out  : pgErr * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/pgErr TaskSetLevel(DmOpenRef dbP, UInt16 index, UInt8 level){	TaskAttrType attr;	DBGMSG((DBB, "TaskSetLevel"));	if (level > 31)		return pgError;	attr = TaskGetAttr(dbP, index);	attr.level = level;	TaskSetAttr(dbP, index, attr);	return pgOK;} // pgErr TaskSetLevel(DmOpenRef dbP, UInt16 index, UInt8 level)/**************************************************************************** * Name : TaskGetLevel * Desc : get the level of a task * Parm :  * 			-> db to search * 			-> index of record * Out  : level, 0 if not found * Auth : lb, 27.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/UInt8 TaskGetLevel(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskGetLevel"));	return TaskGetAttr(dbP, index).level;} // UInt8 TaskGetLevel(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetPriority * Desc : set the priority of a task * Parm :  * 			-> db to search * 			-> index of record * 			-> new priority * Out  :  * Auth : lb, 06.08.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme * Mod	: lb, 2001-09-10 * 		  	adapt to 0.23 db format ***************************************************************************/pgErr TaskSetPriority(DmOpenRef dbP, UInt16 index, UInt8 priority){	MemHandle h;	TaskExtendedRecordType *p;	DBGMSG((DBB, "TaksSetPriority"));	h = DmGetRecord(dbP, index);	p = MemHandleLock(h);	DmWrite(p,		StdFieldsOffset(p) + OffsetOf(TaskStandardFields, priority), 		&priority, sizeof(UInt8));	MemHandleUnlock(h);	DmReleaseRecord(dbP, index, true);	return pgOK;} // void TaskSetPriority(DmOpenRef dbP, UInt16 index, UInt8 priority)/**************************************************************************** * Name : TaskGetPriority * Desc : get the priority of a task * Parm :  * 			-> db to search * 			-> index of record * Out  : level, 0 if not found * Auth : lb, 06.08.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme * Mod	: lb, 2001-09-10 * 		  	adapt to 0.23 db format ***************************************************************************/UInt8 TaskGetPriority(DmOpenRef dbP, UInt16 index){	MemHandle h;	TaskExtendedRecordType *p;	UInt8 priority;	DBGMSG((DBB, "TaskGetPriority"));	h = DmQueryRecord(dbP, index);	p = MemHandleLock(h);	priority = StdFields(p)->priority;	MemHandleUnlock(h);	if (priority == 0)		priority = NO_PRIORITY;	return priority;} // UInt8 TaskGetPriority(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetCategory * Desc : set the category of a task * Parm :  * 			-> db to search * 			-> index of record * 			-> new category * Out  :  * Auth : rw, 30.12.2000 ***************************************************************************/pgErr TaskSetCategory(DmOpenRef dbP, UInt16 index, UInt16 category){	UInt16 attr;	DBGMSG((DBB, "TaskSetPriority"));	DmRecordInfo(dbP, index, &attr, NULL, NULL);	attr = (attr & ~dmRecAttrCategoryMask) | category | dmRecAttrDirty;	DmSetRecordInfo(dbP, index, &attr, NULL);	return pgOK;} // void TaskSetCategory(DmOpenRef dbP, UInt16 index, UInt16 category)/**************************************************************************** * Name : TaskGetCategory * Desc : get the category of a task * Parm :  * 			-> db to search * 			-> index of record * Out  : category, 0 if Unfiled * Auth : rw, 30.12.2000 ***************************************************************************/UInt16 TaskGetCategory(DmOpenRef dbP, UInt16 index){	UInt16 attr;	UInt16 category;	DBGMSG((DBB, "TaskGetCategory"));	DmRecordInfo(dbP, index, &attr, NULL, NULL);	category = attr & dmRecAttrCategoryMask;	return category;} // UInt16 TaskGetCategory(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetHasChild * Desc : set the hasChild field of task * Parm :  * 			-> db to search * 			-> index of the record * 			-> value of hasChild field * Out  :  * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/pgErr TaskSetHasChild(DmOpenRef dbP, UInt16 index, Boolean hasChild){	TaskAttrType attr;	DBGMSG((DBB, "TaskSetHasChild"));	attr = TaskGetAttr(dbP, index);	attr.hasChild = hasChild;	TaskSetAttr(dbP, index, attr);	return pgOK;} // pgErr TaskSetHasChild(DmOpenRef dbP, UInt16 index, Boolean hasChild)/**************************************************************************** * Name : TaskGetHasChild * Desc : get the hasChild field of task * Parm :  * 			-> db to search * 			-> index of the record * Out  : hasChild field value * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/Boolean TaskGetHasChild(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskGetHasChild"));	return TaskGetAttr(dbP, index).hasChild;} // Boolean TaskGetHasChild(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetHasPrev * Desc : set the firstChild field of task * Parm :  * 			-> db to search * 			-> index of the record * 			-> value of hasPrev field * Out  :  * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/pgErr TaskSetHasPrev(DmOpenRef dbP, UInt16 index, Boolean hasPrev){	TaskAttrType attr;	DBGMSG((DBB, "TaskSetHasPrev"));	attr = TaskGetAttr(dbP, index);	attr.hasPrev = hasPrev;	TaskSetAttr(dbP, index, attr);	return pgOK;} // pgErr TaskSetHasPrev(DmOpenRef dbP, UInt16 index, Boolean hasPrev)/**************************************************************************** * Name : TaskGetHasPrev * Desc : get the firstChild field of task * Parm :  * 			-> db to search * 			-> index of the record * Out  : firstChild field value * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/Boolean TaskGetHasPrev(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskGetHasPrev"));	return TaskGetAttr(dbP, index).hasPrev;} // Boolean TaskGetHasPrev(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskGetHasNext * Desc : get the hasNext field of task * Parm :  * 			-> db to search * 			-> index of the record * Out  : hasNext field value * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/Boolean TaskGetHasNext(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskGetHasNext"));	return TaskGetAttr(dbP, index).hasNext;} // Boolean TaskGetHasNext(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskSetHasNext * Desc : set the hasNext field of task * Parm :  * 			-> db to search * 			-> index of the record * 			-> next field * Out  :  * Auth : lb, 28.07.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/pgErr TaskSetHasNext(DmOpenRef dbP, UInt16 index, Boolean next){	TaskAttrType attr;	DBGMSG((DBB, "TaskSetHasNext"));	attr = TaskGetAttr(dbP, index);	attr.hasNext = next;	TaskSetAttr(dbP, index, attr);	return pgOK;} // pgErr TaskSetHasNext(DmOpenRef dbP, UInt16 index, Boolean next)/**************************************************************************** * Name : TaskIsOpened * Desc : see if task is opened * Parm :  * 			-> db to search * 			-> index of the record * Out  :  * Auth : lb, 01.08.2000 * Mod  : lb, 22.08.2000 * 			new preferences scheme ***************************************************************************/Boolean TaskIsOpened(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskIsOpened"));	return TaskGetAttr(dbP, index).opened;} // Boolean TaskIsOpened(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskIsVisible * Desc : true if task is first level, or in an opened hierarchy * Parm :  * 			-> db to search * 			-> index of the record * Out  :  * Auth : lb, 02.08.2000 * Mod  : lb, 24.08.2000 * 			don't look beyond gRefLevel * 		  lb, 2001-09-06 * 		  	adapt to 0.23 db format ***************************************************************************/Boolean TaskIsVisible(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskIsVisible"));	// hide done tasks	if (gProjectPrefs.hideDoneTasks && (TaskGetCompleted(dbP, index) == 10))		return false;	while (TaskGetLevel(dbP, index) > gRefLevel + 1)	{		index = TaskGetFatherIndex(dbP, index);		if (!TaskIsOpened(dbP, index))			return false;	}	return true;} // Boolean TaskIsVisible(DmOpenRef dbP, UInt16 index)/**************************************************************************** * Name : TaskMakeVisible * Desc : open all this task's fathers * Parm :  * 			-> db to search * 			-> index of the record * Out  :  * Auth : lb, 19.10.2000 * Mod	: lb, 2001-09-06 * 		  	adapt to 0.23 db format ***************************************************************************/void TaskMakeVisible(DmOpenRef dbP, UInt16 index){	DBGMSG((DBB, "TaskMakeVisible"));	// hide done tasks on => nothing to do, the task is hidden	if (gProjectPrefs.hideDoneTasks && (TaskGetCompleted(dbP, index) == 10))		return;

⌨️ 快捷键说明

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