OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [MW_0_8_9PRE7/] [mw/] [src/] [demos/] [nxscribble/] [scrib.h] - Diff between revs 673 and 674

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 673 Rev 674
/*
/*
 * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
 * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
 *
 *
 * Copyright © 1999 Keith Packard
 * Copyright © 1999 Keith Packard
 *
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Keith Packard not be used in
 * documentation, and that the name of Keith Packard not be used in
 * advertising or publicity pertaining to distribution of the software without
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Keith Packard makes no
 * specific, written prior permission.  Keith Packard makes no
 * representations about the suitability of this software for any purpose.  It
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 * is provided "as is" without express or implied warranty.
 *
 *
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 * PERFORMANCE OF THIS SOFTWARE.
 */
 */
 
 
#define MWINCLUDECOLORS
#define MWINCLUDECOLORS
#include "nano-X.h"
#include "nano-X.h"
#include "hre_api.h"
#include "hre_api.h"
#include "li_recognizer.h"
#include "li_recognizer.h"
 
 
#define CS_LETTERS     0
#define CS_LETTERS     0
#define CS_DIGITS      1
#define CS_DIGITS      1
#define CS_PUNCTUATION 2
#define CS_PUNCTUATION 2
 
 
#define NUM_RECS    3
#define NUM_RECS    3
#define DEFAULT_REC_DIR         "classifiers"
#define DEFAULT_REC_DIR         "classifiers"
#ifndef REC_DEFAULT_USER_DIR
#ifndef REC_DEFAULT_USER_DIR
#define REC_DEFAULT_USER_DIR    "bin"
#define REC_DEFAULT_USER_DIR    "bin"
#endif
#endif
/*#define REC_DEFAULT_USER_DIR    "/home/greg/net/microwin/src/apps/scribble"*/
/*#define REC_DEFAULT_USER_DIR    "/home/greg/net/microwin/src/apps/scribble"*/
/*#define CLASSIFIER_DIR          ".classifiers"*/
/*#define CLASSIFIER_DIR          ".classifiers"*/
#define DEFAULT_LETTERS_FILE    "letters.cl"
#define DEFAULT_LETTERS_FILE    "letters.cl"
#define DEFAULT_DIGITS_FILE     "digits.cl"
#define DEFAULT_DIGITS_FILE     "digits.cl"
#define DEFAULT_PUNC_FILE       "punc.cl"
#define DEFAULT_PUNC_FILE       "punc.cl"
#define rec_name                "libli_recog.so"
#define rec_name                "libli_recog.so"
 
 
struct graffiti {
struct graffiti {
        recognizer rec[3];     /* 3 recognizers, one each for letters, digits,
        recognizer rec[3];     /* 3 recognizers, one each for letters, digits,
                                  and punctuation */
                                  and punctuation */
        char cldir[200];       /* directory in which the current classifier
        char cldir[200];       /* directory in which the current classifier
                                  files are found */
                                  files are found */
        li_recognizer_train rec_train; /* pointer to training function */
        li_recognizer_train rec_train; /* pointer to training function */
        li_recognizer_getClasses rec_getClasses;
        li_recognizer_getClasses rec_getClasses;
                               /* pointer to the function that lists
                               /* pointer to the function that lists
                                  the characters in the classifier
                                  the characters in the classifier
                                  file. */
                                  file. */
};
};
 
 
typedef struct {
typedef struct {
    /* private state */
    /* private state */
    GR_WINDOW_ID    win;
    GR_WINDOW_ID    win;
    GR_GC_ID        gc;
    GR_GC_ID        gc;
    GR_BOOL         down;           /* mouse is down*/
    GR_BOOL         down;           /* mouse is down*/
    /*GR_WINDOW_ID    lastfocusid;*/    /* last window with focus*/
    /*GR_WINDOW_ID    lastfocusid;*/    /* last window with focus*/
    GR_POINT        *pt;            /* points */
    GR_POINT        *pt;            /* points */
    int             ppasize;
    int             ppasize;
    pen_stroke      ps;
    pen_stroke      ps;
    struct graffiti graf;
    struct graffiti graf;
    int             capsLock;
    int             capsLock;
    int             puncShift;
    int             puncShift;
    int             tmpShift;
    int             tmpShift;
    int             ctrlShift;
    int             ctrlShift;
    int             curCharSet;
    int             curCharSet;
    int             lastchar;
    int             lastchar;
} ScribbleRec, *ScribbleWidget;
} ScribbleRec, *ScribbleWidget;
 
 
ScribbleWidget  create_scribble(void);
ScribbleWidget  create_scribble(void);
void            destroy_scribble(ScribbleWidget w);
void            destroy_scribble(ScribbleWidget w);
void            ActionStart(ScribbleWidget w, int x, int y);
void            ActionStart(ScribbleWidget w, int x, int y);
void            ActionMove(ScribbleWidget w, int x, int y);
void            ActionMove(ScribbleWidget w, int x, int y);
void            ActionEnd(ScribbleWidget w, int x, int y);
void            ActionEnd(ScribbleWidget w, int x, int y);
void            Redisplay (ScribbleWidget w);
void            Redisplay (ScribbleWidget w);
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.