Ignore:
Timestamp:
Mar 15, 2008, 12:55:44 AM (11 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.