[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/doc/pegboard/1020 PEG_1020.rst
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/doc/pegboard/1020 PEG_1020.rst |
Date: |
Fri, 25 Oct 2002 07:25:07 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/10/25 07:25:07
Modified files:
doc/pegboard/1020: PEG_1020.rst
Log message:
calendar - open for comment
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/1020/PEG_1020.rst.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: gzz/doc/pegboard/1020/PEG_1020.rst
diff -u gzz/doc/pegboard/1020/PEG_1020.rst:1.5
gzz/doc/pegboard/1020/PEG_1020.rst:1.6
--- gzz/doc/pegboard/1020/PEG_1020.rst:1.5 Fri Oct 25 04:17:06 2002
+++ gzz/doc/pegboard/1020/PEG_1020.rst Fri Oct 25 07:25:06 2002
@@ -3,84 +3,114 @@
=============================================================
:Authors: Matti Katila
-:Date: $Date: 2002/10/25 08:17:06 $
-:Revision: $Revision: 1.5 $
+:Date: $Date: 2002/10/25 11:25:06 $
+:Revision: $Revision: 1.6 $
:Status: Incomplete
Overview
--------
-Calendar is a renderable which generates an annual calendar.
+Calendar is a renderable which can be used to generate an annual calendar.
This is one of the vital components in PP-module/project.
Basics
------
-One calendar is one year. Usually only parts of it are shown.
+One calendar is one month. Usually only parts of it are shown.
+The whole month is rendered every time.
Issues
------
-What is needed for Calendar?
+What is needed from framework to render Calendar?
- -Coordinating system::
-
- .......
- ---------- . ----.-------
- | Screen | <---- mapping <--- . | Ja.uary |
- | | . | Fe.r. |
- ---------- .......ch |
- | Aprill |
- | May.. |
- --- -- - -
- -Summarum:
- -Two coordinating systems(cs) needed:
- -Calendar cs
- -Screen cs
+ -Coordinating system:
+ _______________
+ |___________|_|
+ ---------- |_|_|_|_|_|_|_|
+ | Screen | <--- |_|_|_|_|_|_|_|
+ | | |_|_|_|_|_|_|_|
+ ---------- |_|_|_|_|_|_|_|
+ |_|_|_________|
+ -object => window
+
+
+ -Text ratio, (Form/layout):
+ -Text's ratio to month's calendar skeleton *must* be
+ changeable from java side.
-Localization:
-Months and Weekdays.
-Solve in java side.
- -Speed
- -Render with OpenGL in C++ side
- -Use cpu wisely and draw only needed parts.
-
-
- -Format/layout? ::
-
- |---|
- | |
- |---| -----------...-------------
- | | | | | | | | |
- |---| -----------...-------------
- | | horizontal
- |---|
- . .
- . .
- . . -----------------
- |---| | | | | |
- | | -----------------
- |---| | | | | |
- -----------------
- vertical | | | | |
- -----------------
- matrix
-
-
-New Object
-----------
-
- -Calendar object
- -Year :int
- -Months: string[12]
- -Weekdays: string[7]
- -these must be countable:
- -first weekday of the Month ::
+What is needed to make Calendar look good?
+
+ -Month (and year)
+ -Weeknumbers
+ -Weekdays
+ -Date(s)
+ -Colors
+ -LineWidth
+ -Text:
+
+------------------------------------------------------------------------------
+| |
+| October 2002 |
+| |
+| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
++-----+--------+---------+-----------+----------+--------+----------+--------+
+|x | | | | | | | |
+| | | | | | | | |
+| | | 1 | 2 | 3 | 4 | 5 | 6 |
+| | | | | | | | |
++-----+--------+---------+-----------+----------+--------+----------+--------+
+|x+1 | | | | | | | |
+| | | | | | | | |
+| | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
+| | | | | | | | |
++-----+--------+---------+-----------+----------+--------+----------+--------+
+|x+2 | | | | | | | |
+| | | | | | | | |
+| | etc.. | | | | | | |
+
+
+|<-w->|<--d1-->|
+
+ -w's ratio to d1
+
+--------------------------- ---
+| /|\
+| m
+| |
+| Monday | Tuesday | \|/
++-----+--------+---------+- ---
+|x | | | /|\
+| | | | d2
+| | empty | 1 | |
+| | | | \|/
++-----+--------+---------+- ----
+
+ -m's ratio to d2
+
+ -must know how many empty days,
+ -must know how many days and
+ -must know how many weeks in month:
+
+
+ April December
+ ______________ _______________
+ |_|_|_|_|_|_|_| |___________|_|
+ |_|_|_|_|_|_|_| |_|_|_|_|_|_|_|
+ |_|_|_|_|_|_|_| |_|_|_|_|_|_|_|
+ |_|_|_|_|_|_|_| |_|_|_|_|_|_|_|
+ . here is . |_|_|_|_|_|_|_|
+ ....emptynes... |_|_|_________|
+
+
_______________
|___________|_| /|\
@@ -90,194 +120,10 @@
|_|_|_|_|_|_|_| |
|_|_|_________| \|/
- -also days per month is needed
-
-
-Prototypes etc.
----------------
-
- Open for comments.
-
-
-TextPrototype
--------------
-
-Code::
-
- import java.util.*;
-
- public class TextCalendar {
- static void p(String s) { System.out.print(s); }
- static void pln(String s) { System.out.println(s); }
-
- // notice common factor, 12
- private int weeks_in_month[] = new int[12];
- private int empty_before_first_day[] = new int[12];
- private int days_in_month[] = new int[12];
-
-
- public TextCalendar() {
-
- // get the supported ids for GMT-08:00 (Pacific Standard Time)
- String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
-
- // if no ids were returned, something is wrong. get out.
- if (ids.length == 0)
- System.exit(0);
-
- // create a Pacific Standard Time time zone
- SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000,
ids[0]);
-
- // set up rules for daylight savings time
- pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 *
1000);
- pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 *
1000);
- Calendar calendar = new GregorianCalendar(pdt);
- calendar.setFirstDayOfWeek(Calendar.MONDAY);
-
- Date date = new Date();
- date.setYear(calendar.YEAR);
-
- pln(" * Year: " + calendar.get(calendar.YEAR));
-
- for (int month = 0; month < 12; month++) {
-
- // set first day of month
- date.setDate(1);
- date.setMonth(month);
- calendar.setTime(date);
-
- // print month
- p("\n" +
- monthStr(calendar.get(Calendar.MONTH)) +
- " " + (calendar.get(Calendar.MONTH)+1) +
- "\n ");
-
- // count empty day at the beginning of the month.
- if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
- empty_before_first_day[month] = 6;
- } else {
- empty_before_first_day[month] =
- calendar.get(Calendar.DAY_OF_WEEK) - 2;
- }
-
- // print empty spaces at the beginning of month if needed..
- for (int i=0; i< empty_before_first_day[month]; i++) {
- p(" ");
- }
-
-
- // generate one month a day by day
- for (int day=1; day<33; day++) {
- date.setDate(day);
- calendar.setTime(date);
-
- // over-month checking
- if (date.getDate() < day) {
- days_in_month[month] = day - 1;
- break;
- }
-
- // print weekday and date
- p(dayStr(calendar.get(Calendar.DAY_OF_WEEK))+
- " " +
- calendar.get(Calendar.DATE) + ", "
- );
-
- // if sunday, print "\n" and increment weeks
- if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
- p("\n ");
- weeks_in_month[month] += 1;
- }
- }
- pln("\n ** Weeks: " + weeks_in_month[month] +
- ", " + empty_before_first_day[month] +
- " - empty days at the beginning of the month, " +
- days_in_month[month] +" days in month");
- }
-
- }
-
-
- private String dayStr(int day) {
-
- if ( day < Calendar.SUNDAY || day > Calendar.SATURDAY ) return
"ERROR";
-
- switch(day) {
- case Calendar.MONDAY: return "Ma";
- case Calendar.TUESDAY: return "Ti";
- case Calendar.WEDNESDAY: return "Ke";
- case Calendar.THURSDAY: return "To";
- case Calendar.FRIDAY: return "Pe";
- case Calendar.SATURDAY: return "La";
- case Calendar.SUNDAY: return "Su";
- }
- return "Error";
- }
-
- private String monthStr(int month) {
- if ( month < 0 || month > 11) return "ERROR";
-
- String ret ="";
-
- switch(month) {
- case 0: ret = "Tammi"; break;
- case 1: ret = "Helmi"; break;
- case 2: ret = "Maalis"; break;
- case 3: ret = "Huhti"; break;
- case 4: ret = "Touko"; break;
- case 5: ret = "Kesä"; break;
- case 6: ret = "Heinä"; break;
- case 7: ret = "Elo"; break;
- case 8: ret = "Syys"; break;
- case 9: ret = "Loka"; break;
- case 10: ret = "Marras"; break;
- case 11: ret = "Joulu"; break;
- }
- return ret + "kuu";
- }
-
-
- public static void main(String [] arg) {
- TextCalendar c = new TextCalendar();
- }
- }
-
-
-
-Still Very Problematic
-----------------------
-
- _Coordinating system._
-
-
-What is really needed with calendar?
-
-
- while (yearHasMonthsLeft):
-
- // draw month skeleton
- draw skeleton( height[month] )
- // height(weeks) is one of the arguments
-
-
- // put text in correct places
- move to non empty day from beginning
-
- while ( monthHasDaysLeft):
- putText ( date)
-
- etc..
-
- * So, where is scaling done?
- * Is calendar fixed size?
-How it is used?
+Why CalendarVob isn't made with CallGL?
- -Someone needs a piece of calendar(x0,y0, x1,y1)
- -Calculate what part needs rendering
- -Render
- -Put on screen with right coordinates.
-
+ -Text is very problematic - can't be done.
+
- ** Talk to Tjl about coordinate systems. **