dslinux/user/pixil/apps/fltk/schedule Makefile misclist.cxx misclist.h nxdetail.cxx nxgroupbuttons.cxx nxgroupbuttons.h nxmonthcal.cxx nxmonthcal.h nxmonthview.cxx nxmonwin.cxx nxrepeat.cxx nxrepeatevent.cxx nxsc.cxx nxschedule.cxx nxschedule.h nxtime.cxx nxweek.cxx nxweek.h nxweekview.cxx nxyearcal.cxx nxyearcal.h nxyearview.cxx
amadeus
dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:24:30 CEST 2006
Update of /cvsroot/dslinux/dslinux/user/pixil/apps/fltk/schedule
In directory antilope:/tmp/cvs-serv11916/apps/fltk/schedule
Added Files:
Makefile misclist.cxx misclist.h nxdetail.cxx
nxgroupbuttons.cxx nxgroupbuttons.h nxmonthcal.cxx
nxmonthcal.h nxmonthview.cxx nxmonwin.cxx nxrepeat.cxx
nxrepeatevent.cxx nxsc.cxx nxschedule.cxx nxschedule.h
nxtime.cxx nxweek.cxx nxweek.h nxweekview.cxx nxyearcal.cxx
nxyearcal.h nxyearview.cxx
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it
--- NEW FILE: nxmonthview.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include "nxschedule.h"
#ifdef DEBUG
#define DPRINT(str, args...) printf("DEBUG: " str, ## args)
#else
#define DPRINT(args...)
#endif
void
NxSchedule::MakeMonthViewWindow()
{
monthViewWindow = new NxPimWindow(0, 0, W_W, W_H);
add_window((Fl_Window *) monthViewWindow->GetWindowPtr());
/***
{
NxButton* o = new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH - 5, BUTTON_HEIGHT, "Back");
o->callback(backButton_callback, this);
monthViewWindow->add((Fl_Widget*)o);
}
****/
{
NxButton *o =
new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH + 25, BUTTON_HEIGHT,
"This Month");
o->callback(thisMonth_callback, this);
monthViewWindow->add((Fl_Widget *) o);
}
{
pMonthCal =
new NxMonthCalendar(3, 5, W_W - 5, BUTTON_Y - 3, "", true, MONTH,
db, SCHEDULE);
monthViewWindow->add(pMonthCal);
pMonthCal->DateCallback(monthCal_callback);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 180, BUTTON_Y, 10, BUTTON_HEIGHT,
type_daily);
o->callback(dailyView_callback, this);
monthViewWindow->add((Fl_Widget *) o);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 193, BUTTON_Y, 10, BUTTON_HEIGHT,
type_weekly);
o->callback(weeklyView_callback, this);
monthViewWindow->add((Fl_Widget *) o);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 206, BUTTON_Y, 10, BUTTON_HEIGHT,
type_monthly);
o->callback(monthlyView_callback, this);
monthViewWindow->add((Fl_Widget *) o);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 219, BUTTON_Y, 10, BUTTON_HEIGHT,
type_yearly);
o->callback(yearlyView_callback, this);
monthViewWindow->add((Fl_Widget *) o);
}
monthViewWindow->GetWindowPtr()->end();
}
void
NxSchedule::monthCal_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->monthViewWindow->GetWindowPtr()->hide();
if (pThis->pMonthCal->GetPickedDate()) {
pThis->m_CurrentDay = pMonthCal->GetPickedDate();
pThis->UpdateDateDisplay();
}
// dayWindow->add((Fl_Widget*)buttonGroup);
pThis->show_window(dayWindow->GetWindowPtr());
}
void
NxSchedule::thisMonth_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->pMonthCal->SetPickedDate(time(0));
pThis->pMonthCal->update();
}
--- NEW FILE: nxschedule.h ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#ifndef NXSCHEDULE_H
#define NXSCHEDULE_H
#include <FL/Fl.H>
#include <Flek/Fl_Calendar.H>
#include <nxbox.h>
#include <FL/Fl_Window.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Flv_Table_Child.H>
#include <FL/Fl_Editor.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Editor.H>
#include <nxapp.h>
#include <nxdb.h>
#include <nxcalendar.h>
#include <nxweekcalendar.h>
#include <nxwindow.h>
#include <nxbutton.h>
#include <nxscroll.h>
#include <nxinput.h>
#include <nxoutput.h>
#include <nxmultilineinput.h>
#include <nxcheckbutton.h>
#include <nxbox.h>
#include <nxholdbrowser.h>
#include <nxmenubutton.h>
#include <nxintinput.h>
#include <nxinput.h>
#include <catlist.h>
#include "nxyearcal.h"
#include "nxmonthcal.h"
#include "nxweek.h"
#include "nxgroupbuttons.h"
#include <time.h>
#define TRUE 1
#define FALSE 0
#define APP_NAME "Scheduler"
#define CAT_NUM 4
#define ID 4
#define CATEGORYS 50
#define DESC 100
#define GRID_W 15
#define DAY_S 15
#define WEEK_S 24
#define WEEK_H 25
#define COLS 2
#define SCHEDULE "sched"
#define CATEGORY "sched_category"
#define HR_12(_x) ( _x > 12 ? _x - 12 : ( _x ? _x : 12 ) )
#define IS_AM(_x) ( _x >= 12 ? false : true)
#define AM_PM(_x) ( IS_AM(_x) ? "am" : "pm" )
#define MAX_ALARMS 100
typedef enum
{ APPT, TASK }
entry_type;
typedef enum
{ SUN, MON, TUE, WED, THU, FRI, SAT }
day_of_wk;
//Repeat Flag 1
#define REPEAT_NONE 0x0000
#define REPEAT_DAILY 0x0001
#define REPEAT_WEEKLY 0x0002
#define REPEAT_MONTHLY 0x0004
#define REPEAT_YEARLY 0x0008
#define REPEAT_WEEK_SUNDAY 0x0001
#define REPEAT_WEEK_MONDAY 0x0002
#define REPEAT_WEEK_TUESDAY 0x0004
#define REPEAT_WEEK_WEDNESDAY 0x0008
#define REPEAT_WEEK_THURSDAY 0x0010
#define REPEAT_WEEK_FRIDAY 0x0020
#define REPEAT_WEEK_SATURDAY 0x0040
#define REPEAT_WEEK_FLAGS 0x007f
#define REPEAT_MONTH_DAY 0x0080
#define REPEAT_MONTH_DATE 0x0100
#define REPEAT_YEAR_DAY 0x0014
#define REPEAT_YEAR_DATE 0x0018
#define REPEAT_EXCEPTION 0x0001
#define REPEAT_DELETED 0x0002
#define DELETE_FLAG 0x0001
#define CHANGED_TIME_FLAG 0X0002
#define CHANGED_DATE_FLAG 0x0004
#define CHANGED_NEW 0x0008
#define CHANGED_ALARM 0x0010
#ifndef POP_BUTTON_X
#define POP_BUTTON_X 5
#endif
#ifndef POP_BUTTON_Y
#define POP_BUTTON_Y(_x) ((_x->GetWindowPtr()->h()) - BUTTON_HEIGHT - 10 )
#endif
// These flags are for keeping track of where to fill the desc from
#define DESC_UPDATE 0x0000
#define DESC_NEW 0x0001
#define DESC_KEEP 0X0002
// Alarm flags
#define ALARM_MIN 0x0000
#define ALARM_HOUR 0x0001
#define ALARM_DAY 0x0002
#define NO_ALARM 0x7FFF
// For weekly
struct NxTodo
{
unsigned int recno;
long startTime; // Start Time of appointment
long endTime; // End Time of appointment
int allDayFlag; // Flag for time to be ALL day
int repeatFlag_1; // Repeat flag #1 (for day, week, month, year)
int repeatFlag_2; // Repeat flag #2
long repeatFlag_3; // Repeat flag #3
long repeatWkMonFlag; // End of repeating entry
entry_type entryType; // Entry type APPT = Appointment, TASK = Task
char szDescription[DESC]; // Description of appointment or task
int exception;
unsigned int recnoPtr;
long fakeTime;
int alarmInt;
int alarmFlags;
};
class NxSchedule:public NxApp
{
////////////////////////////////////////
// Private Methods
////////////////////////////////////////
private:
// FLNX-Colosseum IPC
#ifdef CONFIG_COLOSSEUM
virtual void ClientIPCHandler(int fd, void *o, int ipc_id = -1);
static void ExecuteSearch(int ipc_id, char *searchStr, int width);
static void ExecuteStringDateSearch(int ipc_id, char *searchStr,
int width, long startTime,
long endTime);
static void ExecuteDateSearch(int ipc_id, int width, long startTime,
long endTime);
#endif
time_t m_CurrentDay;
static time_t fromTime;
static time_t toTime;
static bool g_SearchFlag;
//
// Common
//
static NxDb *db;
static int idNum;
static int g_EditFlag;
//
// Windows
//
static NxWindow *mainWindow;
// Standard PIM Windows
static NxPimWindow *dayWindow;
static NxPimWindow *monthWindow;
static NxPimWindow *setTimeWindow;
static NxPimWindow *weekViewWindow;
static NxPimWindow *monthViewWindow;
static NxPimWindow *yearViewWindow;
static NxPimWindow *lookupWindow;
// Popup PIM Windows
//static NxPimPopWindow * timeWindow;
static NxPimWindow *timeWindow;
static NxPimPopWindow *deleteWindow;
// static NxPimPopWindow * dateWindow;
static NxPimWindow *dateWindow;
// static NxPimPopWindow * weekDateWindow;
static NxPimWindow *weekDateWindow;
static NxPimPopWindow *detailsWindow;
static NxPimPopWindow *resultsWindow;
static NxPimPopWindow *errorWindow;
//static NxPimPopWindow * repeatWindow;
static NxPimWindow *repeatWindow;
static NxPimPopWindow *repeatEventWindow;
static NxPimPopWindow *alarmViewWindow;
static NxCategoryList *dayCat;
static NxCategoryList *weekCat;
static NxCategoryList *detailsCat;
static NxCategoryList *setTimeCat;
static NxCategoryList *cat_list[CAT_NUM];
NxButton *m_DayButtons[7];
static Fl_Group *buttonGroup;
static NxButton *dailyButton;
static NxButton *weeklyButton;
static NxButton *monthlyButton;
static NxButton *yearlyButton;
static NxYearCal *pYearCal;
static NxMonthCalendar *pMonthCal;
static NxCalendar *m_pCalendar;
static NxCalendar *pCalendar;
static NxWeekCalendar *w_pCalendar;
// dayWindow objects
NxScroll *dayScroll;
static Flv_Table_Child *table;
// weekWindow objects
// detailsWindow objects
static NxButton *detailsDeleteButton;
// setTimeWindow objects
NxScroll *hourScroll;
// deleteWindow objects
//
// Callbacks
//
static void dailyView_callback(Fl_Widget * w, void *l);
static void weeklyView_callback(Fl_Widget * w, void *l);
static void monthlyView_callback(Fl_Widget * w, void *l);
static void yearlyView_callback(Fl_Widget * w, void *l);
// for the error window
static NxOutput *error_msg;
static void errorOk_callback(Fl_Widget * fl, void *l);
// for the week view window
static NxBox *monYearBox;
static NxBox *weekBox;
NxButton *weekViewDayButtons[7];
GridButton *upGridButton;
GridButton *downGridButton;
void UpdateWeekViewButtons();
static void weekViewButtons_callback(Fl_Widget * w, void *l);
static void weekGridUpButton_callback(Fl_Widget * w, void *l);
static void weekGridDownButton_callback(Fl_Widget * w, void *l);
static void backButton_callback(Fl_Widget * w, void *l);
static void weekGoto_callback(Fl_Widget * w, void *l);
NxScroll *weekScroll;
WeekGrid *weekGrid;
// for the day window
static void adv_week_callback(Fl_Widget * w, void *l);
static void bak_week_callback(Fl_Widget * w, void *l);
static void new_day_callback(Fl_Widget * w, void *l);
static void details_callback(Fl_Widget * w, void *l);
static void new_callback(Fl_Widget * w, void *l);
static void goto_callback(Fl_Widget * w, void *l);
static void mainDatePicked_callback(Fl_Widget * w, void *l);
static void weekDatePicked_callback(Fl_Widget * w, void *l);
static void view_callback(Fl_Widget * w, void *l);
// for the calendar window
static void adv_year_callback(Fl_Widget * w, void *l);
static void adv_month_callback(Fl_Widget * w, void *l);
static void bak_year_callback(Fl_Widget * w, void *l);
static void bak_month_callback(Fl_Widget * w, void *l);
void set_date_picker(NxCalendar * w);
// for the time window
static void doneTime_callback(Fl_Widget * w, void *l);
static void cancelTime_callback(Fl_Widget * w, void *l);
static void timeHour_callback(Fl_Widget * w, void *l);
static void timeAM_callback(Fl_Widget * w, void *l);
static void timePM_callback(Fl_Widget * w, void *l);
static void timeStart_callback(Fl_Widget * w, void *l);
static void timeEnd_callback(Fl_Widget * w, void *l);
static void timeNone_callback(Fl_Widget * w, void *l);
// for the lookup window
static void searchLookup_callback(Fl_Widget * fl, void *l);
static void cancelLookup_callback(Fl_Widget * fl, void *l);
static void fromCalendar_callback(Fl_Widget * fl, void *l);
static void toCalendar_callback(Fl_Widget * fl, void *l);
static NxInput *lookup_input;
static NxButton *fromDateButton;
static NxButton *toDateButton;
static NxCheckButton *stringCheck;
static NxCheckButton *dateCheck;
static void fromDate_callback(Fl_Widget * fl, void *l);
static void toDate_callback(Fl_Widget * fl, void *l);
static void lookupDate_callback(Fl_Widget * fl, void *l);
void UpdateFromButton();
void UpdateToButton();
static NxTodo *searchString(const char *searchVal);
static NxTodo *searchDate(time_t fromTime, time_t toTime);
static bool checkDate(NxTodo * note, time_t fromTime, time_t toTime);
static char *formatString(const NxTodo * note, int pixels);
// for the results window
static NxOutput *results_message;
static Flv_Table_Child *results_table;
static void doneLookup_callback(Fl_Widget * fl, void *l);
static void resultsView_callback(Fl_Widget * fl, void *l);
// for the month view window
static void monthCal_callback(Fl_Widget * w, void *l);
static void thisMonth_callback(Fl_Widget * w, void *l);
// for the year view window
static void day_callback(Fl_Widget *, void *);
static void month_callback(Fl_Widget *, void *);
void Time_UpdateDisplay();
void time_callback(void (*)(Fl_Widget *, void *));
void SetTimes(time_t nStartTime, time_t nEndTime);
void GetTimes(time_t * nStartTime, time_t * nEndTime);
void (*m_pTimePickerCallback) (Fl_Widget *, void *);
NxButton *m_pTimeAM;
NxButton *m_pTimePM;
NxButton *m_pTimeStart;
NxButton *m_pTimeEnd;
NxButton *m_pTimeNone;
int m_nTimeState;
tm m_StartTime;
tm m_EndTime;
NxHoldBrowser *m_pTimeHour;
NxHoldBrowser *m_pTimeMinute;
// for the detail window
void showAlarmUi();
void hideAlarmUi();
void SetAlarmInt(int interval);
void SetAlarm(NxTodo * n, time_t new_time);
void DeleteAlarm(NxTodo * n);
static void cancelEdit_callback(Fl_Widget * w, void *l);
static void doneEdit_callback(Fl_Widget * w, void *l);
static void deleteEdit_callback(Fl_Widget * w, void *l);
static void detailDate_callback(Fl_Widget * w, void *l);
static void detailTime_callback(Fl_Widget * w, void *l);
static void detailRepeat_callback(Fl_Widget * w, void *l);
static void alarmToggle_callback(Fl_Widget * w, void *l);
static void alarmIntChanged_callback(Fl_Widget * w, void *l);
static void detailDatePicked_callback(Fl_Widget * w, void *l);
static void detailTimePicked_callback(Fl_Widget * w, void *l);
static NxMenuButton *m_pDetailsAlarmInt;
//for the repeat window
static void repeatOk_callback(Fl_Widget * w, void *l);
static void repeatCancel_callback(Fl_Widget * w, void *l);
static void repeatNoneButton_callback(Fl_Widget * w, void *l);
static void repeatDayButton_callback(Fl_Widget * w, void *l);
static void repeatWeekButton_callback(Fl_Widget * w, void *l);
static void repeatMonthButton_callback(Fl_Widget * w, void *l);
static void repeatYearButton_callback(Fl_Widget * w, void *l);
static void repeatDate_callback(Fl_Widget * w, void *l);
static void repeatEveryInput_callback(Fl_Widget * w, void *l);
static void weekDay_callback(Fl_Widget * w, void *l);
static void monthDayDate_callback(Fl_Widget * w, void *l);
void formatWeekMsg(char *msg, char *repeat_str);
void formatMonthMsg(char *msg, char *repeat_str);
void setWeekValue();
long getWeekValue();
NxButton *m_WeekButtons[7];
static NxBox *week_box;
static NxBox *month_box;
void defaultUi();
void resetUi(long repeat);
long getMonthValue();
void setMonthValue();
long getRepeatValue();
void getRepeatData();
void repeatShow_ui();
void noRepeat_Ui();
void wordValue(int val, char *th_val);
int getMonthDayRepeat(time_t date);
time_t repeatDate;
static NxButton *month_day;
static NxButton *month_date;
static NxButton *no_repeat;
static NxButton *day_repeat;
static NxButton *week_repeat;
static NxButton *month_repeat;
static NxButton *year_repeat;
static NxBox *repeat_output;
static NxBox *message_output;
static NxBox *days_box;
static NxIntInput *every_input;
static NxMenuButton *end_list;
static NxBox *every_box;
static NxBox *list_box;
// for the repeat event detailed window
static void changeCurrent_callback(Fl_Widget * w, void *l);
static void changeFuture_callback(Fl_Widget * w, void *l);
static void changeAll_callback(Fl_Widget * w, void *l);
static void changeCancel_callback(Fl_Widget * w, void *l);
// for the delete window
static void yesDelEdit_callback(Fl_Widget * w, void *l);
static void noDelEdit_callback(Fl_Widget * w, void *l);
NxButton *m_pDetails_TimeBox;
NxButton *m_pDetails_DateBox;
NxButton *m_pDetails_RepeatBox;
NxMultilineInput *m_pDetails_DescBox;
static NxCheckButton *m_pDetailsAlarmCheck;
static NxIntInput *m_pDetailsAlarmInput;
NxTodo *m_pCurrentItem;
void FillDetailForm(NxTodo * n, int flags);
// Database functions
static char *Record(int id, int catid, long startTime, long endTime,
int allDayFlag, int repeatFlag_1, int repeatFlag_2,
long repeatFlag_3, long repeatWkMonFlag,
entry_type entryType, char *szDescription, int except,
int recnoPtr, int alarmInt, int alarmFlags);
static char *Record(int catid, string cat_name);
static void clear_table();
void add_items(Flv_Table_Child * t);
void add_item(int i, Flv_Table_Child * t, NxTodo * note);
void UpdateDateDisplay();
void UpdateWeekView();
void MakeDayWindow();
void MakeDateWindow();
void MakeTimeWindow();
void MakeMonthWindow();
void MakeDetailsWindow();
void MakeRepeatWindow();
void MakeSetTimeWindow();
void MakeDeleteWindow();
void MakeLookupWindow();
void MakeResultsWindow();
void MakeErrorWindow();
void MakeWeekViewWindow();
void MakeMonthViewWindow();
void MakeYearViewWindow();
void MakeRepeatEventWindow();
void MakeAlarmViewWindow();
void CreateDateRange(time_t * e, time_t * l, time_t start_day,
time_t end_day);
// for the alarm view window
static NxBox *alarm_msg;
static void viewAlarm(int recno);
void setNextAlarm(NxTodo * note);
void formatAlarmMsg(int recno);
static void alarmOk_callback(Fl_Widget * w, void *l);
static void alarmSnooze_callback(Fl_Widget * w, void *l);
static int alarm_count_;
static int alarms[MAX_ALARMS];
static char alarm_buf[255];
void playAlarm();
static void viewRecord(int recno);
static int compar(NxTodo ** rec1, NxTodo ** rec2);
protected:
virtual void Refresh();
////////////////////////////////////////
// Public Methods
////////////////////////////////////////
public:
NxSchedule(int argc, char *argv[]);
virtual ~ NxSchedule();
Fl_Window *get_main_window();
void show_default_window();
static void exit_callback(Fl_Widget * fl, void *l);
// repeatWindow menu items
static void noDate_callback(Fl_Widget * w, void *l);
static void chooseDate_callback(Fl_Widget * w, void *l);
//
// Public menu callbacks
//
static void calendar_updated(NxCalendar * w);
static void lookup_callback(Fl_Widget * fl, void *l);
static void chooseAlarmMin_callback(Fl_Widget * w, void *l);
static void chooseAlarmHour_callback(Fl_Widget * w, void *l);
static void chooseAlarmDay_callback(Fl_Widget * w, void *l);
static void edit_note(NxTodo * note, int recno);
static void write_note(NxTodo * note);
static void save(NxTodo * note);
static void delete_note(NxTodo * note);
static void ExtractRecord(NxTodo * note, int nRecId);
bool IsForToday(NxTodo * note);
bool IsForToday(NxTodo * note, time_t nEarlyDay, time_t nLateDay);
int MonthDiff(time_t time1, time_t time2);
time_t GetCurrentDay()
{
return m_CurrentDay;
}
int GetEditFlag()
{
return g_EditFlag;
}
NxCalendar *GetpCalendar()
{
return pCalendar;
}
};
#endif
--- NEW FILE: nxweekview.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include "nxschedule.h"
#ifdef DEBUG
#define DPRINT(str, args...) printf("DEBUG: " str, ## args)
#else
#define DPRINT(args...)
#endif
void
NxSchedule::MakeWeekViewWindow()
{
weekViewWindow = new NxPimWindow(0, 0, W_W, W_H);
add_window((Fl_Window *) weekViewWindow->GetWindowPtr());
weekViewWindow->GetWindowPtr()->resizable(NULL);
{
monYearBox =
new NxBox(5, 5, BUTTON_WIDTH + 25, BUTTON_HEIGHT, "Jun '01");
monYearBox->resize(false);
monYearBox->movable(false);
weekViewWindow->add(monYearBox);
}
{
weekBox = new NxBox(W_W - 5 - DAY_S - BUTTON_WIDTH, 5, BUTTON_WIDTH,
BUTTON_HEIGHT, "");
weekBox->resize(false);
weekBox->movable(false);
weekBox->box(FL_FLAT_BOX);
monYearBox->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE);
weekBox->color(NxApp::Instance()->getGlobalColor(APP_BG));
NxApp::Instance()->def_font(weekBox);
weekViewWindow->add(weekBox);
}
{
NxButton *o = new NxButton(W_W - 5 - DAY_S, 5, DAY_S, DAY_S, "@>");
o->movable(false);
o->box(FL_FLAT_BOX);
o->labeltype(FL_SYMBOL_LABEL);
o->callback(adv_week_callback, this);
weekViewWindow->add((Fl_Widget *) o);
o = new NxButton(W_W - 5 - (2 * DAY_S) - BUTTON_WIDTH, 5, DAY_S,
DAY_S, "@<");
o->box(FL_FLAT_BOX);
o->labeltype(FL_SYMBOL_LABEL);
o->callback(bak_week_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
{
for (int i = 7; i > 0; i--) {
NxButton *o = new NxButton(W_W - 12 - ((i) * WEEK_S),
12 + BUTTON_HEIGHT, WEEK_S, WEEK_H,
"");
o->movable(false);
o->callback(weekViewButtons_callback, this);
weekViewDayButtons[7 - i] = o;
o->box(FL_FLAT_BOX);
weekViewWindow->add((Fl_Widget *) o);
}
}
{
weekGrid =
new WeekGrid(W_W - 12 - ((7) * WEEK_S),
BUTTON_HEIGHT + WEEK_S + 18, 7 * WEEK_S,
24 * WEEK_S);
weekGrid->SetDb(db, SCHEDULE);
weekGrid->SetFont(DEFAULT_TEXT_FONT, DEFAULT_TEXT_SIZE);
weekViewWindow->add(weekGrid);
}
{
NxBox *o = new NxBox(BUTTON_X,
weekGrid->y() + weekGrid->h() + 5,
(weekGrid->x() + weekGrid->w() - GRID_W) -
BUTTON_X - 1,
2 * GRID_W);
o->box(FL_BORDER_BOX);
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
//NxApp::Instance()->def_font((Fl_Widget*)o);
weekViewWindow->add((Fl_Widget *) o);
weekGrid->SetOutputBox(o);
}
{
GridButton *o = upGridButton =
new GridButton(weekGrid->x() + weekGrid->w() - GRID_W,
weekGrid->y() + weekGrid->h() + 5, GRID_W, GRID_W,
"@UpArrow");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->SetGrid(weekGrid);
o->callback(weekGridDownButton_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
{
GridButton *o = downGridButton =
new GridButton(weekGrid->x() + weekGrid->w() - GRID_W,
weekGrid->y() + weekGrid->h() + 5 + GRID_W, GRID_W,
GRID_W, "@DownArrow");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->SetGrid(weekGrid);
o->callback(weekGridUpButton_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
/***
{
NxButton* o = new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH - 5, BUTTON_HEIGHT, "Back");
o->callback(backButton_callback, this);
weekViewWindow->add((Fl_Widget*)o);
}
****/
{
NxButton *o =
new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH - 5, BUTTON_HEIGHT,
"Goto");
o->movable(false);
o->callback(weekGoto_callback, this);
NxApp::Instance()->def_font((Fl_Widget *) o);
weekViewWindow->add((Fl_Widget *) o);
}
{
w_pCalendar =
new NxWeekCalendar((NxApp *) this, 0, 32, W_W, BUTTON_Y - 38, "");
DPRINT("Made weekview calendar [%p]\n", w_pCalendar);
w_pCalendar->
CalendarUpdate((void (*)(NxCalendar *)) calendar_updated);
weekViewWindow->add(w_pCalendar);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 180, BUTTON_Y, 10, BUTTON_HEIGHT,
type_daily);
o->movable(false);
o->callback(dailyView_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 193, BUTTON_Y, 10, BUTTON_HEIGHT,
type_weekly);
o->callback(weeklyView_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 206, BUTTON_Y, 10, BUTTON_HEIGHT,
type_monthly);
o->callback(monthlyView_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 219, BUTTON_Y, 10, BUTTON_HEIGHT,
type_yearly);
o->callback(yearlyView_callback, this);
weekViewWindow->add((Fl_Widget *) o);
}
weekViewWindow->GetWindowPtr()->end();
UpdateWeekViewButtons();
}
void
NxSchedule::weekDatePicked_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->weekDateWindow->GetWindowPtr()->hide();
pThis->show_window(weekViewWindow->GetWindowPtr());
if (pCalendar->GetPickedDate()) {
pThis->m_CurrentDay = pCalendar->GetPickedDate();
pThis->pCalendar->SetPickedDate(pThis->m_CurrentDay);
pThis->UpdateDateDisplay();
}
}
void
NxSchedule::weekGoto_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->set_date_picker((NxCalendar *) w_pCalendar);
pCalendar->SetPickedDate(pThis->m_CurrentDay);
NxApp::Instance()->show_window(weekDateWindow->GetWindowPtr(),
DEACTIVATE,
weekViewWindow->GetWindowPtr());
pCalendar->DateCallback(weekDatePicked_callback);
}
void
NxSchedule::backButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
if (!dayWindow->GetWindowPtr()->shown()) {
// dayWindow->add((Fl_Widget*)buttonGroup);
pThis->show_window(dayWindow->GetWindowPtr());
}
}
void
NxSchedule::weekGridUpButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
int count = pThis->weekGrid->UpCount();
if (0 != count) {
pThis->weekGrid->hide();
pThis->weekGrid->show();
}
}
void
NxSchedule::weekGridDownButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
int count = pThis->weekGrid->DownCount();
if (0 != count) {
pThis->weekGrid->hide();
pThis->weekGrid->show();
}
}
void
NxSchedule::UpdateWeekViewButtons()
{
tm *tt = localtime(&m_CurrentDay);
static char buf[7][8];
time_t new_time;
int wday = tt->tm_wday;
char *_d[] = { "S", "M", "T", "W", "T", "F", "S" };
DPRINT("Update Week View Buttons\n");
for (int i = 7; i > 0; i--) {
for (int idx = 6; idx >= 0; idx--) {
tt = localtime(&m_CurrentDay);
tt->tm_mday = tt->tm_mday + (idx - wday);
new_time = mktime(tt);
tt = localtime(&new_time);
if (0 == tt->tm_wday) {
DPRINT("SETTING sunday date\n");
weekGrid->SetDateSunday(new_time);
}
if (tt->tm_wday != (7 - i))
continue;
else {
sprintf(buf[7 - i], "%s\n%d", _d[7 - i], tt->tm_mday);
break;
}
}
weekViewDayButtons[7 - i]->label(buf[7 - i]);
weekViewDayButtons[7 - i]->redraw();
}
}
void
NxSchedule::weekViewButtons_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
int nDOW = -1;
for (int idx = 0; idx < 7; idx++) {
if (pThis->weekViewDayButtons[idx] == w) {
nDOW = idx;
break;
}
}
if (nDOW == -1)
return;
tm *tt = localtime(&pThis->m_CurrentDay);
// Calcuate the new current day; subtract the old
// "current day" doay of the week from the new day of week.
// and Bob's your uncle
pThis->m_CurrentDay += (86400 * (nDOW - tt->tm_wday));
pThis->UpdateDateDisplay();
// pThis->dayWindow->add((Fl_Widget*)buttonGroup);
pThis->show_window(dayWindow->GetWindowPtr());
}
--- NEW FILE: Makefile ---
# apps/schedule/Makefile
TARGET_CXX=schedule
SRC=${shell ls *.cxx}
OBJS=${SRC:.cxx=.o}
CFLAGS ?=
CFLAGS += -DPIXIL
LIBS=-lpixil-pim
ifeq ($(CONFIG_PAR),y)
LIBS+=-lpar
endif
ifeq ($(CONFIG_SYNC),y)
LIBS+=-lpixil-sync
endif
LIBS+=-lfltk -lflek
ifeq ($(CONFIG_NANOX),y)
LIBS+=-lnano-X
endif
ifeq ($(CONFIG_X11),y)
LIBS+=-lX11
endif
ifeq ($(CONFIG_COLOSSEUM),y)
LIBS+=-lipc
endif
include $(BASE_DIR)/Rules.make
--- NEW FILE: misclist.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <stdio.h>
#include <string.h>
#include "misclist.h"
static void
select_callback(Fl_Widget * fl, long l)
{
NxMiscList *list = (NxMiscList *) fl;
strcpy(list->m_CatBuf, list->text());
list->label(list->m_CatBuf);
list->hide();
list->show();
if (list->m_Cb)
(*list->m_Cb) (list, (void *) list->m_CatBuf);
}
NxMiscList::NxMiscList(int x, int y, int w, int h):
Fl_Menu_Button(x, y, w, h, "")
{
add("Work|Home|Fax|Other|E-Mail|Main|Pager|Mobile");
callback(select_callback);
select(0);
}
int
NxMiscList::value()
{
return Fl_Menu_Button::value();
}
void
NxMiscList::value(int n)
{
Fl_Menu_Button::value(n);
int l = strlen(text(n));
strncpy(m_CatBuf, text(n), l);
label(m_CatBuf);
hide();
show();
}
--- NEW FILE: nxyearcal.h ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#ifndef _NX_YEAR_CAL_H_
#define _NX_YEAR_CAL_H_
#include <FL/Fl_Widget.H>
#include <time.h>
#include <nxbutton.h>
#include <nxbox.h>
#include <nxdb.h>
class NxYearCal:public Fl_Group
{
int appts[366];
NxDb *db;
char db_name[255];
int draw_day_box;
int release_box;
void draw();
int handle(int);
int cur_year;
int x_space;
int y_space;
int day_w;
int day_h;
int Month(int, int);
int MonDay(int, int);
void DrawDateBox(int, int);
void (*pMonthCallback) (Fl_Widget *, void *);
void (*pDayCallback) (Fl_Widget *, void *);
void maybe_do_callback();
void check_appts();
public:
NxYearCal(time_t time, int X, int Y, int W, int H, const char *L = 0);
~NxYearCal();
NxBox *year_Box;
void ChangeYear(int year);
static const char *month_name[];
void SetMonthCallback(void (*)(Fl_Widget *, void *));
void SetDayCallback(void (*)(Fl_Widget *, void *));
void SetDb(NxDb * pDb, char *name)
{
db = pDb;
strcpy(db_name, name);
}
virtual void resize(int X, int Y, int W, int H);
static void backYear_callback(Fl_Widget *, void *);
static void forwYear_callback(Fl_Widget *, void *);
};
#endif
--- NEW FILE: nxmonwin.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "nxschedule.h"
extern Fl_Menu_Item schedMenuItems[];
void
NxSchedule::MakeMonthWindow()
{
monthWindow = new NxPimWindow(APP_NAME, schedMenuItems, 0, "",
SCHEDULE, (void (*)(const char *)) 0);
add_window((Fl_Window *) monthWindow->GetWindowPtr());
{
Fl_Button *o =
new Fl_Button(W_W - 10 - (4 * DAY_S), 9, DAY_S, DAY_S, "@<<");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->box(FL_FLAT_BOX);
o->labeltype(FL_SYMBOL_LABEL);
o->callback(bak_year_callback, this);
monthWindow->add((Fl_Widget *) o);
o = new Fl_Button(W_W - 10 - (3 * DAY_S), 9, DAY_S, DAY_S, "@<");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->box(FL_FLAT_BOX);
o->labeltype(FL_SYMBOL_LABEL);
o->callback(bak_month_callback, this);
monthWindow->add((Fl_Widget *) o);
o = new Fl_Button(W_W - 10 - (2 * DAY_S), 9, DAY_S, DAY_S, "@>");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->box(FL_FLAT_BOX);
o->labeltype(FL_SYMBOL_LABEL);
o->callback(adv_month_callback, this);
monthWindow->add((Fl_Widget *) o);
o = new Fl_Button(W_W - 10 - (DAY_S), 9, DAY_S, DAY_S, "@>>");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->box(FL_FLAT_BOX);
o->labeltype(FL_SYMBOL_LABEL);
o->callback(adv_year_callback, this);
monthWindow->add((Fl_Widget *) o);
}
{
m_pCalendar =
new NxCalendar((NxApp *) this, 0, 32, W_W, BUTTON_Y - 38, "");
m_pCalendar->
CalendarUpdate((void (*)(NxCalendar *)) calendar_updated);
monthWindow->add((Fl_Widget *) m_pCalendar);
}
{
Fl_Button *o =
new Fl_Button(BUTTON_X, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,
"GoTo");
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
o->box(FL_SHADOW_BOX);
// o->callback(doneView_callback);
monthWindow->add((Fl_Widget *) o);
}
monthWindow->GetWindowPtr()->end();
}
void
NxSchedule::bak_year_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_pCalendar->GetDatePickerCalendar()->previous_year();
}
void
NxSchedule::bak_month_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_pCalendar->GetDatePickerCalendar()->previous_month();
}
void
NxSchedule::adv_year_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_pCalendar->GetDatePickerCalendar()->next_year();
}
void
NxSchedule::adv_month_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_pCalendar->GetDatePickerCalendar()->next_month();
}
void
NxSchedule::calendar_updated(NxCalendar * w)
{
static char buf[30];
sprintf(buf, "%s %d",
w->GetDatePickerCalendar()->month_name[w->
GetDatePickerCalendar()->
month() - 1],
w->GetDatePickerCalendar()->year());
monthWindow->menu_button->label(buf);
}
--- NEW FILE: nxrepeatevent.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include "nxschedule.h"
void
NxSchedule::MakeRepeatEventWindow()
{
repeatEventWindow =
new NxPimPopWindow("Repeating Event",
NxApp::Instance()->getGlobalColor(APP_FG), 5, 30,
W_W - 10, 180);
add_window((Fl_Window *) repeatEventWindow->GetWindowPtr());
{
NxBox *o = new NxBox(20, 5, W_W - 40, 90,
"Apply the changes to:\n-the Current record,\n-this & all Future records,\n-All occurences?");
o->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
repeatEventWindow->add(o);
}
{
NxButton *o = new NxButton(POP_BUTTON_X,
POP_BUTTON_Y(repeatEventWindow) -
(2 * BUTTON_HEIGHT) - 10,
BUTTON_WIDTH, BUTTON_HEIGHT, "Current");
o->callback(changeCurrent_callback, this);
repeatEventWindow->add(o);
}
{
NxButton *o = new NxButton(POP_BUTTON_X,
POP_BUTTON_Y(repeatEventWindow) -
BUTTON_HEIGHT - 5,
BUTTON_WIDTH, BUTTON_HEIGHT, "Future");
o->callback(changeFuture_callback, this);
repeatEventWindow->add(o);
}
{
NxButton *o =
new NxButton(POP_BUTTON_X, POP_BUTTON_Y(repeatEventWindow),
BUTTON_WIDTH,
BUTTON_HEIGHT, "All");
o->callback(changeAll_callback, this);
repeatEventWindow->add(o);
}
{
NxButton *o =
new NxButton(repeatEventWindow->GetWindowPtr()->w() -
POP_BUTTON_X - BUTTON_WIDTH,
POP_BUTTON_Y(repeatEventWindow), BUTTON_WIDTH,
BUTTON_HEIGHT, "Cancel");
o->callback(changeCancel_callback, this);
repeatEventWindow->add(o);
}
repeatEventWindow->GetWindowPtr()->end();
}
void
NxSchedule::changeCurrent_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
tm *date;
int year;
int mon;
int m_day;
time_t picked_date = pThis->pCalendar->GetPickedDate();
time_t today_date = pThis->m_CurrentDay;
time_t start_time;
time_t end_time;
if (0 == picked_date)
picked_date = pThis->m_CurrentDay;
// set year and day
date = localtime(&today_date);
year = date->tm_year;
mon = date->tm_mon;
m_day = date->tm_mday;
// set the min and sec for the startTime
date = localtime(&(pThis->m_pCurrentItem->startTime));
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
start_time = mktime(date);
// set the min and sec fot the endTime
date = localtime(&(pThis->m_pCurrentItem->endTime));
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
end_time = mktime(date);
pThis->m_pCurrentItem->exception = (REPEAT_EXCEPTION | REPEAT_DELETED);
pThis->m_pCurrentItem->recnoPtr = pThis->m_pCurrentItem->recno;
pThis->m_pCurrentItem->startTime = start_time;
pThis->m_pCurrentItem->endTime = end_time;
pThis->m_pCurrentItem->repeatFlag_1 = REPEAT_NONE;
pThis->write_note(pThis->m_pCurrentItem);
if (!(DELETE_FLAG & g_EditFlag)) {
date = localtime(&picked_date);
year = date->tm_year;
mon = date->tm_mon;
m_day = date->tm_mday;
// set the min and sec for the startTime
date = localtime(&(pThis->m_pCurrentItem->startTime));
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
start_time = mktime(date);
// set the min and sec fot the endTime
date = localtime(&(pThis->m_pCurrentItem->endTime));
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
end_time = mktime(date);
pThis->m_pCurrentItem->startTime = start_time;
pThis->m_pCurrentItem->endTime = end_time;
pThis->m_pCurrentItem->exception = 0;
pThis->m_pCurrentItem->recnoPtr = 0;
pThis->write_note(pThis->m_pCurrentItem);
}
pThis->show_window(dayWindow->GetWindowPtr());
pThis->UpdateDateDisplay();
g_EditFlag = 0;
pThis->pCalendar->SetPickedDate(0);
}
void
NxSchedule::changeFuture_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
int this_rec[1];
int rec_array[255];
char c_recno[8];
NxTodo *n;
int idx = 0;
time_t picked_date = pThis->pCalendar->GetPickedDate();
time_t old_start = pThis->m_pCurrentItem->startTime;
time_t old_end = pThis->m_pCurrentItem->endTime;
time_t today_time = pThis->m_CurrentDay;
time_t end_on = 0;
time_t new_time = 0;
unsigned long days = 0;
double diff = 0;
tm *tt;
int year = 0;
int mon = 0;
int m_day = 0;
this_rec[0] = -1;
//delete dummy record that have start time bigger than this day
for (idx = 0; idx < 255; idx++)
rec_array[idx] = -1;
pThis->db->Select(SCHEDULE, c_recno, 12, rec_array, 255);
for (idx = 0; idx < 255; idx++) {
if (-1 != rec_array[idx]) {
NxTodo *note = new NxTodo;
pThis->ExtractRecord(note, rec_array[idx]);
if (note->startTime > pThis->m_CurrentDay) {
delete_note(note);
}
delete note;
}
}
n = new NxTodo;
end_on = pThis->m_pCurrentItem->repeatFlag_3;
pThis->m_pCurrentItem->repeatFlag_3 = pThis->m_CurrentDay;
sprintf(c_recno, "%d", pThis->m_pCurrentItem->recno);
pThis->db->Select(SCHEDULE, c_recno, 0, this_rec, 1);
// put an end date on the orig record
if (-1 != this_rec[0]) {
pThis->ExtractRecord(n, this_rec[0]);
pThis->m_pCurrentItem->startTime = n->startTime;
pThis->m_pCurrentItem->endTime = n->endTime;
pThis->edit_note(pThis->m_pCurrentItem, this_rec[0]);
}
if (!(DELETE_FLAG & g_EditFlag)) {
pThis->ExtractRecord(n, this_rec[0]);
if (0 != end_on) {
diff = difftime(end_on, n->startTime);
if (0 > diff)
diff = diff * -1;
if (0 == diff)
days = 0;
else
days = (long) (diff / 86400);
tt = localtime(&old_start);
tt->tm_mday += (days + 1);
new_time = mktime(tt);
n->repeatFlag_3 = new_time;
} else
n->repeatFlag_3 = 0;
if (CHANGED_DATE_FLAG & g_EditFlag) {
// need to set the new date
tt = localtime(&picked_date);
year = tt->tm_year;
mon = tt->tm_mon;
m_day = tt->tm_mday;
tt = localtime(&old_start);
tt->tm_year = year;
tt->tm_mon = mon;
tt->tm_mday = m_day;
old_start = mktime(tt);
today_time = old_start;
tt = localtime(&old_end);
tt->tm_year = year;
tt->tm_mon = mon;
tt->tm_mday = m_day;
old_end = mktime(tt);
}
if (CHANGED_TIME_FLAG & g_EditFlag) {
// do this becasue start_time may have new date
// so set the new min and hour
tt = localtime(&today_time);
year = tt->tm_year;
mon = tt->tm_mon;
m_day = tt->tm_mday + 1;
tt = localtime(&old_start);
tt->tm_year = year;
tt->tm_mon = mon;
tt->tm_mday = m_day;
old_start = mktime(tt);
tt = localtime(&old_end);
tt->tm_year = year;
tt->tm_mon = mon;
tt->tm_mday = m_day;
old_end = mktime(tt);
}
if (CHANGED_ALARM & g_EditFlag) {
// set the new alarm int and flags
n->alarmInt = pThis->m_pCurrentItem->alarmInt;
n->alarmFlags = pThis->m_pCurrentItem->alarmFlags;
}
n->startTime = old_start;
n->endTime = old_end;
pThis->write_note(n);
}
delete n;
pThis->show_window(dayWindow->GetWindowPtr());
pThis->UpdateDateDisplay();
pThis->pCalendar->SetPickedDate(0);
g_EditFlag = 0;
}
void
NxSchedule::changeAll_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
tm *date;
time_t picked_date = pThis->pCalendar->GetPickedDate();
time_t start_time = pThis->m_pCurrentItem->startTime;
time_t end_time = pThis->m_pCurrentItem->endTime;
if (0 == picked_date)
picked_date = pThis->m_CurrentDay;
if (DELETE_FLAG & g_EditFlag) {
pThis->repeatEventWindow->GetWindowPtr()->hide();
pThis->show_window(deleteWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
} else { // either CHANGED_DATE_FLAG or CHANGED_TIME_FLAG or CHANGED_ALARM was set
int this_rec[1];
int rec_array[255];
int idx = 0;
char c_recno[8];
int year = 0;
int mon = 0;
int m_day = 0;
time_t end_on = 0;
double diff = 0;
long days = 0;
time_t new_date;
tm *tt;
for (idx = 0; idx < 255; idx++)
rec_array[idx] = -1;
sprintf(c_recno, "%d", pThis->m_pCurrentItem->recno);
if (CHANGED_DATE_FLAG & g_EditFlag) {
// remove all dummy entries for this record
pThis->db->Select(SCHEDULE, c_recno, 12, rec_array, 255);
for (idx = 0; idx < 255; idx++) {
if (-1 != rec_array[idx]) {
pThis->db->DeleteRec(SCHEDULE, rec_array[idx]);
}
}
// reset the year and day for the start and end time
date = localtime(&picked_date);
year = date->tm_year;
mon = date->tm_mon;
m_day = date->tm_mday;
// preserve the hour and min for the startTime
date = localtime(&(pThis->m_pCurrentItem->startTime));
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
start_time = mktime(date);
// preserve the hour and min for the endTime
date = localtime(&(pThis->m_pCurrentItem->endTime));
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
end_time = mktime(date);
end_on = pThis->m_pCurrentItem->repeatFlag_3;
if (0 != end_on) {
NxTodo *n = new NxTodo;
this_rec[0] = -1;
pThis->db->Select(SCHEDULE, c_recno, 0, this_rec, 1);
if (-1 != this_rec[0]) {
pThis->ExtractRecord(n, this_rec[0]);
}
diff = difftime(end_on, n->startTime);
if (0 > diff)
diff = diff * -1;
if (0 == diff) {
days = 0;
} else {
days = (long) (diff / 86400);
}
tt = localtime(&start_time);
tt->tm_mday += (days + 1);
new_date = mktime(tt);
pThis->m_pCurrentItem->repeatFlag_3 = new_date;
delete n;
}
}
if (CHANGED_TIME_FLAG & g_EditFlag) {
// need to change all dummy entries for this record
pThis->db->Select(SCHEDULE, c_recno, 12, rec_array, 255);
for (idx = 0; idx < 255; idx++) {
// this should only be done when time changed only.
// if date was changed these record should have been deleted
if (-1 != rec_array[idx]) {
NxTodo *n = new NxTodo;
pThis->ExtractRecord(n, rec_array[idx]);
date = localtime(&n->startTime);
year = date->tm_year;
mon = date->tm_mon;
m_day = date->tm_mday;
date = localtime(&pThis->m_pCurrentItem->startTime);
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
n->startTime = mktime(date);
date = localtime(&pThis->m_pCurrentItem->endTime);
date->tm_year = year;
date->tm_mon = mon;
date->tm_mday = m_day;
n->endTime = mktime(date);
pThis->edit_note(n, rec_array[idx]);
delete n;
}
}
}
pThis->m_pCurrentItem->endTime = end_time;
pThis->m_pCurrentItem->startTime = start_time;
this_rec[0] = -1;
pThis->db->Select(SCHEDULE, c_recno, 0, this_rec, 1);
if (-1 != this_rec[0]) {
pThis->edit_note(pThis->m_pCurrentItem, this_rec[0]);
}
pThis->show_window(dayWindow->GetWindowPtr());
pThis->UpdateDateDisplay();
}
pThis->pCalendar->SetPickedDate(0);
g_EditFlag = 0;
}
void
NxSchedule::changeCancel_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->show_window(dayWindow->GetWindowPtr());
pThis->UpdateDateDisplay();
pThis->pCalendar->SetPickedDate(0);
g_EditFlag = 0;
}
--- NEW FILE: misclist.h ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#ifndef __MISC_H
#define __MISC_H
#include <FL/Fl.H>
#include <FL/Fl_Menu_Button.H>
class NxMiscList:public Fl_Menu_Button
{
public:
Fl_Callback * m_Cb;
char m_CatBuf[200];
NxMiscList(int x, int y, int w, int h);
void select(Fl_Callback * c)
{
m_Cb = c;
}
int value();
void value(int n);
};
#endif
--- NEW FILE: nxsc.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "nxschedule.h"
#ifdef SYMBOL_MIPS
#include <signal.h>
void
h_sigusr(int signo)
{
Fl_Window *win = ((NxSchedule *) NxApp::Instance())->get_shown_window();
GR_WINDOW_ID wid;
GR_WINDOW_INFO info;
// Get the parent window
while (win->parent() != NULL)
win = (Fl_Window *) win->parent();
// Raise this window's parent
wid = fl_xid(win);
GrGetWindowInfo(wid, &info);
GrMapWindow(info.parent);
GrRaiseWindow(info.parent);
} // end of h_sigusr()
#endif // SYMBOL_MIPS
int exit_flag = 0;
int
main(int argc, char *argv[])
{
NxSchedule sc(argc, argv);
#ifdef SYMBOL_MIPS
signal(SIGUSR1, h_sigusr);
#endif // SYMBOL_MIPS
while (!exit_flag) {
if (Fl::wait() == 0) {
if (!sc.noguisearch_flag) {
break;
}
}
}
return 0;
}
--- NEW FILE: nxyearcal.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <FL/fl_draw.H>
#include <FL/Fl.H>
#include <nxapp.h>
#include <stdio.h>
#include "nxyearcal.h"
#include "nxschedule.h"
#ifdef DEBUG
#define DPRINT(str, args...) printf("DEBUG NxYearCall: " str, ## args)
#else
#define DPRINT(args...)
#endif
const char *
NxYearCal::month_name[] = {
"January",
"Febuary",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
NxYearCal::NxYearCal(time_t time, int X, int Y, int W, int H, const char *L)
:
Fl_Group(X, Y, W, H, L)
{
tm *tt;
tt = localtime(&time);
cur_year = tt->tm_year;
x_space = w() / 3;
y_space = h() / 4;
day_w = x_space / 7;
day_h = y_space / 7;
draw_day_box = 0;
release_box = 0;
DPRINT("day_w [%d] day_h [%d]\n", day_w, day_h);
#ifdef NOT_USED // seperated out of widget
static char year_buf[6];
backYear_Button = new NxButton(w() / 2 - 15, BUTTON_Y, 15, 15, "@<");
backYear_Button->labeltype(FL_SYMBOL_LABEL);
backYear_Button->box(FL_FLAT_BOX);
backYear_Button->callback(backYear_callback, this);
add(backYear_Button);
forwYear_Button = new NxButton(w() / 2, BUTTON_Y, 15, 15, "@>");
forwYear_Button->labeltype(FL_SYMBOL_LABEL);
forwYear_Button->box(FL_FLAT_BOX);
forwYear_Button->callback(forwYear_callback, this);
add(forwYear_Button);
strftime(year_buf, 5, "%Y", tt);
year_Box = new NxBox(w() / 2 - 55, BUTTON_Y - 1, 50, 20, year_buf);
add(year_Box);
#endif
}
void
NxYearCal::resize(int X, int Y, int W, int H)
{
x(X);
y(Y);
w(W);
h(H);
x_space = w() / 3;
y_space = (BUTTON_Y - 1) / 4;
day_w = x_space / 7;
day_h = y_space / 7;
}
void
NxYearCal::ChangeYear(int year)
{
cur_year = year;
}
int
NxYearCal::Month(int X, int Y)
{
int row;
int col;
int month;
X -= x();
Y -= y();
if (Y > y_space * 4) {
DPRINT("Outsid of year grid\n");
return -1;
}
col = X / x_space;
row = Y / y_space;
month = 3 * row + col;
DPRINT("month [%d]\n", month);
return month;
}
int
NxYearCal::MonDay(int X, int Y)
{
int row, col;
int day_x, day_y;
int x_check, y_check;
int month;
int d_col, d_row;
tm tt;
X -= x();
Y -= y();
memset(&tt, 0, sizeof(tt));
col = X / x_space;
row = Y / y_space;
month = 3 * row + col;
day_x = X % x_space;
day_y = Y % y_space;
if (day_y <= day_h) {
return 0;
}
tt.tm_year = cur_year;
tt.tm_mon = month;
tt.tm_mday = 1;
mktime(&tt);
x_check = col * x_space + (tt.tm_wday * day_w);
y_check = row * y_space + day_h;
d_row = 0;
while (month == tt.tm_mon) {
if (((X >= x_check) && (X < x_check + day_w)) &&
((Y >= y_check) && (Y < y_check + day_h))) {
return tt.tm_mday;
}
tt.tm_mday++;
mktime(&tt);
d_col = tt.tm_wday;
if (0 == d_col)
d_row++;
x_check = col * x_space + (tt.tm_wday * day_w);
y_check = row * y_space + day_h + (d_row * day_h);
}
return -1;
}
void
NxYearCal::DrawDateBox(int x, int y)
{
int month;
int day;
char buf[4];
month = Month(x, y);
if (-1 != month) {
day = MonDay(x, y);
DPRINT("day [%d]\n", day);
if (0 < day) {
if (x - 22 < 0)
x = 22;
if (y - 22 < 0)
y = 22;
DPRINT("should be showing day box\n");
sprintf(buf, "%d", day);
fl_color(FL_WHITE);
fl_rectf(x - 20, y - 20, 20, 20);
fl_color(FL_BLACK);
fl_rect(x - 20, y - 20, 20, 20);
fl_rect(x - 1 - 20, y - 1 - 20, 22, 22);
fl_rect(x - 2 - 20, y - 2 - 20, 24, 24);
//fl_font(FL_TIMES, 12);
NxApp::Instance()->def_font();
fl_draw(buf, x - 20, y - 20, 20, 20, FL_ALIGN_CENTER);
}
}
}
void
NxYearCal::check_appts()
{
int idx;
int rec_array[255];
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
NxTodo *note = new NxTodo;
tm t_year;
time_t startDay = 0;
memset(&appts, 0, sizeof(appts));
for (idx = 0; idx < 255; idx++)
rec_array[idx] = -1;
db->Select(db_name, rec_array, 255);
t_year.tm_sec = 0;
t_year.tm_min = 0;
t_year.tm_hour = 0;
t_year.tm_mday = 1;
t_year.tm_mon = 0;
t_year.tm_year = cur_year;
startDay = mktime(&t_year);
for (idx = 0; idx < 255; idx++) {
if (-1 == rec_array[idx])
continue;
pThis->ExtractRecord(note, rec_array[idx]);
for (int jdx = 0; jdx < 366; jdx++) {
if (pThis->IsForToday(note, startDay + (jdx * 86400),
startDay + ((jdx + 1) * 86400) - 1)) {
appts[jdx] = 1;
}
}
/****
date = localtime(¬e->startTime);
if(cur_year == date->tm_year) {
appts[date->tm_yday] = 1;
}
*****/
}
note = NULL;
delete note;
}
void
NxYearCal::draw()
{
int row, col;
int d_row, d_col;
int x_day, y_day;
int idx;
int month;
tm tt;
time_t today;
tm *t_today;
char buf[4];
static int old_x = -100;
static int old_y = -100;
static char year_buf[6];
int day = 0;
check_appts();
memset(&tt, 0, sizeof(tt));
tt.tm_year = cur_year;
tt.tm_mday = 1;
mktime(&tt);
strftime(year_buf, 5, "%Y", &tt);
year_Box->label(year_buf);
year_Box->redraw();
if ((-100 != old_x && -100 != old_y && draw_day_box)
|| (1 == release_box)) {
if (old_x - 22 < 0)
old_x = 22;
if (old_y - 22 < 0)
old_y = 22;
fl_clip(old_x - 22, old_y - 22, 24, 24);
}
fl_color(FL_WHITE);
fl_rectf(x(), y(), 3 * x_space, 4 * y_space);
today = time(0);
t_today = localtime(&today);
day = 0;
for (month = 0; month <= 11; month++) {
row = month / 3;
col = month - (3 * row);
fl_color(NxApp::Instance()->getGlobalColor(BUTTON_FACE));
fl_rectf(col * x_space + x(), row * y_space + 1 + y(), x_space,
day_h + 1);
fl_color(NxApp::Instance()->getGlobalColor(BUTTON_TEXT));
//fl_font(FL_TIMES, day_h - 2);
NxApp::Instance()->def_font();
fl_draw(month_name[month], col * x_space + 7 + x(),
row * y_space + 2 + y(), y_space, day_h - 2, FL_ALIGN_CENTER);
tt.tm_mon = month;
tt.tm_mday = 1;
mktime(&tt);
x_day = col * x_space + (tt.tm_wday * day_w) + 2 + x();
y_day = row * y_space + day_h + 2 + y();
fl_color(NxApp::Instance()->getGlobalColor(APP_FG));
d_row = 0;
NxApp::Instance()->def_small_font();
while (month == tt.tm_mon) {
//DPRINT("day [%d]\n", day);
sprintf(buf, "%d", tt.tm_mday);
if (tt.tm_year == t_today->tm_year
&& tt.tm_yday == t_today->tm_yday) {
Fl_Color old_col = fl_color();
fl_color(NxApp::Instance()->getGlobalColor(HILIGHT));
fl_rectf(x_day, y_day, day_w, day_h + 1);
fl_color(NxApp::Instance()->getGlobalColor(HILIGHT_TEXT));
fl_draw(buf, x_day, y_day, day_w, day_h, FL_ALIGN_CENTER);
fl_color(old_col);
} else
fl_draw(buf, x_day, y_day, day_w, day_h, FL_ALIGN_CENTER);
if (1 == appts[day]) {
Fl_Color old_col = fl_color();
fl_rect(x_day, y_day, day_w, day_h + 1);
fl_color(NxApp::Instance()->getGlobalColor(APP_FG));
if (tt.tm_year != t_today->tm_year
&& tt.tm_yday != t_today->tm_yday)
fl_draw(buf, x_day, y_day, day_w, day_h, FL_ALIGN_CENTER);
fl_color(old_col);
}
tt.tm_mday++;
mktime(&tt);
d_col = tt.tm_wday;
if (0 == d_col)
d_row++;
x_day = col * x_space + (tt.tm_wday * day_w) + 2 + x();
y_day = row * y_space + day_h + 2 + (d_row * day_h) + y();
day++;
}
}
fl_color(FL_BLACK);
for (idx = 1; idx <= 2; idx++)
fl_line(x() + (idx * x_space), y(), x() + (idx * x_space),
y() + (4 * y_space) + 1);
for (idx = 0; idx <= 3; idx++)
fl_line(x(), y() + (idx * y_space), x() + (3 * x_space) - 1,
y() + (idx * y_space));
fl_line(x(), y() + (4 * y_space) + 1, x() + (3 * x_space) - 1,
y() + (4 * y_space) + 1);
if ((-100 != old_x && -100 != old_y && draw_day_box)
|| (1 == release_box))
fl_pop_clip();
release_box = 0;
if (draw_day_box) {
DrawDateBox(Fl::event_x(), Fl::event_y());
}
old_x = Fl::event_x();
old_y = Fl::event_y();
Fl_Group::draw();
}
int
NxYearCal::handle(int event)
{
switch (event) {
case FL_PUSH:
if (Fl::event_inside((Fl_Widget *) this)) {
if (Fl::event_y() <= y() + (4 * y_space)) {
draw_day_box = 1;
redraw();
}
Fl_Group::handle(event);
}
return 1;
case FL_RELEASE:
draw_day_box = 0;
release_box = 1;
maybe_do_callback();
redraw();
Fl_Group::handle(event);
return 1;
case FL_DRAG:
if (Fl::event_inside((Fl_Widget *) this)) {
draw_day_box = 1;
release_box = 0;
redraw();
}
Fl_Group::handle(event);
return 1;
default:
return 0;
}
Fl_Group::handle(event);
}
NxYearCal::~NxYearCal()
{
}
void
NxYearCal::maybe_do_callback()
{
int month;
int day;
time_t time;
tm tt;
memset(&tt, 0, sizeof(tt));
month = Month(Fl::event_x(), Fl::event_y());
if (month >= 0) {
day = MonDay(Fl::event_x(), Fl::event_y());
tt.tm_year = cur_year;
tt.tm_mday = day;
if (day == 0)
tt.tm_mday = 1;
tt.tm_mon = month;
time = mktime(&tt);
if (day == 0) {
if (pMonthCallback)
pMonthCallback(this, &time);
draw_day_box = 0;
release_box = 0;
return;
}
if (day > 0) {
if (pDayCallback)
pDayCallback(this, &time);
draw_day_box = 0;
release_box = 0;
return;
}
}
}
void
NxYearCal::SetMonthCallback(void (*cb) (Fl_Widget *, void *))
{
pMonthCallback = cb;
}
void
NxYearCal::SetDayCallback(void (*cb) (Fl_Widget *, void *))
{
pDayCallback = cb;
}
void
NxYearCal::backYear_callback(Fl_Widget * fl, void *l)
{
NxYearCal *pThis = (NxYearCal *) l;
pThis->cur_year--;
pThis->year_Box->redraw();
pThis->year_Box->hide();
pThis->year_Box->show();
}
void
NxYearCal::forwYear_callback(Fl_Widget * fl, void *l)
{
NxYearCal *pThis = (NxYearCal *) l;
pThis->cur_year++;
pThis->year_Box->redraw();
pThis->year_Box->hide();
pThis->year_Box->show();
}
--- NEW FILE: nxmonthcal.h ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#ifndef _NX_MONCAL_H_
#define _NX_MONCAL_H_
#include <Flek/Fl_Calendar.H>
#include <nxdb.h>
class NxMonthButton;
class NxMonthCalendar:public Fl_Calendar
{
char _db_name[255];
NxDb *_db;
protected:
void (*m_pDateCallback) (Fl_Widget * w, void *l);
time_t m_nDatePicked;
public:
NxMonthCalendar(int x, int y, int w = (7 * 20), int h = (8 * 20),
const char *l = 0, bool bCaption = true, int type =
0, NxDb * db = 0, char *db_name = 0);
virtual void update();
virtual void update_buttons();
void SetPickedDate(time_t t);
time_t GetPickedDate();
void DateCallback(void (*)(Fl_Widget *, void *));
Fl_Callback *GetDateCB()
{
return *m_pDateCallback;
}
};
class NxMonthButton:public Fl_Button
{
int appt[3];
void draw();
public:
NxMonthButton(int X, int Y, int W, int H, const char *L = 0);
void SetAppts(int appt[]);
void GetAppts(int appt[]);
};
#endif
--- NEW FILE: nxgroupbuttons.h ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#ifndef _BUTTON_GROUP_H
#define _BUTTOn_GROUP_H
#include <nxbutton.h>
enum b_type
{
type_daily = 0,
type_weekly,
type_monthly,
type_yearly
};
class GroupButton:public NxButton
{
int type;
int save_x, save_w, save_h;
protected:
void draw();
public:
GroupButton(int X, int Y, int W, int H, int T);
};
#endif
--- NEW FILE: nxgroupbuttons.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <stdio.h>
#include <FL/fl_draw.H>
#include "nxgroupbuttons.h"
#include <nxapp.h>
GroupButton::GroupButton(int X, int Y, int W, int H, int T)
:
NxButton(X, Y, W, H)
{
type = T;
save_x = X;
save_w = W;
save_h = H;
}
void
GroupButton::draw()
{
NxButton::draw();
#ifdef PDA
if (value()) {
fl_color(NxApp::Instance()->getGlobalColor(BUTTON_FACE));
} else {
fl_color(NxApp::Instance()->getGlobalColor(BUTTON_TEXT));
}
switch (type) {
case type_daily:
fl_rectf(x() + w() / 2 - 2, y() + h() / 2 - 1, 4, 4);
break;
case type_weekly:
fl_rectf(x() + w() / 2 - 4, y() + h() / 2, 3, 3);
fl_rectf(x() + w() / 2 + 1, y() + h() / 2, 3, 3);
break;
case type_monthly:
W = 1;
H = 4;
Y = y() + 4;
for (idx = 0, X = x() + 1; idx <= 3; idx++, X += 2) {
fl_rectf(X, Y, W, H);
}
Y = y() + 9;
for (idx = 0, X = x() + 1; idx <= 3; idx++, X += 2) {
fl_rectf(X, Y, W, H);
}
break;
case type_yearly:
W = 1;
H = 2;
for (jdx = 1, Y = y() + 2; jdx <= 4; jdx++, Y += (H + 1)) {
for (idx = 0, X = x() + 1; idx <= 3; idx++, X += 2)
fl_rectf(X, Y, W, H);
}
break;
default:
break;
}
#else
fl_color(FL_BLACK);
switch (type) {
case type_daily:
fl_rectf(x() + w() / 2 - 2, y() + h() / 2 - 1, 4, 4);
break;
case type_weekly:
fl_rectf(x() + w() / 2 - 4, y() + h() / 2 - 1, 3, 3);
fl_rectf(x() + w() / 2 + 1, y() + h() / 2 - 1, 3, 3);
break;
case type_monthly:
int Y;
int W;
int H;
W = 1;
H = 4;
Y = y() + 4;
for (int idx = 0, X = x() + 1; idx <= 3; idx++, X += 2) {
fl_rectf(X, Y, W, H);
}
Y = y() + 9;
for (int idx = 0, X = x() + 1; idx <= 3; idx++, X += 2) {
fl_rectf(X, Y, W, H);
}
break;
case type_yearly:
break;
default:
break;
}
#endif
}
--- NEW FILE: nxrepeat.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <stdio.h>
#include "nxschedule.h"
Fl_Menu_Item repeatMenuItems[] = {
{"No End Date", 0, NxSchedule::noDate_callback}
,
{"Choose Date...", 0, NxSchedule::chooseDate_callback}
,
{0}
};
void
NxSchedule::MakeRepeatWindow()
{
//repeatWindow = new NxPimPopWindow("Change Repeat", DEF_FG, 0, 0, W_W, W_H);
repeatWindow = new NxPimWindow(W_X, W_Y, W_W, W_H);
add_window((Fl_Window *) repeatWindow->GetWindowPtr());
{
NxButton *o = no_repeat =
new NxButton(8, 5, 44, BUTTON_HEIGHT, "None");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->value(1);
o->callback(repeatNoneButton_callback, this);
o->movable(false);
repeatWindow->add(o);
}
{
NxButton *o = day_repeat =
new NxButton(53, 5, 44, BUTTON_HEIGHT, "Day");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->callback(repeatDayButton_callback, this);
o->movable(false);
repeatWindow->add(o);
}
{
NxButton *o = week_repeat =
new NxButton(98, 5, 44, BUTTON_HEIGHT, "Week");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->callback(repeatWeekButton_callback, this);
o->movable(false);
repeatWindow->add(o);
}
{
NxButton *o = month_repeat =
new NxButton(143, 5, 44, BUTTON_HEIGHT, "Month");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->callback(repeatMonthButton_callback, this);
o->movable(false);
repeatWindow->add(o);
}
{
NxButton *o = year_repeat =
new NxButton(188, 5, 44, BUTTON_HEIGHT, "Year");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->callback(repeatYearButton_callback, this);
o->movable(false);
repeatWindow->add(o);
}
{
NxBox *o = repeat_output = new NxBox(BUTTON_X, BUTTON_Y - 70,
W_W - (2 * BUTTON_X), 55);
//NxBox *o = repeat_output = new NxBox(0, 100, W_W, 55);
o->label("No Repeat.");
o->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_TOP);
// o->movable(false);
o->box(FL_BORDER_BOX);
o->color(NxApp::Instance()->getGlobalColor(APP_BG));
repeatWindow->add(o);
}
{
NxIntInput *o = every_input = new NxIntInput(53, 30 + BUTTON_HEIGHT,
30, 25, "Every:");
o->maximum_size(2);
o->align(FL_ALIGN_LEFT);
o->callback(repeatEveryInput_callback, this);
o->when(FL_WHEN_CHANGED);
repeatWindow->add(o);
o->hide();
}
{
NxBox *o = every_box = new NxBox(85, 33 + BUTTON_HEIGHT,
50, 25, "Day(s)");
repeatWindow->add(o);
o->hide();
}
{
NxBox *o = list_box =
new NxBox(28, 75 + BUTTON_HEIGHT, 20, BUTTON_HEIGHT);
o->label("End on:");
repeatWindow->add(o);
o->hide();
}
{
NxMenuButton *o = end_list = new NxMenuButton(63, 76 + BUTTON_HEIGHT,
100, BUTTON_HEIGHT);
o->label("No End Date");
o->movable(true);
o->menu(repeatMenuItems);
repeatWindow->add(o);
o->hide();
}
{
NxBox *o = week_box =
new NxBox(22, 108 + BUTTON_HEIGHT, 50, BUTTON_HEIGHT);
o->label("Repeat on:");
repeatWindow->add(o);
o->hide();
}
{
char *_d[] = { "S", "M", "T", "W", "T", "F", "S" };
for (int idx = 0; idx < 7; idx++) {
NxButton *o = new NxButton(BUTTON_X + ((idx + 1) * DAY_S),
135 + BUTTON_HEIGHT,
DAY_S, DAY_S, _d[idx]);
m_WeekButtons[idx] = o;
o->box(FL_FLAT_BOX);
o->callback(weekDay_callback, this);
o->align(FL_ALIGN_CENTER);
o->type(FL_TOGGLE_BUTTON);
o->hide();
repeatWindow->add(o);
}
}
{
NxBox *o = month_box =
new NxBox(22, 125 + BUTTON_HEIGHT, 50, BUTTON_HEIGHT);
o->label("Repeat by:");
repeatWindow->add(o);
o->hide();
}
{
NxButton *o = month_day =
new NxButton(BUTTON_X + 73, 127 + BUTTON_HEIGHT,
44, BUTTON_HEIGHT, "Day");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->callback(monthDayDate_callback, this);
repeatWindow->add(o);
o->hide();
}
{
NxButton *o = month_date =
new NxButton(BUTTON_X + 118, 127 + BUTTON_HEIGHT,
44, BUTTON_HEIGHT, "Date");
o->box(FL_FLAT_BOX);
o->type(FL_TOGGLE_BUTTON);
o->callback(monthDayDate_callback, this);
repeatWindow->add(o);
o->hide();
}
{
NxBox *o = message_output = new NxBox(BUTTON_X, 30 + BUTTON_HEIGHT,
W_W - (2 * BUTTON_X), 55);
o->label("Tap one of the above buttons\n to set repeat interval");
o->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
repeatWindow->add(o);
}
{
NxButton *o =
new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH - 5, BUTTON_HEIGHT,
"Ok");
o->callback(repeatOk_callback, this);
repeatWindow->add(o);
}
{
NxButton *o = new NxButton(BUTTON_X + 56, BUTTON_Y, BUTTON_WIDTH - 5,
BUTTON_HEIGHT, "Cancel");
o->callback(repeatCancel_callback, this);
repeatWindow->add(o);
}
repeatWindow->GetWindowPtr()->end();
}
void
NxSchedule::noDate_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
pThis->end_list->label("No End Date");
pThis->repeatDate = 0;
pThis->end_list->hide();
pThis->end_list->show();
}
void
NxSchedule::repeatDate_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
static char date_buf[30];
tm *tt;
int year;
int mon;
int m_day;
pThis->dateWindow->GetWindowPtr()->hide();
pThis->show_window(repeatWindow->GetWindowPtr());
if (pCalendar->GetPickedDate()) {
tt = localtime(&pThis->m_pCurrentItem->startTime);
year = tt->tm_year;
mon = tt->tm_mon;
m_day = tt->tm_mday;
time_t picked_date = pCalendar->GetPickedDate();
tt = localtime(&picked_date);
if (tt->tm_year < year || tt->tm_mon < mon || tt->tm_mday < m_day) {
pThis->end_list->label("No End Date");
pThis->end_list->hide();
pThis->end_list->show();
pThis->repeatDate = 0;
return;
}
pThis->repeatDate = pCalendar->GetPickedDate();
pThis->m_pCurrentItem->repeatFlag_3 = pThis->repeatDate;
strftime(date_buf, 29, "%a %m/%d/%Y",
localtime(&(pThis->repeatDate)));
pThis->end_list->label(date_buf);
pThis->end_list->hide();
pThis->end_list->show();
}
}
void
NxSchedule::chooseDate_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
pThis->set_date_picker(m_pCalendar);
if (pThis->m_pCurrentItem->repeatFlag_3)
pCalendar->SetPickedDate(pThis->m_pCurrentItem->repeatFlag_3);
else
pCalendar->SetPickedDate(pThis->m_pCurrentItem->startTime);
pThis->show_window(dateWindow->GetWindowPtr(),
DEACTIVATE, repeatWindow->GetWindowPtr());
pCalendar->DateCallback(repeatDate_callback);
}
void
NxSchedule::repeatOk_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_pCurrentItem->repeatFlag_1 = pThis->getRepeatValue();
if (0 == strcmp("", pThis->every_input->value()) ||
(0 == strcmp("1", pThis->every_input->value())) ||
(0 == strcmp("0", pThis->every_input->value())) ||
(0 == strcmp("00", pThis->every_input->value())))
every_input->value("1");
if (pThis->no_repeat->value()) {
pThis->m_pCurrentItem->repeatFlag_2 = 0;
pThis->m_pCurrentItem->repeatFlag_3 = 0;
} else {
pThis->m_pCurrentItem->repeatFlag_2 =
strtol(every_input->value(), NULL, 10);
pThis->m_pCurrentItem->repeatFlag_3 = pThis->repeatDate;
}
if (pThis->week_repeat->value())
pThis->m_pCurrentItem->repeatWkMonFlag = pThis->getWeekValue();
else if (pThis->month_repeat->value())
pThis->m_pCurrentItem->repeatWkMonFlag = pThis->getMonthValue();
else
pThis->m_pCurrentItem->repeatWkMonFlag = 0;
pThis->FillDetailForm(pThis->m_pCurrentItem, DESC_KEEP);
pThis->show_window(dayWindow->GetWindowPtr());
pThis->show_window(detailsWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
}
void
NxSchedule::repeatCancel_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->show_window(dayWindow->GetWindowPtr());
pThis->show_window(detailsWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
}
void
NxSchedule::noRepeat_Ui()
{
list_box->hide();
end_list->hide();
every_input->hide();
every_box->hide();
for (int idx = 0; idx < 7; idx++)
m_WeekButtons[idx]->hide();
week_box->hide();
month_box->hide();
month_day->hide();
month_date->hide();
}
void
NxSchedule::repeatShow_ui()
{
message_output->hide();
every_input->show();
every_box->hide();
every_box->show();
end_list->show();
list_box->show();
for (int idx = 0; idx < 7; idx++)
m_WeekButtons[idx]->hide();
week_box->hide();
month_box->hide();
month_day->hide();
month_date->hide();
}
void
NxSchedule::defaultUi()
{
every_input->value("1");
end_list->label("No End Date");
repeatDate = 0;
}
void
NxSchedule::resetUi(long repeat)
{
static char val[4];
static char date[30];
if (0 >= m_pCurrentItem->repeatFlag_3)
strcpy(date, "No End Date");
else
strftime(date, 29, "%a %m/%d/%Y",
localtime(&(m_pCurrentItem->repeatFlag_3)));
defaultUi();
switch (repeat) {
case REPEAT_DAILY:
if (REPEAT_DAILY == m_pCurrentItem->repeatFlag_1) {
sprintf(val, "%d", m_pCurrentItem->repeatFlag_2);
every_input->value(val);
end_list->label(date);
}
break;
case REPEAT_WEEKLY:
if (REPEAT_WEEKLY == m_pCurrentItem->repeatFlag_1) {
sprintf(val, "%d", m_pCurrentItem->repeatFlag_2);
every_input->value(val);
end_list->label(date);
}
break;
case REPEAT_MONTHLY:
if (REPEAT_MONTHLY == m_pCurrentItem->repeatFlag_1) {
sprintf(val, "%d", m_pCurrentItem->repeatFlag_2);
every_input->value(val);
end_list->label(date);
}
break;
case REPEAT_YEARLY:
if (REPEAT_YEARLY == m_pCurrentItem->repeatFlag_1) {
sprintf(val, "%d", m_pCurrentItem->repeatFlag_2);
every_input->value(val);
end_list->label(date);
}
break;
default:
defaultUi();
break;
}
}
void
NxSchedule::repeatNoneButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->noRepeat_Ui();
pThis->message_output->show();
pThis->repeat_output->label("No Repeat.");
pThis->no_repeat->value(1);
pThis->day_repeat->value(0);
pThis->week_repeat->value(0);
pThis->month_repeat->value(0);
pThis->year_repeat->value(0);
pThis->every_input->do_callback();
pThis->repeatDate = 0;
}
void
NxSchedule::repeatDayButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->resetUi(REPEAT_DAILY);
pThis->every_box->label("Day(s)");
pThis->no_repeat->value(0);
pThis->day_repeat->value(1);
pThis->week_repeat->value(0);
pThis->month_repeat->value(0);
pThis->year_repeat->value(0);
pThis->repeatShow_ui();
pThis->every_input->do_callback();
}
void
NxSchedule::repeatWeekButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->resetUi(REPEAT_WEEKLY);
pThis->every_box->label("Week(s)");
pThis->no_repeat->value(0);
pThis->day_repeat->value(0);
pThis->week_repeat->value(1);
pThis->month_repeat->value(0);
pThis->year_repeat->value(0);
pThis->repeatShow_ui();
pThis->setWeekValue();
for (int idx = 0; idx < 7; idx++)
pThis->m_WeekButtons[idx]->show();
pThis->week_box->show();
pThis->every_input->do_callback();
}
void
NxSchedule::repeatMonthButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->resetUi(REPEAT_MONTHLY);
pThis->every_box->label("Month(s)");
pThis->no_repeat->value(0);
pThis->day_repeat->value(0);
pThis->week_repeat->value(0);
pThis->month_repeat->value(1);
pThis->year_repeat->value(0);
pThis->setMonthValue();
pThis->repeatShow_ui();
pThis->month_day->show();
pThis->month_date->show();
pThis->month_box->show();
pThis->every_input->do_callback();
}
void
NxSchedule::repeatYearButton_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->resetUi(REPEAT_YEARLY);
pThis->every_box->label("Year(s)");
pThis->no_repeat->value(0);
pThis->day_repeat->value(0);
pThis->week_repeat->value(0);
pThis->month_repeat->value(0);
pThis->year_repeat->value(1);
pThis->repeatShow_ui();
pThis->every_input->do_callback();
}
void
NxSchedule::getRepeatData()
{
NxTodo *n = m_pCurrentItem;
static char date_buf[30];
static char repeat_num[4];
memset(date_buf, 0, sizeof(date_buf));
if (0 >= n->repeatFlag_3) {
end_list->label("No End Date");
repeatDate = 0;
every_input->value("1");
} else {
strftime(date_buf, 29, "%a %m/%d/%Y", localtime(&n->repeatFlag_3));
repeatDate = n->repeatFlag_3;
end_list->label(date_buf);
if (n->repeatFlag_2 > 99)
n->repeatFlag_2 = 99;
if (n->repeatFlag_2 < 0)
n->repeatFlag_2 = 0;
sprintf(repeat_num, "%d", n->repeatFlag_2);
every_input->value(repeat_num);
}
switch (n->repeatFlag_1) {
case REPEAT_NONE:
repeatDate = 0;
end_list->label("No End Date");
no_repeat->do_callback();
break;
case REPEAT_DAILY:
day_repeat->do_callback();
break;
case REPEAT_WEEKLY:
week_repeat->do_callback();
break;
case REPEAT_MONTHLY:
month_repeat->do_callback();
break;
case REPEAT_YEARLY:
year_repeat->do_callback();
break;
default:
break;
}
}
void
NxSchedule::setWeekValue()
{
long val = m_pCurrentItem->repeatWkMonFlag;
time_t today = m_pCurrentItem->startTime; //time(0);
tm *tt = localtime(&today);
for (int idx = 0; idx < 7; idx++)
m_WeekButtons[idx]->value(0);
if (0 == val) {
m_WeekButtons[tt->tm_wday]->value(1);
return;
}
if (REPEAT_WEEK_SUNDAY & val)
m_WeekButtons[0]->value(1);
if (REPEAT_WEEK_MONDAY & val)
m_WeekButtons[1]->value(1);
if (REPEAT_WEEK_TUESDAY & val)
m_WeekButtons[2]->value(1);
if (REPEAT_WEEK_WEDNESDAY & val)
m_WeekButtons[3]->value(1);
if (REPEAT_WEEK_THURSDAY & val)
m_WeekButtons[4]->value(1);
if (REPEAT_WEEK_FRIDAY & val)
m_WeekButtons[5]->value(1);
if (REPEAT_WEEK_SATURDAY & val)
m_WeekButtons[6]->value(1);
}
void
NxSchedule::setMonthValue()
{
long val = m_pCurrentItem->repeatWkMonFlag;
if (0 == val) {
month_date->value(1);
month_day->value(0);
return;
}
if (REPEAT_MONTH_DAY & val) {
month_date->value(0);
month_day->value(1);
} else {
month_day->value(0);
month_date->value(1);
}
}
long
NxSchedule::getWeekValue()
{
long val = 0;
for (int idx = 0; idx < 7; idx++) {
if (m_WeekButtons[idx]->value()) {
switch (idx) {
case 0:
val |= REPEAT_WEEK_SUNDAY;
break;
case 1:
val |= REPEAT_WEEK_MONDAY;
break;
case 2:
val |= REPEAT_WEEK_TUESDAY;
break;
case 3:
val |= REPEAT_WEEK_WEDNESDAY;
break;
case 4:
val |= REPEAT_WEEK_THURSDAY;
break;
case 5:
val |= REPEAT_WEEK_FRIDAY;
break;
case 6:
val |= REPEAT_WEEK_SATURDAY;
break;
default:
break;
}
}
}
return val;
}
long
NxSchedule::getMonthValue()
{
if (month_date->value())
return REPEAT_MONTH_DATE;
else
return REPEAT_MONTH_DAY;
}
long
NxSchedule::getRepeatValue()
{
if (no_repeat->value())
return REPEAT_NONE;
else if (day_repeat->value())
return REPEAT_DAILY;
else if (week_repeat->value())
return REPEAT_WEEKLY;
else if (month_repeat->value())
return REPEAT_MONTHLY;
else if (year_repeat->value())
return REPEAT_YEARLY;
else
return REPEAT_NONE;
}
void
NxSchedule::wordValue(int val, char *th_val)
{
char val_buf[8];
int len;
char num_char;
sprintf(val_buf, "%d", val);
len = strlen(val_buf);
if (11 <= val && 13 >= val) {
sprintf(th_val, "%dth", val);
return;
}
num_char = val_buf[len - 1];
switch (num_char) {
case '1':
sprintf(th_val, "%dst", val);
return;
case '2':
sprintf(th_val, "%dnd", val);
return;
case '3':
sprintf(th_val, "%drd", val);
return;
default:
sprintf(th_val, "%dth", val);
return;
}
}
void
NxSchedule::repeatEveryInput_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
long repeat_val = pThis->getRepeatValue();
int sing_flag = 0;
int dbl_flag = 0;
int th_flag = 0;
static char message_buf[100];
char repeat_str[6];
int len = 0;
char val_buf[8];
char num_buf[4];
char num_char;
int num_val = 0;
if (0 == strcmp("", pThis->every_input->value()) ||
(0 == strcmp("1", pThis->every_input->value())) ||
(0 == strcmp("0", pThis->every_input->value())) ||
(0 == strcmp("00", pThis->every_input->value()))) {
sing_flag = 1;
strcpy(repeat_str, "");
}
if (0 == strcmp("2", pThis->every_input->value())) {
dbl_flag = 1;
strcpy(repeat_str, "other");
}
strcpy(val_buf, pThis->every_input->value());
len = strlen(val_buf);
if (len > 1) {
memset(num_buf, 0, sizeof(num_buf));
strcpy(num_buf, val_buf);
num_val = atoi(num_buf);
if (11 <= num_val && 13 >= num_val) {
th_flag = 1;
sprintf(repeat_str, "%dth", num_val);
}
}
if (!sing_flag && !dbl_flag && !th_flag) {
num_char = val_buf[len - 1];
num_val = atoi(pThis->every_input->value());
switch (num_char) {
case '1':
sprintf(repeat_str, "%dst", num_val);
break;
case '2':
sprintf(repeat_str, "%dnd", num_val);
break;
case '3':
sprintf(repeat_str, "%drd", num_val);
break;
default:
sprintf(repeat_str, "%dth", num_val);
break;
}
}
tm *tt;
switch (repeat_val) {
case REPEAT_NONE:
sprintf(message_buf, "No Repeat");
break;
case REPEAT_DAILY:
sprintf(message_buf, "Every %s day", repeat_str);
break;
case REPEAT_WEEKLY:
pThis->formatWeekMsg(message_buf, repeat_str);
break;
case REPEAT_MONTHLY:
pThis->formatMonthMsg(message_buf, repeat_str);
break;
case REPEAT_YEARLY:
tt = localtime(&(pThis->m_CurrentDay));
strftime(message_buf, 99, "%b ", tt);
pThis->wordValue(tt->tm_mday, val_buf);
strcat(message_buf, val_buf);
strcat(message_buf, " Every ");
strcat(message_buf, repeat_str);
strcat(message_buf, " year");
break;
default:
sprintf(message_buf, "Need to handle case %s", repeat_str);
break;
}
pThis->repeat_output->label(message_buf);
// pThis->repeat_output->hide();
// pThis->repeat_output->show();
}
int
NxSchedule::getMonthDayRepeat(time_t date)
{
tm *tt = localtime(&date);
int month = tt->tm_mon;
int count = 0;
while (month == tt->tm_mon) {
count++;
tt->tm_mday = tt->tm_mday - 7;
mktime(tt);
}
return count;
}
void
NxSchedule::formatMonthMsg(char *msg, char *repeat_str)
{
long val = 0;
static char date[30];
char day_val[8];
tm *tt = localtime(&m_CurrentDay);
int week_repeat = 0;
val = getMonthValue();
if (REPEAT_MONTH_DATE & val) {
wordValue(tt->tm_mday, day_val);
sprintf(msg, "The %s of every %s month", day_val, repeat_str);
} else {
strftime(date, 29, "%A", tt);
week_repeat = getMonthDayRepeat(m_CurrentDay);
wordValue(week_repeat, day_val);
sprintf(msg, "The %s %s of every %s month", day_val, date,
repeat_str);
}
}
void
NxSchedule::formatWeekMsg(char *msg, char *repeat_str)
{
int count = 0;
int day_count = 0;
int idx = 0;
long val = 0;
for (idx = 0; idx < 7; idx++) {
if (m_WeekButtons[idx]->value())
count++;
}
if (1 == count) {
val = getWeekValue();
if (REPEAT_WEEK_SUNDAY & val)
sprintf(msg, "Every %s week on Sunday", repeat_str);
if (REPEAT_WEEK_MONDAY & val)
sprintf(msg, "Every %s week on Monday", repeat_str);
if (REPEAT_WEEK_TUESDAY & val)
sprintf(msg, "Every %s week on Tuesday", repeat_str);
if (REPEAT_WEEK_WEDNESDAY & val)
sprintf(msg, "Every %s week on Wednesday", repeat_str);
if (REPEAT_WEEK_THURSDAY & val)
sprintf(msg, "Every %s week on Thursday", repeat_str);
if (REPEAT_WEEK_FRIDAY & val)
sprintf(msg, "Every %s week on Friday", repeat_str);
if (REPEAT_WEEK_SATURDAY & val)
sprintf(msg, "Every %s week on Friday", repeat_str);
} else {
sprintf(msg, "Every %s week on", repeat_str);
day_count = 0;
for (idx = 0; idx < 7; idx++) {
if (m_WeekButtons[idx]->value()) {
day_count++;
if (0 != day_count) {
if (count > 2 && day_count > 1)
strcat(msg, ", ");
if (count == day_count)
strcat(msg, " and");
}
switch (idx) {
case 0:
strcat(msg, " Sun");
break;
case 1:
strcat(msg, " Mon");
break;
case 2:
strcat(msg, " Tue");
break;
case 3:
strcat(msg, " Wed");
break;
case 4:
strcat(msg, " Thur");
break;
case 5:
strcat(msg, " Fri");
break;
case 6:
strcat(msg, " Sat");
break;
default:
break;
}
}
}
}
int width = (int) fl_width(msg);
if (width > repeat_output->w()) {
int len = strlen(msg);
idx = 0;
while (width > repeat_output->w() - 5) {
char test[100];
idx++;
memset(test, 0, sizeof(test));
strncpy(test, msg, len - idx);
width = (int) fl_width(test);
}
while (!isspace(msg[len - idx])) {
idx++;
}
msg[len - idx] = '\n';
}
}
void
NxSchedule::weekDay_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
tm *tt = localtime(&pThis->m_CurrentDay);
if (0 == pThis->getWeekValue()) {
pThis->m_WeekButtons[tt->tm_wday]->value(1);
}
every_input->do_callback();
}
void
NxSchedule::monthDayDate_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
if (w == pThis->month_date) {
pThis->month_date->value(1);
pThis->month_day->value(0);
} else {
pThis->month_day->value(1);
pThis->month_date->value(0);
}
every_input->do_callback();
}
--- NEW FILE: nxweek.h ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#ifndef _NXWEEK_H_
#define _NXWEEK_H_
#include <time.h>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Group.H>
#include <nxbox.h>
#include <nxdb.h>
#include <nxbutton.h>
#include <stdio.h>
#define BUTTON_W 15
#define MAX_COUNT 2
#define APPT_MASK 0x0F
#define MIN_INC 5
#define HOUR_INC 12
#define MAX_VAL 4
enum Appt_Overlay
{
NO_OVERLAP,
SINGLE = 1,
LEFT = 4,
RIGHT = 8,
};
class WeekGrid;
typedef struct appt_
{ // appointmet structure
double x;
double y;
double w;
double h;
int overlay;
int recno;
time_t start_time;
time_t end_time;
appt_ *next_appt;
appt_ *prev_appt;
}
appt;
class GridButton:public NxButton
{
WeekGrid *grid_;
void draw();
public:
GridButton(int X, int Y, int W, int H, const char *L):NxButton(X, Y, W,
H,
(char *)
L)
{
;
}
void SetGrid(WeekGrid * grid)
{
grid_ = grid;
}
};
class WeekGrid:public Fl_Widget
{
int save_h;
short info_draw;
uchar appt_array[7][288];
appt *first_appt;
double pix_ratio;
double day_pix;
NxDb *db;
char db_name[255];
void draw();
int handle(int);
double GetOffSet(double val);
void DrawAppointments();
void DrawOverlaps(int dy);
void DrawRects(int dy);
void GetAppointments();
void ShowInfo(int X, int Y);
int Overlap(appt * p_Appt);
int GetGridVal();
void GetOverlap();
void GetOverlapDim(appt * p_Appt, appt * p_Prev);
void GetApptDim(appt * p_Appt);
void SetInfoBox(appt * p_Appt);
bool MakeAppt(appt * p_Appt, int recno, time_t start_time,
time_t end_time);
bool IsForWeek(time_t start_time, time_t end_time);
int scroll_count;
int b_height;
int b_width;
int font_;
int f_size_;
uchar color_;
uchar txt_color_;
uchar line_color_;
time_t date_sunday;
time_t date_mark;
int num_recs;
NxBox *output_box;
public:
WeekGrid(int X, int Y, int H, int W, const char *L = 0);
~WeekGrid();
void color(uchar col)
{
color_ = col;
}
Fl_Color color() const
{
return (Fl_Color) color_;
}
void txt_color(uchar col)
{
txt_color_ = col;
}
Fl_Color txt_color()
{
return (Fl_Color) txt_color_;
}
void line_color(uchar col)
{
line_color_ = col;
}
Fl_Color line_color() const
{
return (Fl_Color) line_color_;
}
void SetDb(NxDb * pDb, char *name)
{
db = pDb;
strcpy(db_name, name);
}
int h()
{
return (int) (6.5 * b_height);
}
void SetFont(int font, int size)
{
font_ = font;
f_size_ = size;
}
void SetDateSunday(time_t date);
void SetOutputBox(NxBox * out_)
{
output_box = out_;
}
int UpCount();
int DownCount();
virtual void resize(int X, int Y, int W, int H);
};
void free_appts(appt * app);
appt *appt_alloc(void);
#endif
--- NEW FILE: nxweek.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
[...1452 lines suppressed...]
int Y1 = Y + H / 3;
int X1 = X + w1 - w() / 2;
if (damage()) {
#ifdef PDA
draw_box(FL_FLAT_BOX, X, Y, W, H, col);
if (value())
fl_color(NxApp::Instance()->getGlobalColor(BUTTON_FACE));
else
fl_color(NxApp::Instance()->getGlobalColor(BUTTON_TEXT));
#else
draw_box(value()? (down_box()? down_box() : down(box())) : box(),
col);
#endif
if (0 == strcmp(label(), "@UpArrow"))
fl_polygon(X1, Y1, X1 - W1, Y1 + H1, X1 + W1, Y1 + H1);
if (0 == strcmp(label(), "@DownArrow"))
fl_polygon(X1, Y1 + H1, X1 - W1, Y1, X1 + W1, Y1);
}
}
--- NEW FILE: nxmonthcal.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <FL/Fl.H>
#include "nxmonthcal.h"
#include "nxschedule.h"
#include <nxapp.h>
static void
fl_calendar_button_cb(Fl_Button * a, void *b)
{
long j = 0;
NxMonthCalendar *c = (NxMonthCalendar *) b;
Fl_Button *sb;
int numdays = c->days_in_month() + 1;
for (int i = 1; i < numdays; i++) {
sb = c->day_button(i);
sb->color(NxApp::Instance()->getGlobalColor(APP_BG));
sb->labelcolor(NxApp::Instance()->getGlobalColor(APP_FG));
if (a == sb) {
c->day(i);
j = i;
//sb->color (NxApp::Instance()->getGlobalColor(APP_SEL));
//sb->labelcolor(NxApp::Instance()->getGlobalColor(APP_BG));
}
}
c->redraw();
c->do_callback(c, j);
tm d;
memset(&d, 0, sizeof(d));
d.tm_year = c->year() - 1900;
d.tm_mon = c->month() - 1;
d.tm_mday = c->day();
c->SetPickedDate(mktime(&d));
(c->GetDateCB())(a, (void *) (NxApp::Instance()));
}
NxMonthCalendar::NxMonthCalendar(int x, int y, int w, int h,
const char *l, bool bCaption, int type,
NxDb * db, char *db_name)
:
Fl_Calendar(x, y, w, h, l, type)
{
int idx;
memset(_db_name, 0, sizeof(_db_name));
if (db_name)
strcpy(_db_name, db_name);
_db = db;
for (idx = 0; idx < (7 * 6); idx++) {
this->remove(days[idx]);
days[idx] = NULL;
delete days[idx];
}
for (idx = 0; idx < (7 * 6); idx++) {
days[idx] = new NxMonthButton((w / 7) * (idx % 7) + x,
(h / (m_nRows - 2)) * (idx / 7) + y,
(w / 7), (h / (m_nRows - 2)));
#ifndef FLTK_2
days[idx]->down_box(FL_THIN_DOWN_BOX);
days[idx]->labelsize(10);
#else
days[idx]->label_size(10);
#endif
days[idx]->box(FL_THIN_UP_BOX);
days[idx]->color(NxApp::Instance()->getGlobalColor(APP_BG));
days[idx]->selection_color(NxApp::Instance()->
getGlobalColor(APP_SEL));
days[idx]->labelcolor(NxApp::Instance()->getGlobalColor(APP_FG));
days[idx]->callback((Fl_Callback *) & fl_calendar_button_cb,
(void *) this);
}
if (m_bCaption)
Fl_Calendar_Base::csize(x, y + (2 * h / m_nRows), w,
(6 * h / m_nRows));
else
Fl_Calendar_Base::csize(x, y + (h / m_nRows), w, (6 * h / m_nRows));
update();
}
void
NxMonthCalendar::update()
{
int dow = date.day_of_week(date.year(), date.month(), 1);
int dim = date.days_in_month(date.month(), date.leap_year(date.year()));
int i;
for (i = dow; i < (dim + dow); i++) {
char t[8];
sprintf(t, "%d", (i - dow + 1));
days[i]->label(strdup(t));
days[i]->align((Fl_Align)
(FL_ALIGN_INSIDE | FL_ALIGN_TOP | FL_ALIGN_LEFT));
}
char tmp[32];
sprintf(tmp, "%s %d", date.month_name[date.month() - 1], date.year());
update_buttons();
if (m_bCaption) {
if (caption->label())
free((void *) caption->label());
caption->label(strdup(tmp));
}
redraw();
}
void
CreateDateRange(time_t * e, time_t * l, time_t start_day, time_t end_day)
{
tm start_tm;
tm end_tm;
memcpy(&start_tm, localtime(&start_day), sizeof(start_tm));
memcpy(&end_tm, localtime(&end_day), sizeof(end_tm));
start_tm.tm_sec = 0;
start_tm.tm_min = 0;
start_tm.tm_hour = 0;
end_tm.tm_sec = 59;
end_tm.tm_min = 59;
end_tm.tm_hour = 23;
*e = mktime(&start_tm);
*l = mktime(&end_tm);
}
bool
IsForToday(time_t start_time, time_t EarlyDay, time_t LateDay)
{
if (start_time >= EarlyDay && start_time <= LateDay)
return true;
else
return false;
}
void
NxMonthCalendar::update_buttons()
{
int dow = date.day_of_week(date.year(), date.month(), 1);
int dim = date.days_in_month(date.month(), date.leap_year(date.year()));
int i;
int vals[3];
int rec_array[255];
time_t earlyDay;
time_t lateDay;
time_t start_time;
time_t end_time;
time_t day = 0;
tm d;
int idx = 0;
NxTodo *note = new NxTodo;
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
memset(&d, 0, sizeof(d));
d.tm_year = year() - 1900;
d.tm_mon = month() - 1;
d.tm_mday = 0;
for (idx = 0; idx < 255; idx++)
rec_array[idx] = -1;
_db->Select(_db_name, rec_array, 255);
for (i = 0; i < dow; i++) {
days[i]->hide();
}
for (i = (dim + dow); i < (6 * 7); i++) {
days[i]->hide();
}
for (i = dow; i < (dim + dow); i++) {
char t[8];
sprintf(t, "%d", (i - dow + 1));
days[i]->label(strdup(t));
days[i]->color(NxApp::Instance()->getGlobalColor(APP_BG));
days[i]->labelcolor(NxApp::Instance()->getGlobalColor(APP_FG));
d.tm_mday++;
day = mktime(&d);
CreateDateRange(&earlyDay, &lateDay, day, day);
memset(vals, 0, sizeof(vals));
for (idx = 0; idx < 255; idx++) {
if (-1 != rec_array[idx]) {
pThis->ExtractRecord(note, rec_array[idx]);
start_time = note->startTime;
end_time = note->endTime;
if (vals[0] && vals[1] && vals[2])
break;
if (pThis->IsForToday(note, earlyDay, lateDay)) {
tm *tt = localtime(&start_time);
if (tt->tm_hour >= 0 && tt->tm_hour < 8) {
vals[0] = 1;
} else if (tt->tm_hour >= 8 && tt->tm_hour < 16) {
vals[1] = 1;
} else {
vals[2] = 1;
}
tt = localtime(&end_time);
if (vals[0]) {
if (tt->tm_hour >= 8 && tt->tm_hour < 16)
vals[1] = 1;
if (tt->tm_hour >= 16) {
vals[1] = 1;
vals[2] = 1;
}
}
if (vals[1]) {
if (tt->tm_hour >= 16) {
vals[2] = 1;
}
}
}
}
}
((NxMonthButton *) days[i])->SetAppts(vals);
days[i]->redraw();
days[i]->show();
}
redraw();
note = NULL;
delete note;
}
void
NxMonthCalendar::DateCallback(void (*cb) (Fl_Widget *, void *))
{
m_pDateCallback = cb;
}
time_t NxMonthCalendar::GetPickedDate()
{
return m_nDatePicked;
}
void
NxMonthCalendar::SetPickedDate(time_t t)
{
tm *tt = localtime(&t);
set_date(tt->tm_year + 1900, tt->tm_mon + 1, tt->tm_mday);
m_nDatePicked = t;
update();
}
NxMonthButton::NxMonthButton(int X, int Y, int W, int H, const char *L)
:
Fl_Button(X, Y, W, H, L)
{
color(NxApp::Instance()->getGlobalColor(APP_BG));
labelcolor(NxApp::Instance()->getGlobalColor(APP_FG));
for (int idx = 0; idx < 3; idx++)
appt[idx] = 0;
}
void
NxMonthButton::SetAppts(int vals[])
{
for (int idx = 0; idx < 3; idx++) {
appt[idx] = vals[idx];
}
}
void
NxMonthButton::draw()
{
Fl_Color col = value()? selection_color() : color();
#ifdef PDA
if (value()) {
Fl_Color old_label_clr = labelcolor();
labelcolor(contrast(color(), labelcolor()));
draw_box(down(box()), selection_color());
draw_label();
fl_color(labelcolor());
for (int idx = 0; idx < 3; idx++) {
if (0 == idx) {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2, w() / 10,
h() / 3 - 4);
} else if (1 == idx) {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2 + h() / 3,
w() / 10, h() / 3 - 4);
} else {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10,
y() + 2 + 2 * (h() / 3), w() / 10, h() / 3 - 4);
}
}
labelcolor(old_label_clr);
} else {
draw_box(box(), col);
draw_label();
fl_color(labelcolor());
for (int idx = 0; idx < 3; idx++) {
if (0 == idx) {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2, w() / 10,
h() / 3 - 4);
} else if (1 == idx) {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2 + h() / 3,
w() / 10, h() / 3 - 4);
} else {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10,
y() + 2 + 2 * (h() / 3), w() / 10, h() / 3 - 4);
}
}
}
#else
draw_box(value()? (down_box()? down_box() : down(box())) : box(), col);
draw_label();
for (int idx = 0; idx < 3; idx++) {
if (0 == idx) {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2, w() / 10,
h() / 3 - 4);
} else if (1 == idx) {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2 + h() / 3,
w() / 10, h() / 3 - 4);
} else {
if (appt[idx])
fl_rectf(x() + w() - 5 - w() / 10, y() + 2 + 2 * (h() / 3),
w() / 10, h() / 3 - 4);
}
}
#endif
}
--- NEW FILE: nxdetail.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <pixil_config.h>
#include "nxschedule.h"
/* Please, get rid of this ugly thing */
#if defined(CONFIG_APP_ALARM) && defined(CONFIG_COLOSSEUM)
#define DO_ALARM 1
#endif
#ifdef DEBUG
#define DPRINT(str, args...) printf("DEBUG: " str, ## args)
#else
#define DPRINT(args...)
#endif
extern Fl_Menu_Item schedMenuItems[];
#ifdef DO_ALARM
Fl_Menu_Item alarmMenuItems[] = {
{"Minutes", 0, NxSchedule::chooseAlarmMin_callback},
{"Hours", 0, NxSchedule::chooseAlarmHour_callback},
{"Days", 0, NxSchedule::chooseAlarmDay_callback},
{0}
};
#endif
static char *
_FormatTimeRange(NxTodo * n)
{
static char buf[30];
tm startTime;
tm endTime;
memcpy(&startTime, localtime(&n->startTime), sizeof(startTime));
memcpy(&endTime, localtime(&n->endTime), sizeof(endTime));
startTime.tm_sec = 0;
endTime.tm_sec = 0;
sprintf(buf, "%d:%02d%s - %d:%02d%s",
HR_12(startTime.tm_hour),
startTime.tm_min,
AM_PM(startTime.tm_hour),
HR_12(endTime.tm_hour), endTime.tm_min, AM_PM(endTime.tm_hour));
return buf;
}
#ifdef DO_ALARM
void
NxSchedule::chooseAlarmMin_callback(Fl_Widget * w, void *l)
{
NxCheckButton *p_Button = (NxCheckButton *) w;
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
p_Button->label("Minutes");
p_Button->hide();
p_Button->show();
pThis->SetAlarmInt(ALARM_MIN);
}
void
NxSchedule::chooseAlarmHour_callback(Fl_Widget * w, void *l)
{
NxCheckButton *p_Button = (NxCheckButton *) w;
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
p_Button->label("Hours");
p_Button->hide();
p_Button->show();
pThis->SetAlarmInt(ALARM_HOUR);
}
void
NxSchedule::chooseAlarmDay_callback(Fl_Widget * w, void *l)
{
NxCheckButton *p_Button = (NxCheckButton *) w;
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
p_Button->label("Days");
p_Button->hide();
p_Button->show();
pThis->SetAlarmInt(ALARM_DAY);
}
void
NxSchedule::SetAlarmInt(int interval)
{
m_pCurrentItem->alarmFlags = interval;
}
#endif
void
NxSchedule::detailTimePicked_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
time_t start_time;
time_t end_time;
tm *time;
int start_hour1;
int start_min1;
int start_hour2;
int start_min2;
int end_hour1;
int end_min1;
int end_hour2;
int end_min2;
NxTodo *note;
int rec_array[1];
char c_recno[16];
pThis->timeWindow->GetWindowPtr()->hide();
NxApp::Instance()->show_window(pThis->detailsWindow->GetWindowPtr(),
DEACTIVATE,
pThis->dayWindow->GetWindowPtr());
if (w) {
if (!(CHANGED_NEW & g_EditFlag)) {
note = new NxTodo;
rec_array[0] = -1;
sprintf(c_recno, "%d", pThis->m_pCurrentItem->recno);
pThis->GetTimes(&start_time, &end_time);
time = localtime(&start_time);
start_hour1 = time->tm_hour;
start_min1 = time->tm_min;
time = localtime(&end_time);
end_hour1 = time->tm_hour;
end_min1 = time->tm_min;
pThis->db->Select(SCHEDULE, c_recno, 0, rec_array, 1);
pThis->ExtractRecord(note, rec_array[0]);
time = localtime(¬e->startTime);
start_hour2 = time->tm_hour;
start_min2 = time->tm_min;
time = localtime(¬e->endTime);
end_hour2 = time->tm_hour;
end_min2 = time->tm_min;
#ifdef DEBUG
printf("start_hour1 [%d] start_hour2 [%d]\n", start_hour1,
start_hour2);
printf("start_min1 [%d] start_min2 [%d]\n", start_min1,
start_min2);
printf("end_hour1 [%d] end_hour2[%d]\n", end_hour1, end_hour2);
printf("end_min1 [%d] end_min2 [%d]", end_min1, end_min2);
#endif
if (start_hour1 != start_hour2 || start_min1 != start_min2 ||
end_hour1 != end_hour2 || end_min1 != end_min2 &&
!(REPEAT_NONE & pThis->m_pCurrentItem->repeatFlag_1)) {
g_EditFlag |= CHANGED_TIME_FLAG;
} else {
g_EditFlag = g_EditFlag & ~CHANGED_TIME_FLAG;
}
delete note;
}
pThis->GetTimes(&pThis->m_pCurrentItem->startTime,
&pThis->m_pCurrentItem->endTime);
// ok .. we just got a callback from our time picker routines
// update the
pThis->FillDetailForm(pThis->m_pCurrentItem, DESC_KEEP);
}
}
void
NxSchedule::detailDatePicked_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->dateWindow->GetWindowPtr()->hide();
NxApp::Instance()->show_window(pThis->detailsWindow->GetWindowPtr(),
DEACTIVATE,
pThis->dayWindow->GetWindowPtr());
time_t t = pCalendar->GetPickedDate();
if (t) {
tm date;
tm startTime;
tm endTime;
tm today;
time_t start_time;
time_t end_time;
memcpy(&date, localtime(&t), sizeof(date));
memcpy(&startTime, localtime(&pThis->m_pCurrentItem->startTime),
sizeof(startTime));
memcpy(&endTime, localtime(&pThis->m_pCurrentItem->endTime),
sizeof(endTime));
memcpy(&today, localtime(&pThis->m_CurrentDay), sizeof(today));
startTime.tm_sec = 0;
startTime.tm_mon = date.tm_mon;
startTime.tm_year = date.tm_year;
startTime.tm_mday = date.tm_mday;
endTime.tm_sec = 0;
endTime.tm_mon = date.tm_mon;
endTime.tm_year = date.tm_year;
endTime.tm_mday = date.tm_mday;
start_time = mktime(&startTime);
end_time = mktime(&endTime);
if ((date.tm_year != today.tm_year
|| date.tm_mon != today.tm_mon
|| date.tm_mday != today.tm_mday) &&
!(REPEAT_NONE & pThis->m_pCurrentItem->repeatFlag_1))
g_EditFlag |= CHANGED_DATE_FLAG;
else
g_EditFlag = g_EditFlag & ~CHANGED_DATE_FLAG;
#ifdef DEBUG
printf("Date callback g_EditFlag [%d]\n", g_EditFlag);
#endif
pThis->m_pCurrentItem->fakeTime = start_time;
pThis->m_pCurrentItem->startTime = start_time;
pThis->m_pCurrentItem->endTime = end_time;
// ok .. we just got a callback from our date picker routines
// update the detail window
pThis->FillDetailForm(pThis->m_pCurrentItem, DESC_KEEP);
}
}
// Show the date selection window
void
NxSchedule::detailDate_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->set_date_picker(m_pCalendar);
if (!(REPEAT_NONE & pThis->m_pCurrentItem->repeatFlag_1))
pCalendar->SetPickedDate(pThis->m_pCurrentItem->fakeTime);
else
pCalendar->SetPickedDate(pThis->m_pCurrentItem->startTime);
pThis->detailsWindow->GetWindowPtr()->deactivate();
NxApp::Instance()->show_window(dateWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
pCalendar->DateCallback(detailDatePicked_callback);
}
#ifdef DO_ALARM
// Set the alarm value
void
NxSchedule::alarmIntChanged_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
int interval = atoi(pThis->m_pDetailsAlarmInput->value());
pThis->m_pCurrentItem->alarmInt = interval;
}
// Toggle the alarm button show the alarm input and menu
void
NxSchedule::alarmToggle_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
bool val = pThis->m_pDetailsAlarmCheck->value();
if (true == val) {
pThis->m_pCurrentItem->alarmFlags = ALARM_MIN;
pThis->m_pCurrentItem->alarmInt = 5;
pThis->showAlarmUi();
} else {
pThis->m_pCurrentItem->alarmInt = NO_ALARM;
pThis->hideAlarmUi();
}
}
#endif
// Show the repeat selection window
void
NxSchedule::detailRepeat_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->getRepeatData();
pThis->detailsWindow->GetWindowPtr()->deactivate();
NxApp::Instance()->show_window(repeatWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
}
// Show the time selection window
void
NxSchedule::detailTime_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->SetTimes(pThis->m_pCurrentItem->startTime,
pThis->m_pCurrentItem->endTime);
pThis->detailsWindow->GetWindowPtr()->deactivate();
NxApp::Instance()->show_window(timeWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
pThis->time_callback(detailTimePicked_callback);
}
void
NxSchedule::cancelEdit_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->pCalendar->SetPickedDate(0);
pThis->show_window(dayWindow->GetWindowPtr());
pThis->UpdateDateDisplay();
}
void
NxSchedule::deleteEdit_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
if ((REPEAT_NONE) & pThis->m_pCurrentItem->repeatFlag_1 ||
pThis->m_pCurrentItem->repeatFlag_1 == 0)
NxApp::Instance()->show_window(deleteWindow->GetWindowPtr(),
DEACTIVATE,
detailsWindow->GetWindowPtr());
else {
pThis->g_EditFlag = DELETE_FLAG;
NxApp::Instance()->show_window(repeatEventWindow->GetWindowPtr(),
DEACTIVATE,
detailsWindow->GetWindowPtr());
}
}
void
NxSchedule::doneEdit_callback(Fl_Widget * w, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
strcpy(pThis->m_pCurrentItem->szDescription,
pThis->m_pDetails_DescBox->value());
if (!(g_EditFlag & CHANGED_NEW)) {
NxTodo *n = new NxTodo;
int recno = pThis->m_pCurrentItem->recno;
int rec_array[1];
char c_recno[16];
rec_array[0] = -1;
sprintf(c_recno, "%d", recno);
pThis->db->Select(SCHEDULE, c_recno, 0, rec_array, 1);
pThis->ExtractRecord(n, rec_array[0]);
#ifdef DO_ALARM
if (0 == strcmp("", pThis->m_pDetailsAlarmInput->value()) ||
0 == strcmp(" ", pThis->m_pDetailsAlarmInput->value())) {
pThis->m_pCurrentItem->alarmInt = 0;
}
if (n->alarmFlags != pThis->m_pCurrentItem->alarmFlags ||
n->alarmInt != pThis->m_pCurrentItem->alarmInt) {
// need to delete old alarm and set new one
if ((REPEAT_NONE == pThis->m_pCurrentItem->repeatFlag_1)) {
DPRINT("changed alarm\n");
DPRINT("send message to alarmd\n");
pThis->DeleteAlarm(n);
pThis->SetAlarm(pThis->m_pCurrentItem, 0);
} else
g_EditFlag |= CHANGED_ALARM;
}
#endif
delete n;
n = 0;
} else {
#ifdef DO_ALARM
if (pThis->m_pCurrentItem->alarmInt != NO_ALARM) {
DPRINT("setting alarm for new item\n");
pThis->SetAlarm(pThis->m_pCurrentItem, 0);
}
#endif
}
if (((CHANGED_DATE_FLAG & g_EditFlag)
|| (CHANGED_TIME_FLAG & g_EditFlag)
#ifdef DO_ALARM
|| (CHANGED_ALARM & g_EditFlag)
#endif
) &&
(REPEAT_NONE != pThis->m_pCurrentItem->repeatFlag_1) &&
!(CHANGED_NEW & g_EditFlag)) {
NxApp::Instance()->show_window(repeatEventWindow->GetWindowPtr(),
DEACTIVATE,
detailsWindow->GetWindowPtr());
} else {
save(pThis->m_pCurrentItem);
pThis->show_window(dayWindow->GetWindowPtr());
}
g_EditFlag = g_EditFlag & ~CHANGED_NEW;
pThis->UpdateDateDisplay();
}
static char *
_FormatDate(NxTodo * n)
{
static char buf[30];
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
time_t date = pThis->GetCurrentDay();
int year = 0;
int mon = 0;
int day = 0;
tm *tt = NULL;
int flag = pThis->GetEditFlag();
tt = localtime(&date);
day = tt->tm_mday;
mon = tt->tm_mon;
year = tt->tm_year;
if ((REPEAT_NONE & n->repeatFlag_1)) {
//strftime(buf,29,"%b %d, %Y",localtime(&n->startTime));
pThis->GetDateString(buf, localtime(&n->startTime), sizeof(buf),
LONG_YEAR);
return buf;
}
if (flag & CHANGED_DATE_FLAG) {
date = pThis->GetpCalendar()->GetPickedDate();
if (date == 0)
date = pThis->GetCurrentDay();
//strftime(buf,29,"%b %d, %Y",localtime(&date));
pThis->GetDateString(buf, localtime(&date), sizeof(buf), LONG_YEAR);
} else {
//strftime(buf,29,"%b %d, %Y",localtime(&date));
pThis->GetDateString(buf, localtime(&date), sizeof(buf), LONG_YEAR);
}
return buf;
}
// This function will fill the detail form as well as set
// the "Current" schedule item to be edited.
void
NxSchedule::FillDetailForm(NxTodo * n, int flags)
{
#ifdef DO_ALARM
char buf[16];
#endif
if (!n)
return;
m_pCurrentItem = n;
m_pDetails_TimeBox->label(_FormatTimeRange(n));
m_pDetails_TimeBox->redraw();
m_pDetails_DateBox->label(_FormatDate(n));
m_pDetails_DateBox->redraw();
switch (n->repeatFlag_1) {
case REPEAT_YEARLY:
m_pDetails_RepeatBox->label("Yearly");
break;
case REPEAT_MONTHLY:
m_pDetails_RepeatBox->label("Monthly");
break;
case REPEAT_WEEKLY:
m_pDetails_RepeatBox->label("Weekly");
break;
case REPEAT_DAILY:
m_pDetails_RepeatBox->label("Daily");
break;
default:
case REPEAT_NONE:
m_pDetails_RepeatBox->label("None");
break;
}
if (DESC_NEW & flags)
m_pDetails_DescBox->value("");
else if (DESC_KEEP & flags);
else
m_pDetails_DescBox->value(n->szDescription);
#ifdef DO_ALARM
sprintf(buf, "%d", n->alarmInt);
m_pDetailsAlarmInput->value(buf);
if (n->alarmInt != NO_ALARM)
showAlarmUi();
else
hideAlarmUi();
#endif
}
#ifdef DO_ALARM
void
NxSchedule::hideAlarmUi()
{
m_pDetailsAlarmCheck->value(0);
m_pDetailsAlarmInput->hide();
m_pDetailsAlarmInt->hide();
}
void
NxSchedule::showAlarmUi()
{
static char buf[3];
m_pDetailsAlarmCheck->value(1);
switch (m_pCurrentItem->alarmFlags) {
case ALARM_MIN:
m_pDetailsAlarmInt->label("Minutes");
break;
case ALARM_HOUR:
m_pDetailsAlarmInt->label("Hours");
break;
case ALARM_DAY:
m_pDetailsAlarmInt->label("Days");
break;
default:
m_pDetailsAlarmInt->label("Minutes");
break;
}
sprintf(buf, "%d", m_pCurrentItem->alarmInt);
m_pDetailsAlarmInput->value(buf);
m_pDetailsAlarmInput->hide();
m_pDetailsAlarmInput->show();
m_pDetailsAlarmInt->show();
}
#endif
void
NxSchedule::MakeDetailsWindow()
{
detailsWindow =
new NxPimPopWindow("Event Details",
NxApp::Instance()->getGlobalColor(APP_FG), 5, 5,
W_W - 10, 205);
add_window((Fl_Window *) detailsWindow->GetWindowPtr());
// for the time input
{
NxOutput *o = new NxOutput(20, 35, 0, 0, "Time:");
NxApp::Instance()->def_font(o);
detailsWindow->add(o);
o->align(FL_ALIGN_RIGHT);
}
{
NxButton *o = new NxButton(55, 27, 120, BUTTON_HEIGHT);
o->box(FL_THIN_UP_BOX);
o->label("11:00am - 10:00pm");
o->callback(detailTime_callback, this);
detailsWindow->add(o);
m_pDetails_TimeBox = o;
}
// for the date input
{
NxOutput *o = new NxOutput(20, 60, 0, 0, "Date:");
detailsWindow->add(o);
o->align(FL_ALIGN_RIGHT);
}
{
NxButton *o = new NxButton(58, 52, 110, BUTTON_HEIGHT);
o->box(FL_THIN_UP_BOX);
o->label("Aug 10, 2001");
o->callback(detailDate_callback, this);
detailsWindow->add(o);
m_pDetails_DateBox = o;
}
// for the repeat
{
NxOutput *o = new NxOutput(8, 85, 0, 0, "Repeat:");
detailsWindow->add(o);
o->align(FL_ALIGN_RIGHT);
}
{
NxButton *o = new NxButton(58, 77, 70, BUTTON_HEIGHT);
o->box(FL_THIN_UP_BOX);
o->label("Monthly");
detailsWindow->add(o);
m_pDetails_RepeatBox = o;
o->callback(detailRepeat_callback, this);
}
#ifdef DO_ALARM
{
NxOutput *o = new NxOutput(14, 110, 0, 0, "Alarm:");
detailsWindow->add(o);
o->align(FL_ALIGN_RIGHT);
}
{
NxCheckButton *o = new NxCheckButton(58, 99, "");
o->callback(alarmToggle_callback, this);
detailsWindow->add((Fl_Widget *) o);
m_pDetailsAlarmCheck = o;
}
{
NxIntInput *o = new NxIntInput(70, 99, 30, 20, "");
detailsWindow->add(o);
o->maximum_size(2);
o->callback(alarmIntChanged_callback, this);
o->when(FL_WHEN_CHANGED);
m_pDetailsAlarmInput = o;
}
{
NxMenuButton *o = new NxMenuButton(103, 101, 60, BUTTON_HEIGHT);
o->label("Minutes");
o->menu(alarmMenuItems);
detailsWindow->add(o);
m_pDetailsAlarmInt = o;
}
#endif
{
NxMultilineInput *o = new NxMultilineInput(3, 127,
detailsWindow->
GetWindowPtr()->w() - 6,
50);
o->maximum_size(99);
o->align(FL_ALIGN_WRAP);
detailsWindow->add(o);
m_pDetails_DescBox = o;
}
{
NxButton *o = new NxButton(POP_BUTTON_X, POP_BUTTON_Y(detailsWindow),
BUTTON_WIDTH, BUTTON_HEIGHT, "Ok");
o->callback(doneEdit_callback, this);
detailsWindow->add((Fl_Widget *) o);
}
{
NxButton *o = new NxButton(POP_BUTTON_X + BUTTON_WIDTH + 2,
POP_BUTTON_Y(detailsWindow),
BUTTON_WIDTH, BUTTON_HEIGHT, "Cancel");
o->callback(cancelEdit_callback, this);
detailsWindow->add((Fl_Widget *) o);
}
{
NxButton *o = new NxButton(POP_BUTTON_X + (BUTTON_WIDTH * 2) + 4,
POP_BUTTON_Y(detailsWindow),
BUTTON_WIDTH, BUTTON_HEIGHT, "Delete");
o->callback(deleteEdit_callback, this);
detailsDeleteButton = o;
detailsWindow->add((Fl_Widget *) o);
}
detailsWindow->GetWindowPtr()->end();
}
--- NEW FILE: nxyearview.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include "nxschedule.h"
#include "nxyearcal.h"
void
NxSchedule::MakeYearViewWindow()
{
yearViewWindow = new NxPimWindow(0, 0, W_W, W_H);
add_window((Fl_Window *) yearViewWindow->GetWindowPtr());
{
// NxScroll *o = new NxScroll(0, 0, W_W, BUTTON_Y - 1);
// {
NxYearCal *o = pYearCal =
new NxYearCal(m_CurrentDay, 0, 0, W_W, BUTTON_Y - 2);
o->SetMonthCallback(month_callback);
o->SetDayCallback(day_callback);
o->SetDb(db, SCHEDULE);
//yearViewWindow->add(o);
// }
// o->end();
yearViewWindow->add((Fl_Widget *) o);
}
{
NxButton *o = new NxButton(W_W / 2 - 15, BUTTON_Y, 15, 15, "@<");
o->movable(false);
o->labeltype(FL_SYMBOL_LABEL);
o->box(FL_FLAT_BOX);
o->callback(pYearCal->backYear_callback, pYearCal);
yearViewWindow->add((Fl_Widget *) o);
}
{
NxButton *o = new NxButton(W_W / 2, BUTTON_Y, 15, 15, "@>");
o->movable(false);
o->labeltype(FL_SYMBOL_LABEL);
o->box(FL_FLAT_BOX);
o->callback(pYearCal->forwYear_callback, pYearCal);
yearViewWindow->add((Fl_Widget *) o);
}
tm *tt;
static char year_buf[6];
{
tt = localtime(&m_CurrentDay);
strftime(year_buf, 5, "%Y", tt);
NxBox *o = new NxBox(W_W / 2 - 55, BUTTON_Y - 1, 50, 20, year_buf);
o->movable(false);
yearViewWindow->add((Fl_Widget *) o);
pYearCal->year_Box = o;
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 180, BUTTON_Y, 10, BUTTON_HEIGHT,
type_daily);
o->callback(dailyView_callback, this);
yearViewWindow->add((Fl_Widget *) o);
o->movable(false);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 193, BUTTON_Y, 10, BUTTON_HEIGHT,
type_weekly);
o->callback(weeklyView_callback, this);
yearViewWindow->add((Fl_Widget *) o);
o->movable(false);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 206, BUTTON_Y, 10, BUTTON_HEIGHT,
type_monthly);
o->callback(monthlyView_callback, this);
yearViewWindow->add((Fl_Widget *) o);
o->movable(false);
}
{
GroupButton *o =
new GroupButton(BUTTON_X + 219, BUTTON_Y, 10, BUTTON_HEIGHT,
type_yearly);
o->callback(yearlyView_callback, this);
yearViewWindow->add((Fl_Widget *) o);
o->movable(false);
}
yearViewWindow->GetWindowPtr()->end();
}
void
NxSchedule::day_callback(Fl_Widget * fl, void *o)
{
time_t *time;
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
time = (time_t *) o;
pThis->m_CurrentDay = *time;
pThis->UpdateDateDisplay();
// pThis->dayWindow->GetWindowPtr()->add(pThis->buttonGroup);
pThis->show_window(dayWindow->GetWindowPtr());
}
void
NxSchedule::month_callback(Fl_Widget * fl, void *o)
{
time_t *time;
NxSchedule *pThis = (NxSchedule *) (NxApp::Instance());
time = (time_t *) o;
pThis->m_CurrentDay = *time;
pThis->UpdateDateDisplay();
// pThis->monthViewWindow->GetWindowPtr()->add(pThis->buttonGroup);
pThis->pMonthCal->SetPickedDate(pThis->m_CurrentDay);
pThis->show_window(monthViewWindow->GetWindowPtr());
}
--- NEW FILE: nxtime.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* RESTRICTED RIGHTS LEGEND
*
* Use, duplication, or disclosure by the government is subject to
* restriction as set forth in paragraph (b)(3)(b) of the Rights in
* Technical Data and Computer Software clause in DAR 7-104.9(a).
*
* See http://www.pixil.org/gpl/ for GPL licensing
* information.
*
* See http://www.pixil.org/license.html or
* email cetsales at centurysoftware.com for information about the PIXIL
* Commercial License Agreement, or if any conditions of this licensing
* are not clear to you.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "nxschedule.h"
#define TIME_WINDOW_START 0
#define TIME_WINDOW_END 1
#define TIME_WINDOW_NONE 2
static char *
_FormatTime(tm * tt)
{
static char buf[30];
sprintf(buf, "%d:%02d%s",
HR_12(tt->tm_hour), tt->tm_min, AM_PM(tt->tm_hour));
return buf;
}
void
NxSchedule::time_callback(void (*cb) (Fl_Widget *, void *))
{
m_pTimePickerCallback = cb;
}
void
NxSchedule::SetTimes(time_t nStartTime, time_t nEndTime)
{
memcpy(&m_StartTime, localtime(&nStartTime), sizeof(m_StartTime));
memcpy(&m_EndTime, localtime(&nEndTime), sizeof(m_EndTime));
m_StartTime.tm_sec = 0;
m_EndTime.tm_sec = 0;
Time_UpdateDisplay();
}
void
NxSchedule::GetTimes(time_t * nStartTime, time_t * nEndTime)
{
*nStartTime = mktime(&m_StartTime);
*nEndTime = mktime(&m_EndTime);
}
void
NxSchedule::doneTime_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
(*pThis->m_pTimePickerCallback) (o, l);
}
void
NxSchedule::cancelTime_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
(*pThis->m_pTimePickerCallback) (0, l);
}
void
NxSchedule::timeStart_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_nTimeState = TIME_WINDOW_START;
pThis->Time_UpdateDisplay();
}
void
NxSchedule::timeEnd_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_nTimeState = TIME_WINDOW_END;
pThis->Time_UpdateDisplay();
}
void
NxSchedule::timeNone_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
pThis->m_nTimeState = TIME_WINDOW_NONE;
pThis->Time_UpdateDisplay();
}
// for when the user selects a new hour
void
NxSchedule::timeHour_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
tm *p;
if (pThis->m_nTimeState == TIME_WINDOW_NONE)
pThis->m_nTimeState = TIME_WINDOW_START;
if (pThis->m_nTimeState == TIME_WINDOW_START) {
p = &pThis->m_StartTime;
} else {
p = &pThis->m_EndTime;
}
if (pThis->m_pTimeHour->value()) {
if (IS_AM(p->tm_hour)) {
p->tm_hour = pThis->m_pTimeHour->value();
} else {
p->tm_hour = pThis->m_pTimeHour->value() + 12;
}
}
if (pThis->m_pTimeMinute->value())
p->tm_min = (pThis->m_pTimeMinute->value() - 1) * 5;
if (p)
p->tm_sec = 0;
pThis->Time_UpdateDisplay();
}
void
NxSchedule::timeAM_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
if (pThis->m_nTimeState == TIME_WINDOW_START) {
if (pThis->m_StartTime.tm_hour >= 12)
pThis->m_StartTime.tm_hour -= 12;
} else {
if (pThis->m_EndTime.tm_hour >= 12)
pThis->m_EndTime.tm_hour -= 12;
}
pThis->Time_UpdateDisplay();
}
void
NxSchedule::timePM_callback(Fl_Widget * o, void *l)
{
NxSchedule *pThis = (NxSchedule *) l;
if (pThis->m_nTimeState == TIME_WINDOW_START) {
if (pThis->m_StartTime.tm_hour < 12)
pThis->m_StartTime.tm_hour += 12;
} else {
if (pThis->m_EndTime.tm_hour < 12) {
pThis->m_EndTime.tm_hour += 12;
}
}
if (pThis->m_EndTime.tm_mday != pThis->m_StartTime.tm_mday)
pThis->m_EndTime.tm_mday = pThis->m_StartTime.tm_mday;
pThis->Time_UpdateDisplay();
}
void
NxSchedule::Time_UpdateDisplay()
{
bool start = false;
bool end = false;
bool none = false;
bool am = false;
bool pm = false;
tm *p;
time_t start_time = 0;
time_t end_time = 0;
// which mode are we in?
switch (m_nTimeState) {
default:
case TIME_WINDOW_START:
start = true;
break;
case TIME_WINDOW_END:
end = true;
break;
case TIME_WINDOW_NONE:
none = true;
break;
}
start_time = mktime(&m_StartTime);
end_time = mktime(&m_EndTime);
if (end_time < start_time)
m_EndTime = m_StartTime;
// are we am or pm?
if (start) {
p = &m_StartTime;
} else {
p = &m_EndTime;
}
if (p->tm_hour >= 12)
pm = true;
else
am = true;
p->tm_sec = 0;
// moidfy all the on screen controls
m_pTimeStart->value(start);
m_pTimeEnd->value(end);
m_pTimeNone->value(none);
m_pTimeAM->value(am);
m_pTimePM->value(pm);
if (m_pTimeEnd->label())
free((void *) m_pTimeEnd->label());
m_pTimeEnd->label(strdup(_FormatTime(&m_EndTime)));
if (m_pTimeStart->label())
free(const_cast < char *>(m_pTimeStart->label()));
m_pTimeStart->label(strdup(_FormatTime(&m_StartTime)));
m_pTimeHour->select(HR_12(p->tm_hour));
m_pTimeMinute->select((p->tm_min / 5) + 1);
m_pTimeAM->redraw();
m_pTimePM->redraw();
m_pTimeStart->redraw();
m_pTimeNone->redraw();
m_pTimeEnd->redraw();
m_pTimeMinute->redraw();
m_pTimeHour->redraw();
}
void
NxSchedule::MakeTimeWindow()
{
//timeWindow = new NxPimPopWindow("Choose Time",NxApp::Instance()->getGlobalColor(APP_FG),5,5,W_W-10,235);
timeWindow = new NxPimWindow(W_X, W_Y, W_W, W_H);
add_window((Fl_Window *) timeWindow->GetWindowPtr());
m_nTimeState = TIME_WINDOW_START;
// for start time input
{
NxOutput *o = new NxOutput(20, 35 - 5, 0, 0, "Start Time:");
// o->labelfont(FL_TIMES_BOLD);
o->align(FL_ALIGN_RIGHT);
o->movable(false);
timeWindow->add(o);
}
{
NxButton *o = new NxButton(20, 50 - 5, 60, 20);
o->box(FL_THIN_UP_BOX);
o->callback(timeStart_callback, this);
m_pTimeStart = o;
o->movable(false);
timeWindow->add(o);
// m_pDetails_TimeBox = o;
}
// for end time input
{
NxOutput *o = new NxOutput(20, 85 - 5, 0, 0, "End Time:");
timeWindow->add(o);
o->align(FL_ALIGN_RIGHT);
o->movable(false);
}
{
NxButton *o = new NxButton(20, 100 - 5, 60, 20);
o->box(FL_THIN_UP_BOX);
o->callback(timeEnd_callback, this);
m_pTimeEnd = o;
o->movable(false);
timeWindow->add(o);
// m_pDetails_TimeBox = o;
}
{
NxButton *o = new NxButton(20, 135 - 5, 60, 20);
o->box(FL_THIN_UP_BOX);
o->label(" No Time ");
o->callback(timeNone_callback, this);
m_pTimeNone = o;
o->movable(false);
timeWindow->add(o);
}
{
NxHoldBrowser *o = new NxHoldBrowser(145, 32, 30, 157);
o->add("1");
o->add("2");
o->add("3");
o->add("4");
o->add("5");
o->add("6");
o->add("7");
o->add("8");
o->add("9");
o->add("10");
o->add("11");
o->add("12");
o->callback(timeHour_callback, this);
o->has_scrollbar(0);
m_pTimeHour = o;
timeWindow->add(o);
}
{
NxHoldBrowser *o = new NxHoldBrowser(180, 32, 30, 157);
o->add("0");
o->add("5");
o->add("10");
o->add("15");
o->add("20");
o->add("25");
o->add("30");
o->add("35");
o->add("40");
o->add("45");
o->add("50");
o->add("55");
o->has_scrollbar(0);
o->callback(timeHour_callback, this);
m_pTimeMinute = o;
timeWindow->add(o);
}
{
NxButton *o = new NxButton(100, 40 - 5, 20, 20);
o->label("AM");
o->box(FL_FLAT_BOX);
o->callback(timeAM_callback, this);
m_pTimeAM = o;
o->movable(false);
timeWindow->add(o);
}
{
NxButton *o = new NxButton(100, 60 - 5, 20, 20);
o->label("PM");
o->box(FL_FLAT_BOX);
o->callback(timePM_callback, this);
m_pTimePM = o;
o->movable(false);
timeWindow->add(o);
}
{
NxButton *o = new NxButton(POP_BUTTON_X, POP_BUTTON_Y(timeWindow),
BUTTON_WIDTH, BUTTON_HEIGHT, "Done");
o->callback(doneTime_callback, this);
timeWindow->add((Fl_Widget *) o);
}
{
NxButton *o = new NxButton(POP_BUTTON_X + BUTTON_WIDTH + 5,
POP_BUTTON_Y(timeWindow),
BUTTON_WIDTH, BUTTON_HEIGHT, "Cancel");
o->callback(cancelTime_callback, this);
timeWindow->add((Fl_Widget *) o);
}
timeWindow->GetWindowPtr()->end();
}
--- NEW FILE: nxschedule.cxx ---
/*
* Copyright (c) 2003 Century Software, Inc. All Rights Reserved.
*
* This file is part of the PIXIL Operating Environment
*
* The use, copying and distribution of this file is governed by one
* of two licenses, the PIXIL Commercial License, or the GNU General
* Public License, version 2.
*
* Licensees holding a valid PIXIL Commercial License may use this file
* in accordance with the PIXIL Commercial License Agreement provided
* with the Software. Others are governed under the terms of the GNU
* General Public License version 2.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
[...3094 lines suppressed...]
}
*/
}
void
NxSchedule::set_date_picker(NxCalendar * w)
{
pCalendar = w;
}
void
NxSchedule::lookup_callback(Fl_Widget * fl, void *l)
{
NxApp::Instance()->show_window(lookupWindow->GetWindowPtr(),
DEACTIVATE, dayWindow->GetWindowPtr());
lookup_input->value("");
stringCheck->value(false);
dateCheck->value(false);
Fl::focus((Fl_Widget *) lookup_input);
}
More information about the dslinux-commit
mailing list