Back to index

texmacs  1.0.7.15
Classes | Defines | Functions
rubber_boxes.cpp File Reference
#include "boxes.hpp"

Go to the source code of this file.

Classes

struct  empty_box_rep
struct  marker_box_rep
struct  bracket_box_rep

Defines

#define Lbracket   1011
#define Lcrochet   1012
#define Langular   1013
#define Laccolade   1014
#define Rbracket   1021
#define Rcrochet   1022
#define Rangular   1023
#define Raccolade   1024
#define Voidbr   1030
#define Absolute   1031

Functions

SI bracket_width (int br_type, SI height, SI penw)
void draw_bracket (renderer ren, int br_type, SI x, SI y, SI w, SI h, SI lw)
box empty_box (path ip, int x1, int y1, int x2, int y2)
box marker_box (path ip, int x1, int y1, int x2, int y2, box ref)
box bracket_box (path ip, int br_type, SI penw, color col, SI y1, SI y2)

Define Documentation

#define Absolute   1031

Definition at line 30 of file rubber_boxes.cpp.

#define Laccolade   1014

Definition at line 24 of file rubber_boxes.cpp.

#define Langular   1013

Definition at line 23 of file rubber_boxes.cpp.

#define Lbracket   1011

Definition at line 21 of file rubber_boxes.cpp.

#define Lcrochet   1012

Definition at line 22 of file rubber_boxes.cpp.

#define Raccolade   1024

Definition at line 28 of file rubber_boxes.cpp.

#define Rangular   1023

Definition at line 27 of file rubber_boxes.cpp.

#define Rbracket   1021

Definition at line 25 of file rubber_boxes.cpp.

#define Rcrochet   1022

Definition at line 26 of file rubber_boxes.cpp.

#define Voidbr   1030

Definition at line 29 of file rubber_boxes.cpp.


Function Documentation

box bracket_box ( path  ip,
int  br_type,
SI  penw,
color  col,
SI  y1,
SI  y2 
)

Definition at line 228 of file rubber_boxes.cpp.

                                                                     {
  return tm_new<bracket_box_rep> (ip, br_type, penw, col, y1, y2);
}
SI bracket_width ( int  br_type,
SI  height,
SI  penw 
)

Definition at line 93 of file rubber_boxes.cpp.

                                                {
  switch (br_type) {
  case Lbracket:
  case Rbracket:
  case Lcrochet:
  case Rcrochet:
  case Laccolade:
  case Raccolade:
  case Langular:
  case Rangular:
    {
      SI ref_size  = penw/2;
      double factor= sqrt (((double) height) / ((double) ref_size));
      if (factor<2) factor=2;
      factor=factor*1.412;
      return (2*penw) + ((SI) (((double) height)/factor));
    }
  case Absolute:
    return 2*penw;
  case Voidbr:
  default:
    return 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_bracket ( renderer  ren,
int  br_type,
SI  x,
SI  y,
SI  w,
SI  h,
SI  lw 
)

Definition at line 130 of file rubber_boxes.cpp.

                                                                        {
  x+=lw; w-=2*lw;
  y+=lw; h-=2*lw;
  switch (br_type) {
  case Lbracket:
    {
      int i;
      SI ww= (SI) (((double) w) / (1.0- sqrt (0.5)));
      SI hh= (SI) (((double) h) / sqrt (2.0));
      SI ox= x+ ww;
      SI oy= y+ (h>>1);
      ren->set_line_style (PIXEL);
      for (i=0; i<lw; i+=PIXEL)
       ren->arc (ox-ww+i, oy-hh, ox+ww-i, oy+hh, 135<<6, 90<<6);
    }
    break;
  case Rbracket:
    {
      int i;
      SI ww= (SI) (((double) w) / (1.0- sqrt (0.5)));
      SI hh= (SI) (((double) h) / sqrt (2.0));
      SI ox= x+ w- ww;
      SI oy= y+ (h>>1);
      ren->set_line_style (PIXEL);
      for (i=0; i<lw; i+=PIXEL)
       ren->arc (ox-ww+i, oy-hh, ox+ww-i, oy+hh, -(45<<6), 90<<6);
    }
    break;
  case Lcrochet:
    ren->line (x, y, x, y+h);
    ren->line (x, y, x+w, y);
    ren->line (x, y+h, x+w, y+h);
    break;
  case Rcrochet:
    ren->line (x+w, y, x+w, y+h);
    ren->line (x, y, x+w, y);
    ren->line (x, y+h, x+w, y+h);
    break;
  case Laccolade:
  case Raccolade:
    {
      SI d = w>>1;
      SI ox= x+ (w>>1);
      SI oy= y+ (h>>1);
      // SI xx= x+ w;
      SI yy= y+ h;
      ren->line (ox, y+d-PIXEL, ox, oy-d);
      ren->line (ox, oy+d-PIXEL, ox, yy-d);
      if (br_type==Laccolade) {
       ren->arc (ox, yy-w, ox+w, yy, 90<<6, 90<<6);
       ren->arc (ox-w, oy, ox, oy+w, 270<<6, 90<<6);
       ren->arc (ox-w, oy-w, ox, oy, 0, 90<<6);
       ren->arc (ox, y, ox+w, y+w, 180<<6, 90<<6);
      }
      else {
       ren->arc (ox-w, yy-w, ox, yy, 0, 90<<6);
       ren->arc (ox, oy, ox+w, oy+w, 180<<6, 90<<6);
       ren->arc (ox, oy-w, ox+w, oy, 90<<6, 90<<6);
       ren->arc (ox-w, y, ox, y+w, 270<<6, 90<<6);
      }
    }
    break;
  case Langular:
    ren->line (x, y+(h>>1), x+w, y);
    ren->line (x, y+(h>>1), x+w, y+h);
    break;
  case Rangular:
    ren->line (x+w, y+(h>>1), x, y);
    ren->line (x+w, y+(h>>1), x, y+h);
    break;
  case Absolute:
    ren->line (x, y, x, y+h);
    break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

box empty_box ( path  ip,
int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 218 of file rubber_boxes.cpp.

                                                    {
  return tm_new<empty_box_rep> (ip, x1, y1, x2, y2);
}

Here is the caller graph for this function:

box marker_box ( path  ip,
int  x1,
int  y1,
int  x2,
int  y2,
box  ref 
)

Definition at line 223 of file rubber_boxes.cpp.

                                                              {
  return tm_new<marker_box_rep> (ip, x1, y1, x2, y2, ref);
}

Here is the caller graph for this function: