Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
d97541e72e |
@ -1,5 +1,8 @@
|
||||
AmiTimeKeeper Change Log
|
||||
|
||||
v1.06 08.02.2019
|
||||
- Adjust layout in settings window
|
||||
|
||||
v1.05 06.08.2018
|
||||
- Preferences can now be saved from settings window
|
||||
- Time zone is shown as UTC offset in settings window
|
||||
@ -7,7 +10,7 @@ v1.05 06.08.2018
|
||||
- Low water option renamed to threshold and high water option removed
|
||||
- New option for sending log messages to file instead of to screen
|
||||
- Some incorrect NTP log messages no longer appears
|
||||
- Read-only options is now applied consistently
|
||||
- Read-only option is now applied consistently
|
||||
- Potential race condition in memory allocation fixed
|
||||
- Other minor enhancements
|
||||
|
||||
|
2
LICENSE
2
LICENSE
@ -1,7 +1,7 @@
|
||||
Copyright (c) 2001, 02 Motoyuki Kasahara
|
||||
Copyright (c) 2007 TANDBERG Telecom AS
|
||||
Copyright (c) 2008-2009 Dag-Erling Smørgrav <des@des.no>
|
||||
Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
289
Manual
Normal file
289
Manual
Normal file
@ -0,0 +1,289 @@
|
||||
@database TimeKeeper.guide
|
||||
@$VER: TimeKeeper.guide 1.06 (2019-02-08)
|
||||
@(c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
@author Carsten Sonne Larsen
|
||||
|
||||
@rem Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
@rem All rights reserved.
|
||||
@rem
|
||||
@rem Redistribution and use in source and binary forms, with or without
|
||||
@rem modification, are permitted provided that the following conditions
|
||||
@rem are met:
|
||||
@rem 1. Redistributions of source code must retain the above copyright
|
||||
@rem notice, this list of conditions and the following disclaimer.
|
||||
@rem 2. Redistributions in binary form must reproduce the above copyright
|
||||
@rem notice, this list of conditions and the following disclaimer in the
|
||||
@rem documentation and/or other materials provided with the distribution.
|
||||
@rem
|
||||
@rem THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
@rem IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
@rem OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
@rem IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
@rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
@rem NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
@rem THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@Width 74
|
||||
|
||||
@Node Main "TimeKeeper.guide"
|
||||
@Next "Configuring the client"
|
||||
|
||||
AmiTimeKeeper is a small program which keeps the time right on your
|
||||
machine. No installation is required.
|
||||
|
||||
AmiTimeKeeper is operated as a commodity and is controlled by AmigaOS.
|
||||
An AmiTCP compatible TCP/IP stack is required for AmiTimeKeeper to work.
|
||||
|
||||
AmiTimeKeeper can be configured through several settings. This can be
|
||||
done either directly from the command line or by using the tooltypes
|
||||
of an icon. Preferences can also be saved between reboots.
|
||||
|
||||
@{"Configuring the client" Link "Configuring the client"}
|
||||
@{"Using tooltypes of an icon" Link "Using tooltypes of an icon"}
|
||||
@{"Saving preferences" Link "Saving preferences"}
|
||||
@{"Change Log / Change History" Link "Change Log"}
|
||||
@{"Software License" Link "Software License"}
|
||||
@{"Contacting the author" Link "Contacting the author"}
|
||||
|
||||
@EndNode
|
||||
|
||||
@Node "Configuring the client" "TimeKeeper.guide/Configuring the client"
|
||||
@Toc "Main"
|
||||
@Prev "Main"
|
||||
@Next "Using tooltypes of an icon"
|
||||
@{b}Server Address@{ub}
|
||||
|
||||
NTP servers are managed by several organizations. The pool.ntp.org
|
||||
project and Network Time Foundation are probably the two most famous.
|
||||
The pool.ntp.org project organize servers into pools whereas Network
|
||||
Time Foundation maintains a list of valid NTP servers. The servers are
|
||||
divided into two categories: Stratum 1 and Stratum 2.
|
||||
|
||||
The NTP pool servers are divided into zones. If you want to use a server
|
||||
in Europe you can use set the server address to europe.pool.ntp.org.
|
||||
For North America the server address is north-america.pool.ntp.org.
|
||||
Zones also exists for countries. To use a server in for example Germany
|
||||
the server address should be set to de.pool.ntp.org. For Switzerland
|
||||
the address should be ch.pool.ntp.org.
|
||||
|
||||
Network Time Foundation has a website on http://support.ntp.org/
|
||||
The pool.ntp.org project website is located at https://www.ntppool.org/
|
||||
|
||||
@{b}Server Port@{ub}
|
||||
|
||||
NTP servers use port 123 as default. Only under special circumstances
|
||||
are the NTP server port different from 123.
|
||||
|
||||
@{b}Interval between requests@{ub}
|
||||
|
||||
The Amiga hardware clock will slowly drift away from true time. The
|
||||
drift is determined by several factors and is small, but the drift is not
|
||||
insignificant. Request are repeatedly sent to the NTP server in order to
|
||||
keep the Amiga hardware clock as close to true time as possible.
|
||||
|
||||
The requests are sent in certain intervals defined by the interval
|
||||
parameter. The interval should be specified using milliseconds. One
|
||||
thousand (1.000) milliseconds are equal to one second.
|
||||
|
||||
@{b}Threshold@{ub}
|
||||
|
||||
Due to the accuracy of NTP servers and the nature of Amiga CPUs it does
|
||||
not make sense to adjust the Amiga clock on every response from the NTP
|
||||
server. Processing the response could take longer time than anticipated.
|
||||
The amount of accepted inaccuracy is set using the threshold parameter.
|
||||
The threshold should be specified using microsecond. One million
|
||||
microseconds (1.000.000) are equal to one second.
|
||||
|
||||
@{b}Read Only@{ub}
|
||||
|
||||
It is possible to send request to the NTP server without setting the
|
||||
Amiga hardware clock. This option can be handy when debugging time zone
|
||||
setup and other time related parameters.
|
||||
|
||||
@{b}Connection Timeout@{ub}
|
||||
|
||||
In some cases, a connection to the NTP server cannot be established or
|
||||
the NTP server simply does respond. To avoid an infinitive wait for a
|
||||
response the connection will instead make a time out. The timeout
|
||||
interval should be specified using milliseconds. One thousand (1.000)
|
||||
milliseconds are equal to one second.
|
||||
|
||||
@{b}Verbosity@{ub}
|
||||
|
||||
The level of logging can be adjusted from none to all. Expressed as a
|
||||
numeric value verbose can be 0, 1, 2 or 3, where 0 is equal to none and
|
||||
3 is equal to maximum verbosity.
|
||||
|
||||
@{b}Log file@{ub}
|
||||
|
||||
It is possible to send log messages to a file instead of sending them to
|
||||
a console window.
|
||||
|
||||
@EndNode
|
||||
|
||||
@Node "Using tooltypes of an icon" "TimeKeeper.guide/Using tooltypes of an icon"
|
||||
@Toc "Main"
|
||||
@Prev "Configuring the client"
|
||||
@Next "Saving preferences"
|
||||
|
||||
Settings can be changes by setting tooltypes in the TimeKeeper icon.
|
||||
Add the following line to the icon tooltypes in order to set the server
|
||||
to an European pool server:
|
||||
SERVER=europe.pool.ntp.org
|
||||
|
||||
The available tooltypes are the same as the available command line
|
||||
parameters.
|
||||
|
||||
@{b}Parameter@{ub} | @{b}Short description@{ub}
|
||||
-----------------------------------------
|
||||
SERVER | Server Address
|
||||
PORT | Server Port
|
||||
THRESHOLD | Adjustment threshold
|
||||
INTERVAL | Interval between requests
|
||||
CX_PRIORITY | Commodity priority
|
||||
READONLY | Read only option
|
||||
TIMEOUT | Connection Timeout
|
||||
VERBOSE | Log verbosity
|
||||
LOGFILE | Log file location
|
||||
|
||||
@{b}Caveats@{ub}
|
||||
|
||||
Settings can be overridden and are set in the following order:
|
||||
1. Preference file
|
||||
2. Icon tooltypes
|
||||
3. CLI parameters
|
||||
|
||||
CLI parameters has highest precedence and will always override settings
|
||||
from icon tooltypes and from the preference file.
|
||||
|
||||
@EndNode
|
||||
|
||||
@Node "Saving preferences" "TimeKeeper.guide/Saving preferences"
|
||||
@Toc "Main"
|
||||
@Prev "Using tooltypes of an icon"
|
||||
@Next "Change Log"
|
||||
|
||||
Preferences from the setting window are saved in the file
|
||||
ENV:timekeeper.prefs
|
||||
|
||||
Preferences are also persisted between reboots in the file
|
||||
ENVARC:timekeeper.prefs
|
||||
|
||||
Depending on the setup the content of timekeeper.prefs could be:
|
||||
|
||||
CX_PRIORITY=25
|
||||
THRESHOLD=1000000
|
||||
SERVER=de.pool.ntp.org
|
||||
PORT=123
|
||||
TIMEOUT=5000
|
||||
INTERVAL=17500
|
||||
VERBOSE=3
|
||||
READONLY=0
|
||||
LOGFILE=RAM:log
|
||||
|
||||
The preference file should not be edited under normal circumstances.
|
||||
|
||||
@{b}Caveats@{ub}
|
||||
|
||||
If LOGFILE is set in the preference file, no messages will be emitted
|
||||
to screen (unless overridden by CLI or Icon tooltype with LOGFILE=NO).
|
||||
|
||||
@EndNode
|
||||
|
||||
@Node "Change Log" "TimeKeeper.guide/Change Log"
|
||||
@Toc "Main"
|
||||
@Prev "Saving preferences"
|
||||
@Next "Software License"
|
||||
|
||||
@{b}v1.06 08.02.2019@{ub}
|
||||
- Adjust layout in settings window
|
||||
|
||||
@{b}v1.05 06.08.2018@{ub}
|
||||
- Preferences can now be saved from settings window
|
||||
- Time zone is shown as UTC offset in settings window
|
||||
- Running multiple instances no longer create zombie processes
|
||||
- Low water option renamed to threshold and high water option removed
|
||||
- New option for sending log messages to file instead of to screen
|
||||
- Some incorrect NTP log messages no longer appears
|
||||
- Read-only option is now applied consistently
|
||||
- Potential race condition in memory allocation fixed
|
||||
- Other minor enhancements
|
||||
|
||||
@{b}v1.04 15.12.2017@{ub}
|
||||
- Default settings adjusted to comply better with AmigaOS
|
||||
- Bugs in threshold settings (high/low water) fixed
|
||||
- Bugs in opening and closing of libraries fixed
|
||||
- New and more accurate error and log messages
|
||||
|
||||
@{b}v1.03 09.12.2017@{ub}
|
||||
- Settings window
|
||||
|
||||
@{b}v1.02 29.11.2017@{ub}
|
||||
- AROS code compliance
|
||||
|
||||
@{b}v1.01 28.11.2017@{ub}
|
||||
- Handle network disconnection
|
||||
- Fix infinity timeout problem
|
||||
- Support hardware clock
|
||||
- Improved error messages
|
||||
|
||||
@{b}v1.00 26.11.2017@{ub}
|
||||
- First public release
|
||||
|
||||
@EndNode
|
||||
|
||||
@Node "Software License" "TimeKeeper.guide/Software License"
|
||||
@Prev "Change Log"
|
||||
@Next "Contacting the author"
|
||||
@Toc "Main"
|
||||
|
||||
@{b}Simplified BSD License / 2-clause BSD license@{ub}
|
||||
|
||||
Copyright (c) 2001, 02 Motoyuki Kasahara
|
||||
Copyright (c) 2007 TANDBERG Telecom AS
|
||||
Copyright (c) 2008-2009 Dag-Erling Smørgrav <des@des.no>
|
||||
Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@EndNode
|
||||
|
||||
@Node "Contacting the author" "TimeKeeper.guide/Contacting the author"
|
||||
@Toc "Main"
|
||||
@Prev "Software License"
|
||||
|
||||
The author of AmiTimeKeeper can be contacted using the following
|
||||
email addresses: <carsten.larsen@mail.com> or <cs@innolan.net>.
|
||||
|
||||
Please notice <cs@innolan.net> is a member of several high volume
|
||||
mailing lists and should not be used under normal circumstances.
|
||||
|
||||
Feel free to send suggestions, feature request and bug reports.
|
||||
General comment and questions are also welcome.
|
||||
|
||||
Carsten Sonne Larsen
|
||||
February 2019
|
||||
|
||||
@EndNode
|
2
broker.c
2
broker.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
com.c
2
com.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2014-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
14
config.h
14
config.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -35,6 +35,8 @@
|
||||
#include <resources/battclock.h>
|
||||
#include <libraries/asl.h>
|
||||
#include <libraries/commodities.h>
|
||||
#include <graphics/text.h>
|
||||
#include <graphics/rastport.h>
|
||||
#include <dos/dos.h>
|
||||
#include <dos/dostags.h>
|
||||
#include <proto/dos.h>
|
||||
@ -48,6 +50,7 @@
|
||||
#include <proto/intuition.h>
|
||||
#include <proto/battclock.h>
|
||||
#include <proto/commodities.h>
|
||||
#include <clib/graphics_protos.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -127,11 +130,6 @@ int poll(struct pollfd *, nfds_t, int);
|
||||
#if AOS3
|
||||
#define IPTR ULONG
|
||||
#endif
|
||||
#if AOS3
|
||||
#define VARSIZE 0
|
||||
#else
|
||||
#define VARSIZE 1
|
||||
#endif
|
||||
|
||||
#ifdef AROS
|
||||
#define VSNPrintf(str, n, format, args) vsnprintf(str, n, format, args)
|
||||
@ -145,8 +143,8 @@ int poll(struct pollfd *, nfds_t, int);
|
||||
|
||||
#define APP_SHORT_NAME "AmiTimeKeeper"
|
||||
#define APP_LONG_NAME "Amiga Time Keeper"
|
||||
#define APP_VERSION "1.05"
|
||||
#define APP_DATE_VERSION "1.05 (06.08.2018)"
|
||||
#define APP_VERSION "1.06"
|
||||
#define APP_DATE_VERSION "1.06 (08.02.2019)"
|
||||
#define APP_ID APP_SHORT_NAME " " APP_DATE_VERSION
|
||||
#define APP_TITLE APP_LONG_NAME " " APP_DATE_VERSION
|
||||
#define APP_TITLE_VERSION APP_LONG_NAME " " APP_VERSION
|
||||
|
23
library.c
23
library.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -31,6 +31,7 @@
|
||||
/* Library identifiers */
|
||||
static const char *dosName = "dos.library";
|
||||
static const char *aslName = "asl.library";
|
||||
static const char *gfxName = "graphics.library";
|
||||
static const char *iconName = "icon.library";
|
||||
static const char *commoditiesName = "commodities.library";
|
||||
static const char *localeName = "locale.library";
|
||||
@ -46,6 +47,7 @@ static const char *mathName = "mathieeedoubbas.library";
|
||||
#define UtilityBase __FX_UtilityBase
|
||||
#define IntuitionBase __FX_IntuitionBase
|
||||
#define CxBase __FX_CxBase
|
||||
#define GfxBase __FX_GfxBase
|
||||
#define AslBase __FX_AslBase
|
||||
#define IconBase __FX_IconBase
|
||||
#define GadToolsBase __FX_GadToolsBase
|
||||
@ -60,6 +62,7 @@ struct LocaleBase *LocaleBase = NULL;
|
||||
struct UtilityBase *UtilityBase = NULL;
|
||||
struct IntuitionBase *IntuitionBase = NULL;
|
||||
struct Library *CxBase = NULL;
|
||||
struct Library *GfxBase = NULL;
|
||||
struct Library *AslBase = NULL;
|
||||
struct Library *IconBase = NULL;
|
||||
struct Library *GadToolsBase = NULL;
|
||||
@ -70,6 +73,8 @@ struct UtilityBase *__UtilityBase = NULL;
|
||||
#define DOSLIB_REV 36L
|
||||
#define ASLLIB_NAME ((STRPTR)aslName)
|
||||
#define ASLLIB_REV 37L
|
||||
#define GFXLIB_NAME ((STRPTR)gfxName)
|
||||
#define GFXLIB_REV 37L
|
||||
#define ICONLIB_NAME ((STRPTR)iconName)
|
||||
#define ICONLIB_REV 36L
|
||||
#define COMMODLIB_NAME ((STRPTR)commoditiesName)
|
||||
@ -217,6 +222,15 @@ int OpenLibraries(void)
|
||||
|
||||
OpenLibrarySuccess(GadToolsBase->lib_IdString);
|
||||
|
||||
// Graphics Library
|
||||
if (!(GfxBase = OpenLibrary((STRPTR)GFXLIB_NAME, GFXLIB_REV)))
|
||||
{
|
||||
OpenLibraryError(GFXLIB_NAME, GFXLIB_REV);
|
||||
return LIB_ERROR;
|
||||
}
|
||||
|
||||
OpenLibrarySuccess(GfxBase->lib_IdString);
|
||||
|
||||
// Locale
|
||||
if (!(Globals->Locale = OpenLocale(NULL)))
|
||||
{
|
||||
@ -308,6 +322,13 @@ void CloseLibraries(void)
|
||||
GadToolsBase = NULL;
|
||||
}
|
||||
|
||||
if (GfxBase != NULL)
|
||||
{
|
||||
ClosingLibrary(GfxBase->lib_IdString);
|
||||
CloseLibrary(GfxBase);
|
||||
GfxBase = NULL;
|
||||
}
|
||||
|
||||
if (IntuitionBase != NULL)
|
||||
{
|
||||
ClosingLibrary(((struct Library *)IntuitionBase)->lib_IdString);
|
||||
|
2
log.c
2
log.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
log.h
2
log.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
main.c
2
main.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
mem.h
2
mem.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2014-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
net.c
2
net.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 02 Motoyuki Kasahara
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 02 Motoyuki Kasahara
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
sntp.c
2
sntp.c
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* Copyright (c) 2007 TANDBERG Telecom AS
|
||||
* Copyright (c) 2008-2009 Dag-Erling Smørgrav <des@des.no>
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
sntp.h
2
sntp.h
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* Copyright (c) 2007 TANDBERG Telecom AS
|
||||
* Copyright (c) 2008-2009 Dag-Erling Smørgrav <des@des.no>
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
state.c
2
state.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
state.h
2
state.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
string.c
2
string.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
string.h
2
string.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
time.c
2
time.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
time.h
2
time.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
2
win.h
2
win.h
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
88
win_gad.c
88
win_gad.c
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -57,6 +57,18 @@ static const char *saveLabel = "Save";
|
||||
static const char *useLabel = "Use";
|
||||
static const char *cancelLabel = "Cancel";
|
||||
|
||||
static const char **textLabels[] = {
|
||||
&serverLabel,
|
||||
&portLabel,
|
||||
&timeoutLabel,
|
||||
&intervalLabel,
|
||||
&thresholdLabel,
|
||||
&verboseLabel,
|
||||
&priorityLabel,
|
||||
&timeZoneLabel,
|
||||
&lastSyncLabel,
|
||||
NULL};
|
||||
|
||||
static char *verboseLevel[] = {
|
||||
"Show none (0)",
|
||||
"Show some (1)",
|
||||
@ -64,11 +76,33 @@ static char *verboseLevel[] = {
|
||||
"Show all (3)",
|
||||
NULL};
|
||||
|
||||
int GetLabelWidth(struct RastPort *rp)
|
||||
{
|
||||
int len, max = 0;
|
||||
int c, i = 0;
|
||||
const char **label = textLabels[0];
|
||||
|
||||
while (**label != NULL)
|
||||
{
|
||||
c = StrLen(*label);
|
||||
len = TextLength(rp, *label, c);
|
||||
if (len > max)
|
||||
{
|
||||
max = len;
|
||||
}
|
||||
|
||||
label = textLabels[++i];
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
bool CreateGadgets(void)
|
||||
{
|
||||
struct Gadget *gadget;
|
||||
struct NewGadget *ng;
|
||||
long x, y, w, h;
|
||||
long x, y, h;
|
||||
long labelWidth;
|
||||
long textWidth, boxWidth;
|
||||
long col1, col2;
|
||||
long labelId;
|
||||
@ -89,17 +123,17 @@ bool CreateGadgets(void)
|
||||
ng->ng_TextAttr = Globals->Window->Screen->Font;
|
||||
ng->ng_Flags = 0;
|
||||
|
||||
w = Globals->Window->Screen->RastPort.TxWidth;
|
||||
h = Globals->Window->Screen->RastPort.TxHeight;
|
||||
|
||||
x = Globals->Window->Screen->WBorLeft + 8;
|
||||
y = Globals->Window->Screen->WBorTop + h + 9;
|
||||
|
||||
col1 = x;
|
||||
textWidth = 13 + VARSIZE;
|
||||
labelWidth = GetLabelWidth(&Globals->Window->Screen->RastPort);
|
||||
|
||||
col2 = col1 + w * textWidth;
|
||||
boxWidth = 13 + VARSIZE * 2;
|
||||
col1 = x;
|
||||
textWidth = labelWidth + Globals->Window->Screen->RastPort.TxWidth / 2;
|
||||
|
||||
col2 = col1 + textWidth;
|
||||
boxWidth = labelWidth;
|
||||
|
||||
ng->ng_TopEdge = y;
|
||||
ng->ng_Height = h + 6;
|
||||
@ -108,7 +142,7 @@ bool CreateGadgets(void)
|
||||
|
||||
// Server
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -118,7 +152,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = GID_SERVER;
|
||||
gadget = CreateGadget(
|
||||
STRING_KIND, gadget, ng,
|
||||
@ -132,7 +166,7 @@ bool CreateGadgets(void)
|
||||
// Port
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -142,7 +176,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = GID_PORT;
|
||||
gadget = CreateGadget(
|
||||
STRING_KIND, gadget, ng,
|
||||
@ -156,7 +190,7 @@ bool CreateGadgets(void)
|
||||
// Interval
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -167,7 +201,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = GID_INTERVAL;
|
||||
gadget = CreateGadget(
|
||||
INTEGER_KIND, gadget, ng,
|
||||
@ -183,7 +217,7 @@ bool CreateGadgets(void)
|
||||
// Timeout
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -193,7 +227,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = GID_TIMEOUT;
|
||||
gadget = CreateGadget(
|
||||
INTEGER_KIND, gadget, ng,
|
||||
@ -209,7 +243,7 @@ bool CreateGadgets(void)
|
||||
// Threshold
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -219,7 +253,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = GID_THRESHOLD;
|
||||
gadget = CreateGadget(
|
||||
STRING_KIND, gadget, ng,
|
||||
@ -234,7 +268,7 @@ bool CreateGadgets(void)
|
||||
// Verbose
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -244,7 +278,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = GID_VERBOSE;
|
||||
gadget = CreateGadget(
|
||||
CYCLE_KIND, gadget, ng,
|
||||
@ -260,7 +294,7 @@ bool CreateGadgets(void)
|
||||
// Priority
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -270,7 +304,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = (boxWidth * w + 20) / 2;
|
||||
ng->ng_Width = (boxWidth + 20) / 2;
|
||||
ng->ng_GadgetID = GID_PRIORITY;
|
||||
|
||||
gadget = CreateGadget(
|
||||
@ -286,7 +320,7 @@ bool CreateGadgets(void)
|
||||
// Time zone
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -296,7 +330,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -310,7 +344,7 @@ bool CreateGadgets(void)
|
||||
// Last sync
|
||||
ng->ng_LeftEdge = col1;
|
||||
ng->ng_TopEdge += ng->ng_Height + 4;
|
||||
ng->ng_Width = textWidth * w + 20;
|
||||
ng->ng_Width = textWidth;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -320,7 +354,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
ng->ng_LeftEdge = col2;
|
||||
ng->ng_Width = boxWidth * w + 20;
|
||||
ng->ng_Width = boxWidth + 20;
|
||||
ng->ng_GadgetID = labelId++;
|
||||
gadget = CreateGadget(
|
||||
TEXT_KIND, gadget, ng,
|
||||
@ -358,7 +392,7 @@ bool CreateGadgets(void)
|
||||
return false;
|
||||
|
||||
Globals->Window->Height = ng->ng_TopEdge + ng->ng_Height;
|
||||
Globals->Window->Width = textWidth * w + boxWidth * w;
|
||||
Globals->Window->Width = textWidth + boxWidth;
|
||||
|
||||
FreeMemSafe(ng);
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2017-2018 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* Copyright (c) 2017-2019 Carsten Sonne Larsen <cs@innolan.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
Reference in New Issue
Block a user