Index: bigclock/.cvsignore
diff -u /dev/null bigclock/.cvsignore:1.3
--- /dev/null	Mon Apr 10 20:07:43 2006
+++ bigclock/.cvsignore	Fri Feb 10 16:23:25 2006
@@ -0,0 +1,9 @@
+*.bin
+*.ld
+*.res
+*.s
+*.prc
+bigclock
+bigclock-en
+bigclock-ja
+*.stamp
Index: bigclock/Copyright
diff -u /dev/null bigclock/Copyright:1.4
--- /dev/null	Mon Apr 10 20:07:43 2006
+++ bigclock/Copyright	Sun Mar 19 23:13:33 2006
@@ -0,0 +1,32 @@
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+Copyright (C) 1998-2001 Jens Rupp <jens@gacel.de>.
+http://www.bigclock.de/
+
+Copyright (C) 1999 Tetsuji Yoshikawa <egom@m4.cty-net.ne.jp>
+Japanese translation
+http://hp.vector.co.jp/authors/VA018397/
+
+Copyright (C) 2002 Ling Nero <rnlnero@yahoo.com>.
+Modified to not mess up Clie hi-res screens after alarm triggered,
+by using WinSaveBits and WinRestoreBits instead of WinCopyRectangle.
+http://www.geocities.com/rnlnero/Palmos.html#BigClock
+
+Copyright (C) 2002, 2003 Free Software Foundation.
+This application uses FreeSans font on the HiRes mode.
+http://savannah.nongnu.org/download/freefont/
+
+Copyright (C) 2006 Yoshizumi Endo <y-endo@ceres.dti.ne.jp>.
+Added some Japanese translations and HiRes mode support.
Index: bigclock/Makefile
diff -u bigclock/Makefile:1.1.1.1 bigclock/Makefile:1.10
--- bigclock/Makefile:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/Makefile	Sun Mar 26 02:47:51 2006
@@ -1,30 +1,36 @@
 CC = m68k-palmos-gcc
-CFLAGS = -O2 -c -Wall
+
+#DEFINES = -Ddebug
+CFLAGS = -O2 -c -Wall -palmos5r4 $(DEFINES)
+LIBS = -lPalmOSGlue
 
 AS = m68k-palmos-gcc
 ASFLAGS = -c
 
+bigclock-ja.prc: bin-ja.stamp bigclock
+	build-prc bigclock.def bigclock *.bin -o bigclock-ja.prc
+bigclock-en.prc: bin-en.stamp bigclock
+	build-prc bigclock.def bigclock *.bin -o bigclock-en.prc
 
-bigclock.prc: bin.stamp bigclock
-	build-prc bigclock.def bigclock *.bin
-
+all: bigclock-ja.prc bigclock-en.prc
 
-bigclock: bigclock.o draw.o gccfix.o bigclock-sections.o bigclock-sections.ld
+bigclock: bigclock.o draw.o alarm.o gccfix.o bigclock-sections.o bigclock-sections.ld
+	$(CC) $+ $(LIBS) -o bigclock
 
 bigclock.o: bigclock.c util.c fire.c option.c bigclocktypes.h
 draw.o: draw.c bigclocktypes.h
 gccfix.o: gccfix.c gccfix.h
 
 bigclock-sections.o: bigclock-sections.s
-
 bigclock-sections.s bigclock-sections.ld: bigclock.def
-	multigen bigclock.def
-
-bin.stamp: bigclock.rcp
-	pilrc -L english bigclock.rcp
-
-
+	m68k-palmos-multigen bigclock.def
 
+bin-ja.stamp: bigclock.rcp ja.rcp
+	pilrc -L JAPANESE -Fj -D LABELFONT=0 bigclock.rcp
+	touch bin-ja.stamp
+bin-en.stamp: bigclock.rcp
+	pilrc -L ENGLISH -D LABELFONT=2 bigclock.rcp
+	touch bin-en.stamp
 
 clean:
-	rm -f *.o *-sections.* *.prc bigclock
+	rm -f *.o *-sections.* *.prc *.bin bigclock *.stamp
Index: bigclock/Readme
diff -u bigclock/Readme:1.1.1.1 bigclock/Readme:removed
--- bigclock/Readme:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/Readme	Mon Apr 10 20:07:43 2006
@@ -1,5 +0,0 @@
-Original source archive is bigclock_sorce-2.83.zip.
-This archives is added some miscellaneous modifications
-(some file names, line feed codes, new directory "bitmaps").
-
-2006/02/06 Yoshizumi Endo <y-endo@ceres.dti.ne.jp>
Index: bigclock/alarm.c
diff -u /dev/null bigclock/alarm.c:1.7
--- /dev/null	Mon Apr 10 20:07:43 2006
+++ bigclock/alarm.c	Wed Mar 29 03:58:15 2006
@@ -0,0 +1,235 @@
+#include <PalmOS.h>
+#include <PalmCompatibility.h>
+#include "bigclock.h"
+#include "bigclocktypes.h"
+
+Boolean AttentionBottleNeckProc(AttnLaunchCodeArgsType *paramP);
+int DrawAlarm(UInt32 uniqueID, AttnCommandArgsType *paramsPtr, 
+	      Boolean drawDetail);
+void DeleteAttention (UInt32 uniqueID, Boolean goThere);
+void PlayMidiSound(UInt recordNo, Boolean ignoresystemsoundoff);
+
+extern DmOpenRef OpenAlarm();
+extern Boolean ReadAlarm(DmOpenRef BCdb,int num,BigClockAlarm *target);
+extern void CloseAlarm(DmOpenRef BCdb);
+extern void PlayAlarmSound(BigClockSound *sound, Boolean ignoresystemsoundoff);
+
+Boolean AttentionBottleNeckProc(AttnLaunchCodeArgsType *paramP)
+{
+
+  AttnCommandArgsType * argsP = paramP->commandArgsP;
+
+  switch (paramP->command) 
+    {
+    case kAttnCommandDrawDetail:
+      DrawAlarm(paramP->userData, paramP->commandArgsP, true);
+      break;			
+      
+    case kAttnCommandDrawList:
+      DrawAlarm(paramP->userData, paramP->commandArgsP, false);
+      break;
+      
+    case kAttnCommandPlaySound:
+      {
+	BigClockAlarm *alarm;
+	DmOpenRef BCdb;
+
+	alarm=MemPtrNew(sizeof(BigClockAlarm));
+	BCdb=OpenAlarm();
+	ReadAlarm(BCdb, paramP->userData, alarm);
+	CloseAlarm(BCdb);
+
+	PlayAlarmSound(&alarm->sound, alarm->options.ignoresystemsoundoff);
+	MemPtrFree(alarm);
+      }
+      break;		
+						
+    case kAttnCommandGotIt:
+      {
+	if (argsP->gotIt.dismissedByUser)
+	  DeleteAttention(paramP->userData, false);
+      }
+      break;			
+      
+    case kAttnCommandGoThere:
+      DeleteAttention(paramP->userData, true);
+      break;	 
+      
+    case kAttnCommandIterate:
+      break;	
+    }
+  
+  return true;
+}
+
+
+int DrawAlarm(UInt32 uniqueID, AttnCommandArgsType *paramsPtr, Boolean isDetail)
+{
+  MemHandle	resH;
+  Int16         x=0;
+  Int16         y=0;
+  Int16         curFont, iconOffset, width;
+  BitmapPtr     iconP;
+
+  DateTimeType  time;
+  //DateTimeType  today;
+
+  BigClockAlarm *alarm;
+  DmOpenRef     BCdb;
+  SystemPreferencesType *lSysPref;
+  int           result=0;
+
+  char          alertString[20];
+  char          tmp[30];
+  Boolean       isWorld=1;
+
+  // read preferences
+  lSysPref=MemPtrNew(sizeof(SystemPreferencesType));
+  if (lSysPref==NULL) return result;
+  PrefGetPreferences(lSysPref);
+
+  //read alarm data
+  alarm=MemPtrNew(sizeof(BigClockAlarm));
+  if (alarm==NULL) return result;
+  BCdb=OpenAlarm();
+  ReadAlarm(BCdb, uniqueID, alarm);
+  CloseAlarm(BCdb);
+
+  // format alarmtime
+  time=alarm->time;
+  TimeToAscii(time.hour, time.minute, 
+	      lSysPref->timeFormat, alertString);
+
+  /*
+  TimSecondsToDateTime (TimGetSeconds(), &today);
+
+  if ( (today.day == time.day) && (today.month == time.month) 
+       && (today.year == time.year))
+  {
+    StrCopy(dateStr, "¡“ú");
+  }
+  else
+  {
+    DateToAscii(time.month, time.day, time.year, lSysPref->dateFormat, dateStr);
+  }
+
+  StrCat(alertString, " ");
+  StrCat(alertString, dateStr);
+  */
+
+  // check timezone
+  SysCopyStringResource(tmp, stringID_localtime);
+  if ((StrCompare(alarm->worldname, tmp) == 0) || 
+      (StrCompare(alarm->worldname, "") == 0))
+    isWorld=0;
+
+  // Draw the icon 
+  x = paramsPtr->drawDetail.bounds.topLeft.x; 
+  y = paramsPtr->drawDetail.bounds.topLeft.y; 
+
+  if (isDetail) {
+    resH = DmGetResource(bitmapRsc, bitmapID_icon); 
+
+    WinDrawBitmap(MemHandleLock(resH), x, y + 4); 
+  } else {
+    resH = DmGetResource(bitmapRsc, bitmapID_smallicon); 
+    iconP = (BitmapPtr)(MemHandleLock(resH)); 
+    BmpGetDimensions(iconP, &width, NULL, NULL);
+    iconOffset = (kAttnListMaxIconWidth - width)/2; 
+
+    WinDrawBitmap(iconP, x + iconOffset, y);	 
+  }
+
+  MemHandleUnlock(resH); 
+  DmReleaseResource(resH); 
+
+  // Draw the text
+  if (isDetail) {
+    curFont = FntSetFont (largeBoldFont); 
+    x=+37;
+    y=y+4;
+
+    StrCopy(tmp, "BigClock");
+    WinDrawChars(tmp, StrLen(tmp), x, y); 
+    WinDrawChars(alertString, StrLen(alertString), x, y+20); 
+    WinDrawChars(alarm->worldname,StrLen(alarm->worldname),x, y+40);
+    WinDrawChars(alarm->name, StrLen(alarm->name), x, y+60); 
+    FntSetFont(curFont); 
+  } else {
+    curFont = FntSetFont(stdFont); 
+
+    if (isWorld)
+      StrPrintF(tmp, "%s (%s)", alertString, alarm->worldname);
+    else
+      StrCopy(tmp, alertString);
+
+    WinDrawTruncChars(tmp, StrLen(tmp), 
+		 x + kAttnListTextOffset, y, 120); 
+    WinDrawChars(alarm->name, StrLen(alarm->name), 
+		 x + kAttnListTextOffset, y+11); 
+  }
+
+  FntSetFont(curFont); 
+
+  MemPtrFree(lSysPref);
+  MemPtrFree(alarm);
+
+  return 0;
+}
+
+
+void DeleteAttention(UInt32 uniqueID, Boolean goThere)
+{
+  UInt cardNo;
+  LocalID dbID;
+  DmSearchStateType searchInfo;
+
+  DmGetNextDatabaseByTypeCreator(true, &searchInfo,
+      sysFileTApplication, BCAppID, true, &cardNo, &dbID);
+  AttnForgetIt(cardNo, dbID, uniqueID);
+
+  if (goThere)
+    SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdNormalLaunch, NULL);
+}
+
+
+void PlayMidiSound(UInt recordNo, Boolean ignoresystemsoundoff)
+{
+  Err                   err;
+
+  MemHandle             midiH;
+  SndMidiRecHdrType*    midiHdrP;
+
+  DmOpenRef             dbP = NULL;
+  DmSearchStateType	searchState;
+  UInt16                cardNo;	
+  LocalID               dbID;
+
+  SndSmfOptionsType optionsP;
+
+
+  err = DmGetNextDatabaseByTypeCreator(true, &searchState,
+				       sysFileTMidi, sysFileCSystem, true, 
+				       &cardNo, &dbID);
+
+  dbP = DmOpenDatabase (cardNo, dbID, dmModeReadOnly);
+
+  midiH = DmQueryRecord(dbP, recordNo);
+  midiHdrP = MemHandleLock(midiH);
+		
+  optionsP.dwStartMilliSec = 0;
+  optionsP.dwEndMilliSec = sndSmfPlayAllMilliSec;
+  optionsP.interruptible = true;
+  optionsP.reserved = 0;
+  if (ignoresystemsoundoff)
+    optionsP.amplitude = sndMaxAmp;
+  else
+    optionsP.amplitude = PrefGetPreference(prefAlarmSoundVolume);
+
+  err = SndPlaySmf(NULL, sndSmfCmdPlay, 
+		   (UInt8*)midiHdrP  + midiHdrP->bDataOffset, 
+		   &optionsP, NULL, NULL, false);
+
+  MemPtrUnlock (midiHdrP);
+  DmCloseDatabase(dbP);
+}
Index: bigclock/bigclock.c
diff -u bigclock/bigclock.c:1.1.1.1 bigclock/bigclock.c:1.49.2.1
--- bigclock/bigclock.c:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/bigclock.c	Mon Apr 10 19:32:13 2006
@@ -18,22 +18,37 @@
 Written by Jens Rupp
 jens@gacel.de
 http://www.gacel.de/bigclock.htm
+
+Modified by Ling Nero to not mess up Clie hi-res screens after alarm triggered,
+by using WinSaveBits and WinRestoreBits instead of WinCopyRectangle.  Lines
+modified are denoted by *LLN. 
+
+Added Japanese translation and HiRes mode support 
+by Yoshizumi Endo <y-endo@ceres.dti.ne.jp>.
 */
+
 #define NON_PORTABLE
+#define ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS
+#define ALLOW_ACCESS_TO_INTERNALS_OF_FORMS
+#define _SDK5_
+// #define _TRG_
+// #define debug
 
 #include <PalmOS.h>
+#include <SonyCLIE.h>
 #include <CoreTraps.h>
 #include <System/SerialMgrOld.h>   // for talelight
 #include <SysEvtMgr.h>
 #include <PalmCompatibility.h>
 #include "bigclock.h"
 #include "gccfix.h"
+#include <BmpGlue.h>
+#ifdef _TRG_
 #include "Trg.h"
 #include "Vga.h"
 #include "Silk.h"
+#endif
 
-
-#define BCAppID       'BClk'
 #define ymove 2
 
 #define SEG_UTIL  __attribute__ ((section ("util")))
@@ -41,6 +56,7 @@
 #define SEG_DRAW  __attribute__ ((section ("draw")))
 #define SEG_FIRE  __attribute__ ((section ("fire")))
 
+UInt16 HRrefNum;
 
 //default panels
 const int defpages[2][8] ={
@@ -60,6 +76,9 @@
 
 #include "bigclocktypes.h"
 
+void HiResOn(void);
+void HiResOff(void);
+
 //main segment
 int StartApplication(void);
 Boolean ReadAlarm(DmOpenRef BCdb,int num,BigClockAlarm *target);
@@ -78,21 +97,23 @@
 void UpdateTimer(int num);
 Boolean newyear(EventPtr event);
 
-#define debug
+//alarm
+extern Boolean AttentionBottleNeckProc(AttnLaunchCodeArgsType *paramP);
+extern void PlayMidiSound(UInt recordNo, Boolean ignoresystemsoundoff);
 
 #ifdef debug
   HostFILEType  *log;
 #endif
 
 //options segment
-Boolean layout(EventPtr event);
-Boolean optionsworld(EventPtr event);
-Boolean optionsglobal(EventPtr event);
-Boolean optionssound(EventPtr event);
-Boolean optionscolor(EventPtr event);
-Boolean optionslocaltime(EventPtr event);
-Boolean optionsalarm(EventPtr event);
-Boolean labelhistory(EventPtr event);
+Boolean layout(EventPtr event) SEG_OPTION;
+Boolean optionsworld(EventPtr event) SEG_OPTION;
+Boolean optionsglobal(EventPtr event) SEG_OPTION;
+Boolean optionssound(EventPtr event) SEG_OPTION;
+Boolean optionscolor(EventPtr event) SEG_OPTION;
+Boolean optionslocaltime(EventPtr event) SEG_OPTION;
+Boolean optionsalarm(EventPtr event) SEG_OPTION;
+Boolean labelhistory(EventPtr event) SEG_OPTION;
 
 //draw segment in draw.c
 extern void ColorSet(Boolean i) SEG_DRAW;
@@ -102,10 +123,9 @@
 extern void DrawButton(char *t,Boolean i,int x, int y, int h, int w, int o)  SEG_DRAW;
 extern void MySetFont(int n) SEG_DRAW;
 extern void TinyNumber(int size,int x,int y,int num) SEG_DRAW;
+#ifdef _TRG_
 extern void DrawSilkMonth(int off,int x,int y) SEG_DRAW;
-
-
-
+#endif
 
 //util segment
 void SetSound(int a,int w);
@@ -125,20 +145,29 @@
 Boolean dirty=false;  // for the backup bit of the data database
 DWord romversion;
 Boolean is35;         // os 3.5 or higher
-Boolean isTRG;        //larger screen
+#ifdef _TRG_
+Boolean isTRG;        // larger screen
+#endif
 Boolean iscolor;      // color device
+Boolean isHR;         // HiRes device
+Boolean isHD;         // HiDensity device
+Boolean isOS4;        // OS4 device
+Boolean isOS5;        // OS5 device
+Boolean isCLIE_OS5;   // CLIE OS5 device
+Boolean isJOG;        // Jog
 UInt32  maxdepth;
 UInt32  screenwidth;
 UInt32  screenheight;
 UInt32  panelwidth=160;
 UInt32  panelheight=62;
 UInt32  startscreendepth;
-int   changed[2];     // upper (0) or lower (1) panel changed -> redraw
+int     changed[2];      // upper (0) or lower (1) panel changed -> redraw
 Boolean GotHelp;
 Boolean InfoIconState=false;
 UInt32  ytop=15;         // upper panel
-UInt32 ybottom=77;      // lower panel
-
+UInt32  ybottom=77;      // lower panel
+int     xHR=1;           // a constant to calculate of coordinates on HiRes screen mode 
+int     isJA=0;
 
 
 VoidHand hdays;
@@ -150,8 +179,12 @@
 //Boolean screenChanged = false;
 
 
-VoidHand   bigbitmapH[16];
-BitmapPtr  bigbitmapP[16];
+VoidHand   bigbitmapH[17];
+BitmapPtr  bigbitmapP[17];
+#ifdef _SDK5_
+BitmapPtrV3  bigbitmapV3P[17];
+#endif
+WinHandle  bitmapWinH[17];
 
 
 int        ThemeMode=0;
@@ -193,8 +226,8 @@
 
 char      stimer[4][12];
 
-char      salarmmode[2][12];
-char      stimermode[7][14];
+char      salarmmode[2][20];
+char      stimermode[7][20];
 
 char      reltimerdate[12];
 char      reltimertime[12];
@@ -223,6 +256,7 @@
 #include "fire.c"
 
 
+#ifdef _TRG_
 void DrawSilk()
 {
   RectangleType rc = {{0,240},{240,66}};
@@ -259,18 +293,17 @@
       DrawSilk();
     } */
 }
+#endif
 
 
 DWord  PilotMain (Word cmd, Ptr cmdPBP, Word launchFlags)
 {
   int error;
 
-
-
   if (cmd == sysAppLaunchCmdNormalLaunch)
   {
 #ifdef debug
-  log=HostFOpen("c:\\palm\\bigclock\\log.txt","w");
+  log=HostFOpen("/tmp/bigclock_log.txt","w");
   HostFPutS("Startlog\n", log);
 #endif
 
@@ -291,10 +324,11 @@
   } else if (cmd == sysAppLaunchCmdDisplayAlarm)
   {
     DisplayAlarm ((SysAlarmTriggeredParamType *)cmdPBP);
+  } else if  (cmd == sysAppLaunchCmdAttention)
+  {
+    AttentionBottleNeckProc ((AttnLaunchCodeArgsType*)cmdPBP);
   } else if ((cmd == sysAppLaunchCmdSystemReset) ||
-             (cmd == sysAppLaunchCmdTimeChange)
-             )
-
+             (cmd == sysAppLaunchCmdTimeChange))
   {
     UpdateSystemAlarm();
   } else if (cmd==sysAppLaunchCmdNotify)
@@ -318,8 +352,6 @@
     } */
   }
 
-
-
   return (0);
 }
 
@@ -347,7 +379,6 @@
   StrCat(out,"\n");
   HostFPutS(out, log);
 }
-
 #endif
 
 
@@ -387,7 +418,6 @@
        SndDoCmd(0, &cmd, 0);
      }
   }
-
 }
 
 
@@ -416,18 +446,49 @@
   int     result=0;
   char    message[32];
   char    number[6];
-  WinHandle Save;
+  WinHandle Save,oldWin;
   FontID oldfont;
-  RectangleType screen = {{0,0},{160,160}};
+// *LLN RectangleType screen = {{0,0},{160,160}};
+  RectangleType screen;
   DWord version;
   int err;
+  UInt16 error; // *LLN
+  Boolean isHR=0;
+#ifdef _TRG_
   Boolean isTRGl;
   VgaScreenModeType oldmode;
   VgaRotateModeType oldrotation;
   VgaScreenStateType oldstate;
+#endif
+
+  VoidHand   alarmbitmapH;
+  BitmapPtr  alarmbitmapP;
+  UInt16 HRrefNum;
+  SonySysFtrSysInfoP sonySysFtrSysInfoP;
 
+#ifdef _TRG_
   isTRGl=FtrGet(TRGSysFtrID, TRGVgaFtrNum, &version) == 0;
+#endif
 
+  // for CLIE HiRes mode
+  if ((err = FtrGet(sonySysFtrCreator,
+		      sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) {
+    /* Not CLIE: maybe not available */
+  } else {
+    if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrHR) {
+      /* HR available */
+      if ((err = SysLibFind(sonySysLibNameHR, &HRrefNum))){
+	if (err == sysErrLibNotFound) {
+	  /* couldn't find lib */
+	  err = SysLibLoad( 'libr', sonySysFileCHRLib, &HRrefNum);
+	}
+      }
+      if (!err ) {
+	/* Now we can use HR lib */
+	isHR = 1;
+      }
+    }
+  }
 
   //remember old form
   curForm = FrmGetActiveForm ();
@@ -448,10 +509,14 @@
   //if (isTRG)
   //  VgaFrmModify(frm,vgaFormModify160To240);
 
-
   FrmSetActiveForm (frm);
 
+  oldWin=WinSetDrawWindow(WinGetDisplayWindow()); // *LLN
+  WinGetWindowFrameRect(WinGetDisplayWindow(), &screen);  // *LLN
+  Save=WinSaveBits(&screen, &error);				 // *LLN
+  WinSetDrawWindow(oldWin); 	// *LLN
 
+#ifdef _TRG_
   if (isTRGl)
   {
     VgaSaveScreenState(&oldstate);
@@ -464,16 +529,16 @@
   } else
   {
     // create offscreen window to save screen
-    Save=WinCreateOffscreenWindow(160,160,screenFormat,(Word *)&dummy);
+//*LLN    Save=WinCreateOffscreenWindow(160,160,screenFormat,(Word *)&dummy);
   }
 
   // save screen
-  if (Save!=NULL)
-    WinCopyRectangle(WinGetDisplayWindow(),Save,&screen,0,0,scrCopy);
+//*LLN  if (Save!=NULL)
+//*LLN    WinCopyRectangle(WinGetDisplayWindow(),Save,&screen,0,0,scrCopy);
 
   if (isTRGl)
     VgaSetScreenMode(screenModeScaleToFit,oldrotation);
-
+#endif
 
   //WinSetDrawWindow(WinGetActiveWindow());
 
@@ -487,6 +552,21 @@
 
   FrmDrawForm (frm);
 
+  // Alarm bitmap
+  if (isHR)
+    alarmbitmapH=DmGetResource('Tbmp', bitmapID_alarm_L);
+  else
+    alarmbitmapH=DmGetResource('Tbmp', bitmapID_alarm);
+
+  alarmbitmapP=MemHandleLock(alarmbitmapH);
+
+  if (isHR)
+    HRWinDrawBitmap(HRrefNum, alarmbitmapP,0,80);
+  else
+    WinDrawBitmap(alarmbitmapP,0,40);
+
+  MemHandleUnlock(alarmbitmapH);
+  DmReleaseResource(alarmbitmapH);
 
   // read preferences
   lSysPref=MemPtrNew(sizeof(SystemPreferencesType));
@@ -518,7 +598,7 @@
     WinDrawChars(message,StrLen(message),80-(dummy /2),24);
     if (alarm->snoozecurrent > 0)
     {
-       StrCopy(message,"Snooze ");
+       SysCopyStringResource(message,stringID_snooze);
        StrIToA(number,alarm->snoozecurrent);
        StrCat(message,number);
        StrCat(message," / ");
@@ -594,7 +674,6 @@
       quit=true;
 
 
-
     if (!quit)
       {
         if (typ==1)  // play sound
@@ -681,7 +760,6 @@
   if (event.eType == penUpEvent)
     quit=true;
 
-
  } while (
           (! quit) &&
           (! (
@@ -727,29 +805,35 @@
   }
 
 
-
-
-  if (isTRGl)
+#ifdef _TRG_
+ if (isTRGl)
     VgaSetScreenMode(screenMode1To1,oldrotation);
 
   // restore screen
-  if (Save != NULL)
-  {
-    WinCopyRectangle(Save,WinGetDisplayWindow(),&screen,0,0,scrCopy);
-    WinDeleteWindow(Save,false);
-  }
+//*LLN  if (Save != NULL)
+//*LLN  {
+//*LLN    WinCopyRectangle(Save,WinGetDisplayWindow(),&screen,0,0,scrCopy);
+//*LLN    WinDeleteWindow(Save,false);
+//*LLN  }
   if (isTRGl)
   {
     VgaRestoreScreenState(&oldstate);
     //VgaSetScreenMode(oldmode,oldrotation);
   }
+#endif
+
+  // *LLN new restore screen
+  WinRestoreBits(Save,screen.topLeft.x, screen.topLeft.y);
+
   //restore active form
   FrmSetActiveForm (curForm);
 
+
   //FrmCustomAlert(alertID_text,"return",NULL,NULL);
   return result;
 }
 
+
 void UpdateSystemAlarm ()
 {
   UInt cardNo;
@@ -763,33 +847,96 @@
 }
 
 
-
-void AlarmTriggered (SysAlarmTriggeredParamType * cmdPBP)
+void AlarmTriggered (SysAlarmTriggeredParamType *cmdPBP)
 {
-  int r;
   BigClockAlarm *alarm;
   DmOpenRef BCdb;
+  DWord romversion;
 
+  FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romversion);
 
-  UpdateSystemAlarm();
+  if (romversion >= 0x04000000)
+  {
+    UInt cardNo;
+    LocalID dbID;
+    DmSearchStateType searchInfo;
+    UInt nagRateInSeconds=0, nagRepeatLimit=0;
 
-  r=0;
-  if (cmdPBP->ref != -2)
-    r=DisplayAndSound(cmdPBP,1);
-
-  if ((r!=0) && (cmdPBP->ref >= 0))
-  {
-     alarm=MemPtrNew(sizeof(BigClockAlarm));
-     BCdb=OpenAlarm();
-     ReadAlarm(BCdb,cmdPBP->ref,alarm);
-     if (alarm->options.snooze == 1)
-     {
-       // set to end of snooze
-       alarm->snoozecurrent=alarm->snoozecount+1;
-       WriteAlarm(BCdb,cmdPBP->ref,alarm);
-     }
-     CloseAlarm(BCdb);
-     MemPtrFree(alarm);
+    DmGetNextDatabaseByTypeCreator (true, &searchInfo,
+       sysFileTApplication, BCAppID, true, &cardNo, &dbID);
+    SetNextAlarm(cardNo,dbID);
+
+    if (cmdPBP->ref != -2) 
+    {
+      AttnFlagsType AttnFlag = 0;
+
+      alarm=MemPtrNew(sizeof(BigClockAlarm));
+      BCdb=OpenAlarm();
+      ReadAlarm(BCdb,cmdPBP->ref,alarm);
+      
+      // alarm (once) off
+      if (alarm->options.trigger==2)
+      {
+	alarm->options.active=0;
+	WriteAlarm(BCdb,cmdPBP->ref,alarm);
+      }
+      
+      // nagging (snooze)
+      if (alarm->options.snooze)
+      {
+	nagRateInSeconds = alarm->snoozetime*60;
+	nagRepeatLimit = alarm->snoozecount;
+      }
+
+      // Attention methods
+      if (alarm->options.silent)
+	AttnFlag += kAttnFlagsNoSound;
+      else if (alarm->options.ignoresystemsoundoff)
+	AttnFlag += kAttnFlagsAlwaysSound;
+ 
+      if (alarm->options.talelight)
+	AttnFlag += kAttnFlagsAlwaysLED;
+      else
+	AttnFlag += kAttnFlagsNoLED;
+
+      if (alarm->options.backlight) 
+	AttnFlag += kAttnFlagsAlwaysVibrate;
+      else
+	AttnFlag += kAttnFlagsNoVibrate;
+      
+      AttnForgetIt(cardNo, dbID, cmdPBP->ref);
+      AttnGetAttention(cardNo, dbID, cmdPBP->ref, NULL,
+		       kAttnLevelInsistent, AttnFlag,
+		       nagRateInSeconds, nagRepeatLimit);
+      cmdPBP->purgeAlarm = true;
+
+      CloseAlarm(BCdb);
+      MemPtrFree(alarm);
+    }
+  }
+  else
+  {
+    int r=0;
+
+    UpdateSystemAlarm();
+
+    if (cmdPBP->ref != -2)
+      r=DisplayAndSound(cmdPBP,1);
+
+    if ((r!=0) && (cmdPBP->ref >= 0))
+      {
+	alarm=MemPtrNew(sizeof(BigClockAlarm));
+	BCdb=OpenAlarm();
+	ReadAlarm(BCdb,cmdPBP->ref,alarm);
+	if (alarm->options.snooze == 1)
+	  {
+	    // set to end of snooze
+	    alarm->snoozecurrent=alarm->snoozecount+1;
+	    WriteAlarm(BCdb,cmdPBP->ref,alarm);
+	  }
+	CloseAlarm(BCdb);
+	MemPtrFree(alarm);
+      }
   }
 }
 
@@ -804,10 +951,8 @@
   DmOpenRef BCdb;
   int r=0;
 
-
   if (cmdPBP->ref == -2) return;
 
-
   DmGetNextDatabaseByTypeCreator (true, &searchInfo,
      sysFileTApplication, BCAppID, true, &cardNo, &dbID);
 
@@ -839,7 +984,6 @@
       WriteAlarm(BCdb,cmdPBP->ref,alarm);
       CloseAlarm(BCdb);
 
-
       SetNextAlarm(cardNo,dbID);
 
     }
@@ -944,7 +1088,6 @@
   BigClockRegion *n;
   n=regions;
 
-
   while (n != NULL)
   {
     if (n->panel == panel)
@@ -1112,10 +1255,10 @@
   AddRegion(0,0,39,panelheight, pnMonth,1,regMonthLeft);
   AddRegion(40,0,79,panelheight, pnMonth,1,regMonthRight);
   AddRegion(80,0,159,panelheight, pnMonth,1,regMonthDate);
-
-
 }
 
+
+#ifdef _TRG_
 void InitRegionsStar()
 {
   int iii;
@@ -1240,7 +1383,6 @@
      x+=36+12;
   }
 
-
   //label
   AddRegion(0,0,119,18, pnTimer,4,regLabel);
   //timer toggle
@@ -1278,6 +1420,7 @@
   //pnSetTime
 
 }
+#endif
 
 /*
 void ShowRegions(UInt32 panel,UInt32 sub)
@@ -1302,11 +1445,10 @@
     }
     n=(BigClockRegion *)n->next;
   }
-
 }*/
 
 
- void InitPref()
+void InitPref()
 {
   int iii;
   int jjj;
@@ -1382,17 +1524,15 @@
 
   prefs.screendepth=startscreendepth;
   SetDeepthDefault();
-
-
 }
 
- void DrawWorldName (Int16 itemNum, RectangleType *bounds,Char **itemsText)
+
+void DrawWorldName (Int16 itemNum, RectangleType *bounds,Char **itemsText)
 {
 	CharPtr	itemTextP;
 	SWord		itemTextLen;
 	SWord		itemWidth;
 
-
 	itemTextP = prefs.world[wLocal+itemNum].name;
 
 	itemTextLen = StrLen(itemTextP);
@@ -1419,9 +1559,9 @@
 		// Draw ellipsis char
 		WinDrawChars(&ellipsisChar, 1, bounds->topLeft.x + itemWidth, bounds->topLeft.y);
 		}
-
 }
 
+
 Boolean WritePref()
 {
   DmOpenRef BCdb;
@@ -1509,7 +1649,6 @@
 }
 
 
-
 void CloseAlarm(DmOpenRef BCdb)
 {
    DmCloseDatabase(BCdb);
@@ -1544,7 +1683,8 @@
   return BCdb;
 }
 
- Boolean ReadAlarm(DmOpenRef BCdb,int num,BigClockAlarm *target)
+
+Boolean ReadAlarm(DmOpenRef BCdb,int num,BigClockAlarm *target)
 {
   VoidHand  BCalarmHandle;
   BigClockAlarm *BCalarm=NULL;
@@ -1592,7 +1732,53 @@
   if (start==0)
     start=7184;
 
-  if ((resdb) || (ThemeDef->numbers==0))
+  if (isHR)
+  {
+      UInt16    error;
+      Coord     bitmapWidth, bitmapHeight;
+      UInt16    bitmapRowBytes;
+      WinHandle screenH;
+      // WinDrawOperation oldDrawMode;
+
+      start=7284;
+
+      for (iii=0 ; iii<16 ; iii++)
+      {
+	ColorSet(0);
+
+	bigbitmapH[iii]=DmGetResource('Tbmp',start+iii);
+	bigbitmapP[iii]=MemHandleLock(bigbitmapH[iii]);
+
+	BmpGlueGetDimensions(bigbitmapP[iii], &bitmapWidth, &bitmapHeight,
+			     &bitmapRowBytes);
+	bitmapWinH[iii] = WinCreateOffscreenWindow(bitmapWidth, bitmapHeight, 
+						   screenFormat, &error);
+	ErrFatalDisplayIf(error, "Could Not Create Offscreen Window");
+	
+	screenH = WinSetDrawWindow(bitmapWinH[iii]);
+	// oldDrawMode = WinSetDrawMode(winMask);
+	WinPaintBitmap(bigbitmapP[iii], 0, 0);
+	// WinSetDrawMode(oldDrawMode);
+
+	WinSetDrawWindow(screenH);
+	MemHandleUnlock(bigbitmapH[iii]);
+	DmReleaseResource(bigbitmapH[iii]);
+      }
+  }
+#ifdef _SDK5_
+  else if (isHD)
+  {
+    for (iii=0 ; iii<16 ; iii++)
+    {
+      bigbitmapH[iii]=DmGetResource('Tbmp',7284+iii);
+      bigbitmapP[iii]=MemHandleLock(bigbitmapH[iii]);
+
+      bigbitmapV3P[iii] = BmpCreateBitmapV3(bigbitmapP[iii], 
+                           kDensityDouble, BmpGetBits(bigbitmapP[iii]), 0); 
+    }
+  }
+#endif
+  else if ((resdb) || (ThemeDef->numbers==0))
   {
      for (iii=0 ; iii<16 ; iii++)
      {
@@ -1615,15 +1801,32 @@
        }
      }
   }
-
 }
 
+
 void CloseBigBitmaps(void)
 {
   int iii;
 
-  for (iii=0 ; iii<16 ; iii++)
-    MemHandleUnlock(bigbitmapH[iii]);
+  if (isHR)
+  {
+    for (iii=0 ; iii<16 ; iii++)
+      {
+	WinDeleteWindow(bitmapWinH[iii], false);
+      }
+  }
+  else
+  {
+    for (iii=0 ; iii<16 ; iii++)
+      {
+#ifdef _SDK5_
+	if (isHD)
+	  BmpDelete((BitmapType*)bigbitmapV3P[iii]);
+#endif
+	MemHandleUnlock(bigbitmapH[iii]);
+	DmReleaseResource(bigbitmapH[iii]);
+      }
+  }
 }
 
 /*
@@ -1638,6 +1841,7 @@
   }
 } */
 
+
 void SetPageResource(int set,int  num,int hour)
 {
   int newid;
@@ -1648,8 +1852,6 @@
   iii=0;
   c=&(ThemeDef->back);
 
-
-
   while ((newid < 0) && (iii<ThemeDef->count))
   {
     if ( ((c->set == set) || (c->set==2)) && ((c->page == num) || (c->page==4)) && (hour >= c->start ) && (hour < c->end))
@@ -1662,8 +1864,6 @@
   if (newid < 0)
    newid=0;
 
-
-
   if (newid != BackgroundID)
   {
     changed[0]=1;
@@ -1702,20 +1902,21 @@
 {
   LocalID id;
   UInt16  attr;
+#ifdef _TRG_
   VoidHand trgres;
   int     trgmode=0;
+  UInt32 version;
+#endif
 
   //Voidhand kindh;
   //UInt8 *kind;
 
-  UInt32 version;
   Word x;
 
 #ifdef debug
   debugs("OpenTheme",name);
 #endif
 
-
   ThemeDB=0;
   resdb=true;
   //use external theme?
@@ -1749,7 +1950,7 @@
          SetPageResource(prefs.pageset,prefs.mode,Time[0].hour);
       }
 
-
+#ifdef _TRG_
  if (FtrGet(TRGSysFtrID, TRGVgaFtrNum, &version) == 0)
  {
     if (resdb)
@@ -1792,7 +1993,6 @@
     else
       InitRegions160();
 
-
     recreate=true;
 
     /*
@@ -1807,15 +2007,32 @@
     }
     */
  }
+#endif
 
  if (build != NULL)
  {
    WinDeleteWindow(build,true);
  }
- build=WinCreateOffscreenWindow(panelwidth,panelheight,screenFormat,&x);
+
+ if  (isHR)
+ {
+   panelwidth=320;
+   panelheight=124;
+   ytop=30;
+   ybottom=154;
+
+   build = HRWinCreateOffscreenWindow(HRrefNum, panelwidth, panelheight, screenFormat, &x);
+ }
+ else
+#ifdef _SDK5_
+   build=WinCreateOffscreenWindow(panelwidth,panelheight,nativeFormat,&x);
+#else
+   build=WinCreateOffscreenWindow(panelwidth,panelheight,screenFormat,&x);
+#endif
 
 }
 
+
 void CloseTheme()
 {
   CloseBigBitmaps();
@@ -1839,6 +2056,7 @@
 }
 
 
+#ifdef _TRG_
 void FindTRGTheme(UInt32 type,char *name)
 {
   int     num;
@@ -1852,7 +2070,6 @@
   UInt16  attr;
   Err       error;
 
-
   num=1;
   found=false;
   d=0;
@@ -1865,7 +2082,6 @@
     error=DmDatabaseInfo(0,dbid,NULL,&attr,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
     TestDB=DmOpenDatabase(0,dbid,dmModeReadOnly);
 
-
     if (attr & dmHdrAttrResDB)
     {
       res=DmFindResource (TestDB,'bctt',333, NULL);
@@ -1879,7 +2095,6 @@
       ThemeBonus=0;
     }
 
-
     DmCloseDatabase(TestDB);
 
     if (res>=0)
@@ -1889,11 +2104,11 @@
     }
     num++;
   }
-
 }
+#endif
 
 
- int StartApplication(void)
+int StartApplication(void)
 {
   int error;
   int iii;
@@ -1910,14 +2125,20 @@
   UInt32            depth;
   //VoidHand         trgres=NULL;
   //LocalID               id;
+  char language[20];
 
   error = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romversion);
   //usemidi=(romversion>=0x03003000);
   //usemidi=false;
   is35 = (romversion >= 0x03503000);
+  isOS4 = (romversion >= 0x04000000);
+  isOS5 = (romversion >= 0x05000000);
   //is35=false;
+#ifdef _TRG_
   isTRG=FtrGet(TRGSysFtrID, TRGVgaFtrNum, &version) == 0;
+#endif
 
+  HiResOn();
 
   //read system configuration
   if (is35)
@@ -1926,9 +2147,10 @@
       WinScreenMode(winScreenModeGetSupportedDepths,NULL,NULL,&depth,NULL);
 #ifdef debug
       debugi("depth before",depth);
+#ifdef _TRG_
       if (isTRG)
         debugs("device","trg"     );
-
+#endif
 #endif
 
       if ((depth & 32768) == 32768)
@@ -1943,6 +2165,7 @@
         maxdepth=1;
 
       WinScreenMode(winScreenModeGetDefaults,&screenwidth,&screenheight,&startscreendepth,NULL);
+
 #ifdef debug
   debugi("maxdepth after",maxdepth);
   debugi("Screenwidth",screenwidth);
@@ -1979,19 +2202,20 @@
   if (prefs.screendepth>maxdepth)
     prefs.screendepth=maxdepth;
 
-
 #ifdef debug
   debugi("Set screen mode",prefs.screendepth);
 #endif
+
   if (is35)
     WinScreenMode(winScreenModeSet,NULL,NULL,&prefs.screendepth,NULL);
 
-
+#ifdef _TRG_
   //no theme on TRG?
   if ((StrLen(prefs.theme) == 0) && (isTRG))
   {
      FindTRGTheme('BCth',prefs.theme);
   }
+#endif
 
   OpenTheme(prefs.theme);
 
@@ -2016,9 +2240,6 @@
       screenwidth=160;
       screenheight=160;
     }
-
-
-
   }*/
 
   //is GotHelp installed and running?
@@ -2027,42 +2248,36 @@
       (FtrGet('pHLP',1000,&version) != ftrErrNoSuchFeature)
     );
 
-
-
-
-
   if (prefs.startfirst)
     {
       prefs.mode=0;
       prefs.pageset=0;
     }
 
-
   BCdb=OpenAlarm();
   if (BCdb==0) return 1;
   CloseAlarm(BCdb);
 
-
   //on this a panel display is created, after that copied to the screen
   //build=WinCreateOffscreenWindow(panelwidth,panelheight,screenFormat,&x);
 
-
-
   //initbigbitmap();
 
 #ifdef debug
   debugs("StartApplication","InitRegion");
 #endif
+
+#ifdef _TRG_
   if (isTRG)
     InitRegionsStar();
   else
+#endif
     InitRegions160();
+
 #ifdef debug
   debugs("StartApplication","InitRegion done");
 #endif
 
-
-
   //init month and weekday strings
   SysCopyStringResource(daystrings,stringID_weekdays);
   SysCopyStringResource(monthstrings,stringID_months);
@@ -2108,6 +2323,11 @@
   for (iii=0; iii<7 ; iii++)
     SysCopyStringResource(stimermode[iii],stringID_timermode0+iii);
 
+  SysCopyStringResource(language,stringID_language);
+
+  if(strcmp(language, "japanese") == 0)
+    isJA = 1;
+
 #ifdef debug
   debugs("StartApplication","goto form");
 #endif
@@ -2117,7 +2337,7 @@
 }
 
 
- void EventLoop(void)
+void EventLoop(void)
 {
   short err;
   int formID;
@@ -2189,7 +2409,8 @@
   } while(event.eType != appStopEvent);
 }
 
- void StopApplication(void)
+
+void StopApplication(void)
 {
   //int iii;
   //LocalID          id;
@@ -2213,6 +2434,7 @@
        SysNotifyUnregister(0, id, trgNotifySilkEvent, sysNotifyNormalPriority);
   */
 
+  HiResOff();
   FrmCloseAllForms ();
 }
 
@@ -2233,7 +2455,6 @@
 }
 
 
-
 /*
 void DrawSysInfo(int y)
 {
@@ -2256,7 +2477,6 @@
 
   FntSetFont(0);
 
-
   error = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romversion);
 
   c=(char *)&romversion;
@@ -2272,8 +2492,6 @@
   StrCat(help,&help2[6]);
   MyDrawChars(help,StrLen(help),50,y);
 
-
-
   MyDrawChars("Freemem:",8,0,y+1*12);
   MemCardInfo(0,NULL,NULL,NULL,NULL,NULL,NULL,&free);
   StrIToA(help,free);
@@ -2295,7 +2513,6 @@
       StrIToA(help,(Long)endPP-(Long)startPP);
       MyDrawChars(help,StrLen(help),50,y+3*12);
   }
-
 }*/
 
 
@@ -2335,6 +2552,7 @@
   return r;
 }
 
+
 int UpdateTimes()
 {
   int iii;
@@ -2363,7 +2581,6 @@
   if (last.hour != Time[0].hour)
     SetPageResource(prefs.pageset,prefs.mode,Time[0].hour);
 
-
   for (iii=0 ; iii<4 ; iii++)
   {
     //adjust time
@@ -2380,10 +2597,8 @@
     else
       prefs.world[iii+1].options.daychanged=0;
 
-
     prefs.world[iii+1].last=TimDateTimeToSeconds(&Time[iii+1]);
 
-
     bct=&prefs.world[wTimer1+iii];
     //adjust timers
     if (bct->options.active)
@@ -2403,7 +2618,6 @@
         if (bct->options.timerup == 0)
           add=-add;
 
-
         bct->value=bct->value+add;
       } else
       {
@@ -2498,18 +2712,21 @@
   SwitchDrawSection(prefs.pages[prefs.pageset][prefs.mode*2+1],ybottom,true);
 }
 
+
 void DrawCaptionTime()
 {
   char text[30];
   RectangleType rc = {{115,0},{45,12}};
   int w;
 
+#ifdef _TRG_
   if (isTRG)
   {
     rc.topLeft.x=screenwidth-70;
     rc.extent.x=70;
     rc.extent.y=18;
   }
+#endif
 
   TimeToAscii(Time[0].hour,Time[0].minute,SysPref.timeFormat,text);
   MySetFont(1);
@@ -2523,9 +2740,17 @@
 
   WinEraseRectangle(&rc,0);
   w=FntCharsWidth(text,StrLen(text));
+
+  if (isHR && !isCLIE_OS5) 
+  {
+    w/=2;
+    FntSetFont(1);
+  }
+
   WinDrawChars(text,StrLen(text),screenwidth-w,1);
 }
 
+
 void IdleDraw()
 {
   int n;
@@ -2548,6 +2773,7 @@
   }
 }
 
+
 void ChangeDays(int num, int d)
 {
   unsigned char b;
@@ -2560,17 +2786,16 @@
 
 }
 
+
 void ChangeCalcTimer(int num , int id)
 {
   long add=0;
   Boolean up;
 
-
   up=(id < 6);
   if (!up)
     id -=5;
 
-
   switch (id)
   {
     case 0: add=(long)3600 / (long)prefs.world[num].calc;
@@ -2608,7 +2833,7 @@
   DateToAscii(s.month,s.day,s.year,dfDMYWithDots,h1);
   TimeToAscii(s.hour,s.minute,false,h2);
   FrmCustomAlert(alertID_text3,name,h1,h2);
-};*/
+}*/
 
 
 void SetNextAlarm(UInt cno,LocalID aid)
@@ -2623,10 +2848,8 @@
   DmOpenRef BCdb=NULL;
   Boolean wakeup;
 
-
   alarm=MemPtrNew(sizeof(BigClockAlarm));
 
-
   wakeup=false;
   BCdb=OpenAlarm();
 
@@ -2663,7 +2886,6 @@
           d.second=0;
           al=TimDateTimeToSeconds(&d);
 
-
           while (
                  ( (alarm->days & ( 1 << d.weekDay)) == 0 ) ||
                    ( al <= now)
@@ -2744,17 +2966,28 @@
     }
   }
 
-
   if (num==-1)
     as=0;
-  CloseAlarm(BCdb);
 
+  /*
+  if (num >= 0)
+  {
+    ReadAlarm(BCdb,num,alarm);
+
+    //    TimSecondsToDateTime(as - daysInSeconds, &d);
+    TimSecondsToDateTime(as, &d);
+    alarm->time = d;
+    WriteAlarm(BCdb,num,alarm);
+  }
+  */
+
+  CloseAlarm(BCdb);
   AlmSetAlarm(cno,aid,num,as,false);
 
   MemPtrFree(alarm);
-
 }
 
+
 void SetSound(int a,int w)
 {
   if ((w>=0) && (w<=3))
@@ -2798,6 +3031,7 @@
   CloseAlarm(BCdb);
 }
 
+
 void ToggleAlarm(int num)
 {
   prefs.world[num].options.active = inot[prefs.world[num].options.active];
@@ -2805,6 +3039,7 @@
   SetNextAlarm(cardNo,appID);
 }
 
+
 Boolean SetTime(int num,UInt8 id,Boolean under)
 {
   const long off[19] = {0,                               // dummy
@@ -2865,7 +3100,6 @@
       b=SetTime(num,id,false);
     }
 
-
     prefs.world[num].reset=prefs.world[num].value;
   } else if (id==regLabel)
   {
@@ -2887,7 +3121,6 @@
 }
 
 
-
 Boolean SetAlarm(int num, int id)
 {
   Boolean b;
@@ -2925,7 +3158,6 @@
 }
 
 
-
 void UpdateTimer(int num)
 {
   BigClockAlarm alarm;
@@ -2971,11 +3203,9 @@
 
   WriteAlarm(BCdb,num-5,&alarm);
   CloseAlarm(BCdb);
-
 }
 
 
-
 Boolean ControlTap(int num, int id,int drawpage)
 {
   int iii,kkk;
@@ -3005,7 +3235,6 @@
       UpdateTimer(iii);
     }
 
-
     UpdateTimer(num);
     SetNextAlarm(cardNo,appID);
   } else if (prefs.world[num].options.active==0)
@@ -3035,12 +3264,14 @@
   return true;
 }
 
+
 Boolean ChangeMonthOffset(int num,int i)
 {
   prefs.world[num].monthoffset+=i;
   return true;
 }
 
+
 Boolean SectionPenUp(int val)
 {
   unsigned char pan;
@@ -3049,7 +3280,6 @@
   pan=val >> 3;
   num= val & 7;
 
-
   if (timercommand>0)
   {
 
@@ -3169,7 +3399,7 @@
 }
 
 
- Boolean bigclock(EventPtr event)
+Boolean bigclock(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
@@ -3192,22 +3422,26 @@
       recreate=false;
       FrmSetEventHandler(form, (FormEventHandlerPtr) bigclock);
       event->eType=frmOpenEvent;
+#ifdef _TRG_
       if (isTRG)
       {
-        VgaFrmModify(form,vgaFormModify160To240);
+        VgaFormModify(form,vgaFormModify160To240); 
         ResizeForm();
       }
+#endif
     }
   }
 
-
   switch (event->eType)
   {
   case frmOpenEvent:
+#ifdef _TRG_
      if (isTRG)
      {
         ResizeForm();
      }
+#endif
+
 #ifdef debug
   debugs("bigclock","open form");
 #endif
@@ -3221,7 +3455,6 @@
     FrmDrawForm(form);
     //page=3;
 
-
     SetPageNames();
     CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_m1+prefs.mode)),1);
     CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_pageset1+prefs.pageset)),1);
@@ -3234,18 +3467,23 @@
 
     DrawCaptionTime();
 
+#ifdef _TRG_
     if (isTRG)
       if (! SilkWindowMaximized())
       {
         DrawSilk();
       }  
+#endif
 
     running=true;
     handled = 1;
+
 #ifdef debug
   debugs("bigclock","openform done");
 #endif
     break;
+
+#ifdef _TRG_
   case displayExtentChangedEvent:
          {
            ResizeForm();
@@ -3253,6 +3491,7 @@
              DrawSilk();
            handled = 1;
          }
+#endif
   case menuOpenEvent:
       if (is35)
       {
@@ -3271,7 +3510,10 @@
     switch (event->data.menu.itemID)
     {
     case menuitemID_about:
-      FrmAlert(alertID_info);
+	form = FrmInitForm(formID_about);
+	FrmDoDialog(form);
+	FrmDeleteForm(form);
+	handled =1;
       break;
     case menuitemID_help:
         FrmHelp(stringID_help);
@@ -3339,6 +3581,22 @@
   case keyDownEvent:
    form= FrmGetActiveForm ();
 
+   // Jog push: move mode 1 <-> mode2.
+   if (isJOG){
+     if (EvtKeydownIsVirtual(event)) {
+       if (event->data.keyDown.chr == vchrJogRelease) {
+	 CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_pageset1+prefs.pageset)),0);
+	 prefs.pageset = !prefs.pageset;
+
+	 SetPageResource(prefs.pageset,prefs.mode,Time[0].hour);
+	 SwitchDraw();
+	 SetPageNames();
+	 CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_pageset1+prefs.pageset)),1);
+	 break;
+       }
+     }
+   }
+
    if (prefs.hardwarebuttons)
    {
      if (event->data.keyDown.chr  == pageUpChr)
@@ -3362,7 +3620,7 @@
    } else
    {
      CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_m1+prefs.mode)),0);
-     if (event->data.keyDown.chr  == pageUpChr)
+     if (event->data.keyDown.chr  == pageDownChr)
        {
         if (prefs.mode<3)
           prefs.mode++;
@@ -3370,7 +3628,7 @@
         SwitchDraw();
         handled = 1;
        }
-     else if (event->data.keyDown.chr == pageDownChr)
+     else if (event->data.keyDown.chr == pageUpChr)
        {
         if (prefs.mode>0)
           prefs.mode--;
@@ -3382,16 +3640,17 @@
     }
     break;
   case penDownEvent:
-    if ( (event->screenY >=ytop) && (event->screenY <=(ybottom+panelheight) ))
+    if ( (event->screenY >= ytop/xHR) && (event->screenY <= (ybottom/xHR+panelheight)) )
     {
-      if (event->screenY >=ybottom)
-          b=SectionPenDown(prefs.pages[prefs.pageset][prefs.mode*2+1],event->screenX,event->screenY-ybottom,prefs.mode*2+1);
+      if (event->screenY >= ybottom/xHR)
+          b=SectionPenDown(prefs.pages[prefs.pageset][prefs.mode*2+1],event->screenX,event->screenY-ybottom/xHR,prefs.mode*2+1);
       else
-          b=SectionPenDown(prefs.pages[prefs.pageset][prefs.mode*2],event->screenX,event->screenY-ytop,prefs.mode*2);
+          b=SectionPenDown(prefs.pages[prefs.pageset][prefs.mode*2],event->screenX,event->screenY-ytop/xHR,prefs.mode*2);
       if (b)
         SwitchDraw();
     } else
     {
+#ifdef _TRG_
       if (isTRG)
       {
         if (event->screenY > 240)
@@ -3405,6 +3664,7 @@
           DrawSilk();
         }
       }
+#endif
     }
     break;
   case penUpEvent:
@@ -3435,7 +3695,6 @@
     default: break;
   }
 
-
   return handled;
 }
 
@@ -3564,7 +3823,7 @@
 }
 
 
- Boolean layout(EventPtr event)
+Boolean layout(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
@@ -3578,18 +3837,18 @@
   {
   case frmOpenEvent:
     form = FrmGetActiveForm();
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
-
+#endif
     SetLayoutLabels();
     FrmDrawForm(form);
     page=1;
     handled = 1;
     break;
 
-
  case ctlSelectEvent:
    if (event->data.ctlEnter.controlID == buttonID_ok)
    {
@@ -3711,7 +3970,6 @@
 }
 
 
-
 void ResetData()
 {
   BigClockAlarm alarm;
@@ -3742,9 +4000,9 @@
   SetPageNames();
   OpenTheme(prefs.theme);
   SwitchDraw();
-
 }
 
+
 int InfoIconHandler(int i,int res,int x,int y)
 {
   if ((x>=144) && (x<=159) && (y<=16))
@@ -3771,6 +4029,7 @@
   }
 }
 
+
 void SetWorldOptions(int num)
 {
   FormPtr   form;
@@ -3814,9 +4073,8 @@
   SetFieldText(editID_tzm,number,6);
   ShowEdit(editID_tzm);
 
-  SetFieldText(editID_name,prefs.world[num+wWorld1].name,12);
+  SetFieldText(editID_name,prefs.world[num+wWorld1].name,13);
   ShowEdit(editID_name);
-
 }
 
 
@@ -3848,7 +4106,7 @@
 }
 
 
- Boolean optionsworld(EventPtr event)
+Boolean optionsworld(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
@@ -3857,11 +4115,12 @@
   switch (event->eType)
   {
   case frmOpenEvent:
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
-
+#endif
     optionpage=0;
     SetWorldOptions(optionpage);
     CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_m1+optionpage)),1);
@@ -3913,11 +4172,11 @@
 
   }
 
-
   return handled;
 }
 
- Boolean optionsglobal(EventPtr event)
+
+Boolean optionsglobal(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
@@ -3926,10 +4185,12 @@
   switch (event->eType)
   {
   case frmOpenEvent:
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
+#endif
     SetCheckBox(checkboxID_hardware,prefs.hardwarebuttons);
     SetCheckBox(checkboxID_soundoff,prefs.ignoresystemsoundoff);
     SetCheckBox(checkboxID_locktimer,prefs.locktimer);
@@ -3964,12 +4225,11 @@
 
   }
 
-
   return handled;
 }
 
 
- Boolean optionslocaltime(EventPtr event)
+Boolean optionslocaltime(EventPtr event)
 {
   RectangleType rc = {{0,50},{160,40}};
   FormPtr   form;
@@ -3980,7 +4240,14 @@
   DateTimeType time1;
   DateTimeType time2;
   int       start;
+  int       xHD;
+
+  if (isHD)
+    xHD=2;
+  else
+    xHD=xHR;
 
+#ifdef _TRG_
   if (isTRG)
   {
     rc.topLeft.y=70;
@@ -3988,24 +4255,27 @@
     rc.extent.x=240;
     start=70;
   } else
+#endif
     start=50;
-  rc.extent.y=panelheight;
+  rc.extent.y=panelheight/xHR;
 
   form = FrmGetActiveForm();
   switch (event->eType)
   {
   case frmOpenEvent:
 
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
+#endif
     FrmDrawForm(form);
 
     if (is35)
       ColorSet(false);
     page=4;
-    DrawTime(0,start,false,false,false);
+    DrawTime(0,start*xHD,false,false,false);
 
     handled = 1;
     break;
@@ -4041,7 +4311,7 @@
     }
     break;
   case penDownEvent:
-    if ( (event->screenY >=start) && (event->screenY <=start+panelheight) )
+    if ( (event->screenY >=start) && (event->screenY <=start+panelheight/xHR) )
     {
       prefs.world[0].options.active=0;
       b=SectionPenDown(-1,event->screenX,event->screenY-start,0);
@@ -4049,7 +4319,7 @@
       {
         UpdateTimes();
         WinEraseRectangle(&rc,0);
-        DrawTime(0,start,false,false,false);
+        DrawTime(0,start*xHD,false,false,false);
       }
       prefs.world[0].options.active=1;
       handled=1;
@@ -4059,7 +4329,7 @@
        if (UpdateTimes()>0)
        {
          WinEraseRectangle(&rc,0);
-         DrawTime(0,start,false,false,false);
+         DrawTime(0,start*xHD,false,false,false);
        }
        break;
     default: break;
@@ -4068,6 +4338,7 @@
   return handled;
 }
 
+
 void SetAlarmOptions(int num)
 {
   FormPtr   form;
@@ -4119,12 +4390,11 @@
         HideEdit(checkboxID_daterel);
         HideEdit(selectorID_reldate);
         HideEdit(selectorID_reltime);
-
       }
-
     }
 
     SetCheckBox(checkboxID_backlight,prefs.world[num+obase].options.backlight == 1);
+    SetCheckBox(checkboxID_vibration,prefs.world[num+obase].options.backlight == 1);
     SetCheckBox(checkboxID_talelight,prefs.world[num+obase].options.talelight == 1);
     SetCheckBox(checkboxID_silent,prefs.world[num+obase].options.silent == 1);
     SetCheckBox(checkboxID_wait,prefs.world[num+obase].options.wait == 0);
@@ -4138,7 +4408,6 @@
     StrIToA(number,prefs.world[num+obase].snoozecount);
     SetFieldText(editID_max,number,6);
     ShowEdit(editID_max);
-
   }
 }
 
@@ -4146,6 +4415,7 @@
 Boolean getalarmtext(int num)
 {
   char text[8];
+  int n;
 
   GetFieldText(editID_snooze,text);
   prefs.world[num+obase].snoozetime=StrAToI(text);
@@ -4154,13 +4424,17 @@
   if (!ao)
   {
     GetFieldText(editID_calc,text);
-    prefs.world[num+obase].calc=StrAToI(text);
+    n = StrAToI(text);
+    prefs.world[num+obase].calc=n;
+
+    if (!n)
+      prefs.world[num+obase].options.calc=0;
   }
   return true;
 }
 
 
- Boolean optionsalarm(EventPtr event)
+Boolean optionsalarm(EventPtr event)
 {
   FormPtr   form;
   int       handled  = 0;
@@ -4173,18 +4447,26 @@
 
   form = FrmGetActiveForm();
 
-
-
   if (event->eType == frmOpenEvent)
   {
     optionpage=0;
     SetAlarmOptions(optionpage);
     CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_m1+optionpage)),1);
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
+#endif
 
+    if (isOS4)
+    {
+      MyCtlHideControl(checkboxID_wait);
+      MyCtlHideControl(checkboxID_backlight);
+    }
+    else
+      MyCtlHideControl(checkboxID_vibration);
+    
     FrmDrawForm(form);
     handled = 1;
     page=2;
@@ -4233,7 +4515,6 @@
                (event->data.ctlEnter.controlID >= buttonID_m1) &&
                (event->data.ctlEnter.controlID <= buttonID_m4)
              )
-
    {
      getalarmtext(optionpage);
      optionpage=event->data.ctlEnter.controlID-buttonID_m1;
@@ -4241,6 +4522,9 @@
    } else if (event->data.ctlEnter.controlID == checkboxID_backlight)
    {
      bco->backlight=GetCheckBox(checkboxID_backlight);
+   } else if (event->data.ctlEnter.controlID == checkboxID_vibration)
+   {
+     bco->backlight=GetCheckBox(checkboxID_vibration);
    } else if (event->data.ctlEnter.controlID == checkboxID_talelight)
    {
      bco->talelight=GetCheckBox(checkboxID_talelight);
@@ -4316,6 +4600,8 @@
   }
   return handled;
 }
+
+
 void setsoundlabels()
 {
    int iii;
@@ -4409,7 +4695,8 @@
   prefs.sounds[obase].count=StrAToI(text);
 }
 
-void testsound(int num)
+
+void PlayAlarmSound(BigClockSound *sound, Boolean ignoresystemsoundoff)
 {
   int iii;
   int jjj;
@@ -4423,32 +4710,27 @@
   jjj=0;
   quit=false;
 
-
-  if ( prefs.sounds[num].type == 0)
+  if ( sound->type == 0)
   {
     last=TimGetTicks();
-    while ( (iii< prefs.sounds[num].count) && (!quit) )
+    while ( (iii< sound->count) && (!quit) )
     {
       EvtGetEvent(&event, wait);
 
       if (SysHandleEvent (&event)) continue;
       if (event.eType == penDownEvent) return;
-
       if ((TimGetTicks()-last) < wait) continue;
 
-
-
-
-      if (prefs.sounds[num].freq[jjj] >0)
+      if (sound->freq[jjj] >0)
       {
         cmd.cmd = sndCmdFreqDurationAmp;
-        cmd.param1 = prefs.sounds[num].freq[jjj];
-        cmd.param2 = prefs.sounds[num].time[jjj];
-        cmd.param3 = prefs.sounds[num].amplitude[jjj];
+        cmd.param1 = sound->freq[jjj];
+        cmd.param2 = sound->time[jjj];
+        cmd.param3 = sound->amplitude[jjj];
         SndDoCmd(0, &cmd, 0);
 
       }
-      wait=prefs.sounds[num].pause[jjj];
+      wait=sound->pause[jjj];
       last=TimGetTicks();
 
       jjj++;
@@ -4459,39 +4741,42 @@
       }
 
     }
-  } else if ( prefs.sounds[num].type == 1)
+  } else if ( sound->type == 1)
   {
-    SndPlaySystemSound(sndAlarm);
-  } else if (  prefs.sounds[num].type >= 2)
+    PlayMidiSound(0, ignoresystemsoundoff);
+  } else if (  sound->type >= 2)
   {
     wait=0;
-    while ( (jjj< prefs.sounds[num].count) && (!quit) )
+    while ( (jjj< sound->count) && (!quit) )
     {
       EvtGetEvent(&event, wait);
       wait=100;
       if (SysHandleEvent (&event)) continue;
 
       if (event.eType == penDownEvent) return;
-      CustomBeep(prefs.sounds[num].type -2);
+      CustomBeep(sound->type -2);
       jjj++;
      }
-
   }
-
 }
 
+
 Boolean optionssound(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
-  int iii;
+  int       iii;
   int       index;
   ListPtr   ListP;
   RectangleType rc = {{50,50},{60,60}};
+  char      label_stop[10];
 
   //char soundname[12];
   //Word      midicount;
   //Handle    midih;
+  //int       usemidi =1;
+
+#ifdef _TRG_
   if (isTRG)
   {
     rc.extent.x=90;
@@ -4499,15 +4784,18 @@
     rc.topLeft.x=75;
     rc.topLeft.y=75;
   }
+#endif
 
   form = FrmGetActiveForm();
   switch (event->eType)
   {
   case frmOpenEvent:
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
+#endif
 
     obase=0;
     CtlSetValue(FrmGetObjectPtr(form,FrmGetObjectIndex(form,buttonID_m1+obase)),1);
@@ -4555,20 +4843,38 @@
      form = FrmGetActiveForm();
      FrmSetFocus(form,noFocus);
 
+     if (iscolor)
+     {
+       IndexedColorType UIColor; 
+       UIColor = UIColorGetTableEntryIndex(UIDialogFrame);
+       WinSetForeColor(UIColor);
+     }
+
      WinEraseRectangle(&rc,5);
-     WinDrawRectangleFrame(roundFrame,&rc);
-     MySetFont(2);
+     WinDrawRectangleFrame(boldRoundFrame,&rc);
+     FntSetFont(2);
+
+     SysCopyStringResource(label_stop,stringID_stop);
+
+#ifdef _TRG_
      if (isTRG)
-       WinDrawChars("STOP",4,100,110);
+     {
+       WinDrawChars(label_stop,StrLen(label_stop), 
+		    120-FntCharsWidth(label_stop, StrLen(label_stop))/2, 110);
+     }
      else
-       WinDrawChars("STOP",4,68,74);
+#endif
+     {
+       WinDrawChars(label_stop,StrLen(label_stop), 
+		    80-FntCharsWidth(label_stop, StrLen(label_stop))/2, 74);
+     }
 
      getsoundlabels();
-     testsound(obase);
-     rc.extent.x+=2;
-     rc.extent.y+=2;
-     rc.topLeft.x--;
-     rc.topLeft.y--;
+     PlayAlarmSound(&prefs.sounds[obase], false);
+     rc.extent.x+=4;
+     rc.extent.y+=4;
+     rc.topLeft.x-=2;
+     rc.topLeft.y-=2;
 
      WinEraseRectangle(&rc,5);
      FrmDrawForm(form);
@@ -4597,6 +4903,7 @@
     RectangleType rcbi = {{100,40},{50,14}};
     RectangleType rcfi = {{100,58},{50,14}};
 
+#ifdef _TRG_
     if (isTRG)
     {
       rcb.topLeft.x=60;
@@ -4619,6 +4926,7 @@
       rcfi.extent.x=75;
       rcfi.extent.y=21;
     }
+#endif
 
     WinSetForeColor(prefs.colorb);
     WinDrawRectangle(&rcb,0);
@@ -4638,13 +4946,9 @@
     WinDrawRectangleFrame(1,&rcf);
     WinDrawRectangleFrame(1,&rcbi);
     WinDrawRectangleFrame(1,&rcfi);
-
-
   }
 
 
-
-
 void InitThemeList(UInt32 type,int listid,char *def)
 {
   FormPtr Form;
@@ -4656,7 +4960,6 @@
   LocalID dbid;
   int d;
 
-
   Form= FrmGetActiveForm();
   list=FrmGetObjectPtr(Form,FrmGetObjectIndex(Form,listid));
 
@@ -4699,6 +5002,7 @@
   return err;
 }
 
+
 Err SendDatabase (Word cardNo, LocalID dbID, CharPtr nameP,CharPtr descriptionP)
 {
   ExgSocketType exgSocket;
@@ -4717,7 +5021,7 @@
 }
 
 
- Boolean optionscolor(EventPtr event)
+Boolean optionscolor(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
@@ -4744,16 +5048,17 @@
   {
   case frmOpenEvent:
     page=5;
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
+#endif
 
     CloseTheme();
 
     InitThemeList('BCth',listID_theme,prefs.theme);
 
-
    //set screen mode
    index = FrmGetObjectIndex(form, popuplistID_screenmode);
    list = FrmGetObjectPtr(form, index);
@@ -4784,6 +5089,7 @@
     break;
   case penDownEvent:
       rd=false;
+#ifdef _TRG_
       if (isTRG)
       {
         cx1=60;
@@ -4793,6 +5099,7 @@
         cy2=87;
         ch=21;
       } else
+#endif
       {
         cx1=40;
         cx2=100;
@@ -4864,14 +5171,21 @@
              ThemeBonusH=DmQueryRecord(ThemeDB,1);
              ThemeBonus=MemHandleLock(ThemeBonusH);
 
-             if (
+	     if (isHR || isHD)
+	     {
+	       FrmAlert(alertID_nohirestheme);
+	       StrCopy(prefs.theme,"");
+	       MemHandleUnlock(ThemeBonusH);
+	     }
+             else if (
                   (ThemeBonus->maxdepth==3) &&
                   (romversion < 0x04000000) &&
                   (maxdepth < 16)
                 )
              {
-                FrmCustomAlert(alertID_text,"This theme requires support for 16bit graphics!",NULL,NULL);
-                StrCopy(prefs.theme,"");
+	        // FrmCustomAlert(alertID_text,"This theme requires support for 16bit graphics!",NULL,NULL);
+	       FrmAlert(alertID_need16bitcolor);
+	       StrCopy(prefs.theme,"");
              } else
              {
                if (prefs.screendepth >= 8)
@@ -4885,18 +5199,13 @@
                MemHandleUnlock(ThemeBonusH);
                ThemeBonusH=0;
                ThemeBonus=0;
-
              }
 
-
-
            DmCloseDatabase(ThemeDB);
            ThemeDB=0;
          }  
 
        }
-
-
        }
        else
          prefs.theme[0]=0;
@@ -4913,8 +5222,6 @@
 
       FrmReturnToForm(formID_bigclock);
 
-
-
       handled = 1;
     } else
     if (event->data.ctlEnter.controlID == buttonID_info)
@@ -4948,20 +5255,23 @@
 
       }  else
       {
-         FrmCustomAlert(alertID_text,"Use the build in font and no background.",NULL,NULL);
+	//FrmCustomAlert(alertID_text,"Use the build in font and no background.",NULL,NULL);
+	FrmAlert(alertID_buildinfont);
       }
     } else
     if (event->data.ctlEnter.controlID == buttonID_beam)
     {
        id=DmFindDatabase(0,prefs.theme);
-       StrCopy(beamname,prefs.theme);
-       StrCat(beamname,".pdb");
-
-       //StrCopy(beamdisplay,"BigClock theme """);
-       //StrCat(beamdisplay,prefs.theme);
-       //StrCat(beamdisplay,"""");
+       if (id !=0) {
+	 StrCopy(beamname,prefs.theme);
+	 StrCat(beamname,".pdb");
+
+	 //StrCopy(beamdisplay,"BigClock theme """);
+	 //StrCat(beamdisplay,prefs.theme);
+	 //StrCat(beamdisplay,"""");
 
-       SendDatabase (0, id, beamname,prefs.theme);
+	 SendDatabase (0, id, beamname,prefs.theme);
+       }
     } else
     if (event->data.ctlEnter.controlID == buttonID_delete)
     {
@@ -5026,8 +5336,16 @@
       }
       WinDeleteWindow(build,true);
       WinScreenMode(winScreenModeSet,NULL,NULL,&prefs.screendepth,NULL);
-      build=WinCreateOffscreenWindow(panelwidth,panelheight,screenFormat,&x);
-      //build=WinCreateOffscreenWindow(panelwidth,panelheight,genericFormat,&x);
+
+      if (isHR)
+	build = HRWinCreateOffscreenWindow(HRrefNum, panelwidth,panelheight, screenFormat, &x);
+      else
+#ifdef _SDK5_
+	build=WinCreateOffscreenWindow(panelwidth,panelheight,nativeFormat,&x);
+#else
+	build=WinCreateOffscreenWindow(panelwidth,panelheight,screenFormat,&x);
+#endif
+
       SetDeepthDefault();
 
       switch (prefs.screendepth)
@@ -5053,8 +5371,6 @@
 
      }
     }
-
-
     break;
 
     default: break;
@@ -5063,15 +5379,18 @@
    return handled;
 }
 
+
 void drawlabels()
 {
   int iii,yadd;
 
-  MySetFont(2);
+  MySetFont(0);
 
+#ifdef _TRG_
   if (isTRG)
     yadd=21;
   else
+#endif
     yadd=14;
 
   for (iii=0; iii<8; iii++)
@@ -5111,12 +5430,10 @@
     }
     StrCopy(prefs.history[free],label);
   }
-
 }
 
 
-
- Boolean labelhistory(EventPtr event)
+Boolean labelhistory(EventPtr event)
 {
   FormPtr   form;
   int       handled = 0;
@@ -5127,11 +5444,13 @@
   switch (event->eType)
   {
   case frmOpenEvent:
+#ifdef _TRG_
     if (isTRG)
     {
-      VgaFrmModify(form,vgaFormModify160To240);
+      VgaFormModify(form,vgaFormModify160To240); 
     }
-  
+#endif
+
     page=6;
 
     FrmDrawForm(form);
@@ -5241,7 +5560,6 @@
 }
 
 
-
 void initrockets(void)
 {
   rocket *r;
@@ -5250,8 +5568,8 @@
 
   backlight=0;
   FtrGet(sysFtrCreator, sysFtrNumBacklight, &backlight);
-  if (backlight>0)
-    HwrBacklight(true,true);
+  //  if (backlight>0)
+  //    HwrBacklight(true,true);
 
 
   rocketlist=MemPtrNew(sizeof(rocket)*maxrockets);
@@ -5269,6 +5587,7 @@
 
 }
 
+
 void freerockets(void)
 {
   int iii;
@@ -5280,6 +5599,7 @@
   }
 }
 
+
 int SysRandomUnder(int num)
 {
  return ( (Int)
@@ -5290,6 +5610,7 @@
         );
 }
 
+
 void addrocket(int x,int y,int xs,int ys,int time, Boolean explode, int sprite)
 {
   rocket *r;
@@ -5316,6 +5637,7 @@
 
 }
 
+
 void addexplode(int x,int y)
 {
   int s1,s2,i1,i2,t1,t2,style;
@@ -5349,6 +5671,7 @@
   }
 }
 
+
 void animaterockets()
 {
    int iii;
@@ -5395,3 +5718,80 @@
      r++;
    }
 }
+
+
+/* HiRes mode on */
+void HiResOn(void) 
+{
+  SonySysFtrSysInfoP sonySysFtrSysInfoP;
+  Err error = 0;
+
+  error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, 
+		 (UInt32*)&sonySysFtrSysInfoP);
+
+  if (!error) {
+
+    isJOG=1;
+
+    if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrHR) {
+      /* HR available */
+      if ((error = SysLibFind(sonySysLibNameHR, &HRrefNum))){
+	if (error == sysErrLibNotFound) {
+	  /* couldn't find lib */
+	  error = SysLibLoad( 'libr', sonySysFileCHRLib, &HRrefNum );
+	}
+      }
+      if (!error ) {
+	/* Now we can use HR lib */
+
+	UInt32 width, height;
+	error = HROpen(HRrefNum);
+
+	if (!error) {
+	  width = hrWidth;
+	  height = hrHeight;
+	  error = HRWinScreenMode ( HRrefNum, winScreenModeSet,
+				    &width, &height, NULL, NULL );
+	  if (!error){
+	    /* Now HiRes mode*/
+	    isHR = 1;
+	    xHR =2;
+	    isCLIE_OS5 = (romversion >= 0x05000000); // for Sony OS5 devices
+	  }
+	}
+      }
+    }
+#ifdef _SDK5_
+  } else {
+
+    UInt32 version;
+    UInt32 width;
+
+    error = FtrGet(sysFtrCreator,sysFtrNumWinVersion, &version);
+
+    if ( version >= 4){
+      WinScreenGetAttribute(winScreenWidth, &width);
+      if (width >= 320)
+	/* Enable High Density Hires mode */
+	isHD=1;
+    }
+#endif
+  }
+}
+
+
+/* (SONY) HiRes mode off */
+void HiResOff(void)
+{
+    SonySysFtrSysInfoP sonySysFtrSysInfoP;
+    Err	error = 0;
+
+    error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP,
+		   (UInt32*) &sonySysFtrSysInfoP);
+    
+    if( !error & (HRrefNum != 0)){
+	error = HRWinScreenMode(HRrefNum, winScreenModeSetToDefaults,
+				NULL, NULL, NULL, NULL);
+	error = HRClose(HRrefNum);
+    }
+}
Index: bigclock/bigclock.def
diff -u /dev/null bigclock/bigclock.def:1.2.2.1
--- /dev/null	Mon Apr 10 20:07:45 2006
+++ bigclock/bigclock.def	Thu Apr  6 16:52:44 2006
@@ -0,0 +1,2 @@
+application { BigClock BClk }
+multiple code { draw util fire option}
Index: bigclock/bigclock.h
diff -u bigclock/bigclock.h:1.1.1.1 bigclock/bigclock.h:1.11
--- bigclock/bigclock.h:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/bigclock.h	Wed Mar 29 04:00:31 2006
@@ -1,4 +1,6 @@
 // New Consts
+#define BCAppID       'BClk'
+
 #define numpanels   16
 #define numpages    numpanels / 4
 #define maxthemes   16
@@ -144,6 +146,7 @@
 #define formID_help              1013
 #define formID_global            1014
 #define formID_displayalarm      1015
+#define formID_about             1016
 
 //alerts 1050-1099
 #define alertID_info             1050
@@ -154,7 +157,9 @@
 #define alertID_help             1056
 #define alertID_text2            1057
 #define alertID_text3            1058
-
+#define alertID_buildinfont      1059
+#define alertID_need16bitcolor   1060
+#define alertID_nohirestheme     1061
 
 //bitmaps 1100-1199
 #define bitmapID_num0            1000
@@ -186,7 +191,10 @@
 #define bitmapID_list            1058
 #define bitmapID_mona            1059
 #define bitmapID_info            1060
-
+#define bitmapID_icon            1061
+#define bitmapID_smallicon       1062
+#define bitmapID_copy            1063
+#define bitmapID_alarm_L         1064
 
 //edits 1200-1299
 
@@ -395,6 +403,7 @@
 #define checkboxID_price         1738
 #define checkboxID_keepworld     1739
 #define checkboxID_startfirst    1740
+#define checkboxID_vibration     1741
 
 //selector 1800
 #define selectorID_reldate       1800
@@ -463,3 +472,7 @@
 #define stringID_datedialog      2058
 #define stringID_timedialog      2059
 #define stringID_notheme         2060
+#define stringID_stop            2061
+#define stringID_language        2062
+#define stringID_copyright       2063
+#define stringID_snooze          2064
Index: bigclock/bigclock.rcp
diff -u bigclock/bigclock.rcp:1.1.1.1 bigclock/bigclock.rcp:1.35.2.1
--- bigclock/bigclock.rcp:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/bigclock.rcp	Thu Apr  6 16:53:14 2006
@@ -1,8 +1,11 @@
 #include "bigclock.h"
+#include "ja.rcp"
+#include "de.rcp"
 
-TRANSLATION "english"
+#define BCLKVERSION "2.83c-ye4"
+
+TRANSLATION "ENGLISH"
 BEGIN
-  "aboutmessage"="V2.83\nThis is free software under the GNU General Public License!\n\nWritten by Jens Rupp\nEMail & WWW:\nbigclock@gacel.de\nhttp://www.gacel.de"
   "monthlist"="January February March April May June July August September October November December"
   "weekdaylist"="Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
   "MenuOptions"="Options"
@@ -14,7 +17,7 @@
   "MenuWorld"="Worldtimes..."
   "MenuTimer"="Timers..."
   "MenuSounds"="Sounds..."
-  "MenuResetData"="Reset all Data"
+  "MenuResetData"="Reset all Data..."
   "MenuHelp"="Help"
   "MenuAbout"="About"
   "MenuGlobal"="Preferences..."
@@ -40,161 +43,13 @@
   "p_2World"="2World"
   "p_Analog"="Analog"
 
-END
-
-
-TRANSLATION "deutsch"
-BEGIN
-  "Layout"="Layout"
-  "About BigClock"="Über BigClock"
-  "Set Time"="Zeit einstellen"
-
-  "MenuSettings"="Anpassen"
-  "MenuOptions"="Optionen"
-  "MenuInfo"="Info"
-  "MenuTime"="Systemzeit..."
-  "MenuGlobal"="Einstellungen..."
-  "MenuLayout"="Layout..."
-  "MenuAlarm"="Alarm..."
-  "MenuWorld"="Weltzeit..."
-  "MenuTimer"="Stoppuhr..."
-  "MenuSounds"="Töne..."
-  "MenuResetData"="Alle Daten zurücksetzen"
-  "MenuHelp"="Hilfe"
-  "MenuAbout"="Über"
-  "MenuColor"="Farbe..."
-
-  "Yes"="Ja"
-  "No"="Nein"
-  "Cancel"="Abbrechen"
-
-  "ShortTime"="Zeit"
-  "ShortAlarm"="Alarm"
-  "ShortWorld"="Welt"
-  "ShortTimer"="Stop"
-  "ShortA34"="A 3+4"
-  "ShortTimer2"="Stop2"
+  "copyright_1"="This program is distrubuted"
+  "copyright_2"="under the GPL version 2 or later."
+  "copyright_3"="See also Info. about other"
+  "copyright_4"="copyright holders."
 
-  "Time"="Zeit"
-  "Alarm"="Alarm"
-  "World"="Welt"
-  "Timer"="Stoppuhr"
-  "Sounds"="Töne"
-  "Preferences"="Einstellungen"
-
-  "Mode"="Art"
-  "Date"="Datum"
-  "No sound"="Stumm"
-  "Autoclose"="Schließen"
-  "Backlight"="Licht"
-  "Snooze"="Snooze"
-  "minutes"="Minuten"
-  "Timebase"="Zeit"
-  "Local"="Lokal"
-  "Trigger"="Auslöser"
-  "Stay on"="An bleiben"
-  "Alternate"="Wechseln"
-  "Multiply with"="Multiplizieren"
-
-  "Select Timer Date"="Datum auswählen"
-  "Select Timer Time"="Zeit auswählen"
-
-
-  "Timer 1 uses up/down buttons"="Stoppuhr 1 mit Tasten steuern"
-  "Ignore system alarm sound off"="System Alarm aus ignorieren"
-
-
-  "simple"="Einfach"
-  "reset"="Zurücksetzen"
-  "loop"="Schleife"
-  "alarm"="Alarm"
-  "alarm & loop"=   "Alarm&Schleife"
-  "go on" ="Fortsetzen"
-  "alarm & go on" = "Alarm&Weiter"
-  "every day"="Immer"
-  "selected days"="Tage"
-  "once"="Einmal"
-  "chime"="Läuten"
-
-  "World 1"="Welt 1"
-  "World 2"="Welt 2"
-  "World 3"="Welt 3"
-  "World 4"="Welt 4"
-  "Local time"="Lokale Zeit"
-  "Timer 1"="Stop 1"
-  "Timer 2"="Stop 2"
-  "Timer 3"="Stop 3"
-  "Timer 4"="Stop 4"
-  "Alarm 1"="Alarm 1"
-  "Alarm 2"="Alarm 2"
-  "Alarm 3"="Alarm 3"
-  "Alarm 4"="Alarm 4"
-
-  "Week"="Woche"
-  "Day"="Tag"
-  "Hour"="Stunde"
-  "Month"="Monat"
-
-  "Start"="Start"
-  "Stop"="Stop"
-  "Reset"="Reset"
-  "Clear"="Löschen"
-
-  "Name:"="Name:"
-  "Lock"="Sperren"
-  "Timezone:"="Zeitzone:"
-  "Warning!"="Warnung!"
-  "Are you sure to reset the options, layout, worldtimes, timer and alarms?"="Sind Sie sicher? Alle Einstellungen werden gelöscht"
-
-
-  "p_Empty"="Nix"
-  "p_Time"="Zeit"
-  "p_Month"="Monat"
-  "p_Date"="Datum"
-  "p_DateD"="DatumD"
-  "p_Alarm"="Alarm"
-  "p_Timer"="Stopp"
-  "p_TimerC"="StoppS"
-  "p_Timer+"="Stopp+"
-  "p_TimerV"="StoppV"
-  "p_2World"="2Welt"
-  "p_Analog"="Analog"
-
-  "Color"="Farbe"
-  "Normal"="Normal"
-  "Selected"="Ausgewählt"
-  "Back"="Hinterg."
-  "Text"="Text"
-  "Themes:"="Motive:"
-  "Info"="Info"
-  "Delete"="Löschen"
-  "<no theme>"="<kein Motiv>"
-
-  "Sec."="Sek."
-
-  "Use system sound"="Palm Alarm"
-  "Freq"="Freq"
-  "Ampli"="Ampli"
-  "Pause"="Pause"
-  "Repeat"="Anzahl:"
-  "times"="mal"
-  "Test"="Test"
-
-  "Tap on the numbers to change the"="Tippen Sie auf die Zahlen um die"
-  "system time. Use the preferences"="Systemzeit zu ändern. Für das Datum"
-  "application to change the date."="Programm \"Einstellen\" verwenden."
-
-  "Update world times"="Weltzeiten beibehalten"
-
-
-  "Tap here to turn off snooze!"="Hier tippen um snooze zu beenden!"
-  "monthlist"="Janua Februar März April Mai Juni Julie August September Oktober November Dezember"
-  "weekdaylist"="Sonntag Montag Dienstag Mittwoch Donnnerstag Freitag Samstag"
-  "aboutmessage"="V2.83\nDieses Programm ist unter der GNU General Public License!\n\nVon Jens Rupp\nEMail & WWW:\nbigclock@gacel.de\nhttp://www.gacel.de"
-  "Happy New Year!" = "Frohes neues Jahr!"
 END
 
-
 FORM ID formID_bigclock AT ( 0 0 160 160 )
 NOFRAME
 USABLE
@@ -202,15 +57,14 @@
 BEGIN
     TITLE "BigClock"
 
-
     PUSHBUTTON "1" ID buttonID_pageset1 AT ( 78 1 12 12) USABLE FONT 2 GROUP 2
     PUSHBUTTON "2" ID buttonID_pageset2 AT ( 91 1 12 12) USABLE FONT 2 GROUP 2
 
+    PUSHBUTTON "Time" ID buttonID_m1 AT ( 0 140 40 20) USABLE FONT LABELFONT GROUP 1
+    PUSHBUTTON "Alarm" ID buttonID_m2 AT ( 41 140 39 20) USABLE FONT LABELFONT GROUP 1
+    PUSHBUTTON "World" ID buttonID_m3 AT ( 81 140 39 20) USABLE FONT LABELFONT GROUP 1
+    PUSHBUTTON "Timer" ID buttonID_m4 AT ( 121 140 39 20) USABLE FONT LABELFONT GROUP 1
 
-    PUSHBUTTON "Time" ID buttonID_m1 AT ( 0 140 40 20) USABLE FONT 2 GROUP 1
-    PUSHBUTTON "Alarm" ID buttonID_m2 AT ( 41 140 39 20) USABLE FONT 2 GROUP 1
-    PUSHBUTTON "World" ID buttonID_m3 AT ( 81 140 39 20) USABLE FONT 2 GROUP 1
-    PUSHBUTTON "Timer" ID buttonID_m4 AT ( 121 140 39 20) USABLE FONT 2 GROUP 1
 END
 
 FORM ID formID_displayalarm AT ( 2 2 156 156 )
@@ -219,7 +73,7 @@
 MODAL
 BEGIN
   TITLE "BigClock"
-  FORMBITMAP AT(0 40) BITMAP bitmapID_alarm
+  //FORMBITMAP AT(0 40) BITMAP bitmapID_alarm
 END
 
 
@@ -228,42 +82,41 @@
 MODAL
 BEGIN
   TITLE "Timer"
-  PUSHBUTTON "1" ID buttonID_m1 AT ( 6 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "2" ID buttonID_m2 AT ( 42 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "3" ID buttonID_m3 AT ( 78 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "4" ID buttonID_m4 AT ( 114 20 35 18) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "1" ID buttonID_m1 AT ( 6 18 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "2" ID buttonID_m2 AT ( 42 18 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "3" ID buttonID_m3 AT ( 78 18 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "4" ID buttonID_m4 AT ( 114 18 35 16) USABLE FONT 2 GROUP 1
 
-  LABEL "Mode" ID 500 AT (2 42) FONT 2
-  POPUPTRIGGER "Alarm" ID popupID_mode AT (60 42 50 AUTO) LEFTANCHOR FONT 2
+  LABEL "Mode:" ID 500 AT (4 40) FONT 1
+  POPUPTRIGGER "Alarm" ID popupID_mode AT (PREVRIGHT+2 PREVTOP 50 AUTO) LEFTANCHOR FONT 0
 
-  CHECKBOX "Date" ID checkboxID_daterel AT (0 56 AUTO AUTO) FONT 2
-  SELECTORTRIGGER  "Date" ID selectorID_reldate AT (55  58 55 11) FONT 0 LEFTANCHOR
-  SELECTORTRIGGER  "Time" ID selectorID_reltime AT (105  58 35 11) FONT 0 LEFTANCHOR
+  CHECKBOX "Date:" ID checkboxID_daterel AT (4 54 AUTO AUTO) FONT 0
+  SELECTORTRIGGER  "Date" ID selectorID_reldate AT (PREVRIGHT+6 PREVTOP 55 11) FONT 0 LEFTANCHOR
+  SELECTORTRIGGER  "Time" ID selectorID_reltime AT (PREVRIGHT PREVTOP 35 11) FONT 0 LEFTANCHOR
 
-  CHECKBOX "No sound" ID checkboxID_silent AT (0 70 AUTO AUTO) FONT 2
-  CHECKBOX "Autoclose" ID checkboxID_wait AT (80 70 AUTO AUTO) FONT 2
+  CHECKBOX "No sound" ID checkboxID_silent AT (4 68 AUTO AUTO) FONT 0
+  CHECKBOX "Autoclose" ID checkboxID_wait AT (80 68 AUTO AUTO) FONT 0
 
-  CHECKBOX "Backlight" ID checkboxID_backlight AT (0 84 AUTO AUTO) FONT 2
-  CHECKBOX "Talelight" ID checkboxID_talelight AT (80 84 AUTO AUTO) FONT 2
+  CHECKBOX "Talelight" ID checkboxID_talelight AT (4 82 AUTO AUTO) FONT 0
+  CHECKBOX "Backlight" ID checkboxID_backlight AT (80 82 AUTO AUTO) FONT 0
+  CHECKBOX "Vibration" ID checkboxID_vibration AT (80 82 AUTO AUTO) FONT 0
 
-  CHECKBOX "Stay on" ID checkboxID_autooff AT (0 98 AUTO AUTO) FONT 2
-  CHECKBOX "Alternate" ID checkboxID_chess AT (80 98 AUTO AUTO) FONT 2
+  CHECKBOX "Stay on" ID checkboxID_autooff AT (4 96 AUTO AUTO) FONT 0
+  CHECKBOX "Alternate" ID checkboxID_chess AT (80 96 AUTO AUTO) FONT 0
 
-  CHECKBOX "Snooze" ID checkboxID_snooze AT (0 112 AUTO AUTO) FONT 2
-  FIELD ID editID_max AT (60 112 16 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  LABEL "x" ID 502 AT (80 112) FONT 2
-  FIELD ID editID_snooze AT (91 112 16 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  LABEL "minutes" ID 501 AT (112 112) FONT 2
+  CHECKBOX "Snooze:" ID checkboxID_snooze AT (4 110 AUTO AUTO) FONT 0
+  FIELD ID editID_max AT (PREVRIGHT+4 PREVTOP 16 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  LABEL "x" ID 502 AT (PREVRIGHT+4 PREVTOP) FONT 0
+  FIELD ID editID_snooze AT (PREVRIGHT+4 PREVTOP 16 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  LABEL "minutes" ID 501 AT (PREVRIGHT+4 PREVTOP) FONT 0
 
-  CHECKBOX "Multiply with" ID checkboxID_calc AT (0 126 AUTO AUTO) FONT 2
-  FIELD ID  editID_calc AT (91 126 48 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 6
+  CHECKBOX "Multiply with" ID checkboxID_calc AT (4 124 AUTO AUTO) FONT 0
+  FIELD ID  editID_calc AT (PREVRIGHT+4 PREVTOP 28 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 6 NUMERIC
 
+  LIST "simple" "reset" "loop" "alarm" "alarm & loop" "go on" "alarm & go on" ID popuplistID_mode AT (0 0 95 1) NONUSABLE VISIBLEITEMS 7 FONT 0
 
-
-  LIST "simple" "reset" "loop" "alarm" "alarm & loop" "go on" "alarm & go on" ID popuplistID_mode AT (0 0 95 1) NONUSABLE VISIBLEITEMS 7 FONT 2
-
-
-  BUTTON "Ok" ID buttonID_ok AT (5 142 45 AUTO)
+  BUTTON "Ok" ID buttonID_ok AT (5 140 36 AUTO)
+  NOGRAFFITISTATEINDICATOR
 END
 
 FORM ID formID_newyear AT ( 0 0 160 160 )
@@ -278,106 +131,100 @@
 MODAL
 BEGIN
   TITLE "Alarm"
-  PUSHBUTTON "1" ID buttonID_m1 AT ( 6 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "2" ID buttonID_m2 AT ( 42 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "3" ID buttonID_m3 AT ( 78 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "4" ID buttonID_m4 AT ( 114 20 35 18) USABLE FONT 2 GROUP 1
-
-  LABEL "Timebase" ID 500 AT (2 42) FONT 2
-  POPUPTRIGGER "Local" ID popupID_base AT (60 42 50 AUTO) LEFTANCHOR FONT 2
-
+  PUSHBUTTON "1" ID buttonID_m1 AT ( 6 20 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "2" ID buttonID_m2 AT ( 42 20 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "3" ID buttonID_m3 AT ( 78 20 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "4" ID buttonID_m4 AT ( 114 20 35 16) USABLE FONT 2 GROUP 1
 
-  CHECKBOX "No sound" ID checkboxID_silent AT (0 56 AUTO AUTO) FONT 2
-  CHECKBOX "Autoclose" ID checkboxID_wait AT (80 56 AUTO AUTO) FONT 2
-  CHECKBOX "Backlight" ID checkboxID_backlight AT (0 70 AUTO AUTO) FONT 2
-  CHECKBOX "Talelight" ID checkboxID_talelight AT (80 70 AUTO AUTO) FONT 2
+  LABEL "Timebase:" ID 500 AT (4 42) FONT 1
+  POPUPTRIGGER "Local" ID popupID_base AT (PREVRIGHT+2 42 50 AUTO) LEFTANCHOR FONT 0
 
+  CHECKBOX "No sound" ID checkboxID_silent AT (4 56 AUTO AUTO) FONT 0
+  CHECKBOX "Autoclose" ID checkboxID_wait AT (80 56 AUTO AUTO) FONT 0
+  CHECKBOX "Talelight" ID checkboxID_talelight AT (4 70 AUTO AUTO) FONT 0
+  CHECKBOX "Backlight" ID checkboxID_backlight AT (80 70 AUTO AUTO) FONT 0
+  CHECKBOX "Vibration" ID checkboxID_vibration AT (80 70 AUTO AUTO) FONT 0
 
-  CHECKBOX "Snooze" ID checkboxID_snooze AT (0 84 AUTO AUTO) FONT 2
-  FIELD ID editID_max AT (60 84 16 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  LABEL "x" ID 502 AT (80 84) FONT 2
-  FIELD ID editID_snooze AT (93 84 16 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  LABEL "minutes" ID 501 AT (112 84) FONT 2
+  CHECKBOX "Snooze:" ID checkboxID_snooze AT (4 84 AUTO AUTO) FONT 0
+  FIELD ID editID_max AT (PREVRIGHT+4 84 16 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  LABEL "x" ID 502 AT (PREVRIGHT+4 84) FONT 0
+  FIELD ID editID_snooze AT (PREVRIGHT+4 84 16 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  LABEL "minutes" ID 501 AT (PREVRIGHT+4 84) FONT 0
 
-  LABEL "Trigger" ID 504 AT (2 98) FONT 2
-  POPUPTRIGGER "selected days" ID popupID_trigger AT (60 98 50 AUTO) LEFTANCHOR FONT 2
+  LABEL "Trigger:" ID 504 AT (4 98) FONT 1
+  POPUPTRIGGER "selected days" ID popupID_trigger AT (PREVRIGHT+2 98 50 AUTO) LEFTANCHOR FONT 0
 
-  BUTTON "Ok" ID buttonID_ok AT (5 116 45 AUTO)
+  BUTTON "Ok" ID buttonID_ok AT (5 117 36 AUTO)
 
-  LIST "Local" "World 1" "World 2" "World 3" "World 4" ID popuplistID_times AT (0 0 69 1) NONUSABLE VISIBLEITEMS 5 FONT 2
-  LIST "every day" "selected days" "once" "chime" ID popuplistID_trigger AT (0 0 80 1) NONUSABLE VISIBLEITEMS 4 FONT 2
+  LIST "Local" "World 1" "World 2" "World 3" "World 4" ID popuplistID_times AT (0 0 69 1) NONUSABLE VISIBLEITEMS 5 FONT 0
+  LIST "every day" "selected days" "once" "chime" ID popuplistID_trigger AT (0 0 80 1) NONUSABLE VISIBLEITEMS 4 FONT 0
 
+  NOGRAFFITISTATEINDICATOR
 END
 
-FORM ID formID_world AT ( 2 50 156 108)
+
+FORM ID formID_world AT ( 2 52 156 106)
 USABLE
 MODAL
 BEGIN
   TITLE "World"
-  PUSHBUTTON "L" ID buttonID_ml AT ( 6 20 28 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "1" ID buttonID_m1 AT ( 35 20 28 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "2" ID buttonID_m2 AT ( 64 20 28 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "3" ID buttonID_m3 AT ( 93 20 28 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "4" ID buttonID_m4 AT ( 122 20 28 18) USABLE FONT 2 GROUP 1
-
-
-
-  LABEL "Name:" ID 500 AT (2 42) FONT 2
-  FIELD ID editID_name AT (60 42  75 AUTO) USABLE FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 11
-
+  PUSHBUTTON "L" ID buttonID_ml AT ( 6 20 28 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "1" ID buttonID_m1 AT ( 35 20 28 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "2" ID buttonID_m2 AT ( 64 20 28 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "3" ID buttonID_m3 AT ( 93 20 28 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "4" ID buttonID_m4 AT ( 122 20 28 16) USABLE FONT 2 GROUP 1
 
-  CHECKBOX "Lock" ID checkboxID_lock AT (0 56 AUTO AUTO) FONT 2
-  LABEL "Timezone:" ID 500 AT (2 70) FONT 2
+  LABEL "Name:" ID 500 AT (RIGHT@60 PREVBOTTOM+6) FONT 1
+  FIELD ID editID_name AT (PREVRIGHT+6 42 60 AUTO) USABLE FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 12
 
+  LABEL "Timezone:" ID 500 AT (RIGHT@60 PREVBOTTOM+2) FONT 1
 
-
-  POPUPTRIGGER "+" ID popupID_tzd AT (62 70 26 AUTO)  LEFTANCHOR FONT 2
+  POPUPTRIGGER "+" ID popupID_tzd AT (PREVRIGHT+4 PREVTOP 26 AUTO)  LEFTANCHOR FONT 0
   POPUPLIST ID popupID_tzd listID_tzd
-  LIST "+" "-" ID listID_tzd AT (60 70 20 AUTO) NONUSABLE DISABLED FONT 2 VISIBLEITEMS 2
-
+  LIST "+" "-" ID listID_tzd AT (PREVRIGHT-30 PREVTOP 20 AUTO) NONUSABLE DISABLED FONT 0 VISIBLEITEMS 2
 
-  FIELD ID editID_tzh AT (90 70 15 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 2
-  LABEL "h" ID 500 AT (107 70) FONT 2
-  FIELD ID editID_tzm AT (116 70 20 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 2
-  LABEL "m" ID 500 AT (138 70) FONT 2
+  FIELD ID editID_tzh AT (PREVRIGHT+8 PREVTOP 12 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 2 NUMERIC
+  LABEL "h" ID 500 AT (PREVRIGHT+4 PREVTOP) FONT 0
+  FIELD ID editID_tzm AT (PREVRIGHT+6 PREVTOP 12 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 2 NUMERIC
+  LABEL "m" ID 500 AT (PREVRIGHT+4 PREVTOP) FONT 0
 
+  LABEL "Lock:" AUTOID at (RIGHT@60 PREVBOTTOM+2) FONT 1
+  CHECKBOX "" ID checkboxID_lock AT (PREVRIGHT+4 PREVTOP AUTO AUTO) FONT 0 LEFTANCHOR
 
 
-  BUTTON "Ok" ID buttonID_ok AT (5 90 45 AUTO)
+  BUTTON "Ok" ID buttonID_ok AT (5 89 36 AUTO)
+  GRAFFITISTATEINDICATOR AT (142 PREVTOP+2)
 END
 
-FORM ID formID_global AT ( 2 74 156 84)
+FORM ID formID_global AT ( 2 66 156 92)
 USABLE
 MODAL
 BEGIN
   TITLE "Preferences"
 
-  CHECKBOX "Timer 1 uses up/down buttons" ID checkboxID_hardware AT (0 16 AUTO AUTO) FONT 0
-  CHECKBOX "Ignore system alarm sound off" ID checkboxID_soundoff AT (0 28 AUTO AUTO) FONT 0
-  CHECKBOX "Lock timer layout" ID checkboxID_locktimer AT (0 40 AUTO AUTO) FONT 0
-  CHECKBOX "Always start on first page" ID checkboxID_startfirst AT (0 52 AUTO AUTO) FONT 0
+  CHECKBOX "Timer 1 uses up/down buttons" ID checkboxID_hardware AT (4 16 AUTO AUTO) FONT 0
+  CHECKBOX "Ignore system alarm sound off" ID checkboxID_soundoff AT (PREVLEFT PREVBOTTOM+1 AUTO AUTO) FONT 0
+  CHECKBOX "Lock timer layout" ID checkboxID_locktimer AT (PREVLEFT PREVBOTTOM+1 AUTO AUTO) FONT 0
+  CHECKBOX "Always start on first page" ID checkboxID_startfirst AT (PREVLEFT PREVBOTTOM+1 AUTO AUTO) FONT 0
 
-  BUTTON "Ok" ID buttonID_ok AT (5 66 45 AUTO)
+  BUTTON "Ok" ID buttonID_ok AT (5 PREVTOP+20 36 AUTO)
 END
 
-
 ALERT ID formID_sure
-CONFIRMATION
+WARNING
 BEGIN
   TITLE "Warning!"
   MESSAGE "Are you sure to reset the options, layout, worldtimes, timer and alarms?"
   BUTTONS "Yes" "No"
 END
 
-
 //TITLE "Layout"
 FORM ID formID_layout AT ( 2 2 156 156 )
 USABLE
 MODAL
 BEGIN
 
-
-  FIELD ID editID_time AT (2 2 78 AUTO) USABLE LEFTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
+  FIELD ID editID_time AT (2 2 78 AUTO) USABLE LEFTALIGN FONT 1 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
 
   POPUPTRIGGER "Date" ID popupID_panel11g AT (0 13 50 AUTO) LEFTANCHOR
   POPUPTRIGGER "L" ID popupID_panel11t AT (50 13 30 AUTO) LEFTANCHOR
@@ -389,7 +236,7 @@
   CHECKBOX "Sec." ID checkboxID_time2a AT (88 24 AUTO AUTO)
   CHECKBOX "24h" ID checkboxID_time2b AT (122 24 AUTO AUTO)
 
-  FIELD ID editID_alarm AT (2 36 78 AUTO) USABLE LEFTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
+  FIELD ID editID_alarm AT (2 36 78 AUTO) USABLE LEFTALIGN FONT 1 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
 
   POPUPTRIGGER "Alarm" ID popupID_panel21g AT (0 47 50 AUTO) LEFTANCHOR
   POPUPTRIGGER "1" ID popupID_panel21t AT (50 47 30 AUTO) LEFTANCHOR
@@ -401,7 +248,7 @@
   CHECKBOX "Sec." ID checkboxID_alarm2a AT (88 58 AUTO AUTO)
   CHECKBOX "24h" ID checkboxID_alarm2b AT (122 58 AUTO AUTO)
 
-  FIELD ID editID_world AT (2 70 78 AUTO) USABLE LEFTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
+  FIELD ID editID_world AT (2 70 78 AUTO) USABLE LEFTALIGN FONT 1 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
 
   POPUPTRIGGER "Time" ID popupID_panel31g AT (0 81 50 AUTO) LEFTANCHOR
   POPUPTRIGGER "1" ID popupID_panel31t AT (50 81 30 AUTO) LEFTANCHOR
@@ -413,7 +260,7 @@
   CHECKBOX "Sec." ID checkboxID_world2a AT (88 92 AUTO AUTO)
   CHECKBOX "24h" ID checkboxID_world2b AT (122 92 AUTO AUTO)
 
-  FIELD ID editID_timer AT (2 104 78 AUTO) USABLE LEFTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
+  FIELD ID editID_timer AT (2 104 78 AUTO) USABLE LEFTALIGN FONT 1 EDITABLE UNDERLINED SINGLELINE MAXCHARS 8
 
   POPUPTRIGGER "Timer" ID popupID_panel41g AT (0 115 50 AUTO) LEFTANCHOR
   POPUPTRIGGER "1" ID popupID_panel41t AT (50 115 30 AUTO) LEFTANCHOR
@@ -456,8 +303,8 @@
        "4"
         ID popuplistID_alarmlist AT (50 PrevTop 30 1) NONUSABLE VISIBLEITEMS 4 FONT 1
 
-
-  BUTTON "Ok" ID buttonID_ok AT (3 142 45 AUTO)
+  BUTTON "Ok" ID buttonID_ok AT (4 141 36 AUTO)
+  GRAFFITISTATEINDICATOR  AT (142 142)
 END
 
 FORM ID formID_sound AT ( 2 2 156 156 )
@@ -466,56 +313,54 @@
 BEGIN
   TITLE "Sounds"
 
-  PUSHBUTTON "1" ID buttonID_m1 AT ( 6 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "2" ID buttonID_m2 AT ( 42 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "3" ID buttonID_m3 AT ( 78 20 35 18) USABLE FONT 2 GROUP 1
-  PUSHBUTTON "4" ID buttonID_m4 AT ( 114 20 35 18) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "1" ID buttonID_m1 AT ( 6 18 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "2" ID buttonID_m2 AT ( 42 PREVTOP 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "3" ID buttonID_m3 AT ( 78 PREVTOP 35 16) USABLE FONT 2 GROUP 1
+  PUSHBUTTON "4" ID buttonID_m4 AT ( 114 PREVTOP 35 16) USABLE FONT 2 GROUP 1
 
 
-  LABEL "Sound:" ID 500 AT (2 40) FONT 2
+  LABEL "Sound:" ID 500 AT (5 38) FONT 1
 
-  POPUPTRIGGER "Custom" ID popupID_soundtypes AT (50 40 80 AUTO) LEFTANCHOR FONT 2
+  POPUPTRIGGER "Custom" ID popupID_soundtypes AT (PREVRIGHT+4 PREVTOP 80 AUTO) LEFTANCHOR FONT 0
   LIST "Custom"
        "System"
        "Zirp"
        "Emergency"
-        ID popuplistID_soundtypes AT (50 PrevTop 80 1) NONUSABLE VISIBLEITEMS 4 FONT 2
-
-
-
-  LABEL "Freq" ID labelID_soundfreq  AT (2 55) FONT 2
-  LABEL "Time" ID labelID_soundtime  AT (41 55) FONT 2
-  LABEL "Ampli" ID labelID_soundampli  AT (79 55) FONT 2
-  LABEL "Pause" ID labelID_soundpause  AT (118 55) FONT 2
-
-  FIELD ID editID_soundf1 AT (2 69 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundt1 AT (41 69 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_sounda1 AT (79 69 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundp1 AT (118 69 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-
-  FIELD ID editID_soundf2 AT (2 83 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundt2 AT (41 83 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_sounda2 AT (79 83 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundp2 AT (118 83 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-
-  FIELD ID editID_soundf3 AT (2 97 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundt3 AT (41 97 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_sounda3 AT (79 97 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundp3 AT (118 97 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-
-  FIELD ID editID_soundf4 AT (2 111 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundt4 AT (41 111 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_sounda4 AT (79 111 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  FIELD ID editID_soundp4 AT (118 111 34 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-
-  LABEL "Repeat" ID 500 AT (2 125) FONT 2
-  FIELD ID editID_soundr AT (48 125 25 AUTO) USABLE RIGHTALIGN FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4
-  LABEL "times" ID 500 AT (78 125) FONT 2
-
-  BUTTON "Test" ID buttonID_test AT (116 127 35 9)
-
-  BUTTON "Ok" ID buttonID_ok AT (5 142 45 AUTO)
+        ID popuplistID_soundtypes AT (PREVLEFT PrevTop 80 1) NONUSABLE VISIBLEITEMS 4 FONT 0
 
+  LABEL "Freq" ID labelID_soundfreq  AT (CENTER@20 PREVTOP+14) FONT 0
+  LABEL "Length" ID labelID_soundtime  AT (CENTER@58 PREVTOP) FONT 0
+  LABEL "Ampli" ID labelID_soundampli  AT (CENTER@96 PREVTOP) FONT 0
+  LABEL "Pause" ID labelID_soundpause  AT (CENTER@134 PREVTOP) FONT 0
+
+  FIELD ID editID_soundf1 AT (4 PREVBOTTOM+1 32 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundt1 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_sounda1 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundp1 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+
+  FIELD ID editID_soundf2 AT (4 PREVBOTTOM+2 PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundt2 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_sounda2 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundp2 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+
+  FIELD ID editID_soundf3 AT (4 PREVBOTTOM+2 PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundt3 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_sounda3 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundp3 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+
+  FIELD ID editID_soundf4 AT (4 PREVBOTTOM+2 PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundt4 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_sounda4 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  FIELD ID editID_soundp4 AT (PREVRIGHT+6 PREVTOP PREVWIDTH AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+
+  LABEL "Repeat:" ID 500 AT (5 PREVBOTTOM+3) FONT 1
+  FIELD ID editID_soundr AT (PREVRIGHT+4 PREVTOP 25 AUTO) USABLE RIGHTALIGN FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 4 NUMERIC
+  LABEL "times" ID 500 AT (PREVRIGHT+4 PREVTOP) FONT 0
+
+
+  BUTTON "Ok" ID buttonID_ok AT (5 140 36 AUTO)
+  BUTTON "Test" ID buttonID_test AT (PREVRIGHT+6 PREVTOP AUTO AUTO)
+  NOGRAFFITISTATEINDICATOR
 END
 
 FORM ID formID_color AT ( 2 2 156 156 )
@@ -524,59 +369,53 @@
 BEGIN
   TITLE "Theme & Color"
 
-  LABEL "Screen:" ID 500 AT (2 14) FONT 2
-  POPUPTRIGGER "Black & White" ID popupID_screenmode AT (50 14 110 AUTO) LEFTANCHOR FONT 2
+  LABEL "Screen:" ID 500 AT (5 14) FONT 1
+  POPUPTRIGGER "Black & White" ID popupID_screenmode AT (55 14 AUTO AUTO) LEFTANCHOR FONT 0
   LIST "Black & White"
        "4 Grayscale"
        "16 Grayscale"
        "256 Color"
        "64k Color"
-        ID popuplistID_screenmode AT (50 PrevTop 110 1) NONUSABLE VISIBLEITEMS 5 FONT 2
-
+        ID popuplistID_screenmode AT (50 PrevTop 108 1) NONUSABLE VISIBLEITEMS 5 FONT 0
 
-  LABEL "Normal" ID 500 AT (40 28) FONT 0
-  LABEL "Selected" ID 500 AT (100 28) FONT 0
-  LABEL "Back" ID 500 AT (4 42) FONT 0
-  LABEL "Text" ID 500 AT (4 60) FONT 0
+  LABEL "Normal" ID 500 AT (40 28)
+  LABEL "Selected" ID 500 AT (100 28)
+  LABEL "Back" ID 500 AT (5 42)
+  LABEL "Text" ID 500 AT (5 60)
 
-  LABEL "Themes:" ID 500 AT (4 74) FONT 2
-  LIST "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" ID listID_theme AT(4 90 105 44) FONT 0
+  LABEL "Themes:" ID 500 AT (5 74) FONT 1
+  LIST "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" ID listID_theme AT(5 90 104 44) FONT 0
   BUTTON "Info" ID buttonID_info AT (115 90 35 AUTO)
   BUTTON "Beam" ID buttonID_beam AT (115 106 35 AUTO)
   BUTTON "Delete" ID buttonID_delete AT (115 122 35 AUTO)
 
 
-  BUTTON "Ok" ID buttonID_ok AT (5 140 45 AUTO)
+  BUTTON "Ok" ID buttonID_ok AT (5 140 36 AUTO)
 END
 
-
-
 FORM ID formID_history AT ( 2 2 156 156 )
 USABLE
 MODAL
 BEGIN
   TITLE "History"
 
-  LABEL "1." ID 500 AT (2 14) FONT 2
-  LABEL "2." ID 500 AT (2 28) FONT 2
-  LABEL "3." ID 500 AT (2 42) FONT 2
-  LABEL "4." ID 500 AT (2 56) FONT 2
-  LABEL "5." ID 500 AT (2 70) FONT 2
-  LABEL "6." ID 500 AT (2 84) FONT 2
-  LABEL "7." ID 500 AT (2 98) FONT 2
-  LABEL "8." ID 500 AT (2 112) FONT 2
+  LABEL "1." ID 500 AT (2 14) FONT 0
+  LABEL "2." ID 500 AT (2 28) FONT 0
+  LABEL "3." ID 500 AT (2 42) FONT 0
+  LABEL "4." ID 500 AT (2 56) FONT 0
+  LABEL "5." ID 500 AT (2 70) FONT 0
+  LABEL "6." ID 500 AT (2 84) FONT 0
+  LABEL "7." ID 500 AT (2 98) FONT 0
+  LABEL "8." ID 500 AT (2 112) FONT 0
 
-  LABEL "New:" ID 500 AT (2 126) FONT 2
-  FIELD ID editID_edit1 AT (40 126 80 AUTO) USABLE FONT 2 EDITABLE UNDERLINED SINGLELINE MAXCHARS 11
+  LABEL "New:" ID 500 AT (2 126) FONT 0
+  FIELD ID editID_edit1 AT (40 126 80 AUTO) USABLE FONT 0 EDITABLE UNDERLINED SINGLELINE MAXCHARS 11
   GRAFFITISTATEINDICATOR  AT (140 142)
 
-  BUTTON "Set" ID buttonID_set AT (5 142 45 AUTO)
-  BUTTON "Cancel" ID buttonID_cancel AT (55 142 45 AUTO)
-
+  BUTTON "Set" ID buttonID_set AT (5 142 36 AUTO)
+  BUTTON "Cancel" ID buttonID_cancel AT (PREVRIGHT+6 142 36 AUTO)
 END
 
-
-
 FORM ID formID_localtime AT ( 0 0 160 160 )
 USABLE
 MODAL
@@ -587,42 +426,66 @@
   LABEL "system time. Use the preferences" ID 500 AT (2 26) FONT 0
   LABEL "application to change the date." ID 500 AT (2 36) FONT 0
 
+  CHECKBOX "Update world times" ID checkboxID_keepworld AT (0 126 AUTO AUTO) FONT 0
 
-  CHECKBOX "Update world times" ID checkboxID_keepworld AT (0 124 AUTO AUTO) FONT 2
-
+  BUTTON "Ok" ID buttonID_ok AT (1 147 36 AUTO)
+  BUTTON "Cancel" ID buttonID_cancel AT (PREVRIGHT+6 PREVTOP 36 AUTO)
+END
 
-  BUTTON "Ok" ID buttonID_ok AT (3 142 45 AUTO)
-  BUTTON "Cancel" ID buttonID_cancel AT (54 142 45 AUTO)
+FORM ID formID_about AT (2 2 156 156)
+USABLE
+SAVEBEHIND
+HELPID stringID_copyright
+MODAL
+FRAME
+BEGIN
+    TITLE "About BigClock"
+    FORMBITMAP at (13 23) BITMAP bitmapID_icon
+    LABEL "BigClock" AUTOID AT (PREVLEFT+39 PREVTOP-4) FONT 7
+    LABEL "Ver. " AUTOID  AT (PREVLEFT PREVTOP+18) FONT 1
+    LABEL BCLKVERSION AUTOID  AT (PREVRIGHT PREVTOP) FONT 1
 
-END
+    LABEL "1998-2001 Jens Rupp." AUTOID  AT (20 PREVTOP+20)
+    FORMBITMAP at (PREVLEFT-10 PREVTOP+1) BITMAP bitmapID_copy
+    //LABEL "2002 Ling Nero." AUTOID  AT (PREVLEFT+10 PREVTOP+11)
+    //FORMBITMAP at (PREVLEFT-10 PREVTOP+1) BITMAP bitmapID_copy
+    LABEL "2006 Yoshizumi Endo." AUTOID  AT (PREVLEFT+10 PREVTOP+11)
+    FORMBITMAP at (PREVLEFT-10 PREVTOP+1) BITMAP bitmapID_copy
 
+    LABEL "copyright_1" AUTOID  AT (PREVLEFT PREVTOP+16)
+    LABEL "copyright_2" AUTOID  AT (PREVLEFT PREVTOP+11)
+    LABEL "copyright_3" AUTOID  AT (PREVLEFT PREVTOP+11)
+    LABEL "copyright_4" AUTOID  AT (PREVLEFT PREVTOP+11)
 
-VERSION ID 1 "2.83"
+    BUTTON "OK" AUTOID AT (CENTER@156/2 140 36 auto)
+END
 
-ICONFAMILY "logo.bmp" "" "" "logo256.bmp"
-SMALLICONFAMILY "logos.bmp" "" "" "logos256.bmp"
-ICONFAMILY ID 2000 "logo_trg.bmp" "" "" ""
-ICONFAMILY ID 2001 "logo_trg_s.bmp" "" "" ""
-ICONFAMILY ID 2002 "logo_trg_i.bmp" "" "" ""
 
 
-//BITMAP ID bitmapID_infoicon  "infoicon.bmp"
-//BITMAP ID bitmapID_infoiconi  "infoiconi.bmp"
+ICONFAMILY "bitmaps/logo.bmp" "" "" "bitmaps/logo256.bmp" TRANSPARENTINDEX 0
 
+SMALLICONFAMILY "bitmaps/logos.bmp" "" "" "bitmaps/logos256.bmp" TRANSPARENTINDEX 0
 
-BITMAP ID bitmapID_alarm  "alarm.bmp" 
-//BITMAP ID bitmapID_large  "large3.bmp"
+ICONFAMILY ID 2000 "bitmaps/logo_trg.bmp" "" "" ""
+ICONFAMILY ID 2001 "bitmaps/logo_trg_s.bmp" "" "" ""
+ICONFAMILY ID 2002 "bitmaps/logo_trg_i.bmp" "" "" ""
 
+BITMAP ID bitmapID_icon "bitmaps/logo.bmp" "" "" "bitmaps/logo256.bmp" TRANSPARENTINDEX 0
+BITMAP ID bitmapID_smallicon "bitmaps/logos.bmp" "" "" "bitmaps/logos256.bmp" TRANSPARENTINDEX 0
 
+BITMAP ID bitmapID_copy "bitmaps/copyright.xbm" TRANSPARENTINDEX 0
 
+//BITMAP ID bitmapID_infoicon  "bitmaps/infoicon.bmp"
+//BITMAP ID bitmapID_infoiconi  "bitmaps/infoiconi.bmp"
 
-BITMAPFAMILY ID  bitmapID_circlelarge  "circle_big.bmp" "" "" "circle_big256.bmp"
-BITMAPFAMILY ID  bitmapID_circlesmall  "circle_small.bmp" "" "" "circle_small256.bmp"
-BITMAPFAMILY ID  bitmapID_circletiny   "circle_tiny.bmp" "" "" "circle_tiny256.bmp"
-BITMAPFAMILY ID  bitmapID_starlarge    "star_large.bmp" "" "" "star_large256.bmp"
-BITMAPFAMILY ID  bitmapID_starsmall    "star_small.bmp" "" "" "star_small256.bmp"
-BITMAPFAMILY ID  bitmapID_startiny     "star_tiny.bmp" "" "" "star_tiny256.bmp"
+//BITMAP ID bitmapID_large  "bitmaps/large3.bmp"
 
+BITMAPFAMILY ID  bitmapID_circlelarge  "bitmaps/circle_big.bmp" "" "" "bitmaps/circle_big256.bmp"
+BITMAPFAMILY ID  bitmapID_circlesmall  "bitmaps/circle_small.bmp" "" "" "bitmaps/circle_small256.bmp"
+BITMAPFAMILY ID  bitmapID_circletiny   "bitmaps/circle_tiny.bmp" "" "" "bitmaps/circle_tiny256.bmp"
+BITMAPFAMILY ID  bitmapID_starlarge    "bitmaps/star_large.bmp" "" "" "bitmaps/star_large256.bmp"
+BITMAPFAMILY ID  bitmapID_starsmall    "bitmaps/star_small.bmp" "" "" "bitmaps/star_small256.bmp"
+BITMAPFAMILY ID  bitmapID_startiny     "bitmaps/star_tiny.bmp" "" "" "bitmaps/star_tiny256.bmp"
 
 ALERT ID alertID_info
 INFORMATION
@@ -632,7 +495,6 @@
   BUTTONS "OK"
 END
 
-
 MENU ID menuID_bigclock
 BEGIN
   PULLDOWN "MenuSettings"
@@ -640,6 +502,7 @@
     MENUITEM "MenuAlarm"    menuitemID_alarm  "a"
     MENUITEM "MenuWorld"    menuitemID_world  "w"
     MENUITEM "MenuTimer"    menuitemID_timer  "t"
+    MENUITEM SEPARATOR
     MENUITEM "MenuSounds"    menuitemID_sounds  "o"
   END  
 
@@ -658,7 +521,7 @@
   END
 END
 
-STRING ID stringID_help "BigClock V2.83\n"\
+STRING ID stringID_help
 "SETTING WORLDTIME \n"\
 "Tap on the upper half of the digit to increase, tap on the lower half to decrease.\n"\
 "SETTING ALARM\n"\
@@ -667,13 +530,23 @@
 "The vertical 1-4 are the different alarm sounds. Change them in the sound options.\n"\
 "For more details look into the documentation."
 
+STRING ID stringID_copyright
+"Copyright 1998-2001 Jens Rupp.\n"\
+"Original author\n\n"\
+"Copyright 1999 Tetsuji Yoshikawa.\n"\
+"Original Japanese translator\n\n"\
+"Copyright 2002 Ling Nero.\n"\
+"Modified to not mess up Clie hi-res screens after alarm triggered.\n\n"\
+"Copyleft 2002, 2003 Free Software Foundation.\n"\
+"FreeSans Font on HiRes mode.\n\n"\
+"Copyright 2006 Yoshizumi Endo.\n"\
+"Added some Japanese translations and HiRes mode support."
+
 HEX "hSTR" ID stringID_help
 "<tBigClock>"\
 "<ac>BigClock</a>" \
 "Test <f2>font</f> Test"
 
-
-
 ALERT ID alertID_text
 INFORMATION
 BEGIN
@@ -690,6 +563,30 @@
   BUTTONS "OK" "Cancel"
 END
 
+ALERT ID alertID_buildinfont
+INFORMATION
+BEGIN
+  TITLE "Information"
+  MESSAGE "Use the build in font and no background."
+  BUTTONS "OK"
+END
+
+ALERT ID alertID_need16bitcolor
+INFORMATION
+BEGIN
+  TITLE "Information"
+  MESSAGE "This theme requires support for 16bit graphics!"
+  BUTTONS "OK"
+END
+
+ALERT ID alertID_nohirestheme
+INFORMATION
+BEGIN
+  TITLE "Information"
+  MESSAGE "No theme support on HiRes mode."
+  BUTTONS "OK"
+END
+
 
 ALERT ID alertID_text2
 INFORMATION
@@ -705,7 +602,6 @@
   BUTTONS "OK"
 END
 
-
 STRING ID stringID_localtime "Local time"
 STRING ID stringID_world1 "World 1"
 STRING ID stringID_world2 "World 2"
@@ -720,7 +616,6 @@
 STRING ID stringID_alarm3 "Alarm 3"
 STRING ID stringID_alarm4 "Alarm 4"
 
-
 STRING ID stringID_pagenames00 "ShortTime"
 STRING ID stringID_pagenames01 "ShortAlarm"
 STRING ID stringID_pagenames02 "ShortWorld"
@@ -758,6 +653,10 @@
 STRING ID stringID_months "monthlist"
 
 STRING ID stringID_stopsnooze "Tap here to turn off snooze!"
+STRING ID stringID_snooze "Snooze "
+
+STRING ID stringID_stop "STOP"
+STRING ID stringID_language "language"
 
 HEX "sKst" ID 1000 "StarKist Aware"
 
@@ -767,19 +666,42 @@
 
 STRING ID 7169 "Default"
 
-BITMAP  ID 7184 "num0.bmp"
-BITMAP  ID 7185 "num1.bmp"
-BITMAP  ID 7186 "num2.bmp"
-BITMAP  ID 7187 "num3.bmp"
-BITMAP  ID 7188 "num4.bmp"
-BITMAP  ID 7189 "num5.bmp"
-BITMAP  ID 7190 "num6.bmp"
-BITMAP  ID 7191 "num7.bmp"
-BITMAP  ID 7192 "num8.bmp"
-BITMAP  ID 7193 "num9.bmp"
-BITMAP  ID 7194 "slash.bmp"
-BITMAP  ID 7195 "points.bmp"
-BITMAP  ID 7196 "point.bmp"
-BITMAP  ID 7197 "dash.bmp"
-BITMAP  ID 7198 "am.bmp"
-BITMAP  ID 7199 "pm.bmp"  
+BITMAP  ID 7184 "bitmaps/num0.bmp"
+BITMAP  ID 7185 "bitmaps/num1.bmp"
+BITMAP  ID 7186 "bitmaps/num2.bmp"
+BITMAP  ID 7187 "bitmaps/num3.bmp"
+BITMAP  ID 7188 "bitmaps/num4.bmp"
+BITMAP  ID 7189 "bitmaps/num5.bmp"
+BITMAP  ID 7190 "bitmaps/num6.bmp"
+BITMAP  ID 7191 "bitmaps/num7.bmp"
+BITMAP  ID 7192 "bitmaps/num8.bmp"
+BITMAP  ID 7193 "bitmaps/num9.bmp"
+BITMAP  ID 7194 "bitmaps/slash.bmp"
+BITMAP  ID 7195 "bitmaps/points.bmp"
+BITMAP  ID 7196 "bitmaps/point.bmp"
+BITMAP  ID 7197 "bitmaps/dash.bmp"
+BITMAP  ID 7198 "bitmaps/am.bmp"
+BITMAP  ID 7199 "bitmaps/pm.bmp"  
+BITMAP  ID bitmapID_alarm "bitmaps/alarm.bmp" 
+
+BITMAP  ID 7284 "bitmaps/num_freesans/num0.bmp"
+BITMAP  ID 7285 "bitmaps/num_freesans/num1.bmp"
+BITMAP  ID 7286 "bitmaps/num_freesans/num2.bmp"
+BITMAP  ID 7287 "bitmaps/num_freesans/num3.bmp"
+BITMAP  ID 7288 "bitmaps/num_freesans/num4.bmp"
+BITMAP  ID 7289 "bitmaps/num_freesans/num5.bmp"
+BITMAP  ID 7290 "bitmaps/num_freesans/num6.bmp"
+BITMAP  ID 7291 "bitmaps/num_freesans/num7.bmp"
+BITMAP  ID 7292 "bitmaps/num_freesans/num8.bmp"
+BITMAP  ID 7293 "bitmaps/num_freesans/num9.bmp"
+BITMAP  ID 7294 "bitmaps/num_freesans/slash.bmp"
+BITMAP  ID 7295 "bitmaps/num_freesans/points.bmp"
+BITMAP  ID 7296 "bitmaps/num_freesans/point.bmp"
+BITMAP  ID 7297 "bitmaps/num_freesans/dash.bmp"
+BITMAP  ID 7298 "bitmaps/num_freesans/am.bmp"
+BITMAP  ID 7299 "bitmaps/num_freesans/pm.bmp"  
+BITMAP  ID bitmapID_alarm_L "bitmaps/num_freesans/alarm.bmp" 
+
+APPLICATIONICONNAME ID 1000 "BigClock"
+APPLICATION ID 1 "BClk"
+VERSION ID 1 BCLKVERSION
Index: bigclock/bigclocktypes.h
diff -u bigclock/bigclocktypes.h:1.1.1.1 bigclock/bigclocktypes.h:1.2
--- bigclock/bigclocktypes.h:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/bigclocktypes.h	Sat Feb 11 17:24:15 2006
@@ -89,7 +89,7 @@
 
 typedef struct
         {
-          char             name[12];      // name of time
+          char             name[13];      // name of time
           long             value;         // current value
           long             reset;         // reset value
           long             date;          // date for relative timer
Index: bigclock/de.rcp
diff -u /dev/null bigclock/de.rcp:1.2
--- /dev/null	Mon Apr 10 20:07:45 2006
+++ bigclock/de.rcp	Sun Feb  5 19:16:39 2006
@@ -0,0 +1,150 @@
+TRANSLATION "DEUTSCH"
+BEGIN
+  "Layout"="Layout"
+  "About BigClock"="Über BigClock"
+  "Set Time"="Zeit einstellen"
+
+  "MenuSettings"="Anpassen"
+  "MenuOptions"="Optionen"
+  "MenuInfo"="Info"
+  "MenuTime"="Systemzeit..."
+  "MenuGlobal"="Einstellungen..."
+  "MenuLayout"="Layout..."
+  "MenuAlarm"="Alarm..."
+  "MenuWorld"="Weltzeit..."
+  "MenuTimer"="Stoppuhr..."
+  "MenuSounds"="Töne..."
+  "MenuResetData"="Alle Daten zurücksetzen"
+  "MenuHelp"="Hilfe"
+  "MenuAbout"="Über"
+  "MenuColor"="Farbe..."
+
+  "Yes"="Ja"
+  "No"="Nein"
+  "Cancel"="Abbrechen"
+
+  "ShortTime"="Zeit"
+  "ShortAlarm"="Alarm"
+  "ShortWorld"="Welt"
+  "ShortTimer"="Stop"
+  "ShortA34"="A 3+4"
+  "ShortTimer2"="Stop2"
+
+  "Time"="Zeit"
+  "Alarm"="Alarm"
+  "World"="Welt"
+  "Timer"="Stoppuhr"
+  "Sounds"="Töne"
+  "Preferences"="Einstellungen"
+
+  "Mode"="Art"
+  "Date"="Datum"
+  "No sound"="Stumm"
+  "Autoclose"="Schließen"
+  "Backlight"="Licht"
+  "Snooze"="Snooze"
+  "minutes"="Minuten"
+  "Timebase"="Zeit"
+  "Local"="Lokal"
+  "Trigger"="Auslöser"
+  "Stay on"="An bleiben"
+  "Alternate"="Wechseln"
+  "Multiply with"="Multiplizieren"
+
+  "Select Timer Date"="Datum auswählen"
+  "Select Timer Time"="Zeit auswählen"
+
+
+  "Timer 1 uses up/down buttons"="Stoppuhr 1 mit Tasten steuern"
+  "Ignore system alarm sound off"="System Alarm aus ignorieren"
+
+
+  "simple"="Einfach"
+  "reset"="Zurücksetzen"
+  "loop"="Schleife"
+  "alarm"="Alarm"
+  "alarm & loop"=   "Alarm&Schleife"
+  "go on" ="Fortsetzen"
+  "alarm & go on" = "Alarm&Weiter"
+  "every day"="Immer"
+  "selected days"="Tage"
+  "once"="Einmal"
+  "chime"="Läuten"
+
+  "World 1"="Welt 1"
+  "World 2"="Welt 2"
+  "World 3"="Welt 3"
+  "World 4"="Welt 4"
+  "Local time"="Lokale Zeit"
+  "Timer 1"="Stop 1"
+  "Timer 2"="Stop 2"
+  "Timer 3"="Stop 3"
+  "Timer 4"="Stop 4"
+  "Alarm 1"="Alarm 1"
+  "Alarm 2"="Alarm 2"
+  "Alarm 3"="Alarm 3"
+  "Alarm 4"="Alarm 4"
+
+  "Week"="Woche"
+  "Day"="Tag"
+  "Hour"="Stunde"
+  "Month"="Monat"
+
+  "Start"="Start"
+  "Stop"="Stop"
+  "Reset"="Reset"
+  "Clear"="Löschen"
+
+  "Name:"="Name:"
+  "Lock"="Sperren"
+  "Timezone:"="Zeitzone:"
+  "Warning!"="Warnung!"
+  "Are you sure to reset the options, layout, worldtimes, timer and alarms?"="Sind Sie sicher? Alle Einstellungen werden gelöscht"
+
+
+  "p_Empty"="Nix"
+  "p_Time"="Zeit"
+  "p_Month"="Monat"
+  "p_Date"="Datum"
+  "p_DateD"="DatumD"
+  "p_Alarm"="Alarm"
+  "p_Timer"="Stopp"
+  "p_TimerC"="StoppS"
+  "p_Timer+"="Stopp+"
+  "p_TimerV"="StoppV"
+  "p_2World"="2Welt"
+  "p_Analog"="Analog"
+
+  "Color"="Farbe"
+  "Normal"="Normal"
+  "Selected"="Ausgewählt"
+  "Back"="Hinterg."
+  "Text"="Text"
+  "Themes:"="Motive:"
+  "Info"="Info"
+  "Delete"="Löschen"
+  "<no theme>"="<kein Motiv>"
+
+  "Sec."="Sek."
+
+  "Use system sound"="Palm Alarm"
+  "Freq"="Freq"
+  "Ampli"="Ampli"
+  "Pause"="Pause"
+  "Repeat"="Anzahl:"
+  "times"="mal"
+  "Test"="Test"
+
+  "Tap on the numbers to change the"="Tippen Sie auf die Zahlen um die"
+  "system time. Use the preferences"="Systemzeit zu ändern. Für das Datum"
+  "application to change the date."="Programm \"Einstellen\" verwenden."
+
+  "Update world times"="Weltzeiten beibehalten"
+
+
+  "Tap here to turn off snooze!"="Hier tippen um snooze zu beenden!"
+  "monthlist"="Janua Februar März April Mai Juni Julie August September Oktober November Dezember"
+  "weekdaylist"="Sonntag Montag Dienstag Mittwoch Donnnerstag Freitag Samstag"
+  "aboutmessage"="V2.83\nDieses Programm ist unter der GNU General Public License!\n\nVon Jens Rupp\nEMail & WWW:\nbigclock@gacel.de\nhttp://www.gacel.de"
+  "Happy New Year!" = "Frohes neues Jahr!"
+END
Index: bigclock/draw.c
diff -u bigclock/draw.c:1.1.1.1 bigclock/draw.c:1.39
--- bigclock/draw.c:1.1.1.1	Fri Feb  3 00:26:59 2006
+++ bigclock/draw.c	Mon Mar 27 22:53:55 2006
@@ -1,12 +1,18 @@
 #define NON_PORTABLE
+#define ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS
+#define _SDK5_
 
 #include <PalmOS.h>
+#include <SonyCLIE.h>
 #include <CoreTraps.h>
 #include <System/SerialMgrOld.h>   // for talelight
 #include <SysEvtMgr.h>
 #include <PalmCompatibility.h>
-#include "vga.h"
 #include "bigclock.h"
+#include <BmpGlue.h>
+#ifdef _TRG_
+#include "Vga.h"
+#endif
 
 #define BCAppID       'BClk'
 #define ymove 2
@@ -17,6 +23,7 @@
 #include "bigclocktypes.h"
 #define nodebug
 
+extern UInt16 HRrefNum;
 
 void ColorSet(Boolean i)  SEG_DRAW;
 void MyDrawChars(const Char *chars, Int16 len,Coord x, Coord y,Boolean i)  SEG_DRAW;
@@ -43,7 +50,10 @@
 void DrawAlarmCheck(int num, int y) SEG_DRAW;
 void DrawMonthView(int num,int y,Boolean r) SEG_DRAW;
 void SwitchDrawSection(int val,int y,Boolean sw) SEG_DRAW;
+int MyFntCharsWidth(Char const *chars,  Int16 len) SEG_DRAW;
+#ifdef _TRG_
 void DrawSilkMonth(int off,int x,int y) SEG_DRAW;
+#endif
 
 extern void CloseAlarm(DmOpenRef BCdb);
 extern DmOpenRef OpenAlarm();
@@ -58,21 +68,32 @@
 #endif
 extern void ShowRegions(UInt32 panel,UInt32 sub);
 
+extern WinHandle bitmapWinH[17];
 
 
 
 extern Boolean iscolor;
 extern Boolean is35;
+
+#ifdef _TRG_
 extern Boolean isTRG;
+#endif
+extern Boolean isHR;
+extern Boolean isHD;
+extern Boolean isCLIE_OS5;
+extern Boolean isOS5;
 extern UInt32  maxdepth;
 extern UInt32  panelwidth;
-extern UInt32 panelheight;
+extern UInt32  panelheight;
 extern UInt32  ytop;         // upper panel
-extern UInt32 ybottom;      // lower panel
-
+extern UInt32  ybottom;      // lower panel
+extern int     xHR;
 
 extern BigClockPrefType prefs;
-extern BitmapPtr  bigbitmapP[16];
+extern BitmapPtr  bigbitmapP[17];
+#ifdef _SDK5_
+extern BitmapPtrV3  bigbitmapV3P[17];
+#endif
 extern SystemPreferencesType SysPref; //100
 extern char      *day[7];
 extern char      *month[12];
@@ -85,8 +106,9 @@
 extern int     timercommand;
 extern WinHandle build;
 extern BitmapPtr  Background;
-extern char      salarmmode[2][12];
-extern char      stimermode[7][14];
+extern char      salarmmode[2][20];
+extern char      stimermode[7][20];
+extern int       isJA;
 
 
 
@@ -111,8 +133,13 @@
 
 void MySetFont(int n)
 {
+#ifdef _TRG_
   if (isTRG)
     FntSetFont(VgaBaseToVgaFont(n));
+  else 
+#endif
+  if (isHR)
+    HRFntSetFont(HRrefNum, n+8);
   else
     FntSetFont(n);
 }
@@ -161,15 +188,15 @@
 
   if (len>0)
   {
-    if (iscolor || (Background != NULL))
+    if (Background != NULL)
     {
       if (is35)
         WinPushDrawState();
       max=160;
       maxs=len;
       FntCharsInWidth (chars,&max,&maxs,&trunc);
-      h=FntCharHeight();
-
+      h=FntCharHeight() * xHR;
+      max *= xHR;
 
       if (prefs.screendepth != 16)
          bitmap= BmpCreate(max, h, prefs.screendepth, NULL, &bmperror);
@@ -189,10 +216,22 @@
 
       WinEraseRectangle(&rc,0);
 
-      if (i)
-        bitmap->transparentIndex=prefs.colorbi;
-      else
-        bitmap->transparentIndex=prefs.colorb;
+#ifdef _SDK5_
+      if (isOS5)
+      {
+	if (i)
+	  BmpSetTransparentValue(bitmap, prefs.colorbi);
+	else
+	  BmpSetTransparentValue(bitmap, prefs.colorb);
+      }
+      else 
+#endif
+      {
+	if (i)
+	  BmpGlueSetTransparentValue(bitmap, prefs.colorbi);
+	else
+	  BmpGlueSetTransparentValue(bitmap, prefs.colorb);
+      }
 
       /*
       if (prefs.screendeepth==16)
@@ -201,7 +240,10 @@
       } */
 
 
-      WinDrawChars(chars,len,0,0);
+      if (isHR)
+	HRWinDrawChars(HRrefNum, chars,len,0,0);
+      else
+	WinDrawChars(chars,len,0,0);
 
       WinSetDrawWindow(oldwin);
 
@@ -221,7 +263,10 @@
 
     } else
     {
-      WinDrawChars(chars,len,x,y);
+      if (isHR)
+        HRWinDrawChars(HRrefNum, chars,len,x,y);
+      else
+	WinDrawChars(chars,len,x,y);
     }
   }
    #ifdef debug
@@ -233,7 +278,32 @@
 void DrawBigNumber(Boolean out,int num,UInt32 *x,UInt32 *y)
 {
   if (out)
-    WinDrawBitmap(bigbitmapP[num],*x,*y);
+  { 
+    if (isHR)
+    {     
+      RectangleType bounds;
+      WinHandle screenH = WinGetDrawWindow();
+
+      //WinGetBounds(bitmapWinH[num], &bounds);
+      WinGetDrawWindowBounds(&bounds);
+      HRWinCopyRectangle(HRrefNum, bitmapWinH[num], screenH, &bounds,
+		       *x, *y, winPaint);
+    }
+#ifdef _SDK5_
+    else if (isHD)
+    {
+      int wcs_org;
+
+      wcs_org=WinSetCoordinateSystem(kCoordinatesNative);
+      WinDrawBitmap((BitmapType *)bigbitmapV3P[num], *x, *y);
+      WinSetCoordinateSystem(wcs_org);
+    }
+#endif
+    else
+    {
+      WinDrawBitmap(bigbitmapP[num],*x,*y);
+    }
+  }
   else
   {
     if (bigbitmapP[num]->height > *y)
@@ -264,6 +334,12 @@
   char *t;
   UInt8  m;
 
+  if (isHD) 
+    {
+      w+=160;
+      h+=62;
+    }
+
    #ifdef debug
     debugs("DrawBig",text);
     debugi("DrawBig X",x);
@@ -322,10 +398,12 @@
            case 'p' : DrawBigAMPM(m==1,1,&xdraw,&ydraw);
                       break;
            case '#' : //x+=24;
+#ifdef _TRG_
                       if (isTRG)
                         xdraw+=36;
                       else
-                        xdraw+=24;
+#endif
+                        xdraw+=24 * xHR;
                       break;
            case '/' : DrawBigSymbol(m==1,0,&xdraw,&ydraw);
                       break;
@@ -336,10 +414,12 @@
            case '*' : DrawBigSymbol(m==1,3,&xdraw,&ydraw);
                       break;
            case ' ' : //x+=8;
+#ifdef _TRG_
                       if (isTRG)
                         xdraw+=12;
                       else
-                        xdraw+=8;
+#endif
+                        xdraw+=8 * xHR;
                       break;
            default  : break;
         }
@@ -369,20 +449,33 @@
   Boolean i;
   int w;
 
+#ifdef _TRG_
   if (isTRG)
   {
     rc.extent.x=12;
     rc.extent.y=16;
     rc.topLeft.y=y+2;
+  } else 
+#endif 
+  if (isHR) 
+  {
+    rc.extent.x=16;
+    rc.extent.y=22;
+    rc.topLeft.x=x;
+    rc.topLeft.y=y+2;
   }
 
-
   //rc.extent.x = 8;
   MySetFont(0);
   for (iii=0 ; iii<7 ; iii++)
   {
+#ifdef _TRG_
     if (isTRG)
       rc.topLeft.x = x+iii*12-1;
+    else 
+#endif
+    if (isHR)
+      rc.topLeft.x = x+iii*16+2;
     else
       rc.topLeft.x = x+iii*8-1;
 
@@ -397,8 +490,17 @@
     }
 
     w=FntCharWidth(day[(iii+SysPref.weekStartDay) % 7][0]);
+    
+    if (isHR && !isCLIE_OS5)
+      w=w/2;
+
+#ifdef _TRG_
     if (isTRG)
       MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,x+iii*12+5-(w /2),y+2,i);
+    else 
+#endif
+    if (isHR)
+      MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,x+iii*16+6-(w /2),y+2,i);
     else
       MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,x+iii*8+3-(w /2),y,i);
     if (i && (!is35))
@@ -410,26 +512,36 @@
 void DrawAlarmSound(int num,int x,int y)
 {
   int iii;
-  RectangleType rc={{x,0},{19,9}};
+  RectangleType rc={{x*xHR, 0}, {19*xHR, 9*xHR}};
   char c= '1';
 
   //ColorSet(false);
 
+  if (isHR)
+  {
+    x *= 2;
+    y *= 2;
+  }
+
   MySetFont(1);
+#ifdef _TRG_
   if (isTRG)
   {
     rc.extent.x=29;
     rc.extent.y=14;
   }
+#endif
 
   for (iii=0; iii<4; iii++)
   {
+#ifdef _TRG_
     if (isTRG)
     {
       rc.topLeft.y = 24+y+iii*15;
-    }  else
+    } else
+#endif
     {
-      rc.topLeft.y = 16+y+iii*10;
+      rc.topLeft.y = 16*xHR+y+iii*10*xHR;
     }
 
     if (is35)
@@ -439,13 +551,19 @@
         {
           WinEraseRectangle(&rc,0);
         }
+#ifdef _TRG_
       if (isTRG)
         MyDrawChars(&c,1,x+10,24+y+iii*15-1,prefs.world[num].options.sound==iii);
       else
-        MyDrawChars(&c,1,x+7,16+y+iii*10-1,prefs.world[num].options.sound==iii);
+#endif
+        MyDrawChars(&c,1,x+7*xHR,16*xHR+y+iii*10*xHR-1*xHR,
+		    prefs.world[num].options.sound==iii);
 
       ColorSet(false);
-      WinDrawRectangleFrame(1,&rc);
+      if (isHR)
+        WinDrawRectangleFrame(simple3DFrame,&rc);
+      else
+        WinDrawRectangleFrame(1,&rc);
     } else
     {
       rc.topLeft.y = 16+y+iii*10;
@@ -461,9 +579,12 @@
 
 void DrawButton(char *t,Boolean i,int x, int y, int h, int w, int o)
 {
-  RectangleType rc={{x,y},{w,h}};
-  MySetFont(2);
+  RectangleType rc={{x*xHR, y*xHR},{w*xHR, h*xHR}};
 
+  if (isJA)
+    MySetFont(0); // for Timer control buttons
+  else
+    MySetFont(2);
 
   if (is35)
   {
@@ -474,9 +595,14 @@
        WinDrawRectangle(&rc,5);
      }
      ColorSet(i);
-     MyDrawChars(t,StrLen(t),(w / 2) - (FntCharsWidth(t,StrLen(t)) / 2) + x,y+o,i);
-     WinDrawRectangleFrame(roundFrame,&rc);
 
+     MyDrawChars(t, StrLen(t), (w*xHR / 2) - (MyFntCharsWidth(t,StrLen(t)) / 2) 
+		 + x*xHR, y*xHR+o*xHR, i);
+
+     if (isHR)
+       WinDrawRectangleFrame(boldRoundFrame,&rc);
+     else
+       WinDrawRectangleFrame(roundFrame,&rc);
 
   } else
   {
@@ -500,27 +626,30 @@
 
 }
 
-
 void DrawUpDown(int num,int x,int y)
 {
-  RectangleType rc={{x,0},{19,19}};
+  RectangleType rc={{x*xHR,0},{19*xHR,19*xHR}};
   int iii;
   char  d;
   Boolean i;
 
+#ifdef _TRG_
   if (isTRG)
   {
     rc.extent.x=29;
     rc.extent.y=29;
   }
+#endif
 
   MySetFont(5);
   for (iii=0; iii<2; iii++)
   {
+#ifdef _TRG_
     if (isTRG)
       rc.topLeft.y = y+24+iii*30;
     else
-      rc.topLeft.y = y+16+iii*20;
+#endif
+      rc.topLeft.y = (y+16)*xHR+iii*20*xHR;
 
     d=iii+1;
 
@@ -530,17 +659,22 @@
       ColorSet(i);
       if (i)
         WinEraseRectangle(&rc,0);
+#ifdef _TRG_
       if (isTRG)
         MyDrawChars(&d,1,x+7,y+33+iii*30,i);
       else
-        MyDrawChars(&d,1,x+4,y+20+iii*22,i);
+#endif
+        MyDrawChars(&d,1,(x+4)*xHR,(y+20)*xHR+iii*22*xHR,i);
       ColorSet(false);
-      WinDrawRectangleFrame(1,&rc);
+      if (isHR)
+	WinDrawRectangleFrame(simple3DFrame,&rc);
+      else
+	WinDrawRectangleFrame(1,&rc);
     } else
     {
       WinEraseRectangle(&rc,0);
       WinDrawRectangleFrame(1,&rc);
-      WinDrawChars(&d,1,x+4,y+20+iii*22);
+      WinDrawChars(&d,1,(x+4)*xHR,(y+20)*xHR+iii*22*xHR);
       if (i)
         WinInvertRectangle(&rc,0);
     }
@@ -554,6 +688,7 @@
 
   MySetFont(2);
 
+#ifdef _TRG_
   if (isTRG)
   {
     if (small)
@@ -565,6 +700,7 @@
     DrawUpDown(num,172,y);
     DrawAlarmSound(num,208,y);
   } else
+#endif
   {
     if (small)
       DrawButton(stimer[prefs.world[num].options.active],prefs.world[num].options.active,3,y+16+22,17,43,2);
@@ -625,6 +761,13 @@
     a=4;
     b=3;
     c=6;
+  }
+  else if (size==2)
+  {
+    a=4;
+    b=4;
+    c=8;
+
   } else
   {
     a=2;
@@ -651,12 +794,21 @@
 
 void TinyNumber(int size,int x,int y,int num)
 {
-  const int numbers[10] = {119,36,93,109,46,107,123,37,127,111};
-  //if ((num >=0) && (num<=9))
-  DrawTiny(size,x,y,numbers[num ]);
-}
-
 
+  if (isHR)
+  {
+    char tmp[2];
+    HRFntSetFont(HRrefNum, 2);
+    StrIToA(tmp, num);
+    HRWinDrawChars(HRrefNum, tmp, StrLen(tmp), x, y-2);
+  }
+  else
+  {
+    const int numbers[10] = {119,36,93,109,46,107,123,37,127,111};
+    //if ((num >=0) && (num<=9))
+    DrawTiny(size,x,y,numbers[num ]);
+  }
+}
 
 //draw the time
 void DrawTime(int num,int y,Boolean alarm, Boolean timer,Boolean small)
@@ -706,10 +858,15 @@
 
   if (alarm)
   {
+#ifdef _TRG_
     if (isTRG)
       prefs.world[num].add=84;
     else
-      prefs.world[num].add=56;
+#endif
+    if (isHD)
+      prefs.world[num].add=56 * 2;
+    else
+      prefs.world[num].add=56 * xHR; // for alarm
   }
 
   am=0;
@@ -762,16 +919,25 @@
         time[6]='p';
     } else
     {
+      int HDy;
+
       // small am/pm
       rc.extent.x =15;
       rc.extent.y = 16;
       rc.topLeft.x = 130;
       rc.topLeft.y = y;
       //WinEraseRectangle(&rc,0);
+
+      // for optionslocaltime in HD mode. Evil!
+      if (isHD && y==100)
+	HDy=50;
+      else
+	HDy=y;
+
       if (am==1)
-        MyDrawChars("am",2,panelwidth-FntCharsWidth("am",2),y,false);
+        MyDrawChars("am",2,panelwidth-MyFntCharsWidth("am",2),HDy,false);
       else if (am==2)
-        MyDrawChars("pm",2,panelwidth-FntCharsWidth("pm",2),y,false);
+        MyDrawChars("pm",2,panelwidth-MyFntCharsWidth("pm",2),HDy,false);
     }
   }
   if ((ShowDate) && (!alarm) && (!timer))
@@ -780,14 +946,21 @@
 
 
    if (small)
+   {
      MyDrawChars(time,StrLen(time),3,y,false);
-   else
+   } else
+   {
+     if (isHR || isHD) 
+       y+=6;
      DrawBig(time,prefs.world[num].add,y+13,panelwidth-prefs.world[num].add,panelheight-16,1);
+
+   }
 }
 
 
 void DrawTime2(int y,int d,int h,int m,int s,Boolean small)
 {
+
   char time [9];
   char sec[4];
   MemSet(time,9,0);
@@ -807,11 +980,19 @@
   if (small)
      MyDrawChars(time,StrLen(time),0,y,false);
   else
-     DrawBig(time,0,y+13,panelwidth,panelheight-16,1);
+  {
+    int offset=0;
+
+    if (isHR || isHD) 
+      offset=6;
+
+    DrawBig(time,0,y+13+offset,panelwidth,panelheight-16,1);
+  }
+
 
   if ((s>=0) != small)
   {
-    FntSetFont(2);
+    MySetFont(2);
     StrIToA(sec,s);
     if (s<10)
     {
@@ -819,7 +1000,7 @@
       sec[1]=sec[0];
       sec[0]='0';
     }
-    MyDrawChars(sec,StrLen(sec),140,y,false);
+    MyDrawChars(sec,StrLen(sec),140*xHR,y,false);
   }
 }
 
@@ -830,7 +1011,21 @@
   int dx,dy;
   int r1,r2,r3,r4,r5,yadd;
   int h,am;
+#ifdef _SDK5_
+  int wcs_org=0;
+  int old_xHR=0;
+#endif
+
+#ifdef _SDK5_
+  if (isHD)
+  {
+    old_xHR = xHR;
+    xHR = 2;
+    wcs_org=WinSetCoordinateSystem(kCoordinatesNative);
+  }
+#endif
 
+#ifdef _TRG_
   if (isTRG)
   {
     dx=180;
@@ -842,15 +1037,19 @@
     r5=35;
     yadd=21;
   } else
+#endif
   {
-    dx=28+90;
-    dy=28+4;
-    r1=28;
-    r2=26;
-    r3=4;
-    r4=15;
-    r5=22;
-    yadd=14;
+    dx=(28+90) * xHR;
+    dy=(28+4)  * xHR;
+    r1=28 * xHR;
+    r2=26 * xHR;
+    if (isHR || isHD)
+      r3=6;
+    else
+      r3=4;
+    r4=15 * xHR;
+    r5=22 * xHR;
+    yadd=14 * xHR;
   }
 
   ColorSet(false);
@@ -872,6 +1071,15 @@
 
   }
 
+#ifdef _SDK5_
+  if (isHD)
+  {
+    xHR=old_xHR;
+    WinSetCoordinateSystem(wcs_org);
+    yadd=14;
+  }
+#endif
+
   MySetFont(1);
   StrCopy(help,prefs.world[num].name);
   MyDrawChars( help,StrLen(help),8 ,y,false);
@@ -890,9 +1098,9 @@
     if (h>=12)
      am=2;
     if (am==1)
-      MyDrawChars("am",2,panelwidth-FntCharsWidth("am",2),y,false);
+      MyDrawChars("am",2,panelwidth-MyFntCharsWidth("am",2),y,false);
     else if (am==2)
-      MyDrawChars("pm",2,panelwidth-FntCharsWidth("pm",2),y,false);
+      MyDrawChars("pm",2,panelwidth-MyFntCharsWidth("pm",2),y,false);
   }
 
 }
@@ -906,7 +1114,6 @@
   int iii,jjj,kkk;
 
 
-
   d=0;
   h2=prefs.world[num].value / hoursInSeconds;
   h=h2;
@@ -969,6 +1176,10 @@
     Time[num].second=s;
     Time[num].minute=m;
     Time[num].hour=h;
+
+    if (isHR && small) // yendo: for small timer
+      y+=18;
+
     DrawTime(num,y,false,true,small);
   }
 
@@ -982,10 +1193,12 @@
   int iii;
   int yadd;
 
+#ifdef _TRG_
   if (isTRG)
     yadd=21;
   else
-    yadd=14;  
+#endif
+    yadd=14 * xHR;  
 
   for (iii=0 ; iii<2; iii++)
   {
@@ -1008,10 +1221,12 @@
   Long data[6];
   int yadd;
 
+#ifdef _TRG_
   if (isTRG)
     yadd=21;
   else
-    yadd=14;
+#endif
+    yadd=14 * xHR;
 
   CalcDateData(Time[num],& data[0]);
 
@@ -1021,11 +1236,11 @@
 
   //Date
   DateToAscii(Time[num].month,Time[num].day,Time[num].year,SysPref.dateFormat,text);
-  MyDrawChars(text,StrLen(text),80,y,false);
+  MyDrawChars(text,StrLen(text),80*xHR,y,false);
 
-  x1=FntCharsWidth(detailweek,StrLen(detailweek));
-  x2=FntCharsWidth(detailweek,StrLen(detailday));
-  x3=FntCharsWidth(detailweek,StrLen(detailhour));
+  x1=MyFntCharsWidth(detailweek,StrLen(detailweek));
+  x2=MyFntCharsWidth(detailweek,StrLen(detailday));
+  x3=MyFntCharsWidth(detailweek,StrLen(detailhour));
   if (x1>x2)
   {
     if (x1>x3)
@@ -1039,10 +1254,10 @@
     else
       xdraw=x3;
   }
-  xdraw+=8;
+  xdraw+=8*xHR;
   //StrIToA(number,hourleft);
   StrIToA(number,data[5]);
-  xdraw2=FntCharsWidth(number,StrLen(number))+16+xdraw;
+  xdraw2=MyFntCharsWidth(number,StrLen(number))+16*xHR+xdraw;
 
   //Hour
   MyDrawChars(detailhour,StrLen(detailhour),0,y+3*yadd,false);
@@ -1086,7 +1301,7 @@
   int       mp;
   int       yp;
   Int8      sep;
-  char      date[8];
+  char      date[9];
   char      sepchar[]={'/',':','.','*'};
 
   date[8]=0;
@@ -1176,6 +1391,10 @@
     date[yp+1]=(year % 10) + '0';
 
     //Draw the date
+    if (isHR)
+      y+=5;
+
+    date[8]=0;
     DrawBig(date,0,y+16,panelwidth,panelheight-16,1);
 }
 
@@ -1196,6 +1415,13 @@
   DateTimeType week;
   Boolean wd;
   int w;
+  int offset_y = 11, old_y =y;
+  int xHD;
+#ifdef _SDK5_
+  int wcs_org =0;
+#endif
+
+  y=y+offset_y;
 
    #ifdef debug
     debugs("DrawMonthView","Start");
@@ -1204,6 +1430,7 @@
   ColorSet(false);
   TimSecondsToDateTime(prefs.world[num].last,&old);
 
+#ifdef _TRG_
   if (isTRG)
   {
     MySetFont(1);
@@ -1213,17 +1440,41 @@
       MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,12+iii*17-(w /2),y,false);
     }
 
-  } else
-  {
-    FntSetFont(1);
-    for (iii=0 ; iii<7 ; iii++)
-    {
-      w=FntCharWidth(day[(iii+SysPref.weekStartDay) % 7][0]);
-      MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,3+iii*11+5-(w /2),y,false);
-    }
-  }
+  } else 
+#endif
+  {  // —j“ú
 
+    if (isHR)
+      HRFntSetFont(HRrefNum, 7);
+    else
+      FntSetFont(1);
 
+    for (iii=0 ; iii<7 ; iii++)
+      {
+	/*
+	if (is35)
+	{
+	  if (iii == SysPref.weekStartDay*6)
+	    WinSetTextColor(125);
+	  if (iii == 6-SysPref.weekStartDay)
+	    WinSetTextColor(95);
+	}
+	*/
+	w=FntCharWidth(day[(iii+SysPref.weekStartDay) % 7][0])*xHR;
+
+	if (isHR && !isCLIE_OS5)
+	  w/=2;
+
+	if (isHR)
+	  MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,6+iii*22+6-(w /2),y*2+5,false);
+	else if (isHD)
+	  MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,3+iii*11+2-(w /2),y,false);
+	else
+	  MyDrawChars(day[(iii+SysPref.weekStartDay) % 7],1,3+iii*11+5-(w /2),y,false);
+	if (is35)
+	  ColorSet(false);
+      }
+  }
 
   mo=((Time[num].month-1)+prefs.world[num].monthoffset+12*100) % 12;
 
@@ -1243,13 +1494,25 @@
   week.year=yo;
   wd=false;
 
+#ifdef _SDK5_
+  if (isHD)
+    wcs_org=WinSetCoordinateSystem(kCoordinatesNative);
+#endif
+
+#ifdef _TRG_
   if (isTRG)
   {
     rc.extent.x =14;
     rc.extent.y = 9;
+  } else 
+#endif
+  if (isHR || isHD) // “–“ú”½“]ƒTƒCƒY
+  {
+    rc.extent.x =17; 
+    rc.extent.y =12;
   } else
   {
-    rc.extent.x =9;
+    rc.extent.x = 9;
     rc.extent.y = 7;
   }
 
@@ -1259,10 +1522,17 @@
 
   while ((iii<7) && (kkk<=d))
   {
+#ifdef _TRG_
     if (isTRG)
     {
       rc.topLeft.x = jjj*17+1+2;
       rc.topLeft.y = iii*10+y+15;
+    } else 
+#endif
+    if (isHR || isHD) // “–“ú”½“]ˆÊ’u
+    {
+      rc.topLeft.x = 2+jjj*22;
+      rc.topLeft.y = iii*12+y+24+offset_y;
     } else
     {
       rc.topLeft.x = 3+jjj*11;
@@ -1290,6 +1560,7 @@
    #ifdef debug
     debugs("DrawMonthView","drawtiny");
    #endif
+#ifdef _TRG_
    if (isTRG)
    {
      if ((kkk/10) != 0)
@@ -1299,24 +1570,67 @@
       }
       else
         TinyNumber(1,4+jjj*17+5,iii*10+y+16,kkk % 10);
-   } else
-   {
+   } else 
+#endif
+   {  // ƒJƒŒƒ“ƒ_[–{‘Ì 
+     /*
+     if (jjj==SysPref.weekStartDay*6)
+     {
+       if (isHR)
+	 WinSetTextColor(125);
+       else if (is35)
+	 WinSetForeColor(125);
+     }
+
+     if (jjj+SysPref.weekStartDay ==6)
+     {
+       if (isHR)
+	 WinSetTextColor(95);
+       else if (is35)
+	 WinSetForeColor(95);
+     }
+     */
       if ((kkk/10) != 0)
       {
-        TinyNumber(0,4+jjj*11,iii*6+y+12,kkk / 10);
-        TinyNumber(0,4+jjj*11+4,iii*6+y+12,kkk % 10);
+	if (isHR || isHD) {
+	  TinyNumber(2,4+jjj*22,iii*12+y+26+offset_y,kkk / 10);
+	  TinyNumber(2,4+jjj*22+7,iii*12+y+26+offset_y,kkk % 10);
+	} else {
+	  TinyNumber(0,4+jjj*11,iii*6+y+12,kkk / 10);
+	  TinyNumber(0,4+jjj*11+4,iii*6+y+12,kkk % 10);
+	}
       }
       else
-        TinyNumber(0,4+jjj*11+2,iii*6+y+12,kkk % 10);
-    }
+      {
+	if (isHR || isHD)
+	  TinyNumber(2,4+jjj*22+5,iii*12+y+26+offset_y,kkk % 10);
+	else
+	  TinyNumber(0,4+jjj*11+2,iii*6+y+12,kkk % 10);
+      }
+
+      if (is35)
+      {
+	ColorSet(false);
+      }
+   }
 
    #ifdef debug
     debugs("DrawMonthView","invert?");
    #endif
 
-    if (! is35)
-      if ((kkk==Time[num].day) && (yo==Time[num].year) && ((mo+1)==Time[num].month))
+/*     if (!is35) */
+/*       if ((kkk==Time[num].day) && (yo==Time[num].year) && ((mo+1)==Time[num].month)) */
+/*         WinInvertRectangle(&rc,0); */
+
+    if ((kkk==Time[num].day) && (yo==Time[num].year) && ((mo+1)==Time[num].month))
+    {
+      if (isHR || isHD)
+      {
+	rc.topLeft.y +=12;
+        WinEraseRectangle(&rc,0);
+      } else if (!is35)
         WinInvertRectangle(&rc,0);
+    }
 
    #ifdef debug
     debugs("DrawMonthView","draw week");
@@ -1329,6 +1643,7 @@
       wd=true;
       week.day=kkk;
       CalcDateData(week,&data[0]);
+#ifdef _TRG_
       if (isTRG)
       {
         if ((data[0] / 10) != 0)
@@ -1337,6 +1652,16 @@
           TinyNumber(1,132+7,iii*10+y+16,data[0] % 10);
         } else
           TinyNumber(1,132+7,iii*10+y+16,data[0] % 10);
+      } else 
+#endif
+      if (isHR || isHD) // T”Ô† 
+      {
+        if ((data[0] / 10) != 0)
+        {
+          TinyNumber(2,184-8,iii*12+y+26+offset_y,data[0] / 10);
+          TinyNumber(2,184,iii*12+y+26+offset_y,data[0] % 10);
+        } else
+          TinyNumber(2,184,iii*12+y+26+offset_y,data[0] % 10);
       } else
       {
         if ((data[0] / 10) != 0)
@@ -1358,6 +1683,12 @@
       }
     kkk++;
   }
+
+#ifdef _SDK5_
+  if (isHD)
+    WinSetCoordinateSystem(wcs_org);
+#endif
+
    #ifdef debug
     debugs("DrawMonthView","tiny done");
    #endif
@@ -1365,22 +1696,31 @@
   ColorSet(false);
 
   MySetFont(0);
-  StrCopy(help,month[mo]);
-  StrIToA(help2,yo);
-  StrCat(help," ");
-  StrCat(help,help2);
-  iii=FntCharsWidth(help,StrLen(help));
-  if (isTRG)
+
+  if (isJA)
   {
-    MyDrawChars( help,StrLen(help),(panelwidth/4)-(iii /2),panelheight-FntCharHeight() ,false);
-  } else
+    StrCopy(help2,month[mo]);
+    StrIToA(help,yo);
+    StrCat(help,"”N");
+    StrCat(help,help2);
+  }
+  else
   {
-    MyDrawChars( help,StrLen(help),(panelwidth/4)-(iii /2),panelheight-FntCharHeight(),false);
+    StrCopy(help,month[mo]);
+    StrIToA(help2,yo);
+    StrCat(help," ");
+    StrCat(help,help2);
   }
 
+  y=old_y;
+
+  iii=MyFntCharsWidth(help,StrLen(help));
+  MyDrawChars( help,StrLen(help),(panelwidth/4)-(iii /2),y,false);
+
   MySetFont(2);
   StrCopy(help,month[Time[num].month-1]);
-  iii=FntCharsWidth(help,StrLen(help));
+  iii=MyFntCharsWidth(help,StrLen(help));
+  
   MyDrawChars( help,StrLen(help),panelwidth-iii,y,false);
 
   if ((Time[num].day / 10) != 0)
@@ -1394,7 +1734,12 @@
     debugs("DrawMonthView","draw big");
    #endif
 
-  DrawBig(daytext,0,y+16,panelwidth,panelheight-16,2);
+  if (isHD)
+    xHD=2;
+  else
+    xHD=xHR;
+
+  DrawBig(daytext,0,y*xHD+8+8*xHD,panelwidth,panelheight-16,2);
 
    #ifdef debug
     debugs("DrawMonthView","done");
@@ -1402,6 +1747,7 @@
 }
 
 
+#ifdef _TRG_
 void DrawSilkMonth(int off,int x,int y)
 {
   int iii;
@@ -1497,8 +1843,7 @@
   iii=FntCharsWidth(help,StrLen(help));
   MyDrawChars( help,StrLen(help),(panelwidth/6)-(iii /2)+x,y+48 ,false);
 }
-
-
+#endif 
 
 
 void DrawAlarmCheck(int num, int y)
@@ -1510,8 +1855,9 @@
   CharPtr	itemTextP;
   BigClockAlarm alarm;
   DmOpenRef     BCdb;
-  RectangleType rc={{3,y+18},{20,20}};
+  RectangleType rc={{3*xHR, (y+18)*xHR},{20*xHR, 20*xHR}};
 
+#ifdef _TRG_
   if (isTRG)
   {
     rc.topLeft.x=6;
@@ -1519,7 +1865,7 @@
     rc.extent.x=30;
     rc.extent.y=30;
   }
-
+#endif
 
   ColorSet(false);
   //WinEraseRectangle(&rc,0);
@@ -1556,19 +1902,29 @@
     WinDrawLine(23,y+19,4,y+38);
     */
   }
+  
+  if (isHR)
+    HRFntSetFont(HRrefNum, 2);
+  else
+    MySetFont(0);
 
-  FntSetFont(0);
   if (prefs.world[num].options.base>0)
   {
+#ifdef _TRG_
     if (isTRG)
       itemWidth = 48;
+    else 
+#endif
+    if (isHR && !isCLIE_OS5)
+      itemWidth = 64;
     else
       itemWidth = 32;
+
     itemTextLen = 160;
     itemTextP = prefs.world[wLocal+prefs.world[num].options.base].name;
 
     FntCharsInWidth(itemTextP, &itemWidth, &itemTextLen, &ignored);
-    MyDrawChars(itemTextP, itemTextLen, 0,rc.topLeft.y+rc.extent.y+4,false);
+    MyDrawChars(itemTextP, itemTextLen, 0,rc.topLeft.y+rc.extent.y+4*xHR,false);
   }
 }
 
@@ -1664,9 +2020,11 @@
               length=11;
               FntCharsInWidth(prefs.world[wLocal+num].name,&width,&length,&trunc);
               MyDrawChars(prefs.world[wLocal+num].name,length,0,ymove,false);
+#ifdef _TRG_
               if (isTRG)
                 DrawTime(wLocal+num,ymove+4,false,false,false);
               else
+#endif
                 DrawTime(wLocal+num,ymove,false,false,false);
 
               break;
@@ -1681,9 +2039,11 @@
               MyDrawChars(prefs.world[wAlarm1+num].name,length,0,ymove,false);
 
               DrawAlarmCheck(wAlarm1+num,ymove);
+#ifdef _TRG_
               if (isTRG)
                 DrawTime(wAlarm1+num,ymove+4,true,false,false);
               else
+#endif
                 DrawTime(wAlarm1+num,ymove,true,false,false);
 
               if (prefs.world[wAlarm1+num].options.trigger==1)
@@ -1693,9 +2053,11 @@
               else
                 MyDrawChars(salarmmode[prefs.world[wAlarm1+num].options.trigger-2],StrLen(salarmmode[prefs.world[wAlarm1+num].options.trigger-2]),panelwidth/2,ymove,false);
 
+#ifdef _TRG_
               if (isTRG)
                  DrawAlarmSound(wAlarm1+num,50,ymove);
               else
+#endif
                  DrawAlarmSound(wAlarm1+num,34,ymove);
                 /*
               if (prefs.world[wAlarm1+num].options.ampm==0)
@@ -1719,16 +2081,20 @@
 
               if (pan==pnTimer)
               {
+#ifdef _TRG_
                 if (isTRG)
                   DrawTimerTime(wTimer1+num,ymove+4,false,false);
                 else
+#endif
                   DrawTimerTime(wTimer1+num,ymove,false,false);
               }
               else
               {
+#ifdef _TRG_
                 if (isTRG)
                   DrawTimerTime(wTimer1+num,ymove+29,false,true);
                 else
+#endif
                   DrawTimerTime(wTimer1+num,ymove+18,false,true);
                 DrawTimerControls(wTimer1+num,ymove,true);
                 /*
@@ -1767,9 +2133,11 @@
                     }
                     iii=FntCharsWidth(text,StrLen(text));
                     MyDrawChars(text,StrLen(text),(panelwidth /2 )-(iii/2),ymove+2,false);
+#ifdef _TRG_
                     if (isTRG)
                       DrawTimerTime(wTimer1+num,ymove+4,true,false);
                     else
+#endif
                       D