Changeset 106 for abuse


Ignore:
Timestamp:
Mar 15, 2008, 12:55:44 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Rename the "eh" variable to "wm" because it's a window manager, not an event handler.
  • No longer pass the window manager to functions, there's only one.

Inspired by Win32 Abuse changelog for January 28, 2001:

  • Starting work on singleton code; will get rid of all

references to an arbitrary window_manager* because
there's only going to be one, and it's not ever
going to change.

Location:
abuse/trunk/src
Files:
50 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/ant.cpp

    r60 r106  
    443443  {
    444444    fade_out(8);
    445     eh->set_mouse_position(0,0);
     445    wm->set_mouse_position(0,0);
    446446    screen->clear();
    447447    image *im=cash.img(cash.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
     
    468468    } else sprintf(msg,"%s : %s",symbol_str("lev_complete"),current_level->original_name());
    469469
    470     int w=eh->font()->width()*strlen(msg),h=eh->font()->height();   
     470    int w=wm->font()->width()*strlen(msg),h=wm->font()->height();   
    471471    int x=(x1+x2)/2-w/2,y=(y1+y2)/2-h/2;
    472     screen->bar(x-10,y-10,x+w+10,y+h+10,eh->bright_color());
    473     screen->bar(x-9,y-9,x+w+9,y+h+9,eh->medium_color());
    474 
    475     eh->font()->put_string(screen,x+1,y+1,msg,eh->dark_color());   
    476     eh->font()->put_string(screen,x,y,msg,eh->bright_color());
    477     eh->flush_screen();
     472    screen->bar(x-10,y-10,x+w+10,y+h+10,wm->bright_color());
     473    screen->bar(x-9,y-9,x+w+9,y+h+9,wm->medium_color());
     474
     475    wm->font()->put_string(screen,x+1,y+1,msg,wm->dark_color());   
     476    wm->font()->put_string(screen,x,y,msg,wm->bright_color());
     477    wm->flush_screen();
    478478    milli_wait(500);
    479479  }
  • abuse/trunk/src/automap.cpp

    r56 r106  
    153153  if (automap_window)
    154154  {   
    155     eh->close_window(automap_window);
     155    wm->close_window(automap_window);
    156156    automap_window=NULL;
    157157  }
     
    161161    old_dy=-1000;
    162162
    163     automap_window=eh->new_window(0,0,w*AUTOTILE_WIDTH,h*AUTOTILE_HEIGHT);
    164     automap_window->screen->bar(17,1,17+8*6+3,6,eh->medium_color());   
    165     eh->font()->put_string(automap_window->screen,20,2,"AUTOMAP");
     163    automap_window=wm->new_window(0,0,w*AUTOTILE_WIDTH,h*AUTOTILE_HEIGHT);
     164    automap_window->screen->bar(17,1,17+8*6+3,6,wm->medium_color());   
     165    wm->font()->put_string(automap_window->screen,20,2,"AUTOMAP");
    166166    draw();   
    167167  } 
     
    198198        break; 
    199199      case EV_CLOSE_WINDOW :
    200         eh->close_window(automap_window);
     200        wm->close_window(automap_window);
    201201        automap_window=NULL;
    202202        break;               
  • abuse/trunk/src/chat.cpp

    r56 r106  
    1313#include "dev.hpp"
    1414
    15 chat_console::chat_console(window_manager *WM, JCFont *font, int width, int height) :
    16   console(WM,font,width,height<4 ? 4 : height,symbol_str("CHAT"))
     15chat_console::chat_console(JCFont *font, int width, int height) :
     16  console(font,width,height<4 ? 4 : height,symbol_str("CHAT"))
    1717{
    1818  clear();
  • abuse/trunk/src/chat.hpp

    r57 r106  
    2121  void put_all(char *st);
    2222  void clear();
    23   chat_console(window_manager *WM, JCFont *font, int width, int height);
     23  chat_console(JCFont *font, int width, int height);
    2424 
    2525} ;
  • abuse/trunk/src/clisp.cpp

    r92 r106  
    927927      return ret;
    928928    } break;
    929     case 51 :   return new_lisp_pointer(eh->font()); break;
     929    case 51 :   return new_lisp_pointer(wm->font()); break;
    930930    case 52 :
    931931    {
     
    12971297      return 1;
    12981298    } break;
    1299     case 93 : return eh->dark_color(); break;
    1300     case 94 : return eh->medium_color(); break;
    1301     case 95 : return eh->bright_color(); break;
     1299    case 93 : return wm->dark_color(); break;
     1300    case 94 : return wm->medium_color(); break;
     1301    case 95 : return wm->bright_color(); break;
    13021302
    13031303    case 99 : current_object->remove_object((game_object *)lpointer_value(CAR(args))); return 1; break;
     
    21842184      c_target=id;
    21852185      if (screen)
    2186         eh->set_mouse_shape(cash.img(c_target)->copy(),x,y);
     2186        wm->set_mouse_shape(cash.img(c_target)->copy(),x,y);
    21872187    } break;
    21882188    case 276 :
  • abuse/trunk/src/config.cpp

    r93 r106  
    161161                        b4 = 0;
    162162                }
    163                 else if( !eh )
     163                else if( !wm )
    164164                {
    165165                        x = y = b1 = b2 = b3 = b4 = 0;
  • abuse/trunk/src/console.cpp

    r88 r106  
    7575}
    7676
    77 console::console(window_manager *WM, JCFont *font, int width, int height, char const *Name)
    78 {
    79   wm=WM;
     77console::console(JCFont *font, int width, int height, char const *Name)
     78{
    8079  con_win=NULL;
    8180  w=width;
     
    122121      memset(screen+w*(h-1),' ',w);
    123122      redraw();
    124       eh->flush_screen();
     123      wm->flush_screen();
    125124    }
    126125  } else draw_cursor();   
     
    173172
    174173
    175 shell_term::shell_term(window_manager *WM, JCFont *font, int width, int height, char const *Name) :
    176   console(WM,font,width,height,Name)
     174shell_term::shell_term(JCFont *font, int width, int height, char const *Name) :
     175  console(font,width,height,Name)
    177176{
    178177  shcmd[0]=0;
     
    191190}
    192191
    193 int shell_term::handle_event(event &ev, window_manager *wm)
     192int shell_term::handle_event(event &ev)
    194193{
    195194  if (ev.window==con_win && con_win)
  • abuse/trunk/src/console.hpp

    r57 r106  
    1919  char *screen;
    2020  jwindow *con_win;
    21   window_manager *wm;
    2221  char *name;
    2322  public :
    2423
    25   console(window_manager *WM, JCFont *font, int width, int height, char const *Name);
     24  console(JCFont *font, int width, int height, char const *Name);
    2625  int showing() { return con_win!=NULL; }
    2726  void show();
     
    4645  char shcmd[300];
    4746  public :
    48   shell_term(window_manager *WM, JCFont *font, int width, int height, char const *Name);
     47  shell_term(JCFont *font, int width, int height, char const *Name);
    4948  virtual ~shell_term() {};
    50   int handle_event(event &ev, window_manager *wm);
     49  int handle_event(event &ev);
    5150  virtual void prompt();
    5251  virtual void execute(char const *st);
  • abuse/trunk/src/cop.cpp

    r61 r106  
    10081008  }
    10091009
    1010   JCFont *fnt=eh->font();
     1010  JCFont *fnt=wm->font();
    10111011  if (local)
    10121012  {
     
    10391039{
    10401040  fade_out(8);
    1041   eh->set_mouse_position(0,0);
     1041  wm->set_mouse_position(0,0);
    10421042  screen->clear();
    10431043  image *im=cash.img(cash.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
    10441044  im->put_image(screen,0,0);
    10451045  int x1=im->width()+1,y1=0,y2=screen->height();
    1046   JCFont *fnt=eh->font();
     1046  JCFont *fnt=wm->font();
    10471047 
    10481048  view *v=player_list; int tp=0,i;
     
    10511051  int y=(y1+y2)/2-(tp+2)*fnt->height()/2,x=x1+10;
    10521052  char const *header_str = symbol_str("score_header");
    1053   fnt->put_string(screen,x,y,header_str,eh->bright_color());
     1053  fnt->put_string(screen,x,y,header_str,wm->bright_color());
    10541054  y+=fnt->height();
    10551055
    10561056  screen->wiget_bar(x,y+2,x+strlen(header_str)*fnt->width(),y+fnt->height()-3,
    1057                      eh->bright_color(),eh->medium_color(),eh->dark_color());
     1057                     wm->bright_color(),wm->medium_color(),wm->dark_color());
    10581058  y+=fnt->height();
    10591059  v=player_list;
     
    10751075  }
    10761076 
    1077   eh->flush_screen();
     1077  wm->flush_screen();
    10781078  milli_wait(4000);   // wait 4 seconds
    10791079
  • abuse/trunk/src/demo.cpp

    r88 r106  
    3535extern void fade_out(int steps);
    3636
    37 void get_event(event &ev, window_manager *wm)
     37void get_event(event &ev)
    3838{ wm->get_event(ev);
    3939  switch (ev.type)
     
    5757}
    5858
    59 int event_waiting(window_manager *wm)
     59int event_waiting()
    6060{ return wm->event_waiting(); }
    6161
     
    120120        int32_t mx,my;
    121121        the_game->game_to_mouse(player_list->pointer_x,player_list->pointer_y,player_list,mx,my);
    122         eh->set_mouse_position(small_render ? mx*2 : mx, small_render ? my*2 : my);
     122        wm->set_mouse_position(small_render ? mx*2 : mx, small_render ? my*2 : my);
    123123      }
    124124      else
     
    210210      l_difficulty=initial_difficulty;
    211211      the_game->set_state(MENU_STATE);
    212       eh->push_event(new event(ID_NULL,NULL));
     212      wm->push_event(new event(ID_NULL,NULL));
    213213
    214214      view *v=player_list;
  • abuse/trunk/src/demo.hpp

    r57 r106  
    3838extern demo_manager demo_man;
    3939
    40 extern void get_event(event &ev, window_manager *wm);
    41 extern int event_waiting(window_manager *wm);
     40extern void get_event(event &ev);
     41extern int event_waiting();
    4242
    4343
  • abuse/trunk/src/dev.cpp

    r105 r106  
    100100  public :
    101101  cached_image(int Id) { id=Id; }
    102   virtual void draw(image *screen, int x, int y,
    103                     window_manager *wm, filter *f)
     102  virtual void draw(image *screen, int x, int y, filter *f)
    104103  {
    105104    if (f)
     
    108107      cash.img(id)->put_image(screen,x,y);
    109108  }
    110   virtual int width(window_manager *wm) { return cash.img(id)->width(); }
    111   virtual int height(window_manager *wm) { return cash.img(id)->height(); }
     109  virtual int width() { return cash.img(id)->width(); }
     110  virtual int height() { return cash.img(id)->height(); }
    112111} ;
    113112
     
    139138{
    140139  public :
    141   amb_cont(int X, int Y, ifield *Next) : scroller(X,Y,ID_NULL,100,eh->font()->height()+2,0,64,Next)
     140  amb_cont(int X, int Y, ifield *Next) : scroller(X,Y,ID_NULL,100,wm->font()->height()+2,0,64,Next)
    142141  { if (player_list) sx=player_list->ambient; }
    143   virtual void scroll_event(int newx, image *screen, window_manager *wm)
     142  virtual void scroll_event(int newx, image *screen)
    144143  {
    145144    screen->bar(x,y,x+l-1,y+h-1,wm->dark_color());
    146145    char st[100];
    147146    sprintf(st,"%d",newx);
    148     wm->font()->put_string(screen,x+30,y+1,st,eh->bright_color());
     147    wm->font()->put_string(screen,x+30,y+1,st,wm->bright_color());
    149148    if (player_list)
    150149      player_list->ambient=newx;
     
    160159
    161160
    162   jwindow *quitw=eh->new_window(xres/2+40,yres/2,80,-1,
     161  jwindow *quitw=wm->new_window(xres/2+40,yres/2,80,-1,
    163162                          new button(WINDOW_FRAME_LEFT+10,WINDOW_FRAME_TOP+20,ID_QUIT_OK,ok_image,
    164163                          new button(WINDOW_FRAME_LEFT+38,WINDOW_FRAME_TOP+20,ID_CANCEL,cancel_image,
    165164                          new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,ID_NULL,symbol_str("sure?"),NULL))),
    166165                                    symbol_str("quit_title"));
    167   eh->grab_focus(quitw);
     166  wm->grab_focus(quitw);
    168167  int fin=0,quit=0;
    169168  do
    170169  {
    171     eh->flush_screen();
     170    wm->flush_screen();
    172171
    173172    event ev;
    174     eh->get_event(ev);
     173    wm->get_event(ev);
    175174    if (ev.type==EV_MESSAGE && ev.message.id==ID_QUIT_OK)
    176175      fin=quit=1;
     
    189188  the_game->reset_keymap();
    190189
    191   eh->close_window(quitw);
    192   eh->flush_screen();
     190  wm->close_window(quitw);
     191  wm->flush_screen();
    193192  return quit;
    194193}
     
    292291int32_t dev_controll::snap_x(int32_t x)
    293292{
    294   if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
     293  if (wm->key_pressed(JK_CTRL_L) || wm->key_pressed(JK_CTRL_R))
    295294    return x-(x%the_game->ftile_width());
    296   else if (eh->key_pressed(JK_ALT_L) || eh->key_pressed(JK_ALT_R))
     295  else if (wm->key_pressed(JK_ALT_L) || wm->key_pressed(JK_ALT_R))
    297296    return x-(x%the_game->ftile_width())+the_game->ftile_width()/2;
    298297  else return x; 
     
    301300int32_t dev_controll::snap_y(int32_t y)
    302301{
    303   if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
     302  if (wm->key_pressed(JK_CTRL_L) || wm->key_pressed(JK_CTRL_R))
    304303    return y-(y%the_game->ftile_height())-1;
    305   else if (eh->key_pressed(JK_ALT_L) || eh->key_pressed(JK_ALT_R))
     304  else if (wm->key_pressed(JK_ALT_L) || wm->key_pressed(JK_ALT_R))
    306305    return y-(y%the_game->ftile_height())+the_game->ftile_height()/2-1;
    307306  else return y;
     
    311310{
    312311  if (!ambw)
    313   ambw=eh->new_window(prop->getd("ambient x",-1),
     312  ambw=wm->new_window(prop->getd("ambient x",-1),
    314313                      prop->getd("ambient y",-1),-1,-1,
    315314                      new amb_cont(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,NULL),"ambient");
     
    466465          im->put_image(screen,f->x-vx+v->cx1-im->width()/2,f->y-vy+v->cy1-im->height()/2,1);
    467466          screen->rectangle(f->x1-vx+v->cx1,f->y1-vy+v->cy1,f->x2-vx+v->cx1,f->y2-vy+v->cy1,
    468                             eh->medium_color());
     467                            wm->medium_color());
    469468        }
    470469      }
     
    484483      int32_t rx1,ry1;
    485484      the_game->game_to_mouse(selected_light->x,selected_light->y,v,rx1,ry1);     
    486       screen->rectangle(rx1-l,ry1-h,rx1+l,ry1+h,eh->bright_color());
     485      screen->rectangle(rx1-l,ry1-h,rx1+l,ry1+h,wm->bright_color());
    487486    }
    488487
     
    508507          game_object *other=o->get_object(i);
    509508          the_game->game_to_mouse(other->x,other->y,current_view,x2,y2);       
    510           screen->line(x1,y1,x2,y2,eh->bright_color());
     509          screen->line(x1,y1,x2,y2,wm->bright_color());
    511510        }
    512511
     
    527526      the_game->game_to_mouse(x1,y1,v,rx1,ry1);
    528527      the_game->game_to_mouse(x2,y2,v,rx2,ry2);
    529       screen->rectangle(rx1,ry1,rx2,ry2,eh->bright_color());
     528      screen->rectangle(rx1,ry1,rx2,ry2,wm->bright_color());
    530529
    531530      the_game->game_to_mouse(selected_object->x,selected_object->y,current_view,x1,y1);
     
    574573    {
    575574      int h=st[i]*100/3000;  x++;
    576       memprof->screen->bar(x,y,x,y+h,eh->bright_color());
     575      memprof->screen->bar(x,y,x,y+h,wm->bright_color());
    577576      h=ch[i]*100/3000;
    578       memprof->screen->bar(x,y,x,y+h,eh->medium_color());
     577      memprof->screen->bar(x,y,x,y+h,wm->medium_color());
    579578      x++;
    580579    }
     
    583582    char buf[100];
    584583    sprintf(buf,"%8ld %8ld",(long int)j_allocated(),(long int)j_available());
    585     eh->font()->put_string(memprof->screen,memprof->x1(),memprof->y2()-eh->font()->height(),buf);
     584    wm->font()->put_string(memprof->screen,memprof->x1(),memprof->y2()-wm->font()->height(),buf);
    586585
    587586  }
     
    595594    prop->setd("memprof x",memprof->x);
    596595    prop->setd("memprof y",memprof->y);
    597     eh->close_window(memprof);
     596    wm->close_window(memprof);
    598597    memprof=NULL;
    599598  } else
     
    603602    jfree(st);
    604603    jfree(ch);
    605     memprof=eh->new_window(0,0,total*2+20,100,NULL);
     604    memprof=wm->new_window(0,0,total*2+20,100,NULL);
    606605    update_memprof();   
    607606  }
     
    615614    prop->setd("toolbar x",tbw->x);
    616615    prop->setd("toolbar y",tbw->y);
    617     eh->close_window(tbw);
     616    wm->close_window(tbw);
    618617    tbw=NULL;
    619618  } else
     
    631630                                             ID_NULL,
    632631                                             5,(visual_object **)dev_mode_pict,dev_mode_ids,DEV_MODES,
    633                                                 pal,pal,eh,NULL);
    634     tbw=eh->new_window(prop->getd("toolbar x",-1),
     632                                                pal,pal,NULL);
     633    tbw=wm->new_window(prop->getd("toolbar x",-1),
    635634                       prop->getd("toolbar y",-1),-1,-1,tp);
    636     tp->set_x(setx,tbw->screen,eh);
     635    tp->set_x(setx,tbw->screen);
    637636  }
    638637}
     
    645644    prop->setd("layer x",show_menu->x);
    646645    prop->setd("layer y",show_menu->y);
    647     eh->close_window(show_menu);
     646    wm->close_window(show_menu);
    648647    show_menu=NULL;
    649648  } else
     
    659658    button *fb=new button(sx,sy+ 0,  SHOW_FOREGROUND,       symbol_str("l_fore"),bdb);      if (dev&DRAW_FG_LAYER)       fb->push();
    660659
    661     show_menu=eh->new_window(prop->getd("layer x",-1),
     660    show_menu=wm->new_window(prop->getd("layer x",-1),
    662661                             prop->getd("layer y",-1),
    663662                             -1,-1,fb,symbol_str(symbol_str("SHOW?")));
     
    676675    prop->setd("objects x",omenu->x);
    677676    prop->setd("objects y",omenu->y);
    678     eh->close_window(omenu);
     677    wm->close_window(omenu);
    679678    omenu=NULL;
    680679    jfree(listable_objs);
     
    698697      }
    699698             
    700     omenu=eh->new_window(prop->getd("objects x",0),
     699    omenu=wm->new_window(prop->getd("objects x",0),
    701700                         prop->getd("objects y",0),-1,-1,
    702701                         new pick_list(WINDOW_FRAME_LEFT,
    703                                        WINDOW_FRAME_TOP,DEV_CREATE,yres/eh->font()->height()/2,
     702                                       WINDOW_FRAME_TOP,DEV_CREATE,yres/wm->font()->height()/2,
    704703                                       listable_objs,total_listable,0,NULL,cash.img(window_texture)));
    705704  } 
     
    721720    prop->setd("pal x",pmenu->x);
    722721    prop->setd("pal y",pmenu->y);
    723     eh->close_window(pmenu);
     722    wm->close_window(pmenu);
    724723    pmenu=NULL;
    725724    jfree(pwin_list);
     
    733732      pwin_list[i]=pal_wins[i]->name;
    734733
    735     pmenu=eh->new_window(prop->getd("pal x",0),
     734    pmenu=wm->new_window(prop->getd("pal x",0),
    736735                         prop->getd("pal y",-1),
    737736                         -1,-1,
    738737                         new pick_list(WINDOW_FRAME_LEFT,
    739                                        WINDOW_FRAME_TOP,DEV_PALETTE,yres/eh->font()->height()/2,
     738                                       WINDOW_FRAME_TOP,DEV_PALETTE,yres/wm->font()->height()/2,
    740739                                       pwin_list,total_pals,0,NULL,cash.img(window_texture)));
    741740  } else the_game->show_help(symbol_str("no_pals"));
     
    751750
    752751    tile_picker *f_tp=new tile_picker(WINDOW_FRAME_LEFT+1,WINDOW_FRAME_TOP+1,
    753                                          DEV_FG_PICKER,SPEC_FORETILE,eh,fg_scale,maxh,fg_w,NULL);
     752                                         DEV_FG_PICKER,SPEC_FORETILE,fg_scale,maxh,fg_w,NULL);
    754753    f_tp->reverse();
    755754
    756     forew=eh->new_window(prop->getd("fore x",-30),
     755    forew=wm->new_window(prop->getd("fore x",-30),
    757756                         prop->getd("fore y",0),
    758757                         -1,-1,
     
    763762    prop->setd("fore x",forew->x);
    764763    prop->setd("fore y",forew->y);
    765     eh->close_window(forew);
     764    wm->close_window(forew);
    766765    forew=NULL;
    767766  }
     
    772771/*  if (!music_window)
    773772  {
    774     music_window=eh->new_window(-1,30,0,0,
     773    music_window=wm->new_window(-1,30,0,0,
    775774                         new pick_list(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,
    776775                                       DEV_MUSIC_PICKLIST,10,song_list,total_songs,0,NULL));
    777     eh->fnt->put_string(music_window->screen,WINDOW_FRAME_LEFT,1,"songs");
     776    wm->fnt->put_string(music_window->screen,WINDOW_FRAME_LEFT,1,"songs");
    778777  } else
    779778  {
    780     eh->close_window(music_window);
     779    wm->close_window(music_window);
    781780    music_window=NULL;
    782781  }*/
     
    790789    int maxh=(yres-25)/(the_game->btile_height()/bg_scale);
    791790
    792     backw=eh->new_window(prop->getd("back x",-30),
     791    backw=wm->new_window(prop->getd("back x",-30),
    793792                         prop->getd("back y",0),
    794793                         -1,-1,
    795794                         new tile_picker(WINDOW_FRAME_LEFT+1,WINDOW_FRAME_TOP+1,
    796                                          DEV_BG_PICKER,SPEC_BACKTILE,eh,bg_scale,maxh,bg_w,NULL),symbol_str("l_bg"));
     795                                         DEV_BG_PICKER,SPEC_BACKTILE,bg_scale,maxh,bg_w,NULL),symbol_str("l_bg"));
    797796  } else
    798797  {
     
    800799    prop->setd("back x",backw->x);
    801800    prop->setd("back y",backw->y);
    802     eh->close_window(backw);
     801    wm->close_window(backw);
    803802    backw=NULL;
    804803  }
     
    812811        wh=WINDOW_FRAME_TOP+1;
    813812    int bw=cash.img(dev_forward)->width();
    814     search_window=eh->new_window(prop->getd("searchw x",-30),
     813    search_window=wm->new_window(prop->getd("searchw x",-30),
    815814                                 prop->getd("searchw y",0),
    816815                                 -1,-1,
     
    818817                                                "***************************",
    819818                                                prop->get("search name",""),
    820                                   new button(wl+bw*1,wh+eh->font()->height()+5,ID_SEARCH_BACKWARD,
     819                                  new button(wl+bw*1,wh+wm->font()->height()+5,ID_SEARCH_BACKWARD,
    821820                                            cash.img(dev_backward),
    822                                   new button(wl+bw*3,wh+eh->font()->height()+5,ID_SEARCH_FOREWARD,
     821                                  new button(wl+bw*3,wh+wm->font()->height()+5,ID_SEARCH_FOREWARD,
    823822                                            cash.img(dev_forward),NULL))),"SEARCH");
    824823    searchw_on=0;
     
    829828    prop->setd("searchw y",search_window->y);
    830829    prop->set("search name",search_window->read(ID_SEARCH_TEXT));
    831     eh->close_window(search_window);
     830    wm->close_window(search_window);
    832831    search_window=NULL;
    833832    search_object=NULL;
     
    961960  dev_console=new dev_term(50,18,this);
    962961  if (start_edit)
    963     dev_menu=make_menu(0,yres-eh->font()->height()-5);   
     962    dev_menu=make_menu(0,yres-wm->font()->height()-5);   
    964963
    965964  if (get_option("-nolight"))
     
    12431242      cur_fg=current_level->get_fg(x,y);
    12441243      if (forew)     
    1245         ((tile_picker *)forew->read(DEV_FG_PICKER))->recenter(forew->screen,eh);     
     1244        ((tile_picker *)forew->read(DEV_FG_PICKER))->recenter(forew->screen);     
    12461245      the_game->need_refresh();
    12471246    }
     
    12671266
    12681267      if (forew)     
    1269         ((tile_picker *)forew->read(DEV_FG_PICKER))->recenter(forew->screen,eh);     
     1268        ((tile_picker *)forew->read(DEV_FG_PICKER))->recenter(forew->screen);     
    12701269    }   
    12711270  }
     
    13491348  if (!lightw)
    13501349  {
    1351     int wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP,bh=16+6,bw=20+6,th=eh->font()->height()+4;   
    1352     lightw=eh->new_window(prop->getd("light create x",0),
     1350    int wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP,bh=16+6,bw=20+6,th=wm->font()->height()+4;   
     1351    lightw=wm->new_window(prop->getd("light create x",0),
    13531352                          prop->getd("light create y",0),
    13541353                          -1,-1,new button_box(wl,wh,DEV_LIGHT_BUTTON_BOX,1,
     
    13881387    prop->setd("light create r1",atoi(lightw->read(DEV_LIGHTR1)));
    13891388    prop->setd("light create r2",atoi(lightw->read(DEV_LIGHTR2)));
    1390     eh->close_window(lightw);
     1389    wm->close_window(lightw);
    13911390    lightw=NULL;
    13921391  }
     
    13961395{
    13971396  ai_object=o;
    1398   int th=eh->font()->height()+4,wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP+20;
     1397  int th=wm->font()->height()+4,wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP+20;
    13991398  if (figures[o->otype]->total_fields)
    14001399  {
     
    14241423      wh+=th;
    14251424    }         
    1426     aiw=eh->new_window(prop->getd("ai x",0),
     1425    aiw=wm->new_window(prop->getd("ai x",0),
    14271426                       prop->getd("ai y",0),
    14281427                       -1,-1,               
     
    14321431  else
    14331432  {
    1434     aiw=eh->new_window(prop->getd("ai x",0),
     1433    aiw=wm->new_window(prop->getd("ai x",0),
    14351434                       prop->getd("ai y",0),
    14361435                       -1,-1,
     
    14501449  }
    14511450
    1452   eh->grab_focus(aiw);
     1451  wm->grab_focus(aiw);
    14531452}
    14541453
     
    14611460      prop->setd("ledit x",ledit->x);
    14621461      prop->setd("ledit y",ledit->y);
    1463       eh->close_window(ledit); ledit=NULL;
     1462      wm->close_window(ledit); ledit=NULL;
    14641463    }
    14651464    edit_light=NULL;
     
    15361535    prop->setd("ai x",aiw->x);
    15371536    prop->setd("ai y",aiw->y);
    1538     eh->close_window(aiw);
     1537    wm->close_window(aiw);
    15391538    aiw=NULL;
    15401539    ai_object=NULL;
     
    15771576      current_area->view_yoff_speed=atoi(area_win->read(DEV_AREA_VIEW_YOFF_SPEED));
    15781577    }   
    1579     eh->close_window(area_win);
     1578    wm->close_window(area_win);
    15801579    area_win=NULL;
    15811580  }
     
    16091608      if (area_win) close_area_win(0);
    16101609      int wl=WINDOW_FRAME_LEFT;
    1611       int wh=WINDOW_FRAME_TOP,th=eh->font()->height()+12,bw=cash.img(dev_ok)->width()+10;
    1612       area_win=eh->new_window(prop->getd("area_box x",0),
     1610      int wh=WINDOW_FRAME_TOP,th=wm->font()->height()+12,bw=cash.img(dev_ok)->width()+10;
     1611      area_win=wm->new_window(prop->getd("area_box x",0),
    16131612                              prop->getd("area_box y",0),
    16141613                              -1,-1,
     
    16471646    prop->setd("oedit x",oedit->x);
    16481647    prop->setd("oedit y",oedit->y);
    1649     eh->close_window(oedit);
     1648    wm->close_window(oedit);
    16501649    oedit=NULL;     
    16511650    edit_object=NULL;
     
    16661665  }
    16671666
    1668   if (dev_menu && dev_menu->handle_event(ev,screen,eh)) return ;
     1667  if (dev_menu && dev_menu->handle_event(ev,screen)) return ;
    16691668
    16701669  if (!current_level) return ;
     
    16771676    dlasty=last_demo_my;   
    16781677  }
    1679   if (dev_console && dev_console->handle_event(ev,eh))
     1678  if (dev_console && dev_console->handle_event(ev))
    16801679    return;
    16811680
     
    19411940            int bw=20+6,bh=16+6,wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP;
    19421941
    1943             oedit=eh->new_window(prop->getd("oedit x",0),
     1942            oedit=wm->new_window(prop->getd("oedit x",0),
    19441943                                 prop->getd("oedit y",0),
    19451944                                 -1,-1,new button_box(wl,wh,ID_NULL,1,
     
    19691968              prop->setd("ledit x",ledit->x);
    19701969              prop->setd("ledit x",ledit->y);
    1971               eh->close_window(ledit);
     1970              wm->close_window(ledit);
    19721971            }
    1973             int bw=20+6,bh=16+6,wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP,th=eh->font()->height()+4;
     1972            int bw=20+6,bh=16+6,wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP,th=wm->font()->height()+4;
    19741973            edit_light=selected_light;
    19751974            if (edit_object)
     
    19781977              edit_light->known=1;
    19791978            }
    1980             ledit=eh->new_window(prop->getd("ledit x",0),
     1979            ledit=wm->new_window(prop->getd("ledit x",0),
    19811980                                 prop->getd("ledit y",0),
    19821981                                 -1,-1,
     
    20592058          if (mess_win)
    20602059          {
    2061             eh->close_window(mess_win);
     2060            wm->close_window(mess_win);
    20622061            mess_win=NULL;
    20632062          } break;
     
    20672066          if (!mess_win)
    20682067          {
    2069             mess_win=file_dialog(eh,symbol_str("level_name"),current_level ? current_level->name() : "",
     2068            mess_win=file_dialog(symbol_str("level_name"),current_level ? current_level->name() : "",
    20702069                                 ID_LEVEL_LOAD_OK,symbol_str("ok_button"),ID_CANCEL,symbol_str("cancel_button"),
    20712070                                 symbol_str("FILENAME"),ID_MESS_STR1);
    2072             eh->grab_focus(mess_win);
     2071            wm->grab_focus(mess_win);
    20732072          }
    20742073        } break;
     
    20782077          sprintf(cmd,"load %s",mess_win->read(ID_MESS_STR1));
    20792078          dev_cont->do_command(cmd,ev);
    2080           eh->push_event(new event(ID_CANCEL,NULL));        // close window
     2079          wm->push_event(new event(ID_CANCEL,NULL));        // close window
    20812080        } break;       
    20822081        case ID_GAME_SAVE :
     
    21032102          if (!mess_win)
    21042103          {
    2105             mess_win=file_dialog(eh,symbol_str("saveas_name"),current_level ? current_level->name() : "untitled.spe",
     2104            mess_win=file_dialog(symbol_str("saveas_name"),current_level ? current_level->name() : "untitled.spe",
    21062105                               ID_LEVEL_SAVEAS_OK,symbol_str("ok_button"),
    21072106                                 ID_CANCEL,symbol_str("cancel_button"),
    21082107                                 symbol_str("FILENAME"),ID_MESS_STR1);
    2109             eh->grab_focus(mess_win);
     2108            wm->grab_focus(mess_win);
    21102109          }
    21112110        } break;
     
    21152114          {
    21162115            current_level->set_name(mess_win->read(ID_MESS_STR1));
    2117             eh->push_event(new event(ID_CANCEL,NULL));        // close window after save
    2118             eh->push_event(new event(ID_LEVEL_SAVE,NULL));         
     2116            wm->push_event(new event(ID_CANCEL,NULL));        // close window after save
     2117            wm->push_event(new event(ID_LEVEL_SAVE,NULL));         
    21192118          }
    21202119        } break;
     
    21472146          if (!mess_win)
    21482147          {
    2149             mess_win=eh->new_window(xres/2,yres/2,-1,-1,
     2148            mess_win=wm->new_window(xres/2,yres/2,-1,-1,
    21502149                       new button(WINDOW_FRAME_LEFT+10,WINDOW_FRAME_TOP+20,ID_LEVEL_NEW_OK,symbol_str("YES"),
    21512150                       new button(WINDOW_FRAME_LEFT+40,WINDOW_FRAME_TOP+20,ID_CANCEL,symbol_str("NO"),
    21522151              new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,ID_NULL,symbol_str("sure?"),NULL))),symbol_str("New?"));
    2153             eh->grab_focus(mess_win);
     2152            wm->grab_focus(mess_win);
    21542153          }
    21552154        } break;
    21562155        case ID_LEVEL_NEW_OK :
    21572156        {
    2158           eh->push_event(new event(ID_CANCEL,NULL));  // close_window
     2157          wm->push_event(new event(ID_CANCEL,NULL));  // close_window
    21592158          if (current_level)     
    21602159            delete current_level;       
     
    21652164          if (!mess_win)
    21662165          {
    2167             int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=eh->font()->height()+8;
    2168             mess_win=eh->new_window(xres/2,yres/2,-1,-1,
     2166            int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=wm->font()->height()+8;
     2167            mess_win=wm->new_window(xres/2,yres/2,-1,-1,
    21692168                    new text_field(wl,wt+h*0,ID_MESS_STR1,symbol_str("width_"),"****",
    21702169                               current_level ? current_level->foreground_width() : 100,
     
    21822181                                    atoi(mess_win->read(ID_MESS_STR2)));
    21832182          } else the_game->show_help("Create a level first!");
    2184           eh->push_event(new event(ID_CANCEL,NULL));  // close_window
     2183          wm->push_event(new event(ID_CANCEL,NULL));  // close_window
    21852184        } break;
    21862185
     
    22172216          if (!mess_win)
    22182217          {
    2219             int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=eh->font()->height()+8;
    2220             mess_win=eh->new_window(xres/2,yres/2,-1,-1,
     2218            int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=wm->font()->height()+8;
     2219            mess_win=wm->new_window(xres/2,yres/2,-1,-1,
    22212220                    new text_field(wl,wt+h*0,ID_RECORD_DEMO_FILENAME,
    22222221                                   "demo filename","*******************",
     
    22302229        {
    22312230          demo_man.set_state(demo_manager::RECORDING,mess_win->read(ID_RECORD_DEMO_FILENAME));
    2232           eh->push_event(new event(ID_CANCEL,NULL));        // close window       
     2231          wm->push_event(new event(ID_CANCEL,NULL));        // close window       
    22332232        } break;
    22342233
     
    22372236          if (!mess_win)
    22382237          {
    2239             int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=eh->font()->height()+8;
    2240             mess_win=eh->new_window(xres/2,yres/2,-1,-1,
     2238            int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=wm->font()->height()+8;
     2239            mess_win=wm->new_window(xres/2,yres/2,-1,-1,
    22412240                    new text_field(wl,wt+h*0,ID_PLAY_DEMO_FILENAME,
    22422241                                   "demo filename","*******************",
     
    22502249        {
    22512250          demo_man.set_state(demo_manager::PLAYING,mess_win->read(ID_PLAY_DEMO_FILENAME));
    2252           eh->close_window(mess_win);
     2251          wm->close_window(mess_win);
    22532252          mess_win=NULL;
    22542253        } break;
     
    22582257          if (!mess_win)
    22592258          {
    2260             int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=eh->font()->height()+8;
    2261             mess_win=eh->new_window(xres/2,yres/2,-1,-1,
     2259            int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=wm->font()->height()+8;
     2260            mess_win=wm->new_window(xres/2,yres/2,-1,-1,
    22622261                    new text_field(wl,wt+h*0,ID_MESS_STR1,symbol_str("x_mul"),"****",bg_xmul,
    22632262                    new text_field(wl,wt+h*1,ID_MESS_STR2,symbol_str("x_div"),"****",bg_xdiv,
     
    22782277              (((float)tbg_ymul/(float)tbg_ydiv) < ((float)bg_ymul/(float)bg_ydiv)))
    22792278          {
    2280             int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=eh->font()->height()+8;
    2281 
    2282             warn_win=eh->new_window(xres/2-40,yres/2-40,-1,-1,
     2279            int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=wm->font()->height()+8;
     2280
     2281            warn_win=wm->new_window(xres/2-40,yres/2-40,-1,-1,
    22832282                              new info_field(wl,wt,ID_NULL,
    22842283                                          symbol_str("back_loss"),
     
    22862285                                          new button(wt+40,wt+h*4,ID_WARN_CANCEL,symbol_str("cancel_button"),NULL))),
    22872286                                    symbol_str("WARNING"));
    2288             eh->grab_focus(warn_win);
    2289           } else eh->push_event(new event(ID_SET_SCROLL_OK,NULL));
     2287            wm->grab_focus(warn_win);
     2288          } else wm->push_event(new event(ID_SET_SCROLL_OK,NULL));
    22902289        } break;
    22912290        case ID_WARN_CANCEL :
    22922291        {
    2293           eh->close_window(warn_win); warn_win=NULL;
    2294           eh->push_event(new event(ID_CANCEL,NULL));
     2292          wm->close_window(warn_win); warn_win=NULL;
     2293          wm->push_event(new event(ID_CANCEL,NULL));
    22952294        } break;
    22962295        case ID_SET_SCROLL_OK :
    22972296        {
    2298           if (warn_win) { eh->close_window(warn_win); warn_win=NULL; }
     2297          if (warn_win) { wm->close_window(warn_win); warn_win=NULL; }
    22992298          bg_xmul=atoi(mess_win->read(ID_MESS_STR1));
    23002299          bg_xdiv=atoi(mess_win->read(ID_MESS_STR2));
    23012300          bg_ymul=atoi(mess_win->read(ID_MESS_STR3));
    23022301          bg_ydiv=atoi(mess_win->read(ID_MESS_STR4));
    2303           eh->push_event(new event(ID_CANCEL,NULL));        // close window
     2302          wm->push_event(new event(ID_CANCEL,NULL));        // close window
    23042303        } break;
    23052304
     
    23232322          if (!mess_win)
    23242323          {
    2325             int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=eh->font()->height()+8;
    2326             mess_win=eh->new_window(xres/2,yres/2,-1,-1,
     2324            int wl=WINDOW_FRAME_LEFT,wt=WINDOW_FRAME_TOP,h=wm->font()->height()+8;
     2325            mess_win=wm->new_window(xres/2,yres/2,-1,-1,
    23272326                    new text_field(wl,wt+h*0,ID_MESS_STR1,symbol_str("ap_width"),"****",2,
    23282327                    new text_field(wl,wt+h*1,ID_MESS_STR2,symbol_str("ap_height"),"****",2,
     
    23402339          char const *s=name;
    23412340          eval(compile(s));
    2342           eh->push_event(new event(ID_CANCEL,NULL));        // close window
     2341          wm->push_event(new event(ID_CANCEL,NULL));        // close window
    23432342        } break;
    23442343        case ID_TOGGLE_DELAY :
     
    24712470          prop->setd("ledit x",ledit->x);
    24722471          prop->setd("ledit y",ledit->y);
    2473           eh->close_window(ledit); ledit=NULL;
     2472          wm->close_window(ledit); ledit=NULL;
    24742473          if (current_level)
    24752474            current_level->remove_light(edit_light);
     
    24992498          prop->setd("ledit x",ledit->x);
    25002499          prop->setd("ledit y",ledit->y);
    2501           eh->close_window(ledit); ledit=NULL;
     2500          wm->close_window(ledit); ledit=NULL;
    25022501          the_game->need_refresh();       
    25032502        } break;
     
    25062505          prop->setd("ledit x",ledit->x);
    25072506          prop->setd("ledit y",ledit->y);
    2508           eh->close_window(ledit); ledit=NULL;
     2507          wm->close_window(ledit); ledit=NULL;
    25092508          state=DEV_MOVE_LIGHT;
    25102509        } break;
     
    25142513          prop->setd("ledit x",ledit->x);
    25152514          prop->setd("ledit y",ledit->y);
    2516           eh->close_window(ledit); ledit=NULL;   
     2515          wm->close_window(ledit); ledit=NULL;   
    25172516          state=DEV_MOVE_LIGHT;
    25182517        } break;
     
    25972596          prop->setd("commandw x",commandw->x);
    25982597          prop->setd("commandw y",commandw->y);
    2599           eh->close_window(commandw);
     2598          wm->close_window(commandw);
    26002599          commandw=NULL;
    26012600          do_command(cmd,ev);
     
    27002699          prop->setd("commandw x",commandw->x);
    27012700          prop->setd("commandw y",commandw->y);   
    2702           eh->close_window(commandw);
     2701          wm->close_window(commandw);
    27032702          commandw=NULL;       
    27042703        } else if (ev.window==oedit)
    27052704          close_oedit_window();
    27062705        else if (ev.window==ambw)
    2707         { eh->close_window(ambw); ambw=NULL; }
     2706        { wm->close_window(ambw); ambw=NULL; }
    27082707        else if (ev.window==backw) toggle_bgw();
    27092708        else if (ev.window==forew) toggle_fgw();
     
    27912790          case 'A' : { if (selected_object)
    27922791                       {
    2793                          if (oedit) eh->push_event(new event(DEV_OEDIT_OK,NULL));                     
     2792                         if (oedit) wm->push_event(new event(DEV_OEDIT_OK,NULL));                     
    27942793                         make_ai_window(selected_object);
    27952794                       }
     
    28562855          if (selected_object && selected_object->controller()==NULL)
    28572856          { copy_object=selected_object;
    2858                         eh->push_event(new event(DEV_OEDIT_COPY,NULL)); } break;
     2857                        wm->push_event(new event(DEV_OEDIT_COPY,NULL)); } break;
    28592858         
    28602859          case 'D' : the_game->toggle_delay(); break;
     
    29202919                if (ledit)
    29212920                {
    2922                   eh->close_window(ledit);
     2921                  wm->close_window(ledit);
    29232922                  ledit=NULL;
    29242923                }
     
    30123011{
    30133012  if (me) close_window();
    3014   me=eh->new_window(x,y,w*f_wid/scale,h*f_hi/scale,NULL,name);
     3013  me=wm->new_window(x,y,w*f_wid/scale,h*f_hi/scale,NULL,name);
    30153014  draw();
    30163015}
     
    30233022                //  it will be in the same spot
    30243023    y=me->y;
    3025     eh->close_window(me);
     3024    wm->close_window(me);
    30263025    me=NULL;
    30273026   
     
    30543053                          me->y1()+(i/w)*th,
    30553054                          me->x1()+(i%w)*tw+tw-1,
    3056                           me->y1()+(i/w)*th+th-1,eh->bright_color());
     3055                          me->y1()+(i/w)*th+th-1,wm->bright_color());
    30573056      }
    30583057    }
     
    30973096            if (dev_cont->forew)     
    30983097              ((tile_picker *)dev_cont->forew->
    3099                read(DEV_FG_PICKER))->recenter(dev_cont->forew->screen,eh);     
     3098               read(DEV_FG_PICKER))->recenter(dev_cont->forew->screen);     
    31003099          }
    31013100        } else if (ev.mouse_button==2)
     
    36133612         new pmenu_item(symbol_str("file_top"),new psub_menu(i_recurse(filemenu),NULL),
    36143613         new pmenu_item(symbol_str("edit_top"),new psub_menu(i_recurse(editmenu),NULL),
    3615          new pmenu_item(symbol_str("window_top"),new psub_menu(i_recurse(winmenu),NULL),NULL))),screen,eh);
     3614         new pmenu_item(symbol_str("window_top"),new psub_menu(i_recurse(winmenu),NULL),NULL))),screen);
    36163615}
    36173616
     
    36233622  if (dev&EDIT_MODE)
    36243623  {
    3625     eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     3624    wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
    36263625    pal->load();
    36273626  }
     
    36293628  {
    36303629    if (dev&MAP_MODE) dev-=MAP_MODE;                        // no map mode while playing!
    3631     eh->set_mouse_shape(cash.img(c_target)->copy(),8,8);
     3630    wm->set_mouse_shape(cash.img(c_target)->copy(),8,8);
    36323631  }
    36333632  if ((dev&EDIT_MODE) && !dev_menu)
    36343633  {
    3635     dev_menu=make_menu(0,yres-eh->font()->height()-5);   
     3634    dev_menu=make_menu(0,yres-wm->font()->height()-5);   
    36363635  }
    36373636  else if (!(dev&EDIT_MODE) && dev_menu)
  • abuse/trunk/src/dev.hpp

    r88 r106  
    129129  dev_controll *dv;
    130130  public :
    131   dev_term(int width, int height, dev_controll *dev) : shell_term(eh,console_font,width,height,"dev")
     131  dev_term(int width, int height, dev_controll *dev) : shell_term(console_font, width, height, "dev")
    132132  {
    133     dv=dev;
     133    dv = dev;
    134134  }
    135135  virtual ~dev_term() {};
  • abuse/trunk/src/devsel.cpp

    r56 r106  
    1919int cur_bg=0,cur_fg=0,cur_char=0;
    2020
    21 void tile_picker::recenter(image *screen, window_manager *wm)
     21void tile_picker::recenter(image *screen)
    2222{
    23   set_x(get_current(),screen,wm);
     23  set_x(get_current(), screen);
    2424}
    2525
     
    7272}
    7373
    74 tile_picker::tile_picker(int X, int Y, int ID, int spec_type, window_manager *wm,
     74tile_picker::tile_picker(int X, int Y, int ID, int spec_type,
    7575                         int Scale, int scroll_h, int Wid, ifield *Next)
    7676     : scroller(X,Y,ID,2,2,1,0,Next)
     
    8686
    8787
    88 void tile_picker::scroll_event(int newx, image *screen, window_manager *wm)
     88void tile_picker::scroll_event(int newx, image *screen)
    8989{
    9090  int yo=y,ya=pich(),xw=picw(),c=get_current(),xo;
     
    9292  last_sel=newx;
    9393
    94   screen->bar(x,y,x+l-1,y+h-1,eh->black());
     94  screen->bar(x,y,x+l-1,y+h-1,wm->black());
    9595  for (int i=newx;i<newx+th*wid;i++)
    9696  {
     
    142142
    143143
    144 void tile_picker::handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm)
     144void tile_picker::handle_inside_event(event &ev, image *screen, input_manager *inm)
    145145{
    146146  if (ev.type==EV_MOUSE_BUTTON)
     
    150150    {
    151151      set_current(sel);
    152       scroll_event(last_sel,screen,wm);
     152      scroll_event(last_sel, screen);
    153153    }
    154154  }
  • abuse/trunk/src/devsel.hpp

    r57 r106  
    1616  int th,last_sel,type,scale,wid,rev;
    1717  public :
    18   tile_picker(int X, int Y, int ID, int spec_type, window_manager *wm,
     18  tile_picker(int X, int Y, int ID, int spec_type,
    1919                 int scale, int scroll_h, int Wid, ifield *Next);
    20   virtual void handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm);
    21   virtual void scroll_event(int newx, image *screen, window_manager *wm);
     20  virtual void handle_inside_event(event &ev, image *screen, input_manager *inm);
     21  virtual void scroll_event(int newx, image *screen);
    2222  virtual char *read() { return (char *)this; }
    2323  int picw();
     
    2626  int get_current();
    2727  void set_current(int x);
    28   void recenter(image *screen, window_manager *wm);
     28  void recenter(image *screen);
    2929  void reverse() { rev=!rev; }
    3030} ;
  • abuse/trunk/src/director.cpp

    r56 r106  
    125125       *text_symbol=make_find_symbol("text");
    126126     
    127   JCFont *font=eh->font();
     127  JCFont *font=wm->font();
    128128
    129129  do
     
    156156                    the_game->first_view->cy2-tbottom,text,font,
    157157                    white_light+32*256,
    158                     eh->bright_color()
     158                    wm->bright_color()
    159159                   
    160160                    ))
     
    174174    } else if (arg==text_symbol) done=1;
    175175           
    176     eh->flush_screen();   
    177     while (eh->event_waiting())
     176    wm->flush_screen();   
     177    while (wm->event_waiting())
    178178    {   
    179179      event ev;     
    180       eh->get_event(ev);
     180      wm->get_event(ev);
    181181      if (ev.type==EV_KEY)
    182182      {
  • abuse/trunk/src/endgame.cpp

    r60 r106  
    179179
    180180  image blank(2,2); blank.clear();
    181   eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
     181  wm->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
    182182
    183183
     
    263263      eoff+=2; if (eoff>=320) eoff-=320;
    264264      coff+=1; if (coff>=320) coff-=320;     
    265       eh->flush_screen();
     265      wm->flush_screen();
    266266      i++;
    267267    }
     
    326326      }
    327327
    328       eh->flush_screen();
     328      wm->flush_screen();
    329329
    330330    }
     
    356356      eoff+=2; if (eoff>=320) eoff-=320;
    357357      coff+=1; if (coff>=320) coff-=320;     
    358       eh->flush_screen();
     358      wm->flush_screen();
    359359      i++;
    360360    }
    361361   
    362     if (eh->event_waiting())
    363       eh->get_event(ev);
     362    if (wm->event_waiting())
     363      wm->get_event(ev);
    364364
    365365  } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
     
    387387             256,paddr,
    388388             p,cash.img(mask)->height(),eoff,coff);     
    389     text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(end_plot),eh->font(),cmap,eh->bright_color());
    390     eh->flush_screen();
     389    text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(end_plot),wm->font(),cmap,wm->bright_color());
     390    wm->flush_screen();
    391391    time_marker now; while (now.diff_time(&start)<0.18) now.get_time(); start.get_time();
    392392
    393     while (eh->event_waiting() && ev.type!=EV_KEY) eh->get_event(ev);
     393    while (wm->event_waiting() && ev.type!=EV_KEY) wm->get_event(ev);
    394394  }
    395395
     
    412412
    413413
    414   eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     414  wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
    415415  the_game->set_state(MENU_STATE);
    416416}
     
    422422  fade_out(16);
    423423  image blank(2,2); blank.clear();
    424   eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
     424  wm->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
    425425  screen->clear();
    426426
     
    453453                           lstring_value(to_be));
    454454
    455     text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(mid_plot),eh->font(),cmap,eh->bright_color());
    456     eh->flush_screen();
     455    text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(mid_plot),wm->font(),cmap,wm->bright_color());
     456    wm->flush_screen();
    457457    time_marker now; while (now.diff_time(&start)<0.18) now.get_time(); start.get_time();
    458     while (eh->event_waiting() && ev.type!=EV_KEY) eh->get_event(ev);
     458    while (wm->event_waiting() && ev.type!=EV_KEY) wm->get_event(ev);
    459459  }
    460460
     
    463463    do
    464464    {
    465       eh->flush_screen();
    466       eh->get_event(ev);   
     465      wm->flush_screen();
     466      wm->get_event(ev);   
    467467    } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
    468468  }
    469469
    470470  fade_out(16);
    471   eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse 
     471  wm->set_mouse_shape(blank.copy(),0,0);      // don't show mouse 
    472472  show_sell(1);
    473   eh->push_event(new event(ID_SHOW_SELL,NULL));
     473  wm->push_event(new event(ID_SHOW_SELL,NULL));
    474474}
    475475
     
    479479  fade_out(16);
    480480  image blank(2,2); blank.clear();
    481   eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
     481  wm->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
    482482  screen->clear();
    483483
     
    503503    im->put_image(screen,dx,dy);
    504504
    505     text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(end_plot),eh->font(),cmap,eh->bright_color());
    506     eh->flush_screen();
     505    text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(end_plot),wm->font(),cmap,wm->bright_color());
     506    wm->flush_screen();
    507507    time_marker now; while (now.diff_time(&start)<0.18) now.get_time(); start.get_time();
    508     while (eh->event_waiting() && ev.type!=EV_KEY) eh->get_event(ev);
     508    while (wm->event_waiting() && ev.type!=EV_KEY) wm->get_event(ev);
    509509  }
    510510
     
    513513    do
    514514    {
    515       eh->flush_screen();
    516       eh->get_event(ev);   
     515      wm->flush_screen();
     516      wm->get_event(ev);   
    517517    } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
    518518  }
     
    526526  show_sell(1);
    527527
    528   eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     528  wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
    529529  the_game->set_state(MENU_STATE);
    530530}
  • abuse/trunk/src/game.cpp

    r95 r106  
    6060extern crc_manager *net_crcs;
    6161game *the_game;
    62 window_manager *eh = NULL;
     62window_manager *wm = NULL;
    6363int dev, shift_down = SHIFT_DOWN_DEFAULT, shift_right = SHIFT_RIGHT_DEFAULT;
    6464double sum_diffs = 1, total_diffs = 12;
     
    101101        "and try again.\n";
    102102
    103     if(!eh)
     103    if(!wm)
    104104    {
    105105        fprintf(stderr, "%s\n", no_space_msg);
     
    108108
    109109    info_field *inf = new info_field(WINDOW_FRAME_LEFT, WINDOW_FRAME_TOP +
    110                                        eh->font()->height() * 2, ID_NULL,
     110                                       wm->font()->height() * 2, ID_NULL,
    111111                                     no_space_msg, NULL);
    112112    button *b = new button(WINDOW_FRAME_LEFT, WINDOW_FRAME_TOP,
    113113                           ID_QUIT_OK, "Quit", inf);
    114     jwindow *no_space = eh->new_window(0, 0, -1, -1, b, "ERROR");
     114    jwindow *no_space = wm->new_window(0, 0, -1, -1, b, "ERROR");
    115115
    116116    event ev;
    117117    do
    118118    {
    119         eh->flush_screen();
    120         eh->get_event(ev);
     119        wm->flush_screen();
     120        wm->get_event(ev);
    121121    } while(ev.type != EV_MESSAGE || ev.message.id != ID_QUIT_OK);
    122     eh->close_window(no_space);
     122    wm->close_window(no_space);
    123123
    124124    close_graphics();
     
    430430    // so we need to redraw.
    431431    if(window_state(new_state) && !window_state(state))
    432         eh->show_windows();
     432        wm->show_windows();
    433433    else if(!window_state(new_state) && window_state(state))
    434         eh->hide_windows();
     434        wm->hide_windows();
    435435
    436436    int old_state = state;
     
    440440
    441441    if(playing_state(state) &&  !(dev & EDIT_MODE))
    442         eh->set_mouse_shape(cash.img(c_target)->copy(), 8, 8);
     442        wm->set_mouse_shape(cash.img(c_target)->copy(), 8, 8);
    443443    else
    444         eh->set_mouse_shape(cash.img(c_normal)->copy(), 1, 1);
     444        wm->set_mouse_shape(cash.img(c_normal)->copy(), 1, 1);
    445445
    446446    if(old_state == SCENE_STATE && new_state != SCENE_STATE)
     
    473473        int dx = WINDOW_FRAME_LEFT + 20, dy = WINDOW_FRAME_TOP + 5;
    474474        image *jim = cash.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);
    475         joy_win->screen->bar(dx, dy, dx + jim->width()+6, dy + jim->height()+6, eh->black());
     475        joy_win->screen->bar(dx, dy, dx + jim->width()+6, dy + jim->height()+6, wm->black());
    476476        jim->put_image(joy_win->screen, dx + 3, dy + 3);
    477477
     
    481481    else if(ev.type == EV_MESSAGE && ev.message.id == JOY_OK)
    482482    {
    483         eh->close_window(joy_win);
     483        wm->close_window(joy_win);
    484484        joy_win = NULL;
    485485        set_state(MENU_STATE);
     
    493493    {
    494494#if 0
    495         eh->push_event(new event(men_mess[((pick_list *)ev.message.data)->get_selection()], NULL));
    496         eh->close_window(top_menu);
     495        wm->push_event(new event(men_mess[((pick_list *)ev.message.data)->get_selection()], NULL));
     496        wm->close_window(top_menu);
    497497        top_menu = NULL;
    498498#endif
     
    511511                      int val, int max)
    512512{
    513     screen->bar(x, y, x + w - 1, y + h, eh->dark_color());
    514     screen->bar(x, y + 1, x + w * val / max, y + h - 1, eh->bright_color());
     513    screen->bar(x, y, x + w - 1, y + h, wm->dark_color());
     514    screen->bar(x, y + 1, x + w * val / max, y + h - 1, wm->bright_color());
    515515}
    516516
     
    630630    if(mousex < xmargin &&  dev_cont->ok_to_scroll()) xs = -18;
    631631    else if(mousex>(screen->width()-xmargin) &&  dev_cont->ok_to_scroll()) xs = 18;
    632     else if(eh->key_pressed(JK_LEFT) && !last_input && !dev_cont->need_arrows())
     632    else if(wm->key_pressed(JK_LEFT) && !last_input && !dev_cont->need_arrows())
    633633      xs = -18;
    634     else if(eh->key_pressed(JK_RIGHT) && !last_input && !dev_cont->need_arrows())
     634    else if(wm->key_pressed(JK_RIGHT) && !last_input && !dev_cont->need_arrows())
    635635      xs = 18;
    636636    else xs = 0;
     
    639639    if(mousey < ymargin && dev_cont->ok_to_scroll()) ys = -18;
    640640    else if(mousey>(screen->height()-ymargin) &&  dev_cont->ok_to_scroll()) ys = 18;
    641     else if(eh->key_pressed(JK_UP) && !last_input)
     641    else if(wm->key_pressed(JK_UP) && !last_input)
    642642      ys = -18;
    643     else if(eh->key_pressed(JK_DOWN) && !last_input)
     643    else if(wm->key_pressed(JK_DOWN) && !last_input)
    644644      ys = 18;
    645645    else ys = 0;
     
    717717      if(state == SCENE_STATE)
    718718        screen->set_clip(cx1, cy1, cx2, cy2);
    719       eh->flush_screen();
     719      wm->flush_screen();
    720720    }
    721721    return;
     
    896896    {
    897897      if(dev & EDIT_MODE)
    898         screen->clear(eh->bright_color());
     898        screen->clear(wm->bright_color());
    899899      else
    900         screen->clear(eh->black());
     900        screen->clear(wm->black());
    901901      for(y = y1, draw_y = yo; y <= y2; y++, draw_y += yinc)
    902902      {
     
    10091009          else
    10101010          {
    1011         screen->line(draw_x, draw_y, draw_x + xinc, draw_y + yinc, eh->bright_color());
    1012         screen->line(draw_x + xinc, draw_y, draw_x, draw_y + yinc, eh->bright_color());
     1011        screen->line(draw_x, draw_y, draw_x + xinc, draw_y + yinc, wm->bright_color());
     1012        screen->line(draw_x + xinc, draw_y, draw_x, draw_y + yinc, wm->bright_color());
    10131013          }
    10141014        }
     
    10211021    if(dev & DRAW_FG_BOUND_LAYER)
    10221022    {
    1023       int b = eh->bright_color();
     1023      int b = wm->bright_color();
    10241024      int fg_h = current_level->foreground_height(), fg_w = current_level->foreground_width();
    10251025
     
    10681068        color = 2+(help_text_frames - 10);
    10691069
    1070     int x1 = v->cx1, y1 = v->cy1, x2 = v->cx2, y2 = v->cy1 + eh->font()->height()+10;
     1070    int x1 = v->cx1, y1 = v->cy1, x2 = v->cx2, y2 = v->cy1 + wm->font()->height()+10;
    10711071
    10721072    remap_area(screen, x1, y1, x2, y2, white_light + 40 * 256);
     
    10741074    screen->bar(x1, y2, x2, y2, color);
    10751075
    1076     eh->font()->put_string(screen, x1 + 5, y1 + 5,
     1076    wm->font()->put_string(screen, x1 + 5, y1 + 5,
    10771077                   help_text, color);
    10781078    if(color > 30)
     
    11981198    }
    11991199    pal->load();
    1200     eh->flush_screen();
     1200    wm->flush_screen();
    12011201    milli_wait(25);
    12021202  }
     
    12221222    }
    12231223    pal->load();
    1224     eh->flush_screen();
     1224    wm->flush_screen();
    12251225    milli_wait(25);
    12261226  }
    12271227  screen->clear();
    1228   eh->flush_screen();
     1228  wm->flush_screen();
    12291229  delete pal;
    12301230  pal = old_pal;
     
    12611261        image *blank = new image(2, 2);
    12621262        blank->clear();
    1263         eh->set_mouse_shape(blank->copy(), 0, 0); // hide mouse
     1263        wm->set_mouse_shape(blank->copy(), 0, 0); // hide mouse
    12641264        delete blank;
    12651265        fade_in(cash.img(cdc_logo), 32);
     
    13131313                gray->put_image(screen, dx, dy);
    13141314                smoke[i % 5]->put_image(screen, dx + 24, dy + 5);
    1315                 text_draw(205 - i, dx + 15, dy, dx + 320 - 15, dy + 199, str, eh->font(), cmap, eh->bright_color());
    1316                 eh->flush_screen();
     1315                text_draw(205 - i, dx + 15, dy, dx + 320 - 15, dy + 199, str, wm->font(), cmap, wm->bright_color());
     1316                wm->flush_screen();
    13171317                time_marker now;
    13181318
     
    13251325                start.get_time();
    13261326
    1327                 while(eh->event_waiting() && ev.type != EV_KEY)
     1327                while(wm->event_waiting() && ev.type != EV_KEY)
    13281328                {
    1329                     eh->get_event(ev);
     1329                    wm->get_event(ev);
    13301330                }
    13311331                if((i % 5) == 0 && DEFINEDP(space_snd) && (sound_avail & SFX_INITIALIZED))
     
    13541354            fade_in(cash.img(title_screen), 32);
    13551355
    1356         eh->set_mouse_shape(cash.img(c_normal)->copy(), 1, 1);
     1356        wm->set_mouse_shape(cash.img(c_normal)->copy(), 1, 1);
    13571357    }
    13581358}
     
    14831483  console_font = new JCFont(cash.img(console_font_pict));
    14841484
    1485   eh = new window_manager(screen, pal, bright_color,
     1485  wm = new window_manager(screen, pal, bright_color,
    14861486                                   med_color,
    14871487                                   dark_color,
     
    14891489
    14901490  delete stat_man;  // move to a graphical status manager
    1491   gui_status_manager *gstat = new gui_status_manager(eh);
     1491  gui_status_manager *gstat = new gui_status_manager();
    14921492  gstat->set_window_title("status");
    14931493  stat_man = gstat;
    14941494
    14951495
    1496   chat = new chat_console(eh, console_font, 50, 6);
    1497 
    1498   if(!eh->has_mouse())
     1496  chat = new chat_console( console_font, 50, 6);
     1497
     1498  if(!wm->has_mouse())
    14991499  {
    15001500    close_graphics();
     
    16011601      {
    16021602            draw_map(f, 1);
    1603         eh->flush_screen();
     1603        wm->flush_screen();
    16041604      }
    16051605          draw_map(f, 0);
     
    16221622    cash.prof_poll_end();
    16231623
    1624   eh->flush_screen();
     1624  wm->flush_screen();
    16251625
    16261626}
     
    16991699    event ev;
    17001700    idle_ticks++;
    1701     while(event_waiting(eh))
    1702     {
    1703         get_event(ev, eh);
     1701    while(event_waiting())
     1702    {
     1703        get_event(ev);
    17041704
    17051705        if(ev.type == EV_MOUSE_MOVE)
     
    17811781                            int wx = WINDOW_FRAME_LEFT, wy = WINDOW_FRAME_TOP;
    17821782
    1783                             joy_win = eh->new_window(80, 50, -1, -1,
     1783                            joy_win = wm->new_window(80, 50, -1, -1,
    17841784                                    new button(wx + 70, wy + 9, JOY_OK, "OK",
    17851785                                    new info_field(wx, wy + 30, DEV_NULL,
     
    18021802            else if(ev.type == EV_CLOSE_WINDOW && ev.window == top_menu)
    18031803            {
    1804                 eh->close_window(top_menu);
     1804                wm->close_window(top_menu);
    18051805                top_menu = NULL;
    18061806            }
     
    18541854                                    case 'v':
    18551855                                    {
    1856                                         eh->push_event(new event(DO_VOLUME, NULL));
     1856                                        wm->push_event(new event(DO_VOLUME, NULL));
    18571857                                    } break;
    18581858                                    case 'p':
     
    18691869                                        if(start_edit)
    18701870                                        {
    1871                                             eh->push_event(new event(ID_LEVEL_SAVE, NULL));
     1871                                            wm->push_event(new event(ID_LEVEL_SAVE, NULL));
    18721872                                        }
    18731873                                    } break;
     
    18931893                                        if(!dev_cont->need_plus_minus())
    18941894                                        {
    1895                                             if(eh->key_pressed(JK_CTRL_L))
     1895                                            if(wm->key_pressed(JK_CTRL_L))
    18961896                                                grow_views(20);
    18971897                                            else
     
    19091909                                        if(!dev_cont->need_plus_minus())
    19101910                                        {
    1911                                             if(eh->key_pressed(JK_CTRL_L))
     1911                                            if(wm->key_pressed(JK_CTRL_L))
    19121912                                                grow_views(-20);
    19131913                                            else
     
    21862186  config_cleanup();
    21872187  delete color_table;
    2188   delete eh;
     2188  delete wm;
    21892189  delete game_font;
    21902190  delete big_font;
     
    22122212    {
    22132213        char const *helpstr = "ARROW KEYS CHANGE TEXT SPEED";
    2214         eh->font()->put_string(screen, screen->width()/2-(eh->font()->width()*strlen(helpstr))/2 + 1,
    2215             screen->height()-eh->font()->height()-5 + 1, helpstr, eh->dark_color());
    2216         eh->font()->put_string(screen, screen->width()/2-(eh->font()->width()*strlen(helpstr))/2,
    2217             screen->height()-eh->font()->height()-5, helpstr, eh->bright_color());
     2214        wm->font()->put_string(screen, screen->width()/2-(wm->font()->width()*strlen(helpstr))/2 + 1,
     2215            screen->height()-wm->font()->height()-5 + 1, helpstr, wm->dark_color());
     2216        wm->font()->put_string(screen, screen->width()/2-(wm->font()->width()*strlen(helpstr))/2,
     2217            screen->height()-wm->font()->height()-5, helpstr, wm->bright_color());
    22182218    }
    22192219/*    else
    22202220    {
    22212221        char *helpstr="PRESS h FOR HELP";
    2222         eh->font()->put_string(screen, screen->width()-eh->font()->width()*strlen(helpstr)-5,
    2223             screen->height()-eh->font()->height()-5, helpstr);
     2222        wm->font()->put_string(screen, screen->width()-wm->font()->width()*strlen(helpstr)-5,
     2223            screen->height()-wm->font()->height()-5, helpstr);
    22242224    }*/
    22252225/*    int dc = cash.img(window_colors)->pixel(0, 2);
     
    22842284    do
    22852285    {
    2286       get_event(ev, eh);
     2286      get_event(ev);
    22872287      if(ev.type == EV_KEY)
    22882288      {
     
    23072307    }
    23082308      }
    2309       eh->flush_screen();
     2309      wm->flush_screen();
    23102310    } while(ev.type != EV_KEY || ev.key != JK_ENTER);
    23112311    dprintf("\n");
  • abuse/trunk/src/game.hpp

    r88 r106  
    4646
    4747/* Cleaned-up externs */
    48 extern window_manager *eh;
     48extern window_manager *wm;
    4949
    5050
  • abuse/trunk/src/gamma.cpp

    r88 r106  
    3030public:
    3131        int sc;
    32         virtual void draw_item(window_manager *wm, image *screen, int x, int y, int num, int active)
    33         {
    34                 long x2 = x + item_width( wm ) - 1;
    35                 long y2 = y + item_height( wm ) - 1;
     32        virtual void draw_item(image *screen, int x, int y, int num, int active)
     33        {
     34                long x2 = x + item_width() - 1;
     35                long y2 = y + item_height() - 1;
    3636                screen->bar( x, y, x2, y2, 0 );
    3737                screen->bar( x, y, x2 - 3, y2, sc + num );
     
    4343        void set_pos( int x ) { cur_sel = x; }
    4444        virtual int total() { return 32; }
    45         virtual int item_width( window_manager *wm ) { return 12; }
    46         virtual int item_height( window_manager *wm ) { return 20; }
     45        virtual int item_width() { return 12; }
     46        virtual int item_height() { return 20; }
    4747        virtual int activate_on_mouse_move() { return 0; }
    4848
     
    9494                gray_pal->load();
    9595
    96                 int wm_bc = eh->bright_color(), wm_mc = eh->medium_color(), wm_dc = eh->dark_color();
     96                int wm_bc = wm->bright_color(), wm_mc = wm->medium_color(), wm_dc = wm->dark_color();
    9797
    9898                int br_r = pal->red( wm_bc ) + 20;
     
    144144                }
    145145
    146                 eh->set_colors( gray_pal->find_closest( br_r, br_g, br_b ),
     146                wm->set_colors( gray_pal->find_closest( br_r, br_g, br_b ),
    147147                        gray_pal->find_closest( md_r, md_g, md_b ),
    148148                        gray_pal->find_closest( dr_r, dr_g, dr_b ) );
    149149
    150150                int wl = WINDOW_FRAME_LEFT, wh = WINDOW_FRAME_TOP;
    151                 int sh = eh->font()->height() + 35;
     151                int sh = wm->font()->height() + 35;
    152152                button *but = new button( wl + 5, wh + 5 + sh * 3, ID_GAMMA_OK, cash.img( ok_button ),
    153153                        new info_field( wl + 35, wh + 10 + sh * 3, ID_NULL, lang_string( "gamma_msg" ), 0 ) );
     
    156156                gp->set_pos( dg / 4 );
    157157
    158                 jwindow *gw = eh->new_window( xres / 2 - 190, yres / 2 - 90, -1, -1, gp);
     158                jwindow *gw = wm->new_window( xres / 2 - 190, yres / 2 - 90, -1, -1, gp);
    159159
    160160                event ev;
    161                 eh->flush_screen();
     161                wm->flush_screen();
    162162                do
    163163                {
    164164                        do
    165165                        {
    166                                 eh->get_event(ev);
    167                         } while( ev.type == EV_MOUSE_MOVE && eh->event_waiting() );
    168                         eh->flush_screen();
     166                                wm->get_event(ev);
     167                        } while( ev.type == EV_MOUSE_MOVE && wm->event_waiting() );
     168                        wm->flush_screen();
    169169                        if( ev.type == EV_CLOSE_WINDOW)
    170170                        {
     
    179179                dg = ( (spicker *)gw->inm->get( ID_GREEN_PICKER ) )->first_selected() * 4;
    180180
    181                 eh->close_window( gw );
    182                 eh->flush_screen();
    183 
    184                 eh->set_colors( wm_bc, wm_mc, wm_dc);
     181                wm->close_window( gw );
     182                wm->flush_screen();
     183
     184                wm->set_colors( wm_bc, wm_mc, wm_dc);
    185185                delete gray_pal;
    186186
  • abuse/trunk/src/go.cpp

    r56 r106  
    338338    game_object::draw();
    339339    int sx=the_game->screenx(x),sy=the_game->screeny(y);     
    340     screen->rectangle(sx-xrange,sy-yrange,sx+xrange,sy+yrange,eh->bright_color());     
     340    screen->rectangle(sx-xrange,sy-yrange,sx+xrange,sy+yrange,wm->bright_color());     
    341341  } 
    342342}
  • abuse/trunk/src/gui.cpp

    r67 r106  
    3131}
    3232
    33 void ico_switch_button::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     33void ico_switch_button::area(int &x1, int &y1, int &x2, int &y2)
    3434{
    3535  x1=10000;
     
    4040  for (ifield *b=blist;b;b=b->next)
    4141  {   
    42     b->area(X1,Y1,X2,Y2,wm);
     42    b->area(X1,Y1,X2,Y2);
    4343    if (X1<x1) x1=X1;
    4444    if (Y1<y1) y1=Y1;
     
    6868}
    6969
    70 void ico_switch_button::handle_event(event &ev, image *screen, window_manager *wm, input_manager *im)
     70void ico_switch_button::handle_event(event &ev, image *screen, input_manager *im)
    7171{
    7272  if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON &&
     
    7575    cur_but=cur_but->next;
    7676    if (!cur_but) cur_but=blist;
    77     cur_but->draw(act,screen,wm);
    78     cur_but->handle_event(ev,screen,wm,im);
     77    cur_but->draw(act,screen);
     78    cur_but->handle_event(ev,screen,im);
    7979  }
    8080
    8181}
    8282
    83 void ico_button::draw(int active, image *screen, window_manager *wm)
     83void ico_button::draw(int active, image *screen)
    8484{
    8585  int x1,y1,x2,y2;
    86   area(x1,y1,x2,y2,wm);
     86  area(x1,y1,x2,y2);
    8787 
    8888  if (active!=act  && activate_id!=-1 && active)
     
    116116extern int sfx_volume;
    117117
    118 void ico_button::handle_event(event &ev, image *screen, window_manager *wm, input_manager *im)
     118void ico_button::handle_event(event &ev, image *screen, input_manager *im)
    119119{
    120120  if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON &&
     
    122122  {
    123123    int  x1,y1,x2,y2;
    124     area(x1,y1,x2,y2,wm);
     124    area(x1,y1,x2,y2);
    125125    up=!up;
    126     draw(act,screen,wm);
     126    draw(act,screen);
    127127    wm->push_event(new event(id,(char *)this));
    128128    if (S_BUTTON_PRESS_SND)
     
    131131}
    132132
    133 void ico_button::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     133void ico_button::area(int &x1, int &y1, int &x2, int &y2)
    134134{
    135135  x1=x; y1=y;
  • abuse/trunk/src/gui.hpp

    r57 r106  
    2121  ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id=-1, char const *help_key=NULL);
    2222
    23   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    24   virtual void draw_first(image *screen, window_manager *wm) { draw(0,screen,wm); }
    25   virtual void draw(int active, image *screen, window_manager *wm);
    26   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     23  virtual void area(int &x1, int &y1, int &x2, int &y2);
     24  virtual void draw_first(image *screen) { draw(0,screen); }
     25  virtual void draw(int active, image *screen);
     26  virtual void handle_event(event &ev, image *screen, input_manager *im);
    2727
    2828  virtual char *read() { return (char *)&up; }
     
    4040  public :
    4141  ico_switch_button(int X, int Y, int ID, int start_on, ifield *butts, ifield *Next);
    42   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    43   virtual void draw_first(image *screen, window_manager *wm) { cur_but->draw_first(screen,wm); }
    44   virtual void draw(int active, image *screen, window_manager *wm) { cur_but->draw(active,screen,wm); act=active; }
    45   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     42  virtual void area(int &x1, int &y1, int &x2, int &y2);
     43  virtual void draw_first(image *screen) { cur_but->draw_first(screen); }
     44  virtual void draw(int active, image *screen) { cur_but->draw(active,screen); act=active; }
     45  virtual void handle_event(event &ev, image *screen, input_manager *im);
    4646  virtual ifield *unlink(int id);
    4747  virtual char *read() { return cur_but->read(); }
  • abuse/trunk/src/imlib/filesel.cpp

    r90 r106  
    2323  file_picker(int X, int Y, int ID, int Rows, ifield *Next);
    2424  virtual int total() { return tf+td; }
    25   virtual int item_width(window_manager *wm) { return wm->font()->width()*wid; }
    26   virtual int item_height(window_manager *wm) { return wm->font()->height()+1; }
    27   virtual void draw_item(window_manager *wm, image *screen, int x, int y, int num, int active);
    28   virtual void note_selection(window_manager *wm, image *screen, input_manager *inm, int x);
     25  virtual int item_width() { return wm->font()->width()*wid; }
     26  virtual int item_height() { return wm->font()->height()+1; }
     27  virtual void draw_item(image *screen, int x, int y, int num, int active);
     28  virtual void note_selection(image *screen, input_manager *inm, int x);
    2929  void free_up();
    3030  ~file_picker() { free_up(); }
     
    4242}
    4343
    44 void file_picker::note_selection(window_manager *wm, image *screen, input_manager *inm, int x)
     44void file_picker::note_selection(image *screen, input_manager *inm, int x)
    4545{
    4646  if (x<td)
     
    4949    {
    5050      int x1,y1,x2,y2;
    51       area(x1,y1,x2,y2,wm);
     51      area(x1,y1,x2,y2);
    5252      screen->bar(x1,y1,x2,y2,wm->medium_color());
    5353
     
    7272
    7373      reconfigure(); 
    74       draw_first(screen,wm);
     74      draw_first(screen);
    7575    }
    7676  } else
     
    7979    sprintf(nm,"%s/%s",cd,f[x-td]);
    8080    text_field *link=(text_field *)inm->get(sid);
    81     link->change_data(nm,strlen(nm),1,screen,wm);
     81    link->change_data(nm,strlen(nm),1,screen);
    8282  }
    8383
    8484}
    8585
    86 void file_picker::draw_item(window_manager *wm, image *screen, int x, int y, int num, int active)
     86void file_picker::draw_item(image *screen, int x, int y, int num, int active)
    8787{
    8888  if (active)
    89     screen->bar(x,y,x+item_width(wm)-1,y+item_height(wm)-1,wm->black());
     89    screen->bar(x,y,x+item_width()-1,y+item_height()-1,wm->black());
    9090
    9191  if (num<td)
     
    116116}
    117117
    118 jwindow *file_dialog(window_manager *wm, char const *prompt, char const *def,
     118jwindow *file_dialog(char const *prompt, char const *def,
    119119                     int ok_id, char const *ok_name, int cancel_id,
    120120                     char const *cancel_name, char const *FILENAME_str,
  • abuse/trunk/src/imlib/filesel.hpp

    r57 r106  
    1313#include "jwindow.hpp"
    1414
    15 jwindow *file_dialog(window_manager *wm, char const *prompt, char const *def,
     15jwindow *file_dialog(char const *prompt, char const *def,
    1616                     int ok_id, char const *ok_name, int cancel_id,
    1717                     char const *cancel_name, char const *FILENAME_str,
  • abuse/trunk/src/imlib/guistat.cpp

    r56 r106  
    1010#include "config.h"
    1111
     12#include "input.hpp"
    1213#include "status.hpp"
    1314#include "timing.hpp"
     
    2122  visual_object *show;
    2223  jwindow *stat_win;
    23   window_manager *wm;
    2424  int last_update;
    2525  time_marker last_time;
    26   gui_status_node(char const *Name, visual_object *Show, window_manager *WM, gui_status_node *Next)
     26  gui_status_node(char const *Name, visual_object *Show, gui_status_node *Next)
    2727  { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name);
    2828    show=Show;
     
    3030    last_update=0;
    3131    stat_win=NULL;
    32     wm=WM;
    3332  }
    3433  ~gui_status_node();
     
    7372void gui_status_manager::push(char const *name, visual_object *show)
    7473{
    75   first=new gui_status_node(name,show,wm,first); 
     74  first=new gui_status_node(name,show,first); 
    7675}
    7776
    78 gui_status_manager::gui_status_manager(window_manager *WM)
     77gui_status_manager::gui_status_manager()
    7978{
    80   wm=WM;
    8179  first=NULL;
    8280  strcpy(title,"STATUS");
     
    9593      {
    9694        long wx=xres/2,wy=10,len1=strlen(first->name)*wm->font()->width()+10,len2=0,len3,
    97           h1=wm->font()->height()+5,h2=first->show ? first->show->height(wm) : 0;
     95          h1=wm->font()->height()+5,h2=first->show ? first->show->height() : 0;
    9896
    99         if (first->show) len2=first->show->width(wm)/2;
     97        if (first->show) len2=first->show->width()/2;
    10098        if (len2>len1) len3=len2; else len3=len1;
    10199        wx-=len3/2;
     
    112110        if (first->show)
    113111          first->show->draw(first->stat_win->screen,(first->stat_win->x2()-first->stat_win->x1())/2-
    114                             first->show->width(wm)/2,my+h1,wm,NULL);
     112                            first->show->width()/2,my+h1,NULL);
    115113
    116114        draw_bar(first,percentage);
  • abuse/trunk/src/imlib/guistat.hpp

    r57 r106  
    1717class gui_status_manager : public status_manager
    1818{
    19   window_manager *wm;
    2019  char title[40];
    2120  int last_perc;
    2221  public :   
    2322  gui_status_node *first;
    24   gui_status_manager(window_manager *WM);
     23  gui_status_manager();
    2524  virtual void push(char const *name, visual_object *show);
    2625  virtual void update(int percentage);
  • abuse/trunk/src/imlib/input.cpp

    r56 r106  
    6060}
    6161
    62 void button_box::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     62void button_box::area(int &x1, int &y1, int &x2, int &y2)
    6363{
    6464  button *b=buttons;
     
    6666  else
    6767  {
    68     b->area(x1,y1,x2,y2,wm);
     68    b->area(x1,y1,x2,y2);
    6969    int xp1,yp1,xp2,yp2;
    7070    for (b=(button *)b->next;b;b=(button *)b->next)
    7171    {
    72       b->area(xp1,yp1,xp2,yp2,wm);
     72      b->area(xp1,yp1,xp2,yp2);
    7373      if (xp1<x1) x1=xp1;
    7474      if (xp2>x2) x2=xp2;
     
    7979}
    8080
    81 void button_box::draw_first(image *screen, window_manager *wm)
     81void button_box::draw_first(image *screen)
    8282{
    8383  for (button *b=buttons;b;b=(button *)b->next)
    84     b->draw_first(screen,wm);
    85 }
    86 
    87 void button_box::draw(int active, image *screen, window_manager *wm)
     84    b->draw_first(screen);
     85}
     86
     87void button_box::draw(int active, image *screen)
    8888{
    8989  return ;
     
    100100}
    101101
    102 void button_box::handle_event(event &ev, image *screen, window_manager *wm, input_manager *im)
     102void button_box::handle_event(event &ev, image *screen, input_manager *im)
    103103{
    104104  switch (ev.type)
     
    110110      for (button *b=buttons;!found && b;b=(button *)b->next)  // see if the user clicked on a button
    111111      {
    112         b->area(x1,y1,x2,y2,wm);
     112        b->area(x1,y1,x2,y2);
    113113        if (ev.mouse_move.x>=x1 && ev.mouse_move.x<=x2 &&
    114114            ev.mouse_move.y>=y1 && ev.mouse_move.y<=y2)
    115115        {
    116           b->handle_event(ev,screen,wm,im);
     116          b->handle_event(ev,screen,im);
    117117
    118118          int total=0;
     
    131131                  total--;
    132132                  b2->push();
    133                   b2->draw_first(screen,wm);
     133                  b2->draw_first(screen);
    134134                }
    135135            }
    136             b->draw_first(screen,wm);
     136            b->draw_first(screen);
    137137          } else if (total==0 && maxdown)
    138138            b->push();    // don't let the user de-press a button if non others are selected.     
     
    154154
    155155
    156 void button_box::arrange_left_right(window_manager *wm)
     156void button_box::arrange_left_right()
    157157{
    158158  button *b=buttons;
     
    160160  for (;b;b=(button *)b->next)
    161161  {
    162     b->area(x1,y1,x2,y2,wm);
     162    b->area(x1,y1,x2,y2);
    163163    b->x=x_on;
    164164    b->y=y;
     
    167167}
    168168
    169 void button_box::arrange_up_down(window_manager *wm)
     169void button_box::arrange_up_down()
    170170
    171171  button *b=buttons;
     
    173173  for (;b;b=(button *)b->next)
    174174  {
    175     b->area(x1,y1,x2,y2,wm);
     175    b->area(x1,y1,x2,y2);
    176176    b->y=y_on;
    177177    b->x=x;
     
    186186}
    187187
    188 void button::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     188void button::area(int &x1, int &y1, int &x2, int &y2)
    189189
    190190  x1=x; y1=y;
     
    237237
    238238void text_field::change_data(char const *new_data, int new_cursor, // cursor==-1, does not change it.
    239                              int active, image *screen, window_manager *wm)
     239                             int active, image *screen)
    240240{
    241241  if (strlen(format)<strlen(new_data))
     
    245245  if (new_cursor!=-1)
    246246    cur=new_cursor;
    247   draw_first(screen,wm);
    248   draw(active,screen,wm);
     247  draw_first(screen);
     248  draw(active,screen);
    249249}
    250250
     
    259259#endif
    260260
    261 void text_field::handle_event(event &ev, image *screen, window_manager *wm, input_manager *im)
     261void text_field::handle_event(event &ev, image *screen, input_manager *im)
    262262{
    263263  int xx;
     
    266266    switch (ev.key)
    267267    {
    268       case JK_LEFT : if (cur) { draw_cur(wm->dark_color(),screen,wm); cur--;
    269                            draw_cur(wm->bright_color(),screen,wm); } break;
    270       case JK_RIGHT : if (cur<(int)strlen(format)-1) { draw_cur(wm->dark_color(),screen,wm); cur++;
    271                            draw_cur(wm->bright_color(),screen,wm); } break;
     268      case JK_LEFT : if (cur) { draw_cur(wm->dark_color(),screen); cur--;
     269                           draw_cur(wm->bright_color(),screen); } break;
     270      case JK_RIGHT : if (cur<(int)strlen(format)-1) { draw_cur(wm->dark_color(),screen); cur++;
     271                           draw_cur(wm->bright_color(),screen); } break;
    272272      case JK_END : if (cur!=last_spot())
    273                           { draw_cur(wm->dark_color(),screen,wm); cur=last_spot();
     273                          { draw_cur(wm->dark_color(),screen); cur=last_spot();
    274274                            if (cur==(int)strlen(format)-1) cur--;
    275                            draw_cur(wm->bright_color(),screen,wm); } break;
     275                           draw_cur(wm->bright_color(),screen); } break;
    276276      case JK_HOME : if (cur)
    277                           { draw_cur(wm->dark_color(),screen,wm); cur=0;
    278                            draw_cur(wm->bright_color(),screen,wm); } break;
     277                          { draw_cur(wm->dark_color(),screen); cur=0;
     278                           draw_cur(wm->bright_color(),screen); } break;
    279279      case JK_BACKSPACE : if (cur)
    280          { draw_cur(wm->dark_color(),screen,wm); cur--;
     280         { draw_cur(wm->dark_color(),screen); cur--;
    281281           for (xx=cur;xx<(int)strlen(format)-1;xx++)
    282282             data[xx]=data[xx+1];
    283283           data[strlen(format)-1]=' ';
    284            draw_text(screen,wm);
    285            draw_cur(wm->bright_color(),screen,wm);
     284           draw_text(screen);
     285           draw_cur(wm->bright_color(),screen);
    286286           wm->push_event(new event(id,(char *)this));
    287287         } break;
    288288      default : if (ev.key>=' ' && ev.key<='~')
    289289         {
    290            draw_cur(wm->dark_color(),screen,wm);
     290           draw_cur(wm->dark_color(),screen);
    291291           for (xx=strlen(format)-1;xx>cur && xx>0;xx--)
    292292             data[xx]=data[xx-1];
     
    295295             cur++;
    296296           data[strlen(format)]=0;
    297            draw_text(screen,wm);
    298            draw_cur(wm->bright_color(),screen,wm);
     297           draw_text(screen);
     298           draw_cur(wm->bright_color(),screen);
    299299           wm->push_event(new event(id,(char *)this));
    300300         } break;
     
    307307#endif
    308308
    309 void text_field::draw(int active, image *screen, window_manager *wm)
     309void text_field::draw(int active, image *screen)
    310310{
    311311  if (active)
    312312  {
    313     screen->rectangle(xstart(wm),y,xend(wm),yend(wm),wm->bright_color());
    314     draw_cur(wm->bright_color(),screen,wm);
     313    screen->rectangle(xstart(),y,xend(),yend(),wm->bright_color());
     314    draw_cur(wm->bright_color(),screen);
    315315  }
    316316  else
    317317  {
    318     screen->rectangle(xstart(wm),y,xend(wm),yend(wm),wm->dark_color());
    319     draw_cur(wm->dark_color(),screen,wm);
    320   }
    321 }
    322 
    323 void text_field::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     318    screen->rectangle(xstart(),y,xend(),yend(),wm->dark_color());
     319    draw_cur(wm->dark_color(),screen);
     320  }
     321}
     322
     323void text_field::area(int &x1, int &y1, int &x2, int &y2)
    324324{
    325325  x1=x; y1=y;
    326   x2=xend(wm);
    327   y2=yend(wm);
     326  x2=xend();
     327  y2=yend();
    328328}
    329329
     
    361361{ up=!up; }
    362362
    363 void button::handle_event(event &ev, image *screen, window_manager *wm, input_manager *im)
     363void button::handle_event(event &ev, image *screen, input_manager *im)
    364364{
    365365  if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON &&
     
    367367  {
    368368    int  x1,y1,x2,y2;
    369     area(x1,y1,x2,y2,wm);
     369    area(x1,y1,x2,y2);
    370370    up=!up;
    371     draw_first(screen,wm);
    372     draw(act,screen,wm);
     371    draw_first(screen);
     372    draw(act,screen);
    373373    wm->push_event(new event(id,(char *)this));
    374374  }
    375375}
    376376
    377 void button::draw(int active, image *screen, window_manager *wm)
     377void button::draw(int active, image *screen)
    378378{
    379379  int x1,y1,x2,y2,color=(active ? wm->bright_color() : wm->medium_color()); 
    380   area(x1,y1,x2,y2,wm);
     380  area(x1,y1,x2,y2);
    381381  if (active!=act  && act_id!=-1 && active)
    382382    wm->push_event(new event(act_id,NULL));
     
    399399}
    400400
    401 void button::draw_first(image *screen, window_manager *wm)
     401void button::draw_first(image *screen)
    402402{
    403403  if (pressed) 
    404     draw(0,screen,wm);
     404    draw(0,screen);
    405405  else
    406406  {
    407407
    408408    int x1,y1,x2,y2;
    409     area(x1,y1,x2,y2,wm);
     409    area(x1,y1,x2,y2);
    410410   
    411411
     
    439439}
    440440
    441 void text_field::draw_first(image *screen, window_manager *wm)
     441void text_field::draw_first(image *screen)
    442442{
    443443  wm->font()->put_string(screen,x,y+3,prompt);
    444   screen->bar(xstart(wm),y,xend(wm),yend(wm),wm->dark_color());
    445   wm->font()->put_string(screen,xstart(wm)+1,y+3,data);
    446 }
    447 
    448 
    449 void text_field::draw_cur(int color, image *screen, window_manager *wm)
    450 {
    451   screen->bar(xstart(wm)+cur*wm->font()->width()+1,
    452                       yend(wm)-2,
    453                       xstart(wm)+(cur+1)*wm->font()->width(),
    454                       yend(wm)-1,color);
     444  screen->bar(xstart(),y,xend(),yend(),wm->dark_color());
     445  wm->font()->put_string(screen,xstart()+1,y+3,data);
     446}
     447
     448
     449void text_field::draw_cur(int color, image *screen)
     450{
     451  screen->bar(xstart()+cur*wm->font()->width()+1,
     452                      yend()-2,
     453                      xstart()+(cur+1)*wm->font()->width(),
     454                      yend()-1,color);
    455455}
    456456
     
    465465
    466466
    467 void info_field::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     467void info_field::area(int &x1, int &y1, int &x2, int &y2)
    468468{
    469469  if (w==-1)     // if we haven't calculated this yet
     
    509509}
    510510
    511 void info_field::draw_first(image *screen, window_manager *wm)
     511void info_field::draw_first(image *screen)
    512512{
    513513  put_para(screen,text,x+1,y+1,wm->font()->width(),wm->font()->height(),wm->font(),wm->black());
  • abuse/trunk/src/imlib/input.hpp

    r57 r106  
    1313#include "filter.hpp"
    1414
     15extern window_manager *wm; /* FIXME: get rid of this if possible */
    1516
    1617class button : public ifield
     
    2526  button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next);
    2627
    27   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    28   virtual void draw_first(image *screen, window_manager *wm);
    29   virtual void draw(int active, image *screen, window_manager *wm);
    30   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     28  virtual void area(int &x1, int &y1, int &x2, int &y2);
     29  virtual void draw_first(image *screen);
     30  virtual void draw(int active, image *screen);
     31  virtual void handle_event(event &ev, image *screen, input_manager *im);
    3132  void change_visual(image *new_visual);
    3233  virtual void remap(filter *f);
     
    4748  void press_button(int id);      // if button box doesn't contain id, nothing happens
    4849  virtual void remap(filter *f);
    49   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    50   virtual void draw_first(image *screen, window_manager *wm);
    51   virtual void draw(int active, image *screen, window_manager *wm);
    52   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im); 
     50  virtual void area(int &x1, int &y1, int &x2, int &y2);
     51  virtual void draw_first(image *screen);
     52  virtual void draw(int active, image *screen);
     53  virtual void handle_event(event &ev, image *screen, input_manager *im); 
    5354  virtual ~button_box();
    5455  virtual char *read();   // return pointer to first button which is depressed
    5556  virtual ifield *find(int search_id);  // should return pointer to item you control with this id
    56   void arrange_left_right(window_manager *wm);
    57   void arrange_up_down(window_manager *wm);
     57  void arrange_left_right();
     58  void arrange_up_down();
    5859} ;
    5960
     
    6263  int cur;
    6364  char *prompt,*data,*format;
    64   int xstart(window_manager *wm) { return x+wm->font()->width()*(strlen(prompt)+1)+3; }
    65   int xend(window_manager *wm) { return x+wm->font()->width()*(strlen(prompt)+1+strlen(format))+7; }
    66   int yend(window_manager *wm) { return y+wm->font()->height()+5; }
    67   void draw_cur(int color, image *screen, window_manager *wm);
     65  int xstart() { return x+wm->font()->width()*(strlen(prompt)+1)+3; }
     66  int xend() { return x+wm->font()->width()*(strlen(prompt)+1+strlen(format))+7; }
     67  int yend() { return y+wm->font()->height()+5; }
     68  void draw_cur(int color, image *screen);
    6869  int last_spot() { int x=strlen(data); while (x && data[x-1]==' ') x--; return x; }
    69   void draw_text(image *screen, window_manager *wm)
     70  void draw_text(image *screen)
    7071  {
    71     screen->bar(xstart(wm)+1,y+1,xend(wm)-1,yend(wm)-1,wm->dark_color());
    72     wm->font()->put_string(screen,xstart(wm)+1,y+3,data);
     72    screen->bar(xstart()+1,y+1,xend()-1,yend()-1,wm->dark_color());
     73    wm->font()->put_string(screen,xstart()+1,y+3,data);
    7374  }
    7475public :
     
    7879                               double Data, ifield *Next);
    7980
    80   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    81   virtual void draw_first(image *screen, window_manager *wm);
    82   virtual void draw(int active, image *screen, window_manager *wm);
    83   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     81  virtual void area(int &x1, int &y1, int &x2, int &y2);
     82  virtual void draw_first(image *screen);
     83  virtual void draw(int active, image *screen);
     84  virtual void handle_event(event &ev, image *screen, input_manager *im);
    8485 
    8586  virtual ~text_field() { jfree(prompt); jfree(format); jfree(data); }
    8687  virtual char *read();
    8788  void change_data(char const *new_data, int new_cursor,       // cursor==-1, does not change it.
    88                    int active, image *screen, window_manager *wm);
     89                   int active, image *screen);
    8990} ;
    9091
     
    9899public :
    99100  info_field(int X, int Y, int ID, char const *info, ifield *Next);
    100   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    101   virtual void draw_first(image *screen, window_manager *wm);
    102   virtual void draw(int active, image *screen, window_manager *wm) { ; }
    103   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im) { ; }
     101  virtual void area(int &x1, int &y1, int &x2, int &y2);
     102  virtual void draw_first(image *screen);
     103  virtual void draw(int active, image *screen) { ; }
     104  virtual void handle_event(event &ev, image *screen, input_manager *im) { ; }
    104105  virtual char *read() { return text; }
    105106  virtual int selectable() { return 0; }
  • abuse/trunk/src/imlib/jwindow.cpp

    r56 r106  
    1212#include "video.hpp"
    1313#include "image.hpp"
     14#include "input.hpp"
    1415#include "event.hpp"
    1516#include "filter.hpp"
     
    201202        ev.type=EV_SPURIOUS;
    202203      } else if (ev.window)
    203         ev.window->inm->handle_event(ev,ev.window,this);
     204        ev.window->inm->handle_event(ev,ev.window);
    204205    }
    205206  } else if (state==dragging)
     
    274275  if (y>screen->height()-4) y=screen->height()-10;
    275276 
    276   jwindow *j=new jwindow(x,y,l,h,this,fields,Name),*k;
     277  jwindow *j=new jwindow(x,y,l,h,fields,Name),*k;
    277278  j->property.hidden=0;
    278279  if (!first)
     
    350351}
    351352
    352 jwindow::jwindow(int X, int Y, int L, int H, window_manager *wm, ifield *fields, char const *Name)
     353jwindow::jwindow(int X, int Y, int L, int H, ifield *fields, char const *Name)
    353354{
    354355  ifield *i;
     
    359360    for (i=fields;i;i=i->next)
    360361    {
    361       i->area(x1,y1,x2,y2,wm);
     362      i->area(x1,y1,x2,y2);
    362363      if ((int)y2>(int)h)
    363364        h=y2+1;
     
    384385  screen->clear(backg);
    385386  next=NULL;
    386   inm=new input_manager(screen,wm,fields);
     387  inm=new input_manager(screen,fields);
    387388  if (Name==NULL)
    388389    name=strcpy((char *)jmalloc(strlen(" ")+1,"jwindow::window name")," "); 
     
    469470{
    470471  if (active)
    471     active->draw(0,screen,wm);
     472    active->draw(0,screen);
    472473
    473474  active=NULL;
    474475}
    475476
    476 void input_manager::handle_event(event &ev, jwindow *j, window_manager *wm)
     477void input_manager::handle_event(event &ev, jwindow *j)
    477478{
    478479  ifield *i,*in_area=NULL;
     
    491492      for (i=first;i;i=i->next)
    492493      {
    493         i->area(x1,y1,x2,y2,wm);
     494        i->area(x1,y1,x2,y2);
    494495        if (ev.mouse_move.x>=x1 && ev.mouse_move.y>=y1 &&
    495496            ev.mouse_move.x<=x2 && ev.mouse_move.y<=y2)
     
    499500      {
    500501        if (active)
    501           active->draw(0,screen,wm);
     502          active->draw(0,screen);
    502503
    503504        active=in_area;
    504505
    505506        if (active)
    506           active->draw(1,screen,wm);
     507          active->draw(1,screen);
    507508      }
    508509    }
    509510    if (ev.type==EV_KEY && ev.key==JK_TAB && active)
    510511    {
    511       active->draw(0,screen,wm);
     512      active->draw(0,screen);
    512513      do
    513514      {
     
    515516        if (!active) active=first;
    516517      } while (active && !active->selectable());
    517       active->draw(1,screen,wm);
     518      active->draw(1,screen);
    518519    }
    519520  } else active=grab;
     
    522523  {
    523524    if (ev.type!=EV_MOUSE_MOVE && ev.type!=EV_MOUSE_BUTTON)
    524       active->handle_event(ev,screen,wm,this);
     525      active->handle_event(ev,screen,this);
    525526    else
    526527    {
    527       active->area(x1,y1,x2,y2,wm);
     528      active->area(x1,y1,x2,y2);
    528529      if (grab || (ev.mouse_move.x>=x1 && ev.mouse_move.y>=y1 &&
    529530          ev.mouse_move.x<=x2 && ev.mouse_move.y<=y2))
    530531      {
    531532        if (j)
    532           active->handle_event(ev,screen,wm,j->inm);
    533         else active->handle_event(ev,screen,wm,this);
     533          active->handle_event(ev,screen,j->inm);
     534        else active->handle_event(ev,screen,this);
    534535      }
    535536    }
     
    552553  ifield *i;
    553554  for (i=first;i;i=i->next)
    554     i->draw_first(screen,wm);
     555    i->draw_first(screen);
    555556  if (active)
    556     active->draw(1,screen,wm);
    557 }
    558 
    559 input_manager::input_manager(image *Screen, window_manager *WM, ifield *First)
     557    active->draw(1,screen);
     558}
     559
     560input_manager::input_manager(image *Screen, ifield *First)
    560561{
    561562  no_selections_allowed=0;
     
    563564  grab=NULL;
    564565  screen=Screen;
    565   wm=WM;
    566566  active=first=First;
    567567  while (active && !active->selectable()) active=active->next;
  • abuse/trunk/src/imlib/jwindow.hpp

    r57 r106  
    3838  image *screen;
    3939  ifield *first,*active,*grab;
    40   window_manager *wm;
    4140  jwindow *cur;
    4241  int no_selections_allowed;
    4342public :
    44   input_manager(image *Screen, window_manager *WM, ifield *First);
    45   void handle_event(event &ev, jwindow *j, window_manager *wm);
     43  input_manager(image *Screen, ifield *First);
     44  void handle_event(event &ev, jwindow *j);
    4645  ifield *get(int id);
    4746  void redraw();
     
    6463  int id;
    6564  ifield *next;
    66   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm) = 0;
    67   virtual void draw_first(image *screen, window_manager *wm)              = 0;
    68   virtual void draw(int active, image *screen, window_manager *wm)        = 0;
    69   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im) = 0;
     65  virtual void area(int &x1, int &y1, int &x2, int &y2) = 0;
     66  virtual void draw_first(image *screen)              = 0;
     67  virtual void draw(int active, image *screen)        = 0;
     68  virtual void handle_event(event &ev, image *screen, input_manager *im) = 0;
    7069  virtual int selectable() { return 1; }
    7170  virtual void remap(filter *f) { ; }
     
    9392  input_manager *inm;
    9493  void *local_info;     // pointer to info block for local system (may support windows)
    95   jwindow(int X, int Y, int L, int H, window_manager *wm, ifield *fields, char const *Name=NULL);
     94  jwindow(int X, int Y, int L, int H, ifield *fields, char const *Name=NULL);
    9695  void redraw(int hi, int med, int low, JCFont *fnt);
    9796  void resize(int L, int H);
  • abuse/trunk/src/imlib/pmenu.cpp

    r56 r106  
    1717}
    1818
    19 pmenu::pmenu(int X, int Y, pmenu_item *first, image *screen, window_manager *wmanager)
     19pmenu::pmenu(int X, int Y, pmenu_item *first, image *screen)
    2020{
    2121  top=first;
    2222  active=NULL;
    23   wm=wmanager;
    2423
    2524  short cx1,cy1,cx2,cy2;
     
    4645
    4746  for (p=top;p;p=p->next,tx+=tw)
    48     p->draw_self(bar,itemx(p,wm),1,itemw(p,wm),1,wm,p==active);     
     47    p->draw_self(bar,itemx(p),1,itemw(p),1,p==active);     
    4948/*  }
    5049  else
    5150  {
    5251    for (p=top;p;p=p->next,tx+=tw)
    53       p->draw(bar,itemx(p,wm),1,itemw(p,wm),1,wm,p==active);
     52      p->draw(bar,itemx(p),1,itemw(p),1,p==active);
    5453  }*/
    5554 
     
    139138
    140139
    141 void psub_menu::hide(jwindow *parent, int x, int y, window_manager* wm)
     140void psub_menu::hide(jwindow *parent, int x, int y)
    142141{
    143142  int w,h;
    144   calc_size(w,h,wm);
     143  calc_size(w,h);
    145144  short cx1,cy1,cx2,cy2;
    146145  screen->get_clip(cx1,cy1,cx2,cy2);
     
    154153    {
    155154      int w,h;
    156       calc_size(w,h,wm);
    157       item_num(active)->draw(win,x+3,y+3+active*(wm->font()->height()+1),w-6,0,wm,0);
     155      calc_size(w,h);
     156      item_num(active)->draw(win,x+3,y+3+active*(wm->font()->height()+1),w-6,0,0);
    158157    }
    159158    wm->close_window(win);
     
    162161}
    163162
    164 void psub_menu::calc_size(int &w, int &h, window_manager *wm)
     163void psub_menu::calc_size(int &w, int &h)
    165164{
    166165  int tw=wm->font()->width(),th=wm->font()->height();
     
    179178}
    180179
    181 void psub_menu::draw(jwindow *parent, int x, int y, window_manager *wmanager)
     180void psub_menu::draw(jwindow *parent, int x, int y)
    182181{
    183182  if (win) wm->close_window(win);
    184   wm=wmanager;
    185 
    186183
    187184  int w,h,i=0;
    188   calc_size(w,h,wm);
     185  calc_size(w,h);
    189186  short cx1,cy1,cx2,cy2;
    190187  screen->get_clip(cx1,cy1,cx2,cy2);
     
    210207 
    211208  for (p=first;p;p=p->next,i++,y+=wm->font()->height()+1)
    212     p->draw(win,x,y,w-6,0,wm,i==active);
    213 
    214 }
    215 
    216 void pmenu_item::draw_self(jwindow *parent, int x, int y, int w, int top, window_manager *wm, int active)
     209    p->draw(win,x,y,w-6,0,i==active);
     210
     211}
     212
     213void pmenu_item::draw_self(jwindow *parent, int x, int y, int w, int top, int active)
    217214{
    218215  int bx=x;
     
    250247
    251248void pmenu_item::draw(jwindow *parent, int x, int y, int w, int top,
    252                       window_manager *wm, int active)
     249                      int active)
    253250
    254251  if (n)
     
    256253    if (active)
    257254    {     
    258       draw_self(parent,x,y,w,top,wm,active);
     255      draw_self(parent,x,y,w,top,active);
    259256      if (sub)
    260257      {
    261258        if (top)
    262           sub->draw(parent,x,y+wm->font()->height()+2,wm);
     259          sub->draw(parent,x,y+wm->font()->height()+2);
    263260        else
    264           sub->draw(parent,x+w,y,wm);
     261          sub->draw(parent,x+w,y);
    265262      }
    266263    }
     
    270267      {
    271268        if (top)
    272           sub->hide(parent,x,y+wm->font()->height()+2,wm);
     269          sub->hide(parent,x,y+wm->font()->height()+2);
    273270        else
    274           sub->hide(parent,x+w,y,wm);
    275       }
    276       draw_self(parent,x,y,w,top,wm,active);
    277 
    278     }
    279 
    280   } else draw_self(parent,x,y,w,top,wm,active);
    281 }
    282 
    283 int pmenu::itemx(pmenu_item *p, window_manager *wm)
     271          sub->hide(parent,x+w,y);
     272      }
     273      draw_self(parent,x,y,w,top,active);
     274
     275    }
     276
     277  } else draw_self(parent,x,y,w,top,active);
     278}
     279
     280int pmenu::itemx(pmenu_item *p)
    284281{
    285282  if (p->xp!=-1) return p->xp;
     
    299296
    300297
    301 void pmenu::draw(image *screen, window_manager *wm, int top_only)
    302 {
    303 
    304 }
    305 
    306 
    307 int psub_menu::handle_event(jwindow *parent, int x, int y, window_manager *wm, event &ev)
     298void pmenu::draw(image *screen, int top_only)
     299{
     300
     301}
     302
     303
     304int psub_menu::handle_event(jwindow *parent, int x, int y, event &ev)
    308305{
    309306  int w,h;
    310   calc_size(w,h,wm);
     307  calc_size(w,h);
    311308  short cx1,cy1,cx2,cy2;
    312309  screen->get_clip(cx1,cy1,cx2,cy2);
     
    328325    {
    329326      if (active!=-1)
    330         item_num(active)->draw(win,dx,3+active*(th+1),w-6,0,wm,0);
     327        item_num(active)->draw(win,dx,3+active*(th+1),w-6,0,0);
    331328      active=new_active;
    332329      if (active!=-1)
    333         item_num(active)->draw(win,dx,3+active*(th+1),w-6,0,wm,1);
     330        item_num(active)->draw(win,dx,3+active*(th+1),w-6,0,1);
    334331    }
    335332    if (ev.type==EV_MOUSE_BUTTON)
    336333    {
    337334      if (active!=-1)
    338         return item_num(active)->handle_event(win,dx,3+active*(th+1),w-6,0,wm,ev);
     335        return item_num(active)->handle_event(win,dx,3+active*(th+1),w-6,0,ev);
    339336      else return 0;
    340337    } else return 1;
    341338  } else if (active!=-1)
    342     return item_num(active)->handle_event(win,win->x+dx,win->y+3+active*(th+1),w-6,0,wm,ev);
     339    return item_num(active)->handle_event(win,win->x+dx,win->y+3+active*(th+1),w-6,0,ev);
    343340  else return 0;
    344341
     
    347344
    348345int pmenu_item::handle_event(jwindow *parent, int x, int y, int w, int top,
    349                              window_manager *wm, event &ev)
     346                             event &ev)
    350347{
    351348  x+=parent->x;
     
    364361  {
    365362    if (top)
    366       return sub->handle_event(parent,x,y+wm->font()->height()+2,wm,ev);
    367     else return sub->handle_event(parent,x+w,y,wm,ev);
     363      return sub->handle_event(parent,x,y+wm->font()->height()+2,ev);
     364    else return sub->handle_event(parent,x+w,y,ev);
    368365  } else return 0;
    369366}
    370367
    371 pmenu_item *pmenu::inarea(int mx, int my, image *screen, window_manager *wm)
     368pmenu_item *pmenu::inarea(int mx, int my, image *screen)
    372369{
    373370  short cx1,cy1,cx2,cy2;
     
    381378    {
    382379      if (!p->next) return p;
    383       else if (itemx(p->next,wm)>mx) return p;
     380      else if (itemx(p->next)>mx) return p;
    384381    }
    385382    return NULL;
     
    407404}
    408405
    409 int pmenu::handle_event(event &ev, image *screen, window_manager *wm)
     406int pmenu::handle_event(event &ev, image *screen)
    410407{
    411408  if (!active && ev.window!=bar) return 0;
     
    438435    case EV_MOUSE_MOVE :
    439436    {
    440       pmenu_item *new_selection=inarea(ev.mouse_move.x,ev.mouse_move.y,screen,wm);
     437      pmenu_item *new_selection=inarea(ev.mouse_move.x,ev.mouse_move.y,screen);
    441438      if (!new_selection && active &&
    442           active->handle_event(bar,itemx(active,wm),1,itemw(active,wm),1,wm,ev))
     439          active->handle_event(bar,itemx(active),1,itemw(active),1,ev))
    443440        return 1;
    444441      else if (active!=new_selection)
    445442      {
    446443        if (active)
    447           active->draw(bar,itemx(active,wm),1,itemw(active,wm),1,wm,0);
     444          active->draw(bar,itemx(active),1,itemw(active),1,0);
    448445        active=new_selection;
    449446        if (active)
    450           active->draw(bar,itemx(active,wm),1,itemw(active,wm),1,wm,1);
     447          active->draw(bar,itemx(active),1,itemw(active),1,1);
    451448      }
    452449      if (active) return 1;
     
    457454      if (active)
    458455      {
    459         if (active->handle_event(bar,itemx(active,wm),1,itemw(active,wm),1,wm,ev))
     456        if (active->handle_event(bar,itemx(active),1,itemw(active),1,ev))
    460457        {
    461           active->draw(bar,itemx(active,wm),1,itemw(active,wm),1,wm,0);
     458          active->draw(bar,itemx(active),1,itemw(active),1,0);
    462459          active=NULL;
    463460          return 1;
  • abuse/trunk/src/imlib/pmenu.hpp

    r57 r106  
    3131  pmenu_item *find_id(int search_id);
    3232  pmenu_item *find_key(int key);
    33   void draw       (jwindow *parent, int x, int y, int w, int top, window_manager *wm, int active);
    34   void draw_self  (jwindow *parent, int x, int y, int w, int top, window_manager *wm, int active);
    35   int handle_event(jwindow *parent, int x, int y, int w, int top, window_manager *wm, event &ev);
     33  void draw       (jwindow *parent, int x, int y, int w, int top, int active);
     34  void draw_self  (jwindow *parent, int x, int y, int w, int top, int active);
     35  int handle_event(jwindow *parent, int x, int y, int w, int top, event &ev);
    3636  int own_event(event &ev);
    3737  ~pmenu_item();
     
    4444  psub_menu *next;
    4545  int active;
    46   window_manager *wm;
    4746  jwindow *win;
    4847  pmenu_item *item_num(int x) { pmenu_item *p=first; while (x-- && p) p=p->next; return p; }
    4948public :
    50   void calc_size(int &w, int &h, window_manager *wm);
     49  void calc_size(int &w, int &h);
    5150  pmenu_item *find_id(int search_id);
    5251  pmenu_item *find_key(int key);
    5352  psub_menu(pmenu_item *First, psub_menu *Next)
    5453  { first=First; Next=Next; win=0; active=0; }
    55   int handle_event(jwindow *parent, int x, int y, window_manager *wm, event &ev);
    56   void draw(jwindow *parent, int x, int y, window_manager *wm);
    57   void hide(jwindow *parent, int x, int y, window_manager *wm);
     54  int handle_event(jwindow *parent, int x, int y, event &ev);
     55  void draw(jwindow *parent, int x, int y);
     56  void hide(jwindow *parent, int x, int y);
    5857  int own_event(event &ev);
    5958  ~psub_menu();
     
    6261class pmenu
    6362{
    64   window_manager *wm;
    6563  jwindow *bar;
    6664  pmenu_item *top,*active;
    67   int itemw(pmenu_item *p, window_manager *wm)
     65  int itemw(pmenu_item *p)
    6866  { return strlen(p->name())*wm->font()->width()+2; }
    69   int itemx(pmenu_item *p, window_manager *wm);
    70   pmenu_item *inarea(int mx, int my, image *screen, window_manager *wm);
     67  int itemx(pmenu_item *p);
     68  pmenu_item *inarea(int mx, int my, image *screen);
    7169public :
    7270  ~pmenu();
    73   pmenu(int X, int Y, pmenu_item *first, image *screen, window_manager *wm);
     71  pmenu(int X, int Y, pmenu_item *first, image *screen);
    7472  void move(int new_x, int new_y);
    75   void draw(image *screen, window_manager *wm, int top_only=0);
    76   int handle_event(event &ev, image *screen, window_manager *wm); 
     73  void draw(image *screen, int top_only=0);
     74  int handle_event(event &ev, image *screen); 
    7775
    7876} ;
  • abuse/trunk/src/imlib/scroller.cpp

    r56 r106  
    5050    0, 0, 0, 0, 0};
    5151
    52 void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, uint8_t *buf)
     52void show_icon(image *screen, int x, int y, int icw, int ich, uint8_t *buf)
    5353{
    5454  short cx1,cy1,cx2,cy2;
     
    7979
    8080
    81 void scroller::area(int &x1, int &y1, int &x2, int &y2, window_manager *wm)
     81void scroller::area(int &x1, int &y1, int &x2, int &y2)
    8282
    83   area_config(wm);
     83  area_config();
    8484  x1=x-1; y1=y-1; 
    8585  if (vert)
     
    112112
    113113
    114 void scroller::draw_first(image *screen, window_manager *wm)
     114void scroller::draw_first(image *screen)
    115115{
    116116  if (sx>=t) sx=t-1;
    117   draw(0,screen,wm);
     117  draw(0,screen);
    118118  screen->wiget_bar(b1x(),b1y(),b1x()+bw()-1,b1y()+bh()-1,
    119119                    wm->bright_color(),wm->medium_color(),wm->dark_color());
    120120  screen->wiget_bar(b2x(),b2y(),b2x()+bw()-1,b2y()+bh()-1,
    121121                    wm->bright_color(),wm->medium_color(),wm->dark_color());
    122   show_icon(screen,wm,b1x()+2,b1y()+2,bw()-4,bh()-4,b1());
    123   show_icon(screen,wm,b2x()+2,b2y()+2,bw()-4,bh()-4,b2());
     122  show_icon(screen,b1x()+2,b1y()+2,bw()-4,bh()-4,b1());
     123  show_icon(screen,b2x()+2,b2y()+2,bw()-4,bh()-4,b2());
    124124
    125125  int x1,y1,x2,y2;
     
    127127  screen->bar(x1,y1,x2,y2,wm->black());
    128128  screen->bar(x1+1,y1+1,x2-1,y2-1,wm->medium_color());   
    129   draw_wiget(screen,wm,0);
    130   scroll_event(sx,screen,wm);
     129  draw_wiget(screen,0);
     130  scroll_event(sx,screen);
    131131}
    132132
     
    154154
    155155
    156 void scroller::draw_wiget(image *screen, window_manager *wm, int erase)
     156void scroller::draw_wiget(image *screen, int erase)
    157157{
    158158  int x1,y1,x2,y2;
     
    165165}
    166166
    167 void scroller::draw(int active, image *screen, window_manager *wm)
     167void scroller::draw(int active, image *screen)
    168168{
    169169  int x1,y1,x2,y2;
    170   area(x1,y1,x2,y2,wm);
     170  area(x1,y1,x2,y2);
    171171  screen->rectangle(x1,y1,x2,y2,active ? wm->bright_color() : wm->dark_color());
    172172}
    173173
    174174
    175 void scroller::handle_event(event &ev, image *screen, window_manager *wm, input_manager *inm)
     175void scroller::handle_event(event &ev, image *screen, input_manager *inm)
    176176{
    177177  int mx=ev.mouse_move.x,my=ev.mouse_move.y;
     
    186186          if (sx>0)
    187187          {
    188             draw_wiget(screen,wm,1);
     188            draw_wiget(screen,1);
    189189            sx--;
    190             draw_wiget(screen,wm,0);
    191             scroll_event(sx,screen,wm);
     190            draw_wiget(screen,0);
     191            scroll_event(sx,screen);
    192192          }
    193193        } else if (mx>=b2x() && mx<b2x()+bw() && my>=b2y() && my<=b2y()+bh())
     
    195195          if (sx<t-1)
    196196          {
    197             draw_wiget(screen,wm,1);
     197            draw_wiget(screen,1);
    198198            sx++;
    199             draw_wiget(screen,wm,0);
    200             scroll_event(sx,screen,wm);
     199            draw_wiget(screen,0);
     200            scroll_event(sx,screen);
    201201          }         
    202202        }
     
    219219              if (nx!=sx && nx>=0 && nx<t)
    220220              {
    221                 draw_wiget(screen,wm,1);
     221                draw_wiget(screen,1);
    222222                sx=nx;
    223                 draw_wiget(screen,wm,0);
    224                 scroll_event(sx,screen,wm);             
     223                draw_wiget(screen,0);
     224                scroll_event(sx,screen);               
    225225              }         
    226226            }
    227           } else handle_inside_event(ev,screen,wm,inm);
     227          } else handle_inside_event(ev,screen,inm);
    228228        }
    229229      } else if (!ev.mouse_button && drag!=-1)
     
    242242        if (nx!=sx)
    243243        {
    244           draw_wiget(screen,wm,1);
     244          draw_wiget(screen,1);
    245245          sx=nx;
    246           draw_wiget(screen,wm,0);
    247           scroll_event(sx,screen,wm);
     246          draw_wiget(screen,0);
     247          scroll_event(sx,screen);
    248248        }
    249249      } else if ( activate_on_mouse_move())
     
    252252        wig_area(x1,y1,x2,y2);
    253253        if (mx>=x && mx<=x+l-1 && my>=y && my<=y+h-1)
    254           handle_inside_event(ev,screen,wm,inm);
     254          handle_inside_event(ev,screen,inm);
    255255      }
    256256
     
    261261      {
    262262        case JK_LEFT :
    263         { handle_left(screen,wm,inm); } break;
     263        { handle_left(screen,inm); } break;
    264264        case JK_RIGHT :
    265         { handle_right(screen,wm,inm); } break;
     265        { handle_right(screen,inm); } break;
    266266        case JK_UP :
    267         { handle_up(screen,wm,inm); } break;
     267        { handle_up(screen,inm); } break;
    268268        case JK_DOWN :
    269         { handle_down(screen,wm,inm); } break;
     269        { handle_down(screen,inm); } break;
    270270
    271271        default :
    272           handle_inside_event(ev,screen,wm,inm);
     272          handle_inside_event(ev,screen,inm);
    273273      }
    274274    } break;
     
    277277
    278278
    279 void scroller::handle_right(image *screen, window_manager *wm, input_manager *inm)
     279void scroller::handle_right(image *screen, input_manager *inm)
    280280{
    281281  if (!vert && sx<t-1)
    282282  {
    283     draw_wiget(screen,wm,1);
     283    draw_wiget(screen,1);
    284284    sx++;
    285     draw_wiget(screen,wm,0);
    286     scroll_event(sx,screen,wm);     
    287   }
    288 }
    289 
    290 void scroller::handle_left(image *screen, window_manager *wm, input_manager *inm)
     285    draw_wiget(screen,0);
     286    scroll_event(sx,screen);       
     287  }
     288}
     289
     290void scroller::handle_left(image *screen, input_manager *inm)
    291291{
    292292  if (!vert && sx>1)
    293293  {
    294     draw_wiget(screen,wm,1);
     294    draw_wiget(screen,1);
    295295    sx--;
    296     draw_wiget(screen,wm,0);
    297     scroll_event(sx,screen,wm);     
    298   }
    299 }
    300 
    301 void scroller::handle_up(image *screen, window_manager *wm, input_manager *inm)
     296    draw_wiget(screen,0);
     297    scroll_event(sx,screen);       
     298  }
     299}
     300
     301void scroller::handle_up(image *screen, input_manager *inm)
    302302{
    303303  if (vert && sx>1)
    304304  {
    305     draw_wiget(screen,wm,1);
     305    draw_wiget(screen,1);
    306306    sx--;
    307     draw_wiget(screen,wm,0);
    308     scroll_event(sx,screen,wm);     
    309   }
    310 }
    311 
    312 void scroller::handle_down(image *screen, window_manager *wm, input_manager *inm)
     307    draw_wiget(screen,0);
     308    scroll_event(sx,screen);       
     309  }
     310}
     311
     312void scroller::handle_down(image *screen, input_manager *inm)
    313313{
    314314  if (vert && sx<t-1)
    315315  {
    316     draw_wiget(screen,wm,1);
     316    draw_wiget(screen,1);
    317317    sx++;
    318     draw_wiget(screen,wm,0);
    319     scroll_event(sx,screen,wm);     
    320   }
    321 }
    322 
    323 void scroller::set_x (int x, image *screen, window_manager *wm)
     318    draw_wiget(screen,0);
     319    scroll_event(sx,screen);       
     320  }
     321}
     322
     323void scroller::set_x (int x, image *screen)
    324324{
    325325  if (x<0) x=0;
     
    327327  if (x!=sx)
    328328  {
    329     draw_wiget(screen,wm,1);
     329    draw_wiget(screen,1);
    330330    sx=x;
    331     draw_wiget(screen,wm,0);
    332     scroll_event(sx,screen,wm);     
     331    draw_wiget(screen,0);
     332    scroll_event(sx,screen);       
    333333  }
    334334}
     
    356356
    357357
    358 void scroller::scroll_event(int newx, image *screen, window_manager *wm)
     358void scroller::scroll_event(int newx, image *screen)
    359359{
    360360  screen->bar(x,y,x+l-1,y+h-1,wm->black());
     
    370370}
    371371
    372 void pick_list::area_config(window_manager *wm)
     372void pick_list::area_config()
    373373{
    374374  l=wid*wm->font()->width();
     
    407407}
    408408
    409 void pick_list::handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm)
     409void pick_list::handle_inside_event(event &ev, image *screen, input_manager *inm)
    410410{
    411411  if (ev.type==EV_MOUSE_MOVE && activate_on_mouse_move())
     
    415415    {
    416416      cur_sel=sel;
    417       scroll_event(last_sel,screen,wm);
     417      scroll_event(last_sel,screen);
    418418    }   
    419419  }
     
    428428      {
    429429        cur_sel=sel;
    430         scroll_event(last_sel,screen,wm);
     430        scroll_event(last_sel,screen);
    431431      }     
    432432    }
     
    448448      sx=found;
    449449      cur_sel=found;
    450       scroll_event(sx,screen,wm);
     450      scroll_event(sx,screen);
    451451    } else key_hist_total=0;
    452452  }
    453453}
    454454
    455 void pick_list::handle_up(image *screen, window_manager *wm, input_manager *inm)
     455void pick_list::handle_up(image *screen, input_manager *inm)
    456456{
    457457  if (cur_sel>0)
     
    460460  if (cur_sel<sx)
    461461  {
    462     draw_wiget(screen,wm,1);
     462    draw_wiget(screen,1);
    463463    sx=cur_sel;
    464     draw_wiget(screen,wm,0);
    465   }
    466   scroll_event(sx,screen,wm);             
    467 }
    468 
    469 void pick_list::handle_down(image *screen, window_manager *wm, input_manager *inm)
     464    draw_wiget(screen,0);
     465  }
     466  scroll_event(sx,screen);               
     467}
     468
     469void pick_list::handle_down(image *screen, input_manager *inm)
    470470{
    471471  if (cur_sel<t-1)
     
    474474  if (cur_sel>sx+th-1)
    475475  {
    476     draw_wiget(screen,wm,1);
     476    draw_wiget(screen,1);
    477477    sx=cur_sel-th+1;
    478     draw_wiget(screen,wm,0);
    479   }
    480   scroll_event(sx,screen,wm);             
    481 }
    482 
    483 void pick_list::scroll_event(int newx, image *screen, window_manager *wm)
     478    draw_wiget(screen,0);
     479  }
     480  scroll_event(sx,screen);               
     481}
     482
     483void pick_list::scroll_event(int newx, image *screen)
    484484{
    485485  last_sel=newx;
     
    569569}
    570570
    571 void spicker::draw_background(window_manager *wm, image *screen)
     571void spicker::draw_background(image *screen)
    572572{
    573573  screen->bar(x,y,x+l-1,y+h-1,wm->dark_color());
     
    575575
    576576
    577 void spicker::area_config(window_manager *wm)
     577void spicker::area_config()
    578578{
    579579  if (vert)
    580     l=item_width(wm)+4;
     580    l=item_width()+4;
    581581  else
    582     l=item_width(wm)*c+4;
     582    l=item_width()*c+4;
    583583
    584584  if (vert)
    585     h=item_height(wm)*r+4;
     585    h=item_height()*r+4;
    586586  else
    587     h=item_height(wm)+4;
    588 
    589 }
    590 
    591 void spicker::set_x(int x, image *screen, window_manager *wm)
     587    h=item_height()+4;
     588
     589}
     590
     591void spicker::set_x(int x, image *screen)
    592592{
    593593  cur_sel=x;
    594594  sx=x;
    595   scroll_event(x,screen,wm);
    596 }
    597 
    598 
    599 void spicker::scroll_event(int newx, image *screen, window_manager *wm)
     595  scroll_event(x,screen);
     596}
     597
     598
     599void spicker::scroll_event(int newx, image *screen)
    600600{
    601601  last_sel=newx;
     
    603603  xo=x+2;
    604604  yo=y+2;
    605   if (vert) { xa=0; ya=item_height(wm); }
    606   else { xa=item_width(wm); ya=0; }
    607   draw_background(wm,screen);
     605  if (vert) { xa=0; ya=item_height(); }
     606  else { xa=item_width(); ya=0; }
     607  draw_background(screen);
    608608
    609609  for (int i=newx;i<newx+vis();i++)
     
    612612    {
    613613      if (m)     
    614         draw_item(wm,screen,xo,yo,i,get_select(i));
     614        draw_item(screen,xo,yo,i,get_select(i));
    615615      else
    616         draw_item(wm,screen,xo,yo,i,i==cur_sel);
     616        draw_item(screen,xo,yo,i,i==cur_sel);
    617617    }
    618618    xo+=xa; yo+=ya;
     
    621621
    622622
    623 void spicker::handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm)
     623void spicker::handle_inside_event(event &ev, image *screen, input_manager *inm)
    624624{
    625625  switch (ev.type)
     
    631631        int me;     
    632632        if (vert)
    633           me=last_sel+(ev.mouse_move.y-y)/item_height(wm);
     633          me=last_sel+(ev.mouse_move.y-y)/item_height();
    634634        else
    635           me=last_sel+(ev.mouse_move.x-x)/item_width(wm);
     635          me=last_sel+(ev.mouse_move.x-x)/item_width();
    636636        if (me<t && me>=0)
    637637        {
     
    639639          {
    640640            cur_sel=me;
    641             scroll_event(last_sel,screen,wm);
    642             note_new_current(wm,screen,inm,me);
     641            scroll_event(last_sel,screen);
     642            note_new_current(screen,inm,me);
    643643          }
    644644        }
     
    649649      int me;     
    650650      if (vert)
    651         me=last_sel+(ev.mouse_move.y-y)/item_height(wm);
     651        me=last_sel+(ev.mouse_move.y-y)/item_height();
    652652      else
    653         me=last_sel+(ev.mouse_move.x-x)/item_width(wm);
     653        me=last_sel+(ev.mouse_move.x-x)/item_width();
    654654      if (me<t && me>=0)
    655655      {
     
    661661            {
    662662              set_select(me,!get_select(me));
    663               scroll_event(last_sel,screen,wm);
     663              scroll_event(last_sel,screen);
    664664              inm->grab_focus(this);
    665665            }
     
    669669        {
    670670          if (cur_sel==me)         
    671             note_selection(wm,screen,inm,me);
     671            note_selection(screen,inm,me);
    672672          else
    673673          {
    674674            cur_sel=me;
    675             scroll_event(last_sel,screen,wm);
    676             note_new_current(wm,screen,inm,me);
     675            scroll_event(last_sel,screen);
     676            note_new_current(screen,inm,me);
    677677          }
    678678        }
     
    684684
    685685
    686 void spicker::handle_up(image *screen, window_manager *wm, input_manager *inm)
     686void spicker::handle_up(image *screen, input_manager *inm)
    687687{
    688688  if (vert && cur_sel>0)
     
    692692    if (cur_sel<sx)
    693693    {
    694       draw_wiget(screen,wm,1);
     694      draw_wiget(screen,1);
    695695      last_sel=sx=cur_sel;
    696       draw_wiget(screen,wm,0);
     696      draw_wiget(screen,0);
    697697    }
    698     scroll_event(last_sel,screen,wm);
    699     note_new_current(wm,screen,inm,cur_sel);   
    700   }
    701 }
    702 
    703 void spicker::handle_down(image *screen, window_manager *wm, input_manager *inm)
     698    scroll_event(last_sel,screen);
     699    note_new_current(screen,inm,cur_sel);   
     700  }
     701}
     702
     703void spicker::handle_down(image *screen, input_manager *inm)
    704704{
    705705  if (vert && cur_sel<t-1)
     
    708708  if (cur_sel>sx+r-1)
    709709  {
    710     draw_wiget(screen,wm,1);
     710    draw_wiget(screen,1);
    711711    last_sel=sx=cur_sel-r+1;
    712     draw_wiget(screen,wm,0);
    713   }
    714   scroll_event(sx,screen,wm);
    715   note_new_current(wm,screen,inm,cur_sel);   
    716 }
    717 
    718 void spicker::handle_left(image *screen, window_manager *wm, input_manager *inm)
    719 {
    720 }
    721 
    722 void spicker::handle_right(image *screen, window_manager *wm, input_manager *inm)
    723 {
    724 }
    725 
    726 
    727 
    728 
     712    draw_wiget(screen,0);
     713  }
     714  scroll_event(sx,screen);
     715  note_new_current(screen,inm,cur_sel);   
     716}
     717
     718void spicker::handle_left(image *screen, input_manager *inm)
     719{
     720}
     721
     722void spicker::handle_right(image *screen, input_manager *inm)
     723{
     724}
     725
     726
     727
     728
  • abuse/trunk/src/imlib/scroller.hpp

    r57 r106  
    3333  int wig_x();
    3434  int darea() { return (l-bw()-2)-bw()-bw(); }
    35   void draw_wiget(image *screen, window_manager *wm, int erase);
     35  void draw_wiget(image *screen, int erase);
    3636  int mouse_to_drag(int mx,int my);
    3737public :
    3838  int t,sx;
    3939  scroller(int X, int Y, int ID, int L, int H, int Vert, int Total_items, ifield *Next);
    40   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    41   virtual void draw_first(image *screen, window_manager *wm);
    42   virtual void draw(int active, image *screen, window_manager *wm);
    43   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     40  virtual void area(int &x1, int &y1, int &x2, int &y2);
     41  virtual void draw_first(image *screen);
     42  virtual void draw(int active, image *screen);
     43  virtual void handle_event(event &ev, image *screen, input_manager *im);
    4444  virtual char *read() { return (char *)&sx; }
    4545
    4646  virtual int activate_on_mouse_move() { return 1; }
    47   virtual void handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm) {;}
    48   virtual void scroll_event(int newx, image *screen, window_manager *wm);
    49   virtual void handle_up(image *screen, window_manager *wm, input_manager *inm);
    50   virtual void handle_down(image *screen, window_manager *wm, input_manager *inm);
    51   virtual void handle_left(image *screen, window_manager *wm, input_manager *inm);
    52   virtual void handle_right(image *screen, window_manager *wm, input_manager *inm);
    53   virtual void area_config(window_manager *wm) { ; }
     47  virtual void handle_inside_event(event &ev, image *screen, input_manager *inm) {;}
     48  virtual void scroll_event(int newx, image *screen);
     49  virtual void handle_up(image *screen, input_manager *inm);
     50  virtual void handle_down(image *screen, input_manager *inm);
     51  virtual void handle_left(image *screen, input_manager *inm);
     52  virtual void handle_right(image *screen, input_manager *inm);
     53  virtual void area_config() { ; }
    5454  void set_size(int width, int height) { l=width; h=height; }
    55   virtual void set_x(int x, image *screen, window_manager *wm);
     55  virtual void set_x(int x, image *screen);
    5656} ;
    5757
     
    6464  spicker(int X, int Y, int ID, int Rows, int Cols, int Vert, int MultiSelect, ifield *Next);
    6565  int vis() { if (vert) return r; else return c; }
    66   virtual void area_config(window_manager *wm);
     66  virtual void area_config();
    6767  void set_select(int x, int on);
    6868  int get_select(int x);
    6969  int first_selected();
    70   virtual void scroll_event(int newx, image *screen, window_manager *wm);
    71   virtual void handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm);
     70  virtual void scroll_event(int newx, image *screen);
     71  virtual void handle_inside_event(event &ev, image *screen, input_manager *inm);
    7272
    7373  // you should define \/
    74   virtual void draw_background(window_manager *wm, image *screen);
    75   virtual void draw_item(window_manager *wm, image *screen, int x, int y, int num, int active) = 0;
     74  virtual void draw_background(image *screen);
     75  virtual void draw_item(image *screen, int x, int y, int num, int active) = 0;
    7676  virtual int total() = 0;
    77   virtual int item_width(window_manager *wm) = 0;
    78   virtual int item_height(window_manager *wm) = 0;
    79   virtual void note_selection(window_manager *wm, image *screen, input_manager *inm, int x) { ; }
    80   virtual void note_new_current(window_manager *wm, image *screen, input_manager *inm, int x) { ; }
     77  virtual int item_width() = 0;
     78  virtual int item_height() = 0;
     79  virtual void note_selection(image *screen, input_manager *inm, int x) { ; }
     80  virtual void note_new_current(image *screen, input_manager *inm, int x) { ; }
    8181  virtual int ok_to_select(int num) { return 1; }
    82   virtual void handle_up(image *screen, window_manager *wm, input_manager *inm);
    83   virtual void handle_down(image *screen, window_manager *wm, input_manager *inm);
    84   virtual void handle_left(image *screen, window_manager *wm, input_manager *inm);
    85   virtual void handle_right(image *screen, window_manager *wm, input_manager *inm);
    86   virtual void set_x(int x, image *screen, window_manager *wm);
     82  virtual void handle_up(image *screen, input_manager *inm);
     83  virtual void handle_down(image *screen, input_manager *inm);
     84  virtual void handle_left(image *screen, input_manager *inm);
     85  virtual void handle_right(image *screen, input_manager *inm);
     86  virtual void set_x(int x, image *screen);
    8787  void reconfigure();   // should be called by constructor after class is ready to take virtual calls
    8888  ~spicker() { if (select) jfree(select); }
     
    104104  pick_list(int X, int Y, int ID, int height,
    105105            char **List, int num_entries, int start_yoffset, ifield *Next, image *texture=NULL);
    106   virtual void handle_inside_event(event &ev, image *screen, window_manager *wm, input_manager *inm);
    107   virtual void scroll_event(int newx, image *screen, window_manager *wm);
     106  virtual void handle_inside_event(event &ev, image *screen, input_manager *inm);
     107  virtual void scroll_event(int newx, image *screen);
    108108  virtual char *read() { return (char *)this; }
    109   virtual void area_config(window_manager *wm);
    110   virtual void handle_up(image *screen, window_manager *wm, input_manager *inm);
    111   virtual void handle_down(image *screen, window_manager *wm, input_manager *inm);
     109  virtual void area_config();
     110  virtual void handle_up(image *screen, input_manager *inm);
     111  virtual void handle_down(image *screen, input_manager *inm);
    112112  int get_selection() { return lis[cur_sel].number; }
    113113  ~pick_list() { jfree(lis); }
  • abuse/trunk/src/imlib/tools.cpp

    r56 r106  
    2121}
    2222
    23 void tool_picker::remap(palette *pal, window_manager *wm, image *screen)
     23void tool_picker::remap(palette *pal, image *screen)
    2424{
    2525  delete map;
    2626  map=new filter(old_pal,pal);
    27   draw_first(screen,wm);
     27  draw_first(screen);
    2828}
    2929
    3030tool_picker::tool_picker(int X, int Y, int ID,
    3131              int show_h, visual_object **Icons, int *Ids, int total_ic,
    32                          palette *icon_palette, palette *pal, window_manager *wm, ifield *Next) :
     32                         palette *icon_palette, palette *pal, ifield *Next) :
    3333  spicker(X,Y,ID,show_h,1,1,0,Next)
    3434{
     
    3939  for (int i=0;i<total_ic;i++)
    4040  {
    41     if (icons[i]->width(wm)>iw) iw=icons[i]->width(wm);
    42     if (icons[i]->height(wm)>ih) ih=icons[i]->height(wm);
     41    if (icons[i]->width()>iw) iw=icons[i]->width();
     42    if (icons[i]->height()>ih) ih=icons[i]->height();
    4343  }
    4444  map=new filter(icon_palette,pal);
     
    4747}
    4848
    49 void tool_picker::draw_item(window_manager *wm, image *screen, int x, int y, int num, int active)
     49void tool_picker::draw_item(image *screen, int x, int y, int num, int active)
    5050{
    5151  if (!active)
     
    5353  else
    5454    screen->bar(x,y,x+iw-1,y+ih-1,wm->bright_color());
    55   icons[num]->draw(screen,x,y,wm,map);
     55  icons[num]->draw(screen,x,y,map);
    5656}
    5757
  • abuse/trunk/src/imlib/tools.hpp

    r57 r106  
    3131  tool_picker(int X, int Y, int ID,
    3232              int show_h, visual_object **Icons, int *Ids, int total_ic,
    33               palette *icon_palette, palette *pal, window_manager *wm, ifield *Next);
     33              palette *icon_palette, palette *pal, ifield *Next);
    3434
    35   virtual void draw_item(window_manager *wm, image *screen, int x, int y, int num, int active);
     35  virtual void draw_item(image *screen, int x, int y, int num, int active);
    3636  virtual int total() { return total_icons; }
    37   virtual int item_width(window_manager *wm) { return iw; }
    38   virtual int item_height(window_manager *wm) { return ih; }
    39   virtual void note_new_current(window_manager *wm, image *screen, input_manager *inm, int x)
     37  virtual int item_width() { return iw; }
     38  virtual int item_height() { return ih; }
     39  virtual void note_new_current(image *screen, input_manager *inm, int x)
    4040  { wm->push_event(new event(ids[x],NULL)); }
    4141
    42   void remap(palette *pal, window_manager *wm, image *screen);
     42  void remap(palette *pal, image *screen);
    4343  ~tool_picker();
    4444} ;
  • abuse/trunk/src/imlib/visobj.cpp

    r56 r106  
    1010#include "config.h"
    1111
     12#include "input.hpp"
    1213#include "visobj.hpp"
    1314
    1415void image_visual::draw(image *screen, int x, int y,
    15                     window_manager *wm, filter *f)
     16                    filter *f)
    1617{
    1718  if (f)
     
    3031
    3132
    32 int string_visual::width(window_manager *wm)
     33int string_visual::width()
    3334{
    3435  if (w==-1)  // not calculated yet
     
    5152}
    5253
    53 int string_visual::height(window_manager *wm)
     54int string_visual::height()
    5455{
    55   if (w==-1) width(wm);
     56  if (w==-1) width();
    5657  return h;
    5758}
     
    7879}
    7980
    80 void string_visual::draw(image *screen, int x, int y,
    81                     window_manager *wm, filter *f)
     81void string_visual::draw(image *screen, int x, int y, filter *f)
    8282
    8383{
  • abuse/trunk/src/imlib/visobj.hpp

    r57 r106  
    1717{
    1818  public :
    19   virtual void draw(image *screen, int x, int y, window_manager *wm, filter *f) = 0;
    20   virtual int width(window_manager *wm) = 0;
    21   virtual int height(window_manager *wm) = 0;
     19  virtual void draw(image *screen, int x, int y, filter *f) = 0;
     20  virtual int width() = 0;
     21  virtual int height() = 0;
    2222  virtual ~visual_object() {}
    2323} ;
     
    3131
    3232  image_visual(image *img) { im=img; }
    33   virtual void draw(image *screen, int x, int y,
    34                     window_manager *wm, filter *f);
    35   virtual int width(window_manager *wm) { return im->width(); }
    36   virtual int height(window_manager *wm) { return im->height(); }
     33  virtual void draw(image *screen, int x, int y, filter *f);
     34  virtual int width() { return im->width(); }
     35  virtual int height() { return im->height(); }
    3736} ;
    3837
     
    4544  public :
    4645  string_visual(char *string, int Color);
    47   virtual void draw(image *screen, int x, int y,
    48                     window_manager *wm, filter *f);
    49   virtual int width(window_manager *wm);
    50   virtual int height(window_manager *wm);
     46  virtual void draw(image *screen, int x, int y, filter *f);
     47  virtual int width();
     48  virtual int height();
    5149} ;
    5250
  • abuse/trunk/src/innet.cpp

    r90 r106  
    542542
    543543
    544       jwindow *j=eh->new_window(0,yres/2,-1,-1,new info_field(WINDOW_FRAME_LEFT,
     544      jwindow *j=wm->new_window(0,yres/2,-1,-1,new info_field(WINDOW_FRAME_LEFT,
    545545                                                                   WINDOW_FRAME_TOP,
    546546                                                                   0,symbol_str("resync"),
    547547                                              new button(WINDOW_FRAME_LEFT,
    548                                                          WINDOW_FRAME_TOP+eh->font()->height()+5,ID_NET_DISCONNECT,
     548                                                         WINDOW_FRAME_TOP+wm->font()->height()+5,ID_NET_DISCONNECT,
    549549                                                         symbol_str("slack"),NULL)),symbol_str("hold!"))
    550550;
     
    552552 
    553553
    554       eh->flush_screen();
     554      wm->flush_screen();
    555555      if (!reload_start()) return ;
    556556
     
    561561      {
    562562                                service_net_request();
    563                                 if (eh->event_waiting())
     563                                if (wm->event_waiting())
    564564                                {
    565565                                  event ev;
    566566                                  do
    567567                                  {
    568                                     eh->get_event(ev);
     568                                    wm->get_event(ev);
    569569                                    if (ev.type==EV_MESSAGE && ev.message.id==ID_NET_DISCONNECT)
    570570                                    {
     
    573573                                    }
    574574                       
    575                                   } while (eh->event_waiting());
     575                                  } while (wm->event_waiting());
    576576                       
    577                                   eh->flush_screen();
     577                                  wm->flush_screen();
    578578                                }
    579579
    580580      } while (!reload_end());
    581       eh->close_window(j);
     581      wm->close_window(j);
    582582      unlink(NET_STARTFILE);
    583583
     
    651651        if (total_retry==12000)    // 2 minutes and nothing
    652652        {
    653           abort=eh->new_window(0,yres/2,-1,eh->font()->height()*4,
     653          abort=wm->new_window(0,yres/2,-1,wm->font()->height()*4,
    654654                               new info_field(WINDOW_FRAME_LEFT,
    655655                                              WINDOW_FRAME_TOP,
    656656                                              0,symbol_str("waiting"),
    657657                                              new button(WINDOW_FRAME_LEFT,
    658                                                          WINDOW_FRAME_TOP+eh->font()->height()+5,ID_NET_DISCONNECT,
     658                                                         WINDOW_FRAME_TOP+wm->font()->height()+5,ID_NET_DISCONNECT,
    659659                                                         symbol_str("slack"),NULL)),symbol_str("Error"));         
    660           eh->flush_screen();
     660          wm->flush_screen();
    661661        }
    662662      }
    663663      if (abort)
    664664      {
    665         if (eh->event_waiting())
     665        if (wm->event_waiting())
    666666        {
    667667          event ev;
    668668          do
    669669          {
    670             eh->get_event(ev);
     670            wm->get_event(ev);
    671671            if (ev.type==EV_MESSAGE && ev.message.id==ID_NET_DISCONNECT)
    672672            {
     
    674674              base->input_state=INPUT_PROCESSING;
    675675            }
    676           } while (eh->event_waiting());
    677 
    678           eh->flush_screen();
     676          } while (wm->event_waiting());
     677
     678          wm->flush_screen();
    679679        }
    680680      }
     
    683683    if (abort)
    684684    {
    685       eh->close_window(abort);
     685      wm->close_window(abort);
    686686      the_game->reset_keymap();
    687687
  • abuse/trunk/src/level.cpp

    r56 r106  
    787787    {
    788788      c1=morph_sel_frame_color;
    789       c2=eh->bright_color();
     789      c2=wm->bright_color();
    790790    } else
    791791    {
    792792      c2=morph_sel_frame_color;
    793       c1=eh->bright_color();
     793      c1=wm->bright_color();
    794794    }
    795795   
     
    16301630    sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"player_names",NULL,name_len,0));
    16311631
    1632     sd.add_by_hand(new spec_entry(SPEC_IMAGE,"thumb nail",NULL,4+160*(100+eh->font()->height()*2),0));
     1632    sd.add_by_hand(new spec_entry(SPEC_IMAGE,"thumb nail",NULL,4+160*(100+wm->font()->height()*2),0));
    16331633  }
    16341634
     
    16421642void level::write_thumb_nail(bFILE *fp, image *im)
    16431643{
    1644   image *i=new image(160,100+eh->font()->height()*2);
     1644  image *i=new image(160,100+wm->font()->height()*2);
    16451645  i->clear();
    16461646  scale_put(im,i,0,0,160,100);
    16471647  if (first_name)
    1648     eh->font()->put_string(i,80-strlen(first_name)*eh->font()->width()/2,100,first_name);
     1648    wm->font()->put_string(i,80-strlen(first_name)*wm->font()->width()/2,100,first_name);
    16491649
    16501650  time_t t;
     
    16531653
    16541654  strftime(buf,80,"%T %A %B %d",localtime(&t)); 
    1655   eh->font()->put_string(i,80-strlen(buf)*eh->font()->width()/2,100+eh->font()->height(),buf);
     1655  wm->font()->put_string(i,80-strlen(buf)*wm->font()->width()/2,100+wm->font()->height(),buf);
    16561656
    16571657  fp->write_uint16(i->width());
  • abuse/trunk/src/loadgame.cpp

    r88 r106  
    7373    buts[i]->next=buts[i+1];
    7474
    75   return eh->new_window(mx,yres/2-(WINDOW_FRAME_TOP+ih*5)/2,-1,-1,buts[0]);
     75  return wm->new_window(mx,yres/2-(WINDOW_FRAME_TOP+ih*5)/2,-1,-1,buts[0]);
    7676}
    7777
     
    103103  do
    104104  {
    105     eh->flush_screen();
    106     eh->get_event(ev);
     105    wm->flush_screen();
     106    wm->get_event(ev);
    107107    if (ev.type==EV_MESSAGE && ev.message.id>=ID_LOAD_GAME_NUMBER && ev.message.id<ID_LOAD_GAME_PREVIEW)
    108108      got_level=ev.message.id-ID_LOAD_GAME_NUMBER+1;
     
    113113  } while (!got_level && !quit);
    114114
    115   eh->close_window(l_win);
     115  wm->close_window(l_win);
    116116  the_game->reset_keymap();
    117117  return got_level;
     
    220220
    221221        jwindow *l_win=create_num_window(0,total_saved,thumb_nails);
    222         jwindow *preview=eh->new_window(l_win->x+l_win->l+5,l_win->y,max_w,max_h,NULL,title);
     222        jwindow *preview=wm->new_window(l_win->x+l_win->l+5,l_win->y,max_w,max_h,NULL,title);
    223223
    224224        first->put_image(preview->screen,preview->x1(),preview->y1());
     
    229229        do
    230230        {
    231                 eh->flush_screen();
    232                 eh->get_event(ev);
     231                wm->flush_screen();
     232                wm->get_event(ev);
    233233                if (ev.type==EV_MESSAGE && ev.message.id>=ID_LOAD_GAME_NUMBER && ev.message.id<ID_LOAD_GAME_PREVIEW)
    234234                        got_level=ev.message.id-ID_LOAD_GAME_NUMBER+1;
     
    245245        } while (!got_level && !quit);
    246246
    247         eh->close_window(l_win);
    248         eh->close_window(preview);
     247        wm->close_window(l_win);
     248        wm->close_window(preview);
    249249
    250250        for (i=0;i<total_saved;i++)
  • abuse/trunk/src/menu.cpp

    r88 r106  
    148148    int tl=strlen(title)*font->width();
    149149    int tx=screen->width()/2-tl/2;
    150     dark_wiget(tx-2,my-font->height()-4,tx+tl+2,my-2,eh->medium_color(),eh->dark_color(),180);
    151     font->put_string(screen,tx+1,my-font->height()-2,title,eh->bright_color());
     150    dark_wiget(tx-2,my-font->height()-4,tx+tl+2,my-2,wm->medium_color(),wm->dark_color(),180);
     151    font->put_string(screen,tx+1,my-font->height()-2,title,wm->bright_color());
    152152  }
    153153 
    154   dark_wiget(mx,my,mx+mw-1,my+mh-1,eh->medium_color(),eh->dark_color(),200);
     154  dark_wiget(mx,my,mx+mw-1,my+mh-1,wm->medium_color(),wm->dark_color(),200);
    155155
    156156
     
    159159  {
    160160    char *ms=men_str(CAR(c));
    161     font->put_string(screen,mx+10+1,y+1,ms,eh->black());
    162     font->put_string(screen,mx+10,y,ms,eh->bright_color());
     161    font->put_string(screen,mx+10+1,y+1,ms,wm->black());
     162    font->put_string(screen,mx+10,y,ms,wm->bright_color());
    163163    y+=font->height()+1;
    164164  }
    165165
    166   eh->flush_screen();
     166  wm->flush_screen();
    167167  event ev;
    168168  int choice=0,done=0;
     
    176176  do
    177177  {
    178     eh->flush_screen();
    179     if (eh->event_waiting())
    180     {
    181       eh->get_event(ev);
     178    wm->flush_screen();
     179    if (wm->event_waiting())
     180    {
     181      wm->get_event(ev);
    182182      if (ev.type==EV_KEY)
    183183      {
     
    228228
    229229      char *cur=men_str(nth(choice,args));
    230       font->put_string(screen,mx+10+1,by1+3,cur,eh->black());
    231       font->put_string(screen,mx+10,by1+2,cur,eh->bright_color());
    232       screen->rectangle(mx+1,by1,mx+mw-2,by2,eh->bright_color());
     230      font->put_string(screen,mx+10+1,by1+3,cur,wm->black());
     231      font->put_string(screen,mx+10,by1+2,cur,wm->bright_color());
     232      screen->rectangle(mx+1,by1,mx+mw-2,by2,wm->bright_color());
    233233
    234234      color+=cdir;
     
    239239        color+=cdir;
    240240      }
    241       eh->flush_screen();
     241      wm->flush_screen();
    242242      save->put_image(screen,mx+1,by1);
    243243    } else milli_wait(10);
     
    287287static void create_volume_window()
    288288{
    289 /*  int vx=WINDOW_FRAME_LEFT,vy=WINDOW_FRAME_TOP+eh->font()->height()*2,scroller_height=130,bh=eh->font()->height()+5;
    290 
    291   volume_window=eh->new_window(prop->getd("volume_x",xres/2-20),
     289/*  int vx=WINDOW_FRAME_LEFT,vy=WINDOW_FRAME_TOP+wm->font()->height()*2,scroller_height=130,bh=wm->font()->height()+5;
     290
     291  volume_window=wm->new_window(prop->getd("volume_x",xres/2-20),
    292292                               prop->getd("volume_y",yres/2-50),
    293293                               -1,
     
    299299  do
    300300  {
    301     eh->flush_screen();
    302     eh->get_event(ev);
     301    wm->flush_screen();
     302    wm->get_event(ev);
    303303    if (ev.type==EV_CLOSE_WINDOW && ev.window==volume_window) done=1;   
    304304  } while (!done);
    305   eh->close_window(volume_window);
     305  wm->close_window(volume_window);
    306306  volume_window=NULL; */
    307307
     
    320320      slider=cash.reg(ff,"volume_slide",t,1);
    321321 
    322   volume_window=eh->new_window(prop->getd("volume_x",xres/2-20),
     322  volume_window=wm->new_window(prop->getd("volume_x",xres/2-20),
    323323                               prop->getd("volume_y",yres/2-50),
    324324                               41-WINDOW_FRAME_LEFT-WINDOW_FRAME_RIGHT-2,
     
    337337  draw_sfx_vol(slider);
    338338  volume_window->inm->redraw();
    339   eh->grab_focus(volume_window);
    340   eh->flush_screen();
     339  wm->grab_focus(volume_window);
     340  wm->flush_screen();
    341341
    342342  volume_window->inm->allow_no_selections();
     
    346346  do
    347347  {
    348     do { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
    349     eh->flush_screen();
     348    do { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
     349    wm->flush_screen();
    350350    if (ev.type==EV_MESSAGE)
    351351    {
     
    396396    } else if (ev.type==EV_CLOSE_WINDOW || (ev.type==EV_KEY && ev.key==JK_ESC))
    397397    {
    398       eh->close_window(volume_window);
     398      wm->close_window(volume_window);
    399399      volume_window=NULL;
    400400    }
     
    448448  {
    449449    image blank(2,2); blank.clear();
    450     eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
     450    wm->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
    451451
    452452    ss=symbol_value(ss);
     
    459459      event ev;
    460460      do
    461       { eh->flush_screen();
    462         eh->get_event(ev);
     461      { wm->flush_screen();
     462        wm->get_event(ev);
    463463      } while (ev.type!=EV_KEY);
    464464      if (ev.key==JK_ESC && abortable)
     
    467467      ss=CDR(ss);
    468468    }
    469     eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     469    wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
    470470  }
    471471}
     
    572572          inm->redraw();
    573573          fade_in(NULL,8);
    574           eh->flush_screen();
     574          wm->flush_screen();
    575575
    576576        } break;
     
    580580    {
    581581      if (ev.window==volume_window)
    582       { eh->close_window(volume_window); volume_window=NULL; }
     582      { wm->close_window(volume_window); volume_window=NULL; }
    583583    } break;
    584584  }
     
    708708        list=make_default_buttons(xres-33,y,list);
    709709
    710         input_manager *inm=new input_manager(screen,eh,list);
     710        input_manager *inm=new input_manager(screen,list);
    711711        inm->allow_no_selections();
    712712        inm->clear_current();
     
    718718        int stop_menu=0;
    719719        time_marker start;
    720         eh->flush_screen();
     720        wm->flush_screen();
    721721        do
    722722        {
    723723                time_marker new_time;
    724724
    725                 if (eh->event_waiting())
     725                if (wm->event_waiting())
    726726                {
    727727                        do
    728728                        {
    729                                 eh->get_event(ev);
    730                         } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
    731                         inm->handle_event(ev,NULL,eh);
     729                                wm->get_event(ev);
     730                        } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
     731                        inm->handle_event(ev,NULL);
    732732                        if (ev.type==EV_KEY && ev.key==JK_ESC)
    733                                 eh->push_event(new event(ID_QUIT,NULL));
     733                                wm->push_event(new event(ID_QUIT,NULL));
    734734
    735735                        menu_handler(ev,inm);
    736736                        start.get_time();
    737737
    738                         eh->flush_screen();
     738                        wm->flush_screen();
    739739                }
    740740                else
  • abuse/trunk/src/net/gserver.cpp

    r61 r106  
    2929#include "input.hpp"
    3030#include "dev.hpp"
     31#include "game.hpp"
    3132
    3233extern base_memory_struct *base;
     
    3536extern net_protocol *prot;
    3637extern join_struct *join_array;
    37 extern window_manager *eh;
    3838extern void service_net_request();
    3939
     
    6666    if (last_count!=total_players())
    6767    {
    68       if (stat) eh->close_window(stat);
     68      if (stat) wm->close_window(stat);
    6969      char msg[100];
    7070      sprintf(msg,symbol_str("min_wait"),main_net_cfg->min_players-total_players());
    71       stat=eh->new_window(100,50,-1,-1,new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,ID_NULL,msg,
    72                                        new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+eh->font()->height()*2,
     71      stat=wm->new_window(100,50,-1,-1,new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,ID_NULL,msg,
     72                                       new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+wm->font()->height()*2,
    7373                                                  ID_CANCEL,symbol_str("cancel_button"),NULL)  ));
    74       eh->flush_screen();
     74      wm->flush_screen();
    7575      last_count=total_players();
    7676    }
    7777
    78     if (eh->event_waiting())
    79     {
    80       do { eh->get_event(ev); }  while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
    81       eh->flush_screen();
     78    if (wm->event_waiting())
     79    {
     80      do { wm->get_event(ev); }  while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
     81      wm->flush_screen();
    8282      if (ev.type==EV_MESSAGE && ev.message.id==ID_CANCEL)
    8383        abort=1;
     
    8888  if (stat)
    8989  {
    90     eh->close_window(stat);
    91     eh->flush_screen(); 
     90    wm->close_window(stat);
     91    wm->flush_screen(); 
    9292  }
    9393}
  • abuse/trunk/src/netcfg.cpp

    r88 r106  
    5353void net_configuration::cfg_error(char const *msg)
    5454{
    55   jwindow *j=eh->new_window(-1,0,-1,-1,new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,0,msg,
     55  jwindow *j=wm->new_window(-1,0,-1,-1,new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,0,msg,
    5656      new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+30,CFG_ERR_OK,symbol_str("ok_button"),NULL)),symbol_str("input_error"));
    5757  event ev;
    5858  do
    5959  {
    60     eh->flush_screen();
    61     do { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
     60    wm->flush_screen();
     61    do { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
    6262  } while (ev.type!=EV_MESSAGE || ev.message.id!=CFG_ERR_OK || ev.type==EV_CLOSE_WINDOW || (ev.type==EV_KEY && ev.key==JK_ESC));
    63   eh->close_window(j);
    64   eh->flush_screen();
     63  wm->close_window(j);
     64  wm->flush_screen();
    6565}
    6666
     
    171171  int x=WINDOW_FRAME_LEFT,y=WINDOW_FRAME_TOP;
    172172 
    173   jwindow *sv=eh->new_window(50,80,-1,-1,new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,NET_SERVER,symbol_str("server"),
    174                                      new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+eh->font()->height()*2,NET_CLIENT,symbol_str("client"),
    175                                      new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+eh->font()->height()*4,NET_SINGLE,symbol_str("single_play"),
    176                                      new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+eh->font()->height()*6,NET_CANCEL,symbol_str("cancel_net"),
     173  jwindow *sv=wm->new_window(50,80,-1,-1,new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,NET_SERVER,symbol_str("server"),
     174                                     new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+wm->font()->height()*2,NET_CLIENT,symbol_str("client"),
     175                                     new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+wm->font()->height()*4,NET_SINGLE,symbol_str("single_play"),
     176                                     new button(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP+wm->font()->height()*6,NET_CANCEL,symbol_str("cancel_net"),
    177177                                                NULL)))),symbol_str("Networking"));
    178178
     
    181181  do
    182182  {
    183     eh->flush_screen();
    184     do { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
     183    wm->flush_screen();
     184    do { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
    185185    if (ev.type==EV_MESSAGE)
    186186    {
     
    193193  } while (!done);
    194194
    195   eh->close_window(sv);
    196   eh->flush_screen();
     195  wm->close_window(sv);
     196  wm->flush_screen();
    197197           
    198198  if (state==RESTART_SINGLE)
     
    228228    i->y=y;
    229229    int x1,y1,x2,y2;
    230     i->area(x1,y1,x2,y2,eh);
     230    i->area(x1,y1,x2,y2);
    231231    y=y2+2;
    232232  }
    233233
    234234
    235   jwindow *nw=eh->new_window(0,0,-1,-1,ilist,symbol_str("Networking"));
     235  jwindow *nw=wm->new_window(0,0,-1,-1,ilist,symbol_str("Networking"));
    236236
    237237  done=0;
    238238  do
    239239  {
    240     eh->flush_screen();
    241     do { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
     240    wm->flush_screen();
     241    do { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
    242242    if (ev.type==EV_MESSAGE && ev.message.id==NET_OK && confirm_inputs(nw,state==RESTART_SERVER))
    243243      done=1;
     
    248248
    249249  } while (!done);
    250   eh->close_window(nw);
    251   eh->flush_screen();
     250  wm->close_window(nw);
     251  wm->flush_screen();
    252252
    253253  return ev.message.id==NET_OK;
     
    265265  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
    266266  ns->put_image(screen,x,y);
    267   JCFont *fnt=eh->font();
     267  JCFont *fnt=wm->font();
    268268
    269269  uint8_t *remap=white_light+30*256;
     
    276276    fy=y+ns_h/2-fnt->height();
    277277
    278   fnt->put_string(screen,fx+1,fy+1,message,eh->black());
    279   fnt->put_string(screen,fx,fy,message,eh->bright_color());
     278  fnt->put_string(screen,fx+1,fy+1,message,wm->black());
     279  fnt->put_string(screen,fx,fy,message,wm->bright_color());
    280280
    281281 
     
    288288    button *sb=new button(bx,by,NET_SERVER,ok,NULL);
    289289
    290     input_manager inm(screen,eh,sb);
     290    input_manager inm(screen,sb);
    291291    inm.allow_no_selections();
    292292    inm.clear_current();
     
    296296    do
    297297    {
    298       eh->flush_screen();
    299       do  { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
    300       inm.handle_event(ev,NULL,eh);
     298      wm->flush_screen();
     299      do  { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
     300      inm.handle_event(ev,NULL);
    301301      if ((ev.type==EV_KEY && (ev.key==JK_ESC || ev.key==JK_ENTER)) ||
    302302          ev.type==EV_MESSAGE) done=1;
     
    305305
    306306  screen_backup->put_image(screen,0,0);
    307   eh->flush_screen();
     307  wm->flush_screen();
    308308  delete screen_backup;
    309309}
     
    313313{
    314314  int X1,Y1,X2,Y2;
    315   i->area(X1,Y1,X2,Y2,eh);
     315  i->area(X1,Y1,X2,Y2);
    316316  i->x=(x1+x2)/2-(X2-X1)/2;
    317317
    318318  if (place_below)
    319319  {
    320     place_below->area(X1,Y1,X2,Y2,eh);
     320    place_below->area(X1,Y1,X2,Y2);
    321321    i->y=Y2+2;
    322322  }
     
    330330  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
    331331  ns->put_image(screen,x,y);
    332   JCFont *fnt=eh->font();
     332  JCFont *fnt=wm->font();
    333333  image *ok_image=cash.img(cash.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(),
    334334    *cancel_image=cash.img(cash.reg("art/frame.spe","cancel",SPEC_IMAGE,1))->copy();
     
    356356
    357357
    358     b->arrange_left_right(eh);
     358    b->arrange_left_right();
    359359    center_ifield(b,x,x+ns_w,list);
    360     b->arrange_left_right(eh);
     360    b->arrange_left_right();
    361361    list=b;
    362362
     
    372372    b->add_button(new button(0,0,MAX_3,"3",NULL));
    373373    b->add_button(new button(0,0,MAX_2,"2",NULL));
    374     b->arrange_left_right(eh);
     374    b->arrange_left_right();
    375375    center_ifield(b,x,x+ns_w,list);
    376     b->arrange_left_right(eh);   
     376    b->arrange_left_right();   
    377377    list=b;
    378378
     
    386386    b->add_button(q);
    387387
    388     b->arrange_left_right(eh);
     388    b->arrange_left_right();
    389389    center_ifield(b,x,x+ns_w,list);
    390     b->arrange_left_right(eh);   
     390    b->arrange_left_right();   
    391391    list=b;
    392392
     
    408408
    409409  {
    410     input_manager inm(screen,eh,list);
     410    input_manager inm(screen,list);
    411411    inm.allow_no_selections();
    412412    inm.clear_current();
     
    416416    do
    417417    {
    418       eh->flush_screen();
    419       do { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
    420       inm.handle_event(ev,NULL,eh);
     418      wm->flush_screen();
     419      do { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
     420      inm.handle_event(ev,NULL);
    421421      if (ev.type==EV_MESSAGE)
    422422      {
     
    450450  ns->put_image(screen,x,y);
    451451  char const *nw_s = symbol_str("Networking");
    452   JCFont *fnt=eh->font();
    453 
    454 
    455   eh->font()->put_string(screen,x+ns_w/2-strlen(nw_s)*fnt->width()/2,y+21/2-fnt->height()/2,
    456       nw_s,eh->medium_color());
     452  JCFont *fnt=wm->font();
     453
     454
     455  wm->font()->put_string(screen,x+ns_w/2-strlen(nw_s)*fnt->width()/2,y+21/2-fnt->height()/2,
     456      nw_s,wm->medium_color());
    457457  {
    458458
     
    463463      sb=new button(x+40,y+ns_h-9-fnt->height(),NET_SINGLE,symbol_str("single_play"),sb);
    464464
    465     input_manager inm(screen,eh,sb);
     465    input_manager inm(screen,sb);
    466466
    467467    inm.allow_no_selections();
     
    479479    do
    480480    {
    481       if (eh->event_waiting())
     481      if (wm->event_waiting())
    482482      {
    483         do  { eh->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && eh->event_waiting());
    484         inm.handle_event(ev,NULL,eh);
     483        do  { wm->get_event(ev); } while (ev.type==EV_MOUSE_MOVE && wm->event_waiting());
     484        inm.handle_event(ev,NULL);
    485485        if (ev.type==EV_MESSAGE)
    486486        {
     
    509509        }
    510510
    511       eh->flush_screen();
     511      wm->flush_screen();
    512512      char name[256];
    513513
  • abuse/trunk/src/oldhelp.cpp

    r56 r106  
    5555void make_help_page(int page, image *s)
    5656{
    57   int x=0,y=0,fw=eh->font()->width(),fh=eh->font()->height(),ya;
     57  int x=0,y=0,fw=wm->font()->width(),fh=wm->font()->height(),ya;
    5858  char *h,*ho,imname[30],*inp;
    5959  h=ho=get_page(page);
     
    6464  if (fp->open_failure())
    6565  {
    66     eh->font()->put_string(s,10,10,"Help file missing!");
     66    wm->font()->put_string(s,10,10,"Help file missing!");
    6767    return ;
    6868   
     
    8282        if (*h=='@')
    8383        {         
    84           eh->font()->put_char(s,x,y,*h);
     84          wm->font()->put_char(s,x,y,*h);
    8585          x+=fw;         
    8686          h++;   
     
    122122          if (!sd.find(imname))
    123123          {         
    124             eh->font()->put_string(s,0,yres-10,"Missing image!");
     124            wm->font()->put_string(s,0,yres-10,"Missing image!");
    125125            delete fp;
    126126            jfree(ho);     
     
    160160      else
    161161      {
    162         eh->font()->put_char(s,x,y,*h);
     162        wm->font()->put_char(s,x,y,*h);
    163163        x+=fw;   
    164164        h++;   
     
    198198    screen->scroll(0,0,xres,yres,0,scroll_step);
    199199    h->put_part(screen,0,helpy,0,0,xres,-helpy+scroll_step);
    200     eh->flush_screen();   
     200    wm->flush_screen();   
    201201  }
    202202  delete h;       
  • abuse/trunk/src/profile.cpp

    r88 r106  
    5656
    5757 
    58   prof_win=eh->new_window(prop->getd("profile x",-1),
     58  prof_win=wm->new_window(prop->getd("profile x",-1),
    5959                          prop->getd("profile y",-1),
    6060                          20*console_font->width(),
     
    8181  if (prof_list) jfree(prof_list);
    8282  prof_list=NULL;
    83   if (prof_win) { eh->close_window(prof_win); prof_win=NULL; }
     83  if (prof_win) { wm->close_window(prof_win); prof_win=NULL; }
    8484}
    8585
     
    125125    prof_win->screen->bar(spliter-1-(int)(prof_list[i].total_time*time_scaler),dy+1,
    126126                          spliter-1,
    127                           dy+console_font->height()-1,eh->bright_color());
     127                          dy+console_font->height()-1,wm->bright_color());
    128128    dy+=console_font->height()+1;
    129129  }
  • abuse/trunk/src/scene.cpp

    r56 r106  
    650650            if (!text_loaded) done=1;
    651651           
    652           eh->flush_screen();     
    653           while (eh->event_waiting())
     652          wm->flush_screen();     
     653          while (wm->event_waiting())
    654654          {     
    655655            event ev;       
    656             eh->get_event(ev);
     656            wm->get_event(ev);
    657657            if (ev.type==EV_KEY)
    658658            {
  • abuse/trunk/src/statbar.cpp

    r56 r106  
    246246    {
    247247      if ((current_level->tick_counter()&4)==0)
    248         eh->set_mouse_shape(cash.img(c_mouse1)->copy(),4,4);
    249       else eh->set_mouse_shape(cash.img(c_mouse2)->copy(),4,4);   
     248        wm->set_mouse_shape(cash.img(c_mouse1)->copy(),4,4);
     249      else wm->set_mouse_shape(cash.img(c_mouse2)->copy(),4,4);   
    250250      changed_cursor=1;
    251251    } else if (changed_cursor)
    252252    {
    253253      if (!(dev&EDIT_MODE))
    254         eh->set_mouse_shape(cash.img(c_target)->copy(),8,8);
     254        wm->set_mouse_shape(cash.img(c_target)->copy(),8,8);
    255255      else
    256         eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     256        wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
    257257      changed_cursor=0;     
    258258    }
  • abuse/trunk/src/unixnfc.cpp

    r61 r106  
    487487
    488488
    489       jwindow *j=eh->new_window(0,yres/2,-1,-1,new info_field(WINDOW_FRAME_LEFT,
     489      jwindow *j=wm->new_window(0,yres/2,-1,-1,new info_field(WINDOW_FRAME_LEFT,
    490490                                                                   WINDOW_FRAME_TOP,
    491491                                                                   0,"Clients are re-syncing, please wait...",NULL));
    492       eh->flush_screen();
     492      wm->flush_screen();
    493493      if (!reload_start()) return ;
    494494
     
    498498        next_process();
    499499      } while (!reload_end());
    500       eh->close_window(j);
     500      wm->close_window(j);
    501501
    502502    }     
     
    564564        if (total_retry==10)    // 2 seconds and nothing
    565565        {
    566           abort=eh->new_window(0,yres/2,-1,eh->font()->height()*4,
     566          abort=wm->new_window(0,yres/2,-1,wm->font()->height()*4,
    567567                               new info_field(WINDOW_FRAME_LEFT,
    568568                                              WINDOW_FRAME_TOP,
    569569                                              0,"Waiting for data...",
    570570                                              new button(WINDOW_FRAME_LEFT,
    571                                                          WINDOW_FRAME_TOP+eh->font()->height()+5,ID_NET_DISCONNECT,
     571                                                         WINDOW_FRAME_TOP+wm->font()->height()+5,ID_NET_DISCONNECT,
    572572                                                         "Disconnect slackers",NULL)),"Error");   
    573           eh->flush_screen();
     573          wm->flush_screen();
    574574        }
    575575      }
    576576      if (abort)
    577577      {
    578         if (eh->event_waiting())
     578        if (wm->event_waiting())
    579579        {
    580580          event ev;
    581581          do
    582582          {
    583             eh->get_event(ev);
     583            wm->get_event(ev);
    584584            if (ev.type==EV_MESSAGE && ev.message.id==ID_NET_DISCONNECT)
    585585            kill_slackers();
     
    590590              input.add_front(e);
    591591            }
    592           } while (eh->event_waiting());
    593 
    594           eh->flush_screen();
     592          } while (wm->event_waiting());
     593
     594          wm->flush_screen();
    595595        }
    596596      }
     
    599599    if (abort)
    600600    {
    601       eh->close_window(abort);
     601      wm->close_window(abort);
    602602      while (input.first())               // push all the key events
    603603      {
    604604        event *ev=(event *)input.first();
    605605        input.unlink((linked_node *)ev);
    606         eh->push_event(ev);
     606        wm->push_event(ev);
    607607      }
    608608    }
Note: See TracChangeset for help on using the changeset viewer.