void display_player_xtra_info(void) { int i; int panels [] = { 1, 2, 3, 4}; bool left_adj [] = { 1, 0, 0, 0, 0 }; data_panel data[MAX_PANEL]; for (i = 0; i < (int)N_ELEMENTS(panels); i++) { int oid = panels[i]; int rows = get_panel(oid, data, N_ELEMENTS(data)); /* Hack: Don't show 'Level' in the name, class ... panel */ if (oid == 1) rows -= 1; display_panel(data, rows, left_adj[i], &boundaries[oid]); } /* Indent output by 1 character, and wrap at column 72 */ text_out_wrap = 72; text_out_indent = 1; /* History */ Term_gotoxy(text_out_indent, 19); text_out_to_screen(TERM_WHITE, p_ptr->history); /* Reset text_out() vars */ text_out_wrap = 0; text_out_indent = 0; return; }
/** * Display the character on the screen (two different modes) * * The top two lines, and the bottom line (or two) are left blank. * * Mode 0 = standard display with skills/history * Mode 1 = special display with equipment flags */ void display_player(int mode) { /* Erase screen */ clear_from(0); /* When not playing, do not display in subwindows */ if (Term != angband_term[0] && !player->upkeep->playing) return; /* Stat info */ display_player_stat_info(); if (mode) { struct panel *p = panels[0].panel(); display_panel(p, panels[0].align_left, &panels[0].bounds); panel_free(p); /* Stat/Sustain flags */ display_player_sust_info(); /* Other flags */ display_player_flag_info(); } else { /* Extra info */ display_player_xtra_info(); } }
/* * Display the character on the screen (two different modes) * * The top two lines, and the bottom line (or two) are left blank. * * Mode 0 = standard display with skills/history * Mode 1 = special display with equipment flags */ void display_player(int mode) { /* Erase screen */ clear_from(0); /* Stat info */ display_player_stat_info(); if (mode) { data_panel data[MAX_PANEL]; int rows = get_panel(1, data, N_ELEMENTS(data)); display_panel(data, rows, 1, &boundaries[1]); /* Stat/Sustain flags */ display_player_sust_info(); /* Other flags */ display_player_flag_info(); } /* Standard */ else { /* Extra info */ display_player_xtra_info(); } }
/************************************************************************* * *N displaymessage * *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Purpose: *P * This function displays a list of text strings in a * popup text window. The list must be NULL-terminated. Must be in * graphics mode to call this function. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Parameters: *A * string <input> == (char *) first text string to be displayed. * ... <input> == (char *) variable list of text strings to be displayed. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * History: *H * Barry Michaels August 1991 DOS Turbo C *E *************************************************************************/ void displaymessage( char *string, ... ) { int i,maxw,height,x,y,pad, nlines; panel_type panel; char **text; va_list arglist; va_start(arglist,string); nlines = 1; while (va_arg(arglist,char *)) nlines++; va_end(arglist); text = (char **)vpfmalloc((nlines+1)*sizeof(char *)); text[0] = string; va_start(arglist,string); for (i=1;i<nlines;i++) { text[i] = va_arg(arglist,char *); } va_end(arglist); settextstyle( SMALL_FONT, HORIZ_DIR, 4 ); maxw = 0; height = 0; for (i=0;i<nlines;i++) { if (textwidth(text[i]) > maxw) maxw = textwidth(text[i]); height = height + textheight(text[i]) + 5; } if (maxw < (textwidth("Continue") + 10)) maxw = textwidth("Continue") + 10; pad = (maxw*10)/100; maxw = maxw + (2*pad); if (maxw > getmaxx()) maxw = getmaxx() - 8; height = height + 2*(textheight("Continue") + 5) + 5; create_panel( &panel, maxw, height, menucolor, menubordercolor ); x = pad; y = 0; for (i=0;i<nlines;i++) { y = y + textheight(text[i]) + 5; create_label( text[i], x, y, SMALL_FONT, 4, menutextcolor, &panel ); } y = height - (textheight("Continue") + 6); x = (maxw - (textwidth("Continue") + 10))/2; create_button( 27, "Continue", x, y, SMALL_FONT, 4, menutextcolor, menucolor, menubordercolor, RELIEVED, &panel ); get_display_position( &x, &y, panel.window ); display_panel( &panel, x, y ); i = process_panel( &panel, i ); destroy_panel( &panel ); close_panel( &panel ); free(text); }
/************************************************************************* * *N yes_no * *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Purpose: *P * This function displays a panel asking the user a yes or no * question and returns the response. Must be in graphics mode to call * this function. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Parameters: *A * text <input>==(char *) question string. * return <output>==(int) yes (TRUE) or no (FALSE). *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * History: *H * Barry Michaels May 1991 DOS Turbo C *E *************************************************************************/ int yes_no( char *text ) { panel_type panel; int no_id = 27; int yes_id = 13; int x,y,width,height,maxheight,id=0; settextstyle( SMALL_FONT, HORIZ_DIR, 4 ); width = 0; maxheight = 0; width = textwidth(text); maxheight = textheight(text); width = width + 50; if (width > getmaxx()) width = getmaxx()-10; height = maxheight * 5; create_panel( &panel,width,height,menucolor,menubordercolor ); y = maxheight; create_label( text,CENTER,y,SMALL_FONT,4,menutextcolor,&panel ); y += maxheight; create_button( yes_id, "Yes", 3, height-textheight("Y")-6, SMALL_FONT, 4, menutextcolor, menucolor, menubordercolor, RELIEVED, &panel ); create_button( no_id, "No", width-textwidth("No")-13, height-textheight("No")-6, SMALL_FONT, 4, menutextcolor, menucolor, menubordercolor, RELIEVED, &panel ); get_display_position( &x, &y, panel.window ); display_panel( &panel, x,y ); id = process_panel(&panel, id); destroy_panel( &panel ); close_panel( &panel ); if (id == yes_id) return TRUE; else return FALSE; }
int XttVideoMgmAimetis::init() { int sts; sts = authorize( m_op->User, m_op->Password); if ( EVEN(sts)) return sts; sts = get_panels(); if ( EVEN(sts)) return sts; sts = get_cameras(); if ( EVEN(sts)) return sts; // Set default panel sts = display_panel( m_op->DefaultPanel); m_op->PanelArraySelect[m_op->DefaultPanel] = 1; m_panel_select_old[m_op->DefaultPanel] = 1; return 1; }
/************************************************************************* * *N displayinfo * *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Purpose: *P * This function displays an array of text strings in a * popup text window. Must be in graphics mode to call this function. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Parameters: *A * text[] <input> == (char *) array of text strings to be displayed. * nlines <input> == (int) number of text lines. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * History: *H * Barry Michaels June 1990 Original Version DOS Turbo C *E *************************************************************************/ void displayinfo( char *text[], int nlines ) { int i,maxw,height,x,y,pad; panel_type panel; arrow_cursor(); settextstyle( SMALL_FONT, HORIZ_DIR, 4 ); maxw = 0; height = 0; for (i=0;i<nlines;i++) { if (textwidth(text[i]) > maxw) maxw = textwidth(text[i]); height = height + textheight(text[i]) + 5; } if (maxw < (textwidth("Continue") + 10)) maxw = textwidth("Continue") + 10; pad = (maxw*10)/100; maxw = maxw + (2*pad); if (maxw > getmaxx()) maxw = getmaxx() - 8; height = height + 2*(textheight("Continue") + 10); create_panel( &panel, maxw, height, menucolor, menubordercolor ); x = pad; y = 0; for (i=0;i<nlines;i++) { y = y + textheight(text[i]) + 3; create_label( text[i], x, y, SMALL_FONT, 4, menutextcolor, &panel ); } y = height - (textheight("Continue") + 6); x = (maxw - (textwidth("Continue") + 10))/2; create_button( 27, "Continue", x, y, SMALL_FONT, 4, menutextcolor, menucolor, menubordercolor, RELIEVED, &panel ); get_display_position( &x, &y, panel.window ); display_panel( &panel, x, y ); i = process_panel( &panel, i ); destroy_panel( &panel ); close_panel( &panel ); }
void display_player_xtra_info(void) { size_t i; for (i = 0; i < N_ELEMENTS(panels); i++) { struct panel *p = panels[i].panel(); display_panel(p, panels[i].align_left, &panels[i].bounds); panel_free(p); } /* Indent output by 1 character, and wrap at column 72 */ text_out_wrap = 72; text_out_indent = 1; /* History */ Term_gotoxy(text_out_indent, 19); text_out_to_screen(COLOUR_WHITE, player->history); /* Reset text_out() vars */ text_out_wrap = 0; text_out_indent = 0; return; }
/************************************************************************* * *N displayerror * *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Purpose: *P * This function displays an error message when a disk error is detected. * It displays the given lines of text in a popup panel and waits for * the user to click on either retry or cancel. It returns 1 for retry * and 0 for cancel. Must be in graphics mode to call this function. * * text strings may contain embedded newlines, in which case text to the * right of the newline will be displayed on (what else?) a new line. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Parameters: *A * text[] <input> == (char *) array of text strings to be displayed. * nlines <input> == (int) number of lines of text (this count ignores * newline characters embedded in the text * strings * return <output> == (VPF_BOOLEAN) 1 => retry, * 0 => cancel. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * History: *H * Barry Michaels July 1990 Prototype 3 DOS Turbo C *E *************************************************************************/ VPF_BOOLEAN displayerror( char *text[], int nlines ) { register int i; int maxw, height, x, y, pad, choice, n_real_lines; panel_type panel; int retry_button = 'r', cancel_button = 'c', msg_ar_sz = 10; char * walker, ** msgs; struct viewporttype view; getviewsettings( &view ); setviewport(0,0,getmaxx(),getmaxy(),1); settextstyle( SMALL_FONT, HORIZ_DIR, 4 ); msgs = (char **) vpfmalloc(msg_ar_sz * sizeof(char *)); maxw = height = 0; for (n_real_lines = i = 0; i < nlines; i++) { walker = text[i]; while (1) { size_t substr_len = strcspn(walker, "\n"); char plug; maxw = max(maxw, textwidth(walker)); height = height + textheight(walker) + 5; plug = walker[substr_len]; walker[substr_len] = '\0'; msgs[n_real_lines++] = strdup(walker); if (n_real_lines == msg_ar_sz) msgs = (char **) realloc(msgs, (msg_ar_sz += 5) * sizeof(char *)); if (plug == 0) break; walker[substr_len] = plug; walker += substr_len + 1; } } if (maxw < (textwidth("Retry") + textwidth("Cancel") + 20)) maxw = textwidth("Retry") + textwidth("Cancel") + 20; pad = (maxw*10)/100; maxw = maxw + (2*pad); height = height + 2*(textheight("Retry") + 5) + 1; maxw = min(getmaxx(), maxw); height = min(getmaxy()-10, height); create_panel( &panel, maxw, height, menucolor, menubordercolor ); for (y = i = 0; i < n_real_lines; i++) { create_label(msgs[i], pad, y, SMALL_FONT, 4, menutextcolor, &panel ); y += textheight(msgs[i]) + 3; } y = height-15; create_button( retry_button, "Retry", 3, y, SMALL_FONT, 4, menutextcolor, menucolor, menubordercolor, RELIEVED, &panel ); create_button( cancel_button, "Cancel", maxw - (textwidth("Cancel") + 13), y, SMALL_FONT, 4, menutextcolor, menucolor, menubordercolor, RELIEVED, &panel ); get_display_position( &x, &y, panel.window ); display_panel( &panel, x,y ); showmousecursor(); arrow_cursor(); choice = process_panel( &panel, 0 ); hidemousecursor(); destroy_panel( &panel ); close_panel( &panel ); setviewport(view.left,view.top,view.right,view.bottom,view.clip); for (i = 0; i < n_real_lines; i++) free(msgs[i]); free(msgs); return (choice == retry_button) ? 1 : 0; }