Changeset 18 for branches

Show
Ignore:
Timestamp:
02/29/08 13:48:56 (4 years ago)
Author:
mirko
Message:

killed tabs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/pdfcube-0.0.3/src/pdfcube.cc

    r17 r18  
    1 // -*- mode: C++ -*- 
     1// ex: set ts=2: -*- mode: C++; mode: flyspell-prog; mode: flymake; c-basic-offset: 2; indent-tabs-mode: nil -*-  
    22// 
    33// PDF-Cube source file - pdfcube.cc 
     
    1818// along with this program; if not, write to the Free Software 
    1919// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
     20// 
     21// Notes: please indent using 2 spaces. 
    2022 
    2123#include <iostream> 
     
    5759 
    5860enum animation { ANIM_NONE, 
    59                 CUBE_NEXT, CUBE_PREV, 
    60                 ZOOM0, ZOOM1, ZOOM2, ZOOM3, ZOOM4, ZOOMC, 
    61                 SWITCH_FW, SWITCH_BW 
     61                CUBE_NEXT, CUBE_PREV, 
     62                ZOOM0, ZOOM1, ZOOM2, ZOOM3, ZOOM4, ZOOMC, 
     63                SWITCH_FW, SWITCH_BW 
    6264}; 
    6365 
     
    114116    pixmap = 
    115117      gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, tex_width, 
    116                      tex_height); 
     118                     tex_height); 
    117119    steps = new GLfloat[N_FRAMES]; 
    118120    xsteps = new double[N_FRAMES]; 
     
    177179    for (ii = 0; ii < total_pages; ++ii) { 
    178180      if (page_transition[ii]) 
    179         section--; 
     181        ection--; 
    180182      if (section == 0) 
    181         break; 
     183        break; 
    182184    } 
    183185#ifndef NDEBUG 
     
    239241      glHint(GL_FOG_HINT, GL_DONT_CARE); 
    240242      glClearColor(fogColor[0], fogColor[1],  
    241                    fogColor[2], fogColor[3]); 
     243                   fogColor[2], fogColor[3]); 
    242244    } 
    243245 
     
    248250    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); 
    249251    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, 
    250                     GL_CLAMP_TO_EDGE); 
     252                    GL_CLAMP_TO_EDGE); 
    251253    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, 
    252                     GL_CLAMP_TO_EDGE); 
     254                    GL_CLAMP_TO_EDGE); 
    253255 
    254256    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, 
    255                     GL_LINEAR_MIPMAP_LINEAR); 
     257                    GL_LINEAR_MIPMAP_LINEAR); 
    256258    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, 
    257                     GL_LINEAR); 
     259                    GL_LINEAR); 
    258260 
    259261    update_textures(widget); 
     
    280282  
    281283    // up is in positive Y direction  
    282     gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 0.0, 1.0, 0.0);       
     284    gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 0.0, 1.0, 0.0);         
    283285 
    284286    matrix_setup(); 
     
    294296 
    295297#ifndef NDEBUG 
    296         cerr << "No animation... stopping right now." << 
    297           endl; 
    298 #endif 
    299         frame = 0; 
    300         stop_animation(widget); 
    301         break; 
     298        cerr << "No animation... stopping right now." << 
     299          endl; 
     300#endif 
     301        frame = 0; 
     302        stop_animation(widget); 
     303        break; 
    302304      case CUBE_NEXT: 
    303305#ifndef NDEBUG 
    304         cerr << "cube " << frame << endl; 
    305 #endif 
    306         if (frame == N_FRAMES) { 
    307           frame = 0; 
    308           stop_animation(widget); 
    309           quick_reset(widget); 
    310         } else { 
    311           glClear(GL_COLOR_BUFFER_BIT | 
    312                   GL_DEPTH_BUFFER_BIT); 
    313           glMatrixMode(GL_MODELVIEW); 
    314           glLoadIdentity(); 
    315           lookposz -= zsteps[frame] * 4; 
    316           lookposy = 6 * xsteps[frame]; 
    317           gluLookAt(lookposx, lookposy, lookposz, 
    318                     atx, aty, atz, 0, 1, 0); 
    319           angle -= steps[frame]; 
    320           glRotatef(angle, 0.0, 1.0, 0.0); 
    321           drawCube(); 
    322           frame++; 
    323         } 
    324         break; 
     306        cerr << "cube " << frame << endl; 
     307#endif 
     308        if (frame == N_FRAMES) { 
     309          frame = 0; 
     310          stop_animation(widget); 
     311          quick_reset(widget); 
     312        } else { 
     313          glClear(GL_COLOR_BUFFER_BIT | 
     314                  GL_DEPTH_BUFFER_BIT); 
     315          glMatrixMode(GL_MODELVIEW); 
     316          glLoadIdentity(); 
     317          lookposz -= zsteps[frame] * 4; 
     318          lookposy = 6 * xsteps[frame]; 
     319          gluLookAt(lookposx, lookposy, lookposz, 
     320                    atx, aty, atz, 0, 1, 0); 
     321          angle -= steps[frame]; 
     322          glRotatef(angle, 0.0, 1.0, 0.0); 
     323          drawCube(); 
     324          frame++; 
     325        } 
     326        break; 
    325327      case CUBE_PREV: 
    326328#ifndef NDEBUG 
    327         cerr << "cube " << frame << endl; 
    328 #endif 
    329         if (frame == N_FRAMES) { 
    330           frame = 0; 
    331           stop_animation(widget); 
    332           quick_reset(widget); 
    333         } else { 
    334           glClear(GL_COLOR_BUFFER_BIT | 
    335                   GL_DEPTH_BUFFER_BIT); 
    336           glMatrixMode(GL_MODELVIEW); 
    337           glLoadIdentity(); 
    338           lookposz -= zsteps[frame] * 4; 
    339           lookposy = 6 * xsteps[frame]; 
    340           gluLookAt(lookposx, lookposy, lookposz, 
    341                     atx, aty, atz, 0, 1, 0); 
    342           angle -= steps[frame]; 
    343           glRotatef(angle, 0.0, -1.0, 0.0); 
    344           drawCube(); 
    345           frame++; 
    346         } 
    347         break; 
     329        cerr << "cube " << frame << endl; 
     330#endif 
     331        if (frame == N_FRAMES) { 
     332          frame = 0; 
     333          stop_animation(widget); 
     334          quick_reset(widget); 
     335        } else { 
     336          glClear(GL_COLOR_BUFFER_BIT | 
     337                  GL_DEPTH_BUFFER_BIT); 
     338          glMatrixMode(GL_MODELVIEW); 
     339          glLoadIdentity(); 
     340          lookposz -= zsteps[frame] * 4; 
     341          lookposy = 6 * xsteps[frame]; 
     342          gluLookAt(lookposx, lookposy, lookposz, 
     343                    atx, aty, atz, 0, 1, 0); 
     344          angle -= steps[frame]; 
     345          glRotatef(angle, 0.0, -1.0, 0.0); 
     346          drawCube(); 
     347          frame++; 
     348        } 
     349        break; 
    348350      case ZOOM0: 
    349351 
    350352#ifndef NDEBUG 
    351         cerr << "zoom0 " << frame << endl; 
    352 #endif 
    353         if (frame == N_FRAMES) { 
    354           frame = 0; 
    355           stop_animation(widget); 
    356           quick_reset(widget); 
    357         } else { 
    358           glClear(GL_COLOR_BUFFER_BIT | 
    359                   GL_DEPTH_BUFFER_BIT); 
    360           switch (previous_animation) { 
    361           case ZOOM1: 
    362             persp = 
    363               perspsteps[(N_FRAMES - 1) - 
    364                         frame]; 
    365             atx = lookposx = 
    366               -(1.3 * 
    367                 zoomsteps[(N_FRAMES - 1) - 
    368                           frame]); 
    369             aty = lookposy = 
    370               zoomsteps[(N_FRAMES - 1) - 
    371                         frame] - 
    372               yoffset / N_FRAMES * 
    373               ((N_FRAMES - 1) - frame); 
    374             break; 
    375           case ZOOM2: 
    376             persp = 
    377               perspsteps[(N_FRAMES - 1) - 
    378                         frame]; 
    379             atx = lookposx = 
    380               1.3 * 
    381               zoomsteps[(N_FRAMES - 1) - 
    382                         frame]; 
    383             aty = lookposy = 
    384               zoomsteps[(N_FRAMES - 1) - 
    385                         frame] - 
    386               yoffset / N_FRAMES * 
    387               ((N_FRAMES - 1) - frame); 
    388             break; 
    389           case ZOOM3: 
    390             persp = 
    391               perspsteps[(N_FRAMES - 1) - 
    392                         frame]; 
    393             atx = lookposx = 
    394               -1.3 * 
    395               zoomsteps[(N_FRAMES - 1) - 
    396                         frame]; 
    397             aty = lookposy = 
    398               -zoomsteps[(N_FRAMES - 1) - 
    399                         frame] - 
    400               yoffset / N_FRAMES * 
    401               ((N_FRAMES - 1) - frame); 
    402             break; 
    403           case ZOOM4: 
    404             persp = 
    405               perspsteps[(N_FRAMES - 1) - 
    406                         frame]; 
    407             atx = lookposx = 
    408               1.3 * 
    409               zoomsteps[(N_FRAMES - 1) - 
    410                         frame]; 
    411             aty = lookposy = 
    412               -zoomsteps[(N_FRAMES - 1) - 
    413                         frame] - 
    414               yoffset / N_FRAMES * 
    415               ((N_FRAMES - 1) - frame); 
    416             break; 
    417           case ZOOMC: 
    418             persp = 
    419               perspstepsc[(N_FRAMES - 1) - 
    420                           frame]; 
    421             aty = lookposy = 
    422               -zoomsteps[(N_FRAMES - 1) - 
    423                         frame] * 0.38; 
    424             break; 
    425           default: 
    426  
    427 #ifndef NDEBUG 
    428             cerr << "Should not reach" << 
    429               endl; 
    430 #endif 
    431             break; 
    432           } 
    433           glMatrixMode(GL_PROJECTION); 
    434           glLoadIdentity(); 
    435           gluPerspective(persp, 1.0, 0.5, 10.0); 
    436           glMatrixMode(GL_MODELVIEW); 
    437           glLoadIdentity(); 
    438           gluLookAt(lookposx, lookposy, lookposz, 
    439                     atx, aty, atz, 0, 1, 0); 
    440           glRotatef(angle, 0.0, 1.0, 0.0); 
    441           drawCube(); 
    442           frame++; 
    443         } 
    444         break; 
     353        cerr << "zoom0 " << frame << endl; 
     354#endif 
     355        if (frame == N_FRAMES) { 
     356          frame = 0; 
     357          stop_animation(widget); 
     358          quick_reset(widget); 
     359        } else { 
     360          glClear(GL_COLOR_BUFFER_BIT | 
     361                  GL_DEPTH_BUFFER_BIT); 
     362          switch (previous_animation) { 
     363          case ZOOM1: 
     364            persp = 
     365              perspsteps[(N_FRAMES - 1) - 
     366                        frame]; 
     367            atx = lookposx = 
     368              -(1.3 * 
     369                zoomsteps[(N_FRAMES - 1) - 
     370                          frame]); 
     371            aty = lookposy = 
     372              zoomsteps[(N_FRAMES - 1) - 
     373                        frame] - 
     374              yoffset / N_FRAMES * 
     375              ((N_FRAMES - 1) - frame); 
     376            break; 
     377          case ZOOM2: 
     378            persp = 
     379              perspsteps[(N_FRAMES - 1) - 
     380                        frame]; 
     381            atx = lookposx = 
     382              1.3 * 
     383              zoomsteps[(N_FRAMES - 1) - 
     384                        frame]; 
     385            aty = lookposy = 
     386              zoomsteps[(N_FRAMES - 1) - 
     387                        frame] - 
     388              yoffset / N_FRAMES * 
     389              ((N_FRAMES - 1) - frame); 
     390            break; 
     391          case ZOOM3: 
     392            persp = 
     393              perspsteps[(N_FRAMES - 1) - 
     394                        frame]; 
     395            atx = lookposx = 
     396              -1.3 * 
     397              zoomsteps[(N_FRAMES - 1) - 
     398                        frame]; 
     399            aty = lookposy = 
     400              -zoomsteps[(N_FRAMES - 1) - 
     401                        frame] - 
     402              yoffset / N_FRAMES * 
     403              ((N_FRAMES - 1) - frame); 
     404            break; 
     405          case ZOOM4: 
     406            persp = 
     407              perspsteps[(N_FRAMES - 1) - 
     408                        frame]; 
     409            atx = lookposx = 
     410              1.3 * 
     411              zoomsteps[(N_FRAMES - 1) - 
     412                        frame]; 
     413            aty = lookposy = 
     414              -zoomsteps[(N_FRAMES - 1) - 
     415                        frame] - 
     416              yoffset / N_FRAMES * 
     417              ((N_FRAMES - 1) - frame); 
     418            break; 
     419          case ZOOMC: 
     420            persp = 
     421              perspstepsc[(N_FRAMES - 1) - 
     422                          frame]; 
     423            aty = lookposy = 
     424              -zoomsteps[(N_FRAMES - 1) - 
     425                        frame] * 0.38; 
     426            break; 
     427          default: 
     428 
     429#ifndef NDEBUG 
     430            cerr << "Should not reach" << 
     431              endl; 
     432#endif 
     433            break; 
     434          } 
     435          glMatrixMode(GL_PROJECTION); 
     436          glLoadIdentity(); 
     437          gluPerspective(persp, 1.0, 0.5, 10.0); 
     438          glMatrixMode(GL_MODELVIEW); 
     439          glLoadIdentity(); 
     440          gluLookAt(lookposx, lookposy, lookposz, 
     441                    atx, aty, atz, 0, 1, 0); 
     442          glRotatef(angle, 0.0, 1.0, 0.0); 
     443          drawCube(); 
     444          frame++; 
     445        } 
     446        break; 
    445447      case ZOOM1: 
    446448#ifndef NDEBUG 
    447         cerr << "zoom1 " << frame << endl; 
    448 #endif 
    449         if (frame == N_FRAMES) { 
    450           frame = 0; 
    451           stop_animation(widget); 
    452         } else { 
    453           glClear(GL_COLOR_BUFFER_BIT | 
    454                   GL_DEPTH_BUFFER_BIT); 
    455           glMatrixMode(GL_PROJECTION); 
    456           glLoadIdentity(); 
    457           persp = perspsteps[frame]; 
    458           gluPerspective(persp, 1.0, 0.5, 10.0); 
    459           glMatrixMode(GL_MODELVIEW); 
    460           glLoadIdentity(); 
    461           atx = lookposx = 
    462             -1.3 * zoomsteps[frame]; 
    463           aty = lookposy = 
    464             zoomsteps[frame] - 
    465             yoffset / N_FRAMES * (frame); 
    466           gluLookAt(lookposx, lookposy, lookposz, 
    467                     atx, aty, atz, 0, 1, 0); 
    468           glRotatef(angle, 0.0, 1.0, 0.0); 
    469           drawCube(); 
    470           frame++; 
    471         } 
    472         break; 
     449        cerr << "zoom1 " << frame << endl; 
     450#endif 
     451        if (frame == N_FRAMES) { 
     452          frame = 0; 
     453          stop_animation(widget); 
     454        } else { 
     455          glClear(GL_COLOR_BUFFER_BIT | 
     456                  GL_DEPTH_BUFFER_BIT); 
     457          glMatrixMode(GL_PROJECTION); 
     458          glLoadIdentity(); 
     459          persp = perspsteps[frame]; 
     460          gluPerspective(persp, 1.0, 0.5, 10.0); 
     461          glMatrixMode(GL_MODELVIEW); 
     462          glLoadIdentity(); 
     463          atx = lookposx = 
     464            -1.3 * zoomsteps[frame]; 
     465          aty = lookposy = 
     466            zoomsteps[frame] - 
     467            yoffset / N_FRAMES * (frame); 
     468          gluLookAt(lookposx, lookposy, lookposz, 
     469                    atx, aty, atz, 0, 1, 0); 
     470          glRotatef(angle, 0.0, 1.0, 0.0); 
     471          drawCube(); 
     472          frame++; 
     473        } 
     474        break; 
    473475      case ZOOM2: 
    474476#ifndef NDEBUG 
    475         cerr << "zoom1 " << frame << endl; 
    476 #endif 
    477         if (frame == N_FRAMES) { 
    478           frame = 0; 
    479           stop_animation(widget); 
    480         } else { 
    481           glClear(GL_COLOR_BUFFER_BIT | 
    482                   GL_DEPTH_BUFFER_BIT); 
    483           glMatrixMode(GL_PROJECTION); 
    484           glLoadIdentity(); 
    485           persp = perspsteps[frame]; 
    486           gluPerspective(persp, 1.0, 0.5, 10.0); 
    487           glMatrixMode(GL_MODELVIEW); 
    488           glLoadIdentity(); 
    489           atx = lookposx = 1.3 * zoomsteps[frame]; 
    490           aty = lookposy = 
    491             zoomsteps[frame] - 
    492             yoffset / N_FRAMES * (frame); 
    493           gluLookAt(lookposx, lookposy, lookposz, 
    494                     atx, aty, atz, 0, 1, 0); 
    495           glRotatef(angle, 0.0, 1.0, 0.0); 
    496           drawCube(); 
    497           frame++; 
    498         } 
    499         break; 
     477        cerr << "zoom1 " << frame << endl; 
     478#endif 
     479        if (frame == N_FRAMES) { 
     480          frame = 0; 
     481          stop_animation(widget); 
     482        } else { 
     483          glClear(GL_COLOR_BUFFER_BIT | 
     484                  GL_DEPTH_BUFFER_BIT); 
     485          glMatrixMode(GL_PROJECTION); 
     486          glLoadIdentity(); 
     487          persp = perspsteps[frame]; 
     488          gluPerspective(persp, 1.0, 0.5, 10.0); 
     489          glMatrixMode(GL_MODELVIEW); 
     490          glLoadIdentity(); 
     491          atx = lookposx = 1.3 * zoomsteps[frame]; 
     492          aty = lookposy = 
     493            zoomsteps[frame] - 
     494            yoffset / N_FRAMES * (frame); 
     495          gluLookAt(lookposx, lookposy, lookposz, 
     496                    atx, aty, atz, 0, 1, 0); 
     497          glRotatef(angle, 0.0, 1.0, 0.0); 
     498          drawCube(); 
     499          frame++; 
     500        } 
     501        break; 
    500502      case ZOOM3: 
    501503#ifndef NDEBUG 
    502         cerr << "zoom1 " << frame << endl; 
    503 #endif 
    504         if (frame == N_FRAMES) { 
    505           frame = 0; 
    506           stop_animation(widget); 
    507         } else { 
    508           glClear(GL_COLOR_BUFFER_BIT | 
    509                   GL_DEPTH_BUFFER_BIT); 
    510           glMatrixMode(GL_PROJECTION); 
    511           glLoadIdentity(); 
    512           persp = perspsteps[frame]; 
    513           gluPerspective(persp, 1.0, 0.5, 10.0); 
    514           glMatrixMode(GL_MODELVIEW); 
    515           glLoadIdentity(); 
    516           atx = lookposx = 
    517             -1.3 * zoomsteps[frame]; 
    518           aty = lookposy = 
    519             -zoomsteps[frame] - 
    520             yoffset / N_FRAMES * (frame); 
    521           gluLookAt(lookposx, lookposy, lookposz, 
    522                     atx, aty, atz, 0, 1, 0); 
    523           glRotatef(angle, 0.0, 1.0, 0.0); 
    524           drawCube(); 
    525           frame++; 
    526         } 
    527         break; 
     504        cerr << "zoom1 " << frame << endl; 
     505#endif 
     506        if (frame == N_FRAMES) { 
     507          frame = 0; 
     508          stop_animation(widget); 
     509        } else { 
     510          glClear(GL_COLOR_BUFFER_BIT | 
     511                  GL_DEPTH_BUFFER_BIT); 
     512          glMatrixMode(GL_PROJECTION); 
     513          glLoadIdentity(); 
     514          persp = perspsteps[frame]; 
     515          gluPerspective(persp, 1.0, 0.5, 10.0); 
     516          glMatrixMode(GL_MODELVIEW); 
     517          glLoadIdentity(); 
     518          atx = lookposx = 
     519            -1.3 * zoomsteps[frame]; 
     520          aty = lookposy = 
     521            -zoomsteps[frame] - 
     522            yoffset / N_FRAMES * (frame); 
     523          gluLookAt(lookposx, lookposy, lookposz, 
     524                    atx, aty, atz, 0, 1, 0); 
     525          glRotatef(angle, 0.0, 1.0, 0.0); 
     526          drawCube(); 
     527          frame++; 
     528        } 
     529        break; 
    528530      case ZOOM4: 
    529531#ifndef NDEBUG 
    530         cerr << "zoom1 " << frame << endl; 
    531 #endif 
    532         if (frame == N_FRAMES) { 
    533           frame = 0; 
    534           stop_animation(widget); 
    535         } else { 
    536           glClear(GL_COLOR_BUFFER_BIT | 
    537                   GL_DEPTH_BUFFER_BIT); 
    538           glMatrixMode(GL_PROJECTION); 
    539           glLoadIdentity(); 
    540           persp = perspsteps[frame]; 
    541           gluPerspective(persp, 1.0, 0.5, 10.0); 
    542           glMatrixMode(GL_MODELVIEW); 
    543           glLoadIdentity(); 
    544           atx = lookposx = 1.3 * zoomsteps[frame]; 
    545           aty = lookposy = 
    546             -zoomsteps[frame] - 
    547             yoffset / N_FRAMES * (frame); 
    548           gluLookAt(lookposx, lookposy, lookposz, 
    549                     atx, aty, atz, 0, 1, 0); 
    550           glRotatef(angle, 0.0, 1.0, 0.0); 
    551           drawCube(); 
    552           frame++; 
    553         } 
    554         break; 
     532        cerr << "zoom1 " << frame << endl; 
     533#endif 
     534        if (frame == N_FRAMES) { 
     535          frame = 0; 
     536          stop_animation(widget); 
     537        } else { 
     538          glClear(GL_COLOR_BUFFER_BIT | 
     539                  GL_DEPTH_BUFFER_BIT); 
     540          glMatrixMode(GL_PROJECTION); 
     541          glLoadIdentity(); 
     542          persp = perspsteps[frame]; 
     543          gluPerspective(persp, 1.0, 0.5, 10.0); 
     544          glMatrixMode(GL_MODELVIEW); 
     545          glLoadIdentity(); 
     546          atx = lookposx = 1.3 * zoomsteps[frame]; 
     547          aty = lookposy = 
     548            -zoomsteps[frame] - 
     549            yoffset / N_FRAMES * (frame); 
     550          gluLookAt(lookposx, lookposy, lookposz, 
     551                    atx, aty, atz, 0, 1, 0); 
     552          glRotatef(angle, 0.0, 1.0, 0.0); 
     553          drawCube(); 
     554          frame++; 
     555        } 
     556        break; 
    555557      case ZOOMC: 
    556558#ifndef NDEBUG 
    557         cerr << "zoomc " << frame << endl; 
    558 #endif 
    559         if (frame == N_FRAMES) { 
    560           frame = 0; 
    561           stop_animation(widget); 
    562         } else { 
    563           glClear(GL_COLOR_BUFFER_BIT | 
    564                   GL_DEPTH_BUFFER_BIT); 
    565           persp = perspstepsc[frame]; 
    566           aty = lookposy = 
    567             -zoomsteps[frame] * 0.38; 
    568           glMatrixMode(GL_PROJECTION); 
    569           glLoadIdentity(); 
    570           gluPerspective(persp, 1.0, 0.5, 10.0); 
    571           glMatrixMode(GL_MODELVIEW); 
    572           glLoadIdentity(); 
    573           gluLookAt(lookposx, lookposy, lookposz, 
    574                     atx, aty, atz, 0, 1, 0); 
    575           glRotatef(angle, 0.0, 1.0, 0.0); 
    576           drawCube(); 
    577           frame++; 
    578         } 
    579         break; 
     559        cerr << "zoomc " << frame << endl; 
     560#endif 
     561        if (frame == N_FRAMES) { 
     562          frame = 0; 
     563          stop_animation(widget); 
     564        } else { 
     565          glClear(GL_COLOR_BUFFER_BIT | 
     566                  GL_DEPTH_BUFFER_BIT); 
     567          persp = perspstepsc[frame]; 
     568          aty = lookposy = 
     569            -zoomsteps[frame] * 0.38; 
     570          glMatrixMode(GL_PROJECTION); 
     571          glLoadIdentity(); 
     572          gluPerspective(persp, 1.0, 0.5, 10.0); 
     573          glMatrixMode(GL_MODELVIEW); 
     574          glLoadIdentity(); 
     575          gluLookAt(lookposx, lookposy, lookposz, 
     576                    atx, aty, atz, 0, 1, 0); 
     577          glRotatef(angle, 0.0, 1.0, 0.0); 
     578          drawCube(); 
     579          frame++; 
     580        } 
     581        break; 
    580582      case SWITCH_FW: 
    581583#ifndef NDEBUG 
    582         cerr << "fw " << frame << endl; 
    583 #endif 
    584         if (frame == 1) { 
    585           frame = 0; 
    586           stop_animation(widget); 
    587         } else { 
    588           glClear(GL_COLOR_BUFFER_BIT | 
    589                   GL_DEPTH_BUFFER_BIT); 
    590           glMatrixMode(GL_MODELVIEW); 
    591           glLoadIdentity(); 
    592           gluLookAt(lookposx, lookposy, lookposz, 
    593                     atx, aty, atz, 0, 1, 0); 
    594           angle -= 90; 
    595           glRotatef(angle, 0.0, 1.0, 0.0); 
    596           drawCube(); 
    597           frame++; 
    598         } 
    599         break; 
     584        cerr << "fw " << frame << endl; 
     585#endif 
     586        if (frame == 1) { 
     587          frame = 0; 
     588          stop_animation(widget); 
     589        } else { 
     590          glClear(GL_COLOR_BUFFER_BIT | 
     591                  GL_DEPTH_BUFFER_BIT); 
     592          glMatrixMode(GL_MODELVIEW); 
     593          glLoadIdentity(); 
     594          gluLookAt(lookposx, lookposy, lookposz, 
     595                    atx, aty, atz, 0, 1, 0); 
     596          angle -= 90; 
     597          glRotatef(angle, 0.0, 1.0, 0.0); 
     598          drawCube(); 
     599          frame++; 
     600        } 
     601        break; 
    600602      case SWITCH_BW: 
    601603#ifndef NDEBUG 
    602         cerr << "bw " << frame << endl; 
    603 #endif 
    604         if (frame == 1) { 
    605           frame = 0; 
    606           stop_animation(widget); 
    607         } else { 
    608           glClear(GL_COLOR_BUFFER_BIT | 
    609                   GL_DEPTH_BUFFER_BIT); 
    610           glMatrixMode(GL_MODELVIEW); 
    611           glLoadIdentity(); 
    612           gluLookAt(lookposx, lookposy, lookposz, 
    613                     atx, aty, atz, 0, 1, 0); 
    614           angle += 90; 
    615           glRotatef(angle, 0.0, 1.0, 0.0); 
    616           drawCube(); 
    617           frame++; 
    618         } 
    619         break; 
     604        cerr << "bw " << frame << endl; 
     605#endif 
     606        if (frame == 1) { 
     607          frame = 0; 
     608          stop_animation(widget); 
     609        } else { 
     610          glClear(GL_COLOR_BUFFER_BIT | 
     611                  GL_DEPTH_BUFFER_BIT); 
     612          glMatrixMode(GL_MODELVIEW); 
     613          glLoadIdentity(); 
     614          gluLookAt(lookposx, lookposy, lookposz, 
     615                    atx, aty, atz, 0, 1, 0); 
     616          angle += 90; 
     617          glRotatef(angle, 0.0, 1.0, 0.0); 
     618          drawCube(); 
     619          frame++; 
     620        } 
     621        break; 
    620622      } 
    621623    } else { 
     
    623625      case ANIM_NONE: 
    624626#ifndef NDEBUG 
    625         cerr << "Redrawing" << endl; 
    626 #endif 
    627         break; 
     627        cerr << "Redrawing" << endl; 
     628#endif 
     629        break; 
    628630      case CUBE_NEXT: 
    629631#ifndef NDEBUG 
    630         cerr << "cube stop" << endl; 
    631 #endif 
    632         forward(widget); 
    633         current_face = next_face(); 
    634         //          quick_reset(widget); 
    635         break; 
     632        cerr << "cube stop" << endl; 
     633#endif 
     634        forward(widget); 
     635        current_face = next_face(); 
     636        //          quick_reset(widget); 
     637        break; 
    636638      case CUBE_PREV: 
    637639#ifndef NDEBUG 
    638         cerr << "cube stop" << endl; 
    639 #endif 
    640         backward(widget); 
    641         current_face = prev_face(); 
    642         //          quick_reset(widget); 
    643         break; 
     640        cerr << "cube stop" << endl; 
     641#endif 
     642        backward(widget); 
     643        current_face = prev_face(); 
     644        //          quick_reset(widget); 
     645        break; 
    644646      case SWITCH_FW: 
    645647#ifndef NDEBUG 
    646         cerr << "fw stop" << endl; 
    647 #endif 
    648         forward(widget); 
    649         current_face = next_face(); 
    650         break; 
     648        cerr << "fw stop" << endl; 
     649#endif 
     650        forward(widget); 
     651        current_face = next_face(); 
     652        break; 
    651653      case SWITCH_BW: 
    652654#ifndef NDEBUG 
    653         cerr << "bw stop" << endl; 
    654 #endif 
    655         backward(widget); 
    656         current_face = prev_face(); 
    657         break; 
     655        cerr << "bw stop" << endl; 
     656#endif 
     657        backward(widget); 
     658        current_face = prev_face(); 
     659        break; 
    658660      case ZOOM0: 
    659661      case ZOOM1: 
     
    664666      default: 
    665667#ifndef NDEBUG 
    666         cerr << "default stop" << endl; 
    667 #endif 
    668         break; 
     668        cerr << "default stop" << endl; 
     669#endif 
     670        break; 
    669671 
    670672      } 
     
    678680      glLoadIdentity(); 
    679681      gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 
    680                 0, 1, 0); 
     682                0, 1, 0); 
    681683      glRotatef(angle, 0.0, 1.0, 0.0); 
    682684      drawCube(); 
     
    684686      glRasterPos3f(0, -1.4, 0); 
    685687      GLuint rcube[] = { 
    686         0, 0, 0, 127 
     688        0, 0, 0, 127 
    687689      }; 
    688690      glDrawPixels(1, 1, GL_RGBA, GL_UNSIGNED_BYTE, rcube); 
     
    740742      14,   10,   8,    6,    4,    3,    2.5,   2.0, 0.0  };*/ 
    741743 
    742     float step_factor = 0.2 * N_FRAMES; //this is little buggy 
     744    float step_factor = 0.2 * N_FRAMES;        //this is little buggy 
    743745    float step = (step_factor) / double (N_FRAMES / 2); 
    744746    int i = 0; 
     
    746748      steps[i] = i * step; 
    747749      if (steps[i] > step_factor) 
    748         steps[i] = step_factor; 
     750        steps[i] = step_factor; 
    749751    } 
    750752    for (i = N_FRAMES / 2; i < N_FRAMES; i++) { 
    751753      steps[i] = step_factor - (i - N_FRAMES / 2) * step; 
    752754      if (steps[i] < 0) 
    753         steps[i] = 0; 
     755        steps[i] = 0; 
    754756    } 
    755757    steps[N_FRAMES - 1] = 0; 
     
    771773      xsteps[i] = i * xstep; 
    772774      if (xsteps[i] > xstep_ratio) 
    773         xsteps[i] = xstep_ratio; 
     775        xsteps[i] = xstep_ratio; 
    774776    } 
    775777    for (i = N_FRAMES / 2; i < N_FRAMES; i++) { 
    776778      xsteps[i] = xstep_ratio - (i - N_FRAMES / 2) * xstep; 
    777779      if (xsteps[i] < 0.01) 
    778         xsteps[i] = 0; 
     780        xsteps[i] = 0; 
    779781    } 
    780782    xsteps[N_FRAMES - 1] = 0; 
     
    932934 
    933935    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
    934                   textures[texmap[forward ? 2 : 1]]); 
     936                  textures[texmap[forward ? 2 : 1]]); 
    935937    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 
    936                 0, 
    937                 GL_RGBA, 
    938                 tex_width, 
    939                 tex_height, 
    940                 0, 
    941                 GL_RGBA, 
    942                 GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
     938                0, 
     939                GL_RGBA, 
     940                tex_width, 
     941                tex_height, 
     942                0, 
     943                GL_RGBA, 
     944                GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
    943945 
    944946    gdk_window_invalidate_rect(widget->window, &widget->allocation, 
    945                                FALSE); 
     947                               FALSE); 
    946948 
    947949  } 
     
    955957    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textures[texmap[0]]); 
    956958    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 
    957                 0, 
    958                 GL_RGBA, 
    959                 tex_width, 
    960                 tex_height, 
    961                 0, 
    962                 GL_RGBA, 
    963                 GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
     959                0, 
     960                GL_RGBA, 
     961                tex_width, 
     962                tex_height, 
     963                0, 
     964                GL_RGBA, 
     965                GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
    964966 
    965967    render_page(pixmap, prev_page(), tex_width, tex_height); 
    966968    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textures[texmap[1]]); 
    967969    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 
    968                 0, 
    969                 GL_RGBA, 
    970                 tex_width, 
    971                 tex_height, 
    972                 0, 
    973                 GL_RGBA, 
    974                 GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
     970                0, 
     971                GL_RGBA, 
     972                tex_width, 
     973                tex_height, 
     974                0, 
     975                GL_RGBA, 
     976                GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
    975977 
    976978    render_page(pixmap, next_page(), tex_width, tex_height); 
    977979    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textures[texmap[2]]); 
    978980    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 
    979                 0, 
    980                 GL_RGBA, 
    981                 tex_width, 
    982                 tex_height, 
    983                 0, 
    984                 GL_RGBA, 
    985                 GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
     981                0, 
     982                GL_RGBA, 
     983                tex_width, 
     984                tex_height, 
     985                0, 
     986                GL_RGBA, 
     987                GL_UNSIGNED_BYTE, gdk_pixbuf_get_pixels(pixmap)); 
    986988 
    987989    gdk_window_invalidate_rect(widget->window, &widget->allocation, 
    988                                FALSE); 
     990                               FALSE); 
    989991 
    990992  } 
     
    10181020    poppler_page_get_size(page, &w, &h); 
    10191021    poppler_page_render_to_pixbuf(page, 0, 0, iWidth, iHeight, 
    1020                                   1.0 * iWidth / w, 0, pm); 
     1022                                  1.0 * iWidth / w, 0, pm); 
    10211023  } 
    10221024 
     
    10271029    for (i = 0; i < 6; i++) { 
    10281030      if (i == current_face) { 
    1029         glEnable(GL_TEXTURE_RECTANGLE_ARB); 
    1030         glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
    1031                       textures[texmap[0]]); 
     1031        glEnable(GL_TEXTURE_RECTANGLE_ARB); 
     1032        glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
     1033                      textures[texmap[0]]); 
    10321034      } else if (i == prev_face()) { 
    1033         glEnable(GL_TEXTURE_RECTANGLE_ARB); 
    1034         glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
    1035                       textures[texmap[1]]); 
     1035        glEnable(GL_TEXTURE_RECTANGLE_ARB); 
     1036        glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
     1037                      textures[texmap[1]]); 
    10361038      } else if (i == next_face()) { 
    1037         glEnable(GL_TEXTURE_RECTANGLE_ARB); 
    1038         glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
    1039                       textures[texmap[2]]); 
     1039        glEnable(GL_TEXTURE_RECTANGLE_ARB); 
     1040        glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 
     1041                      textures[texmap[2]]); 
    10401042      } else if (i <= 3) { 
    1041         glDisable(GL_TEXTURE_RECTANGLE_ARB); 
    1042         glColor4f(0.4, 0.0, 0.0, 1.0); 
     1043        glDisable(GL_TEXTURE_RECTANGLE_ARB); 
     1044        glColor4f(0.4, 0.0, 0.0, 1.0); 
    10431045      } else { 
    1044         glDisable(GL_TEXTURE_RECTANGLE_ARB); 
    1045         glColor4f(1.0, 1.0, 1.0, 1.0); 
     1046        glDisable(GL_TEXTURE_RECTANGLE_ARB); 
     1047        glColor4f(1.0, 1.0, 1.0, 1.0); 
    10461048      } 
    10471049      glPolygonMode(GL_FRONT, GL_FILL); 
     
    10491051      //      glNormal3fv(&n[i][0]); 
    10501052      glTexCoord2f((1.0 - mapping[i][4]) * tex_width, 
    1051                    mapping[i][5] * tex_height); 
     1053                   mapping[i][5] * tex_height); 
    10521054      glVertex3fv(&v[faces[i][0]][0]); 
    10531055 
    10541056      glTexCoord2f((1.0 - mapping[i][6]) * tex_width, 
    1055                    mapping[i][7] * tex_height); 
     1057                   mapping[i][7] * tex_height); 
    10561058      glVertex3fv(&v[faces[i][1]][0]); 
    10571059 
    10581060      glTexCoord2f((1.0 - mapping[i][0]) * tex_width, 
    1059                    mapping[i][1] * tex_height); 
     1061                   mapping[i][1] * tex_height); 
    10601062      glVertex3fv(&v[faces[i][2]][0]); 
    10611063 
    10621064      glTexCoord2f((1.0 - mapping[i][2]) * tex_width, 
    1063                    mapping[i][3] * tex_height); 
     1065                   mapping[i][3] * tex_height); 
    10641066      glVertex3fv(&v[faces[i][3]][0]); 
    10651067 
     
    11001102  , 
    11011103  {1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0} 
    1102   ,                     // top 
     1104  ,                        // top 
    11031105  {1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0} 
    1104   ,                     // bottom 
     1106  ,                        // bottom 
    11051107}; 
    11061108 
     
    12691271#ifndef NDEBUG 
    12701272  g_print("%s: \"motion_notify_event\": button", 
    1271           gtk_widget_get_name(widget)); 
     1273          gtk_widget_get_name(widget)); 
    12721274  if (event->state & GDK_BUTTON1_MASK) { 
    12731275    g_print(" 1"); 
     
    13451347#endif 
    13461348      if (sleeping()) 
    1347         pc->section(widget, event->keyval - GDK_1 + 1); 
     1349        pc->section(widget, event->keyval - GDK_1 + 1); 
    13481350      break; 
    13491351 
     
    13811383#endif 
    13821384      if (sleeping()) 
    1383         pc->go_to(widget, (event->keyval - GDK_1) * 5); 
     1385        pc->go_to(widget, (event->keyval - GDK_1) * 5); 
    13841386      break; 
    13851387 
     
    13901392#endif 
    13911393      if (sleeping()) 
    1392         start_animation(widget, CUBE_PREV); 
     1394        start_animation(widget, CUBE_PREV); 
    13931395 
    13941396      break; 
     
    13981400#endif 
    13991401      if (sleeping()) 
    1400         start_animation(widget, CUBE_NEXT); 
     1402        start_animation(widget, CUBE_NEXT); 
    14011403      break; 
    14021404 
     
    14081410#endif 
    14091411      if (sleeping()) 
    1410         start_animation(widget, SWITCH_FW); 
     1412        start_animation(widget, SWITCH_FW); 
    14111413      break; 
    14121414 
     
    14181420#endif 
    14191421      if (sleeping()) 
    1420         start_animation(widget, SWITCH_BW); 
     1422        start_animation(widget, SWITCH_BW); 
    14211423      break; 
    14221424 
    14231425    case GDK_g: 
    14241426      if (sleeping()) 
    1425         if (last_animation >= 
    1426             ZOOM1 and last_animation <= ZOOMC) 
    1427           start_animation(widget, ZOOM0); 
     1427        if (last_animation >= 
     1428            ZOOM1 and last_animation <= ZOOMC) 
     1429          start_animation(widget, ZOOM0); 
    14281430      break; 
    14291431 
    14301432    case GDK_h: 
    14311433      if (sleeping()) 
    1432         if (last_animation >= 
    1433             ZOOM1 and last_animation <= ZOOMC) 
    1434           start_animation(widget, ZOOM0); 
    1435         else 
    1436           start_animation(widget, ZOOM1); 
     1434        if (last_animation >= 
     1435            ZOOM1 and last_animation <= ZOOMC) 
     1436          start_animation(widget, ZOOM0); 
     1437        else 
     1438          start_animation(widget, ZOOM1); 
    14371439      break; 
    14381440 
    14391441    case GDK_j: 
    14401442      if (sleeping()) 
    1441         if (last_animation >= 
    1442             ZOOM1 and last_animation <= ZOOMC) 
    1443           start_animation(widget, ZOOM0); 
    1444         else 
    1445           start_animation(widget, ZOOM2); 
     1443        if (last_animation >= 
     1444            ZOOM1 and last_animation <= ZOOMC) 
     1445          start_animation(widget, ZOOM0); 
     1446        else 
     1447          start_animation(widget, ZOOM2); 
    14461448      break; 
    14471449 
    14481450    case GDK_k: 
    14491451      if (sleeping()) 
    1450         if (last_animation >= 
    1451             ZOOM1 and last_animation <= ZOOMC) 
    1452           start_animation(widget, ZOOM0); 
    1453         else 
    1454           start_animation(widget, ZOOM3); 
     1452        if (last_animation >= 
     1453            ZOOM1 and last_animation <= ZOOMC) 
     1454          start_animation(widget, ZOOM0); 
     1455        else 
     1456          start_animation(widget, ZOOM3); 
    14551457      break; 
    14561458 
    14571459    case GDK_l: 
    14581460      if (sleeping()) 
    1459         if (last_animation >= 
    1460             ZOOM1 and last_animation <= ZOOMC) 
    1461           start_animation(widget, ZOOM0); 
    1462         else 
    1463           start_animation(widget, ZOOM4); 
     1461        if (last_animation >= 
     1462            ZOOM1 and last_animation <= ZOOMC) 
     1463          start_animation(widget, ZOOM0); 
     1464        else 
     1465          start_animation(widget, ZOOM4); 
    14641466      break; 
    14651467 
    14661468    case GDK_z: 
    14671469      if (sleeping()) 
    1468         if (last_animation >= 
    1469             ZOOM1 and last_animation <= ZOOMC) 
    1470           start_animation(widget, ZOOM0); 
    1471         else 
    1472           start_animation(widget, ZOOMC); 
     1470        if (last_animation >= 
     1471            ZOOM1 and last_animation <= ZOOMC) 
     1472          start_animation(widget, ZOOM0); 
     1473        else 
     1474          start_animation(widget, ZOOMC); 
    14731475      break; 
    14741476 
     
    14761478    case GDK_space: 
    14771479      if (page_transition[pc->page()]and sleeping()) 
    1478         start_animation(widget, CUBE_NEXT); 
     1480        start_animation(widget, CUBE_NEXT); 
    14791481      else if (sleeping()) 
    1480         start_animation(widget, SWITCH_FW); 
     1482        start_animation(widget, SWITCH_FW); 
    14811483 
    14821484      break; 
     
    14851487    case GDK_f: 
    14861488      if ((fullscreen = !fullscreen) == true) 
    1487         gtk_window_fullscreen((GtkWindow *) (data)); 
     1489        gtk_window_fullscreen((GtkWindow *) (data)); 
    14881490      else 
    1489         gtk_window_unfullscreen((GtkWindow *) (data)); 
     1491        gtk_window_unfullscreen((GtkWindow *) (data)); 
    14901492      break; 
    14911493 
     
    15231525  if (timeout_id == 0) { 
    15241526    timeout_id = g_timeout_add(TIMEOUT_INTERVAL, 
    1525                                (GSourceFunc) timeout, widget); 
     1527                               (GSourceFunc) timeout, widget); 
    15261528  } 
    15271529} 
     
    15771579gboolean 
    15781580visibility_notify_event(GtkWidget * widget, 
    1579                         GdkEventVisibility * event, gpointer data) 
     1581                        GdkEventVisibility * event, gpointer data) 
    15801582{ 
    15811583  if (animating) { 
     
    16451647  /* Connect signal handlers to the window */ 
    16461648  g_signal_connect(G_OBJECT(window), "delete_event", 
    1647                    G_CALLBACK(gtk_main_quit), NULL); 
     1649                   G_CALLBACK(gtk_main_quit), NULL); 
    16481650 
    16491651  /* 
     
    16611663  drawing_area = gtk_drawing_area_new(); 
    16621664  gtk_widget_set_size_request(drawing_area, DEFAULT_WIDTH, 
    1663                               DEFAULT_HEIGHT); 
     1665                              DEFAULT_HEIGHT); 
    16641666 
    16651667  /* Set OpenGL-capability to the widget */ 
    16661668  gtk_widget_set_gl_capability(drawing_area, 
    1667                                glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE); 
     1669                               glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE); 
    16681670 
    16691671  gtk_widget_add_events(drawing_area, 
    1670                         GDK_BUTTON1_MOTION_MASK | 
    1671                         GDK_BUTTON2_MOTION_MASK | 
    1672                         GDK_BUTTON_PRESS_MASK | 
    1673                         GDK_VISIBILITY_NOTIFY_MASK); 
     1672                        GDK_BUTTON1_MOTION_MASK | 
     1673                        GDK_BUTTON2_MOTION_MASK | 
     1674                        GDK_BUTTON_PRESS_MASK | 
     1675                        GDK_VISIBILITY_NOTIFY_MASK); 
    16741676 
    16751677  /* Connect signal handlers to the drawing area */ 
    16761678  g_signal_connect_after(G_OBJECT(drawing_area), "realize", 
    1677                         G_CALLBACK(realize), NULL); 
     1679                        G_CALLBACK(realize), NULL); 
    16781680  g_signal_connect(G_OBJECT(drawing_area), "configure_event", 
    1679                    G_CALLBACK(configure_event), NULL); 
     1681                   G_CALLBACK(configure_event), NULL); 
    16801682  g_signal_connect(G_OBJECT(drawing_area), "expose_event", 
    1681                    G_CALLBACK(expose_event), NULL); 
     1683                   G_CALLBACK(expose_event), NULL); 
    16821684  g_signal_connect(G_OBJECT(drawing_area), "unrealize", 
    1683                    G_CALLBACK(unrealize), NULL); 
     1685                   G_CALLBACK(unrealize), NULL); 
    16841686 
    16851687  g_signal_connect(G_OBJECT(drawing_area), "motion_notify_event", 
    1686                    G_CALLBACK(motion_notify_event), NULL); 
     1688                   G_CALLBACK(motion_notify_event), NULL); 
    16871689  g_signal_connect(G_OBJECT(drawing_area), "button_press_event", 
    1688                    G_CALLBACK(button_press_event), NULL); 
     1690                   G_CALLBACK(button_press_event), NULL); 
    16891691 
    16901692  /* key_press_event handler for top-level window */ 
    16911693  g_signal_connect_swapped(G_OBJECT(window), "key_press_event", 
    1692                            G_CALLBACK(key_press_event), drawing_area); 
     1694                           G_CALLBACK(key_press_event), drawing_area); 
    16931695 
    16941696  /* For timeout function. */ 
    16951697  g_signal_connect(G_OBJECT(drawing_area), "map_event", 
    1696                    G_CALLBACK(map_event), NULL); 
     1698                   G_CALLBACK(map_event), NULL); 
    16971699  g_signal_connect(G_OBJECT(drawing_area), "unmap_event", 
    1698                    G_CALLBACK(unmap_event), NULL); 
     1700                   G_CALLBACK(unmap_event), NULL); 
    16991701  g_signal_connect(G_OBJECT(drawing_area), "visibility_notify_event", 
    1700                    G_CALLBACK(visibility_notify_event), NULL); 
     1702                   G_CALLBACK(visibility_notify_event), NULL); 
    17011703 
    17021704  gtk_box_pack_start(GTK_BOX(vbox), drawing_area, TRUE, TRUE, 0); 
     
    17181720  /* Try double-buffered visual */ 
    17191721  glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode) 
    1720                                        (GDK_GL_MODE_RGBA | 
    1721                                         GDK_GL_MODE_ALPHA | 
    1722                                         GDK_GL_MODE_RGB | 
    1723                                         GDK_GL_MODE_DEPTH | 
    1724                                         GDK_GL_MODE_DOUBLE)); 
     1722                                       (GDK_GL_MODE_RGBA | 
     1723                                        GDK_GL_MODE_ALPHA | 
     1724                                        GDK_GL_MODE_RGB | 
     1725                                        GDK_GL_MODE_DEPTH | 
     1726                                        GDK_GL_MODE_DOUBLE)); 
    17251727  if (glconfig == NULL) { 
    17261728    g_print("\n*** Cannot find the double-buffered visual.\n"); 
     
    17291731    /* Try single-buffered visual */ 
    17301732    glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode) 
    1731                                         (GDK_GL_MODE_RGB | 
    1732                                           GDK_GL_MODE_DEPTH)); 
     1733                                        (GDK_GL_MODE_RGB | 
     1734                                          GDK_GL_MODE_DEPTH)); 
    17331735    if (glconfig == NULL) { 
    17341736      g_print 
    1735         ("*** No appropriate OpenGL-capable visual found.\n"); 
     1737        ("*** No appropriate OpenGL-capable visual found.\n"); 
    17361738      exit(1); 
    17371739    }