void MidiDriver_STMIDI::send(uint32 b) { byte status_byte = (b & 0x000000FF); byte first_byte = (b & 0x0000FF00) >> 8; byte second_byte = (b & 0x00FF0000) >> 16; // warning("ST MIDI Packet sent"); switch (b & 0xF0) { case 0x80: // Note Off case 0x90: // Note On case 0xA0: // Polyphonic Key Pressure case 0xB0: // Controller case 0xE0: // Pitch Bend Bconout(3, status_byte); Bconout(3, first_byte); Bconout(3, second_byte); break; case 0xC0: // Program Change case 0xD0: // Aftertouch Bconout(3, status_byte); Bconout(3, first_byte); break; default: fprintf(stderr, "Unknown : %08x\n", (int)b); break; } }
/* Does not seem to be used by Moria */ void endwin() { if (!_curini) return; _curini = 0; delwin(stdscr); delwin(curscr); _movcur(LINES,0); /* Show cursor */ Bconout(2,'\033'); Bconout(2,'e'); }
open_dial(int flag) { static int x,y,w,h; if ((!_AccFlag) || (para.multi==MULTINE)){ if(flag) { strcpy((char *)transfer[BLOCKNUM].ob_spec,"0001"); strcpy((char *)transfer[STATUS].ob_spec,"---"); strcpy((char *)transfer[RETRIES].ob_spec,"0001"); form_center(transfer,&x,&y,&w,&h); form_dial(0,0,0,0,0,x,y,w,h); objc_draw(transfer,0,8,x,y,w,h); } else form_dial(3,0,0,0,0,x,y,w,h); } else { if (flag) { wind_up(0); strcpy(msg,"0001 01 ---"); v_gtext(handle,640-12*8,13,msg); } else wind_up(1); was_full=0;Bconout(2,7); } }
void MidiDriver_STMIDI::sysEx (const byte *msg, uint16 length) { // FIXME: LordHoto doesn't know if this will still work // when sending 264 byte sysEx data, as needed by KYRA, // feel free to revert it to 254 again if needed. if (length > 264) { warning ("Cannot send SysEx block - data too large"); return; } const byte *chr = msg; warning("Sending SysEx Message"); Bconout(3, '0xF0'); for (; length; --length, ++chr) { Bconout(3,((unsigned char) *chr & 0x7F)); } Bconout(3, '0xF7'); }
ssize_t ConsoleHandle::WriteAt(void */*cookie*/, off_t /*pos*/, const void *buffer, size_t bufferSize) { const char *string = (const char *)buffer; size_t i; // be nice to our audience and replace single "\n" with "\r\n" for (i = 0; i < bufferSize; i++) { if (string[i] == '\0') break; if (string[i] == '\n') Bconout(fHandle, '\r'); Bconout(fHandle, string[i]); } return bufferSize; }
/* initscr : initialize the curses package */ WINDOW *initscr() { if (_curini) /* Initialized before */ { wrefresh(curscr); return(NULL); }; _curini = TRUE; curscr = newwin(0,0,0,0); if (curscr == NULL) return(NULL); stdscr = newwin(0,0,0,0); if (stdscr == NULL) return(NULL); /* Clear screen and home cursor */ Bconout(2,'\033'); Bconout(2,'E'); /* Set 'discard EOL mode' : CR + LF needed for new line */ Bconout(2,'\033'); Bconout(2,'w'); /* Hide cursor */ Bconout(2,'\033'); Bconout(2,'f'); _csry = 0; _csrx = 0; return(stdscr); }
ssize_t CharHandle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) { const char *string = (const char *)buffer; int i; // can't seek //XXX: check Bcostat ? for (i = 0; i < bufferSize; i++) { Bconout(fHandle, string[i]); } return bufferSize; }
/* ................................................................ * Handle user interaction with a form in open window `w'. * * Initial conditions are as follows: * w->x is the address of the form. * window is open, with appropriate WINFO rects & coordinates set * form is drawn within window, at correct virtual coordinates * ROOT object of form has correct x,y coordinates * * This routine works just like form_do, but dispatches window * events, redrawing and fixing up the object tree as appropriate, * and maintaining the various rects and coordinates in the WINFO struct. * * Returns exit object selected, |= 0x8000 if double clicked a TOUCHEXIT, * OR -1 if a message was received which couldn't be handled. * In the latter case, the `puntmsg' array is filled with the message buffer * which xform_do() couldn't handle, and the application is responsible for * picking up where xform_do() left off. A cop-out, I know. * * NOTE: form_dial( FMD_START,... ) and form_dial( FMD_FINISH,... ) * should NOT be used with xform_do(). * * User defined objects could cause problems with this routine, as * the boundary of the object may lie outside the window coordinates. * Caveat programmer. */ WORD cdecl xform_do( OBJECT *tree, WORD start_field, WORD puntmsg[] ) { WORD next_obj, edit_obj, idx; BOOLEAN cont, doedit; WORD event; MRETS m; WORD key, clicks; DIRS direction; /* form_keybd */ GRECT rect; cpx_tree = tree; SetAccCloseState( FALSE ); SetWmCloseState( FALSE ); /* * Get the next editable object */ if( start_field == 0 ) next_obj = find_obj( tree, 0, FORWARD ); else next_obj = start_field; edit_obj = 0; cont = TRUE; cursor = FALSE; while( cont ) { /* * Put the cursor in the edit field * Note: This is skipped if there is only one field. */ if( (next_obj != 0) && (edit_obj != next_obj) ) { edit_obj = next_obj; next_obj = 0; doedit = can_edit( tree, edit_obj ); if( doedit && !cursor ) { objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT ); cursor = TRUE; } } wind_update( FALSE ); /* * Wait... */ event = Evnt_multi( MU_KEYBD|MU_BUTTON|MU_MESAG, 2, 1, 1, NULL, NULL, msg, 0L, &m, &key, &clicks ); wind_update( TRUE ); if( EvMessage() ) { switch( MsgType(msg) ) { case AC_OPEN: acc_open( (int *)msg ); break; case WM_TOPPED: case WM_NEWTOP: Wm_Topped( ( int *)msg ); doedit = can_edit( tree, edit_obj ); if( doedit && !cursor ) { objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT ); cursor = TRUE; } break; case WM_SIZED: doedit = can_edit( tree, edit_obj ); /* fall through */ case WM_MOVED: /* if moving, that means we are on top, therefore, cursor is already on */ doedit = can_edit( tree, edit_obj ); if( !doedit ) cursor = FALSE; case WM_REDRAW: case WM_FULLED: case WM_ARROWED: case WM_HSLID: case WM_VSLID: /* redraw 'n' shit */ if( edit_obj && ( msg[0] == WM_REDRAW )) { NoEdit( edit_obj ); rect = ObRect( edit_obj ); objc_offset( tree, edit_obj, &rect.g_x, &rect.g_y ); /* The offsets will take care of the blinking cursor * area that needs to be redraw to erase it. */ rect.g_y -= 3; rect.g_w += 3; rect.g_h += 6; /* Clip the rectangle to the work area of the form.*/ rc_intersect( &w.work, &rect ); /* The redraw is necessary to turn off the blinking cursor. * We are going to need to send a redraw message to the calling * cpx in case they have any custom redraws that need to be done. */ Redraw_XForm_Do( &rect ); if( msg[0] == WM_REDRAW ) { for( idx = 0; idx < 8; idx++ ) puntmsg[idx] = msg[idx]; } } /* Here we redraw/move the area that is dirtied */ do_windows( (int *)msg, (int *)&event ); if( edit_obj ) MakeEditable( edit_obj ); doedit = can_edit( tree, edit_obj ); if( !doedit ) cursor = FALSE; if( msg[0] == WM_REDRAW ) { for( idx = 0; idx < 8; idx++ ) puntmsg[idx] = msg[idx]; return -1; } break; default:if( msg[0] == AC_CLOSE ) SetAccCloseState( TRUE ); if( msg[0] == AP_TERM ) { SetAccCloseState( TRUE ); msg[0] = AC_CLOSE; } if( msg[0] == WM_CLOSED ) SetWmCloseState( TRUE ); for( idx = 0; idx < 8; idx++ ) puntmsg[idx] = msg[idx]; return -1; } } /* * What about hot keys?? AIEEE!! */ if( EvKey() ) { /* * form_keybd() encapsulated here */ direction = NODIR; switch( key ) { case K_RETURN: case K_ENTER: next_obj = 0; direction = DEFAULTDIR; break; case K_BACKTAB: case K_UP: direction = BACKWARD; break; case K_TAB: case K_DOWN: direction = FORWARD; break; } if( direction != NODIR ) { key = 0; next_obj = find_obj( tree, edit_obj, direction ); if( (direction == DEFAULTDIR) && (next_obj != 0) ) { Objc_change( tree, next_obj, &w.work, ObState(next_obj)|SELECTED, TRUE ); cont = FALSE; } } /* * End of form_keybd() */ /* The above code clears 'key', therefore, we'll * check key FIRST, then test the ASCII and * scancode */ if( key && ( !( key & 0xff ) ) ) { if( ( key != K_UP ) && ( key != K_DOWN ) && ( key != K_RIGHT ) && ( key != K_LEFT ) && ( key != K_RETURN ) && ( key != K_ENTER ) && ( key != K_TAB ) && ( key != K_BACKTAB) ) { puntmsg[0] = CT_KEY; puntmsg[3] = key; return -1; } } if( key && doedit ) objc_edit( tree, edit_obj, key, (int *)&idx, ED_CHAR ); } if( EvButton() ) { next_obj = objc_find( tree, ROOT, MAX_DEPTH, m.x, m.y ); if( next_obj == NIL ) { Bconout( 2, 7 ); next_obj = 0; } else { cont = fm_button( tree, next_obj, clicks, &next_obj ); } } if( doedit && (!cont || (next_obj != 0)) && ( next_obj != edit_obj) ) { objc_edit( tree, edit_obj, 0, (int *)&idx, ED_END ); cursor = FALSE; } } return next_obj; }
void handle_msg(int *msg) { WINDOWP window; wake_mouse(); window= get_window(msg[3]); /* Zugeh�riges Fenster */ switch (msg[0]) /* Art der Nachricht */ { case MN_SELECTED: if (makro_rec) /* Makro wird Tastendruck vorgegaukelt */ { int kstate, kreturn; char str[50]; get_string(menu, msg[4], str); if (str_to_key(str, &kstate, &kreturn)) { kstate |= (kstate & 3); to_makro(kstate, kreturn); } } handle_menu(msg[3], msg[4], menu_ctrl); menu_ctrl = FALSE; break; case WM_REDRAW : if (msg[3] == akt_handle) redraw_aktion(); else redraw_window (window, (GRECT*)(msg+4)); break; case WM_CLOSED : do_icon(window->handle, DO_DELETE); break; case WM_FULLED : full_window (window); break; case WM_ARROWED : arrow_window (window, msg[4], 1); break; case WM_HSLID : h_slider (window, msg[4]); break; case WM_VSLID : v_slider (window, msg[4]); break; case WM_SIZED : size_window (window, (GRECT*)(msg+4), TRUE); break; case WM_MOVED : move_window (window, (GRECT*)(msg+4)); break; case WM_NEWTOP : /* Fenster von qed ist irgendwie nach oben gekommen */ case WM_ONTOP : ontop_window(window); break; case WM_TOPPED : top_window (window); break; case WM_UNTOPPED: /* qed hat jetzt nicht mehr das Top-Fenster */ untop_window (window); break; case WM_BOTTOMED: /* AES 4.00 MagiC 3 : Fenster nach hinten */ case WM_M_BDROPPED : /* Magic 2 */ bottom_window (window, msg[0]); break; case WM_ICONIFY: iconify_window(window, (GRECT*)(msg+4)); break; case WM_ALLICONIFY: all_iconify(window, (GRECT*)(msg+4)); break; case WM_UNICONIFY: if (all_iconified) all_uniconify(NULL, (GRECT*)(msg+4)); else uniconify_window(window, (GRECT*)(msg+4)); break; case WM_SHADED : case WM_UNSHADED : shade_window(window, msg[0]); break; case AP_TERM: if (all_iconified) all_uniconify(NULL, NULL); quick_close = TRUE; if (prepare_quit()) do_quit(); break; case AP_DRAGDROP : if (all_iconified) Bconout(2, 7); else handle_dd(msg); break; case SC_CHANGED : /* * Ignorieren, da wir vor dem Paste sowieso neu laden. */ break; case VA_START : case VA_PROTOSTATUS : case VA_DRAG_COMPLETE : case VA_DRAGACCWIND : case AV_SENDKEY : handle_av(msg); break; case SE_INIT: case SE_OK: case SE_ACK: case SE_OPEN: case SE_ERROR: case SE_ERRFILE: case SE_PROJECT: case SE_QUIT: case SE_TERMINATE: case SE_CLOSE : case SE_MENU : if (all_iconified) all_uniconify(NULL, NULL); handle_se(msg); break; case OLGA_INIT : case OLE_NEW : case OLGA_ACK : case OLE_EXIT : handle_olga(msg); break; case SH_WDRAW: /* schickt Freedom st�ndig */ case DHST_ACK: /* SMU antwortet */ /* ignore */ break; case FONT_CHANGED : if (msg[4] != 0) font_id = msg[4]; if (msg[5] != 0) font_pts = msg[5]; font_change(); break; default: if (debug_level) { char str[12]; int d, i, id; if ((appl_xgetinfo(4, &d, &d, &i, &d)) && (i == 1)) /* gibts appl_search? */ { i = appl_search(0, str, &d, &id); while (i != 0) { if (id == msg[1]) break; i = appl_search( 1, str, &d, &id); } } else { strcpy(str, ""); id = msg[1]; } debug("Unbekannte Msg %d (0x%X) von %s (%d)\n", msg[0], msg[0], str, id); } break; } }
void print_option(int y, int x, int rubout, int show) { char l,r; int loop; int toggle; l=' '; r=' '; toggle=rubout; for(loop=0;loop<2;loop++) { switch(toggle) { case 0: /*New Progs*/ AT(y,x) Bconout(2,l); AT(y,x+9) Bconout(2,r); break; case 1: /*New Accs*/ AT(y+1,x) Bconout(2,l); AT(y+1,x+9) Bconout(2,r); break; case 2: /*Auto Window*/ AT(y+3,x) Bconout(2,l); AT(y+3,x+12) Bconout(2,r); break; case 3: /*Accs Window*/ AT(y+4,x) Bconout(2,l); AT(y+4,x+12) Bconout(2,r); break; case 4: /*Sets Window*/ AT(y+5,x) Bconout(2,l); AT(y+5,x+12) Bconout(2,r); break; case 5: /*Other Window*/ AT(y+6,x) Bconout(2,l); AT(y+6,x+13) Bconout(2,r); break; case 6: /*Auto Path*/ AT(y+8,x) Bconout(2,l); AT(y+8,x+10) Bconout(2,r); break; case 7: /*Accs Path*/ AT(y+11,x) Bconout(2,l); AT(y+11,x+10) Bconout(2,r); break; case 8: /*Set Keys*/ AT(y+14,x) Bconout(2,l); AT(y+14,x+11) Bconout(2,r); break; case 9: /*Resolution Info*/ AT(y+14,x+21) Bconout(2,l); AT(y+14,x+39) Bconout(2,r); break; case 10: /*OK*/ AT(y+16,x+2) Bconout(2,l); AT(y+16,x+13) Bconout(2,r); break; case 11: /*CANCEL*/ AT(y+16,x+14) Bconout(2,l); AT(y+16,x+25) Bconout(2,r); break; case 12: /*SAVE*/ AT(y+16,x+26) Bconout(2,l); AT(y+16,x+37) Bconout(2,r); break; } l='>'; r='<'; toggle=show; } }
void coup_mu_button( short m_x, short m_y, short breturn ) { short obj_x, obj_y ; /* object x and y return values */ short no_exit ; char names[60] ; /* string in which to format names */ coup_form.next_object = objc_find( coup_form.fm_ptr, ROOT, MAX_DEPTH, m_x, m_y ) ; if( coup_form.next_object == NIL ) { Bconout( 2, '\a' ) ; objc_edit( coup_form.fm_ptr, coup_form.edit_object, 0, &(coup_form.cursor_position), ED_END ) ; coup_form.edit_object = 0 ; } else { no_exit = form_button( coup_form.fm_ptr, coup_form.next_object, breturn, &(coup_form.next_object) ) ; if( !no_exit ) { coup_form.next_object &= ~DOUBLE_CLICK ; /* deselect object if it an exit button */ if( coup_form.fm_ptr[coup_form.next_object].ob_flags & EXIT ) coup_form.fm_ptr[coup_form.next_object].ob_state &= ~SELECTED ; switch( coup_form.next_object ) { case C_CANCEL : close_couple() ; break ; case C_OK : save_couple( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ; close_couple() ; break ; case C_DELETE : if( q_del_coup( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ) close_couple() ; else objc_draw( coup_form.fm_ptr, C_DELETE, MAX_DEPTH, ELTS( coup_form.fm_box ) ) ; break ; case C_HELP : help( marriage_help ) ; objc_draw( coup_form.fm_ptr, C_HELP, 0, ELTS( coup_form.fm_box ) ) ; break ; case MALE : if( male = get_person_reference( NULL, FALSE ) ) { names_only( male, names, 40, FALSE ) ; strcpy( c_form_addrs.male, names ) ; objc_draw( coup_form.fm_ptr, MALE, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; sprintf( c_form_addrs.m_ref, "%10d", male ) ; objc_draw( coup_form.fm_ptr, M_REF, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case FEMALE : if( female = get_person_reference( NULL, FALSE ) ) { names_only( female, names, 40, FALSE ) ; strcpy( c_form_addrs.female, names ) ; objc_draw( coup_form.fm_ptr, FEMALE, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; sprintf( c_form_addrs.f_ref, "%10d", female ) ; objc_draw( coup_form.fm_ptr, F_REF, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case WED_QUALIFIER : popup_date_qualifier( c_form_addrs.wed_qual, coup_form.fm_ptr, WED_QUALIFIER ) ; break ; case C_SOURCE : wind_form_do( &co_src_form, WF_SOURCE ) ; break ; case C_DIVORCE : wind_form_do( &divorce_form, DI_DATE ) ; break ; case PROG0 : case PROG1 : case PROG2 : case PROG3 : case PROG4 : case PROG5 : case PROG6 : case PROG7 : case PROG8 : case PROG9 : select_progeny( coup_form.next_object - PROG0, coup_form.fm_box ) ; break ; case C_SLIDER : prog_oset = move_slide( coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; prog_oset = 30 * prog_oset / 1000 ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; break ; case C_UP : if( prog_oset > 0 ) { prog_oset-- ; set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case C_DOWN : if( prog_oset < 30 ) { prog_oset++ ; set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case C_SLIDERANGE : objc_offset( coup_form.fm_ptr, C_SLIDER, &obj_x, &obj_y ) ; if( m_y > obj_y ) { prog_oset += 9 ; if( prog_oset > 30 ) prog_oset = 30 ; } else { prog_oset -= 9 ; if( prog_oset < 0 ) prog_oset = 0 ; } set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; break ; default : #ifndef NDEBUG report( 0x300 + coup_form.next_object ) ; #endif break ; } } } change_edit_object( &coup_form, MU_BUTTON ) ; }
beep() { Bconout(CON,7); }