Ignore:
Timestamp:
May 16, 2011, 2:37:19 AM (12 years ago)
Author:
Sam Hocevar
Message:

imlib: make JCFont use vec2i classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/filesel.cpp

    r655 r668  
    3030  file_picker(int X, int Y, int ID, int Rows, ifield *Next);
    3131  virtual int total() { return tf+td; }
    32   virtual int item_width() { return wm->font()->width()*wid; }
    33   virtual int item_height() { return wm->font()->height()+1; }
     32  virtual int item_width() { return wm->font()->Size().x * wid; }
     33  virtual int item_height() { return wm->font()->Size().y + 1; }
    3434  virtual void draw_item(image *screen, int x, int y, int num, int active);
    3535  virtual void note_selection(image *screen, InputManager *inm, int x);
     
    9595void file_picker::draw_item(image *screen, int x, int y, int num, int active)
    9696{
    97   if (active)
    98     screen->Bar(vec2i(x, y),
    99                 vec2i(x + item_width() - 1, y + item_height() - 1),
    100                 wm->black());
     97    if (active)
     98        screen->Bar(vec2i(x, y),
     99                    vec2i(x + item_width() - 1, y + item_height() - 1),
     100                    wm->black());
    101101
    102   if (num<td)
    103   {
    104     char st[100];
    105     sprintf(st,"<%s>",d[num]);
    106     wm->font()->put_string(screen,x,y,st,wm->bright_color());
    107   } else
    108     wm->font()->put_string(screen,x,y,f[num-td],wm->bright_color());
     102    char st[100], *dest;
     103    if (num >= td)
     104        dest = f[num - td];
     105    else
     106        sprintf(dest = st, "<%s>", d[num]);
     107
     108    wm->font()->PutString(screen, vec2i(x, y), dest, wm->bright_color());
    109109}
    110110
     
    132132                     int filename_id)
    133133{
    134   int wh2 = 5 + wm->font()->height() + 5;
    135   int wh3 = wh2 + wm->font()->height() + 12;
     134  int wh2 = 5 + wm->font()->Size().y + 5;
     135  int wh3 = wh2 + wm->font()->Size().y + 12;
    136136  Jwindow *j=wm->new_window(0,0,-1,-1,
    137137                new info_field(5, 5, 0, prompt,
     
    140140                new button(50, wh3, ok_id, ok_name,
    141141                new button(100, wh3, cancel_id, cancel_name,
    142                 new file_picker(15, wh3 + wm->font()->height() + 10, filename_id, 8,
     142                new file_picker(15, wh3 + wm->font()->Size().y + 10, filename_id, 8,
    143143                      NULL))))),
    144144
Note: See TracChangeset for help on using the changeset viewer.