From: Ton v. O. <tvo...@us...> - 2006-08-23 17:50:49
|
Update of /cvsroot/easycalc/easycalc In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv31944 Added Files: VERSION about.c about.h Log Message: New files for new about form. --- NEW FILE: VERSION --- 1.24-cvs --- NEW FILE: about.c --- /* * $Id: about.c,v 1.1 2006/08/23 17:50:44 tvoverbe Exp $ * * Copyright 2006 Ton van Overbeek * * This 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, or (at your option) * any later version. * * * Summary * Resizable about and help form routines for EasyCalc. * * Author * Ton van Overbeek, to...@v-... * */ #include <PalmOS.h> #include "calcrsc.h" #ifdef SUPPORT_DIA #include "DIA.h" #endif static UInt16 returnFormID = frmBasic; static void updateScrollers(FormType *form, FieldType *fld) { UInt16 upix, downix; Boolean enableUp, enableDown; enableUp = FldScrollable(fld, winUp); enableDown = FldScrollable(fld, winDown); upix = FrmGetObjectIndex(form, abtUp); downix = FrmGetObjectIndex(form, abtDn); FrmUpdateScrollers(form, upix, downix, enableUp, enableDown); } static void helpScroll(FormType *form, WinDirectionType dir) { UInt16 linestoscroll; FieldType *fld; fld = FrmGetObjectPtr(form, FrmGetObjectIndex(form, abtText)); linestoscroll = FldGetVisibleLines(fld) - 1; FldScrollField(fld, linestoscroll, dir); updateScrollers(form, fld); } static void releaseResource(FormType *form) { FieldType *fld; MemHandle aboutH; fld = FrmGetObjectPtr(form, FrmGetObjectIndex(form, abtText)); aboutH = FldGetTextHandle(fld); FldSetTextHandle(fld, 0); DmReleaseResource(aboutH); } Boolean aboutEventHandler(EventPtr event) { Boolean handled = false; FormType *form = FrmGetActiveForm(); FieldType *fld; #ifdef SUPPORT_DIA if (ResizeHandleEvent(event)) { return true; } #endif switch (event->eType) { case frmOpenEvent: case frmUpdateEvent: FrmDrawForm(form); fld = FrmGetObjectPtr(form, FrmGetObjectIndex(form, abtText)); updateScrollers(form, fld); handled = true; break; case ctlSelectEvent: if (event->data.ctlEnter.controlID == abtOk) { FrmGotoForm(returnFormID); handled = true; } break; case frmCloseEvent: releaseResource(form); break; case ctlRepeatEvent: if (event->data.ctlRepeat.controlID == abtUp) { helpScroll(form, winUp); } else if (event->data.ctlRepeat.controlID == abtDn) { helpScroll(form, winDown); } break; default: break; } return handled; } void doAbout(UInt16 aboutStringID) { MemHandle aboutH; FormType *form; FieldType *fld; aboutH = DmGetResource(strRsc, aboutStringID); form = FrmInitForm(frmAbout); fld = FrmGetObjectPtr(form, FrmGetObjectIndex(form, abtText)); FldSetTextHandle(fld, aboutH); FldSetInsertionPoint(fld, 0); returnFormID = FrmGetActiveFormID(); if (returnFormID == 0) returnFormID = frmBasic; FrmGotoForm(frmAbout); } --- NEW FILE: about.h --- /* * $Id: about.h,v 1.1 2006/08/23 17:50:44 tvoverbe Exp $ * * Copyright 2006 Ton van Overbeek * * This 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, or (at your option) * any later version. * * * Summary * Resizable about and help form routines for EasyCalc. * * Author * Ton van Overbeek, to...@v-... * */ Boolean aboutEventHandler(EventPtr event); void doAbout(UInt16 aboutStringID); |