6. Trig Page Creation

6.1. DONE Trig Creation Main

CLOSED: [2020-04-19 Sun 17:24] A new trig page is created with the function page_trig.

<<trig_function_declarations>>=
static void page_trig(monolith_page *pg);
<<trig_functions>>=
static void page_trig(monolith_page *pg)
{
    page_trig_d *trig;
    trig = calloc(1, sizeof(page_trig_d));
    if(trig == NULL) return;
    page_trig_init(pg, trig);
    if(trig_type == 0) page_trig_runtime_init(monolith_page_monolith(pg));
<<trig_assign_callbacks>>
    monolith_page_data_set(pg, trig);
    redraw(trig);
}

6.2. DONE Trig Set Typeflag

CLOSED: [2020-04-19 Sun 17:24]

<<trig_assign_callbacks>>=
monolith_page_type_set(pg, trig_type);

6.3. DONE Trig Open

CLOSED: [2020-04-19 Sun 17:24] When a trig page is opened, the monome state is set.

<<trig_function_declarations>>=
static void trig_open(monolith_page *pg);
<<trig_functions>>=
static void trig_open(monolith_page *pg)
{
    page_trig_d *trig;
    trig = monolith_page_data_get(pg);
    if(trig == NULL) return;
    monolith_page_mstate_recall(trig->mstate);
}
<<trig_assign_callbacks>>=
monolith_page_open_set(pg, trig_open);

6.4. DONE Trig Free

CLOSED: [2020-04-19 Sun 17:24]

<<trig_function_declarations>>=
static void trig_free(monolith_page *pg);
<<trig_functions>>=
static void trig_free(monolith_page *pg)
{
    page_trig_d *trig;
    trig = (page_trig_d *)monolith_page_data_get(pg);
    if(trig == NULL) return;
    page_trig_cleanup(trig);
    free(trig);
}
<<trig_assign_callbacks>>=
monolith_page_free_set(pg, trig_free);

6.5. DONE Trig Press Callback

CLOSED: [2020-04-19 Sun 17:24]

<<trig_function_declarations>>=
static void trig_press(monolith_page *pg, int x, int y, int s);
<<trig_functions>>=
static void trig_press(monolith_page *pg, int x, int y, int s)
{

    if (y == 7 && (x == 0 || x == 1)) {
        page_trig_d *t;
        t = monolith_page_data_get(pg);
        if (s) {
            t->reset_state |= 1 << x;

            if (t->reset_state == 3) {
                t->please_reset = 1;
            }
        } else {
            t->reset_state &= ~(1 << x);
        }
        return;
    }

    if (s) {
        page_trig_d *t;
        t = monolith_page_data_get(pg);
        trig_press_top(t, x, y);
    }
}
<<trig_assign_callbacks>>=
monolith_page_press_set(pg, trig_press);

6.6. TODO Trig Turn Callback

<<trig_function_declarations>>=
static void trig_turn(monolith_page *pg, int s);
<<trig_functions>>=
static void trig_turn(monolith_page *pg, int s)
{
    /* fprintf(stderr, "Trig turn: %d\n", s); */
}
<<trig_assign_callbacks>>=
monolith_page_turn_set(pg, trig_turn);

6.7. TODO Trig Push Callback

<<trig_function_declarations>>=
static void trig_push(monolith_page *pg, int s);
<<trig_functions>>=
static void trig_push(monolith_page *pg, int s)
{
    fprintf(stderr, "Trig push: %d\n", s);
}
<<trig_assign_callbacks>>=
monolith_page_push_set(pg, trig_push);

6.8. TODO Trig Delta Callback

<<trig_function_declarations>>=
static void trig_delta(monolith_page *pg, int n, int delta);
<<trig_functions>>=
static void trig_delta(monolith_page *pg, int n, int delta)
{
    /* fprintf(stderr, "Trig delta: %d, %d\n", n, delta); */
}
<<trig_assign_callbacks>>=
monolith_page_delta_set(pg, trig_delta);



prev | home | next