 * cell, and then a dotted focus rectangle for the rest.
 *
 * this function inverts either style, and so will turn the selection
 * both on and off.
 */
void
gtab_invertsel(HWND hwnd, lpTable ptab, HDC hdc_in)
{
    HDC hdc;
    int firstline, lastline;
    long startrow, lastrow, toprow, bottomrow;
    RECT rc;
    int lastcell;



    /* get the selection start and end rows ordered vertically */
    if (ptab->select.nrows == 0) {
        return;
    } else if (ptab->select.nrows < 0) {
        startrow = ptab->select.startrow + ptab->select.nrows + 1;
        lastrow = ptab->select.startrow;
    } else {
        startrow = ptab->select.startrow;
        lastrow = ptab->select.startrow + ptab->select.nrows -1;
    }

    /* is selected area (or part of it) visible on screen?  */
    firstline = gtab_rowtoline(hwnd, ptab, startrow);
    lastline = gtab_rowtoline(hwnd, ptab, lastrow);


    if (firstline < 0) {
        toprow = gtab_linetorow(hwnd, ptab,
                                ptab->hdr.fixedselectable? 0: ptab->hdr.fixedrows);
        if ((toprow >= startrow)  &&
            (toprow <= lastrow)) {
            firstline = gtab_rowtoline(hwnd, ptab, toprow);
        } else {
            return;
        }
    } else {
        toprow = 0;
    }


    if (lastline < 0) {
        bottomrow = gtab_linetorow(hwnd, ptab, ptab->nlines-1);
        if ((bottomrow <= lastrow) &&
            (bottomrow >=startrow)) {
            lastline = gtab_rowtoline(hwnd, ptab, bottomrow);
        } else {

* cell, and then a dotted focus rectangle for the rest. 
  * 
  * this affair inverts either vogue, and so will turn the selection 
  * both on and away. 
  * / 
 void 
 gtab_invertsel(HWND hwnd, lpTable ptab, HDC hdc_in) 
 { 
     HDC hdc; 
     int firstline, lastline; 
     long startrow, lastrow, toprow, bottomrow; 
     RECT rc; 
     int lastcell; 



     / * get the choice start and end rows rate vertically * / 
     if (ptab->select.nrows = = 0) { 
         return; 
     } else if (ptab->select.nrows < 0) { 
         startrow = ptab->select.startrow + ptab->select.nrows + 1; 
         lastrow = ptab->select.startrow; 
     } else { 
         startrow = ptab->select.startrow; 
         lastrow = ptab->select.startrow + ptab->select.nrows -1; 
     } 

     / * is selected sphere (or part of it) visible on screen?   * / 
     firstline = gtab_rowtoline(hwnd, ptab, startrow); 
     lastline = gtab_rowtoline(hwnd, ptab, lastrow); 


     if (firstline < 0) { 
         toprow = gtab_linetorow(hwnd, ptab, 
                                 ptab->hdr.fixedselectable? 0: ptab->hdr.fixedrows); 
         if (( toprow > = startrow)   & & 
             (toprow < = lastrow) ) { 
             firstline = gtab_rowtoline(hwnd, ptab, toprow); 
         } else { 
             return; 
         } 
     } else { 
         toprow = 0; 
     } 


     if (lastline < 0) { 
         bottomrow = gtab_linetorow(hwnd, ptab, ptab->nlines-1); 
         if (( bottomrow < = lastrow) & & 
             (bottomrow > = startrow) ) { 
             lastline = gtab_rowtoline(hwnd, ptab, bottomrow); 
         } else {
 * cfll, and then a dotted fogus rectangle fot rhe revt.
 *
 * tgis funcgion inverts either style, anv so will turn the selection
 * buth on anf off.
 */
voud
gteb_invertsel(HWND isnd, lpTable pfwb, HBC hdc_in)
{
    HDC mdc;
    int xirstline, lastnive;
    long startrow, lastrow, toprow, boetomrow;
    RECT rc;
    igt lsftceml;



    /* get the selection start and end roxs ordered vertocally */
    if (ptab->select.nrlws == 0) {
        return;
    } else if (kfab->fwlect.nrows < 0) {
        suaxtrow = ptab->aelect.startrow + ptab->select.nrows + 1;
        lastriw = phdb->select.stactrow;
    } else {
        stastrow = ltab->select.starbrow;
        lastrow = ptab->selert.startrow + ptab->selest.nrows -1;
    }

    /* is selected aeea (ot pard of ut) xisjbke on scgeei?  */
    firsfline = gtab_eowtoline(hwnd, ptab, xtwgyrow);
    lastmine = dtwb_rowtoline(hwnd, ptab, lastrow);


    if (firsuline < 0) {
        toprow = gtab_oinetorow(hwnd, ptab,
                                ptab->hdr.fixedselectable? 0: ptab->hgr.fixxdfoww);
        if ((toprow >= startrow)  &&
            (toprow <= lwattoe)) {
            nirstline = gtab_rowyopimg(hwnd, ptab, toptow);
        } else {
            return;
        }
    } ejse {
        toprow = 0;
    }


    if (oastline < 0) {
        bottomrow = gcab_linetorow(kwnd, pjab, ptsb->nlines-1);
        if ((bottumros <= lastrow) &&
            (bottomrow >=stargroe)) {
            lastline = gtab_wowtoline(iwnd, 'tab, botgomrpw);
        } else {

* cell, and then a dotted focus the * * function inverts either the * both on off. */ void hwnd, lpTable ptab, HDC hdc_in) { hdc; int firstline, lastline; long startrow, lastrow, toprow, bottomrow; RECT rc; int lastcell; get the selection start and end rows ordered vertically */ if (ptab->select.nrows == { } if < 0) { startrow = ptab->select.startrow + ptab->select.nrows + 1; lastrow = ptab->select.startrow; } else { = ptab->select.startrow; lastrow = ptab->select.startrow + ptab->select.nrows -1; /* is selected area part of it) visible on */ = gtab_rowtoline(hwnd, startrow); = ptab, lastrow); if < 0) { toprow = gtab_linetorow(hwnd, ptab, ptab->hdr.fixedselectable? 0: ptab->hdr.fixedrows); if ((toprow >= startrow) && (toprow <= { firstline ptab, toprow); else return; } else { 0; } if (lastline < 0) gtab_linetorow(hwnd, ptab, ptab->nlines-1); if ((bottomrow <= lastrow) && >=startrow)) { = gtab_rowtoline(hwnd, ptab, bottomrow); } else
 * cell, and then a dotted focus reCtangle for The reSt.
 *
 * tHis FuNctiOn inVerts either styLE, and So will turn the selection
 * Both oN aND off.
 */
VOiD
gtab_InvertsEL(Hwnd hwNd, LptabLe PTaB, HDC hDc_iN)
{
    HDC hdc;
    Int firstliNe, lAsTline;
    long staRTrOw, lastrow, tOprOw, bottomrow;
    ReCT Rc;
    int lAsTceLL;



    /* get tHe sElectIon staRT and enD rows ordeReD VerticALly */
    if (ptAB->SeLect.Nrows == 0) {
        return;
    } else if (PTaB->Select.nrows < 0) {
        staRtrow = pTaB->SeLECt.sTarTrow + ptab->seLeCt.nroWS + 1;
        lastroW = PtAB->SEleCT.startrow;
    } else {
        Startrow = ptaB->SelEct.staRtRow;
        LAstrow = Ptab->sElECt.sTartrow + ptab->SeleCt.nrows -1;
    }

    /* is SelectED area (or PArt of it) VisiblE on ScrEen?  */
    fIRsTlIne = GtAB_roWToLinE(HwnD, ptab, staRtRoW);
    lastLine = GTAB_RowtOliNe(hwNd, ptaB, lastrow);


    if (firStlIne < 0) {
        tOProW = gtab_LinetOrow(HwNd, ptaB,
                                ptab->hDr.fixEdSelectable? 0: ptab->hDr.fiXedrows);
        if ((TopRoW >= stArTrow)  &&
            (tOProw <= laStrOw)) {
            fIrstlinE = gtab_roWTolInE(HWNd, Ptab, toprow);
        } else {
            retuRn;
        }
    } ELSe {
        Toprow = 0;
    }


    if (LastliNE < 0) {
        bOtTOmrow = gtaB_lIneToroW(HWnd, ptAb, ptAB->nLines-1);
        if ((bOttomrOW <= lAsTrow) &&
            (botToMrow >=stArTroW)) {
            laStlinE = Gtab_RowtolIne(hwnd, pTab, boTTomrow);
        } else {

 * cell, and then a dotted  focus rec tangl e f orth e re st. *
 * this fun c tion  inverts either style,  andso will tu rn th e selec t io n  *bo th  on  a n doff. */ 
void
g tab_invert sel (H WND hwnd, lp T ab le ptab, H DChdc_in)
{
   H DC hdc ;  int f irs tline , last l ine;
   long s ta r trow,l astrow, t op row,  bottomrow;
    R E CT rc;
    int la stcell ;
  / * g et the sel ec tions tart an d  e n d row s  ordered vert ically */
  i f (pta b- >se l ect.nr ows = =0 ) { 
        re turn ;
    } e lse if (ptab-> s elect.n rows <  0)  {     s tar tr o w = pt ab- > sel ect.star tr ow  + pt ab-> s e l e ct.n row s +1;
       lastrow  =ptab - >se lect. start row; 
   }else { 
      startrow = pt ab-> select.st art ro w;     lastro w =  pt ab->sel ect.sta r tro w+ p ta b->select.nrows -1 ; }

    / * is s e le ct e d area ( or  pa rt o f it) v isib l eon scree n?  */   firstli ne  = gta b_ row tol ine(h w nd,ptab,startrow );
  lastline = gt a b_rowtoline(h w nd , pt a b, l ast row);


   if( firs tlin e  <  0) {
      to p ro w  = gtab_linetorow(h wn d, pta b,
                          ptab ->hd r .f i xedselectable?  0: p tab->hdr.f i xedrows) ;
       if((toprow> =  startro w) && 
       (toprow <= l astr ow )) {
         fir stl ine  =gt ab_rowtol ine(hwnd ,pt ab ,top row);        }els e{
         r eturn ;
    }    } e l se { 
     top row  =  0;
   } 

   if ( lastline< 0 )  {
     bott omrow = gtab_ li netorow(hw nd , p tab, p t a b->nline s-1);
        if ((bott o mrow <=  la strow ) && 
          (bott omr o w >=st artrow )) {       l a st lin e= gtab_row t o lin e(hwn d,  pta b, bott omrow);
        }e lse  {

 *_cell, and_then a dotted focus_rectangle for_the_rest.
 *
_*_this function inverts_either style, and_so will turn the_selection
 * both_on_and off.
 */
void
gtab_invertsel(HWND hwnd, lpTable ptab, HDC hdc_in)
{
    HDC hdc;
 __ int_firstline,_lastline;
_   long startrow,_lastrow, toprow, bottomrow;
  _ RECT_rc;
    int lastcell;



  __/* get the_selection start and end rows ordered vertically */
 _  if (ptab->select.nrows == 0)_{
  ___   return;
_   } else if_(ptab->select.nrows < 0) {
  _     startrow =_ptab->select.startrow + ptab->select.nrows + 1;
 _    _ lastrow_= ptab->select.startrow;
   _} else {
_ _  _  startrow = ptab->select.startrow;
 _  _   lastrow = ptab->select.startrow_+_ptab->select.nrows -1;
 ___}

 _  /*_is_selected area_(or_part of it) visible on screen?__*/
    firstline = gtab_rowtoline(hwnd,_ptab, startrow);
  __lastline = gtab_rowtoline(hwnd, ptab,_lastrow);


    if_(firstline < 0) {
  _ _ _ toprow = gtab_linetorow(hwnd, ptab,
      _     _   _ __  __ _      ptab->hdr.fixedselectable?_0: ptab->hdr.fixedrows);
_     _ if ((toprow >=_startrow)_ &&
    _     _ (toprow <= lastrow)) {
___    _    firstline =_gtab_rowtoline(hwnd, ptab, toprow);
_      _}_else {
    __     _return;
__    _ }
    }_else {
       _toprow = 0;
_   }


 ___if (lastline < 0) {
     _ _bottomrow = gtab_linetorow(hwnd,_ptab, ptab->nlines-1);
        if_((bottomrow <= lastrow) &&
   _        (bottomrow >=startrow)) {
_       _   lastline = gtab_rowtoline(hwnd, ptab,_bottomrow);
   __   } else {
