srccontrols/matrix/iupmat_draw.c
void iupMatrixDrawTitleLines(Ihandle* ih, int lin1, int lin2)
{
  int x1, y1, x2, y2, first_lin, adjust_merged_lin = 0;
  int lin, col_alignment, active, framehighlight;
  long framecolor;
  IFniiiiiiC draw_cb;

  /* here col==0 always */

  if (!ih->data->columns.dt[0].size)
    return;

  if (ih->data->merge_info_count)
    adjust_merged_lin = iMatrixAdjustVisibleLinToMergedCells(ih, &lin1, 0, 0);

  if (ih->data->lines.num_noscroll > 1 && lin1 == 1 && lin2 == ih->data->lines.num_noscroll - 1)
  {
    first_lin = 0;
    y1 = 0;
  }
  else
  {
    if (lin1 > ih->data->lines.last ||
        lin2 < ih->data->lines.first)
        return;

    if (!adjust_merged_lin && lin1 < ih->data->lines.first)
      lin1 = ih->data->lines.first;
    if (lin2 > ih->data->lines.last)
      lin2 = ih->data->lines.last;

    first_lin = ih->data->lines.first;
    y1 = 0;
    for (lin = 0; lin < ih->data->lines.num_noscroll; lin++)
      y1 += ih->data->lines.dt[lin].size;
  }

  /* Start the position of the line title */
  x1 = 0;
  x2 = ih->data->columns.dt[0].size;

  iupMATRIX_CLIPAREA(ih, x1, x2, y1, iupMatrixGetHeight(ih) - 1);
  cdCanvasClip(ih->data->cd_canvas, CD_CLIPAREA);

  /* Find the initial position of the first line */
  if (first_lin == ih->data->lines.first)
    y1 -= ih->data->lines.first_offset;
  for (lin = first_lin; lin < lin1; lin++)
    y1 += ih->data->lines.dt[lin].size;
  if (adjust_merged_lin)
  {
    for (lin = first_lin; lin > lin1; lin--)
      y1 -= ih->data->lines.dt[lin].size;
  }

  framecolor = cdIupConvertColor(iupAttribGetStr(ih, "FRAMECOLOR"));
  framehighlight = iupAttribGetInt(ih, "FRAMETITLEHIGHLIGHT");
  active = iupdrvIsActive(ih);
  draw_cb = (IFniiiiiiC)IupGetCallback(ih, "DRAW_CB");

  col_alignment = iupMatrixGetColAlignment(ih, 0);

  /* Draw the titles */
  for (lin = lin1; lin <= lin2; lin++)
  {
    int merged, i;

    /* If it is a hidden line (size = 0), don't draw the title */
    if (ih->data->lines.dt[lin].size == 0)
      continue;

    merged = 0;
    if (ih->data->merge_info_count)
      merged = iupMatrixGetMerged(ih, lin, 0);

    y2 = y1 + ih->data->lines.dt[lin].size;

    if (merged)
    {
      int startLin, endLin, startCol, endCol;
      iupMatrixGetMergedRect(ih, merged, &startLin, &endLin, &startCol, &endCol);

      if (lin == startLin && 0 == startCol)  /* merged start */
      {
        for (i = startLin + 1; i <= endLin; i++)
          y2 += ih->data->lines.dt[i].size;
      }
      else
        continue;  /* ignore internal merged */
    }

    /* If it doesn't have title, the loop just calculate the final position */
    if (ih->data->columns.dt[0].size)
    {
      int marked = iupMatrixLineIsMarked(ih, lin);
      int lin_alignment = iupMatrixGetLinAlignment(ih, lin);

      iMatrixDrawBackground(ih, x1, x2, y1, y2, marked, active, lin, 0);

      iMatrixDrawFrameRectTitle(ih, lin, 0, x1, x2, y1, y2, framecolor, framehighlight);

      iMatrixDrawCellValue(ih, x1, x2, y1, y2, col_alignment, lin_alignment, marked, active, lin, 0, draw_cb, framecolor);
    }

    y1 = y2;
  }

  cdCanvasClip(ih->data->cd_canvas, CD_CLIPOFF);
}
/* Draw the line titles, visible, between lin and lastlin, include it.
   Line titles marked will be draw with the appropriate feedback.
   -> lin1 - First line to have its title drawn
   -> lin2 - Last line to have its title drawn */
Draw the line titles, visible, between lin and lastlin, include it.
Line titles marked will be draw with the appropriate feedback.
> lin1 - First line to have its title drawn
> lin2 - Last line to have its title drawn
Draw the line titles visible between lin and lastlin include it . Line titles marked will be draw with the appropriate feedback . > lin1 - First line to have its title drawn > lin2 - Last line to have its title drawn
void iupMatrixDrawTitleLines(Ihandle* ih, int lin1, int lin2)
{
  int x1, y1, x2, y2, first_lin, adjust_merged_lin = 0;
  int lin, col_alignment, active, framehighlight;
  long framecolor;
  IFniiiiiiC draw_cb;
  if (!ih->data->columns.dt[0].size)
    return;
  if (ih->data->merge_info_count)
    adjust_merged_lin = iMatrixAdjustVisibleLinToMergedCells(ih, &lin1, 0, 0);
  if (ih->data->lines.num_noscroll > 1 && lin1 == 1 && lin2 == ih->data->lines.num_noscroll - 1)
  {
    first_lin = 0;
    y1 = 0;
  }
  else
  {
    if (lin1 > ih->data->lines.last ||
        lin2 < ih->data->lines.first)
        return;
    if (!adjust_merged_lin && lin1 < ih->data->lines.first)
      lin1 = ih->data->lines.first;
    if (lin2 > ih->data->lines.last)
      lin2 = ih->data->lines.last;
    first_lin = ih->data->lines.first;
    y1 = 0;
    for (lin = 0; lin < ih->data->lines.num_noscroll; lin++)
      y1 += ih->data->lines.dt[lin].size;
  }
  x1 = 0;
  x2 = ih->data->columns.dt[0].size;
  iupMATRIX_CLIPAREA(ih, x1, x2, y1, iupMatrixGetHeight(ih) - 1);
  cdCanvasClip(ih->data->cd_canvas, CD_CLIPAREA);
  if (first_lin == ih->data->lines.first)
    y1 -= ih->data->lines.first_offset;
  for (lin = first_lin; lin < lin1; lin++)
    y1 += ih->data->lines.dt[lin].size;
  if (adjust_merged_lin)
  {
    for (lin = first_lin; lin > lin1; lin--)
      y1 -= ih->data->lines.dt[lin].size;
  }
  framecolor = cdIupConvertColor(iupAttribGetStr(ih, "FRAMECOLOR"));
  framehighlight = iupAttribGetInt(ih, "FRAMETITLEHIGHLIGHT");
  active = iupdrvIsActive(ih);
  draw_cb = (IFniiiiiiC)IupGetCallback(ih, "DRAW_CB");
  col_alignment = iupMatrixGetColAlignment(ih, 0);
  for (lin = lin1; lin <= lin2; lin++)
  {
    int merged, i;
    if (ih->data->lines.dt[lin].size == 0)
      continue;
    merged = 0;
    if (ih->data->merge_info_count)
      merged = iupMatrixGetMerged(ih, lin, 0);
    y2 = y1 + ih->data->lines.dt[lin].size;
    if (merged)
    {
      int startLin, endLin, startCol, endCol;
      iupMatrixGetMergedRect(ih, merged, &startLin, &endLin, &startCol, &endCol);
      if (lin == startLin && 0 == startCol)  
      {
        for (i = startLin + 1; i <= endLin; i++)
          y2 += ih->data->lines.dt[i].size;
      }
      else
        continue;  
    }
    if (ih->data->columns.dt[0].size)
    {
      int marked = iupMatrixLineIsMarked(ih, lin);
      int lin_alignment = iupMatrixGetLinAlignment(ih, lin);
      iMatrixDrawBackground(ih, x1, x2, y1, y2, marked, active, lin, 0);
      iMatrixDrawFrameRectTitle(ih, lin, 0, x1, x2, y1, y2, framecolor, framehighlight);
      iMatrixDrawCellValue(ih, x1, x2, y1, y2, col_alignment, lin_alignment, marked, active, lin, 0, draw_cb, framecolor);
    }
    y1 = y2;
  }
  cdCanvasClip(ih->data->cd_canvas, CD_CLIPOFF);
}
void iupMatrixDrawTitleLines ( Ihandle * ih , int lin1 , int lin2 ) { int x1 , y1 , x2 , y2 , first_lin , adjust_merged_lin = 0 ; int lin , col_alignment , active , framehighlight ; long framecolor ; IFniiiiiiC draw_cb ; if ( ! ih -> data -> columns . dt [ 0 ] . size ) return ; if ( ih -> data -> merge_info_count ) adjust_merged_lin = iMatrixAdjustVisibleLinToMergedCells ( ih , & lin1 , 0 , 0 ) ; if ( ih -> data -> lines . num_noscroll > 1 && lin1 == 1 && lin2 == ih -> data -> lines . num_noscroll - 1 ) { first_lin = 0 ; y1 = 0 ; } else { if ( lin1 > ih -> data -> lines . last || lin2 < ih -> data -> lines . first ) return ; if ( ! adjust_merged_lin && lin1 < ih -> data -> lines . first ) lin1 = ih -> data -> lines . first ; if ( lin2 > ih -> data -> lines . last ) lin2 = ih -> data -> lines . last ; first_lin = ih -> data -> lines . first ; y1 = 0 ; for ( lin = 0 ; lin < ih -> data -> lines . num_noscroll ; lin ++ ) y1 += ih -> data -> lines . dt [ lin ] . size ; } x1 = 0 ; x2 = ih -> data -> columns . dt [ 0 ] . size ; iupMATRIX_CLIPAREA ( ih , x1 , x2 , y1 , iupMatrixGetHeight ( ih ) - 1 ) ; cdCanvasClip ( ih -> data -> cd_canvas , CD_CLIPAREA ) ; if ( first_lin == ih -> data -> lines . first ) y1 -= ih -> data -> lines . first_offset ; for ( lin = first_lin ; lin < lin1 ; lin ++ ) y1 += ih -> data -> lines . dt [ lin ] . size ; if ( adjust_merged_lin ) { for ( lin = first_lin ; lin > lin1 ; lin -- ) y1 -= ih -> data -> lines . dt [ lin ] . size ; } framecolor = cdIupConvertColor ( iupAttribGetStr ( ih , " " ) ) ; framehighlight = iupAttribGetInt ( ih , " " ) ; active = iupdrvIsActive ( ih ) ; draw_cb = ( IFniiiiiiC ) IupGetCallback ( ih , " " ) ; col_alignment = iupMatrixGetColAlignment ( ih , 0 ) ; for ( lin = lin1 ; lin <= lin2 ; lin ++ ) { int merged , i ; if ( ih -> data -> lines . dt [ lin ] . size == 0 ) continue ; merged = 0 ; if ( ih -> data -> merge_info_count ) merged = iupMatrixGetMerged ( ih , lin , 0 ) ; y2 = y1 + ih -> data -> lines . dt [ lin ] . size ; if ( merged ) { int startLin , endLin , startCol , endCol ; iupMatrixGetMergedRect ( ih , merged , & startLin , & endLin , & startCol , & endCol ) ; if ( lin == startLin && 0 == startCol ) { for ( i = startLin + 1 ; i <= endLin ; i ++ ) y2 += ih -> data -> lines . dt [ i ] . size ; } else continue ; } if ( ih -> data -> columns . dt [ 0 ] . size ) { int marked = iupMatrixLineIsMarked ( ih , lin ) ; int lin_alignment = iupMatrixGetLinAlignment ( ih , lin ) ; iMatrixDrawBackground ( ih , x1 , x2 , y1 , y2 , marked , active , lin , 0 ) ; iMatrixDrawFrameRectTitle ( ih , lin , 0 , x1 , x2 , y1 , y2 , framecolor , framehighlight ) ; iMatrixDrawCellValue ( ih , x1 , x2 , y1 , y2 , col_alignment , lin_alignment , marked , active , lin , 0 , draw_cb , framecolor ) ; } y1 = y2 ; } cdCanvasClip ( ih -> data -> cd_canvas , CD_CLIPOFF ) ; }
Draw the line titles, visible, between lin and lastlin, include it.
Draw the line titles visible between lin and lastlin include it .
/* here col==0 always */ /* Start the position of the line title */ /* Find the initial position of the first line */ /* Draw the titles */ /* If it is a hidden line (size = 0), don't draw the title */ /* merged start */ /* ignore internal merged */ /* If it doesn't have title, the loop just calculate the final position */