dslinux/user/pixil/apps/fltk/address Makefile misclist.cxx misclist.h nxad.cxx nxaddress.cxx nxaddress.h
amadeus
dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:24:22 CEST 2006
Update of /cvsroot/dslinux/dslinux/user/pixil/apps/fltk/address
In directory antilope:/tmp/cvs-serv11916/apps/fltk/address
Added Files:
Makefile misclist.cxx misclist.h nxad.cxx nxaddress.cxx
nxaddress.h
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it
--- NEW FILE: nxaddress.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 nxnotepad_h
#define nxnotepad_h
#include <FL/Fl.H>
#include <nxbox.h>
#include <FL/Fl_Window.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.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 <nxwindow.h>
#include <nxscroll.h>
#include <nxinput.h>
#include <nxoutput.h>
#include <nxdb.h>
#include <catlist.h>
#include "misclist.h"
#define APP_NAME "Contacts"
#define CAT_NUM 3
#define SECTION 100
#define CATEGORYS 50
//#define ID 4
#define TEXT 50
#define DBL_TEXT 100
#define DATE 20
#define NOTEDB 100
#define HOME 0
#define WORK 1
#define FAX 2
#define MOBILE 3
#define PAGER 4
#define EMAIL 5
#define WEBPAGE 6
struct NxTodo
{
// Indexes
//char szId[ID];
//char szCategory[CATEGORYS];
int nId; // replacing szId[ID]
int nCat; // replacing szCategory[ID]
char szCategory[CATEGORYS]; // Category label
int nShowDisplay;
// Data
char szLastName[TEXT];
char szFirstName[TEXT];
char szCompany[TEXT];
char szJobTitle[TEXT];
int nDep1;
int nDep2;
int nDep3;
int nDep4;
int nDep5;
int nDep6;
int nDep7;
char szDep1[TEXT];
char szDep2[TEXT];
char szDep3[TEXT];
char szDep4[TEXT];
char szDep5[TEXT];
char szDep6[TEXT];
char szDep7[TEXT];
char szAddress[DBL_TEXT];
char szCity[TEXT];
char szRegion[TEXT]; // State, Province, Town, etc.
char szPostalCode[TEXT]; // ZIP, Postal Code, etc.
char szCountry[TEXT];
char szBDay[DATE];
char szAnniv[DATE];
char szCustom1[TEXT];
char szCustom2[TEXT];
char szCustom3[TEXT];
char szCustom4[TEXT];
char szNoteFile[NOTEDB];
};
class NxAddress:public NxApp
{
////////////////////////////////////////////////////////////////////////////////
// Data Members
private:
NxScroll * note_list;
static bool AllFlag;
static NxDb *db;
static int id;
static int g_EditFlag;
static int g_SearchFlag;
static char *nx_inidir;
// Container Window
static NxWindow *main_window;
// Standard PIM Windows
static NxPimWindow *addr_list_window;
static NxPimWindow *addr_edit_window;
static NxPimWindow *addr_view_window;
// PIM Popup Windows
static NxPimPopWindow *addr_details_window;
static NxPimPopWindow *addr_note_window;
static NxPimPopWindow *addr_dellist_window;
static NxPimPopWindow *addr_deledit_window;
static NxPimPopWindow *addr_delview_window;
static NxPimPopWindow *addr_lookup_window;
static NxPimPopWindow *addr_results_window;
static NxPimPopWindow *addr_custom_window;
static Fl_Editor *g_editor;
// Phone Lookup Methods
static NxInput *lookup_input;
static Flv_Table_Child *results_table;
static NxOutput *results_message;
static NxCategoryList *note_category;
static NxCategoryList *edit_category_list;
static NxCategoryList *view_category_list;
// static NxCategoryList * details_category_list;
static NxCategoryList *cat_list[CAT_NUM];
static Flv_Table_Child *table;
// edit window
static NxInput *edit_lastname;
static NxInput *edit_firstname;
static NxInput *edit_company;
static NxInput *edit_title;
static NxMiscList *edit_misc_list1;
static NxMiscList *edit_misc_list2;
static NxMiscList *edit_misc_list3;
static NxMiscList *edit_misc_list4;
static NxMiscList *edit_misc_list5;
static NxMiscList *edit_misc_list6;
static NxMiscList *edit_misc_list7;
static NxInput *edit_misc1;
static NxInput *edit_misc2;
static NxInput *edit_misc3;
static NxInput *edit_misc4;
static NxInput *edit_misc5;
static NxInput *edit_misc6;
static NxInput *edit_misc7;
static NxInput *editAddress;
static NxInput *editCity;
static NxInput *editRegion;
static NxInput *editPostalCode;
static NxInput *editCountry;
static NxInput *edit_bday;
static NxInput *edit_anniv;
static NxInput *edit_custom1;
static NxInput *edit_custom2;
static NxInput *edit_custom3;
static NxInput *edit_custom4;
// view window
static NxOutput *viewName;
static NxOutput *viewBusTitle;
static NxOutput *viewCompany;
static NxOutput *viewAddress;
static NxOutput *viewCityRegionPC;
static NxOutput *viewCountry;
static NxOutput *viewWorkPhone;
static NxOutput *viewEMail;
// custom fields window
static NxInput *custom1Input;
static NxInput *custom2Input;
static NxInput *custom3Input;
static NxInput *custom4Input;
// details window
static NxMiscList *details_show_list;
static Fl_Pixmap *address_pixmap;
////////////////////////////////////////////////////////////////////////////////
// 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);
#endif
////////////////////////////////////////////////////////////////////////////////
// Private Callbacks
// addr_list_window callbacks
static void new_callback(Fl_Widget * fl, long l); // New Button
static void view_callback(Fl_Widget * fl, void *o = 0); // Double Click
static void edit_callback(Fl_Widget * fl, long l); // Edit Button
static void delList_callback(Fl_Widget * fl, void *l); // Delete Button
static void yesDelList_callback(Fl_Widget * fl, void *l); // Yes Delete Button
static void noDelList_callback(Fl_Widget * fl, void *l); // No Delete Button
// addr_view_window callbacks
static void doneView_callback(Fl_Widget * fl, long l); // Done Button
// static void edit_callback(Fl_Widget * fl, long l); // Edit Button
// static void delView_callback(Fl_Widget * fl, void * l); // Delete Button
static void yesDelView_callback(Fl_Widget * fl, void *l); // Yes Button
static void noDelView_callback(Fl_Widget * fl, void *l); // No Button
// addr_edit_window callbacks
static void doneEdit_callback(Fl_Widget * fl, long l); // Done Button
static void delEdit_callback(Fl_Widget * fl, void *l); // Delete Button
static void yesDelEdit_callback(Fl_Widget * fl, void *l); // Yes Delete Button
static void noDelEdit_callback(Fl_Widget * fl, void *l); // No Delete Button
static void cancelEdit_callback(Fl_Widget * fl, void *l); // Cancel Button
static void notes_callback(Fl_Widget * fl, void *l); // Notes Button
// addr_lookup_window callbacks
static void searchLookup_callback(Fl_Widget * fl, void *o);
static void cancelLookup_callback(Fl_Widget * fl, void *o);
static void doneLookup_callback(Fl_Widget * fl, void *o);
// addr_details_window callbacks
static void doneDetails_callback(Fl_Widget * fl, void *l); // Done Button
static void cancelDetails_callback(Fl_Widget * fl, void *l); // Cancel Button
//static void delDetails_callback(Fl_Widget* fl, void *l); // Delete Button
// addr_note_window callbacks
static void doneNote_callback(Fl_Widget * fl, long l); // Done Button
// addr_custom_window callbacks
static void doneCustom_callback(Fl_Widget * fl, void *o);
static void cancelCustom_callback(Fl_Widget * fl, void *o);
////////////////////////////////////////////////////////////////////////////////
// Database functions
static char *Record(int id, int cat_id, int show_id,
string last_name, string first_name, string company,
string title, int info1id, int info2id, int info3id,
int info4id, int info5id, int info6id, int info7id,
string info1, string info2, string info3,
string info4, string info5, string info6,
string info7, string address, string city,
string region, string postalCode, string country,
string bday, string anniv, string custom1,
string custom2, string custom3, string custom4,
string note);
static char *Record(int infoid, string info_type, int dummy);
static char *Record(int catid, string cat_name);
static char *CustRecord(int custid, string cust_name);
static int GetCatId(char *szCategory);
// Database Callbacks
static void priority_callback(Fl_Widget * fl, void *l); // Database
static void category_callback(Fl_Widget * fl, void *l); // Database
static void fill_categories();
static void list_callback(Fl_Widget * fl, void *l);
static void set_category(char *szCat);
static void reset_category(char *szCat);
static void clear_table();
static void add_items(Flv_Table_Child * t, const char *szCategory);
static void _fill_view_form(NxTodo * n);
static void _fill_form(NxTodo * n);
static void edit_note(NxTodo * note, int recno);
static void write_note(NxTodo * note);
////////////////////////////////////////////////////////////////////////////////
// Searching
static NxTodo *search(const char *searchVal);
static char *formatString(const NxTodo * note, int pixels);
static void viewRecord(int recno);
static void select_note(NxTodo * note);
private:
static char *szNoteFile;
public:
static char *get_szNoteFile()
{
return szNoteFile;
}
static void set_szNoteFile(char *_szNoteFile)
{
memset(szNoteFile, 0, NOTEDB);
strcpy(szNoteFile, _szNoteFile);
//cout << "set_szNoteFile(): szNoteFile = " << szNoteFile << endl;
}
private:
void make_list_window();
void make_view_window();
void make_edit_window();
void make_details_window();
void make_note_window();
void make_dellist_window();
void make_deledit_window();
void make_delview_window();
void make_lookup_window();
void make_results_window();
void make_custom_window();
static char *strup(const char *str1, int size);
static int compar(NxTodo ** rec1, NxTodo ** rec2);
protected:
virtual void Refresh();
public:
NxAddress(int argc, char *argv[]);
~NxAddress();
Fl_Window *get_main_window();
void show_default_window();
char **GetSearchResults();
////////////////////////////////////////////////////////////////////////////////
// Public menu callbacks
public:
static void dup_callback(Fl_Widget * fl, void *o);
static void delView_callback(Fl_Widget * fl, void *l);
static void lookup_callback(Fl_Widget * fl, void *o);
static void exit_callback(Fl_Widget * fl, void *l);
static void details_callback(Fl_Widget * fl, void *o);
static void custom_callback(Fl_Widget * fl, void *o);
};
#endif
--- NEW FILE: nxaddress.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.
*
[...3907 lines suppressed...]
for (int idx = 0; idx < CAT_NUM; idx++) {
cat_list[idx]->clear();
cat_list[idx]->add("All");
for (int jdx = 1; jdx <= rec_count; jdx++) {
db->Extract(CATEGORY, jdx, 1, ret_buf);
cat_list[idx]->add(ret_buf);
}
cat_list[idx]->label(const_cast < char *>(cat_list[idx]->text(0)));
}
addr_list_window->GetEditCategoryPtr()->clear_tree();
addr_list_window->GetEditCategoryPtr()->add_items(addr_list_window->
GetEditCategoryPtr()->
get_category_tree());
addr_edit_window->GetEditCategoryPtr()->clear_tree();
addr_edit_window->GetEditCategoryPtr()->add_items(addr_edit_window->
GetEditCategoryPtr()->
get_category_tree());
}
--- 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 <nxmenubutton.h>
class NxMiscList:public NxMenuButton
{
public:
Fl_Callback * m_Cb;
char m_CatBuf[25];
NxMiscList(int x, int y, int w, int h);
void select(Fl_Callback * c)
{
m_Cb = c;
}
int value();
void value(int n);
virtual void resize(int x, int y, int w, int h)
{
Fl_Widget::resize(x, y - 1, w, h);
}
};
#endif
--- NEW FILE: nxad.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 "nxaddress.h"
#ifdef SYMBOL_MIPS
#include <signal.h>
void
h_sigusr(int signo)
{
Fl_Window *win = ((NxAddress *) 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 noguisearch_flag = 0;
int
main(int argc, char *argv[])
{
NxAddress addr(argc, argv);
#ifdef SYMBOL_MIPS
signal(SIGUSR1, h_sigusr);
#endif // SYMBOL_MIPS
while (!exit_flag) {
// printf("noguisearch_flag = %d\n", noguisearch_flag);
if ((Fl::wait() == 0)) {
if (!addr.noguisearch_flag) {
break;
}
}
}
return 0;
}
--- NEW FILE: Makefile ---
# apps/address/Makefile
TARGET_CXX=address
SRC=${shell ls *.cxx}
OBJS=${SRC:.cxx=.o}
LIBS=-lpixil-pim
ifeq ($(CONFIG_SYNC),y)
LIBS+=-lpixil-sync
endif
ifeq ($(CONFIG_PAR),y)
LIBS+=-lpar
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"
#include <nxapp.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):
NxMenuButton(x, y, w, h, "")
{
// color(NxApp::Instance()->getGlobalColor(BUTTON_FACE));
// selection_color(NxApp::Instance()->getGlobalColor(APP_SEL));
// labelcolor(NxApp::Instance()->getGlobalColor(BUTTON_TEXT));
// textcolor(NxApp::Instance()->getGlobalColor(BUTTON_TEXT));
// NxApp::Instance()->def_font((Fl_Widget*)this);
align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
add("Home|Work|Fax|Mobile|Pager|E-Mail|Web");
callback(select_callback);
select(0);
}
int
NxMiscList::value()
{
return NxMenuButton::value();
}
void
NxMiscList::value(int n)
{
NxMenuButton::value(n);
int l = strlen(text(n));
memset(m_CatBuf, 0, 25);
strncpy(m_CatBuf, text(n), l);
label(m_CatBuf);
hide();
show();
}
More information about the dslinux-commit
mailing list