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

📄 .#progect.c.1.81

📁 个人日程管理系统
💻 81
📖 第 1 页 / 共 5 页
字号:
		Int16 length = titleLen;		Int16 len = length;		Int16 width = limit;		Boolean fitInWidth = false;		FntCharsInWidth(c, &width, &len, &fitInWidth);		if (fitInWidth)			WinDrawChars(c, length, x, y);		else		{			width = limit - FntCharsWidth("...", 3);			len = length;			fitInWidth = false;			FntCharsInWidth(c, &width, &len, &fitInWidth);						WinDrawChars(c, len, x, y);			WinDrawChars("...", 3, x + width, y);		}	}	else	{   // 0% nationalized. but best fit with many PalmOS versions.		Char *string = c;		UInt16 textWidth = 0;		Boolean trunc = false;				while (*c && *c != linefeedChr)		{			textWidth += FntCharWidth(*c);			if (textWidth > limit)			{				trunc = true;				break;			}			c++;		}		// now textwidth is in chars !!!		textWidth = (UInt16)(c - string);		WinDrawChars(string, textWidth, x, y);		if (trunc)			WinDrawChars("...", 3, 						 x + FntCharsWidth(string, textWidth), y);	}} // void DrawTruncText(Char *c, UInt16 x, UInt16 y, UInt16 limit)/**************************************************************************** * Name : ProjectDrawExtendedItemDesc * Desc : draw an item desription * Parm : * 			-> pointer to the item * 			-> x and y pos to draw * Out  : - * Auth : lb, 12.09.2000 ***************************************************************************/void ProjectDrawExtendedItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y){	UInt16 datePos = OSCaps.screenWidth;	UInt8 textPos = 0;	UInt16 limit;	Char* pDesc = NULL;	// draw note icon (if a note exist)	if (p->format.bits.hasNote)	{		datePos -= 8;		FntSetFont(symbolFont);		WinGlueDrawChar(symbolNote, datePos, y);		FntSetFont(stdFont);		datePos--;	}	// draw link-via icon	if (p->format.bits.hasLink)	{		MemHandle h = gIconHandle[BtmLinkMaster - BtmOffset];		BitmapPtr bitmap = (BitmapPtr)MemHandleLock(h);		datePos -= 8;		WinDrawBitmap(bitmap, datePos, y + 2);		MemHandleUnlock(h);		datePos--;	}	x += textPos;	limit = datePos - x - 7;	//	// draw attached icon	//	{		UInt16 iconid;		UInt16 size = sizeof(iconid);		if (pgOK == TaskGetExtraChunkByTaskPtr(p, Extra_Icon, 0,											   &iconid, &size) &&			size == sizeof(iconid) &&			iconid < getNumIconsLoaded() )		{			drawIcon(iconid, x, y);			x += getIconWidth(iconid) + 2;		}	}	// draw the description (truncated)	pDesc = TaskGetDescriptionByTaskPtr(p);	FntSetFont(stdFont);	// if it's a direct link, and the destination is not existing anymore,	// nothing to print.	if (pDesc)	{		DrawTruncText(pDesc, x, y, limit);		MemPtrFree(pDesc);	}} // void ProjectDrawExtendedItemDesc(TaskRecordType *p, UInt16 x, UInt16 y)/**************************************************************************** * Name : ProjectDrawItemDesc * Desc : draw an item desription * Parm : * 			-> pointer to the item * 			-> x and y pos to draw * Out  :   <- Number of lines drawn. * Auth : lb, 12.09.2000 * Mod  : hcc, 04.28.2001 * 		    Support word wrapping. Return number of lines wrapped. * 		  lb, 09.08.2001 * 		  	Fixed icon position bug ***************************************************************************/UInt8 ProjectDrawItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y, 	UInt8 lineLimit){	UInt16 datePos = OSCaps.screenWidth;	UInt8 textPos = 0;	UInt8 leftIndentText = 0;	UInt16 widthLimit;	RectangleType rectBounds;	UInt8 lines = 1;	TaskStandardFields *pf = StdFields(p);	Char *desc = NULL;	// draw note icon (if a note exist)	if (p->format.bits.hasNote)	{		datePos -= 8;		FntSetFont(symbolFont);		WinGlueDrawChar(symbolNote, datePos, y);		datePos--;	}	// draw link-via icon	if (p->format.bits.hasLink)	{		MemHandle h = gIconHandle[BtmLinkMaster - BtmOffset];		BitmapPtr bitmap = (BitmapPtr)MemHandleLock(h);		datePos -= 8;		WinDrawBitmap(bitmap, datePos, y + 2);		MemHandleUnlock(h);		datePos--;	}	// draw the due date	// if no date, don't try to print a date	// if DisplayDueDates if false, don't print the date (preference)	if (pf->dueDate.month != 0 && gProjectPrefs.displayDueDates)	{		FntSetFont(stdFont);		PrintDueDate(pf, &datePos, y);	}	//	// draw progresses	//	if (!((gProjectPrefs.hideDoneProgress && 		 (pf->completed == 10)) ||		 gProjectPrefs.hideProgress))	{		// draw progress item		if (p->format.bits.itemType == actionType)		{			if (OSCaps.ver32 || pf->completed == ACTION_NOT_DONE)			{				FntSetFont(symbol11Font);				WinGlueDrawChar( (pf->completed == ACTION_DONE) ? 					symbolCheckboxOn : symbolCheckboxOff, x - 3, y);				FntSetFont(stdFont);			}			else			{				// get ToDo link icon				MemHandle h = gIconHandle[BtmCheckedBox - BtmOffset];				BitmapPtr bitmap = (BitmapPtr)MemHandleLock(h);								// draw it				WinDrawBitmap(bitmap, x - 2, y);				MemHandleUnlock(h);			}		}		else if (p->format.bits.itemType == progressType)		{			// draw progress bar			RctSetRectangle(&rectBounds, x - 1, y + 4, 10, 3);			WinDrawRectangleFrame(simpleFrame, &rectBounds);			RctSetRectangle(&rectBounds, x - 1, y + 4, pf->completed, 3);			WinDrawRectangle(&rectBounds, 0);		}		else if (p->format.bits.itemType == numericType)		{			// draw progress bar			RctSetRectangle(&rectBounds, x - 1, y + 4, 10, 3);			WinDrawRectangleFrame(simpleFrame, &rectBounds);			RctSetRectangle(&rectBounds, x - 1, y + 4, pf->completed, 3);			WinDrawRectangle(&rectBounds, 0);		}		if (p->format.bits.itemType != informativeType)			textPos += 13;		if (gProjectPrefs.displayPriorities && pf->priority > 0 && 			pf->priority < NO_PRIORITY)		{			FntSetFont(stdFont);			WinGlueDrawChar('[', x + textPos, y);			FntSetFont(boldFont);			WinGlueDrawChar(pf->priority + '0', x + textPos + 3, y);			FntSetFont(stdFont);			WinGlueDrawChar(']', x + textPos + 10, y);			leftIndentText += 13;		}	}	// High priority task draw bold font.	//  I wish color to red.	FntSetFont(stdFont); // Initialy	if (pf->completed != 10) // don't hilight done task	{		if (pf->priority > 0 && pf->priority <= gProjectPrefs.boldMinPriority)			FntSetFont(boldFont);		else if (p->format.bits.hasDueDate && gProjectPrefs.boldMinDays != 0 &&			pf->dueDate.month != 0)		{			if (DateInLimit(pf->dueDate, gProjectPrefs.boldMinDays))			{//				static RGBColorType red = { 0, 0xff, 0, 0 };//				WinSetTextColor(WinRGBToIndex(&red));				FntSetFont(boldFont);			}		}	}	x += textPos;	//	// draw attached icon	//	{		UInt16 iconid;		UInt16 size = sizeof(iconid);		if (pgOK == TaskGetExtraChunkByTaskPtr((TaskExtendedRecordType*)p,											   Extra_Icon, 0,											   &iconid, &size) &&			size == sizeof(iconid) &&			iconid < getNumIconsLoaded() )		{			drawIcon(iconid, x + leftIndentText, y + 6 - getIconHeight(iconid) / 2);			leftIndentText += getIconWidth(iconid) + 2;		}	}	// draw the description (truncated)	widthLimit = OSCaps.screenWidth - x; //datePos - x; // - 7;	// HCC: Word-wrapping support added here	// DrawTruncText(&p->description, x, y, limit);//	lines = DrawWrappedText(&pf->description, x, y, lineLimit, //		widthLimit, leftIndentText, OSCaps.screenWidth - datePos,//		gProjectPrefs.strikeDoneTasks &&//		(pf->completed == 10));	desc = TaskGetDescriptionByTaskPtr(p);	lines = DrawWrappedText(desc , x, y, lineLimit, 		widthLimit, leftIndentText, OSCaps.screenWidth - datePos,		gProjectPrefs.strikeDoneTasks &&		(pf->completed == 10));	MemPtrFree(desc);// Strikethrough is Now handled by DrawWrappedText#if 0	// strike out done tasks	//  but, I needs gray color or gray pattern ...	if (gProjectPrefs.strikeDoneTasks &&		(p->completed == 10 || p->completed == ACTION_OK) )	{		WinDrawLine(x, y + 6, x + widthLimit, y + 6);	}#endif		// resume to default. (to safety)	FntSetFont(stdFont);	return (lines);} // UInt8 ProjectDrawItemDesc(TaskExtendedRecordType *p, UInt16 x, UInt16 y,   // UInt8 lineLimit)/**************************************************************************** * Name : DrawItemTreeLines * Desc : Draw the tree line icons for one line of this node. * Parm : *          -> pointer to task *          -> row: The table row being drawn. *          -> x: start x pos for drawing (currently unused; must be zero) *          -> y: The y position to draw this row of lines *          -> lineNum: For multi-line tasks, which line to draw, start at 0. * Out  :   <- The amount of horizontal space used (pixels). * Auth : hcc, 04.28.2001 *          (extracted from lb's code in ProjectItemDraw) * Mod  : hcc, 05.05.2001 *          Do wrapped lines. Handle line drawing disabled mode. ***************************************************************************/UInt16 DrawItemTreeLines(TaskRecordType *p, UInt16 row,						 UInt16 x, UInt16 y, UInt8 lineNum){	UInt8 level;	UInt8 i;	BitmapPtr bitmap;	UInt16 bitmapId = 0;	MemHandle h;	UInt8 shiftX = 0; // Optionally shift icon horizontally (pixels)	// get its level	level = gCurrentPrefs.view == flatView ? 1 : (p->attr.bits.level);	// one bitmap per level of the task	for (i = gRefLevel + 1; i <= level; i++)	{		shiftX = 0;		if(gProjectPrefs.drawTreeLines)		{			// choose the good icon (final icon)			if (i == level)			{				if(lineNum == 0)				{					if (p->attr.bits.hasChild)						bitmapId =							(p->attr.bits.opened)? BtmMinusAlone: BtmPlusAlone;										else // has no children.					{						if (p->attr.bits.hasPrev)							bitmapId =								(p->attr.bits.hasNext) ?								BtmItemMiddle : BtmItemBottom;						else 							bitmapId = 								(p->attr.bits.hasNext) ? 								BtmItemFirst : BtmItemAlone;					}				}				else // wrapped line				{					if (p->attr.bits.hasChild && p->attr.bits.opened)						bitmapId =							(p->attr.bits.hasNext) ?							BtmItemChildNextWrapped : BtmItemChildWrapped;					else						bitmapId =							(p->attr.bits.hasNext) ? BtmItemNo : BtmNull;				}			}			else			{				if (!(p->attr.bits.hasPrev) && i == level - 1 && lineNum == 0)					bitmapId = (wVerticalLines[row] & (1 << (i - 1))) ? 						BtmItemChild : BtmItemChildNo;				// if there is a bitmap to draw				// init bitmapId to BtmNull if prev of level i has no next				else 					bitmapId = (wVerticalLines[row] & (1 << (i - 1))) ?						BtmItemNo: BtmNull;			}		}		else // Tree lines are off		{			if (i == level && lineNum == 0)			{				if (p->attr.bits.hasChild) // Draw + or - icon					bitmapId =						(p->attr.bits.opened)? BtmMinusAlone: BtmPlusAlone;				else // Just draw a bullet.					bitmapId = BtmItemAloneNoLine;			}		}		if (bitmapId != BtmNull)		{			// ok, draw this icon			// retreive the good bitmap			h = gIconHandle[bitmapId - BtmOffset];			bitmap = (BitmapPtr)MemHandleLock(h);			// draw it			WinDrawBitmap(bitmap, (i - 1 - gRefLevel) * 11, y);			MemHandleUnlock(h);			// indicate ToDo Linking			// TODO : test code under 3.5			if (i == level && p->format.bits.hasToDo)			{				if (! OSCaps.ver35)				{					WinDrawLine((i - 1 - gRefLevel) * 11 + 8, y+5, 						(i - 1 - gRefLevel) * 11 + 8, y+5);				}				else				{					WinDrawPixel((i - 1 - gRefLevel) * 11 + 8, y+5);				}			}		}	}	// time optimizations	// TODO : recalc these	x = (level - gRefLevel) * 11 + 2;	return(x);}/**************************************************************************** * Name : ProjectItemDraw * Desc : callback to draw the project table * In   : not called by the user, it's a callback * Out  : - * Auth : lb, 31.07.2000 * Mod  : lb, 06.08.2000 * 		  	support for date right aligning * 		  lb, 29.01.2001 * 		  	fill node when ToDo Link is active *        hcc, 05.05.2001 *          Move line & icon code to new DrawItemTreeLines(). *          Implement word wrapping option. ***************************************************************************/void ProjectItemDraw(MemPtr table, UInt16 row, UInt16 column, RectanglePtr bounds){	BitmapPtr bitmap;	MemHandle h, taskH;	UInt16 id, x = 0;	UInt16 y = bounds->topLeft.y; //HCC: was: row*11 + 15;	TaskExtendedRecordType *p;	FormType *frm;	RectangleType rectBounds;	UInt8 lines = 1;	// If this row exceeds the vertical bounds of the table, bail	if(y > gProjectTableMaxY - 11)	{		TblSetRowHeight(table, row, 0);		return;	}	id = TblGetItemInt(table, row, column);	frm = FrmGetActiveForm();	// erase the row	RctSetRectangle(&rectBounds, 0, y, OSCaps.screenWidth, 11);	WinEraseRectangle(&rectBounds, 0);	// don't do anything more if id is -1	if (id == -1)	{		// Row height may have been left higher from previous update. Set it		// back down so that all remaining rows will be erased.		TblSetRowHeight(table, row, 11);		return;	}	// get the task	taskH = DmQueryRecord(gdbP, id);	p = MemHandleLock(taskH);#if 0	// HCC: Debug	DmRecordInfo(gdbP, id, NULL, &uniqueID, NULL);	DBGMSG((DBB, "Row:%d Lvl:%d Idx:%d Uid:%ld, bounds y=%d, h=%d\n",			row, TaskGetLevel(gdbP, id), id, uniqueID,			bounds->topLeft.y, bounds->extent.y));#endif	if (gCurrentPrefs.view == flatView)	{		// extended task can't link to ToDo. because it's buggy.		if (p->format.bits.itemType != extendedType)		{			// get ToDo link icon

⌨️ 快捷键说明

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