📄 grphics.cpp
字号:
win->key_handler = NULL; win->destroy_handler = NULL; win->events = NULL; win->lastevent = NULL; newop = (CREATEOP *) getshm (sizeof (CREATEOP)); if (newop != NULL) { newop->header.fd = fd; /*file descriptor */ newop->type = CREATE; /*set operator type */ newop->window_type = window_type; /*copy window name */ strncpy (newop->name, name, MAXWINDOWNAME - 1); newop->name[MAXWINDOWNAME - 1] = '\0'; newop->xpos = xpos; newop->ypos = ypos; newop->xsize = xsize; newop->ysize = ysize; newop->xmin = xmin; newop->xmax = xmax; newop->ymin = ymin; newop->ymax = ymax; newop->downon = downon; newop->moveon = moveon; newop->upon = upon; newop->keyon = keyon; } return win; /*file descriptor */}/********************************************************************** * WINFD::WINFD * * Constructor to initialize a WINFD entry. **********************************************************************/WINFD::WINFD() { //constructor fd = -1; used = FALSE; downevent = FALSE; moveevent = FALSE; upevent = FALSE; keyevent = FALSE; click_handler = NULL; selection_handler = NULL; key_handler = NULL; destroy_handler = NULL; events = NULL; lastevent = NULL;}WINFD::~WINFD () {}/********************************************************************** * destroy_window * * Destroy a window and free the file descriptor **********************************************************************/void WINFD::Destroy_window() { /*destroy a window */ ONEOP *newop; /*destroy structure */ if (fd < 1 || fd > maxsbfd || sbfds[fd].used == FALSE) { return; } else { Clear_event_queue(); sbfds[fd].used = FALSE; /*it is not in use */ sbfds[fd].click_handler = NULL; newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*file descriptor */ newop->type = DESTROY; /*set operator type */ } }}/********************************************************************** * Clear_event_queue * * Clear the queue of events for this window. **********************************************************************/void WINFD::Clear_event_queue() { /*clear events */ INT16 fd; //current window GRAPHICS_EVENT *event; /*current event */ GRAPHICS_EVENT *nextevent; /*next in list */ if (this == NULL) { for (fd = 1; fd < maxsbfd; fd++) { if (sbfds[fd].used) { sbfds[fd].Clear_event_queue (); } } } else { for (event = events; event != NULL; event = nextevent) { nextevent = event->next; delete event; //free them all } events = NULL; /*there are none now */ }}/********************************************************************** * clear_view_surface * * Clear the window and empty the display list, discarding images also. **********************************************************************/void WINFD::Clear_view_surface() { /*clear window */ ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = CLEAR; /*send the operator */ }}/********************************************************************** * re_compute_colourmap * * Tell SBD to recalc_colourmap for this window. **********************************************************************/void WINFD::Re_compute_colourmap() { /*Mark need to recalc */ ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = RE_COMP_COLMAP;/*send the operator */ } /* ONE DAY THE PC VERSION WILL SUPPORT COLOUR - BUT NOT TODAY Among the things that will need doing is to change the size of.. PCSTUBSPEC stubspecs[SYNCWIN+1]; in pcsbdg.[ch] to RE_COMP_COLMAP+1 */}/********************************************************************** * vdc_extent * * Shift/scale the window to focus on the given region. **********************************************************************/void WINFD::Vdc_extent( /*set window focus */ float Xmin, /*min values */ float Ymin, /*min values */ float Xmax, /*max values */ float Ymax /*max values */ ) { EIGHTOP *newop; /*message structure */ /*get some space */ newop = (EIGHTOP *) getshm (sizeof (EIGHTOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = VDCEXTENT; /*send the operator */ newop->param.p[0].f = Xmin; /*set parameters */ newop->param.p[1].f = Ymin; newop->param.p[2].f = 0.0f; newop->param.p[3].f = Xmax; newop->param.p[4].f = Ymax; newop->param.p[5].f = 0.0f; }}/********************************************************************** * set_echo * * Set the starbase echo/cursor. **********************************************************************/void WINFD::Set_echo( /*set window echo */ ECHO_TYPE echo_type, //type of echo float xorig, /*min values */ float yorig /*min values */ ) { FOUROP *newop; /*message structure */ /*get some space */ newop = (FOUROP *) getshm (sizeof (FOUROP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = SETECHO; /*send the operator */ newop->param.p[0].i = echo_type; newop->param.p[1].f = xorig; newop->param.p[2].f = yorig; }}/********************************************************************** * overlap_picture_ops * * Clear the output buffer without waiting for acknowledge response. * If update is TRUE, make_picture_currents are issued on all windows, * but they are still not waited for. **********************************************************************/DLLSYM void def_overlap_picture_ops( /*flush output */ BOOL8 update /*send make_ */ ) { ONEOP *newop; /*message structure */ INT16 fd; /*file descriptor */ if (update) { for (fd = 1; fd < maxsbfd; fd++) { if (sbfds[fd].used) { /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ /*send the operator */ newop->type = MAKECURRENT; } } } } kick_daemon(FLUSH_OUT); /*empty shm */}/********************************************************************** * make_picture_current * * Clear the buffer and make sure the image is up-to-date. * If a window of 0 is given, all windows are updated. **********************************************************************/void WINFD::Make_picture_current() { /*update window */ ONEOP *newop; /*message structure */ if (this == NULL || fd <= 0) { overlap_picture_ops(TRUE); } else { /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = MAKECURRENT; /*send the operator */ kick_daemon(FLUSH_IN); /*empty shm */ } }}/********************************************************************** * synchronize_windows * * Make zoom, scroll and resize operations ripple over other window(s). **********************************************************************/void WINFD::Synchronize_windows( /*set line colour */ WINDOW fd2 //other window ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = SYNCWIN; /*send the operator */ newop->param.p.i = fd2->fd; /*set parameter */ }}/********************************************************************** * set_click_handler * * Set a callback function for click events. **********************************************************************/void WINFD::Set_click_handler( //set callback function EVENT_HANDLER handler //handler function ) { click_handler = handler; //remember it}/********************************************************************** * set_selection_handler * * Set a callback function for selection events. **********************************************************************/void WINFD::Set_selection_handler( //set callback function EVENT_HANDLER handler //handler function ) { selection_handler = handler; //remember it}/********************************************************************** * set_key_handler * * Set a callback function for key events. **********************************************************************/void WINFD::Set_key_handler( //set callback function EVENT_HANDLER handler //handler function ) { key_handler = handler; //remember it}/********************************************************************** * set_destroy_handler * * Set a callback function for destroy events. **********************************************************************/void WINFD::Set_destroy_handler( //set callback function EVENT_HANDLER handler //handler function ) { destroy_handler = handler; //remember it}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -