Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

dlgraph.cpp

Go to the documentation of this file.
00001 
00008 //     $Id: dlgraph.cpp,v 1.15 2007-04-13 16:15:53 mbickel Exp $
00009 //
00010 //     $Log: dlgraph.cpp,v $
00011 //     Revision 1.15  2007-04-13 16:15:53  mbickel
00012 //      Merged ASC2 branch
00013 //
00014 //     Revision 1.13.2.1  2006/03/01 21:00:50  mbickel
00015 //      Clean up of source
00016 //      Fixed to construction icons
00017 //
00018 //     Revision 1.13  2001/07/30 17:43:13  mbickel
00019 //      Added Microsoft Visual Studio .net project files
00020 //      Fixed some warnings
00021 //
00022 //     Revision 1.12  2001/07/14 14:26:10  mbickel
00023 //      Some cleanup
00024 //
00025 //     Revision 1.11  2001/02/11 11:39:31  mbickel
00026 //      Some cleanup and documentation
00027 //
00028 //     Revision 1.10  2001/01/28 14:04:12  mbickel
00029 //      Some restructuring, documentation and cleanup
00030 //      The resource network functions are now it their own files, the dashboard
00031 //       as well
00032 //      Updated the TODO list
00033 //
00034 //     Revision 1.9  2000/10/16 14:34:12  mbickel
00035 //      Win32 port is now running fine.
00036 //      Removed MSVC project files and put them into a zip file in
00037 //        asc/source/win32/msvc/
00038 //
00039 //     Revision 1.8  2000/08/12 09:17:26  gulliver
00040 //     *** empty log message ***
00041 //
00042 //     Revision 1.7  2000/08/08 09:48:12  mbickel
00043 //
00044 //      speed up of dialog boxes in linux
00045 //      fixed graphical errors in attack
00046 //      fixed graphical error in ammo transfer
00047 //      fixed reaction fire not allowing manual attack
00048 //
00049 //     Revision 1.6  2000/05/23 20:40:43  mbickel
00050 //      Removed boolean type
00051 //
00052 //     Revision 1.5  2000/04/27 16:25:20  mbickel
00053 //      Attack functions cleanup
00054 //      New vehicle categories
00055 //      Rewrote resource production in ASC resource mode
00056 //      Improved mine system: several mines on a single field allowed
00057 //      Added unitctrl.* : Interface for vehicle functions
00058 //        currently movement and height change included
00059 //      Changed timer to SDL_GetTicks
00060 //
00061 //     Revision 1.4  1999/12/30 20:30:32  mbickel
00062 //      Improved Linux port again.
00063 //
00064 //     Revision 1.3  1999/12/28 21:02:52  mbickel
00065 //      Continued Linux port
00066 //      Added KDevelop project files
00067 //
00068 //     Revision 1.2  1999/11/16 03:41:27  tmwilson
00069 //      Added CVS keywords to most of the files.
00070 //      Started porting the code to Linux (ifdef'ing the DOS specific stuff)
00071 //      Wrote replacement routines for kbhit/getch for Linux
00072 //      Cleaned up parts of the code that gcc barfed on (char vs unsigned char)
00073 //      Added autoconf/automake capabilities
00074 //      Added files used by 'automake --gnu'
00075 //
00076 //
00077 /*
00078     This file is part of Advanced Strategic Command; http://www.asc-hq.de
00079     Copyright (C) 1994-1999  Martin Bickel  and  Marc Schellenberger
00080 
00081     This program is free software; you can redistribute it and/or modify
00082     it under the terms of the GNU General Public License as published by
00083     the Free Software Foundation; either version 2 of the License, or
00084     (at your option) any later version.
00085 
00086     This program is distributed in the hope that it will be useful,
00087     but WITHOUT ANY WARRANTY; without even the implied warranty of
00088     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00089     GNU General Public License for more details.
00090 
00091     You should have received a copy of the GNU General Public License
00092     along with this program; see the file COPYING. If not, write to the 
00093     Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
00094     Boston, MA  02111-1307  USA
00095 */
00096 
00097 void         tdialogbox::rahmen(bool      invers,
00098                     int          x1,
00099                     int          y1,
00100                     int          x2,
00101                     int          y2)
00102 {
00103      collategraphicoperations cgs ( x1, y1, x2, y2 );
00104      
00105          char col       =       (invers == false)       ?       white   :       darkgray;
00106      
00107          line(x1,y1,x1,y2,col);
00108      line(x1,y1,x2,y1,col); 
00109      
00110          col    =       (invers == true)        ?       white   :       darkgray;
00111     
00112          line(x2,y1,x2,y2,col); 
00113      line(x1,y2,x2,y2,col); 
00114 } 
00115 
00116 void                 tdialogbox::rahmen(        bool      invers,
00117                                                                                         tmouserect   rect )
00118 {
00119    rahmen ( invers, rect.x1, rect.y1, rect.x2,rect.y2 );
00120 }
00121 
00122 void         tdialogbox::knopf(int      xx1,
00123                    int      yy1,
00124                    int      xx2,
00125                    int      yy2)
00126 { 
00127      collategraphicoperations cgs ( xx1, yy1, xx2, yy2 );
00128 
00129      paintsurface2(xx1,yy1,xx2,yy2);
00130      rahmen(false,xx1,yy1,xx2,yy2); 
00131 } 
00132                       
00133 
00134 void         tdialogbox::knopfdruck(int      xx1,
00135                         int      yy1,
00136                         int      xx2,
00137                         int      yy2)
00138 {
00139 
00140      collategraphicoperations cgs ( xx1, yy1, xx2, yy2 );
00141 
00142     void*      p;
00143     int      mt;
00144 
00145      mt = mouseparams.taste;
00146      mousevisible(false);
00147 
00148      void*    pq = asc_malloc ( imagesize ( xx1 , yy1 , xx2 , yy2 ));
00149      getimage( xx1 , yy1 , xx2 , yy2 , pq );
00150 
00151      p = asc_malloc ( imagesize ( xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2 ));
00152      getimage(xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2, p);
00153      putimage(xx1 + 3,yy1 + 3, p );
00154      rahmen(true, xx1, yy1, xx2, yy2); 
00155      mousevisible(true); 
00156      knopfsuccessful = true; 
00157      bool kn = true; 
00158      do { 
00159            if ((mouseparams.x > xx2) || (mouseparams.x < xx1) || (mouseparams.y > yy2) || (mouseparams.y < yy1)) { 
00160               knopfsuccessful = false; 
00161               kn = false; 
00162            } 
00163            if (mouseparams.taste != mt) 
00164               kn = false; 
00165            releasetimeslice();
00166      }  while (kn == true);
00167      mousevisible(false); 
00168 
00169      putimage(xx1 + 1,yy1 + 1, p);
00170      asc_free ( p );
00171 
00172      putimage( xx1 , yy1 , pq );
00173      asc_free ( pq );
00174 
00175      mousevisible(true); 
00176 } 
00177 
00178 
00179 
00180 void         tdialogbox::newknopf(int      xx1,
00181                       int      yy1,
00182                       int      xx2,
00183                       int      yy2)
00184 { 
00185      collategraphicoperations cgs ( xx1-1, yy1-1, xx2+1, yy2+1 );
00186 
00187      paintsurface2(xx1,yy1,xx2,yy2);
00188 
00189      rahmen(true,  xx1 - 1, yy1 - 1,xx2 + 1,yy2 + 1);
00190      rahmen(false, xx1,yy1,  xx2,yy2);
00191 } 
00192 
00193 
00194 void         tdialogbox::newknopfdruck2(int      xx1,
00195                             int      yy1,
00196                             int      xx2,
00197                             int      yy2)
00198 {
00199 
00200     void*      p;
00201     bool      kn; 
00202     int      mt;
00203     {
00204        collategraphicoperations cgs ( xx1 -1, yy1 -1, xx2 + 1, yy2 + 1 );
00205        mt = mouseparams.taste;
00206        mousevisible(false);
00207        p = asc_malloc ( imagesize ( xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2 ) );
00208        getimage(xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2, p);
00209        putimage(xx1 + 3,yy1 + 3, p);
00210 
00211        line(xx1 - 1,yy1 - 1,xx2 + 1,yy1 - 1, 8);
00212        line(xx1 - 1,yy1 - 1,xx1 - 1,yy2 + 1, 8);
00213        line(xx2 + 1,yy1 - 1,xx2 + 1,yy2 + 1, 15);
00214        line(xx1 - 1,yy2 + 1,xx2 + 1,yy2 + 1, 15);
00215 
00216        line(xx1,yy1,xx2,yy1, 8);
00217        line(xx1,yy1,xx1,yy2, 8);
00218        line(xx2,yy1,xx2,yy2, 15);
00219        line(xx1,yy2,xx2,yy2, 15);
00220 
00221        mousevisible(true);
00222        knopfsuccessful = true;
00223        kn = true;
00224     }
00225     do {
00226            if ((mouseparams.x > xx2) || (mouseparams.x < xx1) || (mouseparams.y > yy2) || (mouseparams.y < yy1)) { 
00227               knopfsuccessful = false; 
00228               kn = false; 
00229            } 
00230            if (mouseparams.taste != mt) 
00231               kn = false; 
00232            releasetimeslice();
00233     }  while (kn == true);
00234     {
00235        collategraphicoperations cgo ( xx1 - 1, yy1 - 1, xx2 + 1, yy2 + 1 );
00236 
00237        mousevisible(false);
00238 
00239        if (knopfsuccessful == false)
00240           putimage (xx1 + 1,yy1 + 1,p);
00241        asc_free ( p );
00242 
00243        if (knopfsuccessful == false) {
00244           line(xx1 - 1,yy1 - 1,xx2 + 1,yy1 - 1, 8);
00245           line(xx1 - 1,yy1 - 1,xx1 - 1,yy2 + 1, 8);
00246           line(xx2 + 1,yy1 - 1,xx2 + 1,yy2 + 1, 15);
00247           line(xx1 - 1,yy2 + 1,xx2 + 1,yy2 + 1, 15);
00248 
00249           line(xx1,yy1,xx2,yy1, 15);
00250           line(xx1,yy1,xx1,yy2, 15);
00251           line(xx2,yy1,xx2,yy2, 8);
00252           line(xx1,yy2,xx2,yy2, 8);
00253        }
00254        mousevisible(true);
00255     }
00256 
00257 } 
00258 
00259 
00260 void         tdialogbox::newknopfdruck3(int      xx1,
00261                             int      yy1,
00262                             int      xx2,
00263                             int      yy2)
00264 {
00265      collategraphicoperations cgs ( xx1, yy1, xx2, yy2 );
00266 
00267    void*      p;
00268 
00269      // vom reingedr?ckten in den Normalzustand
00270 
00271      p = asc_malloc ( imagesize ( xx1 + 4,yy1 + 4,xx2 - 2,yy2 - 2 ));
00272      getimage(xx1 + 4,yy1 + 4,xx2 - 2,yy2 - 2, p );
00273 
00274      putimage(xx1 + 2,yy1 + 2,p);
00275      asc_free ( p );              
00276 
00277      rahmen(false,xx1,yy1,xx2,yy2); 
00278 } 
00279 
00280 
00281 
00282 
00283 void         tdialogbox::newknopfdruck4(int      xx1,
00284                             int      yy1,
00285                             int      xx2,
00286                             int      yy2)
00287 {
00288      collategraphicoperations cgs ( xx1, yy1, xx2, yy2 );
00289 
00290    void*      p;
00291     // reindr?cken
00292 
00293      p = asc_malloc ( imagesize ( xx1 + 2,yy1 + 2,xx2 - 4,yy2 - 4 )) ;
00294      getimage(xx1 + 2,yy1 + 2,xx2 - 4,yy2 - 4, p);
00295      putimage(xx1 + 4,yy1 + 4, p);
00296      asc_free ( p );
00297 
00298      rahmen(true,xx1,yy1,xx2,yy2); 
00299 } 
00300 
00301 
00302 void         tdialogbox::newknopfdruck(int      xx1,
00303                            int      yy1,
00304                            int      xx2,
00305                            int      yy2)
00306 {
00307 
00308    void*      p;
00309    bool      kn;
00310    int      mt;
00311    void*    pq ;
00312    {
00313      collategraphicoperations cgs( xx1-1, yy1-1, xx2+1, yy2+1 );
00314      mt = mouseparams.taste;
00315      mousevisible(false); 
00316 
00317      pq = asc_malloc ( imagesize ( xx1 , yy1 , xx2 , yy2 ));
00318      getimage( xx1 , yy1 , xx2 , yy2 , pq );
00319 
00320 
00321      p = asc_malloc ( imagesize ( xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2 ));
00322      getimage(xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2, p);
00323      putimage(xx1 + 3,yy1 + 3, p);
00324 
00325      line(xx1 - 1,yy1 - 1,xx2 + 1,yy1 - 1, 8);
00326      line(xx1 - 1,yy1 - 1,xx1 - 1,yy2 + 1, 8);
00327 
00328      line(xx2 + 1,yy1 - 1,xx2 + 1,yy2 + 1, 15);
00329      line(xx1 - 1,yy2 + 1,xx2 + 1,yy2 + 1, 15);
00330 
00331      line(xx1,yy1,xx2,yy1, 8);
00332      line(xx1,yy1,xx1,yy2, 8);
00333 
00334      line(xx2,yy1,xx2,yy2, 15);
00335      line(xx1,yy2,xx2,yy2, 15);
00336      mousevisible(true); 
00337 
00338      knopfsuccessful = true; 
00339      kn = true;
00340    }
00341    do {
00342            if ((mouseparams.x > xx2) || (mouseparams.x < xx1) || (mouseparams.y > yy2) || (mouseparams.y < yy1)) { 
00343               knopfsuccessful = false; 
00344               kn = false; 
00345            } 
00346            if (mouseparams.taste != mt) 
00347               kn = false; 
00348            releasetimeslice();
00349    }  while (kn == true);
00350    {
00351      collategraphicoperations cgo( xx1-1, yy1-1, xx2+1, yy2+1 );
00352      mousevisible(false); 
00353      putimage(xx1 + 1,yy1 + 1,p);
00354      asc_free ( p ) ;
00355 
00356      line(xx1 - 1,yy1 - 1,xx2 + 1,yy1 - 1, 8);
00357      line(xx1 - 1,yy1 - 1,xx1 - 1,yy2 + 1, 8);
00358 
00359      line(xx2 + 1,yy1 - 1,xx2 + 1,yy2 + 1, 15);
00360      line(xx1 - 1,yy2 + 1,xx2 + 1,yy2 + 1, 15);
00361 
00362      line(xx1,yy1,xx2,yy1, 15);
00363      line(xx1,yy1,xx1,yy2, 15);
00364 
00365      line(xx2,yy1,xx2,yy2, 8);
00366      line(xx1,yy2,xx2,yy2, 8);
00367 
00368      putimage( xx1 , yy1 , pq );
00369      asc_free ( pq );
00370 
00371      mousevisible(true);
00372    }
00373 } 

Generated on Tue Jun 24 01:27:39 2008 for Advanced Strategic Command by  doxygen 1.4.2