Changeset 75 in Sophya
- Timestamp:
- Feb 13, 1998, 5:17:14 PM (28 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piapplgen.h
r18 r75 27 27 28 28 virtual void AppendMenu(PIPDMenu *pdm); 29 30 virtual int PrefXSize() = 0; 31 virtual int PrefYSize() = 0; 32 29 33 protected: 30 34 PIContainer *topcont; -
trunk/SophyaPI/PI/piapplx.cc
r60 r75 138 138 } 139 139 } 140 141 142 /* --Methode-- */ 143 int PIApplicationX::PrefXSize() 144 { 145 return(10); // $CHECK$ A remplacer Reza 13/02/98 146 } 147 148 /* --Methode-- */ 149 int PIApplicationX::PrefYSize() 150 { 151 return(18); // $CHECK$ A remplacer Reza 13/02/98 152 } 153 154 -
trunk/SophyaPI/PI/piapplx.h
r18 r75 20 20 virtual void SetBlocked(); 21 21 22 virtual int PrefXSize(); 23 virtual int PrefYSize(); 24 22 25 PIContainer* MBCont() { return intcont; } 23 26 protected: -
trunk/SophyaPI/PI/piwdggen.h
r63 r75 17 17 PIBK_fixed = 1, 18 18 PIBK_elastic = 2 19 }; 20 21 enum PICopyPasteKind { // Pour gerer les types d objets echange en copier/coller 22 PICP_string = 1 19 23 }; 20 24 … … 68 72 69 73 // Gestion de copier-coller 70 virtual bool ClaimSelection( )=0;71 virtual void LoseSelection()=0;72 virtual void RequestSelection()=0;73 virtual void CopyFromSelection(char *, int l)=0;74 virtual char* SelectionString(int& len)=0;74 virtual bool ClaimSelection(int typ=PICP_string) = 0; 75 virtual void SelectionLost() = 0; 76 virtual int RequestSelection(int typ=PICP_string) = 0; 77 virtual void* ProvideSelection(int& typ, int& len) = 0; 78 virtual void PasteSelection(int& typ, void *, int l) = 0; 75 79 76 80 protected: -
trunk/SophyaPI/PI/piwdgx.cc
r63 r75 497 497 if (!curselwdg) return(FALSE); 498 498 int l; 499 *value = curselwdg->SelectionString(l); 499 int styp = 1; 500 *value = curselwdg->ProvideSelection(styp, l); 500 501 *len=l; 501 502 *typ = XA_STRING; … … 507 508 void forXt_LoseSelection(Widget w, Atom* sel) 508 509 { 509 if (curselwdg) curselwdg-> LoseSelection();510 if (curselwdg) curselwdg->SelectionLost(); 510 511 curselwdg = NULL; 511 512 } … … 524 525 printf("forXt_SelectionValue()/Debug: %lx %lx - %lx - %d \n", (unsigned long)w, 525 526 (unsigned long)usd, (unsigned long)value, (*len)); 527 int styp = 1; 526 528 if ( (value != NULL) && (*len > 0) ) 527 ((PIWdgX*)usd)-> CopyFromSelection((char*)value, (*len)) ;529 ((PIWdgX*)usd)->PasteSelection(styp, (void*)value, (*len)) ; 528 530 } 529 531 … … 532 534 // Gestion de Copier/Coller 533 535 /* --Methode-- */ 534 bool PIWdgX::ClaimSelection() 536 bool PIWdgX::ClaimSelection(int typ) 537 // Pour prendre possession du buffer copier/coller 535 538 { 536 539 if (XtOwnSelection(XtWdg(), XA_PRIMARY, PIXGetLastEventTime(), forXt_ConvertSelection, 537 540 forXt_LoseSelection, forXt_DoneSelection) ) { 538 printf("PIWdgX::ClaimSelection( ) - OK (Wdg= %lx)\n", (unsigned long)this);541 printf("PIWdgX::ClaimSelection(%d) - OK (Wdg= %lx)\n", typ, (unsigned long)this); 539 542 curselwdg = this; 540 543 return (true); … … 548 551 549 552 /* --Methode-- */ 550 void PIWdgX::LoseSelection() 551 { 552 printf("PIWdgX::LoseSelection() Ne fait rien !(Wdg= %lx - %lx) \n", 553 void PIWdgX::SelectionLost() 554 // Appele quand le PIWdg perd la possession du buffer copier/coller 555 { 556 printf("PIWdgX::SelectionLost() Ne fait rien !(Wdg= %lx - %lx) \n", 553 557 (unsigned long)this, (unsigned long)curselwdg); 554 558 if (curselwdg == this) curselwdg = NULL; … … 556 560 557 561 /* --Methode-- */ 558 void PIWdgX::RequestSelection() 559 { 560 printf("PIWdgX::RequestSelection() (Wdg= %lx - %lx) \n", 562 int PIWdgX::RequestSelection(int typ) 563 { 564 // Pour demander le contenu du buffer de copier/coller 565 printf("PIWdgX::RequestSelection(%d) (Wdg= %lx - %lx) \n", typ, 561 566 (unsigned long)this, (unsigned long)curselwdg); 562 567 XtGetSelectionValue(XtWdg(), XA_PRIMARY, XA_STRING, forXt_SelectionValue, 563 568 (XtPointer)this, PIXGetLastEventTime()); 564 } 565 566 /* --Methode-- */ 567 void PIWdgX::CopyFromSelection(char * sv, int l) 568 { 569 char* buff = new char[l+2]; 570 strncpy(buff, sv, l); 571 buff[l] = '\0'; 572 printf("PIWdgX::RequestSelection() L=%d [%s] \n", l, buff); 573 delete buff; 574 return; 575 } 576 577 /* --Methode-- */ 578 char* PIWdgX::SelectionString(int& len) 579 { 580 char *rs = new char[60]; 581 strcpy(rs, "Test-of-PIWdgX::SelectionString()"); 569 return(1); 570 } 571 572 573 /* --Methode-- */ 574 void* PIWdgX::ProvideSelection(int& typ, int& len) 575 // Le widget doit fournier une l zone memoire contenant la selection 576 // en un type donne 577 // Renvoie le pointeur de cette zone, sa taille et son typ 578 { 579 char *rs = new char[80]; 580 sprintf(rs, "Test-of-PIWdgX::ProvideSelection(%d)", typ); 582 581 len = strlen(rs); 583 582 return(rs); 584 583 } 584 585 /* --Methode-- */ 586 void PIWdgX::PasteSelection(int& typ, void *buff, int l) 587 { 588 // Methode appele apres que le widget ait fait RequestSelection 589 // Le typ de donnees fourni ainsi que les donnees et leur taille 590 // sont en argument 591 char* mbuff = new char[l+1]; 592 strncpy(mbuff, (char *)buff, l); 593 mbuff[l] = '\0'; 594 printf("PIWdgX::PasteSelection() L=%d [%s] \n", l, mbuff); 595 delete[] mbuff; 596 return; 597 } -
trunk/SophyaPI/PI/piwdgx.h
r63 r75 56 56 57 57 // Gestion de copier-coller 58 virtual bool ClaimSelection( );59 virtual void LoseSelection();60 virtual void RequestSelection();61 virtual void CopyFromSelection(char *, int l);62 virtual char* SelectionString(int& len);58 virtual bool ClaimSelection(int typ=PICP_string); 59 virtual void SelectionLost(); 60 virtual int RequestSelection(int typ=PICP_string); 61 virtual void* ProvideSelection(int& typ, int& len); 62 virtual void PasteSelection(int& typ, void *, int l); 63 63 64 64 inline SysDWdg XtWdg() const {return(sdw); };
Note:
See TracChangeset
for help on using the changeset viewer.