| 424 | } |
| 425 | |
| 426 | int |
| 427 | amii_doprev_message(void) |
| 428 | { |
| 429 | struct amii_WinDesc *cw; |
| 430 | struct Window *w; |
| 431 | char *str; |
| 432 | |
| 433 | |
| 434 | if (WIN_MESSAGE == WIN_ERR || (cw = amii_wins[WIN_MESSAGE]) == NULL |
| 435 | || (w = cw->win) == NULL) { |
| 436 | panic(winpanicstr, WIN_MESSAGE, "doprev_message"); |
| 437 | } |
| 438 | |
| 439 | /* When an interlaced/tall screen is in use, the scroll bar will be there |
| 440 | */ |
| 441 | /* Or in some other cases as well */ |
| 442 | if (scrollmsg) { |
| 443 | struct Gadget *gd; |
| 444 | struct PropInfo *pip; |
| 445 | int hidden, topidx, i, total, wheight; |
| 446 | |
| 447 | for (gd = w->FirstGadget; gd && gd->GadgetID != 1;) |
| 448 | gd = gd->NextGadget; |
| 449 | |
| 450 | if (gd) { |
| 451 | pip = (struct PropInfo *) gd->SpecialInfo; |
| 452 | wheight = (w->Height - w->BorderTop - w->BorderBottom - 2) |
| 453 | / w->RPort->TxHeight; |
| 454 | hidden = max(cw->maxrow - wheight, 0); |
| 455 | topidx = (((ULONG) hidden * pip->VertPot) + (MAXPOT / 2)) >> 16; |
| 456 | for (total = i = 0; i < cw->maxrow; ++i) { |
| 457 | if (cw->data[i][1] != 0) |
| 458 | ++total; |
| 459 | } |
| 460 | |
| 461 | i = 0; |
| 462 | topidx -= wheight / 4 + 1; |
| 463 | if (topidx < 0) |
| 464 | topidx = 0; |
| 465 | SetPropInfo(w, &MsgScroll, wheight, total, topidx); |
| 466 | DisplayData(WIN_MESSAGE, topidx); |
| 467 | } |
| 468 | return (0); |
| 469 | } |
| 470 | |
| 471 | if (--cw->vwy < 0) { |
| 472 | cw->maxcol = 0; |
| 473 | DisplayBeep(NULL); |
| 474 | str = "\0\0No more history saved..."; |
| 475 | } else |
| 476 | str = cw->data[cw->vwy]; |
| 477 | |
| 478 | amii_cl_end(cw, 0); |
| 479 | amii_curs(WIN_MESSAGE, 1, 0); |
| 480 | amii_setdrawpens(amii_wins[WIN_MESSAGE]->win, NHW_MESSAGE); |
| 481 | Text(w->RPort, str + SOFF, strlen(str + SOFF)); |
| 482 | cw->curx = cw->cols + 1; |
| 483 |
nothing calls this directly
no test coverage detected