/* Notes: Send the PureC portab.h to nowhere land */ #include #include #include #include #include #include #include #include #include "example.h" OBJECT *mdial, *pop; extern int xdesk, ydesk, wdesk, hdesk; int gl_apid; main() { int x, y, w, h, mx, my, dum, btn, mitem; int ed_start; #ifdef MEGAMAX ruby_options.m_alloc = lmalloc; #endif #ifndef NO_GEM_HNDL init_appl2(TRUE, " Ruby-Test", FALSE); #else appl_init(); wind_update(BEG_UPDATE); #endif if (!rsrc_load("EXAMPLE.RSC")) { form_alert(1, "[3][EXAMPLE.RSC not found!][Cancel]"); #ifndef NO_GEM_HNDL exit_appl(); #else appl_exit(); #endif return 0; } rsrc_gaddr(R_TREE, MDIAL, &mdial); rsrc_gaddr(R_TREE, POP, &pop); #ifdef NO_GEM_HNDL ruby_init(); #endif /* Den Ruby-Hook fr die hbscheren '-----'-OBJECTs in Mens und Popups installieren */ install_dash_lines_hook(); /* Die Hooks mssen vor dem Aufruf von rsrc_ruby() oder ruby() installiert werden, da sie sonst nicht zur Anwendung k„men... */ #if 1 rsrc_ruby(); #else ruby(mdial); #endif #if 0 { RUBY_USERBLK *that = (RUBY_USERBLK*)mdial[ MDRADIO1 ].ob_spec.userblk; printf("MPOPBTN: ub_code $%lx, ub_spec $%lx, ub_type $%x \n", that->ub_code, that->ub_spec, that->ub_type); printf(" ruby_magic $%lx, text_offset %d \n", that->ruby_magic, that->text_offset); } #endif wind_update(END_UPDATE); /* let's go.. */ /* !! MultiGEM zuliebe bitte Dialoge in BEG/END_UPDATE hineinpacken */ wind_update(BEG_UPDATE); graf_mouse(ARROW, 0L); graf_mkstate(&mx, &my, &dum, &dum); form_center(mdial, &x, &y, &w, &h); form_dial(FMD_START, x, y, w, h, x, y, w, h); form_dial(FMD_GROW, mx, my, 1, 1, x, y, w, h); objc_draw(mdial, 0, MAX_DEPTH, xdesk, ydesk, wdesk, hdesk); release_time = 100 /*2*evnt_dclick(0, 0)*/; mitem = POPI1; ed_start = MDED1; do { #if 0 int ox, oy; BOOLEAN mo_choose; #endif BOOLEAN bgr_saved; btn = form_do(mdial, ed_start) & 0x7FFF; /* no use for double clicks here... */ switch (btn) { case MDJED1: ed_start = MDED1; break; case MDJED2: ed_start = MDED2; break; case MPOPINFO: /* Popup-Info-Button (Versuch, diesen tastaturbedienbar zu machen...) */ case MPOPBTN: /* Popup-Text-Button */ #if 0 /* so w„re es mit ruby_popup() */ wind_update(BEG_MCTRL); mo_choose = TRUE; objc_offset(mdial, MPOPBTN, &ox, &oy); ruby_popup(pop, 0, ox, oy, 1, 1, FALSE, 0, 0, &mo_choose, &mitem, &dum, &bgr_saved); wind_update(END_MCTRL); #else /* die bessere Variante, die auch in der Bedienung variabler ist und wind_update(BEG/END_MCTRL) selbst schon aufruft */ pop_it_up(mdial, MPOPBTN, MPOPINFO, pop, 0, pop_choose, FALSE, CHECKED, TRUE, 1, 1, btn == MPOPINFO, &mitem, &dum, &bgr_saved); #endif break; case MPOPCIRC: /* Popup-Circle-Button */ pop_it_up(mdial, MPOPBTN, MPOPINFO, pop, 0, pop_next, TRUE, CHECKED, TRUE, 1, 1, FALSE, &mitem, &dum, &bgr_saved); break; } } while (btn != MDCC && btn != MDOK); form_dial(FMD_SHRINK, mx, my, 1, 1, x, y, w, h); form_dial(FMD_FINISH, x, y, w, h, x, y, w, h); wind_update(END_UPDATE); #ifndef NO_GEM_HNDL exit_appl(); #else ruby_exit(); appl_exit(); #endif return 0; } /* -eof- */