From 08024af0a5383e79867b5202aa66d63757dcc0af Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Thu, 11 Apr 2013 22:56:48 +0200 Subject: [PATCH] Renamed gemtk_wm_send_redraw to gemtk_wm_exec_redraw ...and did a little bit refactoring. --- atari/download.c | 10 +++---- atari/gemtk/gemtk.h | 5 +++- atari/gemtk/guiwin.c | 64 +++++++++++++++++++++++++++----------------- atari/hotlist.c | 4 +-- atari/settings.c | 6 ++--- 5 files changed, 54 insertions(+), 35 deletions(-) diff --git a/atari/download.c b/atari/download.c index 936b8a551..209650490 100755 --- a/atari/download.c +++ b/atari/download.c @@ -188,7 +188,7 @@ static void on_cbrdy_click(struct gui_download_window *dw) if (dw->close_on_finish && dw->status == NSATARI_DOWNLOAD_COMPLETE) { gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0); } - gemtk_wm_send_redraw(dw->guiwin, NULL); + gemtk_wm_exec_redraw(dw->guiwin, NULL); evnt_timer(250); } @@ -379,7 +379,7 @@ nserror gui_download_window_data(struct gui_download_window *dw, dw->status = NSATARI_DOWNLOAD_CANCELED; dw->abort = false; download_context_abort(dw->ctx); - gemtk_wm_send_redraw(dw->guiwin, NULL); + gemtk_wm_exec_redraw(dw->guiwin, NULL); return(NSERROR_OK); } @@ -411,7 +411,7 @@ nserror gui_download_window_data(struct gui_download_window *dw, (dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : "?" ); - gemtk_wm_send_redraw(dw->guiwin, NULL); + gemtk_wm_exec_redraw(dw->guiwin, NULL); } return NSERROR_OK; } @@ -422,7 +422,7 @@ void gui_download_window_error(struct gui_download_window *dw, LOG(("%s", error_msg)); strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1); dw->status = NSATARI_DOWNLOAD_ERROR; - gemtk_wm_send_redraw(dw->guiwin, NULL); + gemtk_wm_exec_redraw(dw->guiwin, NULL); gui_window_set_status(input_window, messages_get("Done") ); // TODO: change abort to close } @@ -451,7 +451,7 @@ void gui_download_window_done(struct gui_download_window *dw) human_friendly_bytesize(dw->size_downloaded), (dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : human_friendly_bytesize(dw->size_downloaded) ); - gemtk_wm_send_redraw(dw->guiwin, NULL); + gemtk_wm_exec_redraw(dw->guiwin, NULL); } gui_window_set_status(input_window, messages_get("Done") ); } diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h index 1853e75bc..2471b34db 100644 --- a/atari/gemtk/gemtk.h +++ b/atari/gemtk/gemtk.h @@ -225,7 +225,10 @@ void gemtk_wm_scroll(GUIWIN *gw, short orientation, int units, bool refresh); void gemtk_wm_send_msg(GUIWIN *win, short msgtype, short a, short b, short c, short d); -void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area); +short gemtk_wm_exec_msg(GUIWIN *win, short msg_type, short a, short b, short c, + short d); + +void gemtk_wm_exec_redraw(GUIWIN *win, GRECT *area); VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win); diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c index c175cce4a..1278c7323 100644 --- a/atari/gemtk/guiwin.c +++ b/atari/gemtk/guiwin.c @@ -253,7 +253,7 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, g.g_w, g.g_h); if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) { if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) { - gemtk_wm_send_redraw(gw, NULL); + gemtk_wm_exec_redraw(gw, NULL); } } } @@ -270,7 +270,7 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) wind_set_grect(gw->handle, WF_CURRXYWH, &g); if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) { if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) { - gemtk_wm_send_redraw(gw, NULL); + gemtk_wm_exec_redraw(gw, NULL); } } break; @@ -890,7 +890,7 @@ void gemtk_wm_scroll(GUIWIN *win, short orientation, int units, bool refresh) } if ((redraw != NULL) && (redraw->g_h > 0)) { - gemtk_wm_send_redraw(win, redraw); + gemtk_wm_exec_redraw(win, redraw); } } @@ -1132,12 +1132,21 @@ void gemtk_wm_send_msg(GUIWIN *win, short msg_type, short a, short b, short c, appl_write(gl_apid, 16, &msg); } -// TODO: rename, document and implement alternative (gemtk_wm_exec_event) -void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area) +/** Directly execute an Message to a GUIWIN using internal dispatcher +* \param win the GUIWIN which shall receive the message +* \param msg_type the WM_ message definition +* \param a the 4th parameter to appl_write +* \param b the 5th parameter to appl_write +* \param c the 6th parameter to appl_write +* \param d the 7th parameter to appl_write +*/ +short gemtk_wm_exec_msg(GUIWIN *win, short msg_type, short a, short b, short c, + short d) { short msg[8], retval; GRECT work; + EVMULT_OUT event_out; EVMULT_IN event_in = { .emi_flags = MU_MESAG | MU_TIMER | MU_KEYBD | MU_BUTTON, .emi_bclicks = 258, @@ -1150,7 +1159,30 @@ void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area) .emi_tlow = 0, .emi_thigh = 0 }; - EVMULT_OUT event_out; + + msg[0] = msg_type; + msg[1] = gl_apid; + msg[2] = 0; + msg[3] = win->handle; + msg[4] = a; + msg[5] = b; + msg[6] = c; + msg[7] = d; + + event_out.emo_events = MU_MESAG; + retval = preproc_wm(win, &event_out, msg); + if (retval == 0 || (win->flags & GEMTK_WM_FLAG_PREPROC_WM) != 0){ + retval = win->handler_func(win, &event_out, msg); + } + + return(retval); +} + +// TODO: rename, document and implement alternative (gemtk_wm_exec_event) +void gemtk_wm_exec_redraw(GUIWIN *win, GRECT *area) +{ + //short retval; + GRECT work; if (area == NULL) { gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &work); @@ -1165,24 +1197,8 @@ void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area) area = &work; } - msg[0] = WM_REDRAW; - msg[1] = gl_apid; - msg[2] = 0; - msg[3] = win->handle; - msg[4] = area->g_x; - msg[5] = area->g_y; - msg[6] = area->g_w; - msg[7] = area->g_h; - - event_out.emo_events = MU_MESAG; - retval = preproc_wm(win, &event_out, msg); - if (retval == 0 || (win->flags & GEMTK_WM_FLAG_PREPROC_WM) != 0){ - win->handler_func(win, &event_out, msg); - } - - - - //appl_write(gl_apid, 16, &msg); + gemtk_wm_exec_msg(win, WM_REDRAW, area->g_x, area->g_y, area->g_w, + area->g_h); } /** Attach an AES FORM to the GUIWIN, similar feature like the toolbar diff --git a/atari/hotlist.c b/atari/hotlist.c index dbf9f1bb1..adfd596ca 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -71,7 +71,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case TOOLBAR_HOTLIST_DELETE: hotlist_delete_selected(); - gemtk_wm_send_redraw(tv->window, NULL); + gemtk_wm_exec_redraw(tv->window, NULL); break; case TOOLBAR_HOTLIST_EDIT: @@ -82,7 +82,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED; gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, &tb_area); evnt_timer(150); - gemtk_wm_send_redraw(tv->window, &tb_area); + gemtk_wm_exec_redraw(tv->window, &tb_area); break; case WM_CLOSED: diff --git a/atari/settings.c b/atari/settings.c index 4f73fc3db..5244a7f8b 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -46,15 +46,15 @@ static OBJECT * dlgtree; #define OBJ_UNCHECK(idx) (dlgtree[idx].ob_state &= ~(OS_SELECTED)); -#define OBJ_REDRAW(idx) gemtk_wm_send_redraw(settings_guiwin, \ +#define OBJ_REDRAW(idx) gemtk_wm_exec_redraw(settings_guiwin, \ gemtk_obj_screen_rect(dlgtree, idx)); #define DISABLE_OBJ(idx) (dlgtree[idx].ob_state |= OS_DISABLED); \ - gemtk_wm_send_redraw(settings_guiwin, \ + gemtk_wm_exec_redraw(settings_guiwin, \ gemtk_obj_screen_rect(dlgtree, idx)); #define ENABLE_OBJ(idx) (dlgtree[idx].ob_state &= ~(OS_DISABLED)); \ - gemtk_wm_send_redraw(settings_guiwin, \ + gemtk_wm_exec_redraw(settings_guiwin, \ gemtk_obj_screen_rect(dlgtree, idx)); #define FORMEVENT(idx) form_event(idx, 0);