home *** CD-ROM | disk | FTP | other *** search
- /*
- GIK/2 1.0.1 EWYHA.C 5621-432 (C) COPYRIGHT IBM CORP 1991, 1993. ALL RIGHTS RESERVED. LICENSED MATERIALS - PROPERTY OF IBM.
- */
- /**********************************************************************/
- /* */
- /* MODULE PROLOGUE */
- /* */
- /* COMPONENT NAME: CLOCK EXAMPLE */
- /* */
- /* MODULE NAME: EWYHA.C */
- /* */
- /* DESCRIPTIVE NAME: Graphics Interface Kit/2 - Clock Example */
- /* */
- /* PURPOSE: */
- /* */
- /* This module contains functions of the customizing code of */
- /* the clock example. */
- /* */
- /* DESCRIPTION: */
- /* */
- /* The actual drawing routines for the three clock styles are */
- /* coded here. */
- /* */
- /* */
- /* COPYRIGHT: (C) 1991, 1993 IBM Corporation */
- /* */
- /* DISCLAIMER OF WARRANTIES. The following [enclosed] code is */
- /* sample code created by IBM Corporation. This sample code is not */
- /* part of any standard or IBM product and is provided to you solely */
- /* for the purpose of assisting you in the development of your */
- /* applications. The code is provided "AS IS", without */
- /* warranty of any kind. IBM shall not be liable for any damages */
- /* arising out of your use of the sample code, even if they have been */
- /* advised of the possibility of such damages. */
- /* */
- /**********************************************************************/
-
- ;
-
- /*--------------------------------------------------------------------*/
- /* INCLUDE RELATED DEFINES */
- /*--------------------------------------------------------------------*/
-
- #define INCL_DOS /* OS/2 definitions */
- #define INCL_PM /* PM definitions */
-
- /*--------------------------------------------------------------------*/
- /* HEADER FILES */
- /*--------------------------------------------------------------------*/
-
- #include <os2.h> /* OS/2 header file */
- #include <math.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <ewyga.h> /* GIK/2 header file */
- #include "EWYHADF.H" /* Generated header file */
- #include "EWYHA.H" /* Header file */
-
- /*--------------------------------------------------------------------*/
- /* Local constants */
- /*--------------------------------------------------------------------*/
-
- ;
-
- /*------------------------------------------------------------------*/
- /* Radius for the different mercurian circles */
- /*------------------------------------------------------------------*/
-
- #define Q_DOT_RADIUS 400
- #define Q_SEC_RADIUS 550
- #define Q_MIN_RADIUS 250
- ;
-
- /*------------------------------------------------------------------*/
- /* Radius for the different martian circles */
- /*------------------------------------------------------------------*/
-
- #define M_HOUR_RADIUS 550
- #define M_MIN_RADIUS 300
- #define M_SEC_RADIUS 150
-
- /*--------------------------------------------------------------------*/
- /* Module variables */
- /*--------------------------------------------------------------------*/
-
- ;
-
- /*------------------------------------------------------------------*/
- /* All the symbol handles for the mercurian clock */
- /*------------------------------------------------------------------*/
-
- static SHND Q_top_shnd;
- static SHND Q_sec_shnd;
- static SHND Q_min_shnd;
- static SHND Q_hour_shnd;
- static SHND Q_min_c1_shnd;
- static SHND Q_min_c2_shnd;
- static SHND Q_secline_shnd;
- ;
-
- /*------------------------------------------------------------------*/
- /* All the symbol handles for the martian clock */
- /*------------------------------------------------------------------*/
-
- static SHND M_ssec_shnd;
- static SHND M_sec_shnd;
- static SHND M_secline_shnd;
- static SHND M_min_shnd;
- static SHND M_minline_shnd;
- static SHND M_hour_shnd;
- static SHND M_hourline_shnd;
-
- /*------------------------------------------------------------------*/
- /* All the symbol handles for the venusian clock */
- /*------------------------------------------------------------------*/
-
- static SHND V_base_shnd;
- static SHND V_hour_shnd;
- static SHND V_hour_text_shnd;
- static SHND V_min_shnd;
- static SHND V_min_text_shnd;
- static SHND V_sec_shnd;
- static SHND V_sec_text_shnd;
- static POINTL V_text_off;
-
- /*--------------------------------------------------------------------*/
- /* Local function prototypes */
- /*--------------------------------------------------------------------*/
-
- ;
-
- /*--------------------------------------------------------------------*/
- /* Functions */
- /*--------------------------------------------------------------------*/
-
- ;
-
- /**********************************************************************/
- /* Q_Build */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): diagram handle */
- /* */
- /* Returns: */
- /* GS_OK */
- /* */
- /* Description: */
- /* Initially builds the mercurian clock. */
- /**********************************************************************/
-
- SHORT Q_Build(DHND dhnd)
- {
- SHND shnd;
- double ang;
- POINTL pos;
- SHORT n;
-
- /*------------------------------------------------------------------*/
- /* Add the 60 dots */
- /*------------------------------------------------------------------*/
-
- n = 0;
- ang = 0.0;
- for (; n < 60; n++)
- {
- pos.x = (LONG)(Q_DOT_RADIUS *sin(ang));
- pos.y = (LONG)(Q_DOT_RADIUS *cos(ang));
- GsAddSym(dhnd, &shnd, Q_dot, Q_dot_f0);
- GsPutSymPosition(dhnd, shnd, &pos);
- ang += (360/60)/(180/PI);
- }
- Q_top_shnd = shnd-59; /* remember the 'shnd' of the
- top dot. This is the 12
- o'clock dot. */
-
- /*------------------------------------------------------------------*/
- /* Add hour symbol */
- /*------------------------------------------------------------------*/
-
- GsAddSym(dhnd, &Q_hour_shnd, Q_hour, Q_hour_f0);
-
- /*------------------------------------------------------------------*/
- /* Add symbols for minute display */
- /*------------------------------------------------------------------*/
-
- GsAddSym(dhnd, &Q_min_shnd, Q_min, Q_min_f0);
- GsAddSym(dhnd, &Q_min_c1_shnd, Q_line, Q_line_f0);/* link from
- 'hour' to 'minute' symbol. */
- GsPutSymTerminal(dhnd, Q_min_c1_shnd, GS_SOURCE, Q_hour_shnd);
- GsPutSymTerminal(dhnd, Q_min_c1_shnd, GS_TARGET, Q_min_shnd);
- GsAddSym(dhnd, &Q_min_c2_shnd, Q_minline, Q_minline_f0);/* link from
- 'minute' symbol to dots. */
- GsPutSymTerminal(dhnd, Q_min_c2_shnd, GS_SOURCE, Q_min_shnd);
-
- /*------------------------------------------------------------------*/
- /* Add the time-second and time-line symbol and attach them */
- /*------------------------------------------------------------------*/
-
- GsAddSym(dhnd, &Q_sec_shnd, Q_sec, Q_sec_f0);/* 'second' symbol */
- GsAddSym(dhnd, &Q_secline_shnd, Q_secline, Q_secline_f0);/* link
- from 'second' symbol to
- dots. */
- GsPutSymTerminal(dhnd, Q_secline_shnd, GS_TARGET, Q_sec_shnd);
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_OK);
- }
-
- /**********************************************************************/
- /* Q_Tick */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): diagram handle */
- /* DATETIME *pNew_time (I): pointer to structure with new time */
- /* DATETIME *pOld_time (I): pointer to structure with old time */
- /* */
- /* Returns: */
- /* GS_OK */
- /* */
- /* Description: */
- /* This is the function to display the time for the mercurian clock.*/
- /* */
- /* Based upon the difference in time of the 'old' and the 'new' */
- /* time, the clock face, or parts of it are updated. */
- /**********************************************************************/
-
- SHORT Q_Tick(DHND dhnd,DATETIME *pNew_time,DATETIME *pOld_time)
- {
- double ang;
- POINTL pos;
- CHAR text[4];
-
- /*------------------------------------------------------------------*/
- /* See if anything is to do */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->seconds == pOld_time->seconds/* */
- && pNew_time->minutes == pOld_time->minutes/* */
- && pNew_time->hours == pOld_time->hours)
- return (GS_OK);
-
- /*------------------------------------------------------------------*/
- /* The time changed */
- /*------------------------------------------------------------------*/
-
- SecondTick(DO_TICK);
-
- /*------------------------------------------------------------------*/
- /* Adjust the second dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->seconds != pOld_time->seconds)
- {
-
- /*----------------------------------------------------------------*/
- /* Put new position */
- /*----------------------------------------------------------------*/
-
- ang = ((360/60)/(180/PI))*pNew_time->seconds;
- pos.x = (LONG)(Q_SEC_RADIUS *sin(ang));
- pos.y = (LONG)(Q_SEC_RADIUS *cos(ang));
- GsPutSymPosition(dhnd, Q_sec_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put second text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->seconds);
- GsPutPartText(dhnd, Q_sec_shnd, Q_sec_ptext, text);
-
- /*----------------------------------------------------------------*/
- /* Adjust the second pointer */
- /*----------------------------------------------------------------*/
-
- GsPutSymTerminal(dhnd, Q_secline_shnd, GS_SOURCE, Q_top_shnd+
- pNew_time->seconds);
- }
-
- /*------------------------------------------------------------------*/
- /* Adjust the minute dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->minutes != pOld_time->minutes)
- {
-
- /*----------------------------------------------------------------*/
- /* Put new position */
- /*----------------------------------------------------------------*/
-
- ang = ((360/60)/(180/PI))*pNew_time->minutes;
- pos.x = (LONG)(Q_MIN_RADIUS *sin(ang));
- pos.y = (LONG)(Q_MIN_RADIUS *cos(ang));
- GsPutSymPosition(dhnd, Q_min_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put minute text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->minutes);
- GsPutPartText(dhnd, Q_min_shnd, Q_min_ptext, text);
-
- /*----------------------------------------------------------------*/
- /* Adjust the minute pointer */
- /*----------------------------------------------------------------*/
-
- GsPutSymTerminal(dhnd, Q_min_c2_shnd, GS_TARGET, Q_top_shnd+
- pNew_time->minutes);
- }
-
- /*------------------------------------------------------------------*/
- /* Adjust the hour dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->hours != pOld_time->hours)
- {
-
- /*----------------------------------------------------------------*/
- /* Put hour text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->hours);
- GsPutPartText(dhnd, Q_hour_shnd, Q_hour_ptext, text);
- }
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_OK);
- }
-
- ;
-
- /**********************************************************************/
- /* M_Build */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): diagram handle */
- /* */
- /* Returns: */
- /* GS_OK */
- /* */
- /* Description: */
- /* Initially build the mars clock. */
- /**********************************************************************/
-
- SHORT M_Build(DHND dhnd)
- {
-
- /*------------------------------------------------------------------*/
- /* Add the three pointers first, so they are at the grapihcal bottom*/
- /*------------------------------------------------------------------*/
-
- GsAddSym(dhnd, &M_secline_shnd, M_secline, M_secline_f0);
- GsAddSym(dhnd, &M_minline_shnd, M_minline, M_minline_f0);
- GsAddSym(dhnd, &M_hourline_shnd, M_hourline, M_hourline_f0);
-
- /*------------------------------------------------------------------*/
- /* Add the four bubbles */
- /*------------------------------------------------------------------*/
-
- GsAddSym(dhnd, &M_ssec_shnd, M_ssec, M_ssec_f0);
- GsAddSym(dhnd, &M_sec_shnd, M_sec, M_sec_f0);
- GsAddSym(dhnd, &M_min_shnd, M_min, M_min_f0);
- GsAddSym(dhnd, &M_hour_shnd, M_hour, M_hour_f0);
-
- /*------------------------------------------------------------------*/
- /* Connect the three pointers */
- /*------------------------------------------------------------------*/
-
- GsPutSymTerminal(dhnd, M_hourline_shnd, GS_SOURCE, M_hour_shnd);
- GsPutSymTerminal(dhnd, M_hourline_shnd, GS_TARGET, M_min_shnd);
- GsPutSymTerminal(dhnd, M_minline_shnd, GS_SOURCE, M_min_shnd);
- GsPutSymTerminal(dhnd, M_minline_shnd, GS_TARGET, M_sec_shnd);
- GsPutSymTerminal(dhnd, M_secline_shnd, GS_SOURCE, M_sec_shnd);
- GsPutSymTerminal(dhnd, M_secline_shnd, GS_TARGET, M_ssec_shnd);
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_OK);
- }
-
- /**********************************************************************/
- /* M_Tick */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): diagram handle */
- /* DATETIME *pNew_time (I): pointer to structure with new time */
- /* DATETIME *pOld_time (I): pointer to structure with old time */
- /* */
- /* Returns: */
- /* GS_OK */
- /* */
- /* Description: */
- /* This is the function to dispaly the time for the martian clock. */
- /* */
- /* Based upon the difference in time of the 'old' and the 'new' */
- /* time, the clock face, or parts of it are updated. */
- /**********************************************************************/
-
- SHORT M_Tick(DHND dhnd,DATETIME *pNew_time,DATETIME *pOld_time)
- {
- double ang;
- CHAR text[4];
- POINTL pos;
-
- /*------------------------------------------------------------------*/
- /* See if anything is to do */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->seconds == pOld_time->seconds/* */
- && pNew_time->minutes == pOld_time->minutes/* */
- && pNew_time->hours == pOld_time->hours)
- return (GS_OK);
-
- /*------------------------------------------------------------------*/
- /* The time changed */
- /*------------------------------------------------------------------*/
-
- SecondTick(DO_TICK);
-
- /*------------------------------------------------------------------*/
- /* Adjust the hour dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->hours != pOld_time->hours)
- {
-
- /*----------------------------------------------------------------*/
- /* Calc the new position */
- /*----------------------------------------------------------------*/
-
- ang = ((360/12)/(180/PI))*pNew_time->hours;
- pos.x = (LONG)(-M_HOUR_RADIUS *sin(ang));
- pos.y = (LONG)(-M_HOUR_RADIUS *cos(ang));
- GsPutSymPosition(dhnd, M_hour_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put hour text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->hours);
- GsPutPartText(dhnd, M_hour_shnd, M_hour_ptext, text);
- }
-
- /*------------------------------------------------------------------*/
- /* Adjust the minute dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->minutes != pOld_time->minutes)
- {
-
- /*----------------------------------------------------------------*/
- /* Calc the new position */
- /*----------------------------------------------------------------*/
-
- ang = ((360/60)/(180/PI))*pNew_time->minutes;
- pos.x = (LONG)(M_MIN_RADIUS *sin(ang));
- pos.y = (LONG)(M_MIN_RADIUS *cos(ang));
- GsPutSymPosition(dhnd, M_sec_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put minute text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->minutes);
- GsPutPartText(dhnd, M_min_shnd, M_min_ptext, text);
-
- /*----------------------------------------------------------------*/
- /* Force decendants for update */
- /*----------------------------------------------------------------*/
-
- pOld_time->seconds = 0xff;
- }
-
- /*------------------------------------------------------------------*/
- /* Adjust the second dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->seconds != pOld_time->seconds)
- {
-
- /*----------------------------------------------------------------*/
- /* Get offset */
- /*----------------------------------------------------------------*/
-
- GsGetSymPosition(dhnd, M_sec_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Calc the new position */
- /*----------------------------------------------------------------*/
-
- ang = ((360/60)/(180/PI))*pNew_time->seconds;
- pos.x += (LONG)(M_SEC_RADIUS *sin(ang));
- pos.y += (LONG)(M_SEC_RADIUS *cos(ang));
- GsPutSymPosition(dhnd, M_ssec_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put second text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->seconds);
- GsPutPartText(dhnd, M_sec_shnd, M_sec_ptext, text);
- }
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_OK);
- }
-
- ;
- ;
-
- /**********************************************************************/
- /* V_Build */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): diagram handle */
- /* */
- /* Returns: */
- /* GS_OK */
- /* */
- /* Description: */
- /* Initially build the venusian clock. */
- /**********************************************************************/
-
- SHORT V_Build(DHND dhnd)
- {
- RECTL br;
-
- /*------------------------------------------------------------------*/
- /* Add the four needed symbol first, so they are at the grapihcal */
- /* bottom */
- /*------------------------------------------------------------------*/
-
- GsAddSym(dhnd, &V_base_shnd, V_base, V_base_f0);
- GsAddSym(dhnd, &V_hour_shnd, V_hour, V_hour_f0);
- GsAddSym(dhnd, &V_hour_text_shnd, V_text, V_text_f0);
- GsAddSym(dhnd, &V_min_shnd, V_min, V_min_f0);
- GsAddSym(dhnd, &V_min_text_shnd, V_text, V_text_f0);
- GsAddSym(dhnd, &V_sec_shnd, V_sec, V_sec_f0);
- GsAddSym(dhnd, &V_sec_text_shnd, V_text, V_text_f0);
-
- /*------------------------------------------------------------------*/
- /* Get offset of text fieled */
- /*------------------------------------------------------------------*/
-
- GsGetSymBoundingRect(dhnd, V_sec_text_shnd, GS_BR_VISIBLE_SYM, GS_YES,
- 0, &br);
- V_text_off.x = (br.xRight+br.xLeft)/2;
- V_text_off.y = (br.yTop+br.yBottom)/2;
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_OK);
- }
-
- /**********************************************************************/
- /* V_Tick */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): diagram handle */
- /* DATETIME *pNew_time (I): pointer to structure with new time */
- /* DATETIME *pOld_time (I): pointer to structure with old time */
- /* */
- /* Returns: */
- /* GS_OK */
- /* */
- /* Description: */
- /* This is the function to dispaly the time for the venusian clock. */
- /* */
- /* Based upon the difference in time of the 'old' and the 'new' */
- /* time, the clock face, or parts of it are updated. */
- /**********************************************************************/
-
- SHORT V_Tick(DHND dhnd,DATETIME *pNew_time,DATETIME *pOld_time)
- {
- double ang;
- double s05,c05;
- CHAR text[4];
- POINTL pos;
- RECTL br;
- POINTL dim_base;
- POINTL dim_hour;
- POINTL dim_min;
- POINTL dim_sec;
-
- /*------------------------------------------------------------------*/
- /* See if anything is to do */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->seconds == pOld_time->seconds/* */
- && pNew_time->minutes == pOld_time->minutes/* */
- && pNew_time->hours == pOld_time->hours)
- return (GS_OK);
-
- /*------------------------------------------------------------------*/
- /* The time changed */
- /*------------------------------------------------------------------*/
-
- SecondTick(DO_TICK);
-
- /*------------------------------------------------------------------*/
- /* Get all the clock metrics */
- /*------------------------------------------------------------------*/
-
- GsGetSymBoundingRect(dhnd, V_base_shnd, GS_BR_VISIBLE_SYM, GS_YES, 0,
- &br);
- dim_base.x = br.xRight-br.xLeft;
- dim_base.y = br.yTop-br.yBottom;
- GsGetSymBoundingRect(dhnd, V_hour_shnd, GS_BR_VISIBLE_SYM, GS_YES, 0,
- &br);
- dim_hour.x = br.xRight-br.xLeft;
- dim_hour.y = br.yTop-br.yBottom;
- GsGetSymBoundingRect(dhnd, V_min_shnd, GS_BR_VISIBLE_SYM, GS_YES, 0,
- &br);
- dim_min.x = br.xRight-br.xLeft;
- dim_min.y = br.yTop-br.yBottom;
- GsGetSymBoundingRect(dhnd, V_sec_shnd, GS_BR_VISIBLE_SYM, GS_YES, 0,
- &br);
- dim_sec.x = br.xRight-br.xLeft;
- dim_sec.y = br.yTop-br.yBottom;
-
- /*------------------------------------------------------------------*/
- /* Adjust the hour dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->hours != pOld_time->hours)
- {
-
- /*----------------------------------------------------------------*/
- /* Calc the new hour position */
- /*----------------------------------------------------------------*/
-
- ang = ((360/12)/(180/PI))*pNew_time->hours;
- GsGetSymPosition(dhnd, V_base_shnd, &pos);
- pos.x += (LONG)((dim_base.x-dim_hour.x)*sin(ang)*0.5);
- pos.y += (LONG)((dim_base.y-dim_hour.y)*cos(ang)*0.5);
- GsPutSymPosition(dhnd, V_hour_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put hour text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->hours);
- GsPutPartText(dhnd, V_hour_text_shnd, V_text_p0, text);
-
- /*----------------------------------------------------------------*/
- /* Force decendants for update */
- /*----------------------------------------------------------------*/
-
- pOld_time->minutes = 0xff;
- }
-
- /*------------------------------------------------------------------*/
- /* Adjust the minute dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->minutes != pOld_time->minutes)
- {
-
- /*----------------------------------------------------------------*/
- /* Get minute hand angle */
- /*----------------------------------------------------------------*/
-
- ang = ((360/60)/(180/PI))*pNew_time->minutes;
- s05 = sin(ang)*0.5;
- c05 = cos(ang)*0.5;
- GsGetSymPosition(dhnd, V_hour_shnd, &pos);
- pos.x += (LONG)((dim_hour.x-dim_min.x)*s05);
- pos.y += (LONG)((dim_hour.y-dim_min.y)*c05);
- GsPutSymPosition(dhnd, V_min_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put minute text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->minutes);
- GsPutPartText(dhnd, V_min_text_shnd, V_text_p0, text);
-
- /*----------------------------------------------------------------*/
- /* Position 'hour' text field */
- /*----------------------------------------------------------------*/
-
- pos.x -= (LONG)((dim_hour.x)*s05)+V_text_off.x;
- pos.y -= (LONG)((dim_hour.y)*c05)+V_text_off.y;
- GsPutSymPosition(dhnd, V_hour_text_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Force decendants for update */
- /*----------------------------------------------------------------*/
-
- pOld_time->seconds = 0xff;
- }
-
- /*------------------------------------------------------------------*/
- /* Adjust the second dependent stuff */
- /*------------------------------------------------------------------*/
-
- if (pNew_time->seconds != pOld_time->seconds)
- {
-
- /*----------------------------------------------------------------*/
- /* Get second hand angle */
- /*----------------------------------------------------------------*/
-
- ang = ((360/60)/(180/PI))*pNew_time->seconds;
- s05 = sin(ang)*0.5;
- c05 = cos(ang)*0.5;
- GsGetSymPosition(dhnd, V_min_shnd, &pos);
- pos.x += (LONG)((dim_min.x-dim_sec.x)*s05);
- pos.y += (LONG)((dim_min.y-dim_sec.y)*c05);
- GsPutSymPosition(dhnd, V_sec_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Position 'seconds' text field */
- /*----------------------------------------------------------------*/
-
- pos.x -= V_text_off.x;
- pos.y -= V_text_off.y;
- GsPutSymPosition(dhnd, V_sec_text_shnd, &pos);
-
- /*----------------------------------------------------------------*/
- /* Put 'second' text */
- /*----------------------------------------------------------------*/
-
- sprintf(text, "%2d", pNew_time->seconds);
- GsPutPartText(dhnd, V_sec_text_shnd, V_text_p0, text);
-
- /*----------------------------------------------------------------*/
- /* Position 'minute' text field */
- /*----------------------------------------------------------------*/
-
- pos.x -= (LONG)((dim_min.x)*s05);
- pos.y -= (LONG)((dim_min.y)*c05);
- GsPutSymPosition(dhnd, V_min_text_shnd, &pos);
- }
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_OK);
- }
-
- ;