Changeset 173 in Sophya
- Timestamp:
- Dec 22, 1998, 5:19:22 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pigraphgen.cc
r158 r173 36 36 // Constructeur pour les *PIGraphicWin*. Objet "PIGraphic" capable 37 37 // de tracer dans un "PIWdg". 38 // PIGraphic(PIGraphicBuffer* grb) 39 // Constructeur pour objet "PIGraphic" capable de tracer dans un 40 // buffer graphique. 38 41 //-- 39 42 //++ … … 43 46 // int kind() 44 47 // Renvoie le type de l'objet "PIGraphic" . 48 // * PI_UnknownGraphics : Objet PIGraphic de type inconnue. 49 // * PI_GrBufferGraphics : Objet PIGraphic associé à un "GraphicBuffer" 45 50 // * PI_ScrWindowGraphics : Objet PIGraphic associé à une fenêtre sur l'écran (PIWdg) 46 51 // * PI_PSFileGraphics : Objet PIGraphic à un fichier PostScript (pour impression papier) … … 60 65 { 61 66 myWdg = NULL; 67 myGrb = NULL; 62 68 } 63 69 … … 66 72 { 67 73 myWdg = wdg; 74 myGrb = NULL; 75 } 76 77 /* --Methode-- */ 78 PIGraphicGen::PIGraphicGen(PIGraphicBuffer* grb) 79 { 80 myWdg = NULL; 81 myGrb = grb; 68 82 } 69 83 … … 75 89 int PIGraphicGen::kind() 76 90 { 77 return PI_ ScrWindowGraphics;91 return PI_UnknownGraphics ; 78 92 } 79 93 -
trunk/SophyaPI/PI/pigraphgen.h
r158 r173 1 // This may look like C code, but it is really -*- C++ -*- 1 2 // Module PI : Peida Interactive PIGraphic 2 3 // Primitives de trace graphiques R. Ansari 97 … … 60 61 }; 61 62 62 enum PIGraphicsType { PI_ScrWindowGraphics = 0, PI_PSFileGraphics = 1, 63 PI_UCGraphics = 2, PI_3DGraphics = 3 }; 63 enum PIGraphicsType { PI_UnknownGraphics = 0, 64 PI_ScrWindowGraphics = 2, PI_GrBufferGraphics = 3, 65 PI_PSFileGraphics = 8, 66 PI_UCGraphics = 32, PI_3DGraphics = 36 }; 64 67 65 68 // Classe generique de trace graphique de base : … … 70 73 PIGraphicGen(); 71 74 PIGraphicGen(PIWdg* wdg); 75 PIGraphicGen(PIGraphicBuffer* grb); 72 76 virtual ~PIGraphicGen(); 73 77 … … 135 139 // Pour Save/Restore des attributs graphiques 136 140 PIWdg* myWdg; 141 PIGraphicBuffer* myGrb; 137 142 138 143 PIColors sFCol, sBCol; -
trunk/SophyaPI/PI/pigraphx.cc
r158 r173 33 33 { 34 34 35 Init();35 GlInit(); 36 36 37 37 if (MyWdg()) { … … 41 41 else mDisp = PIXDisplay(); // Structure Display X associe 42 42 43 mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), 0, NULL); 44 43 XGCValues xgv; 44 xgv.function = GXcopy; 45 xgv.plane_mask = ~0; 46 mDefGC = XCreateGC (PIXDisplay(), XtWindow(PIXtTopWdg()), GCFunction | GCPlaneMask, &xgv); 47 48 Init(); 49 } 50 51 /* --Methode-- */ 52 PIGraphicX::PIGraphicX(PIGraphicBuffer* grb) 53 : PIGraphicGen(grb) 54 { 55 GlInit(); 56 57 mDisp = PIXDisplay(); // Structure Display X associe 58 mWId = grb->XGrBuffer(); 59 60 XGCValues xgv; 61 xgv.function = GXcopy; 62 xgv.plane_mask = ~0; 63 mDefGC = XCreateGC (mDisp, mWId, GCFunction | GCPlaneMask, &xgv); 64 Init(); 65 } 66 67 68 /* --Methode-- */ 69 void PIGraphicX::Init() 70 { 45 71 mGOm = PI_GOCopy; 46 47 72 mFCol = mBCol = PI_Grey; 48 73 SelForeground(PI_Black); … … 59 84 PIGraphicX::~PIGraphicX() 60 85 { 86 XFreeGC(mDisp, mDefGC); 87 } 88 89 /* --Methode-- */ 90 int PIGraphicX::kind() 91 { 92 if (myWdg != NULL) return (PI_ScrWindowGraphics); 93 else if (myGrb != NULL) return (PI_GrBufferGraphics); 94 else return(PI_UnknownGraphics); 61 95 } 62 96 … … 647 681 648 682 /* --Methode-- */ 649 void PIGraphicX:: Init()683 void PIGraphicX::GlInit() 650 684 { 651 685 char buff[256]; -
trunk/SophyaPI/PI/pigraphx.h
r158 r173 14 14 public: 15 15 PIGraphicX(PIWdg* wdg); 16 PIGraphicX(PIGraphicBuffer* grb); 16 17 virtual ~PIGraphicX(); 18 19 virtual int kind(); 17 20 18 21 // Trace graphiques … … 77 80 78 81 protected: 82 static void GlInit(); 79 83 void Init(); 80 84 void SelectFont(int isz, int jat); -
trunk/SophyaPI/PI/piwdggen.cc
r170 r173 227 227 //++ 228 228 // Titre Gestion des Draw/Event Handler 229 // Des Draw ou des Event Handler peuvent etre ajoute a un Widget 229 // Les objets de la classe "PIWdg" peuvent gérer des objets "PIEventHandler" 230 // qui peuvent prendre en charge une partie du traitement des événements 231 // clavier-souris-écran. 230 232 //-- 231 233 232 234 //++ 233 235 // void AddDrawHandler(PIEventHandler* drwh, bool ad=false) 234 // Ajout de 236 // Ajout d'un objet gestionnaire d'événements, responsable du tracé du contenu de la fenêtre. 237 // La méthode "Draw(PIGraphic* g, ...)" sera appelé pour rafraîchir le contenu de la fenêtre. 235 238 // void RemoveDrawHandler(PIEventHandler* drwh) 236 // Suppression d e239 // Suppression d'un objet gestionnaire de tracé. 237 240 // void AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false) 238 // Ajout de 241 // Ajout d'un objet gestionnaire d'événements. La variable "evtmask" détermine pour 242 // quels types d'événements, la méthode "Process()" du gestionnaire est appelée. 243 //| PIEvent_Resize (Non implementé en version X11 , 12/98) 244 //| PIEvent_Enter , PIEvent_Leave 245 //| PIEvent_ButxPress, PIEvent_ButxRelease (x=1,2,3) 246 //| PIEvent_PtrMove , PIEvent_PtrxMove (x=1,2,3) 247 //| PIEvent_Keyboard 248 // 239 249 // void RemoveEventHandler(PIEventHandler* evh) 240 // Suppression d e250 // Suppression d'un gestionnaire d'événements. 241 251 //-- 242 252 -
trunk/SophyaPI/PI/piwdggen.h
r170 r173 35 35 class PIEventHandler; 36 36 37 // -------------------- Classe PIWdgGen ----------------------- 37 38 class PIWdgGen : public PIMsgHandler 38 39 { … … 96 97 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l) = 0; 97 98 99 // Copie depuis un PIWdgGen 100 virtual void CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y) = 0; 101 98 102 // Gestion des EventHandler 99 103 virtual void AddDrawHandler(PIEventHandler* drwh, bool ad=false); … … 114 118 }; 115 119 116 120 // ---- La classe PIGraphicBuffer doit se conformer a l'interface suivante 121 // class PIGraphicBuffer { 122 // public : 123 // PIGraphicBuffer(int sx, int sy); 124 // virtual ~PIGraphicBuffer(); 125 // virtual int XSize(); 126 // virtual int YSize(); 127 // virtual void CopyFromWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y); 128 // virtual void CopyToWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y); 129 // virtual void CopyFrom(PIGraphicBuffer* grb, int ox, int oy, int dx, int dy, int x, int y); 130 // }; 117 131 118 132 -
trunk/SophyaPI/PI/piwdgx.cc
r170 r173 25 25 static SysDWdg top = NULL; 26 26 static Display * dpy = NULL; 27 static GC defgc; 27 28 // static char appname[64]; 28 29 static char appclass[64]; … … 560 561 top = XtVaAppInitialize(&appctx, appclass, NULL, 0, &n, ppc, (String*)(fallback_res), NULL); 561 562 #endif 563 if (top == NULL) { 564 fprintf(stderr, "PIWdgX::InitXt()/ Error XtVaAppInitialize() -> Exit \n"); 565 exit(9); 566 } 562 567 dpy = XtDisplay(top); 568 if (dpy == NULL) { 569 fprintf(stderr, "PIWdgX::InitXt()/ Error XtVaAppInitialize()/DisplayConnection -> Exit \n"); 570 exit(9); 571 } 572 573 /* le GC pour les XCopyArea */ 574 XGCValues xgv; 575 xgv.function = GXcopy; 576 xgv.plane_mask = ~0; 577 defgc = XCreateGC (dpy, DefaultRootWindow(dpy), GCFunction | GCPlaneMask, &xgv); 563 578 564 579 // On va recuperer la fonte par defaut des composantes Motif … … 736 751 #endif 737 752 return; 753 } 754 755 // Copie depuis un PIWdgGen 756 void PIWdgX::CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y) 757 { 758 PIWdgX* wx = (PIWdgX*)wdg; 759 XCopyArea(XtDisplay(XtWdg()), XtWindow(wx->XtWdg()), XtWindow(XtWdg()), defgc, ox, oy, 760 (unsigned int)dx, (unsigned int)dy, x, y); 738 761 } 739 762 … … 974 997 return; 975 998 } 999 1000 1001 // -------- La classe PIGraphicBuffer ---------- 1002 /* --Methode-- */ 1003 PIGraphicBuffer::PIGraphicBuffer(int sx, int sy) 1004 { 1005 if (sx < 1) sx = 1; 1006 if (sy < 1) sy = 1; 1007 mSx = sx; mSy = sy; 1008 Display * dsx = PIXDisplay(); 1009 Window rw = DefaultRootWindow(dsx); 1010 xGrbuff = XCreatePixmap(dsx, rw, sx, sy, DefaultDepth(dsx, DefaultScreen(dsx)) ); 1011 } 1012 /* --Methode-- */ 1013 PIGraphicBuffer::~PIGraphicBuffer() 1014 { 1015 XFreePixmap(PIXDisplay(),xGrbuff); 1016 } 1017 1018 /* --Methode-- */ 1019 int PIGraphicBuffer::XSize() 1020 { 1021 return(mSx); 1022 } 1023 1024 /* --Methode-- */ 1025 int PIGraphicBuffer::YSize() 1026 { 1027 return(mSx); 1028 } 1029 1030 /* --Methode-- */ 1031 void PIGraphicBuffer::CopyFromWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y) 1032 { 1033 XCopyArea(XtDisplay(wdg->XtWdg()), XtWindow(wdg->XtWdg()), XGrBuffer(), defgc, ox, oy, 1034 (unsigned int)dx, (unsigned int)dy, x, y); 1035 } 1036 1037 /* --Methode-- */ 1038 void PIGraphicBuffer::CopyToWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y) 1039 { 1040 XCopyArea(XtDisplay(wdg->XtWdg()), XGrBuffer(), XtWindow(wdg->XtWdg()), defgc, ox, oy, 1041 (unsigned int)dx, (unsigned int)dy, x, y); 1042 } 1043 1044 /* --Methode-- */ 1045 void PIGraphicBuffer::CopyFrom(PIGraphicBuffer* grb, int ox, int oy, int dx, int dy, int x, int y) 1046 { 1047 1048 XCopyArea(PIXDisplay(), grb->XGrBuffer(), XGrBuffer(), defgc, ox, oy, 1049 (unsigned int)dx, (unsigned int)dy, x, y); 1050 } -
trunk/SophyaPI/PI/piwdgx.h
r170 r173 25 25 public: 26 26 // Les methodes ... 27 PIWdgX(int narg=0, char *arg[]=NULL);28 PIWdgX(PIContainerGen *par, char *nom,29 int sx=10, int sy=10, int px=0, int py=0);27 PIWdgX(int narg=0, char *arg[]=NULL); 28 PIWdgX(PIContainerGen *par, char *nom, 29 int sx=10, int sy=10, int px=0, int py=0); 30 30 31 virtual ~PIWdgX();31 virtual ~PIWdgX(); 32 32 33 33 virtual void FinishCreate(); // apres avoir installe les sous-vues … … 64 64 virtual void PasteSelection(unsigned int typ, void *, unsigned int l); 65 65 66 // Copie depuis un PIWdgGen 67 virtual void CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y); 68 66 69 // Gestion des EventHandler 67 70 virtual void AddDrawHandler(PIEventHandler* drwh, bool ad=false); … … 94 97 typedef PIWdgX PIWdg; 95 98 99 // -------- La classe PIGraphicBuffer ---------- 100 class PIGraphicBuffer { 101 public : 102 PIGraphicBuffer(int sx, int sy); 103 virtual ~PIGraphicBuffer(); 104 105 virtual int XSize(); 106 virtual int YSize(); 107 virtual void CopyFromWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y); 108 virtual void CopyToWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y); 109 virtual void CopyFrom(PIGraphicBuffer* grb, int ox, int oy, int dx, int dy, int x, int y); 110 111 // Acces au Drawable X 112 inline Pixmap XGrBuffer() { return(xGrbuff); } 113 protected : 114 Pixmap xGrbuff; 115 int mSx, mSy; 116 }; 117 96 118 97 119 // Utile pour avoir acces au Display et Screen X ...
Note:
See TracChangeset
for help on using the changeset viewer.