crabs_firewall-3.0.1 ©2005-2011 - Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)
1 /* 2 **============================================================================= 3 ** crabs_firewall-3.0.1 : Firewall-Masquerade avec interface http 4 ** Copyright (C) 2005-2011 : Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com) 5 ** 6 ** Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer 7 ** et/ou le modifier en respectant les termes de la GNU General Public License 8 ** version 2 ou (suite a votre propre choix) une version ulterieure. 9 ** 10 ** Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais 11 ** sans aucune garantie, meme si il est associe a un produit qui vous en 12 ** propose une. Conformez-vous a la GNU General Public License pour avoir 13 ** plus de precisions. 14 ** 15 ** L'auteur ne peut etre tenu responsable de l'utilisation faite des 16 ** composantes associees a ce projet (en partie ou dans leur totalite). 17 ** 18 ** Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC 19 ** de ce projet sous le nom gnu_gpl.txt 20 ** 21 **============================================================================= 22 */ 23 #include "graph.h" 24 #include <string.h> 25 26 CGgraph::CGgraph() 27 { 28 axeX = 0 ; W=640 ; H=480 ;int i ; 29 for( i=0; i<NbAxeY; i++ ) axeY[i] = 0 ; 30 for( i=0; i<NbCourbe; i++ ) 31 { crb[i].axeY=-1; crb[i].valeur=0; crb[i].nom[0]=0; } 32 *fichier = 0 ; 33 } 34 CGgraph::~CGgraph() {} 35 36 const int CGgraph::NbAxeY ; 37 const int CGgraph::NbCourbe ; 38 const int CGgraph::mDEF ; 39 const int CGgraph::mCX ; 40 const int CGgraph::mDX ; 41 const int CGgraph::mGX ; 42 const int CGgraph::mCY ; 43 const int CGgraph::mHY ; 44 const int CGgraph::mBY ; 45 46 void CGgraph::setAxeX( CGserie* axe ) { axeX = axe; } 47 48 int CGgraph::ajouteAxeY( CGserie* axe ) 49 { 50 if ( !axe ) return -1 ; 51 for( int i=0; i<NbAxeY; i++ ) 52 if ( !axeY[i] ) { axeY[i] = axe; return i; } 53 return -1 ; 54 } 55 bool CGgraph::supprimeAxeY( int axe ) 56 { 57 if ( axe < 0 ) return false ; if ( axe >=NbAxeY ) return false ; 58 // Supprime les courbes faisant reference a cet axe 59 if ( axeY[axe] == 0 ) return false ; 60 for( int i=0 ; i<NbCourbe; i++ ) 61 { 62 if ( !crb[i].valeur ) continue ; 63 if ( crb[i].axeY == axe ) supprimeCourbe( i ) ; 64 } 65 axeY[axe] = 0 ; 66 return true ; 67 } 68 69 int CGgraph::ajouteCourbe( CGserie* valeur, int axe, int R, int G, int B, 70 const char* nom ) 71 { 72 if ( axe < 0 ) return -1 ; if ( axe >=NbAxeY ) return -1 ; 73 if ( !axeY[axe] ) return -1 ; if ( !valeur ) return -1 ; 74 for( int i=0 ; i<NbCourbe; i++ ) 75 { 76 if ( crb[i].valeur ) continue ; 77 crb[i].valeur = valeur ; crb[i].axeY = axe ; 78 crb[i].R = R ; crb[i].G = G ; crb[i].B = B ; 79 strcpy( crb[i].nom, (nom)?nom:"" ) ; 80 return i ; 81 } 82 return -1 ; 83 } 84 bool CGgraph::supprimeCourbe( int id ) 85 { 86 if ( id < 0 ) return false ; if ( id >=NbCourbe ) return false ; 87 if ( !crb[id].valeur ) return false ; 88 crb[id].valeur = 0 ; crb[id].axeY = -1 ; crb[id].nom[0] = 0 ; 89 return true ; 90 } 91 92 void CGgraph::setFichier( const char* f ) { strcpy( fichier, f ) ; } 93 void CGgraph::setTitre( const char* t ) { strcpy( titre, t ) ; } 94
Date de génération : 22/09/2011 21:48