Changeset 369 in Sophya
- Timestamp:
- Aug 9, 1999, 2:31:39 PM (26 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 4 added
- 2 deleted
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/parradapter.cc
r204 r369 145 145 double minhis, maxhis, binwidth; 146 146 int under,over,tothis; 147 int *phis;148 int *q;147 int_4 *phis; 148 int_4 *q; 149 149 150 150 double MINDYNAMIC = 1.e-8; /* Gamme dynamique minimale (MaxAff-MinAff)*/ -
trunk/SophyaPI/PI/piapplmac.cc
r88 r369 23 23 24 24 PIInit piInit; 25 26 static PIApplication* cur_piapp = NULL; 27 PIApplication* PIApplicationGetApp() { return cur_piapp; } 28 25 29 26 30 class PISIOUXAttachment : public LAttachment { … … 74 78 menubar = new PIMenubar(this, "DefMenubar"); 75 79 topcont = new PIWindowMac(this, "TopLevel", PIWK_floating, sx, sy, 10, 45); 80 81 cur_piapp = this; 76 82 } 77 83 … … 96 102 97 103 /* --Methode-- */ 98 int PIApplicationMac::PrefXSize()104 void PIApplicationMac::PrefCompSz(int& szx, int& szy) 99 105 { 100 return(10); // $CHECK$ A remplacer Reza 13/02/98 106 szx = 10; 107 szy = 10; 101 108 } 102 109 103 110 /* --Methode-- */ 104 int PIApplicationMac::PrefYSize()111 void PIApplicationMac::ScreenSz(int& szx, int& szy) 105 112 { 106 return(18); // $CHECK$ A remplacer Reza 13/02/98 113 szx = 800; 114 szy = 600; 107 115 } 108 116 -
trunk/SophyaPI/PI/piapplmac.h
r88 r369 13 13 virtual void Stop(); 14 14 15 virtual int PrefXSize();16 virtual int PrefYSize();15 virtual void PrefCompSz(int& szx, int& szy); 16 virtual void ScreenSz(int& szx, int& szy); 17 17 18 18 virtual void RedirectOutStream(PIConsole* cons, unsigned char va= PIVA_Def); … … 24 24 typedef PIApplicationMac PIApplication; 25 25 26 // Pour recuperer un objet PIApplication 27 PIApplication* PIApplicationGetApp(); 26 28 #endif -
trunk/SophyaPI/PI/pibwdgmac.h
r88 r369 24 24 virtual void ActivateKeyboard(); 25 25 26 // Divers : couleur de fond, Effacement fenetre, forme de la souris 27 virtual void SetBackgroundColor(PIColors col=PI_White); 26 28 virtual void EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0); 27 29 virtual void SelPointerShape(PIPointer ptr=PI_ArrowPointer); 28 virtual void SetBackgroundColor(PIColors col=PI_White);29 30 virtual PIColors GetBackgroundColor(); 30 31 virtual PIPointer GetPointerShape(); 31 32 virtual void AssignKeyboard() {} 33 34 // Acces aux caracteristiques du dernier evenement 35 virtual void GetLastEventInfo(PIKeyModifier& kmod, unsigned long& tm); 32 36 33 37 protected: -
trunk/SophyaPI/PI/pigraph3d.cc
r204 r369 6 6 #include <math.h> 7 7 #include "pigraph3d.h" 8 9 #ifndef M_PI_2 10 #define M_PI_2 (M_PI/2) 11 #endif 8 12 9 13 //++ -
trunk/SophyaPI/PI/pigraphmac.cc
r89 r369 2 2 3 3 #include "pigraphmac.h" 4 #include "UDrawingState.h" 4 5 5 6 … … 29 30 30 31 /* --Methode-- */ 31 void PIGraphicMac::DrawString(PIGrCoord x, PIGrCoord y, char * s, int /*pos*/)32 void PIGraphicMac::DrawString(PIGrCoord x, PIGrCoord y, char const* s, int /*pos*/) 32 33 { 33 34 if (!mPane->FocusDraw()) { 34 35 ::MoveTo(x, y); 35 36 LStr255 ps = s; 36 ::TextFont(applFont); 37 StTextState saver; 38 myFont.Apply(); 37 39 ::DrawString(ps); 38 40 } … … 40 42 41 43 /* --Methode-- */ 42 void PIGraphicMac::DrawOpaqueString(PIGrCoord x, PIGrCoord y, char * s, int /*pos*/)44 void PIGraphicMac::DrawOpaqueString(PIGrCoord x, PIGrCoord y, char const* s, int /*pos*/) 43 45 { 44 46 if (mPane->FocusDraw()) { 45 47 ::MoveTo(x, y); 46 48 LStr255 ps = s; 47 ::TextFont(applFont); 49 StTextState saver; 50 myFont.Apply(); 48 51 Rect box; 49 52 box.left = x; … … 52 55 box.right = box.left + iWidth; 53 56 int z; 54 box.top = box.bottom + GetFontHeight(z,z);57 box.top = box.bottom + myFont.GetFontHeight(z,z); 55 58 ::TETextBox(s,strlen(s),&box,teForceLeft); 56 59 } … … 114 117 } 115 118 116 117 /* --Methode-- */ 118 void PIGraphicMac::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n) 119 /* --Methode-- */ 120 void PIGraphicMac::DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 121 { 122 if (mPane->FocusDraw()) { 123 Rect rr = {(int)y0-(int)dy, (int)x0-(int)dx, (int)y0+(int)dy, (int)x0+(int)dx}; 124 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 125 if (rr.left > rr.right) swap(rr.left, rr.right); 126 ::FrameOval(&rr); 127 } 128 } 129 130 /* --Methode-- */ 131 void PIGraphicMac::DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 132 { 133 if (mPane->FocusDraw()) { 134 Rect rr = {(int)y0-(int)dy, (int)x0-(int)dx, (int)y0+(int)dy, (int)x0+(int)dx}; 135 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 136 if (rr.left > rr.right) swap(rr.left, rr.right); 137 ::PaintOval(&rr); 138 } 139 } 140 141 142 /* --Methode-- */ 143 void PIGraphicMac::DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 119 144 { 120 145 PolyHandle h = MakePoly(x,y,n); … … 127 152 128 153 /* --Methode-- */ 129 void PIGraphicMac::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n )154 void PIGraphicMac::DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc) 130 155 { 131 156 PolyHandle h = MakePoly(x,y,n); … … 135 160 } 136 161 } 162 163 164 /* --Methode-- */ 165 void PIGraphicMac::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 166 double degdeb, double degfin) 167 { 168 if (mPane->FocusDraw()) { 169 Rect rr = {(int)y0-(int)dy, (int)x0-(int)dx, (int)y0+(int)dy, (int)x0+(int)dx}; 170 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 171 if (rr.left > rr.right) swap(rr.left, rr.right); 172 ::FrameArc(&rr, degdeb, degfin-degdeb); 173 } 174 } 175 176 /* --Methode-- */ 177 void PIGraphicMac::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 178 double degdeb, double degfin) 179 { 180 if (mPane->FocusDraw()) { 181 Rect rr = {(int)y0-(int)dy, (int)x0-(int)dx, (int)y0+(int)dy, (int)x0+(int)dx}; 182 if (rr.top > rr.bottom) swap(rr.top, rr.bottom); 183 if (rr.left > rr.right) swap(rr.left, rr.right); 184 ::PaintArc(&rr, degdeb, degfin-degdeb); 185 } 186 } 187 137 188 138 189 /* --Methode-- */ … … 364 415 void PIGraphicMac::SelFontSzPt(int npt, PIFontAtt att) 365 416 { 366 if (mPane->FocusDraw()) { 367 ::TextFont(applFont); 368 ::TextSize(npt); 369 switch(att) { 370 case PI_RomanFont: 371 ::TextFace(0); 372 break; 373 case PI_BoldFont: 374 ::TextFace(bold); 375 break; 376 case PI_ItalicFont: 377 ::TextFace(italic); 378 break; 379 } 380 } 381 mFSize = npt; 382 mFAtt = att; 417 myFont.SetFontSzPt(npt); 418 myFont.SetFontAtt(att); 383 419 } 384 420 … … 386 422 void PIGraphicMac::SelFont(PIFontSize sz, PIFontAtt att) 387 423 { 388 switch(sz) { 389 case PI_SmallSizeFont: 390 SelFontSzPt(9, att); 391 break; 392 case PI_NormalSizeFont: 393 SelFontSzPt(12, att); 394 break; 395 case PI_BigSizeFont: 396 SelFontSzPt(14, att); 397 break; 398 } 399 } 400 424 myFont.SetFontSz(sz); 425 myFont.SetFontAtt(att); 426 } 427 428 /* --Methode-- */ 429 void PIGraphicMac::SelFont(PIFont & fnt) 430 { 431 myFont = fnt; 432 } 401 433 402 434 … … 464 496 PIFontAtt PIGraphicMac::GetFontAtt() 465 497 { 466 return (m FAtt);498 return (myFont.GetFontAtt()); 467 499 } 468 500 … … 470 502 int PIGraphicMac::GetFontSize() 471 503 { 472 return (m FSize);504 return (myFont.GetFontSize()); 473 505 } 474 506 … … 491 523 } 492 524 493 /* --Methode-- */ 494 int PIGraphicMac::GetFontHeight(int& asc, int& desc) 495 { 496 if (mPane->FocusDraw()) { 497 FontInfo info; 498 GetFontInfo(&info); 499 asc = info.ascent; 500 desc = info.descent; 501 return (asc + desc); 502 } else { 503 return 0; 504 } 505 } 506 507 /* --Methode-- */ 508 PIGrCoord PIGraphicMac::CalcStringWidth(char const* s) 509 { 510 // if (mPane->FocusDraw()) 511 // ::TextFont(applFont); 512 return ::TextWidth(s,0,strlen(s)); 513 } 514 515 /* --Methode-- */ 516 void PIGraphicMac::SaveGraphicAtt() 517 { 518 // Pour optimier l'implementation de PIBaseWdgGen 519 520 // $CHECK$ faut faire quoi en plus de Gen ? 521 PIGraphicGen::SaveGraphicAtt(); 522 return; 523 } 524 525 /* --Methode-- */ 526 void PIGraphicMac::RestoreGraphicAtt() 527 { 528 PIGraphicGen::RestoreGraphicAtt(); 529 } 530 531 532 533 534 535 525 -
trunk/SophyaPI/PI/pigraphmac.h
r89 r369 1 // This may look like C code, but it is really -*- C++ -*- 2 // Module PI : Peida Interactive PIGraphicMac 3 // Trace graphiques- Implementation Mac E. Aubourg 99 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #ifndef PIGRAPHICMAC_H_SEEN 2 7 #define PIGRAPHICMAC_H_SEEN … … 13 18 // Trace graphiques 14 19 virtual void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 15 virtual void DrawString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);16 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, c har* s, int pos = 0);20 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 21 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 17 22 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 18 23 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); … … 20 25 virtual void DrawCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 21 26 virtual void DrawFCircle(PIGrCoord x0, PIGrCoord y0, PIGrCoord r); 22 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n); 23 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n); 27 virtual void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 28 virtual void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); 29 virtual void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 30 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 31 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 32 double degdeb, double degfin); 33 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 34 double degdeb, double degfin); 24 35 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 25 36 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); … … 33 44 virtual void SelBackground(PIColorMap& cmap, int cid); 34 45 virtual void SelGOMode(PIGOMode mod=PI_GOCopy); 46 virtual void SelFont(PIFont & fnt); 35 47 virtual void SelFont(PIFontSize sz=PI_NormalSizeFont, 36 48 PIFontAtt att=PI_RomanFont); … … 53 65 virtual int GetMarkerSize(); 54 66 55 virtual int GetFontHeight(int& asc, int& desc);56 virtual PIGrCoord CalcStringWidth(char const* s);67 //virtual int GetFontHeight(int& asc, int& desc); 68 //virtual PIGrCoord CalcStringWidth(char const* s); 57 69 58 70 // Sauvegarde des attributs graphiques 59 virtual void SaveGraphicAtt();60 virtual void RestoreGraphicAtt();71 // virtual void SaveGraphicAtt(); 72 // virtual void RestoreGraphicAtt(); 61 73 62 74 protected: … … 67 79 PIColors mFCol, mBCol; 68 80 PIGOMode mGOm; 69 PIFontAtt mFAtt;70 81 PILineAtt mLAtt; 71 int mFSize;72 82 PIMarker mMrk; 73 83 int mMrkSz; -
trunk/SophyaPI/PI/pilistmac.cc
r64 r369 35 35 36 36 /* --Methode-- */ 37 void PIListMac::DeleteItem (PIMessage msg)37 void PIListMac::DeleteItemMsg(PIMessage msg) 38 38 { 39 39 mPIPPList->DeleteItem(msg); … … 72 72 73 73 /* --Methode-- */ 74 void PIListMac::SelectItem (PIMessage msg)74 void PIListMac::SelectItemMsg(PIMessage msg) 75 75 { 76 76 mPIPPList->SelectItem(msg); … … 85 85 86 86 /* --Methode-- */ 87 void PIListMac::ClearSelItem (PIMessage msg)87 void PIListMac::ClearSelItemMsg(PIMessage msg) 88 88 { 89 89 mPIPPList->ClearSelItem(msg); -
trunk/SophyaPI/PI/pilistmac.h
r64 r369 13 13 virtual void AppendItem(const char * item, PIMessage msg); 14 14 virtual void DeleteItem(const char *item); 15 virtual void DeleteItem(PIMessage msg); 15 virtual void DeleteItemMsg(PIMessage msg); 16 virtual void DeleteAllItems(); 17 18 virtual int GetNbItems(); 19 virtual PIMessage GetItemMsg(int n); 20 virtual string GetItem(int n); 16 21 17 22 virtual void SetMultipleSelect(bool ms=false); … … 22 27 23 28 virtual void SelectItem(const char * item); 24 virtual void SelectItem (PIMessage msg);29 virtual void SelectItemMsg(PIMessage msg); 25 30 virtual void ClearSelItem(const char * item); 26 virtual void ClearSelItem (PIMessage msg);31 virtual void ClearSelItemMsg(PIMessage msg); 27 32 28 33 -
trunk/SophyaPI/PI/pimenubarmac.cc
r69 r369 13 13 14 14 void 15 PIMenubarMac::AppendMenu(PI PDMenu *pdm)15 PIMenubarMac::AppendMenu(PIMenu *pdm) 16 16 { 17 17 LMenuBar::GetCurrentMenuBar()->InstallMenu(pdm->macMenu, InstallMenu_AtEnd); 18 18 } 19 20 void 21 PIMenubarMac::RemoveMenu(PIMenu *pdm) 22 { 23 LMenuBar::GetCurrentMenuBar()->RemoveMenu(pdm->macMenu); 24 } 25 26 void 27 PIMenubarMac::SetSensitivity(PIMenu *pdm, bool sens) 28 { 29 30 } 31 32 bool 33 PIMenubarMac::IsSensitive(PIMenu *pdm) 34 { 35 return true; 36 } -
trunk/SophyaPI/PI/pimenubarmac.h
r2 r369 8 8 PIMenubarMac(PIApplicationGen* par, char* nom); 9 9 ~PIMenubarMac(); 10 virtual void AppendMenu(PIPDMenu *pdm); 10 11 virtual void AppendMenu(PIMenu *pdm); 12 virtual void RemoveMenu(PIMenu *pdm); 13 virtual void SetSensitivity(PIMenu *pdm, bool sens=true); 14 virtual bool IsSensitive(PIMenu *pdm); 11 15 12 16 }; -
trunk/SophyaPI/PI/pimenumac.cc
r88 r369 2 2 #include "pimenumac.h" 3 3 #include <algorithm> 4 #include <iostream> 4 5 5 6 int PIMenuMac::lastId = 1024; 6 list<PIMenuMac*> PIMenuMac::sMenus; 7 8 PIMenuMac::PIMenuMac(PIMsgHandler *par, char *nom, PIMenuType pdpu) 7 vector<PIMenuMac::menuInfo> mMenuInfos; 8 9 /* --Methode-- */ 10 PIMenuMac::PIMenuMac(PIWdg* par, const char *nom, PIMenuType pdpu) 9 11 : PIMenuGen(par, nom, pdpu) 10 12 { 11 13 macMenu = new LMenu(lastId, LStr255(nom)); 12 mMenuId = lastId; 13 sMenus.push_back(this); 14 menuInfo info; 15 info.mId = lastId; 16 info.pimenu = this; 17 mMenuInfos.push_back(info); 14 18 lastId++; 15 19 } 16 20 17 21 22 /* --Methode-- */ 18 23 PIMenuMac::~PIMenuMac() 19 24 { 20 25 LMenuBar::GetCurrentMenuBar()->RemoveMenu(macMenu); 21 sMenus.remove(this);26 mMenuInfos.erase(mMenuInfos.begin() + GetMenuNum()); 22 27 delete macMenu; 23 28 } 24 29 25 int 26 PIMenuMac::FindItemByMsg(PIMessage msg) 27 { 28 if (mMsgs.size() == 0) return -1; 29 int i = find(mMsgs.begin(), mMsgs.end(), msg) - mMsgs.begin(); 30 return (i>=mMsgs.size()) ? -1 : i; 31 } 32 33 int 34 PIMenuMac::FindItemByName(string const& s) 35 { 36 int n = ::CountMItems(GetMacMenuHandle()); 37 for (int i=0; i<n; i++) 38 if (GetMenuItemText(i) == s) 39 return i; 40 return -1; 41 } 42 43 44 void 45 PIMenuMac::AppendItem(char* nom, PIMessage msg, char* sc) // sc = short-cut , raccourci clavier 46 { 30 /* --Methode-- */ 31 void PIMenuMac::AppendItem(const char* nom, PIMessage msg, char* sc) 32 { 33 AddItem(nom, msg, 0, sc, NULL); 34 } 35 36 /* --Methode-- */ 37 void PIMenuMac::AppendCheckItem(const char* nom, PIMessage msg, char* sc) 38 { 39 AddItem(nom, msg, 1, sc, NULL); 40 } 41 42 /* --Methode-- */ 43 void PIMenuMac::AppendPDMenu(PIMenuGen *pdm, char* sc) 44 { 45 if (pdm->MType() != k_PulldownMenu) { 46 cerr << "PIMenuX::AppendPDMenu()/Erreur: PullDownMenu seulement ... " << endl; 47 return; 48 } 49 AddItem(NULL, pdm->Msg(), 2, sc, (PIMenuMac*)pdm); 50 } 51 52 /* --Methode-- */ 53 void PIMenuMac::AddItem(const char* nom, PIMessage msg, int tog, char* sc, PIMenuMac *pdm) 54 { 55 macMenu->InsertCommand("\ptemp", -2000, 1000); 56 MenuHandle mh = GetMacMenuHandle(); 57 short i = ::CountMenuItems(mh); 47 58 LStr255 titre(nom); 48 if (titre.BeginsWith("-",1)) 49 titre.Insert(" ", 1, 0); 50 if (sc) { 51 titre.Append('/'); 52 titre.Append(*sc); 59 ::SetMenuItemText(mh, i, titre); 60 61 // Gestion menus hiérarchiques 62 if (tog == 2 && pdm != NULL) { 63 ::SetItemCmd(mh, i, hMenuCmd); 64 ::SetItemMark(mh, i, pdm->GetMacMenuID()); 53 65 } 54 macMenu->InsertCommand(titre, -2000, 1000); // ou cmd_UseMenuItem ??? 55 mMsgs.push_back(msg); 56 } 57 58 void 59 PIMenuMac::CheckItemNum(int n, bool st) 60 { 61 if (n<0 || n >= mMsgs.size()) return; // $CHECK$ exception ? 66 // Le menu hierarchique sera "insere" au moment de l'insertion dans la 67 // menubar... 68 69 itemInfo info; 70 info.pimsg = msg; 71 info.name = nom; 72 mItemInfos.push_back(info); 73 } 74 75 /* --Methode-- */ 76 int PIMenuMac::GetItemNum(const char *nom) 77 { 78 int j=0; 79 for (vector<itemInfo>::iterator i = mItemInfos.begin(); i != mItemInfos.end(); i++,j++) 80 if ((*i).name == nom) return j; 81 return(-1); 82 } 83 84 /* --Methode-- */ 85 int PIMenuMac::GetItemNumMsg(PIMessage msg) 86 { 87 int j=0; 88 for (vector<itemInfo>::iterator i = mItemInfos.begin(); i != mItemInfos.end(); i++,j++) 89 if ((*i).pimsg == msg) return j; 90 return(-1); 91 } 92 93 /* --Methode-- */ 94 int PIMenuMac::GetMenuNum() 95 { 96 int j=0; 97 for (vector<menuInfo>::iterator i = mMenuInfos.begin(); i != mMenuInfos.end(); i++,j++) 98 if ((*i).pimenu == this) return j; 99 return(-1); 100 } 101 102 /* --Methode-- */ 103 int PIMenuMac::GetMenuNum(short menuId) 104 { 105 int j=0; 106 for (vector<menuInfo>::iterator i = mMenuInfos.begin(); i != mMenuInfos.end(); i++,j++) 107 if ((*i).mId == menuId) return j; 108 return(-1); 109 } 110 111 /* --Methode-- */ 112 PIMenu* PIMenuMac::GetMenu(short menuId) 113 { 114 int j=0; 115 for (vector<menuInfo>::iterator i = mMenuInfos.begin(); i != mMenuInfos.end(); i++,j++) 116 if ((*i).mId == menuId) return (*i).pimenu; 117 return(NULL); 118 } 119 120 121 /* --Methode-- */ 122 void 123 PIMenuMac::SetStateNum(int n, bool st) 124 { 125 if (n<0 || n >= mItemInfos.size()) return; // $CHECK$ exception ? 62 126 ::CheckItem(macMenu->GetMacMenuH(), n, st); 63 127 } 64 128 65 void 66 PIMenuMac::CheckItemMsg(PIMessage msg, bool st) 67 { 68 int i = FindItemByMsg(msg); 69 if (i>=0) 70 CheckItemNum(i, st); 71 } 72 73 void 74 PIMenuMac::CheckItem(char* nom, bool st) 75 { 76 int i = FindItemByName(nom); 77 if (i>=0) 78 CheckItemNum(i, st); 129 /* --Methode-- */ 130 void 131 PIMenuMac::SetStateMsg(PIMessage msg, bool st) 132 { 133 int i = GetItemNumMsg(msg); 134 if (i>=0) 135 SetStateNum(i, st); 136 } 137 138 /* --Methode-- */ 139 void 140 PIMenuMac::SetState(const char* nom, bool st) 141 { 142 int i = GetItemNum(nom); 143 if (i>=0) 144 SetStateNum(i, st); 79 145 } 80 146 … … 82 148 PIMenuMac::DeleteItemNum(int n) 83 149 { 84 if (n<0 || n >= m Msgs.size()) return; // $CHECK$ exception ?150 if (n<0 || n >= mItemInfos.size()) return; // $CHECK$ exception ? 85 151 macMenu->RemoveItem(n+1); 86 m Msgs.erase(mMsgs.begin()+n);152 mItemInfos.erase(mItemInfos.begin()+n); 87 153 } 88 154 … … 90 156 PIMenuMac::DeleteItemMsg(PIMessage msg) 91 157 { 92 int i = FindItemByMsg(msg);158 int i = GetItemNumMsg(msg); 93 159 if (i>=0) 94 160 DeleteItemNum(i); … … 96 162 97 163 void 98 PIMenuMac::DeleteItem(c har* nom)99 { 100 int i = FindItemByName(nom);164 PIMenuMac::DeleteItem(const char* nom) 165 { 166 int i = GetItemNum(nom); 101 167 if (i>=0) 102 168 DeleteItemNum(i); 103 169 } 104 170 105 106 107 171 void 108 172 PIMenuMac::ItemSelected(int item) 109 173 { 110 if (item<0 || item >= mMsgs.size()) return; // $CHECK$ exception ? 111 Send(mMsgs[item], PIMsg_Click, (void*) GetMenuItemText(item).c_str()); 112 } 174 if (item<0 || item >= mItemInfos.size()) return; // $CHECK$ exception ? 175 Send(mItemInfos[item].pimsg, PIMsg_Click, (void*) mItemInfos[item].name.c_str()); 176 } 177 178 string 179 PIMenuMac::GetMenuItemText(int item) 180 { 181 if (item<0 || item >= mItemInfos.size()) return ""; // $CHECK$ exception ? 182 return mItemInfos[item].name; 183 } 184 185 PIMessage 186 PIMenuMac::GetMenuItemMsg(int item) 187 { 188 if (item<0 || item >= mItemInfos.size()) return -1; // $CHECK$ exception ? 189 return mItemInfos[item].pimsg; 190 } 191 113 192 114 193 … … 121 200 {} 122 201 123 void124 PIMenuMac::Hide()125 {}126 127 PIMenuMac*128 PIMenuMac::findMenu(int id)129 {130 list<PIMenuMac*>::iterator i = sMenus.begin();131 132 while (i != sMenus.end()) {133 if ((*i)->MenuId()==id) return *i;134 i++;135 }136 137 return NULL;138 }139 202 140 203 MenuHandle … … 151 214 152 215 153 string154 PIMenuMac::GetMenuItemText(int item)155 {156 if (item<0 || item >= mMsgs.size()) return ""; // $CHECK$ exception ?157 MenuHandle h = GetMacMenuHandle();158 Str255 txt;159 ::GetMenuItemText(h, item+1, txt);160 p2cstr(txt);161 return (char*) txt;162 }163 164 PIMenuMac::GetMenuItemMsg(int item)165 {166 if (item<0 || item >= mMsgs.size()) return -1; // $CHECK$ exception ?167 return mMsgs[item];168 }169 170 171 172 /* --Methode-- */173 PIPUMenuMac::PIPUMenuMac(PIMsgHandler* par, char* nom)174 : PIMenuMac(par, nom, k_PopupMenu)175 {176 }177 178 /* --Methode-- */179 PIPUMenuMac::~PIPUMenuMac()180 {181 }182 183 void184 PIPUMenuMac::Show()185 {186 Point pt;187 ::GetMouse(&pt);188 ::LocalToGlobal(&pt);189 int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),pt.v,pt.h,1);190 ItemSelected(item);191 }192 193 void194 PIPUMenuMac::Show(PIWdg *w, int px, int py)195 {196 int item = ::PopUpMenuSelect(macMenu->GetMacMenuH(),py,px,1);197 ItemSelected(item);198 }199 200 /* --Methode-- */201 PIPDMenuMac::PIPDMenuMac(PIMsgHandler* par, char* nom)202 : PIMenuMac(par, nom, k_PulldownMenu)203 {204 }205 206 /* --Methode-- */207 PIPDMenuMac::~PIPDMenuMac()208 {209 }210 -
trunk/SophyaPI/PI/pimenumac.h
r88 r369 10 10 class PIMenuMac : public PIMenuGen { 11 11 public: 12 PIMenuMac(PI MsgHandler* par, char* nom, PIMenuType pdpu);12 PIMenuMac(PIWdg* par, const char* nom, PIMenuType pdpu=k_UTMenu); 13 13 ~PIMenuMac(); 14 14 15 virtual void AppendItem(char* nom, PIMessage msg, char* sc=NULL); 15 virtual void AppendItem(const char* nom, PIMessage msg, char* sc=NULL); 16 virtual void AppendCheckItem(const char* nom, PIMessage msg, char* sc=NULL); 17 virtual void AppendPDMenu(PIMenuGen *pdm, char* sc=NULL); 16 18 17 virtual void DeleteItem(char *nom);18 19 19 virtual void DeleteItem(const char *nom); 20 virtual void DeleteItemMsg(PIMessage msg); 21 virtual void DeleteItemNum(int n); 20 22 21 virtual void CheckItem(char *nom, bool st=false); 22 virtual void CheckItemMsg(PIMessage msg, bool st=false); 23 virtual void CheckItemNum(int n, bool st=false); 24 25 virtual void Show(); 26 virtual void Show(PIWdg *w, int px, int py); 23 virtual void SetSensitivity(const char *nom, bool sens=true); 24 virtual void SetSensitivityMsg(PIMessage msg, bool sens=true); 25 virtual void SetSensitivityNum(int n, bool sens=true); 27 26 28 virtual void Hide(); 29 30 int MenuId() {return mMenuId;} 31 void ItemSelected(int item); 32 33 string GetMenuItemText(int item); 34 int GetMenuItemMsg(int item); 35 int FindItemByMsg(PIMessage msg); 36 int FindItemByName(string const& nom); 37 27 virtual bool IsSensitive(const char *nom); 28 virtual bool IsSensitiveMsg(PIMessage msg); 29 virtual bool IsSensitiveNum(int n); 30 31 virtual void SetState(const char *nom, bool st=false); 32 virtual void SetStateMsg(PIMessage msg, bool st=false); 33 virtual void SetStateNum(int n, bool st=false); 34 35 virtual bool GetState(const char *nom); 36 virtual bool GetStateMsg(PIMessage msg); 37 virtual bool GetStateNum(int n); 38 39 virtual void Show(); 40 virtual void Show(PIWdg *w, int px, int py); 41 42 LMenu* GetPPMenu() {return macMenu;} 43 void ItemSelected(int item); 44 string GetMenuItemText(int item); 45 PIMessage GetMenuItemMsg(int item); 38 46 protected: 39 static PIMenuMac* findMenu(int id);40 47 LMenu* macMenu; 41 int mMenuId; 42 vector<PIMessage> mMsgs; 48 struct menuInfo { 49 short mId; 50 PIMenuMac* pimenu; 51 }; 52 struct itemInfo { 53 PIMessage pimsg; 54 string name; 55 }; 56 static vector<menuInfo> mMenuInfos; 57 vector<itemInfo> mItemInfos; 43 58 static int lastId; 44 static list<PIMenuMac*> sMenus;45 59 46 60 friend class PIMenubarMac; … … 51 65 ResIDT GetMacMenuID(); 52 66 53 54 }; 55 56 // Menu popup 57 class PIPUMenuMac : public PIMenuMac 58 { 59 public: 60 PIPUMenuMac(PIMsgHandler* par, char* nom); 61 ~PIPUMenuMac(); 62 virtual void Show(); 63 virtual void Show(PIWdg *w, int px, int py); 64 }; 65 66 // Menu pull-down 67 class PIPDMenuMac : public PIMenuMac 68 { 69 public: 70 PIPDMenuMac(PIMsgHandler* par, char* nom); 71 ~PIPDMenuMac(); 67 int GetItemNum(const char* nom); 68 int GetItemNumMsg(PIMessage msg); 69 int GetMenuNum(); 70 static int GetMenuNum(short menuId); 71 static PIMenuMac* GetMenu(short menuId); 72 void AddItem(const char* nom, PIMessage msg, int tog, char* sc, PIMenuMac *pdm); 72 73 }; 73 74 74 75 75 76 typedef PIMenuMac PIMenu; 76 typedef PIPUMenuMac PIPUMenu;77 typedef PIPDMenuMac PIPDMenu;78 77 79 78 #endif -
trunk/SophyaPI/PI/pioptmenumac.cc
r69 r369 3 3 4 4 /* --Methode-- */ 5 PIOptMenuMac::PIOptMenuMac(PIContainerGen* par, PIPUMenu *pdm,5 PIOptMenuMac::PIOptMenuMac(PIContainerGen* par, char const* nom, 6 6 int sx, int sy, int px, int py) 7 : PIOptMenuGen(par, pdm, sx, sy, px, py), mPUMenu(pdm)7 : PIOptMenuGen(par, nom, sx, sy, px, py) 8 8 { 9 9 delete mPane; 10 //LStr255 titre(Nom().c_str()); 10 11 char buff[128]; 12 strncpy(buff, nom, 64); 13 strcat(buff,"_Menu"); 14 mMen = new PIMenu((PIWdg*)par, buff, k_PopupMenu); 15 mMen->SetMsgParent(this); 11 16 LStr255 titre(""); 12 17 … … 17 22 int titleWidth = ::StringWidth(titre); 18 23 19 //mPane = new LStdPopupMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1);20 24 mPane = new PIPPOptMenu(mPaneInfo, msg_Click, 0, 200, titleWidth+5, popupMenuProc/*+popupVariableWidth*/, 130, titre, 0, 1); 21 //macMenu = ((LStdPopupMenu*)mPane)->GetMacMenuH();22 25 23 // On va changer la resource de menu au passage... 24 // InsertMenu(pdm->GetMacMenuHandle(), hierMenu); 25 // PopupPrivateDataHandle dataH = 26 //// (PopupPrivateDataHandle) (**((LStdPopupMenu*)mPane)->GetMacControl()).contrlData; 27 // (**dataH).mHandle = pdm->GetMacMenuHandle(); 28 // (**dataH).mID = pdm->GetMacMenuID(); 29 30 ((PIPPOptMenu*)mPane)->SetMenu(pdm); 26 ((PIPPOptMenu*)mPane)->SetMenu(mMen); 31 27 ((LStdPopupMenu*)mPane)->AddListener(this); 32 28 … … 37 33 PIOptMenuMac::~PIOptMenuMac() 38 34 { 35 delete mMen; 39 36 } 40 37 … … 42 39 void PIOptMenuMac::Process(PIMessage msg, PIMsgHandler* sender, void* data) 43 40 { 44 Select((char *)data, UserMsg(msg)); // Reza 17/10/96 $CHECK$ ??? 45 ReSend(msg, sender, data); 41 if (sender == mMen) { 42 SetValue(UserMsg(msg)); 43 ReSend(msg, this, NULL); 44 } 45 return; 46 46 } 47 47 … … 50 50 { 51 51 // if (inMessage == msg_Click) 52 mPUMenu->ItemSelected(((LStdPopupMenu*)mPane)->GetValue()-1); 53 } 54 55 void 56 PIOptMenuMac::Select(char *txt, PIMessage msg) 57 { // Ca doit faire quoi ???? 58 mStext = txt; mSmsg = msg; 52 int n = ((LStdPopupMenu*)mPane)->GetValue()-1; 53 mMen->ItemSelected(n); 54 mStext = mMen->GetMenuItemText(n); 55 mSmsg = mMen->GetMenuItemMsg(n); 59 56 } 60 57 … … 62 59 void PIOptMenuMac::SetValueStr(string & s) 63 60 { 64 int n;65 n=mPUMenu->FindItemByName((char *)s.c_str());66 if (n < 0) return;61 int n; 62 n=mMen->GetItemNum((char *)s.c_str()); 63 if (n < 0) return; 67 64 68 ((LStdPopupMenu*)mPane)->SetValue(n+1);69 mStext = s;70 mSmsg = mPUMenu->GetMenuItemMsg(n);71 72 return;65 StopListening(); 66 ((LStdPopupMenu*)mPane)->SetValue(n+1); 67 StartListening(); 68 mStext = s; 69 mSmsg = mMen->GetMenuItemMsg(n); 73 70 } 74 71 … … 76 73 void PIOptMenuMac::SetValue(PIMessage msg) 77 74 { 78 int n;79 n=mPUMenu->FindItemByMsg(msg);80 if (n < 0) return;75 int n; 76 n=mMen->GetItemNumMsg(msg); 77 if (n < 0) return; 81 78 82 StopListening(); 83 ((LStdPopupMenu*)mPane)->SetValue(n+1); 84 StartListening(); 85 mStext = mPUMenu->GetMenuItemText(n); 86 mSmsg = msg; 87 88 return; 79 StopListening(); 80 ((LStdPopupMenu*)mPane)->SetValue(n+1); 81 StartListening(); 82 mStext = mMen->GetMenuItemText(n); 83 mSmsg = msg; 89 84 } 90 85 -
trunk/SophyaPI/PI/pioptmenumac.h
r23 r369 6 6 class PIOptMenuMac : public PIOptMenuGen { 7 7 public: 8 PIOptMenuMac(PIContainerGen* par, PIPUMenu *pdm,8 PIOptMenuMac(PIContainerGen* par, const char* nom, 9 9 int sx=10, int sy=10, int px=0, int py=0); 10 10 ~PIOptMenuMac(); … … 18 18 virtual void SetValue(PIMessage msg); 19 19 20 inline void Select(char *txt, PIMessage msg); // public ou protege ???21 22 20 23 21 protected: 24 22 string mStext; 25 23 PIMessage mSmsg; 26 //MenuHandle macMenu;27 PIPUMenu* mPUMenu;28 24 }; 29 25 -
trunk/SophyaPI/PI/pipixmapmac.cc
r88 r369 12 12 13 13 /* --Methode-- */ 14 void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy, bool refr )14 void PIPixmapMac::SetPixmap(unsigned char *pix, int sx, int sy, bool refr, int ox, int oy) 15 15 { 16 16 if (nx != sx || ny != sy) -
trunk/SophyaPI/PI/pipixmapmac.h
r88 r369 11 11 virtual ~PIPixmapMac(); 12 12 13 virtual void SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true );13 virtual void SetPixmap(unsigned char *pix, int sx, int sy, bool refr=true, int ox=0, int oy=0); 14 14 virtual void Draw(PIGraphic* g); 15 15 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); -
trunk/SophyaPI/PI/pippmenubar.cc
r69 r369 20 20 int menuItem = LoWord(outMenuChoice)-1; // Dans PI les menu items commencent a 0 21 21 22 PIMenuMac* menu = PIMenuMac:: findMenu(menuId);22 PIMenuMac* menu = PIMenuMac::GetMenu(menuId); 23 23 if (menu) 24 24 menu->ItemSelected(menuItem); … … 37 37 int menuItem = LoWord(outMenuChoice)-1; // Dans PI les menu items commencent a 0 38 38 39 PIMenuMac* menu = PIMenuMac:: findMenu(menuId);39 PIMenuMac* menu = PIMenuMac::GetMenu(menuId); 40 40 if (menu) 41 41 menu->ItemSelected(menuItem); -
trunk/SophyaPI/PI/pippoptmenu.cc
r69 r369 47 47 48 48 void 49 PIPPOptMenu::SetMenu(PI PUMenu* pdm)49 PIPPOptMenu::SetMenu(PIMenu* pdm) 50 50 { 51 51 // On va changer la resource de menu au passage... -
trunk/SophyaPI/PI/pippoptmenu.h
r69 r369 29 29 LStream *inStream); 30 30 31 void SetMenu(PI PUMenu* pdm);31 void SetMenu(PIMenu* pdm); 32 32 protected: 33 33 virtual void HotSpotResult( -
trunk/SophyaPI/PI/pippviewadapter.cc
r66 r369 26 26 PIBindingKind right, PIBindingKind bottom) 27 27 { 28 piBindings.left = left;29 piBindings.right = right;30 piBindings.top = top;28 piBindings.left = left; 29 piBindings.right = right; 30 piBindings.top = top; 31 31 piBindings.bottom = bottom; 32 32 } 33 34 bool PIPPViewAdapter::GetBinding(PIBindingKind& left, PIBindingKind& top, 35 PIBindingKind& right, PIBindingKind& bottom) 36 { 37 left = (PIBindingKind)piBindings.left; 38 right = (PIBindingKind)piBindings.right; 39 top = (PIBindingKind)piBindings.top; 40 bottom = (PIBindingKind)piBindings.bottom; 41 42 return false; 43 } 44 33 45 34 46 void PIPPViewAdapter::AdaptToSuperFrameSize( -
trunk/SophyaPI/PI/pippviewadapter.h
r66 r369 15 15 virtual void SetBinding(PIBindingKind left, PIBindingKind top, 16 16 PIBindingKind right, PIBindingKind bottom); 17 bool GetBinding(PIBindingKind& left, PIBindingKind& top, 18 PIBindingKind& right, PIBindingKind& bottom); 17 19 virtual void AdaptToSuperFrameSize( 18 20 Int32 inSurrWidthDelta, -
trunk/SophyaPI/PI/pistdwdgmac.cc
r88 r369 23 23 24 24 PIButtonMac::PIButtonMac(PIContainerGen *par, char *nom, PIMessage msg, 25 int sx, int sy, int px, int py , PIBtnSign bsgn)26 : PIButtonGen(par, nom, msg, sx, sy, px, py , bsgn)25 int sx, int sy, int px, int py) 26 : PIButtonGen(par, nom, msg, sx, sy, px, py) 27 27 { 28 28 delete mPane; … … 36 36 37 37 void 38 PIButtonMac::SetLabel(string const& str) 39 { 40 LStr255 sstr(str.c_str()); 41 ((LStdButton*)mPane)->SetDescriptor(sstr); 42 } 43 44 45 void 38 46 PIButtonMac::ListenToMessage(MessageT inMessage, void *) 39 47 { … … 46 54 #include <LEditField.h> 47 55 48 PITextMac::PITextMac(PIContainerGen *par, c har *nom,56 PITextMac::PITextMac(PIContainerGen *par, const char *nom, 49 57 int sx, int sy, int px, int py) 50 58 : PITextGen(par, nom, sx, sy, px, py) … … 54 62 mPane = new LEditField(mPaneInfo, titre, 130, 255, true, true, NULL, LCommander::GetTopCommander()); 55 63 } 64 65 PITextMac::PITextMac(PIContainerGen *par, const char *nom, 66 bool vsb, bool hsb, 67 int sx, int sy, int px, int py) 68 : PITextGen(par, nom, vsb, hsb, sx, sy, px, py) 69 { 70 delete mPane; 71 LStr255 titre(nom); 72 mPane = new LEditField(mPaneInfo, titre, 130, 255, true, true, NULL, LCommander::GetTopCommander()); 73 } 74 56 75 57 76 PITextMac::~PITextMac() … … 127 146 128 147 void 148 PIScaleMac::GetMinMax(int &min, int &max) 149 { 150 min = ((LStdControl*)mPane)->GetMinValue(); 151 max = ((LStdControl*)mPane)->GetMaxValue(); 152 } 153 154 void 129 155 PIScaleMac::SetValue(int val) 130 156 { … … 219 245 220 246 void 247 PIScrollBarMac::GetMinMax(int &min, int &max) 248 { 249 min = ((LStdControl*)mPane)->GetMinValue(); 250 max = ((LStdControl*)mPane)->GetMaxValue(); 251 } 252 253 254 void 221 255 PIScrollBarMac::SetValue(int val) 222 256 { -
trunk/SophyaPI/PI/pistdwdgmac.h
r98 r369 11 11 int sx=10, int sy=10, int px=0, int py=0); 12 12 virtual ~PILabelMac(); 13 virtual void SetLabel(string const&); 13 14 }; 14 15 … … 17 18 public: 18 19 PIButtonMac(PIContainerGen *par, char *nom, PIMessage msg = PIMsg_Click, 19 int sx=10, int sy=10, int px=0, int py=0, 20 PIBtnSign bsgn = PIBtn_Label); 20 int sx=10, int sy=10, int px=0, int py=0); 21 21 virtual ~PIButtonMac(); 22 virtual void SetLabel(string const&); 22 23 virtual void ListenToMessage(MessageT inMessage, void *ioParam); 23 24 virtual void ActivatePress(bool=false) {} … … 27 28 { 28 29 public: 29 PITextMac(PIContainerGen *par, char *nom, 30 PITextMac(PIContainerGen *par, const char *nom, 31 int sx=10, int sy=10, int px=0, int py=0); 32 PITextMac(PIContainerGen *par, const char *nom, 33 bool vsb, bool hsb, 30 34 int sx=10, int sy=10, int px=0, int py=0); 31 35 virtual ~PITextMac(); … … 47 51 48 52 virtual void SetMinMax(int min, int max); 53 virtual void GetMinMax(int& min, int& max); 49 54 virtual void SetValue(int val); 50 55 virtual int GetValue(); … … 67 72 virtual void ActivateDrag(bool /*acd*/=false) {}; 68 73 virtual void SetMinMax(int min, int max); 74 virtual void GetMinMax(int& min, int& max); 69 75 virtual void SetValue(int val); 70 76 virtual int GetValue(); -
trunk/SophyaPI/PI/piupdattachment.cc
r88 r369 23 23 switch(msg) { 24 24 case msg_DrawOrPrint: 25 myWdg->Draw(myGraphic );25 myWdg->Draw(myGraphic,0,0,999999,999999); 26 26 break; 27 27 case msg_Resize: -
trunk/SophyaPI/PI/piwdgmac.cc
r88 r369 122 122 } 123 123 124 bool 125 PIWdgMac::GetBinding(PIBindingKind& left, PIBindingKind& top, 126 PIBindingKind& right, PIBindingKind& bottom) 127 { 128 if (mAdapter) 129 mAdapter->GetBinding(left, top, right, bottom); 130 //else 131 // mPane->SetBinding(left, top, right, bottom); 132 return false; 133 } 134 135 void PIWdgMac::Refresh() 136 { 137 if (mPane) mPane->Refresh(); 138 if (mAdapter) mAdapter->Refresh(); 139 } 140 141 124 142 int 125 143 PIWdgMac::XSize() … … 169 187 bool PIWdgMac::ClaimSelection(unsigned int) 170 188 { 171 int l;189 unsigned int l; 172 190 char* txt = SelectionString(l); 173 191 LClipboard::GetClipboard()->SetData('TEXT',txt,l,true); … … 211 229 212 230 /* --Methode-- */ 213 char* PIWdgMac::SelectionString( int& len)231 char* PIWdgMac::SelectionString(unsigned int& len) 214 232 { 215 233 char *rs = new char[60]; … … 250 268 return(mPane->IsVisible()); 251 269 } 270 271 272 // -------- La classe PIScreenBuffer ---------- 273 /* --Methode-- */ 274 PIScreenBuffer::PIScreenBuffer(int sx, int sy) 275 { 276 if (sx < 1) sx = 1; 277 if (sy < 1) sy = 1; 278 Rect bounds = {0,0,sy,sx}; 279 mGWorld = new LGWorld(bounds); 280 } 281 /* --Methode-- */ 282 PIScreenBuffer::~PIScreenBuffer() 283 { 284 delete mGWorld; 285 } 286 287 /* --Methode-- */ 288 int PIScreenBuffer::XSize() 289 { 290 Rect bounds; 291 mGWorld->GetBounds(bounds); 292 return bounds.right - bounds.left; 293 } 294 295 /* --Methode-- */ 296 int PIScreenBuffer::YSize() 297 { 298 Rect bounds; 299 mGWorld->GetBounds(bounds); 300 return bounds.bottom - bounds.top; 301 } 302 303 /* --Methode-- */ 304 void PIScreenBuffer::CopyFromWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y) 305 { 306 mGWorld->BeginDrawing(); 307 LPane* pane = wdg->GetPane(); 308 Rect srcRect = {oy, ox, oy+dy, ox+dx}; 309 Rect destRect = {y, x, y+dy, x+dx}; 310 CopyBits(&pane->GetMacPort()->portBits,&GrafPtr(mGWorld->GetMacGWorld())->portBits,&srcRect,&destRect,srcCopy,NULL); 311 mGWorld->EndDrawing(); 312 } 313 314 /* --Methode-- */ 315 void PIScreenBuffer::CopyToWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y) 316 { 317 LPane* pane = wdg->GetPane(); 318 Rect srcRect = {oy, ox, oy+dy, ox+dx}; 319 Rect destRect = {y, x, y+dy, x+dx}; 320 CopyBits(&GrafPtr(mGWorld->GetMacGWorld())->portBits,&pane->GetMacPort()->portBits,&srcRect,&destRect,srcCopy,NULL); 321 } 322 323 /* --Methode-- */ 324 void PIScreenBuffer::CopyFrom(PIScreenBuffer* grb, int ox, int oy, int dx, int dy, int x, int y) 325 { 326 327 mGWorld->BeginDrawing(); 328 Rect srcRect = {oy, ox, oy+dy, ox+dx}; 329 Rect destRect = {y, x, y+dy, x+dx}; 330 CopyBits(&GrafPtr(grb->mGWorld->GetMacGWorld())->portBits,&GrafPtr(mGWorld->GetMacGWorld())->portBits,&srcRect,&destRect,srcCopy,NULL); 331 mGWorld->EndDrawing(); 332 } -
trunk/SophyaPI/PI/piwdgmac.h
r88 r369 21 21 virtual void SetPos(int px, int py); 22 22 virtual void SetBorderWidth(int /*bw*/) {} 23 23 24 virtual void SetBinding(PIBindingKind left, PIBindingKind top, 24 25 PIBindingKind right, PIBindingKind bottom); 26 virtual bool GetBinding(PIBindingKind& left, PIBindingKind& top, 27 PIBindingKind& right, PIBindingKind& bottom); 25 28 virtual int XSize(); 26 29 virtual int YSize(); … … 29 32 virtual string Nom() { return mNom; } 30 33 34 // Pour activer, desactiver un composant graphique (PIWdg) 31 35 virtual void Manage(); 32 36 virtual void UnManage(); … … 34 38 virtual bool IsVisible(); 35 39 40 // Fonction qui doit etre appelee pour rafraichir la fenetre 41 virtual void Refresh(); 42 43 // Pour rendre un composant graphique (PIWdg) sensible/insensible 44 // aux actions utilisateur (souris, clavier, ...) 45 virtual void SetSensitive(); 46 virtual void SetUnSensitive(); 47 virtual bool IfSensitive(); 48 36 49 // Gestion de copier-coller 37 // $$CHECK$$ Pourquoi les noms ont-ils change ???38 // En plus, pour des trucs tout aussi obscurs...39 // Et c'est quoi, typ, qui en plus n'est pas utilise sous X ???40 50 virtual bool ClaimSelection(unsigned int typ=PICP_string); 41 51 virtual void SelectionLost(); … … 44 54 virtual void PasteSelection(unsigned int typ, void *, unsigned int l); 45 55 virtual void CopyFromSelection(char *, int l); 46 virtual char* SelectionString( int& len);56 virtual char* SelectionString(unsigned int& len); 47 57 virtual void SelectionTransferEnd(); 48 58 59 // Copie depuis un PIWdgGen 60 virtual void CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y); 61 62 // Gestion des EventHandler 63 virtual void AddDrawHandler(PIEventHandler* drwh, bool ad=false); 64 virtual void RemoveDrawHandler(PIEventHandler* drwh); 65 virtual void AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false); 66 virtual void RemoveEventHandler(PIEventHandler* evh); 67 68 69 LPane* GetPane() {return mPane;} 70 49 71 protected: 50 72 LPane* mPane; … … 61 83 typedef PIWdgMac PIWdg; 62 84 85 // -------- La classe PIScreenBuffer ---------- 86 87 #include <UGWorld.h> 88 89 class PIScreenBuffer { 90 public : 91 PIScreenBuffer(int sx, int sy); 92 virtual ~PIScreenBuffer(); 93 94 virtual int XSize(); 95 virtual int YSize(); 96 virtual void CopyFromWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y); 97 virtual void CopyToWdg(PIWdg* wdg, int ox, int oy, int dx, int dy, int x, int y); 98 virtual void CopyFrom(PIScreenBuffer* grb, int ox, int oy, int dx, int dy, int x, int y); 99 100 protected : 101 LGWorld* mGWorld; 102 }; 103 104 63 105 64 106 #endif
Note:
See TracChangeset
for help on using the changeset viewer.