pure-data/src/g_text.c

/* Copyright (c) 1997-1999 Miller Puckette.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */

/* changes by Thomas Musil IEM KUG Graz Austria 2001 */
/* the methods for calling the gui-objects from menu are implemented */
/* all changes are labeled with      iemlib      */

#include <stdlib.h>
#include "m_pd.h"
#include "m_imp.h"

#include "g_canvas.h"
#include <stdio.h>
#include <string.h>
#include <math.h>

#include "g_undo.h"

/* borrowed from RMARGIN and BMARGIN in g_rtext.c */
#define ATOM_RMARGIN
#define ATOM_BMARGIN

#define MESSAGE_CLICK_WIDTH

t_class *text_class;
static t_class *message_class;
static t_class *gatom_class;
static void text_vis(t_gobj *z, t_glist *glist, int vis);
static void text_displace(t_gobj *z, t_glist *glist,
    int dx, int dy);
static void text_getrect(t_gobj *z, t_glist *glist,
    int *xp1, int *yp1, int *xp2, int *yp2);

void canvas_startmotion(t_canvas *x);
int glist_getindex(t_glist *x, t_gobj *y);
void gatom_undarken(t_text *x);

static void glist_nograb(t_glist *x)
{}

/* ----------------- the "text" object.  ------------------ */

    /* add a "text" object (comment) to a glist.  Called without args
    if invoked from the GUI; otherwise at least x and y are provided.  */

void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

/* ----------------- the "object" object.  ------------------ */

void canvas_getargs(int *argcp, t_atom **argvp);

static void canvas_error_couldntcreate(void*x, t_binbuf*b, const char*errmsg)
{}

static void canvas_objtext(t_glist *gl, int xpix, int ypix, int width,
    int selected, t_binbuf *b)
{}

extern int sys_noautopatch;
    /* utility routine to figure out where to put a new text box from menu
    and whether to connect to it automatically */
static void canvas_howputnew(t_canvas *x, int *connectp,
    int *xpixp, int *ypixp, int *indexp, int *totalp)
{}

    /* object creation routine.  These are called without any arguments if
    they're invoked from the gui; when pasting or restoring from a file, we
    get at least x and y. */

void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

/* make an object box for an object that's already there. */

/* iemlib */
void canvas_iemguis(t_glist *gl, t_symbol *guiobjname)
{}

void canvas_bng(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_toggle(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_vslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_hslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_mycnv(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_numbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

/* iemlib */

void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv)
{}

/* ---------------------- the "message" text item ------------------------ */

t_messresponder;

t_message;

static t_class *messresponder_class;

static void messresponder_bang(t_messresponder *x)
{}

static void messresponder_float(t_messresponder *x, t_float f)
{}

static void messresponder_symbol(t_messresponder *x, t_symbol *s)
{}

static void messresponder_list(t_messresponder *x,
    t_symbol *s, int argc, t_atom *argv)
{}

static void messresponder_anything(t_messresponder *x,
    t_symbol *s, int argc, t_atom *argv)
{}

static void message_bang(t_message *x)
{}

static void message_float(t_message *x, t_float f)
{}

static void message_symbol(t_message *x, t_symbol *s)
{}

static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
{}

static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
{}

static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
{}

static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
{}

static void message_addcomma(t_message *x)
{}

static void message_addsemi(t_message *x)
{}

static void message_adddollar(t_message *x, t_floatarg f)
{}

static void message_adddollsym(t_message *x, t_symbol *s)
{}

static void message_click(t_message *x,
    t_floatarg xpos, t_floatarg ypos, t_floatarg shift,
        t_floatarg ctrl, t_floatarg alt)
{}

static void message_tick(t_message *x)
{}

static void message_free(t_message *x)
{}

void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

    /* for the needs of g_editor::glist_dofinderror() */
t_pd *message_get_responder(t_gobj *x)
{}

/* ---------------------- the "atom" text item ------------------------ */

#define ATOM_LABELLEFT
#define ATOM_LABELRIGHT
#define ATOM_LABELUP
#define ATOM_LABELDOWN
#define A_LIST

t_gatom;

    /* prepend "-" as necessary to avoid empty strings, so we can
    use them in Pd messages. */
static t_symbol *gatom_escapit(t_symbol *s)
{}

    /* undo previous operation: strip leading "-" if found.  This is used
    both to restore send, etc, names when loading from a file, and to
    set them from the properties dialog.  In the former case, since before
    version 0.52 '$" was aliases to "#", we also bash any "#" characters
    to "$".  This is unnecessary when reading files saved from 0.52 or later,
    and really we should test for that and only bash when necessary, just
    in case someone wants to have a "#" in a name. */
static t_symbol *gatom_unescapit(t_symbol *s)
{}

static void gatom_redraw(t_gobj *client, t_glist *glist)
{}

static void gatom_senditup(t_gatom *x)
{}

static t_atom *gatom_getatom(t_gatom *x)
{}

static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
{}

static void gatom_bang(t_gatom *x)
{}

static void gatom_float(t_gatom *x, t_float f)
{}

static void gatom_clipfloat(t_gatom *x, t_atom *ap, t_float f)
{}

static void gatom_symbol(t_gatom *x, t_symbol *s)
{}

    /* We need a list method because, since there's both an "inlet" and a
    "nofirstin" flag, the standard list behavior gets confused. */
static void gatom_list(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
{}

static void gatom_reborder(t_gatom *x)
{}

void gatom_undarken(t_text *x)
{}

void gatom_key(void *z, t_symbol *keysym, t_floatarg f)
{}

static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy,
    t_floatarg up)
{}

int rtext_findatomfor(t_rtext *x, int xpos, int ypos);

    /* this is called when gatom is clicked on with patch in run mode. */
static int gatom_doclick(t_gobj *z, t_glist *gl, int xpos, int ypos,
    int shift, int alt, int dbl, int doit)
{}

    /* message back from dialog window */
static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
{}

static int gatom_fontsize(t_gatom *x)
{}

    /* ---------------- gatom-specific widget functions --------------- */
static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
{}

static void gatom_displace(t_gobj *z, t_glist *glist,
    int dx, int dy)
{}

static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
{}

void canvas_atom(t_glist *gl, t_atomtype type,
    t_symbol *s, int argc, t_atom *argv)
{}

void canvas_floatatom(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_symbolatom(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

void canvas_listbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
{}

static void gatom_free(t_gatom *x)
{}

static void gatom_properties(t_gobj *z, t_glist *owner)
{}


/* -------------------- widget behavior for text objects ------------ */

static void text_getrect(t_gobj *z, t_glist *glist,
    int *xp1, int *yp1, int *xp2, int *yp2)
{}

static void text_displace(t_gobj *z, t_glist *glist,
    int dx, int dy)
{}

static void text_select(t_gobj *z, t_glist *glist, int state)
{}

static void text_activate(t_gobj *z, t_glist *glist, int state)
{}

static void text_delete(t_gobj *z, t_glist *glist)
{}

static void text_vis(t_gobj *z, t_glist *glist, int vis)
{}

static int text_click(t_gobj *z, struct _glist *glist,
    int xpix, int ypix, int shift, int alt, int dbl, int doit)
{}

void canvas_statesavers_doit(t_glist *x, t_binbuf *b);
void text_save(t_gobj *z, t_binbuf *b)
{}

    /* this one is for everyone but "gatoms"; it's imposed in m_class.c */
const t_widgetbehavior text_widgetbehavior =;

static const t_widgetbehavior gatom_widgetbehavior =;

/* -------------------- the "text" class  ------------ */

    /* draw inlets and outlets for a text object or for a graph. */
void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
    const char *tag, int x1, int y1, int x2, int y2)
{}

void text_drawborder(t_text *x, t_glist *glist,
    const char *tag, int firsttime)
{}

void glist_eraseiofor(t_glist *glist, t_object *ob, const char *tag)
{}

void text_eraseborder(t_text *x, t_glist *glist, const char *tag)
{}

    /* change text; if T_OBJECT, remake it.  */
void text_setto(t_text *x, t_glist *glist, const char *buf, int bufsize)
{}

    /* this gets called when a message gets sent to an object whose creation
    failed, presumably because of loading a patch with a missing extern or
    abstraction */
static void text_anything(t_text *x, t_symbol *s, int argc, t_atom *argv)
{}

void text_getfont(t_text *x, t_glist *thisglist,
    int *fwidthp, int *fheightp, int *guifsize)
{}


/*
        *fontwidthp =  glist_fontwidth((t_glist *)(x->x_text));
        fontheightp =  glist_fontheight((t_glist *)(x->x_text));
  *guifontsizep = sys_hostfontsize(font, glist_getzoom(x->x_glist));
*/

void g_text_setup(void)
{}