dslinux/user/pixil/include catlist.h editengine.h editvars.h file.h misc.h nxapp.h nxbox.h nxbrowser.h nxbutton.h nxcalendar.h nxcheckbutton.h nxdb.h nxholdbrowser.h nximage.h nxinput.h nxintinput.h nxmenu_.h nxmenubar.h nxmenubutton.h nxmenuitem.h nxmenuwindow.h nxmloutput.h nxmultilineinput.h nxmultilineoutput.h nxoutput.h nxradioroundbutton.h nxscroll.h nxscrollbar.h nxsecretinput.h nxselectbrowser.h nxslider.h nxtminput.h nxvalueslider.h nxweekcalendar.h nxwindow.h wstring.h

amadeus dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:24:48 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/pixil/include
In directory antilope:/tmp/cvs-serv11916/include

Added Files:
	catlist.h editengine.h editvars.h file.h misc.h nxapp.h 
	nxbox.h nxbrowser.h nxbutton.h nxcalendar.h nxcheckbutton.h 
	nxdb.h nxholdbrowser.h nximage.h nxinput.h nxintinput.h 
	nxmenu_.h nxmenubar.h nxmenubutton.h nxmenuitem.h 
	nxmenuwindow.h nxmloutput.h nxmultilineinput.h 
	nxmultilineoutput.h nxoutput.h nxradioroundbutton.h nxscroll.h 
	nxscrollbar.h nxsecretinput.h nxselectbrowser.h nxslider.h 
	nxtminput.h nxvalueslider.h nxweekcalendar.h nxwindow.h 
	wstring.h 
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it

--- NEW FILE: nximage.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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.                                                
 */


/* Derived from fltk/FL/Fl_Image. */
/* Original copyright:  Copyright 1998-1999 by Bill Spitzak and others. */

#ifndef NXIMAGE_INCLUDED
#define NXIMAGE_INCLUDED

class Fl_Widget;
struct Fl_Menu_Item;

struct NxImage
{
    const uchar *array;
    int w, h, d, ld;
    ulong id;			// for internal use
    int _volatile_data;
    FL_EXPORT NxImage(const uchar * bits, int W, int H, int D = 3, int LD =
		      0):array(bits), w(W), h(H), d(D), ld(LD), id(0)
    {
	_volatile_data = 0;
    }
    FL_EXPORT ~ NxImage();
    FL_EXPORT void label(Fl_Widget *);
    FL_EXPORT void label(Fl_Menu_Item *);
    FL_EXPORT void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0);
    FL_EXPORT void draw(int X, int Y)
    {
	draw(X, Y, w, h, 0, 0);
    }
    FL_EXPORT void setvdata(int flag)
    {
	_volatile_data = flag;
    }
};

#endif

--- NEW FILE: wstring.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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.                                                
 */


//  Definition of a string class (wstring)...

#ifndef STRINGCLASS_H

#define STRINGCLASS_H 1

#include <string.h>
#include <stdlib.h>
#include <ctype.h>

#include "editvars.h"

#ifndef WIN32
#ifndef strlwr
inline void
strlwr(char *string)
{
    while (string && *string) {
	if (isupper(*string))
	    *string = tolower(*string);
	string++;
    }
}


#endif /*  */
#ifndef strupr
inline void
strupr(char *string)
{
    while (string && *string) {
	if (islower(*string))
	    *string = toupper(*string);
	string++;
    }
}


#endif /*  */
#endif /*  */
class CLASSEXPORT wString
{
  protected:static char dummy[2];
    // dummy string for if allocation fails...
    char *buffer;		// the buffer where the string is stored
    long BufferCapacity;	// how much it can hold without growing, one less than allocated byte count
    long BufferLength;		// length of the string currently in the buffer
    void Initialize(const char *init, long size);
  public:  wString()
    {
	Initialize("", 12);
    };
    wString(const wString & str)
    {
	Initialize((const char *) str.buffer, str.BufferCapacity);
    };
    wString(const char *init)
    {
	Initialize(init, (init) ? strlen(init) : 4);
    };
    wString(const char *init, long size)
    {
	Initialize(init, size);
    };
    wString(const char *init, long start, long length, bool stripit = TRUE);	// for cutting strings out of fields
    wString(char c, int nRepeat);
    ~wString();
    const char *Get() const
    {
	if (buffer)
	    return buffer;
	else
	    return dummy;
    };
    long Length() const
    {
	return BufferLength;
    };
    long Capacity() const
    {
	return BufferCapacity;
    };
    bool AlmostFull() const
    {
	return (BufferCapacity < (BufferLength + 4));
    };
    wString & Strip();
    wString & Grow(long amount = 10);
    wString Extract(long position, long length, bool cutit = FALSE);
    wString Cut(long position, long length)
    {
	return Extract(position, length, TRUE);
    };
    wString Copy(long position, long length)
    {
	return Extract(position, length, FALSE);
    };
    wString & Paste(long position, wString & str) {
	return InsertAt(position, str.buffer);
    };
    wString & Paste(long position, const char *str) {
	return InsertAt(position, str);
    };
    wString GetWordAt(long position) const;
    wString & InsertAt(long where, char character);
    wString & InsertAt(long where, const char *words);
    wString & DeleteAt(long where, long howmany = 1);
    wString & ChopAt(long limit, wString * remainder =
		     (wString *) NULL, bool special = false);
    wString & WrapAt(long limit, wString * remainder = (wString *) NULL);
    void RecalculateLength()
    {
	BufferLength = strlen(buffer);
    }
    void SSet(const char *value);
    void Shrink();		// trim unused allocation space
    char &LastCharacter() const
    {
	return buffer[BufferLength - 1];
    };
    friend wString operator+(const wString & str1, const wString & str2)
    {
	return str1 + str2.Get();
    };
    RCLDLL friend wString operator+(const char *str1, const wString & str2);
    RCLDLL friend wString operator+(const wString & str1, const char *str2);
    friend wString operator-(const wString & str1, const wString & str2)
    {
	return (str1 - str2.Get());
    };
    RCLDLL friend wString operator-(const wString & str1, const char *str2);
    wString & operator+=(const wString & str);	// concatenate
    wString & operator+=(char c);	// concatenate a character
    char &operator[] (long index)
    {
	return ((index < BufferLength) ? (buffer[index]) : buffer[0]);
    };				// array index operator
    long operator<(const char *str) const
    {
	return (strcmp(buffer, str) < 0);
    };
    long operator>(const char *str) const
    {
	return (strcmp(buffer, str) > 0);
    };
    long operator==(const char *str) const
    {
	return (strcmp(buffer, str) == 0);
    };
    wString & operator=(const char *str) {
	SSet(str);
	return (*this);
    };
    RCLDLL wString & wString::operator=(const wString & str)
    {
	SSet(str.buffer);
	return (*this);
    }
    wString & operator=(const unsigned char *str) {
	SSet((const char *) str);
	return *this;
    };
    operator    const char *() const
    {
	return Get();
    };
    wString & ToUpper() {
	strupr(buffer);
	return *this;
    };
    wString & ToLower() {
	strlwr(buffer);
	return *this;
    };
    long operator!=(const char *str) const
    {
	return !(*this == str);
    };
    long operator<=(const char *str) const
    {
	return !(*this > str);
    };
    long operator>=(const char *str) const
    {
	return !(*this < str);
    };
};


#endif /*  */

--- NEW FILE: editengine.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 EDITCLASS_H

#define EDITCLASS_H 1

#include <stdio.h>

#include "editvars.h"
#include "wstring.h"

//
//  Here are the commands that the editor engine understands.  Most
//  of these take no arguments at all, some take a single character,
//  some take a pointer to a string, etc.

enum EditorCommandTypes
{
    INSERT_CHARACTER,		// insert argument character at cursor
    DELETE_CHARACTER,		// delete character under cursor
    BACKSPACE_CHARACTER,	// backspace one character
    MOVE_LEFT,			// cursor movement
    MOVE_RIGHT,
    MOVE_UP,
    MOVE_DOWN,
    MOVE_SOL,			// move to start of line
    MOVE_EOL,			// move to end of line
    MOVE_TOF,			// move to start of document
    MOVE_BOF,			// move to bottom of document
    MOVE_LEFT_WORD,		// move by words
    MOVE_RIGHT_WORD,
    MOVE_ABSOLUTE_ROW,		// move to absolute line, column
    MOVE_ABSOLUTE_COLUMN,
    CLEAR_ALL,			// wipe out buffer
    MARK_BEGIN,			// mark beginning of region
    CLEAR_MARKS,		// remove region marks
    MARK_END,			// mark end of region
    DELETE_REGION,		// delete region (NOT to clipboard)
    CUT_REGION,			// cut marked region out of document (to clipboard)
    COPY_REGION,		// copy region into document
    PASTE_REGION,		// paste clipboard into document at cursor
    REPLACE_REGION,		// replace marked region with clipboard
    SET_IGNORE_CASE,		// sets ignore case flag true/false
    SET_REPLACEMENT_TEXT,	// set text to use in search/replace
    FIND,			// search/replace operations
    FIND_REPLACE,		//
    INDENT,			// indent to next tab stop
    OUTDENT,			// outdent one position
    PARAGRAPH,			// start new paragraph
    REFORMAT,			// reformat text to different width
    APPEND_CLIPBOARD,		// append clipboard contents to end of document
    INSERT_STRING,		// insert a string of characters at cursor
    REPLACE_CHARACTER,		// overstrike character under cursor
    INSERT_STRING_MOVE,		// insert string of characters, move cursor to end of it...
    SET_SEARCHWHOLE		// search whole words only
};

struct EditPosition
{
    long Row;
    long Column;
};

//
//  This is the low-level editor engine.  It doesn't concern itself with
//  what a character looks like, where you are on the screen, etc.  It just knows
//  about the document in the edit buffer.  This CAN be used without
//  a display -- just feed it the proper commands and it can be driven to
//  do whatever you would do with the keyboard.
//


RCLDLL void SortPositions(EditPosition & first, EditPosition & last);


class CLASSEXPORT EditorEngine
{
  protected:
    wString ReplacementText;	// string to use in replace operations
    rclError EditStatus;	// consider this a warn/fatal type thing
    rclError LastResult;	// while this is most recent action's return code
    struct EditPosition Cursor;	// current editor cursor position
    struct EditPosition BlockStart;	// start of marked block of text
    struct EditPosition BlockEnd;	// end of marked block of text
    short CurrentIndent;	// current indent position
    short Width;		// how wide the lines can be before wordwrap
    short *TabStops;		// tab stop settings, if any
    unsigned long Flags;	// various edit flags (see below)
    long MaxChars;		// maximum number of characters to accept
    long MaxLines;		// maximum number of lines to accept
    long CharCount;		// current number of characters in the buffer
    long LineCount;		// current number of lines in the buffer
    bool HasChanged;		// TRUE if text has been changed
    bool _ReadOnly;		// TRUE if text has been flagged as Read only
    bool LastFindStatus;	// whether most recent search found a match or not.
    wString **Lines;		// dynamic array of pointers to string objects
    bool last_wrapped;		// flag for whether last action caused a line wrap or reformat
    bool DeleteChar;		// flag for wether a character is being deleted or not
    bool Special;		// flag to mark for special move cursor right
  protected:
    // make sure region start, end are in proper order
    void SortRegion()
    {
	SortPositions(BlockStart, BlockEnd);
    }
    virtual void CheckLineFit();
    virtual short MeasureTextWidth(const char *t);
    virtual short MeasureTextHeight(const char *t);
  public:
    EditorEngine(short editwidth, bool readonly = FALSE, unsigned long flags =
		 0, long maxch = 0, long maxlin = 0);
    virtual ~ EditorEngine();
    rclError Status() const
    {
	return EditStatus;
    }
    rclError LastError() const
    {
	return LastResult;
    }
    wString GetLine(long whichline) const;
    long GetLineCount() const
    {
	return LineCount;
    }
    long CursorRow() const
    {
	return Cursor.Row;
    }
    long CursorColumn() const
    {
	return Cursor.Column;
    }
    long SetMaxChar(long val)
    {
	long oldval = MaxChars;
	if (CharCount > val)
	    return (-1);
	MaxChars = val;
	return (oldval);
    }
    rclError Command(EditorCommandTypes command, long argument = 0);
    rclError Command(EditorCommandTypes command, const char *argument);
    rclError MoveTo(long row, long col);
    rclError SetTabs(short *tabs);
    rclError ChangeWidth(short newwidth)
    {
	Width = newwidth;
	return Command(REFORMAT, (long) newwidth);
    };
    rclError LoadFrom(const char *buffer);
    rclError SaveTo(char *buffer);
    rclError LoadFrom(FILE * infile);
    rclError SaveTo(FILE * outfile);
    rclError InsertCharacter(char character);
    rclError ReplaceCharacter(char character);
    rclError DeleteCharacter();
    rclError BackSpaceCharacter();
    rclError DeleteToEOL();
    rclError MoveCursor(EditorCommandTypes Command, long argument);
    rclError Clear();
    void IdentifyRegion(EditPosition & start, EditPosition & end);
    void ConstrainCursor();
    rclError CopyRegion(bool cut);
    rclError CopyRegionTo(char *copybuffer);	// DOES NOT CHECK BUFFER SIZE!
    rclError DeleteRegion();
    rclError PasteRegion(bool replace);
    rclError AppendClip();
    rclError FindPhrase(const char *word, bool replace, bool replaceall = 0);
    rclError ReformatDocument(short wide);
    virtual rclError ReformatParagraph(bool fromfirst = FALSE, bool all = FALSE);	// reformat paragraph from cursor forward
    rclError RemoveLine();	// remove line from document, free its memory
    rclError RemoveLine(long targetline);	// remove line from document, free its memory
    rclError InsertLine(long atline = -1, bool AsLast = FALSE);	// insert an empty line into the document IN FRONT OF the current one, or after last one
    rclError InsertLine(const wString & str, long atline = -1, bool AsLast = FALSE);	// insert a line into the document IN FRONT OF the current one, or after last one
    unsigned long GetFlags() const
    {
	return Flags;
    }
    void SetFlags(unsigned long newflags)
    {
	Flags = newflags;
    }
    void FlushClipBoard();
    void CursorPosition(long &row, long &col) const;
    bool & Changed() {
	return HasChanged;
    }
    long GetCharacterCount() const
    {
	return CharCount;
    }
    char GetCharacterAt(long row, long col) const
    {
	return (LineCount
		&& (row <= LineCount)) ? Lines[row]->operator[] (col) : '\0';
    };
    rclError ReplaceLineAt(long line, wString & newstr);
    int FindSelectPos(long line, long *start, long *end);
    long GetSelectionSize();	//return char count in selection, if any
    bool LastFind()
    {
	return LastFindStatus;
    };
    const EditPosition & GetPosition() const
    {
	return Cursor;
    }
    bool ReadOnly()
    {
	return _ReadOnly;
    };
    void ReadOnly(bool state)
    {
	_ReadOnly = state;
    }
    // next line is useful for peeking into a line without making a copy of it as GetLine() does.
    const wString *Line(long whichline) const
    {
	return (whichline >= 0
		&& whichline < LineCount) ? Lines[whichline] : NULL;
    };
    bool wrapped()
    {
	return last_wrapped;
    };
    bool CanUnwrap(long lineno);	// returns TRUE if at least the first word of line lineno will fit on  line lineno-1
    rclError LoadFromFile(const char *fname);
    rclError SaveToFile(const char *fname);
};

enum NewEditorFlags
{
    EF_WARNINGS = (1 << 0),	/* show warnings on limits, etc. */
    EF_FORCELIMITS = (1 << 1),	/* forcibly impose limits (slows editor) */
    EF_LINELIMITS = (1 << 2),	/* use line limits? */
    EF_BYTELIMITS = (1 << 3),	/* use byte limits? */
    EF_IGNORECASE = (1 << 4),	/* ignore case in comparisons if TRUE */
    EF_FREEFORM = (1 << 5),	/* allow freeform cursor movement */
    EF_SEARCHWHOLE = (1 << 6),	// search whole words only
    EF_NOWRAP = (1 << 7)	// word wrap is disabled, typing breaks line at margin and continues
};

enum EditBlockActions
{				// functions available on a marked block
    BLOCK_NOTHING,
    BLOCK_MOVE,
    BLOCK_COPY,
    BLOCK_DELETE,
    BLOCK_APPEND,
};


inline void
EditorEngine::CursorPosition(long &row, long &col) const
{
    row = Cursor.Row;
    col = Cursor.Column;
}

inline rclError
EditorEngine::MoveTo(long row, long col)
{
    Command(MOVE_ABSOLUTE_ROW, row);
    Command(MOVE_ABSOLUTE_COLUMN, col);
    return (LastResult);
}


inline void
EditorEngine::IdentifyRegion(EditPosition & start, EditPosition & end)
{
    start.Row = BlockStart.Row;
    start.Column = BlockStart.Column;
    end.Row = BlockEnd.Row;
    end.Column = BlockEnd.Column;
}


#endif

--- NEW FILE: nxintinput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXINTINPUT_INCLUDED
#define		NXINTINPUT_INCLUDED	1


#include <FL/Fl.H>
#include <FL/Fl_Int_Input.H>

class NxIntInput:public Fl_Int_Input
{
    bool move;
  public:
      NxIntInput(int x, int y, int w, int h, const char * = 0);
    void movable(bool flag)
    {
	move = flag;
    }
    virtual void resize(int x, int y, int w, int h)
    {
	if (move)
	    Fl_Widget::resize(x, y - 1, this->w(), this->h());
    }
};

#endif //      NXINPUT_INCLUDED

--- NEW FILE: nxcalendar.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 NXCALENDAR_H_
#define NXCALENDAR_H_

#include <time.h>
#include <Flek/Fl_Calendar.H>
#include "nxapp.h"
#include "nxwindow.h"

#define POP_BUTTON_X 5
#define POP_BUTTON_Y(_x) ((_x->GetWindowPtr()->h()) - BUTTON_HEIGHT - 10 )

class NxCalendar:public Fl_Group
{
  protected:
    NxApp * p_App;
    Fl_Calendar *m_pDatePickerCalendar;
    //NxPimPopWindow *dateWindow;
    NxPimWindow *dateWindow;
    time_t m_nDatePicked;
    void (*update_function) (NxCalendar * w);
    void (*m_pDatePickerCallback) (Fl_Widget *, void *);
    static void doneDate_callback(Fl_Widget * w, void *l);
    static void cancelDate_callback(Fl_Widget * w, void *l);
    static void todayDate_callback(Fl_Widget * w, void *l);
  public:
    //              NxPimPopWindow *GetDateWindow() { return dateWindow; }
      NxPimWindow * GetDateWindow()
    {
	return dateWindow;
    }
    NxCalendar(NxApp * p, int x, int y, int w, int h, char *s);
    void CalendarUpdate(void (*pf) (NxCalendar * w))
    {
	update_function = pf;
    }
    virtual void update();
    time_t GetPickedDate();
    void SetPickedDate(time_t t);
    void DateCallback(void (*)(Fl_Widget *, void *));
    virtual void MakeDateWindow();
    Fl_Calendar *GetDatePickerCalendar()
    {
	return m_pDatePickerCalendar;
    }
    Fl_Callback *GetDatePickerCB()
    {
	return *m_pDatePickerCallback;
    }
    NxApp *GetApp()
    {
	return p_App;
    }
};
#endif

--- NEW FILE: editvars.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 VARTYPES_H		/* include only once per compile */
#define VARTYPES_H 1

#if defined(WIN32)
#include <dos.h>
#ifndef RCLDLL
#define RCLDLL
#endif /*  */
#else // not Win32
#define RCLDLL
#define CLASSEXPORT
#endif /*  */

#if (FL_MAJOR_VERSION <= 1)
#define FL_API   FL_EXPORT
#endif /*  */

// These are for the editor, but occasionally seem useful elsewhere
#define SOFT_RETURN 0x0D
#define HARD_RETURN 0x0A
#define CARRIAGE_RETURN  0x0D
#define LINE_FEED 0x0A

#ifndef TRUE
#define TRUE    1
#endif /*  */
#ifndef FALSE
#define FALSE   0
#endif /*  */

#ifdef _WINDOWS
#undef RCLDLL
#if defined(RCL_EXPORTS)
#define RCLDLL  __declspec(dllexport)
#else /*  */
#define RCLDLL
#endif /*  */
#endif /*  */

#ifdef WIN32
RCLDLL extern double PowersOfTen[];

#else /*  */
extern double PowersOfTen[];

#endif /*  */
enum ErrorSeverity
{ ERROR_OKAY, ERROR_INFO, ERROR_WARN, ERROR_FAIL,
};

#undef NOERROR
enum rclError
{ NOERROR,			/* everything OK */
    NOMEMORY,			/* out of memory */
    USERCANCEL,			/* user cancelled operation */
    GOTBREAKKEY,		/* user hit a break key */
    ABORTED,			/* operation aborted */
    FILEERROR,			/* a file error occurred */
    BUFFER_OVERFLOW,		/* operation overflowed internal buffers */
    RELOAD,			/* internally used to force data reload */
    SECURITYVIOLATION,		/* unauthorized operation attempted */
    NOCONFIG,			/* can't read config file records */
    CLIPBOARD_EMPTY,		/* nothing in clipboard to operate on */
    NO_REGION,			/* region not marked to operate on */
    RANGE_ERROR,		/* bounds check exceeded */
    LIMITS_FULL_ERROR,		/* preset limits exceeded */
    LICENSE_OK,			/* license is OK for this module */
    NOT_LICENSED,		/* no license for this module */
    LICENSE_EXPIRED,		/* past license date range */
    FORM_COMPLETE,		/* user completed input form */
    WRONG_TYPE,			/* data is not the expected type */
    VMERROR,			/* VM file error */
    INVALID_PARAMETER,		/* bad parameter given for object construction */
    UNKNOWN_USER,		/* can't identify user name */
};

/* Macro to get a random integer within a specified range */

#define getrandom( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
#define DIVIDE(num, by)         (((by) == 0) ? 0 : ((num) / (by)))

#include <math.h>
#ifndef WIN32
#include <cmath>
#ifndef modf
//extern "C" double modf(double, double *);

#endif /*  */
#endif /*  */
inline double
Round(double num, short places)
{
    double intpart, fracpart;
    fracpart = modf(num * PowersOfTen[places], &intpart);
    if (fracpart >= 0.5)
	intpart++;
    return (intpart / PowersOfTen[places]);
}

inline bool
IsZero(double num)
{
    return ((num > -0.005) && (num < 0.005));
}


#endif /*  */

--- NEW FILE: nxbox.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXBOX_INCLUDED
#define		NXBOX_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <stdio.h>

class NxBox:public Fl_Box
{
    int save_h;
    bool move;
    bool resize_;
    bool default_box_;
    Fl_Color box_color_;
  public:
      NxBox(int x, int y, int w, int h, char *l = 0);
      virtual ~ NxBox()
    {
    }

    virtual void draw();
    void movable(bool flag)
    {
	move = flag;
    }
    void default_box(bool flag)
    {
	default_box_ = flag;
    }
    void resize(bool flag)
    {
	resize_ = flag;
    }
    virtual void resize(int x, int y, int w, int h)
    {
	if (resize_) {
	    int new_h;
	    if (h == save_h)
		new_h = save_h;
	    else
		new_h = h - (this->y() - y) - 6;

	    if (move)
		Fl_Widget::resize(x, y, w, h /*new_h */ );
	    else
		Fl_Widget::resize(this->x(), this->y(), this->w(), new_h);
	}

    }
    void box_color(Fl_Color col)
    {
	box_color_ = col;
    }
};

#endif //      NXBOXINCLUDED

--- NEW FILE: catlist.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 __CAT_H
#define __CAT_H

#include "nxdb.h"

#include <FL/Fl.H>
#include "nxmenubutton.h"


class NxCategoryList:public NxMenuButton
{
  private:
    char NxCategoryBuf[200];
  public:
      Fl_Callback * m_Cb;
    char m_CatBuf[200];

      NxCategoryList(int x, int y, int w, int h, NxDb * db, string _dbName);
    void select(Fl_Callback * c)
    {
	m_Cb = c;
    }
    FL_EXPORT int add(const char *);
    void label(char *szLabel);
    char *label();
    char *get_category_buf()
    {
	return NxCategoryBuf;
    }
    void set_category_buf(char *cat_buf);
    void set_value();
};

#endif

--- NEW FILE: misc.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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_

void remove_end_spaces(char *, char *);

#endif

--- NEW FILE: nxmultilineoutput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXMULTILINEOUTPUT_INCLUDED
#define		NXMULTILINEOUTPUT_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Multiline_Output.H>

class NxMultilineOutput:public Fl_Multiline_Output
{
  public:
    NxMultilineOutput(int x, int y, int w, int h, const char * = 0);
};

#endif //      NXMULTILINEOUTPUT_INCLUDED

--- NEW FILE: nxwindow.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 NXWINDOW_H
#define NXWINDOW_H

#include <string.h>

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Box.H>

#include <nxdb.h>
#include <nxmenubar.h>
#include <nxapp.h>
#include <nxbutton.h>
#include <nxoutput.h>
#include <nxinput.h>
#include <nxoutput.h>
#include <nxscroll.h>

#include <catlist.h>

#include <Flek/Fl_Toggle_Tree.H>

// Default Category List Ini File
#define NX_INIPATH "./nxad"

struct menu_cb_struct
{
    Fl_Group *grp;
    NxMenuBar *menu;
};

enum
{ WINDOW, MENU };

// Normal PIM Window with Menu and Category List

class NxEditCategory;

class NxWindow:public Fl_Window
{
  public:
    NxWindow(int x, int y, int w, int h, char *l = 0):Fl_Window(x, y, w, h, l)
    {
	this->resizable(this);
    }
    NxWindow(int w, int h, char *l = 0):Fl_Window(w, h, l)
    {
	this->resizable(this);
    }

    virtual void resize_notify(int X, int Y, int W, int H)
    {
	//printf("resize_notify to H = %d\n", H);
	NxApp::Instance()->resize_notify(0, 0, W, H);

    }

};

#define PIM_WINDOW 0
#define PIMP_WINDOW 1

class NxDoubleWindow:public Fl_Double_Window
{

    int type;
    int save_h;

  public:
      NxDoubleWindow(int x, int y, int w, int h, char *l =
		     0):Fl_Double_Window(x, y, w, h, l)
    {
	this->resizable(this);
	type = -1;
	save_h = h;
    }
    void WinType(int _type)
    {
	type = _type;
    }
    int WinType()
    {
	return type;
    }

    virtual void resize_notify(int X, int Y, int W, int H)
    {

	int dy;

	//printf("NxDoubleWindow::resize_notify\t%d, %d, %d, %d\n",X, Y, W, H);

	this->damage(FL_DAMAGE_ALL);

	switch (type) {

	case PIM_WINDOW:

	    if ((X == x()) && (Y == y()) && (W == w()) && (H == h()))
		return;

	    if (parent() == NULL)	// Always resize top-level windows
		size(this->w(), H);
	    else if ((H + this->y()) <= parent()->h()) {	// Resize if fits within parent.
		size(this->w(), H);
	    } else if ((H + this->y()) == parent()->h())
		size(this->w(), H);
	    else if ((h() + y()) > parent()->h())	// If > parent, fit within parent
		size(this->w(), parent()->h() - y());

	    redraw();

	    break;

	case PIMP_WINDOW:

	    // Always center PIM_POP_WINDOWS to parent windows
	    dy = (parent()->h() - H) / 2;

	    if (dy == Y)
		return;

	    this->resize(this->x(), dy, this->w(), save_h);
	    break;

	default:
	    size(W, H);
	    break;

	}			// switch

    }				// resize_notify()

};

class NxPimWindow
{

  private:

    NxDoubleWindow * pim_window;
    Fl_Group *grp;
    menu_cb_struct *menu_bar;
    char *title;
    NxDb *catDb_;

    NxEditCategory *edit_category_window;
    static void hideButtons_cb(Fl_Widget * fl, void *o);
    static void hideMenuBar_cb(Fl_Widget * fl, void *o);

    void MakeEditCategoryWindow(NxDb *, string, string,
				void (*)(const char *));
  public:

    ////////////////////////////////////////////////////////////////////////////////
    // Constructors

    // Default NxPimWindow Constructor: menu bar, category screens, and database.
      NxPimWindow(char *_title, Fl_Menu_Item * menu_item, NxDb * catDb,
		  string _catDbName, string _noteDbName,
		  void (*update_items) (const char *category));

    // Size All
      NxPimWindow(Fl_Menu_Item * menu_item, NxDb * catDb, string _catDbName,
		  string _noteDbName,
		  void (*update_items) (const char *category), int x, int y,
		  int w, int h, int menu_x, int menu_y, int menu_w,
		  int menu_h, int cl_x, int cl_y, int cl_w, int cl_h,
		  char *nx_inipath);

    // Menu bar only
      NxPimWindow(char *_title, Fl_Menu_Item * menu_item, int type);

    // Size Window Only or Menu Only
    // Where type == WIND or TYPE = MENU
      NxPimWindow(Fl_Menu_Item * menu_item, NxDb * catDb, string _catDbName,
		  string _noteDbName,
		  void (*update_items) (const char *category), int x, int y,
		  int w, int h, int type);

    // Size Category List Only
      NxPimWindow(Fl_Menu_Item * menu_item, NxDb * catDb, string _catDbName,
		  string _noteDbName,
		  void (*update_items) (const char *category), int cl_x,
		  int cl_y, int cl_w, int cl_h, char *nx_inipath);

    // Window only
      NxPimWindow(int x, int y, int w, int h);


      virtual ~ NxPimWindow()
    {
	delete menu_bar;
    }

    // Methods
    NxDoubleWindow *GetWindowPtr();
    void add(Fl_Widget * w);
    void show();
    NxButton *menu_button;
    NxMenuButton *_menu;
    NxMenuBar *menu;
    NxCategoryList *category_list;
    NxDoubleWindow *GetEditCategoryWindowPtr();
    NxEditCategory *GetEditCategoryPtr()
    {
	return edit_category_window;
    }
    NxDoubleWindow *get_pim_window()
    {
	return pim_window;
    }
    void set_pim_window(NxDoubleWindow * w)
    {
	pim_window = w;
    }

};

// PIM Popup Window
class NxPimPopWindow
{

  private:
    NxDoubleWindow * pimp_window;

  public:
    // Constructors
    NxPimPopWindow(char *title,
		   Fl_Color title_color =
		   NxApp::Instance()->getGlobalColor(APP_FG), int x =
		   10, int y = (W_H / 3), int w = W_W - 20, int h = 114);

      NxPimPopWindow(int x = (W_W / 3), int y = (W_H / 3), int w =
		     (W_W / 2), int h = 230);

    // Methods
    NxDoubleWindow *GetWindowPtr();
    void add(Fl_Widget * w);

};


#define MAX_NAME_SIZE 10

class NxPimWindow;
class NxPimPopWindow;

class NxEditCategory:public NxPimWindow
{
    NxDoubleWindow *pim_window;
    NxCategoryList *menu_list_;
    NxDb *cat_db_;
    field *cat_field_;
    ndxfile *cat_ndx_;
    fildes *cat_des_;
    field *note_field_;
    ndxfile *note_ndx_;
    fildes *note_des_;
    NxScroll *category_list_;
    Fl_Toggle_Tree *category_tree_;
    NxPimWindow *show_win_;
    NxPimPopWindow *new_cat_win_;
    NxPimPopWindow *rename_cat_win_;
    NxPimPopWindow *delete_cat_win_;
    NxInput *new_cat_input_;
    NxInput *rename_cat_input_;
    NxButton *done_button_;
    NxButton *new_button_;
    NxButton *rename_button_;
    NxButton *delete_button_;
    static FL_EXPORT void list_cb(Fl_Widget *, void *);
    static FL_EXPORT void done_cb(Fl_Widget *, void *);
    static FL_EXPORT void new_cb(Fl_Widget *, void *);
    static FL_EXPORT void rename_cb(Fl_Widget *, void *);
    static FL_EXPORT void delete_cb(Fl_Widget *, void *);
    static FL_EXPORT void delete_cat_cb(Fl_Widget *, void *);
    static FL_EXPORT void done_new_cat_cb(Fl_Widget *, void *);
    static FL_EXPORT void cancel_new_cat_cb(Fl_Widget *, void *);
    static FL_EXPORT void done_rename_cat_cb(Fl_Widget *, void *);
    static FL_EXPORT void cancel_rename_cat_cb(Fl_Widget *, void *);
    static FL_EXPORT void delete_yes_cat_cb(Fl_Widget *, void *);
    static FL_EXPORT void delete_no_cat_cb(Fl_Widget *, void *);
    Fl_Pixmap *folderSmall_;
    string catdb_name_;
    string notedb_name_;
    void rename_cat_update(char *, char *);
    void new_cat_update(char *new_value);
    NxEditCategory *g_NxEditCatWin;
  public:
      NxPimWindow * get_show_window()
    {
	return show_win_;
    }
    NxInput *get_new_cat_input()
    {
	return new_cat_input_;
    }
    NxInput *get_rename_cat_input()
    {
	return rename_cat_input_;
    }
    NxPimPopWindow *get_new_cat_window()
    {
	return new_cat_win_;
    }
    NxPimPopWindow *get_rename_cat_window()
    {
	return rename_cat_win_;
    }
    NxPimPopWindow *get_delete_cat_window()
    {
	return delete_cat_win_;
    }
    Fl_Toggle_Tree *get_category_tree()
    {
	return category_tree_;
    }
    NxDb *get_cat_db()
    {
	return cat_db_;
    }
    field *get_cat_field()
    {
	return cat_field_;
    }
    ndxfile *get_cat_ndx()
    {
	return cat_ndx_;
    }
    fildes *get_cat_des()
    {
	return cat_des_;
    }
    field *get_note_field()
    {
	return note_field_;
    }
    ndxfile *get_note_ndx()
    {
	return note_ndx_;
    }
    fildes *get_note_des()
    {
	return note_des_;
    }
    NxScroll *get_category_list()
    {
	return category_list_;
    }
    void set_show_window(NxPimWindow * pim_win)
    {
	show_win_ = pim_win;
    }
    void set_menu_list(NxCategoryList * menu_list)
    {
	menu_list_ = menu_list;
    }
    NxCategoryList *get_menu_list()
    {
	return menu_list_;
    }
    string get_catdb_name()
    {
	return catdb_name_;
    }
    string get_notedb_name()
    {
	return notedb_name_;
    }
    Fl_Pixmap *get_folder_pix()
    {
	return folderSmall_;
    }
    NxEditCategory(NxDb * catDb, string, string, void (*)(const char *) = 0);
    void add_items(Fl_Toggle_Tree * t);
    void clear_tree();
};

#endif

--- NEW FILE: nxcheckbutton.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXCHECKBUTTON_INCLUDED
#define		NXCHECKBUTTON_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Check_Button.H>

#define CHECK_W 25
#define CHECK_H 25

class NxCheckButton:public Fl_Check_Button
{

    bool move;

  public:
      NxCheckButton(int x, int y, char *l = 0);
      NxCheckButton(int x, int y, int w, int h, char *l = 0);
    virtual void draw(void);

    void movable(bool flag)
    {
	move = flag;
    }
    virtual void resize(int x, int y, int w, int h)
    {
	if (move)
	    Fl_Widget::resize(x, y - 1, this->w(), this->h());
    }

};

#endif //      NXCHECKBUTTON_INCLUDED

--- NEW FILE: nxbrowser.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXBROWSER_INCLUDED
#define		NXBROWSER_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Browser.H>
#include <stdio.h>

class NxBrowser:public Fl_Browser
{

    int save_h;
    bool move;

  public:
      NxBrowser(int x, int y, int w, int h, const char * = 0);

    void movable(bool flag)
    {
	move = flag;
    }

    virtual void resize(int x, int y, int w, int h)
    {
	int new_h;

	if (h == save_h)
	    new_h = save_h;
	else {
	    new_h = h - (this->y() - y) - 5;
	}

	printf("h%d, new_h%d, save_h%d\n", h, new_h, save_h);

	if (move)
	    Fl_Browser::resize(x, y, w, new_h);
	else
	    Fl_Browser::resize(this->x(), this->y(), w, new_h);
    }

};

#endif //      NXBROWSER_INCLUDED

--- NEW FILE: file.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 FILE_H_
#define FILE_H_

/* 31 Dec 95*/
/*
 * file.h - file struct defs
 */

/* 875 */
#define MAXRECSIZ 2048		/* maximum record size */
#define BLKSIZ	1024		/* buffer block size */
#define BLKSHFT	10		/* BLKSIZ shift factor */
#define BLKMSK	01777		/* block mask */
#define RECOFF	2		/* offset of first record in block 0 */
#define APPEND	(-1)		/* to append, putrec( APPEND, &file, rbuf) */

#if 0
#define get16(addr)		(*(short *)addr)
#define put16(addr,val)		*(short *)(addr) = (val)
#define get32(addr)		((long)(*(long *)addr))
#define put32(addr,val)		*(long *)(addr) = (val)
#else
int get16(char *addr);
void put16(char *addr, unsigned short val16);
long get32(char *addr);
void put32(char *addr, long val32);
#endif

struct field
{				/* field specifiers */
    char type;			/* field type - Word(integer), Char, Date */
    char size;			/* # field type units */
    short offset;		/* field offset - filled in at open time */
};

struct fildes
{				/* file structure */
    short fildesc;		/* returned by open(), must be offset 0 */
    char fchanged;		/* set if block 0 needs rewrite */
    char ftype;			/* file type: 1=index, 0=database */
    char *filext;		/* file extension */

    char nfields;		/* # fields */
    struct field *fieldp;	/* field type, length */
    struct ndxfile *ndxfp;	/* index file list */
    short nrecs;		/* # records, read from disk */
    short recsiz;		/* record size, calc'd at open time */
    short currec;		/* current record, 1..nrecs */
    char eof;			/* end of file, currec undefined */
    long flags;			/* flags: 0x0 = 1 to mark delete */
};

struct ndxfile
{				/* index file, first 4 fields match fildes */
    short fildesc;		/* returned by open(), must be offset 0 */
    char fchanged;		/* set if block 0 needs rewrite */
    char ftype;			/* file type: 1=index, 0=database */
    char *filext;		/* file extension */

    char keylen;		/* index key size (Char only) */
    short curoff;		/* key # in curblk */
    short curblk;		/* currency leaf node block # */
    short maxkeys;		/* max keys per block =2n */
};

struct buffer
{				/* incore block buffer */
    short blkno;		/* block # */
    struct fildes *fptr;	/* file ptr */
    short usecnt;		/* lru clock value */
    char buf[BLKSIZ];		/* the buffer */
    char changed;		/* modified flag */
};

#define NUSEFILES	3
struct usefile
{				/* inuse file structure */
    struct fildes *fp;		/* use file */
    short recno;		/* buffer record no. */
    char rbuf[MAXRECSIZ];	/* record buffer */
    char uchanged;		/* modified flag */
};

union w
{				/* replace() parm 2 */
    short word;
    char *ptr;
    long lword;
};

/* use.c*/
void use(int fileno, struct fildes *fp, struct ndxfile *nfp);
char *val(int var);
short ival(int var);
long lval(int var);
void replace(int var, union w newval);
void store(void *dst, int var);
int find(int fileno, char *key);
void udelrec(int fileno);
char *fcopy(char *src, char *dst, int len);

/* db.c*/
int dbcreat(struct fildes *fp, char *name);
int dbopen(struct fildes *fp, char *name);
void dbclose(struct fildes *fp);
void dbsave(struct fildes *fp);

/* blkio.c*/
int recerased(struct fildes *fp);
int recdeleted(struct fildes *fp);
int getrec(int recno, struct fildes *fp, char *recbuf);
int putrec(int recno, struct fildes *fp, char *recbuf);
struct buffer *getblk(int blk, struct fildes *fp);
void putblk(struct buffer *bp);
struct buffer *newblk(struct fildes *fp);
struct buffer *lockb(struct buffer *bp);
void unlock(struct buffer *bp);
void dbinit(int maxbufs);
unsigned int umin(unsigned int a, unsigned int b);

/* index.c*/
int search(char *key, struct ndxfile *fp, int mode);
int Delete(char *key, int rec, struct ndxfile *fp);
int next(struct fildes *fp);
int prev(struct fildes *fp);
int gotop(struct fildes *fp);
int gobot(struct fildes *fp);
int gotorec(struct fildes *fp, int rec);

#ifndef fatal
void fatal(int);
#endif

#endif

--- NEW FILE: nxslider.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXSLIDER_INCLUDED
#define		NXSLIDER_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Slider.H>
#include <FL/Fl_Valuator.H>

class NxSlider:public Fl_Valuator
{

    float slider_size_;
    float slider_size_min_;
    uchar slider_;
    FL_EXPORT void _NxSlider();
    FL_EXPORT void draw_bg(int, int, int, int);
    bool movable_;


  protected:
    int handle(int);

  public:
    void slider_hor_lines(int x, int y, int w, int h, int W, Fl_Color c);
    void slider_ver_lines(int x, int y, int w, int h, int W, Fl_Color c);
    int scrollvalue(int windowtop, int windowsize, int first, int totalsize);


      NxSlider(int x, int y, int w, int h, const char *l = 0);
    void draw(int x, int y, int w, int h);
    void draw();

    FL_EXPORT void bounds(double a, double b);
    float slider_size() const
    {
	return slider_size_;
    }
    FL_EXPORT void slider_size(double v);
    Fl_Boxtype slider() const
    {
	return (Fl_Boxtype) slider_;
    }
    void slider(Fl_Boxtype c)
    {
	slider_ = c;
    }
    FL_EXPORT int handle(int, int, int, int, int);

    void movable(bool flag)
    {
	movable_ = flag;
    }

    void resize(int x, int y, int w, int h)
    {
	if (movable_) {
	    Fl_Valuator::resize(x, y, w, h);
	}
    }

};				// end of NxSlider::NxSlider()

#endif //      NXSLIDER_INCLUDED

--- NEW FILE: nxscrollbar.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 __NXSCROLLBAR_H
#define __NXSCROLLBAR_H

#include "nxslider.h"

class NxScrollbar:public NxSlider
{
    int linesize_;
    int pushed_;
    FL_EXPORT void draw();
    FL_EXPORT int handle(int);
    static FL_EXPORT void timeout_cb(void *);
    FL_EXPORT void increment_cb();

  public:

  public:
      NxScrollbar(int x, int y, int w, int h, const char *l = 0);

    int value()
    {
	return int (NxSlider::value());
    }
    int value(int position, int size, int top, int total)
    {
	return scrollvalue(position, size, top, total);
    }
    int linesize() const
    {
	return linesize_;
    }
    void linesize(int i)
    {
	linesize_ = i;
    }



};

#endif

--- NEW FILE: nxscroll.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXSCROLL_INCLUDED
#define		NXSCROLL_INCLUDED	1

#include <FL/Fl_Group.H>
#include "nxscrollbar.h"
#include <FL/Fl_Scrollbar.H>

class NxScroll:public Fl_Group
{
    int save_h;
    bool move;
    bool resize_;
    int xposition_, yposition_;
    int width_, height_;
    int oldx, oldy;
    static FL_EXPORT void hscrollbar_cb(Fl_Widget *, void *);
    static FL_EXPORT void scrollbar_cb(Fl_Widget *, void *);
    FL_EXPORT void fix_scrollbar_order();
    static FL_EXPORT void draw_clip(void *, int, int, int, int);
    FL_EXPORT void bbox(int &, int &, int &, int &);

  protected:
      FL_EXPORT void draw();

  public:
      NxScrollbar scrollbar;
    NxScrollbar hscrollbar;

    void movable(bool flag)
    {
	move = flag;
    }
    void resize(bool flag)
    {
	resize_ = flag;
    }
    FL_EXPORT void resize(int, int, int, int);
    FL_EXPORT int handle(int);

    enum
    {				// values for type()
	HORIZONTAL = 1,
	VERTICAL = 2,
	BOTH = 3,
	ALWAYS_ON = 4,
	HORIZONTAL_ALWAYS = 5,
	VERTICAL_ALWAYS = 6,
	BOTH_ALWAYS = 7
    };

    int xposition() const
    {
	return xposition_;
    }
    int yposition() const
    {
	return yposition_;
    }
    FL_EXPORT void position(int, int);

    NxScroll(int x, int y, int w, int h, const char *l = 0);
};				// end of NxSlider::NxScroll()

#endif //      NXSCROLL_INCLUDED

--- NEW FILE: nxbutton.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXBUTTON_INCLUDED
#define		NXBUTTON_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Button.H>
#include <stdio.h>

class NxButton:public Fl_Button
{

  public:
    NxButton(int x, int y, int w, int h, char *l = 0);
    void activate(void);	// Overridden activate function
    void deactivate(void);	// Overridden deactivate function
    int getactive()
    {
	return active;
    }				// Returns the active status

    void movable(bool flag)
    {
	move = flag;
    }

    virtual void resize(int x, int y, int w, int h)
    {

	if (move) {

	    int new_y;
	    if (y == save_y)
		new_y = save_y;
	    else
		new_y = y - int ((this->h() / 2) - 0.5);

	    Fl_Widget::resize(x, new_y, this->w(), this->h());

	}

    }

  private:
    int active;			// Flag to determine a "fake" limited active status
    bool move;
    int save_y;

  protected:
    void drawButtonCode(int x, int y, int w, int h, Fl_Color c);
    void draw(void);		// Overridden draw function
    int handle(int event);	// Overridden handle function
};

#endif //      NXBUTTON_INCLUDED

--- NEW FILE: nxmenubutton.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXMENUBUTTON_INCLUDED
#define		NXMENUBUTTON_INCLUDED

#include <FL/Fl.H>
#include "nxmenu_.h"
#include "nxapp.h"
#include <stdio.h>

class NxMenuButton:public NxMenu_
{
    bool move;			// default behavor is move=false;
    int scrollsize;
  public:
      NxMenuButton(int x, int y, int w, int h, char *l = 0, int scroll_size =
		   4);
    virtual void draw();
    const NxMenuItem *popup();
    const NxMenuItem *popup(int xx, int yy);
    virtual int handle(int e);
    void movable(bool flag)
    {
	move = flag;
    }
    virtual void resize(int x, int y, int w, int h)
    {
	if (move)
	    Fl_Widget::resize(x, y, w, this->h());
    }
};

#endif //      NXMENUBUTTON_INCLUDED

--- NEW FILE: nxinput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXINPUT_INCLUDED
#define		NXINPUT_INCLUDED	1


#include <FL/Fl.H>
#include <FL/Fl_Input.H>

class NxInput:public Fl_Input
{
    bool move;
  public:
      NxInput(int x, int y, int w, int h, const char * = 0);
    void movable(bool flag)
    {
	move = flag;
    }
    virtual void resize(int x, int y, int w, int h)
    {
	if (move)
	    Fl_Widget::resize(x, y - 1, this->w(), this->h());
    }
};

#endif //      NXINPUT_INCLUDED

--- NEW FILE: nxoutput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXOUTPUT_INCLUDED
#define		NXOUTPUT_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Output.H>

class NxOutput:public Fl_Output
{
    bool move;
  public:
      NxOutput(int x, int y, int w, int h, const char * = 0);
    void movable(bool flag)
    {
	move = flag;
    };
    virtual void resize(int x, int y, int w, int h)
    {
	if (move)
	    Fl_Widget::resize(x, y - 1, this->w(), this->h());
    }

};

#endif //      NXOUTPUT_INCLUDED

--- NEW FILE: nxmenuwindow.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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_Menu_Window_H
#define Nx_Menu_Window_H

#include <FL/Fl_Single_Window.H>

class NxMenuWindow:public Fl_Single_Window
{
    enum
    { NO_OVERLAY = 128 };
  public:
      FL_EXPORT void show();
    FL_EXPORT void erase();
    FL_EXPORT void flush();
    FL_EXPORT void hide();
    int overlay()
    {
	return !(flags() & NO_OVERLAY);
    }
    void set_overlay()
    {
	clear_flag(NO_OVERLAY);
    }
    void clear_overlay()
    {
	set_flag(NO_OVERLAY);
    }
    FL_EXPORT ~ NxMenuWindow();
    NxMenuWindow(int W, int H, const char *l = 0)
    : Fl_Single_Window(W, H, l)
    {
    }
    NxMenuWindow(int X, int Y, int W, int H, const char *l = 0)
    : Fl_Single_Window(X, Y, W, H, l)
    {
    }
};

#endif

--- NEW FILE: nxmenu_.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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_Menu__H
#define Nx_Menu__H

#ifndef Fl_Widget_H
#include <FL/Fl_Widget.H>
#endif
#include <FL/Fl_Menu_Item.H>
#include "nxmenuitem.h"

class NxMenu_:public Fl_Widget
{

    NxMenuItem *menu_;
    const NxMenuItem *value_;

  protected:

      uchar down_box_;
    uchar textfont_;
    uchar textsize_;
    uchar textcolor_;
    uchar alloc;

  public:
      FL_EXPORT const NxMenuItem *picked(const NxMenuItem *);

    FL_EXPORT NxMenu_(int, int, int, int, const char * = 0);
      FL_EXPORT ~ NxMenu_();

    const NxMenuItem *test_shortcut()
    {
	return picked(menu()->test_shortcut());
    }
    FL_EXPORT void global ();

    const NxMenuItem *menu() const
    {
	return menu_;
    }
    FL_EXPORT void menu(const NxMenuItem * m);
    FL_EXPORT void menu(const Fl_Menu_Item * m);
    FL_EXPORT void copy(const NxMenuItem * m, void *user_data = 0);
    FL_EXPORT int add(const char *, int shortcut, Fl_Callback *, void * =
		      0, int = 0);
    int add(const char *a, const char *b, Fl_Callback * c, void *d =
	    0, int e = 0)
    {
	return add(a, fl_old_shortcut(b), c, d, e);
    }
    FL_EXPORT int size() const;
    FL_EXPORT void clear();
    FL_EXPORT int add(const char *);
    FL_EXPORT void replace(int, const char *);
    FL_EXPORT void remove(int);
    void shortcut(int i, int s)
    {
	menu_[i].shortcut(s);
    }
    void mode(int i, int x)
    {
	menu_[i].flags = x;
    }
    int mode(int i) const
    {
	return menu_[i].flags;
    }

    const NxMenuItem *mvalue() const
    {
	return value_;
    }
    int value() const
    {
	return value_ - menu_;
    }
    FL_EXPORT int value(const NxMenuItem *);
    int value(int i)
    {
	return value(menu_ + i);
    }
    const char *text() const
    {
	return value_ ? value_->text : 0;
    }
    const char *text(int i) const
    {
	return menu_[i].text;
    }

    Fl_Font textfont() const
    {
	return (Fl_Font) textfont_;
    }
    void textfont(uchar c)
    {
	textfont_ = c;
    }
    uchar textsize() const
    {
	return textsize_;
    }
    void textsize(uchar c)
    {
	textsize_ = c;
    }
    Fl_Color textcolor() const
    {
	return (Fl_Color) textcolor_;
    }
    void textcolor(uchar c)
    {
	textcolor_ = c;
    }

    Fl_Boxtype down_box() const
    {
	return (Fl_Boxtype) down_box_;
    }
    void down_box(Fl_Boxtype b)
    {
	down_box_ = b;
    }

    // back compatability:
    Fl_Color down_color() const
    {
	return selection_color();
    }
    void down_color(uchar c)
    {
	selection_color(c);
    }
};

#endif

--- NEW FILE: nxapp.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 NXAPP_H
#define NXAPP_H

#define MAX_WIN 255

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Hold_Browser.H>

#include <Flek/Fl_Toggle_Tree.H>

#include <pixil_config.h>

#include "nxdb.h"		// databases

#ifdef NANOX
#include <nano-X.h>
#endif

#include <string>
#include <vector>

#ifdef CONFIG_PAR

extern "C"
{
#include <par/par.h>
}

#endif

#include <stdio.h>

//
// CONSTANTS
//

#ifdef CONFIG_PAR

extern int getGblParInt(char *cat, char *pref);
extern void getGblParStr(char *cat, char *pref, char *text, int len);

// Default Window Button Size
#define W_X getGblParInt("appsizes", "w_x")
#define W_Y getGblParInt("appsizes", "w_y")
#define W_W getGblParInt("appsizes", "w_w")
#define W_H getGblParInt("appsizes", "w_h")

     // Default Menu Button Size
#define MB_X getGblParInt("appsizes", "mb_x")
#define MB_Y getGblParInt("appsizes", "mb_y")
#define MB_W getGblParInt("appsizes", "mb_w")
#define MB_H getGblParInt("appsizes", "mb_h")

     // Default Menu Size
#define MENU_X getGblParInt("appsizes", "menu_x")
#define MENU_Y getGblParInt("appsizes", "menu_y")
#define MENU_W getGblParInt("appsizes", "menu_w")
#define MENU_H getGblParInt("appsizes", "menu_h")

     // Default Category List Size
#define CL_X getGblParInt("appsizes", "cl_x")
#define CL_Y getGblParInt("appsizes", "cl_y")
#define CL_W getGblParInt("appsizes", "cl_w")
#define CL_H getGblParInt("appsizes", "cl_h")

     // BUTTONS
#define BUTTON_X getGblParInt("appsizes", "button_x")
#define BUTTON_Y getGblParInt("appsizes", "button_y")
#define BUTTON_WIDTH  getGblParInt("appsizes", "button_w")
#define BUTTON_HEIGHT getGblParInt("appsizes", "button_h")

     // FONTS
#define DEFAULT_LABEL_FONT getGblParInt("appfonts", "lbl_font")
#define DEFAULT_LABEL_SIZE getGblParInt("appfonts", "lbl_size")
#define DEFAULT_TEXT_FONT getGblParInt("appfonts", "txt_font")
#define DEFAULT_TEXT_SIZE getGblParInt("appfonts", "txt_size")
#define DEFAULT_BIG_FONT getGblParInt("appfonts", "big_font")
#define DEFAULT_BIG_SIZE getGblParInt("appfonts", "big_size")
#define DEFAULT_SMALL_SIZE getGblParInt("appfonts", "sm_size")
#define DEFAULT_SMALL_FONT getGblParInt("appfonts", "sm_font")

#else				/* CONFIG_PAR */

#define W_X 0
#define W_Y 0
#define W_W 240
#define W_H 282

#define MB_X 8
#define MB_Y 6
#define MB_W 80
#define MB_H 15

#define MENU_X 1
#define MENU_Y 4
#define MENU_W 238
#define MENU_H 25

#define CL_X 147
#define CL_Y 6
#define CL_W 85
#define CL_H 15

#define BUTTON_X 8
#define BUTTON_Y 264
#define BUTTON_WIDTH 60
#define BUTTON_HEIGHT 15

#define DEFAULT_LABEL_FONT 8
#define DEFAULT_LABEL_SIZE 12
#define DEFAULT_TEXT_FONT 8
#define DEFAULT_TEXT_SIZE 12
#define DEFAULT_BIG_FONT 9
#define DEFAULT_BIG_SIZE 16
#define DEFAULT_SMALL_FONT 15
#define DEFAULT_SMALL_SIZE 6

#endif				/* CONFIG_PAR */

#define SMALL_BLK 512
#define BIG_BLK   1024

// FLNX-Colosseum IPC
#define MAX_CLIENTS 255
#define MAX_LENGTH 4096
#define TOKEN "^"

// year formats
#define SHORT_YEAR 0x0001
#define LONG_YEAR  0x0002

// Windows
enum
{ NONE, DEACTIVATE, ACTIVATE };

typedef struct about_
{
    char title[50];
    char copyright[50];
    char author[50];
    char date[20];
    char version[10];
}
about;

// NxApp Global Colors
enum NxApp_Color
{
    APP_BG = 0,
    APP_FG,
    APP_SEL,
    BUTTON_FACE,
    BUTTON_TEXT,
    BUTTON_PUSH,
    BUTTON_3D_LITE,
    BUTTON_3D_DARK,
    HILIGHT,
    HILIGHT_TEXT,
    HILIGHT_LITE,
    HILIGHT_DARK,
    TITLE_FG,
    TITLE_BG,
    SCROLL_FACE,
    SCROLL_LITE,
    SCROLL_DARK,
    SCROLL_TRAY,
    RADIO_FILL,
    EDITOR_BG,
    EDITOR_FG,
    EDITOR_SEL
};

#define MAX_CLR_ATTRIB 22

struct sync_db_struct
{
    NxDb *db;
    field *pField;
    string str_dbName;
    int table_num;
    int size;
    int *file_fields;
};

// Implement NxApp as Singleton pattern.
class NxApp
{

  private:
    int saveX, saveY, saveW, saveH;
    int nextSyncState;
    int appSyncState;
    int exitApp;

  public:
    int noguisearch_flag;
    static NxApp *Instance();	/* Global Access Point */

  protected:
      NxApp(char *app = 0);
      virtual ~ NxApp();
    void SyncDb(char *new_msg);

    // FLNX-Colosseum IPC
  public:
    void IPCError(int err, char *errMsg);	/* Error codes from Colosseum */
    int StartApp(char *_appName, unsigned char *args = 0, int flags =
		 0, int timeout = 0);
    int ExecuteShow();
    int ExecuteNoGui();
    int Add_Fd(char *_appName, void (*cb) (int, void *), void *o = 0);
    void Remove_Fd(int fd);
    int Find_Fd(char *_appName);
    int Read_Fd(char *readMsg, int *length);
    int Write_Fd(int fd, char *writeMsg, int length);
    int VerifyClient(char *client);
    static void _ClientIPCHandler(int fd, void *o);
    virtual void ClientIPCHandler(int fd, void *o, int ipc_id = -1)
    {
    }
    void ServerIPCHandler(int fd, int ipc_id, void *o);
    int GetDateString(char *buf, const struct tm *tm, int size, int format);
    bool ValidMsgId(short int msg_id);

    // PIM database synchronization
    /////////////////////////////////////////////////////////////////////////////////////

  private:
    vector < sync_db_struct > v_SyncDB;
    int cur_db;
    int cur_row;
    int cur_table;
    int total_rows;
    int rows[1024];
    int cur_table_size;
    sync_db_struct *c_db_struct;
    void GetRowData(int &flags, vector < string > &data, string & key);
    void GetTableSchema(vector < char >&col_type, vector < int >&col_size);
    bool SaveRowData(const vector < string > &vmessages);
    bool CheckTableSchema(const vector < string > &vmessages);
    void UpdateFlags();
    void DoError(int err, int ipc);
    void ResetSync(void);

    int agent_ipc;
    int app_ipc;
  protected:
    virtual void Refresh()
    {
    }

  public:
    // This methods puts the names of each database to synchronize
    // into the vstr_SyncDB vector<string>.
    int GetKey(NxDb * db, char *db_name, int key_field);
    void SyncRegisterDB(NxDb * db, field * pField, string str_dbName,
			int table_num, int *file_fields = NULL, int size = 0)
    {
	sync_db_struct s;


	if (NULL != file_fields) {
	    s.size = size;
	    s.file_fields = new int[size];
	    memcpy(s.file_fields, file_fields, size * sizeof(int));
	} else {
	    s.size = 0;
	    s.file_fields = NULL;
	}
	s.db = db;
	s.pField = pField;
	s.str_dbName = str_dbName;
	s.table_num = table_num;
	v_SyncDB.push_back(s);
    }


  private:
    int fd;
    char *winTitle;
    char *appName;
    int nextClient;
    char *clientList[MAX_CLIENTS];

  private:
    static NxApp *_instance;
#ifdef NANOX
    GR_WINDOW_ID check_for_keyboard(GR_WINDOW_ID wid);
#endif
    int launch_keyboard(int, int, int, int);

  private:
    string keyboard_path_;
    string keyboard_maps_;
    string keyboard_size_;
    Fl_Window *window[MAX_WIN];
    Fl_Window *catlist_window;
    int cur_size;
    void *cat_ptr;
    bool title_running;
    bool keyboard_running;
    about about_app;
    Fl_Window *shown_window;
    Fl_Window *about_window;
    static bool paste_ok_;
    int exitOnSearch;

    static void hide_about_cb(Fl_Widget * fl, void *o);

    // Global Colors
    static Fl_Color global_colors[MAX_CLR_ATTRIB];
    Fl_Color globalColor(unsigned long c);

  protected:
    int NxApp::colorsFromPAR();

  public:
    static Fl_Color GlobalColor(NxApp_Color nc);

    Fl_Color getGlobalColor(NxApp_Color nc);

    static char *strup(const char *str1, int size);
    static char *strdown(const char *str1, int size);
    static bool searchFile(const char *str, const char *file);
    static Fl_Widget *g_PasteTarget;
    static Fl_Widget *undoTarget;
    static int fl_editor_type;

    void hide_all_windows();
    virtual void show_window(Fl_Window * w = 0, int type =
			     NONE, Fl_Window * w_target = 0);
    void add_window(Fl_Window * w);
    void resize_notify(int X, int Y, int W, int H);

    // Callbacks  
    static void undo_callback(Fl_Widget * fl, void *o);
    static void copy_callback(Fl_Widget * fl, void *o);
    static void pasteTarget_callback(Fl_Widget * fl, void *o = 0);
    static void paste_callback(Fl_Widget * fl, void *o);
    static void cut_callback(Fl_Widget * fl, void *o);
    static void keyboard_callback(Fl_Widget * fl, void *o);

    void set_catlist_window(Fl_Window * w);
    void set_keyboard(int argc, char *argv[]);
    Fl_Window *get_catlist_window();

    Fl_Window **get_window_list()
    {
	return window;
    }
    Fl_Window *get_shown_window()
    {
	return shown_window;
    }
    void set_shown_window(Fl_Window * win)
    {
	shown_window = win;
    }
    Fl_Window *get_about_window()
    {
	return about_window;
    }
    void set_about_window(Fl_Window * win)
    {
	about_window = win;
    }

    void set_about(about);
    about get_about()
    {
	return about_app;
    }
    static void show_about(Fl_Widget *, void *);

    int get_cur_size()
    {
	return cur_size;
    }

    // Default fonts
    static void DefaultFont(Fl_Widget * widget);

    void def_font(Fl_Widget * widget);
    void def_font(Fl_Input * input);
    void def_font(Fl_Output * output);
    void big_font(Fl_Output * output);
    void def_font(Fl_Menu_Button * mb);
    void def_font(Fl_Menu_Bar * mb);
    void def_font(Fl_Hold_Browser * hb);

    static void DefaultFont(Fl_Toggle_Tree * tree);
    void def_font(Fl_Toggle_Tree * tree);

    static void DefaultFont(void);
    void def_font();
    void def_small_font();
};

#endif

--- NEW FILE: nxtminput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXTMINPUT_INCLUDED
#define		NXTMINPUT_INCLUDED	1

/* System header files */
#include <time.h>


/* Local header files */
#include <FL/Fl_Widget.H>
#include <FL/Fl_Input.H>
#include <nxapp.h>


/* Typedef, macros, enum/struct/unions definitions */
#define			MAX_UNITS		4	// Maximum number of units (HH:MM:SS:[am/pm])

//const char                            *dayzn[2] = {{"AM"}, {"PM"}};                   // Array of either am or pm
const short max_val[3] = { {23}, {59}, {59} };	// Max values per unit (23 = hours, 59 = min/sec)


/* Forward declarations */
class NxTmUnit;

/* Class definitions */
class NxTmInput:public Fl_Widget
{
  private:
    char _tmstring[2 + 1 + 2 + 1 + 2 + 1 + 2 + 1];	// String for time
    int _nunits;		// Actual number in use
    void draw();		// Over-ridden draw function

  public:
      NxTmUnit * Units[MAX_UNITS];	// Maximum number of units

    char *GetTime(void);	// Returns the time in a char *
    void GetTime(struct tm *);	// Returns the time in a tm struct
    int GetUnits()
    {
	return (_nunits);
    }				// Returns the number of units
    void SetUnits(int num);	// Sets the _nunits value
    void SetTime(char *tm);	// Set the time from a ##:##:## string
    void SetTime(struct tm *);	// Set the time from a tm struct

    void hide();		// Hides everything
    void show();		// Shows all

    // Constructor
    NxTmInput(int x, int y, int w, int h, char *l = 0, int nfld = 4);	// Default constructor
};				// end of NxTmInput class

class NxTmUnit:public Fl_Input
{
  private:
    NxTmInput * parent;		// Parent of this unit

  public:
    void SetParent(NxTmInput * par)
    {
	parent = par;
    }				// Sets the parent
    int handle(int);		// Over-ridden handle() event

    NxTmUnit(int x, int y, int w, int h, const char *l =
	     0):Fl_Input(x, y, w, h, l)
    {
    };
};				// end of NxTmUnit class

#endif //      NX_TMINPUTINLUCDED

--- NEW FILE: nxmenubar.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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_Menu_Bar.H>
#include <FL/Fl_Group.H>

class NxMenuBar:public Fl_Menu_Bar
{

  private:
    Fl_Group * grp;

  public:
    NxMenuBar(int x, int y, int w, int h, Fl_Group * _grp = 0);
    virtual void resize(int x, int y, int w, int h)
    {
	Fl_Widget::resize(x, y, this->w(), this->h());
    }

  protected:
    int handle(int);

};

--- NEW FILE: nxsecretinput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXSECRETINPUT_INCLUDED
#define		NXSECRETINPUT_INCLUDED	1


#include <FL/Fl.H>
#include <FL/Fl_Secret_Input.H>

class NxSecretInput:public Fl_Secret_Input
{
  public:
    NxSecretInput(int x, int y, int w, int h, const char * = 0);
    virtual void resize(int x, int y, int w, int h)
    {
	Fl_Widget::resize(x, y - 1, this->w(), this->h());
    }
};

#endif //      NXSECRETINPUT_INCLUDED

--- NEW FILE: nxholdbrowser.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXHOLDBROWSER_INCLUDED
#define		NXHOLDBROWSER_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Hold_Browser.H>

class NxHoldBrowser:public Fl_Hold_Browser
{
    int save_h;
    bool move;

  public:
      NxHoldBrowser(int x, int y, int w, int h, const char * = 0);
    void movable(bool flag)
    {
	move = flag;
    };
    virtual void resize(int x, int y, int w, int h)
    {
	int new_h;

	if (save_h == 0)
	    save_h = h;

	if (h == save_h)
	    new_h = save_h;
	else
	    new_h = h - (this->y() - y) - 5;

	if (move) {
	    // Hacked to avoid the label on top from merging with other widgets
	    if (align() & FL_ALIGN_TOP && new_h != save_h) {
		y += this->labelsize();
		new_h -= this->labelsize();
	    }			// end of if
	    Fl_Hold_Browser::resize(x, y, w, new_h);
	}			// end of if
	else {
	    Fl_Hold_Browser::resize(this->x(), this->y(), w, new_h);
	}			// end of else

    }
};

#endif //      NXHOLDBROWSER_INCLUDED

--- NEW FILE: nxselectbrowser.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXSELECTBROWSER_INCLUDED
#define		NXSELECTBROWSER_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Select_Browser.H>

class NxSelectBrowser:public Fl_Select_Browser
{
  public:
    NxSelectBrowser(int x, int y, int w, int h, char *l = 0);
};				// end of NxSelectBrowser::NxSelectBrowser()

#endif //      NXSELECTBROWSER_INCLUDED

--- NEW FILE: nxmenuitem.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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_Menu_Item_H
#define Nx_Menu_Item_H

#ifndef Fl_Widget_H
// used to get the Fl_Callback typedefs:
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Widget.H>
#endif

class NxMenu_;

struct NxMenuItem
{
    const char *text;		// label()
    int shortcut_;
    Fl_Callback *callback_;
    void *user_data_;
    int flags;
    uchar labeltype_;
    uchar labelfont_;
    uchar labelsize_;
    uchar labelcolor_;

    // advance N items, skipping submenus:
    FL_EXPORT const NxMenuItem *next(int = 1) const;
    NxMenuItem *next(int i = 1)
    {
	return (NxMenuItem *) (((const NxMenuItem *) this)->next(i));
    }

    // methods on menu items:
    const char *label() const
    {
	return text;
    }
    void label(const char *a)
    {
	text = a;
    }
    void label(Fl_Labeltype a, const char *b)
    {
	labeltype_ = a;
	text = b;
    }
    Fl_Labeltype labeltype() const
    {
	return (Fl_Labeltype) labeltype_;
    }
    void labeltype(Fl_Labeltype a)
    {
	labeltype_ = a;
    }
    Fl_Color labelcolor() const
    {
	return (Fl_Color) labelcolor_;
    }
    void labelcolor(uchar a)
    {
	labelcolor_ = a;
    }
    Fl_Font labelfont() const
    {
	return (Fl_Font) labelfont_;
    }
    void labelfont(uchar a)
    {
	labelfont_ = a;
    }
    uchar labelsize() const
    {
	return labelsize_;
    }
    void labelsize(uchar a)
    {
	labelsize_ = a;
    }
    Fl_Callback_p callback() const
    {
	return callback_;
    }
    void callback(Fl_Callback * c, void *p)
    {
	callback_ = c;
	user_data_ = p;
    }
    void callback(Fl_Callback * c)
    {
	callback_ = c;
    }
    void callback(Fl_Callback0 * c)
    {
	callback_ = (Fl_Callback *) c;
    }
    void callback(Fl_Callback1 * c, long p = 0)
    {
	callback_ = (Fl_Callback *) c;
	user_data_ = (void *) p;
    }
    void *user_data() const
    {
	return user_data_;
    }
    void user_data(void *v)
    {
	user_data_ = v;
    }
    long argument() const
    {
	return (long) user_data_;
    }
    void argument(long v)
    {
	user_data_ = (void *) v;
    }
    int shortcut() const
    {
	return shortcut_;
    }
    void shortcut(int s)
    {
	shortcut_ = s;
    }
    int submenu() const
    {
	return flags & (FL_SUBMENU | FL_SUBMENU_POINTER);
    }
    int checkbox() const
    {
	return flags & FL_MENU_TOGGLE;
    }
    int radio() const
    {
	return flags & FL_MENU_RADIO;
    }
    int value() const
    {
	return flags & FL_MENU_VALUE;
    }
    void set()
    {
	flags |= FL_MENU_VALUE;
    }
    void clear()
    {
	flags &= ~FL_MENU_VALUE;
    }
    FL_EXPORT void setonly();
    int visible() const
    {
	return !(flags & FL_MENU_INVISIBLE);
    }
    void show()
    {
	flags &= ~FL_MENU_INVISIBLE;
    }
    void hide()
    {
	flags |= FL_MENU_INVISIBLE;
    }
    int active() const
    {
	return !(flags & FL_MENU_INACTIVE);
    }
    void activate()
    {
	flags &= ~FL_MENU_INACTIVE;
    }
    void deactivate()
    {
	flags |= FL_MENU_INACTIVE;
    }
    int activevisible() const
    {
	return !(flags & 0x11);
    }

    // used by menubar:
    FL_EXPORT int measure(int *h, const NxMenu_ *) const;
    FL_EXPORT void draw(int x, int y, int w, int h, const NxMenu_ *, int t =
			0) const;

    // popup menus without using an NxMenu_ widget:
    FL_EXPORT const NxMenuItem *popup(int X, int Y,
				      int scroll_size,
				      const char *title = 0,
				      const NxMenuItem * picked = 0,
				      const NxMenu_ * = 0) const;
    FL_EXPORT const NxMenuItem *pulldown(int X, int Y, int W, int H,
					 int scroll_size,
					 const NxMenuItem * picked = 0,
					 const NxMenu_ * = 0,
					 const NxMenuItem * title = 0,
					 int menubar = 0) const;
    FL_EXPORT const NxMenuItem *test_shortcut() const;
    FL_EXPORT const NxMenuItem *find_shortcut(int *ip = 0) const;

    void do_callback(Fl_Widget * o) const
    {
	callback_(o, user_data_);
    }
    void do_callback(Fl_Widget * o, void *arg) const
    {
	callback_(o, arg);
    }
    void do_callback(Fl_Widget * o, long arg) const
    {
	callback_(o, (void *) arg);
    }

    // back-compatability, do not use:
    int checked() const
    {
	return flags & FL_MENU_VALUE;
    }
    void check()
    {
	flags |= FL_MENU_VALUE;
    }
    void uncheck()
    {
	flags &= ~FL_MENU_VALUE;
    }
    FL_EXPORT int add(const char *, int shortcut, Fl_Callback *, void * =
		      0, int = 0);
    int add(const char *a, const char *b, Fl_Callback * c, void *d =
	    0, int e = 0)
    {
	return add(a, fl_old_shortcut(b), c, d, e);
    }
    FL_EXPORT int size() const;
};

typedef NxMenuItem Nx_Menu;	// back compatability

#endif

--- NEW FILE: nxmloutput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXMLOUTPUT_INCLUDED
#define		NXMLOUTPUT_INCLUDED

#include <FL/Fl.H>
#include <FL/Fl_Multiline_Output.H>

class NxMlOutput:public Fl_Multiline_Output
{
  public:
    NxMlOutput(int x, int y, int w, int h);
    void deactivate();
    void activate();
    void draw();

  private:
    int active;			// Is this widget active

  protected:
    int handle(int event);
};

#endif //      NXMLOUTPUT_INCLUDED

--- NEW FILE: nxradioroundbutton.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXRADIOROUNDBUTTON_INCLUDED
#define		NXRADIOROUNDBUTTON_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Radio_Round_Button.H>


class NxRadioRoundButton:public Fl_Radio_Round_Button
{
  public:
    NxRadioRoundButton(int x, int y, int w, int h, char *l = 0);
    virtual void draw();
    virtual void resize(int x, int y, int w, int h)
    {
	Fl_Widget::resize(x, y - 1, this->w(), this->h());
    }
};

#endif //      NXCHECKBUTTON_INCLUDED

--- NEW FILE: nxvalueslider.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXVALUESLIDER_INCLUDED
#define		NXVALUESLIDER_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Value_Slider.H>

class NxValueSlider:public Fl_Value_Slider
{
  public:
    NxValueSlider(int x, int y, int w, int h, char *l = 0);

};				// end of NxValueSlider::NxValueSlider()

#endif //      NXVALUESLIDER_INCLUDED

--- NEW FILE: nxdb.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 NXDB_H
#define NXDB_H

#ifdef WIN32
#pragma warning(disable:4786)
#endif /*  */
#include <stdio.h>
#include <map>
#include <string>
using namespace std;
extern "C"
{

#include "file.h"
}
typedef map < string, int, less < string > >TDatabase;
typedef
    TDatabase::value_type
    TValue;

#define INT_INDEX 7
#define CHAR_INDEX 5
#define TEMP_DB "/tmp/c0bxztemp"
class NxDb {
  private:TDatabase db;
    int
	dbNum;
    int
	index[255];
    fildes *
	dbDesc[255];
    field *
	dbField[255];
    string path;

    // Register the Database
    void
    Register(string _dbName, fildes * _dbDesc, field * _dbField, int var);
  public:enum t_Flags
    {
	NONE =
	    0x00,
	DELETED =
	    0x01,
	NEW =
	    0x02,
	CHANGED =
	    0x04,
	ERASED =
	    0xF0,
    };
  public:NxDb(int argc, char *argv[]);
    void
    SetPath(const char *c)
    {
	path = c;
    }
    char *
    GetPath()
    {
	char *
	    tmp = (char *)
	    path.
	    c_str();
	return tmp;
    }

    // Basic Database Operations
    int
    Open(string _dbName, fildes * _dbDesc, field * _dbField, int var,
	 int path_flag = 0);
    int
    Close(string _dbName);

    // Creates a totally new Database (note: each instace can only have this one table)
    int
    Create(string _dbName, fildes * _dbDesc, field * _dbField, int var,
	   int path_flag = 0);

    // Basic Record Operations

    // Creates a list of  record numbers matching specific criteria
    // You then use Extract to get specific record numbers
    int
    Select(string _dbName, int *ret, int ret_size, bool bDeleteFlag =
	   false, int flags = -1);
    int
    Select(string _dbName, char *value, int fieldNo, int *ret, int ret_size,
	   bool bDeleteFlag = false);

    // Gets all fields or a specific field from a specific record
    int
    Extract(string _dbName, int recno, int fieldNo, char *ret_buf);
    int
    Extract(string _dbName, int recno, char *ret_buf);

    // Gets a specific field ONLY from a deleted record.
    int
    ExtractDeleted(string _dbName, int recno, int fieldNo, char *ret_buf);

    // Always inserts a new record by setting the NEW bit flag
    void
    Insert(string _dbName, char *record);
    void
    Insert(string _dbName, char *record, int &rec);

    // Makes changes to a record data
    void
    Edit(string _dbName, int recno, char *record);

    // Logically deletes a record
    void
    DeleteRec(string _dbName, int recno);

    // Logically deletes all records in database, if fieldNo == -1
    // OR logically deletes any records containing value in fieldNo.
    void
    Purge(string _dbName, int fieldNo = -1, char *value = 0);

    // Perm. deletes a record
    void
    EraseRec(string _dbName, int recno);

    // Sets Record metadata to flags
    int
    SetFlags(const string _dbName, const int &recno, const int &flags);
    int
    GetFlags(const string _dbName, const int &recno, int &flags);

    // Returns the number of total records in a database
    int
    NumRecs(string _dbName);
    fildes *
    GetFilDes(string _dbName);
    field *
    GetField(string _dbName);
};
void
fatal(int n);

#endif //NXDB_H

--- NEW FILE: nxmultilineinput.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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		NXMULTILINEINPUT_INCLUDED
#define		NXMULTILINEINPUT_INCLUDED	1

#include <FL/Fl.H>
#include <FL/Fl_Multiline_Input.H>

class NxMultilineInput:public Fl_Multiline_Input
{
  public:
    NxMultilineInput(int x, int y, int w, int h, const char * = 0);
};

#endif //      NXMULTILINEINPUT_INCLUDED

--- NEW FILE: nxweekcalendar.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://embedded.centurysoftware.com/gpl/ for GPL licensing       
 * information.                                                         
 *                                                                      
 * See http://embedded.centurysoftware.com/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 NXWEEKCALENDAR_H_
#define NXWEEKCALENDAR_H_

#include "nxcalendar.h"

#define POP_BUTTON_X 5
#define POP_BUTTON_Y(_x) ((_x->GetWindowPtr()->h()) - BUTTON_HEIGHT - 10 )

class NxWeekCalendar:public NxCalendar
{
  protected:
    NxApp * p_App;
    static void thisWeek_callback(Fl_Widget * w, void *l);
  public:
      NxWeekCalendar(NxApp * p, int x, int y, int w, int h, char *s);
    virtual void MakeDateWindow();
    NxApp *GetApp()
    {
	return p_App;
    }
};
#endif




More information about the dslinux-commit mailing list