Index: ChangeLog =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.9 diff -u -r1.1.1.1 -r1.9 --- ChangeLog 31 Jan 2002 17:23:35 -0000 1.1.1.1 +++ ChangeLog 15 Apr 2002 08:45:18 -0000 1.9 @@ -1,3 +1,57 @@ +2002-04-15 IKEDA Shigeru + + * diddlebug.rcp.in: removed NeedVersionXXError + +2002-04-05 IKEDA Shigeru + + * diddlebug.c: Added FrmCloseAllForms() to StopApplication() to + remedy memory leaks. + SetScreenMode() and RestoreScreenMode() when sysAppLaunchCmdGoTo + Release plug-in list handle allocated by + SysCreateDataBaseList() in InitXferList() in xfer.c. + Fixed memory leak in LabelHardwareSelTrig(). + +2002-03-31 IKEDA Shigeru + + * diddlebug.rcp.in: 2nd parameter of CategoryInitialize() should + be `tAIS'. + + * diddlebug.c: removed rom version check for OS3.5 or later. + exchange the calls to WinGetWindowPointer() with new GetWindowBuffer(). + 2nd parameter of CategoryInitialize() should be `tAIS'. + + * util.h: GetWindowBuffer prototype. + + * util.c: new utility function GetWindowBuffer() for OS3.5 or later + compatibility. + +2002-03-28 Roger Sondermann + + * version 2.18 + + * Changed Shigeru's ROM version check to allow OSs < OS 4.2 + When it compiles with SDK 4, why should it not run on OS 4x? + +2002-02-23 IKEDA Shigeru + + * version 2.17 + + * Makefile: added gccfix.* to fix memory leak on exit. + +2002-02-01 IKEDA Shigeru + + * version 2.16 + + * diddlebug.c: fixed memory overwrite bug. + Made screen mode to always 1bpp. + Added ROM version check. + Compatibity with SDK4.0 + Don't drag date & time when the sketch is locked. + + * util.c: SetScreenMode() and RestoreScreenMode() + + * Makefile: version number. compiler flag + DiddleBug (2.15) * Fixed bug where some sketch data could be lost if alarm sounded Index: Makefile =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.9 diff -u -r1.1.1.1 -r1.9 --- Makefile 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ Makefile 5 Apr 2002 04:22:52 -0000 1.9 @@ -1,13 +1,13 @@ # http://homepages.enterprise.net/jmarshall/palmos/build-prct.html -VERSION=2.15 +VERSION=2.19a2 MAKE = make -XOBJS = diddlebug.o shape.o xfer.o util.o -XCC = m68k-palmos-coff-gcc -XCFLAGS = -O2 #-DDIDDLEDEBUG +XOBJS = diddlebug.o shape.o xfer.o util.o gccfix.o +XCC = m68k-palmos-gcc -g -pipe +XCFLAGS = -O2 -DERROR_CHECK_LEVEL=ERROR_CHECK_PARTIAL #-DDIDDLEDEBUG PILRC = pilrc TXT2BITM = txt2bitm -OBJRES = m68k-palmos-coff-obj-res +OBJRES = m68k-palmos-obj-res MULTILINK = multilink BUILDPRC = build-prc ICONTEXT = DiddleBug @@ -53,7 +53,7 @@ .ts-bin.ts-prc: # cp rloc-with-3 rloc0000.diddlebug.grc -# m68k-palmos-coff-objcopy -O binary -R .text -R .data -R .bss diddlebug code0002.diddlebug.grc +# m68k-palmos-objcopy -O binary -R .text -R .data -R .bss diddlebug code0002.diddlebug.grc $(BUILDPRC) diddlebug-$*.prc $(ICONTEXT) $(APPID) code0001.diddlebug.grc code0000.diddlebug.grc data0000.diddlebug.grc *.bin pref000?.diddlebug.grc touch $*.ts-prc @@ -126,7 +126,7 @@ generic.ts-dep: diddlebug.rcp.in menu_shortcuts.h.in diddlebug.h diddlebug.c shape.c tododb.c datedb.c xfer.c xfer.h tododb.h datedb.h diddlebugRsc.h touch $@ -diddlebug.o: generic.ts-dep diddlebug.c diddlebug.h diddlebugRsc.h util.h menu_shortcuts.h.in +diddlebug.o: generic.ts-dep diddlebug.c diddlebug.h diddlebugRsc.h util.h menu_shortcuts.h.in gccfix.h $(XCC) $(XCFLAGS) -c diddlebug.c shape.o: generic.ts-dep shape.c diddlebug.h diddlebugRsc.h @@ -137,6 +137,9 @@ xfer.o: generic.ts-dep xfer.c xfer.h $(XCC) $(XCFLAGS) -c xfer.c + +gccfix.o: gccfix.c gccfix.h + $(XCC) $(XCFLAGS) -c gccfix.c multidef.o: multidef.s $(XCC) -c multidef.s Index: booger.h =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/booger.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- booger.h 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ booger.h 31 Jan 2002 17:39:32 -0000 1.2 @@ -2,7 +2,7 @@ #define __BOOGER_H_ /* booger.h version 'a' */ -#include +#include /* Launch command to activate a booger plugin */ #define boogerPlugLaunchCmdBlowNose 0x9101 Index: diddlebug.c =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/diddlebug.c,v retrieving revision 1.1.1.1 retrieving revision 1.7 diff -u -r1.1.1.1 -r1.7 --- diddlebug.c 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ diddlebug.c 5 Apr 2002 11:51:13 -0000 1.7 @@ -14,7 +14,6 @@ #include "callback.h" #include "util.h" #include "xfer.h" -#include /* shape.c */ extern void ClearOldShape(void); @@ -412,7 +411,7 @@ /* ptr is locked on return */ sketchSize = 0; ptr = CompressSketch(&sketchSize, - WinGetWindowPointer(d.winbufM)->displayAddr); + GetWindowBuffer(d.winbufM)); /* Set the sketchSize */ d.record.sketchLength = sketchSize; @@ -506,7 +505,7 @@ /* Read the header data */ MemMove(&d.record, ptr, sizeof(DiddleBugRecordType)); sketchPtr = ptr+sketchDataOffset+sketchThumbnailSize+1; - bufPtr = WinGetWindowPointer(d.winbufM)->displayAddr; + bufPtr = GetWindowBuffer(d.winbufM); /* Uncompress to the offscreen window */ UncompressSketch(sketchPtr, bufPtr, @@ -1390,7 +1389,7 @@ /* ** ScrollXferField */ -static void ScrollXferField(DirectionType direction) { +static void ScrollXferField(WinDirectionType direction) { FormPtr frm; FieldPtr fld; @@ -1413,11 +1412,11 @@ if (d.is_xfer_mode) { switch (chr) { case pageUpChr: - ScrollXferField(up); + ScrollXferField(winUp); return true; break; case pageDownChr: - ScrollXferField(down); + ScrollXferField(winDown); return true; break; } @@ -1539,7 +1538,7 @@ if (!rH) abort(); someptr = MemHandleLock(rH); RctSetRectangle(&somerect, 0, 0, 20, 20); - MemMove(WinGetWindowPointer(someH)->displayAddr, + MemMove(GetWindowBuffer(someH), someptr+sketchDataOffset, sketchThumbnailSize); WinCopyRectangle(someH, d.winM, &somerect, 0, p.r.topLeft.y, scrCopy); @@ -2473,9 +2472,8 @@ static void LabelHardwareSelTrig(void) { FormPtr frm; ControlPtr ctl; - Char str[64]; + static Char str[64]; Char appname[32]; - CharPtr newlabel; UInt cardNo; LocalID dbID; DmSearchStateType searchstate; @@ -2509,10 +2507,7 @@ str[63] = nullChr; /* Label the selection trigger */ - h = MemHandleNew(64); - newlabel = MemHandleLock(h); - StrNCopy(newlabel, str, 63); - CtlSetLabel(ctl, newlabel); + CtlSetLabel(ctl, str); } /* @@ -2617,7 +2612,7 @@ SysKeyboardDialog(kbdAlpha); break; case menuitemID_XferGHelp: - SysGraffitiReferenceDialog(referenceAlpha); + SysGraffitiReferenceDialog(referenceDefault); break; } @@ -2844,7 +2839,7 @@ do { EvtGetPen(&x, &y, &penDown); - if (y < 147) { + if (y < 147 && !recordIsLocked) { eDate.screenX = x; eDate.screenY = y; old_drawmode = d.drawmode; d.drawmode = MODE_TEXT; d.txt_oldfont = FntSetFont(p.txt_font); @@ -3538,12 +3533,12 @@ if (appIsActive && (dbI == p.dbI) && ((d.formID == DiddleForm)||(d.formID == DiddleTForm))) { record.flags |= RECORD_FLAG_BUFDIRTY; - MemMove(WinGetWindowPointer(winH)->displayAddr, - WinGetWindowPointer(d.winbufM)->displayAddr, 3200); + MemMove(GetWindowBuffer(winH), + GetWindowBuffer(d.winbufM), 3200); } else { bitDepth = GetBitDepth(); - iPtr = WinGetWindowPointer(winH)->displayAddr; + iPtr = GetWindowBuffer(winH); jPtr = iPtr+((bitDepth-1)*3200); UncompressSketch(ptr+sketchDataOffset+sketchThumbnailSize+1, jPtr, record.sketchLength-sketchThumbnailSize-1); @@ -3768,7 +3763,7 @@ /* Read the old alarm data */ MemMove(&alarm, ptr+3200, sizeof(DeprecatedAlarmType)); /* Copy the old sketch data to the buffer */ - winPtr = WinGetWindowPointer(d.winbufM)->displayAddr; + winPtr = GetWindowBuffer(d.winbufM); MemMove(winPtr, ptr, 3200); /* Close the old record */ MemHandleUnlock(t); @@ -3871,7 +3866,7 @@ &appInfoID, NULL, NULL, NULL); appInfoP = MemLocalIDToLockedPtr(appInfoID, 0); DmSet(appInfoP, 0, sizeof(AppInfoType), 0); - CategoryInitialize(appInfoP, CatUnfiledString); + CategoryInitialize(appInfoP, localizedAppInfoString); MemPtrUnlock(appInfoP); SysCopyStringResource(catName, CatUnfiledString); CategorySetName(d.dbR, 0, catName); @@ -4055,7 +4050,12 @@ */ static void StopApplication(void) { PrefSetAppPreferences(AppType, 0, 1, &p, sizeof(p), true); + FrmCloseAllForms(); WinDeleteWindow(d.winbufM, false); + if (d.xfer.pluglistH != NULL) + MemHandleFree(d.xfer.pluglistH); + if (d.papplist != NULL) + MemHandleFree(d.papplist); CloseDatabases(); } @@ -4094,7 +4094,7 @@ exgSock.name = MemPtrNew(StrLen(tempString)+1); StrCopy(exgSock.name, tempString); SysCopyStringResource(tempString, BeamTypeString); - exgSock.description = MemPtrNew(StrLen(tempString+1)); + exgSock.description = MemPtrNew(StrLen(tempString)+1); StrCopy(exgSock.description, tempString); /* Open the record */ @@ -4206,13 +4206,19 @@ Err err; GoToParamsPtr pgoto; Boolean appIsActive; + UInt32 depth; switch (cmd) { case sysAppLaunchCmdNormalLaunch: - if(err = OpenDatabases()) return err; + SetScreenMode(&depth); + if(err = OpenDatabases()) { + RestoreScreenMode(depth); + return err; + } FrmGotoForm(p.formID); EventLoop(); StopApplication(); + RestoreScreenMode(depth); break; case sysAppLaunchCmdAlarmTriggered: @@ -4221,8 +4227,10 @@ break; case sysAppLaunchCmdDisplayAlarm: + SetScreenMode(&depth); appIsActive = launchFlags&sysAppLaunchFlagSubCall; DisplayAlarm((SysDisplayAlarmParamType*)cmdPBP, appIsActive); + RestoreScreenMode(depth); break; case sysAppLaunchCmdSystemReset: @@ -4231,7 +4239,11 @@ case sysAppLaunchCmdGoTo: if (launchFlags&sysAppLaunchFlagNewGlobals) { - if(err = OpenDatabases()) return err; + SetScreenMode(&depth); + if(err = OpenDatabases()) { + RestoreScreenMode(depth); + return err; + } p.dbI = ((GoToParamsPtr)cmdPBP)->recordNum; if ((p.dbI < 0) || (p.dbI >= DmNumRecords(d.dbR))) { StopApplication(); Index: diddlebug.h =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/diddlebug.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- diddlebug.h 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ diddlebug.h 31 Jan 2002 17:39:33 -0000 1.2 @@ -3,8 +3,9 @@ #include "diddlebugRsc.h" #include "menu_shortcuts.h" +#include #include "booger.h" -#include +#include #include #include Index: diddlebug.rcp.in =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/diddlebug.rcp.in,v retrieving revision 1.1.1.1 retrieving revision 1.8 diff -u -r1.1.1.1 -r1.8 --- diddlebug.rcp.in 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ diddlebug.rcp.in 15 Apr 2002 08:45:19 -0000 1.8 @@ -25,6 +25,7 @@ STRING ID CatUnfiledString "Unfiled" STRING ID CatBusinessString "Business" STRING ID CatPersonalString "Personal" +CATEGORIES ID localizedAppInfoString "Unfiled" "" "" "" "" "" "" "" "" "" "" "" "" "" "" STRING ID SunString "Sun" STRING ID MonString "Mon" @@ -42,8 +43,8 @@ STRING ID NoCountdownString "No CountDown Set" STRING ID NoAlarmString "No Alarm Set" STRING ID OffString "OFF" -STRING ID AbsoluteString "Absolute..." -STRING ID CustomString "Custom..." +STRING ID AbsoluteString "Absolute\030" +STRING ID CustomString "Custom\030" STRING ID MinString " min" STRING ID MinsString " mins" STRING ID HourString " hr" @@ -62,7 +63,7 @@ STRING ID XferCompletedString "Completed" STRING ID XferBackLinkString "Back Link" STRING ID XferNoTextString "No text entered" -STRING ID XferSavingString "Saving..." +STRING ID XferSavingString "Saving\030" STRING ID NoUndoString "Nothing to Undo" STRING ID BeamTypeString "DiddleBug Sketch" @@ -291,11 +292,14 @@ END ALERT ID AboutForm +HELPID AboutHelp BEGIN TITLE "About DiddleBug VERSION_STAMP" MESSAGE "Copyright (c) 1999\nMitch Blevins\nmblevin@debian.org\nGNU GPL\nhttp://gnu.org/copyleft/gpl.html\n\nBased on Doodle by:\nRoger E Critchlow Jr\nrec@elf.org" BUTTONS "Thanks Roger" END + +STRING ID AboutHelp "VERSION_STAMP by IKEDA Shigeru \n\nhttp://www.geocities.com/chitianzi/diddlebug.html" ALERT ID ConfirmDeleteForm CONFIRMATION Index: diddlebugRsc.h =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/diddlebugRsc.h,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- diddlebugRsc.h 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ diddlebugRsc.h 31 Mar 2002 05:31:50 -0000 1.4 @@ -112,6 +112,7 @@ #define NoUndoString 5656 #define BeamTypeString 5657 #define BeamContentString 5658 +#define localizedAppInfoString 5659 // These four should stay in consecutive order #define XferMenuOptionsStrings 5700 @@ -147,6 +148,7 @@ #define LockAskForm 8500 #define AlarmSetError 8600 #define NeedVersion2Error 8700 +#define NeedVersionXXError 8701 #define NoPluginSelected 8750 #define NoPluginInstalled 8751 #define PluginError 8752 @@ -154,6 +156,7 @@ #define AlarmTimeTooEarly 8754 #define NoBeamForm 8755 #define AboutForm 8800 +#define AboutHelp 8801 #define TextForm 9100 #define TextField 9101 #define TextModePop 9102 Index: linker.h =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/linker.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- linker.h 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ linker.h 31 Jan 2002 17:39:33 -0000 1.2 @@ -2,7 +2,7 @@ #ifndef __LINKER_H_ #define __LINKER_H_ -#include +#include /*Note: you don't have to "send" the SysAppLaunch command specifically to Linker. Index: util.c =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/util.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- util.c 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ util.c 31 Mar 2002 03:35:54 -0000 1.3 @@ -55,3 +55,47 @@ SysTaskDelay(SysTicksPerSecond()/2); UnFlashMessage(flshP); } + +void SetScreenMode(UInt32 *depth) { + Err err; + + err = FtrGet(sysFtrCreator, sysFtrNumDisplayDepth, depth); + ErrFatalDisplayIf(err, "Can't get display depth"); + + if (*depth != 1) { + err = FtrSet(sysFtrCreator, sysFtrNumDisplayDepth, 1); + ErrFatalDisplayIf(err, "Can't set display depth"); + + if (!err) { + err = ScrDisplayMode(scrDisplayModeSetToDefaults, + NULL, NULL, NULL, NULL); + ErrFatalDisplayIf(err, "Can't set screen mode"); + } + } +} + +void RestoreScreenMode(UInt32 depth) { + Err err; + + err = FtrSet(sysFtrCreator, sysFtrNumDisplayDepth, depth); + ErrFatalDisplayIf(err, "Can't restore display depth"); + + if (!err) { + err = ScrDisplayMode(scrDisplayModeSetToDefaults, NULL, NULL, NULL, NULL); + ErrFatalDisplayIf(err, "Can't restore screen mode"); + } +} + +void *GetWindowBuffer(WinHandle winHandle) { + UInt32 romversion; + void *ptr; + + FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romversion); + if (romversion < sysMakeROMVersion(3,5,0,sysROMStageRelease,0)) { + ptr = WinGetWindowPointer(winHandle)->displayAddr; + } + else { + ptr = BmpGetBits(WinGetBitmap(winHandle)); + } + return ptr; +} Index: util.h =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/util.h,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- util.h 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ util.h 31 Mar 2002 03:35:54 -0000 1.3 @@ -5,4 +5,9 @@ extern void UnFlashMessage(FlashMessagePtr flashP); extern void FlashWaitMessage(UInt strID); +void SetScreenMode(UInt32 *depth); +void RestoreScreenMode(UInt32 depth); + +void *GetWindowBuffer(WinHandle winHandle); + #endif // __UTIL_H_ Index: xfer.c =================================================================== RCS file: /var/users/js3guj/cvs/js3guj/diddlebug/xfer.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- xfer.c 31 Jan 2002 17:23:36 -0000 1.1.1.1 +++ xfer.c 31 Mar 2002 03:35:54 -0000 1.2 @@ -537,7 +537,7 @@ /* Load the sketch data */ if (kleenex.version&IBVERSION_PICTURE) { - kleenex.data = WinGetWindowPointer(d.winbufM)->displayAddr; + kleenex.data = GetWindowBuffer(d.winbufM); kleenex.data_size = 3200; }