Changeset 170 in Sophya for trunk/SophyaPI
- Timestamp:
- Dec 21, 1998, 9:47:37 AM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pi3ddrw.cc
r163 r170 26 26 lCO = 10.; dlCO = 3.; 27 27 v3D_obs = false; 28 xMin = yMin = zMin = -1.; 29 xMax = yMax = zMax = 1.; 28 30 } 29 31 … … 85 87 86 88 // ...................................................................... 87 // ....................... . Classe PIDrawer3D..........................89 // ....................... Classe PIDraw3DWdg .......................... 88 90 // ...................................................................... 89 91 -
trunk/SophyaPI/PI/pi3ddrw.h
r163 r170 31 31 virtual PIGraphicUC* SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g); 32 32 33 float ZMin() const {return zMin;} 34 float ZMax() const {return zMax;} 35 33 36 protected : 34 37 float xO, yO, zO; // Position observateur = camera … … 38 41 float lCO, dlCO; // Distance Camera-Centre du champ et profondeur de champ 39 42 bool v3D_obs; // Si defini par Set3DView_Obs 43 float zMin, zMax; // Pour delimiter le cube 3D (avec x/yMin-Max) 40 44 }; 41 45 -
trunk/SophyaPI/PI/pibwdggen.h
r163 r170 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIBaseWdgGen 3 // Classe de base pour la creation de nouvelles composantes 4 // graphiques interactives 5 // R.Ansari - E.Aubourg 96 6 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 7 1 8 #ifndef PIBWDGGEN_H_SEEN 2 9 #define PIBWDGGEN_H_SEEN … … 8 15 #include PIGRAPHIC_H 9 16 #include "pigraphuc.h" 17 #include "pievthandler.h" 10 18 #include "psfile.h" 11 19 … … 15 23 #include <vector.h> 16 24 #endif 17 18 enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ;19 20 enum PIKeyValues { PIK_Return = 0xFF0D, PIK_Enter = 0xFF8D ,21 PIK_BackSpace = 0xFF08, PIK_Delete = 0xFFFF,22 PIK_Tab = 0xFF09, PIK_Escape = 0xFF1B,23 PIK_Up = 0xFF52, PIK_Down = 0xFF54,24 PIK_Right = 0xFF53, PIK_Left = 0xFF51,25 PIK_Previous = 0xFF55, PIK_Next = 0xFF56 } ;26 25 27 26 -
trunk/SophyaPI/PI/picmapx.cc
r163 r170 61 61 static int NTotAllocCol = 0; 62 62 63 static int nerrallocol = 0; 64 63 65 /* --Methode-- */ 64 66 bool PIColorMapX::AllocColor(PIColor const& col, int index) … … 106 108 } 107 109 else { 108 printf("PIColorMapX::AllocColor() Error: Pb Allocation RGB= %d %d %d \n", 110 nerrallocol++; 111 if (nerrallocol < 21) printf("PIColorMapX::AllocColor() Error: Pb Allocation RGB= %d %d %d \n", 109 112 (int) col.red, (int) col.blue, (int) col.green); 113 if (nerrallocol == 20) printf("No more PIColorMapX::AllocColor() Errors will be reported \n"); 110 114 return(false); 111 115 } -
trunk/SophyaPI/PI/pievthandler.cc
r167 r170 1 1 // Module PI : Peida Interactive PIEventHandler 2 2 // Classe Gestionnaire d'evenements (Ecran/Clavier/Souris) 3 // Reza 11/98 3 // R.Ansari 12/98 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 5 6 #include "pievthandler.h" 7 8 9 /* --Methode-- */ 10 PIEventHandler::PIEventHandler(PIMsgHandler* par, PIMessage msg) 11 : PIMsgHandler(par) 12 { 13 SetMsg(msg); 14 curwdg = NULL; 15 event = PIEvent_None; 16 posx = posy = 0; 17 key = 0; 18 keymod = PIKM_Blank; 19 evttime = 0; 20 } 21 22 /* --Methode-- */ 23 PIEventHandler::~PIEventHandler() 24 { 25 } 26 27 /* --Methode-- */ 28 void PIEventHandler::Draw(PIGraphic*, int, int, int, int) 29 { 30 return; 31 } 32 33 /* --Methode-- */ 34 void PIEventHandler::ProcessEvent() 35 { 36 return; 37 } 38 39 /* --Methode-- */ 40 void PIEventHandler::SetCurrentWdg(PIWdg* wdg) 41 { 42 curwdg = wdg; 43 } 44 45 46 /* --Methode-- */ 47 void PIEventHandler::SetEventInfo(PIEventMask evt, int px, int py, 48 int k, PIKeyModifier km, unsigned long tm) 49 { 50 event = evt; 51 posx = px; posy = py; 52 key = k; 53 keymod = km; 54 evttime = tm; 55 } 56 -
trunk/SophyaPI/PI/pievthandler.h
r167 r170 2 2 // Module PI : Peida Interactive PIEventHandler 3 3 // Classe Gestionnaire d'evenements (Ecran/Clavier/Souris) 4 // Reza 11/98 4 // R.Ansari 12/98 5 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 6 6 7 #ifndef PIEVTHANDLER_H_SEEN 7 8 #define PIEVTHANDLER_H_SEEN 8 9 10 #include "pisysdep.h" 9 11 #include "pimsghandler.h" 12 #include PIWDG_H 13 #include PIGRAPHIC_H 10 14 15 16 // .... KeyModifier (<Shift>, <Control> , <Alt>) and special key values .... 17 enum PIKeyModifier { PIKM_Blank = 0, PIKM_Shift = 1, PIKM_Alt = 2, PIKM_Cntl = 4 } ; 18 19 enum PIKeyValues { PIK_Return = 0xFF0D, PIK_Enter = 0xFF8D , 20 PIK_BackSpace = 0xFF08, PIK_Delete = 0xFFFF, 21 PIK_Tab = 0xFF09, PIK_Escape = 0xFF1B, 22 PIK_Up = 0xFF52, PIK_Down = 0xFF54, 23 PIK_Right = 0xFF53, PIK_Left = 0xFF51, 24 PIK_Previous = 0xFF55, PIK_Next = 0xFF56 } ; 25 26 // .......... Event Mask values .......... 27 enum PIEventMask { 28 PIEvent_None = 0, // 29 PIEvent_Draw = 1 << 0, // ReDraw window 30 PIEvent_Resize = 1 << 1, // window resized 31 PIEvent_Enter = 1 << 2, // Pointer entered window 32 PIEvent_Leave = 1 << 3, // Pointer leaved window 33 PIEvent_But1Press = 1 << 4, // Button-1 Press 34 PIEvent_But1Release = 1 << 5, // Button-1 Release 35 PIEvent_But2Press = 1 << 6, // Button-2 Press 36 PIEvent_But2Release = 1 << 7, // Button-2 Release 37 PIEvent_But3Press = 1 << 8, // Button-3 Press 38 PIEvent_But3Release = 1 << 9, // Button-3 Release 39 PIEvent_PtrMove = 1 << 14, // Pointer moved 40 PIEvent_Ptr1Move = 1 << 15, // Pointer moved with button-1 41 PIEvent_Ptr2Move = 1 << 16, // Pointer moved with button-2 42 PIEvent_Ptr3Move = 1 << 17, // Pointer moved with button-3 43 PIEvent_Keyboard = 1 << 20 // key-pressed Keyboard 44 } ; 45 46 47 // ----------------- Class PIEventHandler ----------------------- 11 48 class PIEventHandler : public PIMsgHandler 12 49 { 13 50 public: 51 PIEventHandler(PIMsgHandler* par=NULL, PIMessage msg = 0); 52 ~PIEventHandler(); 53 54 inline void SetMsg(PIMessage msg = 0) { myMsg=msg; } 55 inline PIMessage Msg() { return (myMsg); } 56 57 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 58 virtual void ProcessEvent(); 59 60 virtual void SetCurrentWdg(PIWdg* wdg); 61 inline PIWdg* CurrentWdg() { return(curwdg); } 62 63 virtual void SetEventInfo(PIEventMask evt, int px, int py, 64 int k, PIKeyModifier km, unsigned long tm); 65 inline PIEventMask EventType() { return(event); } 66 inline int GetPosX() { return(posx); } 67 inline int GetPosY() { return(posy); } 68 inline int GetKey() { return(key); } 69 inline PIKeyModifier GetKeyMod() { return(keymod); } 70 inline unsigned long GetEventTime() { return(evttime); } 71 72 protected: 73 PIMessage myMsg; // associated user message 74 75 PIWdg* curwdg; // Current PIWdg, where event originated 76 PIEventMask event; // event type 77 int posx, posy; // Pointer Position 78 int key; // Pressed key-code 79 PIKeyModifier keymod; // Pressed key-modifier (shift, Cntl, ...) 80 unsigned long evttime; // Event-time in ms 14 81 }; 15 82 -
trunk/SophyaPI/PI/piperiodx.cc
r114 r170 11 11 int szx, szy, szf; 12 12 XtAppContext * appctx = PIXtAppCtx(szx, szy, szf); 13 id = XtAppAddTimeOut(*appctx, pip->Interval ()*1000, xttimer_action, pip);13 id = XtAppAddTimeOut(*appctx, pip->Intervalms(), xttimer_action, pip); 14 14 pip->SetTimerId(id); 15 15 return; … … 33 33 { 34 34 if (mFgact) return; 35 if (dt > 0) mDt = dt;35 if (dt > 0) { mDt = dt; mDtms = dt*1000; } 36 36 37 37 int szx,szy,szf; -
trunk/SophyaPI/PI/pisurfdr.cc
r163 r170 56 56 Set3DView((xmin+xmax)/2., (ymin+ymax)/2, zmin+(zmax-zmin)*0.40, 57 57 (xmin+xmax)/2.+D , (ymin+ymax)/2.+2*D , zmin+(zmax-zmin)*0.60, 0.25, 0.25); 58 59 xMin = xmin - 0.05*(xmax-xmin); 60 xMax = xmax + 0.05*(xmax-xmin); 61 yMin = ymin - 0.05*(ymax-ymin); 62 yMax = ymax + 0.05*(ymax-ymin); 63 zMin = zmin - 0.05*(zmax-zmin); 64 zMax = zmax + 0.05*(zmax-zmin); 65 58 66 // printf("PISurfaceDrawer::UpdateLimits() : %g-%g %g-%g %g-%g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D); 59 67 // printf("PISurfaceDrawer::UpdateLimits() : %g %g %g <<- %g %g %g \n", -
trunk/SophyaPI/PI/piwdggen.cc
r138 r170 10 10 #include "piwdggen.h" 11 11 #include "picontainergen.h" 12 12 #include "pievthandler.h" 13 13 #include "psfile.h" 14 14 … … 181 181 // ChildDel() doit etre appele par la classe qui implemente le widget 182 182 // if (parent) parent->ChildDel(this); // On previent le container parent 183 list<EvHand>::iterator it; 184 for(it= mDHlist.begin(); it != mDHlist.end(); it++) 185 if ((*it).ad) delete (*it).evh; 186 for(it= mEHlist.begin(); it != mEHlist.end(); it++) 187 if ((*it).ad) delete (*it).evh; 183 188 } 184 189 … … 220 225 } 221 226 227 //++ 228 // Titre Gestion des Draw/Event Handler 229 // Des Draw ou des Event Handler peuvent etre ajoute a un Widget 230 //-- 231 232 //++ 233 // void AddDrawHandler(PIEventHandler* drwh, bool ad=false) 234 // Ajout de 235 // void RemoveDrawHandler(PIEventHandler* drwh) 236 // Suppression de 237 // void AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false) 238 // Ajout de 239 // void RemoveEventHandler(PIEventHandler* evh) 240 // Suppression de 241 //-- 242 243 /* --Methode-- */ 244 void PIWdgGen::AddDrawHandler(PIEventHandler* drwh, bool ad) 245 { 246 EvHand eh; 247 eh.evh = drwh; eh.mask = PIEvent_Draw; eh.ad = ad; 248 mDHlist.push_back(eh); 249 } 250 251 /* --Methode-- */ 252 void PIWdgGen::RemoveDrawHandler(PIEventHandler* drwh) 253 { 254 list<EvHand>::iterator it; 255 for(it= mDHlist.begin(); it != mDHlist.end(); it++) 256 if ((*it).evh == drwh) { mDHlist.erase(it); break; } 257 } 258 259 /* --Methode-- */ 260 void PIWdgGen::AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad) 261 { 262 EvHand eh; 263 eh.evh = evh; eh.mask = evtmask; eh.ad = ad; 264 mEHlist.push_back(eh); 265 } 266 267 /* --Methode-- */ 268 void PIWdgGen::RemoveEventHandler(PIEventHandler* evh) 269 { 270 list<EvHand>::iterator it; 271 for(it= mEHlist.begin(); it != mEHlist.end(); it++) 272 if ((*it).evh == evh) { mEHlist.erase(it); break; } 273 } 274 275 222 276 /* --Methode-- 223 277 string PIWdgGen::kindstr() -
trunk/SophyaPI/PI/piwdggen.h
r163 r170 7 7 #define PIWDG_H_SEEN 8 8 9 #include "pimsghandler.h" 10 9 11 #include <string> 12 #include <list> 10 13 #if defined(__KCC__) 11 14 using std::string ; 15 #include <list.h> 12 16 #endif 13 17 14 #include "pimsghandler.h"15 18 16 19 void PIBeep(); … … 30 33 class PSFile; 31 34 class PIContainerGen; 35 class PIEventHandler; 36 32 37 class PIWdgGen : public PIMsgHandler 33 38 { … … 91 96 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l) = 0; 92 97 98 // Gestion des EventHandler 99 virtual void AddDrawHandler(PIEventHandler* drwh, bool ad=false); 100 virtual void RemoveDrawHandler(PIEventHandler* drwh); 101 virtual void AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false); 102 virtual void RemoveEventHandler(PIEventHandler* evh); 103 104 // !! Devrait etre protected - mis ici a cause de cxx Reza 12/98 105 struct EvHand { PIEventHandler* evh; unsigned long mask; bool ad; }; 93 106 protected: 94 PIContainerGen *parent;107 PIContainerGen* parent; 95 108 PIMessage myMsg; 96 109 list<EvHand> mDHlist; 110 list<EvHand> mEHlist; 97 111 private: 98 112 int flag; -
trunk/SophyaPI/PI/piwdgx.cc
r164 r170 9 9 #include <X11/CoreP.h> 10 10 11 #include <X11/keysym.h> 12 11 13 #include <Xm/Xm.h> // A cause des container XmForm 12 14 #include <Xm/Form.h> // Idem … … 14 16 #include "piwdgx.h" 15 17 #include "picontainerx.h" 18 #include "pievthandler.h" 16 19 17 20 … … 734 737 return; 735 738 } 739 740 741 // Declaration de l' EventHandler Xt 742 static void evthandler_piwdgx (Widget wdgp, XtPointer, XEvent* evt, Boolean* cont); 743 744 745 /* --Methode-- */ 746 void PIWdgX::AddDrawHandler(PIEventHandler* drwh, bool ad) 747 { 748 PIWdgGen::AddDrawHandler(drwh, ad); 749 XtAddEventHandler( XtWdg(), ExposureMask, FALSE, evthandler_piwdgx, this); 750 } 751 752 /* --Methode-- */ 753 void PIWdgX::RemoveDrawHandler(PIEventHandler* drwh) 754 { 755 PIWdgGen::RemoveDrawHandler(drwh); 756 if (mEHlist.size() <= 0) XtRemoveEventHandler( XtWdg(), ExposureMask, FALSE, evthandler_piwdgx, this); 757 } 758 759 /* --Methode-- */ 760 void PIWdgX::AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad) 761 { 762 PIWdgGen::AddEventHandler(evh, evtmask, ad); 763 EventMask mask = 0; 764 // if (evtmask & PIEvent_Resize) pas traite pour le moment 765 if (evtmask & PIEvent_Enter) mask |= EnterNotify; 766 if (evtmask & PIEvent_Leave) mask |= LeaveNotify; 767 if (evtmask & PIEvent_But1Press) mask |= ButtonPressMask; 768 if (evtmask & PIEvent_But1Release) mask |= ButtonRelease; 769 if (evtmask & PIEvent_But2Press) mask |= ButtonPressMask; 770 if (evtmask & PIEvent_But2Release) mask |= ButtonRelease; 771 if (evtmask & PIEvent_But3Press) mask |= ButtonPressMask; 772 if (evtmask & PIEvent_But3Release) mask |= ButtonRelease; 773 if (evtmask & PIEvent_PtrMove) mask |= PointerMotionHintMask; 774 if (evtmask & PIEvent_Ptr1Move) mask |= (PointerMotionHintMask | Button1MotionMask); 775 if (evtmask & PIEvent_Ptr2Move) mask |= (PointerMotionHintMask | Button2MotionMask); 776 if (evtmask & PIEvent_Ptr3Move) mask |= (PointerMotionHintMask | Button3MotionMask); 777 if (evtmask & PIEvent_Keyboard) mask |= KeyPressMask; 778 XtAddEventHandler( XtWdg(), mask, FALSE, evthandler_piwdgx, this); 779 } 780 781 /* --Methode-- */ 782 void PIWdgX::RemoveEventHandler(PIEventHandler* evh) 783 { 784 PIWdgGen::RemoveEventHandler(evh); 785 if (mEHlist.size() > 0) return; 786 unsigned mask = EnterNotify; 787 mask |= LeaveNotify; 788 mask |= ButtonPressMask; 789 mask |= ButtonRelease; 790 mask |= ButtonPressMask; 791 mask |= ButtonRelease; 792 mask |= ButtonPressMask; 793 mask |= ButtonRelease; 794 mask |= PointerMotionHintMask; 795 mask |= (PointerMotionHintMask | Button1MotionMask); 796 mask |= (PointerMotionHintMask | Button2MotionMask); 797 mask |= (PointerMotionHintMask | Button3MotionMask); 798 mask |= KeyPressMask; 799 XtRemoveEventHandler( XtWdg(), mask, FALSE, evthandler_piwdgx, this); 800 } 801 802 /* --Methode-- */ 803 void PIWdgX::CallDrawHandlers(int x0, int y0, int dx, int dy) 804 { 805 PIGraphicWin* g = new PIGraphicWin(this); 806 PIEventHandler* eh; 807 list<EvHand>::iterator it; 808 for(it= mDHlist.begin(); it != mDHlist.end(); it++) { 809 eh = (*it).evh; 810 eh->SetCurrentWdg(this); 811 eh->SetEventInfo(PIEvent_Draw, x0, y0, 0, PIKM_Blank, 0); 812 g->SaveGraphicAtt(); 813 eh->Draw(g, x0, y0, dx, dy); 814 g->RestoreGraphicAtt(); 815 } 816 delete g; 817 } 818 819 /* --Methode-- */ 820 void PIWdgX::CallEventHandlers(unsigned long evt, int px, int py, 821 int k, int km, unsigned long tm) 822 { 823 PIEventHandler* eh; 824 list<EvHand>::iterator it; 825 for(it= mEHlist.begin(); it != mEHlist.end(); it++) { 826 if (!((*it).mask & evt)) continue; 827 eh = (*it).evh; 828 eh->SetCurrentWdg(this); 829 eh->SetEventInfo((PIEventMask)evt, px, py, k, (PIKeyModifier)km, tm); 830 eh->ProcessEvent(); 831 } 832 } 833 834 835 // ------- Event Handler Xt ---------- 836 /* Nouvelle-Fonction */ 837 void evthandler_piwdgx (Widget wdgp, XtPointer usd, 838 XEvent* evt, Boolean* cont) 839 { 840 841 *cont = FALSE ; 842 PIWdgX* wx = (PIWdgX*)usd; 843 PIEventMask evm = PIEvent_None; 844 PIKeyModifier kmod = PIKM_Blank; 845 846 switch (evt->type) { 847 case Expose : 848 wx->CallDrawHandlers(evt->xexpose.x , evt->xexpose.y , evt->xexpose.width , evt->xexpose.height); 849 break; 850 case EnterNotify : 851 wx->CallEventHandlers(PIEvent_Enter, evt->xcrossing.x, evt->xcrossing.y, 0, 852 PIKM_Blank, evt->xcrossing.time); 853 PIXSetLastEventTimeSerial(evt->xcrossing.time, evt->xcrossing.serial); 854 break; 855 856 case LeaveNotify : 857 wx->CallEventHandlers(PIEvent_Leave, evt->xcrossing.x, evt->xcrossing.y, 0, 858 PIKM_Blank, evt->xcrossing.time); 859 PIXSetLastEventTimeSerial(evt->xcrossing.time, evt->xcrossing.serial); 860 break; 861 862 case ButtonPress : 863 if (evt->xbutton.state & ShiftMask) 864 kmod = (PIKeyModifier) (kmod | PIKM_Shift); 865 if (evt->xbutton.state & ControlMask) 866 kmod = (PIKeyModifier) (kmod | PIKM_Cntl); 867 if (evt->xbutton.state & Mod1Mask) 868 kmod = (PIKeyModifier) (kmod | PIKM_Alt); 869 if (evt->xbutton.button == 1) evm = PIEvent_But1Press; 870 else if (evt->xbutton.button == 2) evm = PIEvent_But2Press; 871 else if (evt->xbutton.button == 3) evm = PIEvent_But3Press; 872 wx->CallEventHandlers(evm, evt->xbutton.x, evt->xbutton.y, 0, 873 kmod, evt->xbutton.time); 874 PIXSetLastEventTimeSerial(evt->xbutton.time, evt->xbutton.serial); 875 break; 876 877 case ButtonRelease : 878 if (evt->xbutton.state & ShiftMask) 879 kmod = (PIKeyModifier) (kmod | PIKM_Shift); 880 if (evt->xbutton.state & ControlMask) 881 kmod = (PIKeyModifier) (kmod | PIKM_Cntl); 882 if (evt->xbutton.state & Mod1Mask) 883 kmod = (PIKeyModifier) (kmod | PIKM_Alt); 884 if (evt->xbutton.button == 1) evm = PIEvent_But1Release; 885 else if (evt->xbutton.button == 2) evm = PIEvent_But2Release; 886 else if (evt->xbutton.button == 3) evm = PIEvent_But3Release; 887 888 wx->CallEventHandlers(evm, evt->xbutton.x, evt->xbutton.y, 0, 889 kmod, evt->xbutton.time); 890 PIXSetLastEventTimeSerial(evt->xbutton.time, evt->xbutton.serial); 891 break; 892 893 case MotionNotify : 894 { 895 int xw, yw, xr, yr; 896 unsigned int key_but; 897 Window rw, cw; 898 if ( evt->xmotion.is_hint == NotifyHint ) { 899 if (!XQueryPointer( XtDisplay(wdgp), evt->xmotion.window, &rw, &cw, 900 &xr, &yr, &xw, &yw, &key_but) ) break ; 901 } 902 else { key_but = evt->xmotion.state ; xw = evt->xmotion.x; yw = evt->xmotion.y; } 903 if (key_but & Button1Mask ) evm = PIEvent_Ptr1Move; 904 else if (key_but & Button2Mask ) evm = PIEvent_Ptr2Move; 905 else if (key_but & Button3Mask ) evm = PIEvent_Ptr3Move; 906 else if ( !(key_but & (Button4Mask|Button5Mask)) ) evm = PIEvent_PtrMove; 907 908 if (key_but & ShiftMask) kmod = (PIKeyModifier) (kmod | PIKM_Shift); 909 if (key_but & ControlMask) kmod = (PIKeyModifier) (kmod | PIKM_Cntl); 910 if (key_but & Mod1Mask) kmod = (PIKeyModifier) (kmod | PIKM_Alt); 911 912 wx->CallEventHandlers(evm, xw, yw, 0, kmod, evt->xbutton.time); 913 PIXSetLastEventTimeSerial(evt->xmotion.time, evt->xmotion.serial); 914 } 915 break; 916 917 case KeyPress : 918 { 919 XComposeStatus cs; 920 KeySym key; 921 char buf[10]; 922 int i,nc,rkey; 923 924 925 kmod = PIKM_Blank; 926 nc = XLookupString(&(evt->xkey), buf, 10, &key, &cs); 927 928 if (evt->xkey.state & ShiftMask) 929 kmod = (PIKeyModifier) (kmod | PIKM_Shift); 930 if (evt->xkey.state & ControlMask) 931 kmod = (PIKeyModifier) (kmod | PIKM_Cntl); 932 if (evt->xkey.state & Mod1Mask) 933 kmod = (PIKeyModifier) (kmod | PIKM_Alt); 934 switch (key) { 935 case XK_Return : 936 rkey = PIK_Return; 937 break; 938 case XK_KP_Enter : 939 rkey = PIK_Enter; 940 break; 941 case XK_Up : 942 rkey = PIK_Up; 943 break; 944 case XK_Down : 945 rkey = PIK_Down; 946 break; 947 case XK_Left : 948 rkey = PIK_Left; 949 break; 950 case XK_Right : 951 rkey = PIK_Right; 952 break; 953 case XK_Prior : 954 rkey = PIK_Previous; 955 break; 956 case XK_Next : 957 rkey = PIK_Next; 958 break; 959 default : 960 rkey = 0; 961 break; 962 } 963 if (rkey > 0) wx->CallEventHandlers(PIEvent_Keyboard, evt->xkey.y, evt->xkey.x, 964 rkey, kmod, evt->xkey.time); 965 else for(i=0; i<nc; i++) 966 wx->CallEventHandlers(PIEvent_Keyboard, evt->xkey.y, evt->xkey.x, 967 (int)(buf[i]), kmod, evt->xkey.time); 968 PIXSetLastEventTimeSerial(evt->xkey.time, evt->xkey.serial); 969 970 } 971 break; 972 } 973 974 return; 975 } -
trunk/SophyaPI/PI/piwdgx.h
r158 r170 1 /* Classe pour enrobage generique des widgets Xt, Mac, etc */ 2 /* Reza 10/95 */ 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIWdgX 3 // Reza 10/95 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 3 5 4 6 #ifndef PIWDG_X_SEEN … … 62 64 virtual void PasteSelection(unsigned int typ, void *, unsigned int l); 63 65 66 // Gestion des EventHandler 67 virtual void AddDrawHandler(PIEventHandler* drwh, bool ad=false); 68 virtual void RemoveDrawHandler(PIEventHandler* drwh); 69 virtual void AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false); 70 virtual void RemoveEventHandler(PIEventHandler* evh); 71 72 // En public, pour permettre l'acces depuis call-back Xt 73 virtual void CallDrawHandlers(int x0, int y0, int dx, int dy); 74 virtual void CallEventHandlers(unsigned long evt, int px, int py, 75 int k, int km, unsigned long tm); 76 64 77 // Usage limite a a la version X11 65 78 inline SysDWdg XtWdg() const {return(sdw); };
Note:
See TracChangeset
for help on using the changeset viewer.