mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cce4b2cb14 | ||
|
|
e49d9f8ab6 | ||
|
|
48cbeb28f4 | ||
|
|
57d5c54559 | ||
|
|
3b2260f67e | ||
|
|
d423a62327 | ||
|
|
ac8da00030 | ||
|
|
77eb7fb99d | ||
|
|
a751149dd3 | ||
|
|
69d45618c6 | ||
|
|
22fa1a28e5 | ||
|
|
f4cc233009 | ||
|
|
1d6e4edd0f | ||
|
|
daffa8cba0 | ||
|
|
2e161a1bc1 | ||
|
|
204bb00060 | ||
|
|
d6029a54aa | ||
|
|
f99b5c5a66 | ||
|
|
2df4119c1a | ||
|
|
d06b4e5dcd | ||
|
|
bf8a25137d | ||
|
|
0f302ad0fc | ||
|
|
e3d6b283c5 | ||
|
|
2e3ed09039 | ||
|
|
37971a3f07 | ||
|
|
2a1960f257 | ||
|
|
350564c304 | ||
|
|
9e2a9fea37 | ||
|
|
3592b43629 | ||
|
|
becf1fc459 | ||
|
|
2bccd058ed | ||
|
|
12c6621051 | ||
|
|
504bc6a875 | ||
|
|
9cfdd0b53f | ||
|
|
d59024f399 | ||
|
|
24e0178d1a | ||
|
|
1ede5775f2 | ||
|
|
a5c9b07052 | ||
|
|
22353d4833 | ||
|
|
7499ada891 | ||
|
|
3f0a4e5c39 | ||
|
|
b8d6472974 | ||
|
|
6358297724 | ||
|
|
4f6dcde980 | ||
|
|
8a7985c48e | ||
|
|
4ddbe54e55 | ||
|
|
ef0bf73a29 | ||
|
|
beda9014d8 | ||
|
|
498a429b2c | ||
|
|
6aa2aa0fb3 | ||
|
|
1bef88fccd | ||
|
|
8308068067 | ||
|
|
8385c7f1b0 | ||
|
|
0537d02fef | ||
|
|
c33a1a3b0b | ||
|
|
fd39999128 | ||
|
|
0aa40094fa | ||
|
|
e3bbbe07be | ||
|
|
5633798d33 | ||
|
|
0e7e1b1b75 | ||
|
|
4d3790bc1a | ||
|
|
2002c7f1f8 | ||
|
|
1be14e99a2 | ||
|
|
78efdaf85f | ||
|
|
0e98a1c656 | ||
|
|
7aa483e201 |
2
configure
vendored
2
configure
vendored
@@ -3991,7 +3991,7 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION=03.03.01
|
||||
VERSION=03.03.05
|
||||
|
||||
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h"
|
||||
|
||||
|
||||
@@ -75,6 +75,6 @@ if test "$GCC" = yes; then
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale)
|
||||
VERSION=03.03.01
|
||||
VERSION=03.03.05
|
||||
AC_SUBST(VERSION)
|
||||
AC_OUTPUT(src/Makefile www/Makefile src/version.h)
|
||||
|
||||
@@ -1,5 +1,71 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* VERSION 3.3 Patch 5 - 2021-01-21
|
||||
|
||||
- NEW FEATURE: tkremind: Add ability to change fonts and colors from
|
||||
within TkRemind "Options" dialog.
|
||||
|
||||
- CHANGE: tkremind: TkRemind now requires Tcl/Tk 8.5 or newer.
|
||||
|
||||
- CHANGE: tkremind: You can specify the location of the options
|
||||
file on the command-line if you want to use one other than ~/.tkremindrc
|
||||
|
||||
- CLEANUP: tkremind: Remove "Apply Options" from Options dialog; we only
|
||||
need "Save Options".
|
||||
|
||||
- DOC FIX: Add missing release note in 3.3.4 notes regarding
|
||||
setpagedevice patch
|
||||
|
||||
- DOC FIX: tkremind: Document shortcut keys.
|
||||
|
||||
* VERSION 3.3 Patch 4 - 2021-01-12
|
||||
|
||||
- NEW FEATURE: If "inotifywait" is installed, TkRemind uses it to refresh
|
||||
the calendar display right away when the reminders file/directory is updated.
|
||||
This makes TkRemind react almost instantly if external tools are editing
|
||||
or updating reminders.
|
||||
|
||||
- MINOR NEW FEATURE: rem2ps has a new '-x' option; this puts the day numbers
|
||||
on the top-left of the day's box instead of the top-right.
|
||||
|
||||
- MINOR FIXES: A typo in remind.1 was fixed; additional comments regarding
|
||||
UNTIL were added.
|
||||
|
||||
- BUG FIX: rem2ps: Call setpagedevice to set page size. Based on a patch
|
||||
from Jonathan Kamens.
|
||||
|
||||
* VERSION 3.3 Patch 3 - 2020-11-09
|
||||
|
||||
- BUG FIX: Fix startup crash in TkRemind if "Show Today's Reminders on
|
||||
Startup" is enabled (which, unfortunately, is the default.) Bug reported
|
||||
by Martin Ziemer.
|
||||
|
||||
* VERSION 3.3 Patch 2 - 2020-11-08
|
||||
|
||||
- MINOR NEW FEATURE: Add MAYBE-UNCOMPUTABLE keyword; see the man page
|
||||
and discussion at
|
||||
https://dianne.skoll.ca/pipermail/remind-fans/2020/003745.html
|
||||
|
||||
- CHANGE: TkRemind always invokes Remind with the "-itkremind=1" option,
|
||||
even when printing. NOTE INCOMPATIBILITY: This is a behavior change!
|
||||
When you print from TkRemind, we also invoke Remind with "-itkprint=1"
|
||||
so you can detect that PostScript is being generated.
|
||||
|
||||
- CHANGE: The maxmimum length of a variable name has been increased from
|
||||
16 characters to 64 characters. Modern computers have plenty of memory.
|
||||
|
||||
- BUG FIXES: Minor documentation updates, typo fixes, clarifications, etc.
|
||||
|
||||
- BUG FIX: Fix calendar-drawing alignment errors when displaying UTF-8
|
||||
strings with zero-width combining characters and strings with tabs.
|
||||
|
||||
- BUG FIX: TkRemind would mess up placement of the WEEK special if invoked
|
||||
with the "-m" option. This has been fixed.
|
||||
|
||||
- BUG FIX: TkRemind would sometimes fail with an error message when editing
|
||||
a reminder; this is because it was interpreting months 08 and 09 as
|
||||
illegal octal numbers. This has been fixed.
|
||||
|
||||
* VERSION 3.3 Patch 1 - 2020-03-20
|
||||
|
||||
- CHANGE: For overlapping multi-day events, issue a reminder for the
|
||||
|
||||
@@ -26,8 +26,8 @@ RUN OFF
|
||||
################################################
|
||||
# Ensure required version of remind is used... #
|
||||
################################################
|
||||
IF version() < "03.01.08"
|
||||
ERRMSG This file requires at least version 03.01.08 of Remind.%
|
||||
IF version() < "03.01.09"
|
||||
ERRMSG This file requires at least version 03.01.09 of Remind.%
|
||||
ERRMSG This version is version [version()].
|
||||
EXIT
|
||||
ENDIF
|
||||
@@ -84,7 +84,6 @@ SET December 12
|
||||
###########################################################
|
||||
# Other symbolic constants and functions for "pasting"... #
|
||||
###########################################################
|
||||
|
||||
SET Quote CHAR(34)
|
||||
|
||||
# Handy constants/function for specifing week of month...
|
||||
@@ -95,29 +94,17 @@ SET Week_4 22
|
||||
FSET _last(mo) "1 " + MON((mo%12)+1) + " --7"
|
||||
|
||||
# Handy function to provide SCANFROM dates...
|
||||
FSET _back(days) TODAY()-days
|
||||
|
||||
###########################################################
|
||||
# Function which returns a string in "am/pm" format based #
|
||||
# on the time. For example, set a am_pm(NOW())... #
|
||||
###########################################################
|
||||
|
||||
FSET _am_pm(tm) IIF(tm<01:00, tm+12*60+"am", \
|
||||
tm<12:00, tm+"am", \
|
||||
tm<13:00, tm+"pm", \
|
||||
tm-12*60+"pm")
|
||||
FSET _back(days) $U-days
|
||||
|
||||
#################################################################
|
||||
# Function which removes a single leading zero from a string... #
|
||||
# Function that removes a single leading zero from a string... #
|
||||
#################################################################
|
||||
|
||||
FSET _no_lz(s) IIF(SUBSTR(s, 1, 1)=="0", SUBSTR(s, 2), s)
|
||||
|
||||
#################################################################
|
||||
# Return the length of the daylight/night portion of a date, #
|
||||
# in minutes. #
|
||||
#################################################################
|
||||
|
||||
FSET _light_len(date) MAX(SUNSET(date)-SUNRISE(date), 0)
|
||||
FSET _dark_len(date) 1440-_light_len(date)
|
||||
|
||||
@@ -125,26 +112,12 @@ FSET _dark_len(date) 1440-_light_len(date)
|
||||
# Function to calculate number of years since a given year #
|
||||
# or number of months since a given month and year... #
|
||||
############################################################
|
||||
|
||||
FSET _yr_num(yr) ORD(YEAR(TRIGDATE()) - yr)
|
||||
FSET _mo_num(mo, yr) ORD(12 * (YEAR(TRIGDATE()) - yr) + \
|
||||
MONNUM(TRIGDATE()) - mo)
|
||||
FSET _yr_num(yr) ORD($Ty - yr)
|
||||
FSET _mo_num(mo, yr) ORD(12 * ($Ty - yr) + $Tm - mo)
|
||||
|
||||
# Here's an example of how to use them:
|
||||
REM 1 Nov ++12 MSG %"Dean's [_yr_num(1984)] birthday%" is %b.
|
||||
REM 1 MSG Dean's [_mo_num(11, 1984)] 'monthly' anniversary
|
||||
|
||||
###########################################################
|
||||
# Function to send mail via elm's "fastmail" (by GMS!)... #
|
||||
###########################################################
|
||||
|
||||
#FSET _mail(from, subj) "mailx -s " + \
|
||||
# Quote + from + " : " + subj + Quote \
|
||||
# GETENV("LOGNAME") + " < /dev/null 1>&0"
|
||||
FSET _mail(from, subj) "fastmail -f " + \
|
||||
Quote + from + Quote + \
|
||||
" -s " + Quote + subj + Quote + \
|
||||
" /dev/null " + GETENV("LOGNAME")
|
||||
REM 1 Nov ++12 MSG %"John's [_yr_num(1984)] birthday%" is %b.
|
||||
REM 1 MSG John's [_mo_num(11, 1984)] 'monthly' anniversary
|
||||
|
||||
#############################################################################
|
||||
# Here's a tricky problem: The 4th of July is a holiday in the U.S.
|
||||
@@ -158,29 +131,28 @@ FSET _mail(from, subj) "fastmail -f " + \
|
||||
# dependent upon the current date, it's tricky and results may not be
|
||||
# what you expect. You should try to make sure that the OMIT context
|
||||
# "near" any current reminders will not change during a calendar run.
|
||||
# The SCANFROM clause should help make these OMITs very safe.
|
||||
# The SCANFROM clause will make these OMITs safe.
|
||||
############################################################################
|
||||
|
||||
# Calculate the weekday of the holiday.
|
||||
REM 4 July SCANFROM [_back(7)] SATISFY 1
|
||||
|
||||
IF WKDAYNUM(TRIGDATE()) == Sat
|
||||
REM [TRIGDATE()] MSG Independence day (actual)
|
||||
OMIT [TRIGDATE()-1] MSG Independence day (observed)
|
||||
SET iday $T
|
||||
IF WKDAYNUM(iday) == Sat
|
||||
REM [iday] MSG Independence day (actual)
|
||||
OMIT [iday-1] MSG Independence day (observed)
|
||||
ELSE
|
||||
IF WKDAYNUM(TRIGDATE()) == Sun
|
||||
REM [TRIGDATE()] MSG Independence day (actual)
|
||||
OMIT [TRIGDATE()+1] MSG Independence day (observed)
|
||||
IF WKDAYNUM(iday) == Sun
|
||||
REM [iday] MSG Independence day (actual)
|
||||
OMIT [iday+1] MSG Independence day (observed)
|
||||
ELSE
|
||||
OMIT [TRIGDATE()] MSG Independence day
|
||||
OMIT [iday] MSG Independence day
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
############################################################################
|
||||
# #
|
||||
# A meeting on the first Monday of every month which is moved to the #
|
||||
# second Monday in the event of a holiday. #
|
||||
# #
|
||||
############################################################################
|
||||
|
||||
# First, the normal meeting. However, the SKIP keyword means this
|
||||
@@ -192,68 +164,21 @@ REM Mon 8 SATISFY 1
|
||||
|
||||
# But only actually trigger the delayed meeting if the previous
|
||||
# Monday was a holiday
|
||||
IF ISOMITTED(TRIGDATE()-7)
|
||||
REM [TRIGDATE()] MSG Delayed meeting
|
||||
IF ISOMITTED($T-7)
|
||||
REM [$T] MSG Delayed meeting
|
||||
ENDIF
|
||||
|
||||
############################################################################
|
||||
# #
|
||||
# A very complicated reminder sent in by a Remind user. #
|
||||
# This person gets paid every two weeks, starting from 8 January 1993. #
|
||||
# If a pay date occurs before the twelfth of a month, then that #
|
||||
# he pays his mortgage on that pay date. Otherwise, he pays the mortgage #
|
||||
# on the previous pay date. Furthermore, he has to schedule his #
|
||||
# mortgage payment six days before it is due. He wants to be reminded #
|
||||
# a further four days before the scheduling deadline. He also #
|
||||
# wants to be mailed a notice two weeks before the scheduling deadline. #
|
||||
# #
|
||||
# Here's the solution - if you can follow this, consider yourself a #
|
||||
# Remind programmer extraordinaire! #
|
||||
# #
|
||||
############################################################################
|
||||
|
||||
# A function to determine whether or not a pay-date is a mortgage-date.
|
||||
|
||||
FSET _IsMortDate(x) DAY(x) < 12 || (DAY(x+14) >= 12 && DAY(x+14) <= 14)
|
||||
|
||||
# Paydays - for reference
|
||||
|
||||
REM 8 Jan 1993 *14 MSG Payday
|
||||
|
||||
# Calculate the mortgage payment six days ahead of time. Note that this
|
||||
# is done "implicitly" by subtracting 6 from the starting date - we start
|
||||
# on 2 Jan rather than 8 Jan. We add 6 to TRIGDATE() in _IsMortDate to
|
||||
# compensate.
|
||||
|
||||
REM 2 Jan 1993 *14 ++4 SATISFY [_IsMortDate(TRIGDATE()+6)] \
|
||||
MSG %"Schedule mortgage payment%" for %a.
|
||||
|
||||
# Now the mail reminder two weeks before the payment date - because two
|
||||
# weeks before a payment date is also a payment date, no pre-compensation
|
||||
# in the starting date of 8 Jan is necessary - convince yourself of this!
|
||||
# This uses the _mail() function defined earlier.
|
||||
|
||||
REM ONCE 8 Jan 1993 *14 SATISFY [_IsMortDate(TRIGDATE()+14)] \
|
||||
RUN [_mail("Decatur Federal", \
|
||||
"Pay mortgage by the " + ORD(DAY(TRIGDATE()+14)))]
|
||||
|
||||
# Make an entry on the calendar when the mortgage should be paid
|
||||
|
||||
REM 8 Jan 1993 *14 SATISFY [_IsMortDate(TRIGDATE())] \
|
||||
CAL Mortgage payment
|
||||
|
||||
##########################################################################
|
||||
# #
|
||||
# On our UNIX system, I run a program which queries the university #
|
||||
# On our UNIX system, I run a program that queries the university #
|
||||
# library and creates a file called ".booksdue". This file is #
|
||||
# a REMIND script to tell me when my library books are due. Here's #
|
||||
# an example from my reminder file - it shows the use of filedate(). #
|
||||
# When the .booksdue file is at least 7 days old, I create a new version #
|
||||
# by querying the library computer. Note the use of realtoday() rather #
|
||||
# than today. #
|
||||
# than today(). #
|
||||
# #
|
||||
##########################################################################
|
||||
|
||||
IF !$RunOff && !$CalMode && !$SimpleCal
|
||||
IF REALTODAY()-FILEDATE("/home/dfs/.booksdue") >= 7
|
||||
REM RUN /home/dfs/bilge/library/getbooks
|
||||
@@ -283,7 +208,7 @@ REM Sat Sun SPECIAL SHADE 220
|
||||
#############################################################################
|
||||
|
||||
SET SaveTrig $NumTrig
|
||||
SET easter EASTERDATE(YEAR(TODAY()))
|
||||
SET easter EASTERDATE($Uy)
|
||||
REM [easter-46] MSG %"Ash Wednesday%"
|
||||
REM [easter-7] MSG %"Palm Sunday%"
|
||||
OMIT [easter-2] MSG %"Good Friday%"
|
||||
@@ -301,7 +226,7 @@ REM Mon Jan [Week_3] MSG Martin Luther King - %"MLK Day%"
|
||||
REM Feb 2 MSG %"Ground Hog Day%"
|
||||
REM Feb 14 MSG %"Valentine's%" Day
|
||||
REM Mon Feb [Week_3] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [trigdate()] MSG %"President's Day%"
|
||||
OMIT [$T] MSG %"President's Day%"
|
||||
REM Mar 17 MSG %"St. Patrick's%" Day
|
||||
|
||||
# The DST rules are accurate for most locations in
|
||||
@@ -319,23 +244,23 @@ REM Sat May [Week_1] MSG %"Kentucky Derby%"
|
||||
REM Sun May [Week_2] MSG %"Mother's Day%"
|
||||
REM Sat May [Week_3] MSG %"Armed Forces Day%"
|
||||
REM Mon [_last(May)] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [trigdate()] MSG %"Memorial Day%"
|
||||
OMIT [$T] MSG %"Memorial Day%"
|
||||
REM Jun 14 MSG %"Flag Day%"
|
||||
REM Sun Jun [Week_3] MSG %"Father's Day%"
|
||||
REM Mon Sep [Week_1] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [trigdate()] MSG %"Labor Day%"
|
||||
OMIT [$T] MSG %"Labor Day%"
|
||||
REM Mon Oct [Week_2] MSG %"Columbus Day%"
|
||||
REM Nov 11 MSG %"Veterans Day%"
|
||||
|
||||
REM Oct 30 MSG %"Mischief Night%"
|
||||
REM Oct 31 MSG %"Halloween%"
|
||||
REM Tue Nov 2 SCANFROM [_back(7)] \
|
||||
SATISFY [(YEAR(TRIGDATE()) % 4) == 0] \
|
||||
SATISFY [($Ty % 4) == 0] \
|
||||
MSG %"Election%" Day
|
||||
REM Thu Nov [Week_4] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [trigdate()] MSG %"Thanksgiving%" Day
|
||||
OMIT [$T] MSG %"Thanksgiving%" Day
|
||||
REM Fri Nov [Week_4+1] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [trigdate()] MSG %"Thanksgiving%" (cont.)
|
||||
OMIT [$T] MSG %"Thanksgiving%" (cont.)
|
||||
OMIT Dec 24 MSG %"Christmas Eve%"
|
||||
OMIT Dec 25 MSG %"Christmas%" Day
|
||||
|
||||
@@ -350,13 +275,6 @@ if $NumTrig > SaveTrig
|
||||
REM SPECIAL SHADE 220
|
||||
endif
|
||||
|
||||
# Seasons (valid from 1992 to 2000)...
|
||||
REM Mar 20 MSG %"Spring%" begins
|
||||
REM Jun [IIF(YEAR(TODAY())%4, 21, 20)] MSG %"Summer%" begins
|
||||
REM Sep [CHOOSE(YEAR(TODAY())-1991, 22,22,23,23,22,22,22,23,22)] \
|
||||
MSG %"Fall%" begins
|
||||
REM Dec [IIF((YEAR(TODAY())+1)%4, 21, 22)] MSG %"Winter%" begins
|
||||
|
||||
#PSSTUFF2
|
||||
##########################################################################
|
||||
# #
|
||||
@@ -370,7 +288,7 @@ REM Dec [IIF((YEAR(TODAY())+1)%4, 21, 22)] MSG %"Winter%" begins
|
||||
# example, I recommend that you use the -sd 10 option for Rem2PS.
|
||||
REM PS Border Border moveto \
|
||||
/DayFont findfont DaySize scalefont setfont \
|
||||
([hebday(today())] [hebmon(today())]) show
|
||||
([hebday($U)] [hebmon($U)]) show
|
||||
|
||||
# Fill in the phases of the moon on the PostScript calendar
|
||||
[moondate(0)] SPECIAL MOON 0
|
||||
@@ -382,7 +300,7 @@ REM PS Border Border moveto \
|
||||
# calendar - the sizes are hard-coded, however, and work best in landscape.
|
||||
REM PS Border Border 5 sub moveto \
|
||||
/SmallFont findfont 4 scalefont setfont \
|
||||
(Sunrise: [sunrise(trigdate())] Sunset: [sunset(trigdate())]) show
|
||||
(Sunrise: [sunrise($T)] Sunset: [sunset($T)]) show
|
||||
|
||||
# The next one puts the day number (1-366) and days left in the year at the
|
||||
# bottom of the post-script calendar. Again, the hard-coded sizes work best
|
||||
@@ -390,7 +308,7 @@ REM PS Border Border 5 sub moveto \
|
||||
FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
|
||||
REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
|
||||
/SmallFont findfont 4 scalefont setfont \
|
||||
([_DayOfYear(today())]([365+isleap(today())-_DayOfYear(today())])) show
|
||||
([_DayOfYear($U)]([365+isleap($U)-_DayOfYear($U)])) show
|
||||
|
||||
#JHOLS
|
||||
##########################################################################
|
||||
@@ -430,7 +348,7 @@ SET Reform 0
|
||||
|
||||
# Convenient function definition to save typing
|
||||
FSET _h(x, y) HEBDATE(x,y)
|
||||
FSET _h2(x, y) HEBDATE(x, y, TODAY()-7)
|
||||
FSET _h2(x, y) HEBDATE(x, y, $U-7)
|
||||
FSET _PastSat(x, y) IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1)
|
||||
FSET _PastSun(x, y) IIF(WKDAYNUM(_h2(x,y))!=0, _h2(x,y), _h2(x,y)+1)
|
||||
FSET _PastMon(x, y) IIF(WKDAYNUM(_h2(x,y))!=1, _h2(x,y), _h2(x,y)+1)
|
||||
@@ -464,7 +382,7 @@ ELSE
|
||||
ENDIF
|
||||
|
||||
# Because Kislev can change length, we must be more careful about Chanukah
|
||||
FSET _chan(x) HEBDATE(24, "Kislev", today()-9)+x
|
||||
FSET _chan(x) HEBDATE(24, "Kislev", $U-9)+x
|
||||
[_chan(1)] ++4 MSG %"Chanukah 1%" is %b.
|
||||
[_chan(2)] MSG %"Chanukah 2%"
|
||||
[_chan(3)] MSG %"Chanukah 3%"
|
||||
@@ -553,9 +471,9 @@ ENDIF
|
||||
# Counting the omer - do the whole spiel, i.e:
|
||||
# "This is the xth day of the omer, being y weeks and z days of the omer."
|
||||
# Nice Remind programming example here!
|
||||
SET ostart HEBDATE(16, "Nisan", TODAY()-50)
|
||||
IF ostart <= TODAY() && (TODAY() - ostart < 49)
|
||||
SET odays TODAY()-ostart+1
|
||||
SET ostart HEBDATE(16, "Nisan", $U-50)
|
||||
IF ostart <= $U && ($U - ostart < 49)
|
||||
SET odays $U-ostart+1
|
||||
IF odays < 7
|
||||
MSG %"%"Today is the [ORD(odays)] day of the Omer.
|
||||
ELSE
|
||||
@@ -573,8 +491,8 @@ ENDIF
|
||||
### for Friday and Saturday. Note: You must set your latitude, longitude
|
||||
### and possibly time zone for these to work properly!
|
||||
|
||||
REM Friday CAL Candle lighting at [sunset(trigdate())-18]
|
||||
REM Saturday CAL Havdalah at [sunset(trigdate())+42]
|
||||
REM Friday CAL Candle lighting at [sunset($T)-18]
|
||||
REM Saturday CAL Havdalah at [sunset($T)+42]
|
||||
|
||||
#COLORS
|
||||
##########################################################################
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH REM2PS 1 "1 January 2020"
|
||||
.TH REM2PS 1 "5 January 2021"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
rem2ps \- draw a PostScript calendar from Remind output
|
||||
@@ -29,6 +29,11 @@ include any document structuring comments in your prologue.
|
||||
Produce the calendar in landscape mode rather than the default
|
||||
portrait mode.
|
||||
.TP
|
||||
.B \-x
|
||||
When printing the calendar, place the day numbers in the top-left of each
|
||||
day's box. If this option is omitted, the day numbers appear in the
|
||||
top-right.
|
||||
.TP
|
||||
\fB\-c\fR[\fIn\fR]
|
||||
If \fIn\fR is omitted, disables the small calendars for next and previous
|
||||
months which are normally generated. If \fIn\fR is supplied, it can range
|
||||
|
||||
87
man/remind.1
87
man/remind.1
@@ -26,7 +26,7 @@ Anything after the __EOF__ marker is completely ignored.
|
||||
|
||||
.SH OPTIONS
|
||||
\fBRemind\fR has a slew of options. If you're new to the program,
|
||||
ignore them for now and skip to the section "Reminder Files".
|
||||
ignore them for now and skip to the section "REMINDER FILES".
|
||||
.TP
|
||||
.B \-n
|
||||
The \fB\-n\fR option causes \fBRemind\fR to print the \fBnext\fR occurrence
|
||||
@@ -248,7 +248,7 @@ encountered in the reminder script. The \fB\-g\fR option cause
|
||||
\fBRemind\fR to sort reminders by date and time prior to issuing them.
|
||||
The optional \fBa\fR and \fBd\fR characters specify the sort order
|
||||
(ascending or descending) for the date, time and priority fields. See
|
||||
the section "Sorting Reminders" for more information.
|
||||
the section "SORTING REMINDERS" for more information.
|
||||
|
||||
.TP
|
||||
\fB\-b\fR[\fIn\fR]
|
||||
@@ -323,7 +323,7 @@ TAG clause.
|
||||
\fB\-i\fR\fIvar\fR\fB=\fR\fIexpr\fR
|
||||
Sets the value of the specified \fIvar\fR to \fIexpr\fR, and \fBpreserves\fR
|
||||
\fIvar\fR. \fIExpr\fR can be any valid \fBRemind\fR expression. See the
|
||||
section "Initializing Variables on the Command Line" for more details.
|
||||
section "INITIALIZING VARIABLES ON THE COMMAND LINE" for more details.
|
||||
.TP
|
||||
\fB\-i\fR\fIfunc\fR(\fIargs\fR)=\fIdefinition\fR
|
||||
Allows you to define a function on the command line.
|
||||
@@ -352,7 +352,7 @@ In addition, you can supply a \fIrepeat\fR parameter, which has the
|
||||
form *\fInum\fR. This causes \fBRemind\fR to be run \fInum\fR times,
|
||||
with the date incrementing on each iteration. You may have to enclose
|
||||
the parameter in quotes to avoid shell expansion. See the subsection
|
||||
"Repeated Execution" in the section "Calendar Mode" for more
|
||||
"Repeated Execution" in the section "CALENDAR MODE" for more
|
||||
information.
|
||||
.SH REMINDER FILES
|
||||
.PP
|
||||
@@ -439,7 +439,7 @@ These keywords denote the \fItype\fR
|
||||
of the reminder. (\fBSATISFY\fR is more complicated and will be explained
|
||||
later.) A \fBMSG\fR-type reminder normally prints a message to the standard
|
||||
output, after passing the \fIbody\fR through a special substitution filter,
|
||||
described in the section "The Substitution Filter." However, if you have
|
||||
described in the section "THE SUBSTITUTION FILTER." However, if you have
|
||||
used the \fB\-k\fR command-line option, then \fBMSG\fR-type reminders are
|
||||
passed to the appropriate program. Note that the options \fB\-c\fR,
|
||||
\fB\-s\fR, \fB\-p\fR and \fB\-n\fR disable the \fB\-k\fR option.
|
||||
@@ -457,7 +457,7 @@ The \fBMSF\fR keyword is almost the same as the \fBMSG\fR keyword,
|
||||
except that the reminder is formatted to fit into a paragraph-like
|
||||
format. Three system variables control the formatting of \fBMSF\fR-type
|
||||
reminders - they are \fB$FirstIndent\fR, \fB$SubsIndent\fR and
|
||||
\fB$FormWidth\fR. They are discussed in the section "System Variables."
|
||||
\fB$FormWidth\fR. They are discussed in the section "SYSTEM VARIABLES."
|
||||
The \fBMSF\fR keyword causes the spacing of your reminder to be altered -
|
||||
extra spaces are discarded, and two spaces are placed after periods and
|
||||
other characters, as specified by the system variables \fB$EndSent\fR and
|
||||
@@ -815,7 +815,7 @@ the initial date, and does not affect the repetition period.
|
||||
.B SCANFROM \fRand\fB FROM
|
||||
.PP
|
||||
The \fBSCANFROM\fR and \fBFROM\fR keywords are for advanced \fBRemind\fR programmers
|
||||
only, and will be explained in the section "Details about Trigger Computation"
|
||||
only, and will be explained in the section "DETAILS ABOUT TRIGGER COMPUTATION"
|
||||
near the end of this manual. Note that \fBSCANFROM\fR is available only
|
||||
in versions of \fBRemind\fR from 03.00.04 up. \fBFROM\fR is available only
|
||||
from 03.01.00 and later.
|
||||
@@ -827,7 +827,7 @@ It is used in calendar mode and when sorting reminders. If two reminders
|
||||
have the same trigger date and time, then they are sorted by priority.
|
||||
If the \fBPRIORITY\fR keyword is not supplied, a default priority of 5000
|
||||
is used. (This default can be changed by adjusting the system variable
|
||||
\fB$DefaultPrio\fR. See the section "System Variables" for more
|
||||
\fB$DefaultPrio\fR. See the section "SYSTEM VARIABLES" for more
|
||||
information.)
|
||||
.PP
|
||||
.B EXPIRY DATES
|
||||
@@ -860,6 +860,20 @@ As a special case, you can use the \fBTHROUGH\fR keyword instead of
|
||||
REM 1992-11-30 +2 THROUGH 1992-12-04 MSG Jury duty
|
||||
.fi
|
||||
.PP
|
||||
If you have an expiry date via the use of \fBTHROUGH\fR or \fBUNTIL\fR,
|
||||
then Remind will \fInever\fR trigger the reminder after the expiry
|
||||
date. For example, if you have this:
|
||||
.PP
|
||||
.nf
|
||||
OMIT 2021-01-08
|
||||
REM 2021-01-01 THROUGH 2021-01-08 AFTER MSG Test
|
||||
.fi
|
||||
.PP
|
||||
the reminder will not be triggered on 2021-01-08, and nor will it be
|
||||
triggered on 2021-01-09; even though the AFTER keyword would normally
|
||||
move the 8th's reminder to the 9th, the expiry date of 2021-01-08
|
||||
overrides that.
|
||||
.PP
|
||||
.B THE ONCE KEYWORD
|
||||
.PP
|
||||
Sometimes, it is necessary to ensure that reminders are run only once
|
||||
@@ -968,7 +982,7 @@ it terminates the search after the \fBSATISFY\fR iteration limit
|
||||
.PP
|
||||
Timed reminders are those that have an \fBAT\fR keyword followed
|
||||
by a \fItime\fR and optional \fItdelta\fR and \fItrepeat\fR. The \fItime\fR
|
||||
mau be specified in 24-hour format, with 0:00 representing midnight,
|
||||
may be specified in 24-hour format, with 0:00 representing midnight,
|
||||
12:00 representing noon, and 23:59 representing one minute to midnight.
|
||||
Alternatively, it may be specified in common "AM/PM" format; in this case,
|
||||
the hour must range from 1 to 12. 12:00am represents midnight, 12:00pm
|
||||
@@ -1061,7 +1075,7 @@ of timed reminders, and the \fBWARN\fR keyword allows precise control
|
||||
over the advance triggering of all types of reminders.
|
||||
However, discussion must be deferred until after
|
||||
expressions and user-defined functions are explained. See the subsection
|
||||
"Precise Scheduling" further on.
|
||||
"PRECISE SCHEDULING" further on.
|
||||
.PP
|
||||
.B TAG AND DURATION
|
||||
.PP
|
||||
@@ -1323,7 +1337,7 @@ is similar to \fB%3\fR but displays the current time.
|
||||
used by the substitution filter,
|
||||
but is used to tell \fBRemind\fR which text to include in a calendar
|
||||
entry when the \fB\-c\fR, \fB\-s\fR or \fB\-p\fR option is chosen.
|
||||
See "Calendar Mode"
|
||||
See "CALENDAR MODE"
|
||||
.PP
|
||||
Notes:
|
||||
.TP
|
||||
@@ -1900,6 +1914,9 @@ variable. Examples:
|
||||
Note that variables themselves have no type. They take on the type of
|
||||
whatever you store in them.
|
||||
.PP
|
||||
Variables set with SET or on the command-line with \fB\-i\fR\fIvar\fB=\fR\fIexpr\fR
|
||||
have global scope.
|
||||
.PP
|
||||
To delete a variable, use the \fBUNSET\fR command:
|
||||
.PP
|
||||
\fBUNSET\fR \fIvar\fR [\fIvar\fR...]
|
||||
@@ -2059,8 +2076,13 @@ the latitude and longitude system variables.
|
||||
These specify the longitude of your location. \fB$LongDeg\fR can
|
||||
range from \-180 to 180. Western longitudes are positive; eastern
|
||||
ones are negative. Note that all three components should have the
|
||||
same sign: All positive for Western longitudes and all negative
|
||||
for Eastern longitudes.
|
||||
same sign: All positive for Western longitudes and all negative for
|
||||
Eastern longitudes. Note that for historical reasons, the sign for
|
||||
longitude is \fIdifferent\fR from the usual convention! If you find
|
||||
the longitude of your location from a search engine, you will most
|
||||
likely \fIneed to invert the sign to have it work correctly with
|
||||
Remind.\fR
|
||||
|
||||
.RS
|
||||
.PP
|
||||
The latitude and longitude information is required for the functions
|
||||
@@ -2486,16 +2508,16 @@ variables are generally case-sensitive; thus, getenv("HOME") is not
|
||||
the same as getenv("home").
|
||||
.TP
|
||||
.B hebdate(i_day, s_hebmon [,idq_yrstart [,i_jahr [,i_aflag]]])
|
||||
Support for Hebrew dates - see the section "The Hebrew Calendar"
|
||||
Support for Hebrew dates - see the section "THE HEBREW CALENDAR"
|
||||
.TP
|
||||
.B hebday(dq_date)
|
||||
Support for Hebrew dates - see the section "The Hebrew Calendar"
|
||||
Support for Hebrew dates - see the section "THE HEBREW CALENDAR"
|
||||
.TP
|
||||
.B hebmon(dq_date)
|
||||
Support for Hebrew dates - see the section "The Hebrew Calendar"
|
||||
Support for Hebrew dates - see the section "THE HEBREW CALENDAR"
|
||||
.TP
|
||||
.B hebyear(dq_date)
|
||||
Support for Hebrew dates - see the section "The Hebrew Calendar"
|
||||
Support for Hebrew dates - see the section "THE HEBREW CALENDAR"
|
||||
.TP
|
||||
.B hour(tq_time)
|
||||
Returns the hour component of \fItime\fR.
|
||||
@@ -3624,7 +3646,7 @@ However, when \fBRemind\fR gets around to calculating the trigger
|
||||
for Tuesday, 8 September, 1992, the \fBOMIT\fR command will now be
|
||||
omitting Labour Day for 1993, and the "Mon AFTER" command
|
||||
will not be triggered. (But see the description of \fBSCANFROM\fR
|
||||
in the section "Details about Trigger Computation.")
|
||||
in the section "DETAILS ABOUT TRIGGER COMPUTATION.")
|
||||
.PP
|
||||
It is probably best to stay away from computing \fBOMIT\fR
|
||||
trigger dates unless you keep these pitfalls in mind.
|
||||
@@ -3660,6 +3682,35 @@ Note that \fBSATISFY\fR and \fBOMITFUNC\fR can often be used to solve the
|
||||
same problem, though in different ways. Sometimes a \fBSATISFY\fR is cleaner
|
||||
and sometimes an \fBOMITFUNC\fR; experiment and use whichever seems clearer.
|
||||
.PP
|
||||
.SH POSSIBLY-UNCOMPUTABLE TRIGGERS
|
||||
.PP
|
||||
Occasionally, you may wish to suppress the "Can't compute trigger" warnings
|
||||
for reminders for which a trigger date cannot be computed. For example,
|
||||
the following reminder is triggered on a Monday that is not a holiday
|
||||
if the following Tuesday is a holiday:
|
||||
.PP
|
||||
.nf
|
||||
REM Mon SKIP SATISFY [isomitted($T+1)] MSG Work between holidays
|
||||
.fi
|
||||
.PP
|
||||
However, if there are no Mondays after today's date that satisfy the
|
||||
condition, Remind will print the "Can't compute trigger" error. To
|
||||
suppress this, use the \fBMAYBE-UNCOMPUTABLE\fR keyword:
|
||||
.PP
|
||||
.nf
|
||||
REM MAYBE-UNCOMPUTABLE Mon SKIP SATISFY [isomitted($T+1)] MSG Work between holidays
|
||||
.fi
|
||||
.PP
|
||||
It's almost never appropriate to use \fBMAYBE-UNCOMPUTABLE\fR, but it is
|
||||
provided for those rare occasions when it makes sense. If you use
|
||||
\fBMAYBE-UNCOMPUTABLE\fR inside the \fBevaltrig()\fR function, then
|
||||
untriggerable triggers return -1. For example:
|
||||
.PP
|
||||
.nf
|
||||
SET a evaltrig("MAYBE-UNCOMPUTABLE Mon SKIP OMIT Mon")
|
||||
.fi
|
||||
.PP
|
||||
will set a to -1.
|
||||
.SH DEBUGGING REMINDER SCRIPTS
|
||||
.PP
|
||||
Although the command-line \fB\-d\fR option is useful for debugging, it
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.TH TKREMIND 1 "1 January 2020"
|
||||
.TH TKREMIND 1 "15 January 2021"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
tkremind \- graphical front-end to Remind calendar program
|
||||
.SH SYNOPSIS
|
||||
.B tkremind \fR[\fIoptions\fR] [\fIread_file\fR] [\fIwrite_file\fR]
|
||||
.B tkremind \fR[\fIoptions\fR] [\fIread_file\fR] [\fIwrite_file\fR] [\fIconfig_file\fR]
|
||||
.SH DESCRIPTION
|
||||
\fBTkRemind\fR is a graphical front-end to the \fBRemind\fR program.
|
||||
It provides a friendly graphical interface which allows you to view
|
||||
@@ -41,6 +41,9 @@ include the line:
|
||||
.fi
|
||||
.PP
|
||||
|
||||
\fIConfig_file\fR is the file in which \fBTkRemind\fR stores
|
||||
its options. If it is omitted, it defaults to \fI$HOME/.tkremindrt\fR.
|
||||
|
||||
.SH THE CALENDAR WINDOW
|
||||
When you start \fBTkRemind\fR, it displays a calendar for the current
|
||||
month, with today's date highlighted. Reminders are filled into each
|
||||
@@ -51,11 +54,14 @@ notice that the box appears completely full.
|
||||
|
||||
.SH NAVIGATING
|
||||
To change to the previous or next month, click the \fB<\-\fR
|
||||
or \fB\->\fR button, respectively. To change back to
|
||||
the current month, click \fBToday\fR. To go to a specific month,
|
||||
click \fBGo To Date...\fR. This pops up a dialog box which allows you
|
||||
to select a month and enter a year. Once you've done this, click
|
||||
\fBGo\fR to go to the date, or \fBCancel\fR to cancel.
|
||||
or \fB\->\fR button, respectively. You can also use the left/right arrow
|
||||
keys or PageUp/PageDown to navigate.
|
||||
|
||||
To change back to the current month, click \fBToday\fR or press the
|
||||
Home key. To go to a specific month, click \fBGo To Date...\fR. This
|
||||
pops up a dialog box which allows you to select a month and enter a
|
||||
year. Once you've done this, click \fBGo\fR to go to the date, or
|
||||
\fBCancel\fR to cancel.
|
||||
|
||||
To exit \fBTkRemind\fR, click \fBQuit\fR.
|
||||
|
||||
@@ -125,10 +131,11 @@ Select the appropriate paper size and orientation. Activate
|
||||
be the normal case unless you have many reminders in a particular
|
||||
day. (See the \fBRem2PS\fR documentation.)
|
||||
|
||||
Finally, click \fBPrint\fR to print or \fBCancel\fR to cancel.
|
||||
Note that during printing, \fBRemind\fR is \fInot\fR called with
|
||||
the \fB-itkremind=1\fR option, because it is operated in normal
|
||||
PostScript-producing mode.
|
||||
Finally, click \fBPrint\fR to print or \fBCancel\fR to cancel. Note
|
||||
that during printing, \fBRemind\fR is called with the
|
||||
\fB-itkremind=1\fR option and also an additional \fB-itkprint=1\fR
|
||||
option.
|
||||
|
||||
|
||||
.SH EDITING REMINDERS
|
||||
|
||||
@@ -210,7 +217,8 @@ background reminder pops up.
|
||||
.TP
|
||||
.B Feed popped-up reminder to command's standard input
|
||||
If selected, feeds the text of the reminder to the command described
|
||||
above.
|
||||
above. The text of the reminder is prefixed by "HH:MM ", where HH:MM
|
||||
is the time of the reminder.
|
||||
|
||||
.TP
|
||||
.B E-mail reminders here if popup not dismissed
|
||||
@@ -231,6 +239,22 @@ The characters "%d" are replaced with the lined number of the file
|
||||
containing the reminder, and "%s" are replaced with the file name.
|
||||
Useful strings might be "emacs +%d %s" or "gvim +%d %s"
|
||||
|
||||
.TP
|
||||
.B Extra Argument for Remind
|
||||
This specifies any extra arguments that should be passed to Remind
|
||||
when \BTkRemind\fR invokes \fBremind\fR. Unless you know what
|
||||
you are doing, leave this blank.
|
||||
|
||||
.TP
|
||||
.B Change entry font...
|
||||
This button pops up a font selection dialog that lets you change the
|
||||
font used to draw calendar items in the calendar boxes.
|
||||
|
||||
.TP
|
||||
.B Change heading font...
|
||||
Similar to Change entry font, but applies to calendar heading
|
||||
(the month and day names and the day numbers.)
|
||||
|
||||
.PP
|
||||
Once you've configured the options the way you like them,
|
||||
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
|
||||
|
||||
344
scripts/tkremind
344
scripts/tkremind
@@ -7,13 +7,20 @@
|
||||
# A cheesy graphical front/back end for Remind using Tcl/Tk
|
||||
#
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-2020 Dianne Skoll
|
||||
# Copyright (C) 1992-2021 Dianne Skoll
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
|
||||
# the next line restarts using wish \
|
||||
exec wish "$0" "$@"
|
||||
|
||||
# We need at least version 8.5 because of {*} list expansion operator
|
||||
if {[catch {package require Tcl 8.5}]} {
|
||||
puts "This program requires Tcl 8.5 or higher."
|
||||
puts "You have version [info tclversion]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
wm withdraw .
|
||||
|
||||
set Hostname [exec hostname]
|
||||
@@ -155,6 +162,26 @@ set OptDescr(SMTPServer) "(String) IP address or host name of SMTP server to use
|
||||
set Option(ExtraRemindArgs) ""
|
||||
set OptDescr(ExtraRemindArgs) "(String) Extra arguments when invoking remind"
|
||||
|
||||
set Option(CalboxFont) [font actual TkFixedFont]
|
||||
set OptDescr(CalboxFont) "Font to use in calendar boxes in Tk font format"
|
||||
|
||||
set Option(HeadingFont) [font actual TkDefaultFont]
|
||||
set OptDescr(HeadingFont) "Font to use in calendar headings in Tk font format"
|
||||
|
||||
set Option(BackgroundColor) "#d9d9d9"
|
||||
set OptDescr(BackgroundColor) "Default background color of calendar boxes"
|
||||
|
||||
set Option(TextColor) "#000000"
|
||||
set OptDescr(TextColor) "Default text color in calendar boxes"
|
||||
|
||||
set Option(LabelColor) "#000000"
|
||||
set OptDescr(LabelColor) "Default label color for headings"
|
||||
|
||||
set Option(WinBackground) "#d9d9d9"
|
||||
set OptDescr(WinBackground) "Background color of calendar window"
|
||||
|
||||
set TimerUpdateForChanges ""
|
||||
|
||||
# Remind program to execute -- supply full path if you want
|
||||
set Remind "remind"
|
||||
#set Remind "/home/dfs/Remind/src/remind"
|
||||
@@ -166,8 +193,14 @@ set Rem2PS "rem2ps"
|
||||
set ReminderFile {NOSUCHFILE}
|
||||
set ReminderFile [file nativename "~/.reminders"]
|
||||
|
||||
# Default options file
|
||||
set ConfigFile ~/.tkremindrc
|
||||
|
||||
set EditorPid -1
|
||||
|
||||
# Inotify file
|
||||
set InotifyFP ""
|
||||
|
||||
# Reminder file to append to -- default
|
||||
set AppendFile {NOSUCHFILE}
|
||||
catch {set AppendFile $ReminderFile}
|
||||
@@ -218,6 +251,7 @@ set PrintDest file
|
||||
set PrintSize letter
|
||||
set PrintOrient landscape
|
||||
set PrintFill 1
|
||||
set PrintDaysRight 1
|
||||
set PrintEncoding 0
|
||||
set PrintMargins 36pt
|
||||
set PrintSmallCalendars 1
|
||||
@@ -263,9 +297,9 @@ proc Initialize {} {
|
||||
|
||||
global DayNames argc argv CommandLine ReminderFile AppendFile Remind PSCmd
|
||||
global MondayFirst TwentyFourHourMode ReminderFileModTime
|
||||
global Option
|
||||
global Option ConfigFile
|
||||
set CommandLine "|$Remind -itkremind=1 -pp -y -l EXTRA"
|
||||
set PSCmd "$Remind -pp -l EXTRA"
|
||||
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l EXTRA"
|
||||
set i 0
|
||||
while {$i < $argc} {
|
||||
if {[regexp -- {-[bgxim].*} [lindex $argv $i]]} {
|
||||
@@ -289,6 +323,10 @@ proc Initialize {} {
|
||||
if {$i < $argc} {
|
||||
set AppendFile [lindex $argv $i]
|
||||
incr i
|
||||
if {$i < $argc} {
|
||||
set ConfigFile [lindex $argv $i]
|
||||
incr i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,8 +413,7 @@ proc MonitorReminderFile {} {
|
||||
# Redraw calendar and restart daemon if needed
|
||||
if {$ReminderFileModTime < $mtime} {
|
||||
set ReminderFileModTime $mtime
|
||||
FillCalWindow
|
||||
RestartBackgroundRemindDaemon
|
||||
ScheduleUpdateForChanges
|
||||
}
|
||||
}
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -447,6 +484,7 @@ proc CalEntryOffset { firstDay } {
|
||||
proc CreateCalFrame { w dayNames } {
|
||||
# Figure out reasonable height for text frames
|
||||
global SetFontsWorked
|
||||
global Option
|
||||
set h [winfo screenheight .]
|
||||
if {$h <= 480} {
|
||||
if {$SetFontsWorked} {
|
||||
@@ -461,7 +499,7 @@ proc CreateCalFrame { w dayNames } {
|
||||
}
|
||||
|
||||
global MondayFirst
|
||||
frame $w
|
||||
frame $w -background $Option(WinBackground)
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
if {$MondayFirst} {
|
||||
set index [expr ($i+1)%7]
|
||||
@@ -469,7 +507,7 @@ proc CreateCalFrame { w dayNames } {
|
||||
set index $i
|
||||
}
|
||||
|
||||
label $w.day$i -border 1 -text [lindex $dayNames $index] -justify center
|
||||
label $w.day$i -border 1 -text [lindex $dayNames $index] -justify center -font HeadingFont -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
grid configure $w.day$i -row 0 -column $i -sticky ew
|
||||
}
|
||||
for {set i 0} {$i < 6} {incr i} {
|
||||
@@ -477,9 +515,9 @@ proc CreateCalFrame { w dayNames } {
|
||||
for {set j 0} {$j < 7} {incr j} {
|
||||
set f [expr $n+$j]
|
||||
button $w.l$f -text "" -justify center -command "" \
|
||||
-state disabled -relief flat -border 0 -padx 0 -pady 0
|
||||
-state disabled -relief flat -border 0 -padx 0 -pady 0 -font HeadingFont
|
||||
text $w.t$f -width 12 -height $h -border 1 -spacing3 3 -wrap word -relief flat \
|
||||
-state disabled -takefocus 0 -cursor {}
|
||||
-state disabled -takefocus 0 -cursor {} -font CalboxFont -foreground $Option(TextColor) -background $Option(BackgroundColor)
|
||||
$w.t$f tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$f"
|
||||
$w.t$f tag bind REM <ButtonPress-3> "FireEditor $w.t$f"
|
||||
|
||||
@@ -509,18 +547,17 @@ proc CreateCalFrame { w dayNames } {
|
||||
#***********************************************************************
|
||||
proc ConfigureCalFrame { w firstDay numDays } {
|
||||
global CurMonth CurYear TodayMonth TodayYear TodayDay
|
||||
global tk_version
|
||||
global tk_version Option
|
||||
set offset [CalEntryOffset $firstDay]
|
||||
set first [expr $offset+1]
|
||||
set last [expr $offset+$numDays]
|
||||
|
||||
set bg [lindex [. configure -background] 3]
|
||||
|
||||
for {set i 0} {$i < $first} {incr i} {
|
||||
grid $w.l$i $w.t$i
|
||||
$w.l$i configure -text "" -command "" -state disabled -relief flat
|
||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
$w.l$i configure -state disabled
|
||||
balloon_add_help $w.l$i ""
|
||||
$w.t$i configure -relief flat -takefocus 0 -state normal
|
||||
$w.t$i configure -relief flat -takefocus 0 -state normal -background $Option(WinBackground)
|
||||
$w.t$i delete 1.0 end
|
||||
foreach t [$w.t$i tag names] {
|
||||
$w.t$i tag delete $t
|
||||
@@ -528,16 +565,14 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled
|
||||
$w.t$i configure -background $bg
|
||||
$w.l$i configure -background $bg
|
||||
}
|
||||
for {set i $first} {$i <= $last} {incr i} {
|
||||
grid $w.l$i $w.t$i
|
||||
set d [expr $i-$first+1]
|
||||
$w.l$i configure -text $d -state normal -relief flat \
|
||||
-command "ModifyDay $d $firstDay"
|
||||
-command "ModifyDay $d $firstDay" -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
balloon_add_help $w.l$i "Add a reminder..."
|
||||
$w.t$i configure -relief sunken -takefocus 1 -state normal
|
||||
$w.t$i configure -relief sunken -takefocus 1 -state normal -foreground $Option(TextColor) -background $Option(BackgroundColor)
|
||||
$w.t$i delete 1.0 end
|
||||
foreach t [$w.t$i tag names] {
|
||||
$w.t$i tag delete $t
|
||||
@@ -545,8 +580,6 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled
|
||||
$w.t$i configure -background $bg
|
||||
$w.l$i configure -background $bg
|
||||
}
|
||||
set forgetIt 0
|
||||
for {set i [expr $last+1]} {$i < 42} {incr i} {
|
||||
@@ -559,11 +592,13 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
grid rowconfigure $w $row -weight 0
|
||||
grid rowconfigure $w [expr $row+1] -weight 0
|
||||
} else {
|
||||
grid $w.l$i $w.t$i
|
||||
grid rowconfigure $w [expr $row+1] -weight 1
|
||||
}
|
||||
$w.l$i configure -text "" -command "" -state disabled -relief flat
|
||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
$w.l$i configure -state disabled
|
||||
balloon_add_help $w.l$i ""
|
||||
$w.t$i configure -relief flat -takefocus 0 -state normal
|
||||
$w.t$i configure -relief flat -takefocus 0 -state normal -background $Option(WinBackground)
|
||||
$w.t$i delete 1.0 end
|
||||
foreach t [$w.t$i tag names] {
|
||||
$w.t$i tag delete $t
|
||||
@@ -571,8 +606,6 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled
|
||||
$w.t$i configure -background $bg
|
||||
$w.l$i configure -background $bg
|
||||
}
|
||||
if { $CurMonth == $TodayMonth && $CurYear == $TodayYear } {
|
||||
set n [expr $TodayDay + $offset]
|
||||
@@ -593,14 +626,14 @@ proc DoQueue {} {
|
||||
#---------------------------------------------------------------------------
|
||||
proc CreateCalWindow { dayNames } {
|
||||
global Option
|
||||
frame .h
|
||||
label .h.title -text "" -justify center -pady 1 -border 1 -relief raised
|
||||
frame .h -background $Option(WinBackground);
|
||||
label .h.title -text "" -justify center -pady 1 -border 1 -relief raised -font HeadingFont -background $Option(WinBackground) -foreground $Option(LabelColor)
|
||||
pack .h.title -side top -fill x
|
||||
pack .h -side top -expand 0 -fill x
|
||||
|
||||
CreateCalFrame .cal $dayNames
|
||||
|
||||
frame .b
|
||||
frame .b -background $Option(WinBackground);
|
||||
button .b.prev -image leftarrow -width 24 -command {MoveMonth -1} -border 1
|
||||
balloon_add_help .b.prev "Go to previous month"
|
||||
button .b.this -text {Today} -command {ThisMonth} -border 1
|
||||
@@ -635,6 +668,7 @@ proc CreateCalWindow { dayNames } {
|
||||
bind . <KeyPress-Next> ".b.next flash; .b.next invoke"
|
||||
bind . <KeyPress-Home> ".b.this flash; .b.this invoke"
|
||||
|
||||
. configure -background $Option(WinBackground)
|
||||
if {$Option(StartIconified)} {
|
||||
wm iconify .
|
||||
}
|
||||
@@ -736,6 +770,30 @@ proc EditOptions {} {
|
||||
pack $w.extraargs -in $w.eaf -side left -expand 1 -fill x
|
||||
$w.extraargs insert 0 $tmpOpt(ExtraRemindArgs)
|
||||
|
||||
# Fonts
|
||||
frame $w.fframe
|
||||
button $w.font -text "Change entry font..." -command "ChooseCalboxFont"
|
||||
button $w.hfont -text "Change heading font..." -command "ChooseHeadingFont"
|
||||
pack $w.font $w.hfont -in $w.fframe -side left -expand 1 -fill x
|
||||
|
||||
# Colors
|
||||
frame $w.colors1
|
||||
label $w.textcolor -text "Text Color:"
|
||||
button $w.btextcolor -background $Option(TextColor) -command [list PickColor TextColor $w.btextcolor] -text ...
|
||||
label $w.bgcolor -text " Background color:"
|
||||
button $w.bbgcolor -background $Option(BackgroundColor) -command [list PickColor BackgroundColor $w.bbgcolor] -text ...
|
||||
|
||||
grid $w.textcolor $w.btextcolor $w.bgcolor $w.bbgcolor -in $w.colors1
|
||||
grid $w.bgcolor $w.bbgcolor -in $w.colors1
|
||||
|
||||
label $w.headcolor -text "Heading Color:"
|
||||
button $w.bheadcolor -background $Option(LabelColor) -command [list PickColor LabelColor $w.bheadcolor] -text ...
|
||||
label $w.wincolor -text " Window color:"
|
||||
button $w.bwincolor -background $Option(WinBackground) -command [list PickColor WinBackground $w.bwincolor] -text ...
|
||||
grid $w.headcolor $w.bheadcolor $w.wincolor $w.bwincolor -in $w.colors1
|
||||
|
||||
grid columnconfigure $w.colors1 0 -weight 1
|
||||
grid columnconfigure $w.colors1 2 -weight 1
|
||||
frame $w.sep1 -border 1 -relief sunken
|
||||
frame $w.sep2 -border 1 -relief sunken
|
||||
|
||||
@@ -757,16 +815,23 @@ proc EditOptions {} {
|
||||
pack $w.fsmtp -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.ef -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.eaf -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.fframe -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.colors1 -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.sep2 -in $w.f -side top -expand 0 -fill x -ipady 1
|
||||
|
||||
button $w.apply -text "Apply Options" -command "ApplyOptions $w; destroy $w"
|
||||
button $w.save -text "Save Options" -command "SaveOptions $w; destroy $w"
|
||||
button $w.cancel -text "Cancel" -command "destroy $w"
|
||||
|
||||
pack $w.apply $w.save $w.cancel -in $w.b -side left -expand 0 -fill x
|
||||
button $w.cancel -text "Cancel" -command "CancelOptions; destroy $w"
|
||||
wm protocol $w WM_DELETE_WINDOW "CancelOptions; destroy $w"
|
||||
pack $w.save $w.cancel -in $w.b -side left -expand 0 -fill x
|
||||
CenterWindow $w .
|
||||
}
|
||||
|
||||
proc CancelOptions { } {
|
||||
global Option
|
||||
font configure CalboxFont {*}$Option(CalboxFont)
|
||||
font configure HeadingFont {*}$Option(HeadingFont)
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: ApplyOptions
|
||||
# %ARGUMENTS:
|
||||
@@ -807,15 +872,15 @@ proc ApplyOptions { w } {
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Saves options in $HOME/.tkremindrc
|
||||
# Saves options in specified config file
|
||||
#***********************************************************************
|
||||
proc SaveOptions { w } {
|
||||
global Option OptDescr
|
||||
global Option OptDescr ConfigFile
|
||||
ApplyOptions $w
|
||||
|
||||
set problem [catch {set f [open ~/.tkremindrc "w"]} err]
|
||||
set problem [catch {set f [open $ConfigFile "w"]} err]
|
||||
if {$problem} {
|
||||
tk_dialog .error Error "Can't write ~/.tkremindrc: $err" 0 OK
|
||||
tk_dialog .error Error "Can't write $ConfigFile: $err" 0 OK
|
||||
return
|
||||
}
|
||||
|
||||
@@ -831,6 +896,11 @@ proc SaveOptions { w } {
|
||||
}
|
||||
puts $f ""
|
||||
close $f
|
||||
FillCalWindow
|
||||
.h.title configure -background $Option(WinBackground) -foreground $Option(LabelColor)
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
.cal.day$i configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
}
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
@@ -840,25 +910,31 @@ proc SaveOptions { w } {
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Loads options from ~/.tkremindrc
|
||||
# Loads options from $ConfigFile
|
||||
#***********************************************************************
|
||||
proc LoadOptions {} {
|
||||
global Option
|
||||
set problem [catch {set f [open "~/.tkremindrc" "r"]}]
|
||||
global Option ConfigFile
|
||||
set problem [catch {set f [open "$ConfigFile" "r"]}]
|
||||
if {$problem} {
|
||||
return
|
||||
}
|
||||
while {[gets $f line] >= 0} {
|
||||
if {[string match "#*" $line]} { continue }
|
||||
if {$line == ""} { continue }
|
||||
foreach {key val} $line {}
|
||||
if {![info exists Option($key)]} {
|
||||
puts "Unknown option in ~/.tkremindrc: $key"
|
||||
continue
|
||||
}
|
||||
set Option($key) $val
|
||||
if {[string match "#*" $line]} {
|
||||
continue
|
||||
}
|
||||
if {$line == ""} {
|
||||
continue
|
||||
}
|
||||
foreach {key val} $line {}
|
||||
if {![info exists Option($key)]} {
|
||||
puts "Unknown option in $ConfigFile: $key"
|
||||
continue
|
||||
}
|
||||
set Option($key) $val
|
||||
}
|
||||
close $f
|
||||
font configure CalboxFont {*}$Option(CalboxFont)
|
||||
font configure HeadingFont {*}$Option(HeadingFont)
|
||||
}
|
||||
|
||||
|
||||
@@ -962,7 +1038,8 @@ proc FillCalWindow {} {
|
||||
"WEEK" {
|
||||
set stuff [string trimleft $stuff]
|
||||
set stuff [string trimright $stuff]
|
||||
set label [expr $firstWkday + $day - 1]
|
||||
set offset [CalEntryOffset $firstWkday]
|
||||
set label [expr $offset + $day]
|
||||
.cal.l$label configure -text "$day $stuff"
|
||||
continue
|
||||
}
|
||||
@@ -1077,7 +1154,7 @@ proc Status { stuff } {
|
||||
# None
|
||||
#---------------------------------------------------------------------------
|
||||
proc DoPrint {} {
|
||||
global PrintDest PrintSize PrintMargins PrintOrient PrintFill PrintEncoding PrintSmallCalendars PrintStatus Rem2PS PSCmd Option
|
||||
global PrintDest PrintSize PrintMargins PrintOrient PrintFill PrintDaysRight PrintEncoding PrintSmallCalendars PrintStatus Rem2PS PSCmd Option
|
||||
global CurMonth CurYear MonthNames
|
||||
catch {destroy .p}
|
||||
toplevel .p
|
||||
@@ -1113,6 +1190,7 @@ proc DoPrint {} {
|
||||
radiobutton .p.portrait -text "Portrait" -variable PrintOrient -value portrait
|
||||
|
||||
checkbutton .p.fill -text "Fill page" -variable PrintFill
|
||||
checkbutton .p.right -text "Day numbers at top-right" -variable PrintDaysRight
|
||||
checkbutton .p.encoding -text "ISO 8859-1 PostScript encoding" -variable PrintEncoding
|
||||
checkbutton .p.calendars -text "Print small calendars" -variable PrintSmallCalendars
|
||||
|
||||
@@ -1121,7 +1199,7 @@ proc DoPrint {} {
|
||||
|
||||
pack .p.f1 .p.f2 .p.f2a .p.f3 .p.f3a \
|
||||
-side top -fill both -expand 1 -anchor w
|
||||
pack .p.fill .p.encoding .p.calendars -in .p.f3a \
|
||||
pack .p.fill .p.right .p.encoding .p.calendars -in .p.f3a \
|
||||
-side top -anchor w -fill none -expand 0
|
||||
pack .p.f4 -side top -fill both -expand 1 -anchor w
|
||||
pack .p.f11 .p.f12 -in .p.f1 -side top -fill none -expand 0 -anchor w
|
||||
@@ -1193,6 +1271,9 @@ proc DoPrint {} {
|
||||
append cmd " -e"
|
||||
}
|
||||
|
||||
if {!$PrintDaysRight} {
|
||||
append cmd " -x"
|
||||
}
|
||||
if {$PrintEncoding} {
|
||||
append cmd " -i"
|
||||
}
|
||||
@@ -1295,15 +1376,20 @@ proc DoGoto {} {
|
||||
#---------------------------------------------------------------------------
|
||||
proc Quit {} {
|
||||
global Option
|
||||
global InotifyFP
|
||||
if { !$Option(ConfirmQuit) } {
|
||||
destroy .
|
||||
StopBackgroundRemindDaemon
|
||||
exit
|
||||
catch { exec kill [pid $InotifyFP] }
|
||||
catch { close $InotifyFP }
|
||||
exit 0
|
||||
}
|
||||
if { [tk_dialog .question "Confirm..." {Really quit?} question 0 No Yes] } {
|
||||
destroy .
|
||||
StopBackgroundRemindDaemon
|
||||
exit
|
||||
catch { exec kill [pid $InotifyFP] }
|
||||
catch { close $InotifyFP }
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1776,8 +1862,7 @@ proc ModifyDay {d firstDay} {
|
||||
WriteReminder $f TKTAG$HighestTagSoFar $rem $opts
|
||||
close $f
|
||||
|
||||
FillCalWindow
|
||||
RestartBackgroundRemindDaemon
|
||||
ScheduleUpdateForChanges
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -2340,8 +2425,12 @@ proc BrowseForFileRead {w {dir ""}} {
|
||||
# Starts a background Remind daemon to handle timed reminders
|
||||
#---------------------------------------------------------------------------
|
||||
proc StartBackgroundRemindDaemon {} {
|
||||
global Remind DaemonFile ReminderFile Option
|
||||
set problem [catch { set DaemonFile [open "|$Remind -z0 $Option(ExtraRemindArgs) $ReminderFile" "r+"] } err]
|
||||
global Remind DaemonFile ReminderFile Option TwentyFourHourMode
|
||||
if {$TwentyFourHourMode} {
|
||||
set problem [catch { set DaemonFile [open "|$Remind -b1 -z0 -itkremind=1 $Option(ExtraRemindArgs) $ReminderFile" "r+"] } err]
|
||||
} else {
|
||||
set problem [catch { set DaemonFile [open "|$Remind -z0 -itkremind=1 $Option(ExtraRemindArgs) $ReminderFile" "r+"] } err]
|
||||
}
|
||||
if {$problem} {
|
||||
tk_dialog .error Error "Can't start Remind daemon in background: $err" error 0 OK
|
||||
} else {
|
||||
@@ -2559,7 +2648,7 @@ proc IssueBackgroundReminder { file time now tag } {
|
||||
}
|
||||
if {$Option(RunCmd) != ""} {
|
||||
if {$Option(FeedReminder)} {
|
||||
FeedReminderToCommand $Option(RunCmd) $msg
|
||||
FeedReminderToCommand $Option(RunCmd) "$time: $msg"
|
||||
} else {
|
||||
exec "/bin/sh" "-c" $Option(RunCmd) "&"
|
||||
}
|
||||
@@ -2608,27 +2697,33 @@ proc CommandWritable { f msg } {
|
||||
|
||||
|
||||
proc main {} {
|
||||
# If no ~/.tkremindrc file, create an empty one
|
||||
if {![file exists ~/.tkremindrc]} {
|
||||
catch {
|
||||
set f [open ~/.tkremindrc "w"]
|
||||
close $f
|
||||
}
|
||||
}
|
||||
global ConfigFile
|
||||
|
||||
font create CalboxFont {*}[font actual TkFixedFont]
|
||||
font create HeadingFont {*}[font actual TkDefaultFont]
|
||||
|
||||
global AppendFile HighestTagSoFar DayNames
|
||||
catch {
|
||||
puts "\nTkRemind Copyright (C) 1996-2020 Dianne Skoll"
|
||||
puts "\nTkRemind Copyright (C) 1996-2021 Dianne Skoll"
|
||||
}
|
||||
catch { SetFonts }
|
||||
Initialize
|
||||
|
||||
# If no $ConfigFile file, create an empty one
|
||||
if {![file exists $ConfigFile]} {
|
||||
catch {
|
||||
set f [open $ConfigFile "w"]
|
||||
close $f
|
||||
}
|
||||
}
|
||||
LoadOptions
|
||||
CreateMoonImages
|
||||
Initialize
|
||||
ShowTodaysReminders
|
||||
ScanForTags $AppendFile
|
||||
CreateCalWindow $DayNames
|
||||
FillCalWindow
|
||||
StartBackgroundRemindDaemon
|
||||
SetupInotify
|
||||
DisplayTimeContinuously
|
||||
}
|
||||
|
||||
@@ -2705,9 +2800,11 @@ proc ReadTaggedOptions { tag date } {
|
||||
lappend ans -text-day2 $d
|
||||
}
|
||||
if {[dict exists $obj m]} {
|
||||
lappend ans -text-mon1 [lindex $MonthNames [expr [dict get $obj m] -1]]
|
||||
lappend ans -text-mon2 [lindex $MonthNames [expr [dict get $obj m] -1]]
|
||||
lappend ans -text-mon3 [lindex $MonthNames [expr [dict get $obj m] -1]]
|
||||
set mm [dict get $obj m]
|
||||
set mm [string trimleft $m 0]
|
||||
lappend ans -text-mon1 [lindex $MonthNames [expr $mm -1]]
|
||||
lappend ans -text-mon2 [lindex $MonthNames [expr $mm -1]]
|
||||
lappend ans -text-mon3 [lindex $MonthNames [expr $mm -1]]
|
||||
} else {
|
||||
lappend ans -text-mon1 {every month}
|
||||
lappend ans -text-mon2 {every month}
|
||||
@@ -2746,7 +2843,8 @@ proc ReadTaggedOptions { tag date } {
|
||||
lappend ans -text-ordinal Last
|
||||
# Adjust month down and possibly year?
|
||||
if {[dict exists $obj m]} {
|
||||
set idx [expr [dict get $obj m] -1]
|
||||
set mm [string trimleft [dict get $obj m] 0]
|
||||
set idx [expr $mm -1]
|
||||
if {$idx <= 0} {
|
||||
set idx 12
|
||||
}
|
||||
@@ -2792,15 +2890,18 @@ proc ReadTaggedOptions { tag date } {
|
||||
if {[dict exists $obj until]} {
|
||||
set u [dict get $obj until]
|
||||
regexp {^([0-9][0-9][0-9][0-9]).([0-9][0-9]).([0-9][0-9])} $u all yu mu du
|
||||
# Trim leading zeros, or Tcl complains
|
||||
set mu [string trimleft $mu 0]
|
||||
lappend ans -global-expbut 1
|
||||
lappend ans -text-expday $du
|
||||
lappend ans -text-expmon [lindex $MonthNames [expr $mu-1]]
|
||||
lappend ans -text-expyear $yu
|
||||
|
||||
} else {
|
||||
set mm [string trimleft $m 0]
|
||||
lappend ans -global-expbut 0
|
||||
lappend ans -text-expday $d
|
||||
lappend ans -text-expmon [lindex $MonthNames [expr $m-1]]
|
||||
lappend ans -text-expmon [lindex $MonthNames [expr $mm-1]]
|
||||
lappend ans -text-expyear $y
|
||||
}
|
||||
|
||||
@@ -3037,12 +3138,13 @@ proc TaggedEnter { w } {
|
||||
# Removes highlight from an "editable" reminder as mouse leaves it
|
||||
#***********************************************************************
|
||||
proc TaggedLeave { w } {
|
||||
global Option
|
||||
set tag [GetCurrentReminder $w]
|
||||
if {$tag != ""} {
|
||||
set tags [$w tag names current]
|
||||
set index [lsearch -glob $tags "clr*"]
|
||||
if {$index < 0} {
|
||||
set fg "#000000"
|
||||
set fg $Option(TextColor)
|
||||
} else {
|
||||
set fg [string range [lindex $tags $index] 3 end]
|
||||
set fg "#$fg"
|
||||
@@ -3123,12 +3225,38 @@ proc EditTaggedReminder { w } {
|
||||
return 1
|
||||
}
|
||||
|
||||
FillCalWindow
|
||||
RestartBackgroundRemindDaemon
|
||||
ScheduleUpdateForChanges
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: UpdateForChanges
|
||||
# Updates the calendar window and restarts background daemon because
|
||||
# something has changed.
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
#***********************************************************************
|
||||
proc UpdateForChanges {} {
|
||||
global TimerUpdateForChanges
|
||||
catch { after cancel $TimerUpdateForChanges }
|
||||
FillCalWindow
|
||||
RestartBackgroundRemindDaemon
|
||||
}
|
||||
|
||||
# Schedule an update for 100ms in the future.
|
||||
# That way, if we get a rapid succession of
|
||||
# change notifications, we (probably) only
|
||||
# end up doing one call to UpdateForChanges
|
||||
proc ScheduleUpdateForChanges {} {
|
||||
global TimerUpdateForChanges
|
||||
catch { after cancel $TimerUpdateForChanges }
|
||||
set TimerUpdateForChanges [after 100 UpdateForChanges]
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: UniqueFileName
|
||||
# %ARGUMENTS:
|
||||
@@ -3407,6 +3535,7 @@ proc ShowTodaysReminders {} {
|
||||
global Option
|
||||
global Remind
|
||||
global ReminderFile
|
||||
global TwentyFourHourMode
|
||||
if {!$Option(ShowTodaysReminders)} {
|
||||
return
|
||||
}
|
||||
@@ -3428,7 +3557,10 @@ proc ShowTodaysReminders {} {
|
||||
|
||||
# Grab the reminders
|
||||
set stuff ""
|
||||
set cmdline "|$Remind -g -q -r "
|
||||
set cmdline "|$Remind -itkremind=1 -g -q -r "
|
||||
if {$TwentyFourHourMode} {
|
||||
append cmdline "-b1 "
|
||||
}
|
||||
append cmdline $Option(ExtraRemindArgs);
|
||||
append cmdline " $ReminderFile 2>/dev/null"
|
||||
set f [open $cmdline r]
|
||||
@@ -3453,8 +3585,7 @@ proc InteractiveDeleteReminder { tag } {
|
||||
set ans [tk_dialog .error "Really Delete" "Really delete reminder?" warning 0 No Yes]
|
||||
if {$ans == 1} {
|
||||
DeleteTaggedReminder $tag
|
||||
FillCalWindow
|
||||
RestartBackgroundRemindDaemon
|
||||
ScheduleUpdateForChanges
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3507,10 +3638,35 @@ proc SetFonts {} {
|
||||
set SetFontsWorked 1
|
||||
}
|
||||
|
||||
# Set up inotify to watch for changes to reminder file/directory
|
||||
proc SetupInotify {} {
|
||||
global InotifyFP
|
||||
global ReminderFile
|
||||
set failed [catch {set InotifyFP [open "|inotifywait -q -m -e close_write -e move -e create -e delete $ReminderFile" "r"] } ]
|
||||
if {$failed} {
|
||||
# inotifywait probably not available... meh.
|
||||
return
|
||||
}
|
||||
fileevent $InotifyFP readable [list InotifyReadable $InotifyFP]
|
||||
}
|
||||
|
||||
# Called when inotifywait reports an event. Schedule a calendar update
|
||||
# and daemon reload.
|
||||
proc InotifyReadable { fp } {
|
||||
catch { set num [gets $fp line] }
|
||||
if {$num < 0} {
|
||||
catch { exec kill [pid $fp] }
|
||||
close $fp
|
||||
return
|
||||
}
|
||||
ScheduleUpdateForChanges
|
||||
}
|
||||
|
||||
### Balloon help
|
||||
set Balloon(HelpTime) 400
|
||||
set Balloon(StayTime) 3500
|
||||
set Balloon(Font) fixed
|
||||
set Balloon(MustLeave) 0
|
||||
|
||||
proc balloon_reset_timer { w } {
|
||||
balloon_destroy_help_window
|
||||
@@ -3624,4 +3780,40 @@ proc balloon_calculate_geometry { w } {
|
||||
return "+$tx+$ty"
|
||||
}
|
||||
|
||||
proc ChooseCalboxFont {} {
|
||||
tk fontchooser show
|
||||
tk fontchooser configure -font [font actual CalboxFont]
|
||||
tk fontchooser configure -command SetCalboxFont
|
||||
}
|
||||
|
||||
proc SetCalboxFont {font} {
|
||||
global tmpOpt
|
||||
font configure CalboxFont {*}[font actual $font]
|
||||
set tmpOpt(CalboxFont) [font actual $font]
|
||||
raise .opt
|
||||
}
|
||||
|
||||
proc ChooseHeadingFont {} {
|
||||
tk fontchooser show
|
||||
tk fontchooser configure -font [font actual HeadingFont]
|
||||
tk fontchooser configure -command SetHeadingFont
|
||||
}
|
||||
|
||||
proc SetHeadingFont {font} {
|
||||
global tmpOpt
|
||||
font configure HeadingFont {*}[font actual $font]
|
||||
set tmpOpt(HeadingFont) [font actual $font]
|
||||
raise .opt
|
||||
}
|
||||
|
||||
proc PickColor {index button} {
|
||||
global tmpOpt
|
||||
set x [tk_chooseColor -initialcolor $tmpOpt($index)]
|
||||
if {"$x" != ""} {
|
||||
set tmpOpt($index) $x
|
||||
$button configure -background $x
|
||||
}
|
||||
raise .opt
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
#define _XOPEN_SOURCE
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -21,6 +22,7 @@
|
||||
|
||||
#ifdef REM_USE_WCHAR
|
||||
#include <wctype.h>
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
@@ -356,6 +358,7 @@ static int make_wchar_versions(CalEntry *e)
|
||||
if (!buf) return 0;
|
||||
|
||||
(void) mbstowcs(buf, e->text, len+1);
|
||||
buf[len] = 0;
|
||||
e->wc_text = buf;
|
||||
e->wc_pos = buf;
|
||||
return 1;
|
||||
@@ -881,11 +884,21 @@ static void PrintCentered(char const *s, int width, char *pad)
|
||||
|
||||
for (i=0; i<d; i++) fputs(pad, stdout);
|
||||
for (i=0; i<width; i++) {
|
||||
if (*s) PutChar(*s++); else break;
|
||||
if (*s) {
|
||||
if (isspace(*s)) {
|
||||
PutChar(' ');
|
||||
s++;
|
||||
} else {
|
||||
PutChar(*s++);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i=d+len; i<width; i++) fputs(pad, stdout);
|
||||
#else
|
||||
size_t len = mbstowcs(NULL, s, 0);
|
||||
int display_len;
|
||||
int i;
|
||||
wchar_t static_buf[128];
|
||||
wchar_t *buf;
|
||||
@@ -909,11 +922,25 @@ static void PrintCentered(char const *s, int width, char *pad)
|
||||
}
|
||||
}
|
||||
(void) mbstowcs(buf, s, len+1);
|
||||
d = (width - len) / 2;
|
||||
display_len = wcswidth(buf, len+1);
|
||||
d = (width - display_len) / 2;
|
||||
if (d < 0) d = 0;
|
||||
ws = buf;
|
||||
for (i=0; i<d; i++) fputs(pad, stdout);
|
||||
for (i=0; i<width; i++) {
|
||||
if (*ws) PutWideChar(*ws++); else break;
|
||||
if (*ws) {
|
||||
PutWideChar(*ws++);
|
||||
if (wcwidth(*ws) == 0) {
|
||||
/* Don't count this character... it's zero-width */
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Mop up any potential combining characters */
|
||||
while (*ws && wcwidth(*ws) == 0) {
|
||||
PutWideChar(*ws++);
|
||||
}
|
||||
for (i=d+len; i<width; i++) fputs(pad, stdout);
|
||||
if (buf != static_buf) free(buf);
|
||||
@@ -967,6 +994,7 @@ static int WriteOneColLine(int col)
|
||||
#ifdef REM_USE_WCHAR
|
||||
wchar_t const *ws;
|
||||
wchar_t const *wspace;
|
||||
int width;
|
||||
#endif
|
||||
|
||||
int numwritten = 0;
|
||||
@@ -991,9 +1019,18 @@ static int WriteOneColLine(int col)
|
||||
}
|
||||
|
||||
/* Find the last space char within the column. */
|
||||
while (ws - e->wc_pos <= ColSpaces) {
|
||||
if (!*ws) {wspace = ws; break;}
|
||||
if (iswspace(*ws)) wspace = ws;
|
||||
width = 0;
|
||||
while (width <= ColSpaces) {
|
||||
if (!*ws) {
|
||||
wspace = ws;
|
||||
break;
|
||||
}
|
||||
if (iswspace(*ws)) {
|
||||
wspace = ws;
|
||||
}
|
||||
if (wcwidth(*ws)) {
|
||||
width++;
|
||||
}
|
||||
ws++;
|
||||
}
|
||||
|
||||
@@ -1006,16 +1043,30 @@ static int WriteOneColLine(int col)
|
||||
if (!wspace) {
|
||||
for (ws = e->wc_pos; ws - e->wc_pos < ColSpaces; ws++) {
|
||||
if (!*ws) break;
|
||||
numwritten++;
|
||||
PutWideChar(*ws);
|
||||
if (iswspace(*ws)) {
|
||||
PutChar(' ');
|
||||
numwritten++;
|
||||
} else {
|
||||
if (wcwidth(*ws) > 0) {
|
||||
numwritten += wcwidth(*ws);
|
||||
}
|
||||
PutWideChar(*ws);
|
||||
}
|
||||
}
|
||||
e->wc_pos = ws;
|
||||
} else {
|
||||
/* We found a space - print everything before it. */
|
||||
for (ws = e->wc_pos; ws<wspace; ws++) {
|
||||
if (!*ws) break;
|
||||
numwritten++;
|
||||
PutWideChar(*ws);
|
||||
if (iswspace(*ws)) {
|
||||
PutChar(' ');
|
||||
numwritten++;
|
||||
} else {
|
||||
if (wcwidth(*ws) > 0) {
|
||||
numwritten += wcwidth(*ws);
|
||||
}
|
||||
PutWideChar(*ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1065,7 +1116,7 @@ static int WriteOneColLine(int col)
|
||||
/* Find the last space char within the column. */
|
||||
while (s - e->pos <= ColSpaces) {
|
||||
if (!*s) {space = s; break;}
|
||||
if (*s == ' ') space = s;
|
||||
if (isspace(*s)) space = s;
|
||||
s++;
|
||||
}
|
||||
|
||||
@@ -1079,7 +1130,11 @@ static int WriteOneColLine(int col)
|
||||
for (s = e->pos; s - e->pos < ColSpaces; s++) {
|
||||
if (!*s) break;
|
||||
numwritten++;
|
||||
PutChar(*s);
|
||||
if (isspace(*s)) {
|
||||
PutChar(' ');
|
||||
} else {
|
||||
PutChar(*s);
|
||||
}
|
||||
}
|
||||
e->pos = s;
|
||||
} else {
|
||||
@@ -1087,7 +1142,11 @@ static int WriteOneColLine(int col)
|
||||
for (s = e->pos; s<space; s++) {
|
||||
if (!*s) break;
|
||||
numwritten++;
|
||||
PutChar(*s);
|
||||
if (isspace(*s)) {
|
||||
PutChar(' ');
|
||||
} else {
|
||||
PutChar(*s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,7 +1159,7 @@ static int WriteOneColLine(int col)
|
||||
while(numwritten++ < ColSpaces) PutChar(' ');
|
||||
|
||||
/* Skip any spaces before next word */
|
||||
while (*s == ' ') s++;
|
||||
while (isspace(*s)) s++;
|
||||
|
||||
/* If done, free memory if no next entry. */
|
||||
if (!*s && !e->next) {
|
||||
@@ -1325,6 +1384,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
if (trig.typ == SAT_TYPE) {
|
||||
r=DoSatRemind(&trig, &tim, p);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
if (r == E_EXPIRED) return OK;
|
||||
return r;
|
||||
@@ -1369,6 +1431,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
/* Calculate the trigger date */
|
||||
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
return r;
|
||||
}
|
||||
@@ -1599,6 +1664,7 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
if(!e->filename) {
|
||||
if (e->text) free(e->text);
|
||||
if (e->raw_text) free(e->raw_text);
|
||||
if (e->wc_text) free(e->wc_text);
|
||||
free(e);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||
/* any less than 12. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAR_NAME_LEN 16
|
||||
#define VAR_NAME_LEN 64
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||
/* any less than 12. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAR_NAME_LEN 16
|
||||
#define VAR_NAME_LEN 64
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||
|
||||
11
src/dorem.c
11
src/dorem.c
@@ -81,6 +81,9 @@ int DoRem(ParsePtr p)
|
||||
PurgeEchoLine("%s\n", CurLine);
|
||||
r=DoSatRemind(&trig, &tim, p);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
if (r == E_EXPIRED) return OK;
|
||||
return r;
|
||||
@@ -134,6 +137,9 @@ int DoRem(ParsePtr p)
|
||||
PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", ErrMsg[r]);
|
||||
PurgeEchoLine("%s\n", CurLine);
|
||||
}
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
return r;
|
||||
}
|
||||
@@ -219,6 +225,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
trig->duration_days = 0;
|
||||
trig->eventstart = NO_TIME;
|
||||
trig->eventduration = NO_TIME;
|
||||
trig->maybe_uncomputable = 0;
|
||||
DBufInit(&(trig->tags));
|
||||
trig->passthru[0] = 0;
|
||||
tim->ttime = NO_TIME;
|
||||
@@ -276,6 +283,10 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
trig->m = tok.val;
|
||||
break;
|
||||
|
||||
case T_MaybeUncomputable:
|
||||
trig->maybe_uncomputable = 1;
|
||||
break;
|
||||
|
||||
case T_Skip:
|
||||
DBufFree(&buf);
|
||||
if (trig->skip != NO_SKIP) return E_SKIP_ERR;
|
||||
|
||||
@@ -366,12 +366,12 @@ static int CacheFile(char const *fname)
|
||||
cl = NULL;
|
||||
/* Create a file header */
|
||||
cf = NEW(CachedFile);
|
||||
cf->cache = NULL;
|
||||
if (!cf) {
|
||||
ShouldCache = 0;
|
||||
FCLOSE(fp);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
cf->cache = NULL;
|
||||
cf->filename = StrDup(fname);
|
||||
if (!cf->filename) {
|
||||
ShouldCache = 0;
|
||||
|
||||
@@ -2917,6 +2917,10 @@ FEvalTrig(func_info *info)
|
||||
}
|
||||
jul = ComputeTrigger(scanfrom, &trig, &tim, &r, 0);
|
||||
}
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = 0;
|
||||
jul = -1;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
if (r) return r;
|
||||
if (jul < 0) {
|
||||
|
||||
@@ -813,9 +813,11 @@ int DoIfTrig(ParsePtr p)
|
||||
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
|
||||
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||
if (r) {
|
||||
if (!Hush || r != E_RUN_DISABLED) {
|
||||
Eprint("%s", ErrMsg[r]);
|
||||
}
|
||||
if (r != E_CANT_TRIG || !trig.maybe_uncomputable) {
|
||||
if (!Hush || r != E_RUN_DISABLED) {
|
||||
Eprint("%s", ErrMsg[r]);
|
||||
}
|
||||
}
|
||||
syndrome = IF_TRUE | BEFORE_ELSE;
|
||||
}
|
||||
else {
|
||||
|
||||
118
src/rem2ps.c
118
src/rem2ps.c
@@ -5,7 +5,7 @@
|
||||
/* Print a PostScript calendar. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2021 by Dianne Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -99,6 +99,7 @@ CalEntry *CurEntries = NULL;
|
||||
CalEntry *PsEntries[32];
|
||||
PageType *CurPage;
|
||||
char PortraitMode;
|
||||
char DaynumRight;
|
||||
char NoSmallCal;
|
||||
char UseISO;
|
||||
|
||||
@@ -140,6 +141,18 @@ void WriteOneEntry (CalEntry *c);
|
||||
void GetSmallLocations (void);
|
||||
char const *EatToken(char const *in, char *out, int maxlen);
|
||||
|
||||
static void
|
||||
put_escaped_string(char const *s)
|
||||
{
|
||||
while(*s) {
|
||||
if (*s == '\\' || *s == '(' || *s == ')') {
|
||||
PutChar('\\');
|
||||
}
|
||||
PutChar(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* StrCmpi */
|
||||
@@ -336,7 +349,7 @@ int main(int argc, char *argv[])
|
||||
!strcmp(DBufValue(&buf), PSBEGIN2)) {
|
||||
if (!validfile) {
|
||||
if (Verbose) {
|
||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2020 by Dianne Skoll\n\n", VERSION);
|
||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2021 by Dianne Skoll\n\n", VERSION);
|
||||
fprintf(stderr, "Generating PostScript calendar\n");
|
||||
}
|
||||
}
|
||||
@@ -587,6 +600,12 @@ void WriteProlog(void)
|
||||
printf("%%%%Pages: (atend)\n");
|
||||
printf("%%%%Orientation: %s\n", PortraitMode ? "Portrait" : "Landscape");
|
||||
printf("%%%%EndComments\n");
|
||||
if (PortraitMode) {
|
||||
printf("<< /PageSize [%d %d] >> setpagedevice\n", x, y);
|
||||
} else {
|
||||
/* They were swapped up above, so swap them back or we'll get rotated output */
|
||||
printf("<< /PageSize [%d %d] >> setpagedevice\n", y, x);
|
||||
}
|
||||
|
||||
for (i=0; PSProlog1[i]; i++) puts(PSProlog1[i]);
|
||||
if (!MondayFirst)
|
||||
@@ -679,7 +698,7 @@ void WriteCalEntry(void)
|
||||
printf("]\n");
|
||||
|
||||
/* Print the day number */
|
||||
printf("(%d)\n", CurDay);
|
||||
printf("(%d) %d\n", CurDay, (int) DaynumRight);
|
||||
/* Do it! */
|
||||
printf("DoCalBox\n");
|
||||
|
||||
@@ -819,6 +838,7 @@ void Init(int argc, char *argv[])
|
||||
FillPage = 0;
|
||||
MondayFirst = 0;
|
||||
SmallLocation = "bt";
|
||||
DaynumRight = 1;
|
||||
|
||||
for(j=0; j<32; j++) PsEntries[i] = NULL;
|
||||
|
||||
@@ -935,6 +955,7 @@ void Init(int argc, char *argv[])
|
||||
|
||||
case 'i': UseISO = 1; break;
|
||||
|
||||
case 'x': DaynumRight = 0; break;
|
||||
case 'c': k=(*s);
|
||||
if (!k) {
|
||||
SmallLocation = SmallCalLoc[0];
|
||||
@@ -979,6 +1000,7 @@ void Usage(char const *s)
|
||||
fprintf(stderr, "-b size Set border size for calendar entries\n");
|
||||
fprintf(stderr, "-t size Set line thickness\n");
|
||||
fprintf(stderr, "-e Make calendar fill entire page\n");
|
||||
fprintf(stderr, "-x Put day numbers on left instead of right\n");
|
||||
fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1054,10 +1076,10 @@ int DoQueuedPs(void)
|
||||
FILE *fp;
|
||||
int fnoff;
|
||||
char buffer[512];
|
||||
char const *size, *extra;
|
||||
char fbuffer[512];
|
||||
char const *size, *fsize, *extra;
|
||||
char const *s;
|
||||
int num, r, g, b, phase, fontsize, moonsize;
|
||||
unsigned char c;
|
||||
|
||||
if (!MondayFirst) begin = CurDay - WkDayNum;
|
||||
else begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
|
||||
@@ -1129,19 +1151,28 @@ int DoQueuedPs(void)
|
||||
while(*s && isspace(*s)) {
|
||||
s++;
|
||||
}
|
||||
while(*s) {
|
||||
if (*s == '\\' || *s == '(' || *s == ')') {
|
||||
PutChar('\\');
|
||||
}
|
||||
PutChar(*s);
|
||||
s++;
|
||||
}
|
||||
put_escaped_string(s);
|
||||
printf(") show grestore\n");
|
||||
break;
|
||||
|
||||
case SPECIAL_MOON: /* Moon phase */
|
||||
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
||||
&fontsize);
|
||||
/* See if we have extra stuff */
|
||||
extra = e->entry+fnoff;
|
||||
|
||||
/* Skip phase */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Skip moon size */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Skip font size */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
if (num == 1) {
|
||||
moonsize = -1;
|
||||
fontsize = -1;
|
||||
@@ -1163,7 +1194,27 @@ int DoQueuedPs(void)
|
||||
size = buffer;
|
||||
}
|
||||
|
||||
printf("gsave 0 setgray newpath Border %s add BoxHeight Border sub %s sub\n", size, size);
|
||||
/* Store the starting X coordinate in "moonstartx" */
|
||||
if (DaynumRight) {
|
||||
printf("Border %s add /moonstartx exch def", size);
|
||||
} else {
|
||||
printf("xincr Border sub %s sub ", size);
|
||||
if (*extra) {
|
||||
if (fontsize < 0) {
|
||||
fsize = "EntrySize";
|
||||
} else {
|
||||
sprintf(fbuffer, "%d", fontsize);
|
||||
fsize = fbuffer;
|
||||
}
|
||||
printf("/EntryFont findfont %s scalefont setfont (",
|
||||
fsize);
|
||||
put_escaped_string(extra);
|
||||
printf(") stringwidth pop sub Border sub ");
|
||||
}
|
||||
printf("/moonstartx exch def\n");
|
||||
}
|
||||
printf(" gsave 0 setgray newpath ");
|
||||
printf("moonstartx BoxHeight Border sub %s sub\n", size);
|
||||
printf(" %s 0 360 arc closepath\n", size);
|
||||
switch(phase) {
|
||||
case 0:
|
||||
@@ -1174,49 +1225,28 @@ int DoQueuedPs(void)
|
||||
break;
|
||||
|
||||
case 1:
|
||||
printf("stroke\n");
|
||||
printf("newpath Border %s add BoxHeight Border sub %s sub\n",
|
||||
size, size);
|
||||
printf("stroke\nnewpath ");
|
||||
printf("moonstartx BoxHeight Border sub %s sub\n", size);
|
||||
printf("%s 90 270 arc closepath fill\n", size);
|
||||
break;
|
||||
default:
|
||||
printf("stroke\n");
|
||||
printf("newpath Border %s add BoxHeight Border sub %s sub\n",
|
||||
size, size);
|
||||
printf("stroke\nnewpath ");
|
||||
printf("moonstartx BoxHeight Border sub %s sub\n", size);
|
||||
printf("%s 270 90 arc closepath fill\n", size);
|
||||
break;
|
||||
}
|
||||
/* See if we have extra stuff */
|
||||
extra = e->entry+fnoff;
|
||||
|
||||
/* Skip phase */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Skip moon size */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Skip font size */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Anything left? */
|
||||
if (*extra) {
|
||||
printf("Border %s add %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size, size);
|
||||
printf("moonstartx %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size);
|
||||
if (fontsize < 0) {
|
||||
size = "EntrySize";
|
||||
fsize = "EntrySize";
|
||||
} else {
|
||||
sprintf(buffer, "%d", fontsize);
|
||||
size = buffer;
|
||||
sprintf(fbuffer, "%d", fontsize);
|
||||
fsize = fbuffer;
|
||||
}
|
||||
printf("/EntryFont findfont %s scalefont setfont (",
|
||||
size);
|
||||
while(*extra) {
|
||||
c = (unsigned char) *extra++;
|
||||
if (c == '\\' || c == '(' || c == ')') PutChar('\\');
|
||||
PutChar(c);
|
||||
}
|
||||
fsize);
|
||||
put_escaped_string(extra);
|
||||
printf(") show\n");
|
||||
|
||||
}
|
||||
|
||||
13
src/rem2ps.h
13
src/rem2ps.h
@@ -5,7 +5,7 @@
|
||||
/* Define the PostScript prologue */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2021 by Dianne Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -13,7 +13,7 @@ char *PSProlog1[] =
|
||||
{
|
||||
"% This file was produced by Remind and Rem2PS, written by",
|
||||
"% Dianne Skoll.",
|
||||
"% Remind and Rem2PS are Copyright 1992-2020 Dianne Skoll.",
|
||||
"% Remind and Rem2PS are Copyright 1992-2021 Dianne Skoll.",
|
||||
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
|
||||
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
|
||||
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
|
||||
@@ -196,9 +196,10 @@ char *PSProlog2[] =
|
||||
"% Variables for calendar boxes:",
|
||||
"% ytop - current top position",
|
||||
"% ymin - minimum y reached for current row",
|
||||
"% border ytop xleft width textarray daynum DoCalBox ybot",
|
||||
"% border ytop xleft width textarray daynum onright DoCalBox ybot",
|
||||
"% Do the entries for one calendar box. Returns lowest Y-coordinate reached",
|
||||
"/DoCalBox {",
|
||||
" /onright exch def",
|
||||
" /daynum exch def",
|
||||
" /textarr exch def",
|
||||
" /wid exch def",
|
||||
@@ -207,8 +208,10 @@ char *PSProlog2[] =
|
||||
" /border exch def",
|
||||
"% Do the day number",
|
||||
" /DayFont findfont DaySize scalefont setfont",
|
||||
" xl wid add border sub daynum stringwidth pop sub",
|
||||
" yt border sub DaySize sub moveto daynum show",
|
||||
" onright 1 eq",
|
||||
" {xl wid add border sub daynum stringwidth pop sub yt border sub DaySize sub moveto daynum show}",
|
||||
" {xl border add yt border sub DaySize sub moveto daynum show}",
|
||||
" ifelse",
|
||||
"% Do the text entries. Precharge the stack with current y pos.",
|
||||
" /ycur yt border sub DaySize sub DaySize sub 2 add def",
|
||||
" /EntryFont findfont EntrySize scalefont setfont",
|
||||
|
||||
@@ -67,6 +67,7 @@ Token TokArray[] = {
|
||||
{ "june", 3, T_Month, 5 },
|
||||
{ "march", 3, T_Month, 2 },
|
||||
{ "may", 3, T_Month, 4 },
|
||||
{ "maybe-uncomputable", 5, T_MaybeUncomputable, 0},
|
||||
{ "monday", 3, T_WkDay, 0 },
|
||||
{ "msf", 3, T_RemType, MSF_TYPE },
|
||||
{ "msg", 3, T_RemType, MSG_TYPE },
|
||||
|
||||
@@ -73,6 +73,7 @@ typedef struct {
|
||||
int duration_days; /* Duration converted to days to search */
|
||||
int eventstart; /* Original event start (datetime) */
|
||||
int eventduration; /* Original event duration (minutes) */
|
||||
int maybe_uncomputable; /* Suppress "can't compute trigger" warnings */
|
||||
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
|
||||
char warn[VAR_NAME_LEN+1]; /* Warning function */
|
||||
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
|
||||
@@ -171,7 +172,8 @@ enum TokTypes
|
||||
T_Duration,
|
||||
T_LongTime,
|
||||
T_OmitFunc,
|
||||
T_Through
|
||||
T_Through,
|
||||
T_MaybeUncomputable
|
||||
};
|
||||
|
||||
/* The structure of a token */
|
||||
|
||||
12
src/var.c
12
src/var.c
@@ -475,17 +475,17 @@ int DoDump(ParsePtr p)
|
||||
DumpVarTable();
|
||||
return OK;
|
||||
}
|
||||
fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
|
||||
fprintf(ErrFp, "%s %s\n\n", VARIABLE, VALUE);
|
||||
while(1) {
|
||||
if (*DBufValue(&buf) == '$') {
|
||||
DumpSysVarByName(DBufValue(&buf)+1);
|
||||
} else {
|
||||
v = FindVar(DBufValue(&buf), 0);
|
||||
DBufValue(&buf)[VAR_NAME_LEN] = 0;
|
||||
if (!v) fprintf(ErrFp, "%*s %s\n", VAR_NAME_LEN,
|
||||
if (!v) fprintf(ErrFp, "%s %s\n",
|
||||
DBufValue(&buf), UNDEF);
|
||||
else {
|
||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
|
||||
fprintf(ErrFp, "%s ", v->name);
|
||||
PrintValue(&(v->v), ErrFp);
|
||||
fprintf(ErrFp, "\n");
|
||||
}
|
||||
@@ -513,12 +513,12 @@ void DumpVarTable(void)
|
||||
register Var *v;
|
||||
register int i;
|
||||
|
||||
fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
|
||||
fprintf(ErrFp, "%s %s\n\n", VARIABLE, VALUE);
|
||||
|
||||
for (i=0; i<VAR_HASH_SIZE; i++) {
|
||||
v = VHashTbl[i];
|
||||
while(v) {
|
||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
|
||||
fprintf(ErrFp, "%s ", v->name);
|
||||
PrintValue(&(v->v), ErrFp);
|
||||
fprintf(ErrFp, "\n");
|
||||
v = v->next;
|
||||
@@ -835,7 +835,7 @@ static void DumpSysVar(char const *name, const SysVar *v)
|
||||
return;
|
||||
}
|
||||
if (name) strcat(buffer, name); else strcat(buffer, v->name);
|
||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN+1, buffer);
|
||||
fprintf(ErrFp, "%16s ", buffer);
|
||||
if (v) {
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
Value val;
|
||||
|
||||
@@ -289,6 +289,9 @@ rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
|
||||
export LC_ALL=en_US.utf-8
|
||||
export LANG=en_US.utf-8
|
||||
../src/remind -w128 -c ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
cmp -s ../tests/test.out ../tests/test.cmp
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Remind: Acceptance test PASSED"
|
||||
|
||||
1906
tests/test.cmp
1906
tests/test.cmp
File diff suppressed because it is too large
Load Diff
@@ -376,6 +376,14 @@ set a133 trigduration()
|
||||
set a134 trigeventstart()
|
||||
set a135 trigeventduration()
|
||||
|
||||
# These will issue errors
|
||||
REM Mon OMIT Mon SKIP MSG Never ever ever...
|
||||
REM Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
|
||||
|
||||
# These will just silently not trigger
|
||||
REM MAYBE-UNCOMPUTABLE Mon OMIT Mon SKIP MSG Never ever ever...
|
||||
REM MAYBE-UNCOMPUTABLE Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
|
||||
|
||||
dump
|
||||
dump $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
OMIT 2010-09-03 THROUGH 2010-09-15
|
||||
|
||||
4
tests/utf-8.rem
Normal file
4
tests/utf-8.rem
Normal file
@@ -0,0 +1,4 @@
|
||||
MSG ру́сский ру́сский ру́сский ру́сский ру́сский ру́сский ру́сский ру́сский
|
||||
MSG עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית
|
||||
|
||||
Wed MSG With tabs and spaces
|
||||
Reference in New Issue
Block a user