Changeset 80 in Sophya
- Timestamp:
- Feb 24, 1998, 6:07:41 PM (28 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pibwdggen.h
r71 r80 51 51 virtual PIColors GetBackgroundColor() = 0; 52 52 virtual PIPointer GetPointerShape() = 0; 53 virtual void AssignKeyboard() = 0; 53 54 54 55 // Fonction qui doit etre appelee pour rafraichir la fenetre -
trunk/SophyaPI/PI/pibwdgx.cc
r71 r80 161 161 162 162 /* --Methode-- */ 163 void PIBaseWdgX::AssignKeyboard() 164 { 165 XSetInputFocus(XtDisplay (XtWdg()), XtWindow(XtWdg()), RevertToParent, PIXGetLastEventTime()); 166 } 167 168 /* --Methode-- */ 163 169 PIColors PIBaseWdgX::GetBackgroundColor() 164 170 { -
trunk/SophyaPI/PI/pibwdgx.h
r71 r80 32 32 virtual PIColors GetBackgroundColor(); 33 33 virtual PIPointer GetPointerShape(); 34 virtual void AssignKeyboard(); 34 35 35 36 // Appel depuis le PIXtBaseWidget uniquement (ExposeEvt de Xt ) -
trunk/SophyaPI/PI/picons.cc
r79 r80 20 20 21 21 static int CmdStrLen = 256; 22 static int PIVA_Select = 128; 22 23 23 24 /* --Methode-- */ 24 25 PIConsole::PIConsole(PIContainer* par, char* nom, PIMessage msg, 25 int nl, int nc, int sx, int sy, int px, int py ) :26 int nl, int nc, int sx, int sy, int px, int py, bool scb) : 26 27 PIBaseWdg(par, nom, sx, sy, px, py) 27 28 { … … 35 36 mCCP = mCLC = 0; 36 37 mDCOff = 0; 37 AssocScrollBar(NULL); 38 38 39 SetMsg(msg); 40 39 41 int i; 40 42 for(i=0; i<mNL; i++) { … … 54 56 mCPBuffer = NULL; 55 57 mCPBufLen = 0; 56 mCPbeginC = mCPendC = 0;57 mCPbeginL = mCPendL = 0;58 mCPbeginC = mCPendC = -1; 59 mCPbeginL = mCPendL = -1; 58 60 59 61 SetPrompt("Cmd> "); … … 63 65 mCurL = mNL-mWSzL-1; 64 66 mCurC = 0; 67 68 // Pour ajouter un scroll-bar 69 AssocScrollBar(par, nom, scb, sx, sy, px, py); 65 70 66 71 // Pour le menu des options : Fontes, couleur, ... … … 76 81 nb_opmc++; 77 82 78 ActivateKeyboard(); 79 // ActivateButton(1); Pour permettre la selection 80 ActivateButton(3); // Pour afficher le menu des options (Fontes/couleur) 83 ActivateKeyboard(); // Gestion de l'edition 84 ActivateButton(1); // Action selection / copier - coller 85 ActivateMove(1); // " " " 86 ActivateButton(2); // " " " 87 ActivateButton(3); // Pour afficher le menu des options (Fontes/couleur) 81 88 Manage(); 82 89 return; … … 91 98 delete[] mStrBuf; 92 99 delete[] mCmdStr; 100 if (mScb) delete mScb; 93 101 nb_opmc--; 94 102 if (nb_opmc == 0) { delete opmc; opmc=NULL; } … … 152 160 153 161 /* --Methode-- */ 154 void PIConsole::SelectFont(PIFontSize sz , bool autosz)162 void PIConsole::SelectFont(PIFontSize sz) 155 163 { 156 164 int asc, desc; … … 162 170 mWSzC = XSize()/mFLarg - 2; 163 171 mOffL = 0; 164 if (autosz) SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut);165 172 if (mScb) { 166 173 mScb->SetMinMax(0, NbLines()-1); … … 170 177 } 171 178 179 /* --Methode-- */ 180 void PIConsole::AutoSize() 181 { 182 int dsz[2]; 183 dsz[0] = (mNC+2)*mFLarg - XSize(); 184 dsz[1] = (mWSzL+1)*mFHaut - YSize(); 185 Send(Msg(), PIMsg_ResizeRequest, dsz); 186 SetSize((mWSzC+2)*mFLarg, (mWSzL+1)*mFHaut); 187 } 188 189 /* --Methode-- */ 190 void PIConsole::PreferedSize(int& sx, int& sy) 191 { 192 sx = (mNC+2)*mFLarg; 193 sy = (mWSzL+1)*mFHaut; 194 return; 195 } 172 196 173 197 /* --Methode-- */ … … 222 246 } 223 247 224 /* --Methode-- */225 void PIConsole::AssocScrollBar(PIScrollBar* scb)226 {227 mScb = scb;228 if (mScb) {229 msgScb = mScb->Msg();230 mScb->SetMsgParent(this);231 mScb->SetMinMax(0, NbLines()-1);232 mScb->SetSize(WindNbLines());233 mScb->SetValue(NbLines()-WindNbLines()-1);234 }235 else msgScb = 0;236 }237 248 238 249 /* --Methode-- */ … … 256 267 } 257 268 258 static int lines = 0;259 269 260 270 /* --Methode-- */ 261 271 void PIConsole::Keyboard(int key, PIKeyModifier kmod) 262 272 { 273 274 if (kmod == PIKM_Alt) { 275 if (key == 'O' || key == 'o') { // Menu des options 276 opmc->SetMsgParent((PIMsgHandler*)this); 277 opmc->Show(); 278 return; 279 } 280 else if (key == 'A' || key == 'a') { // Pour tout selectionner 281 mCPbeginC = 0; mCPendC = XSize(); 282 mCPbeginL = 0; mCPendL = YSize(); 283 SaveSelection(); 284 return; 285 } 286 } 263 287 264 288 if (mNCmdL < 1) return; … … 283 307 else if (kmod == PIKM_Alt) { 284 308 if (key == 'V' || key == 'v') RequestSelection(); // Pour coller (copier/coller) 285 else if (key == 'A' || key == 'a') { // Pour tout selectionner286 if (ClaimSelection()) { // Definition de la zone de copie287 SelectionLost();288 mCPbeginC = 0; mCPendC = mNC;289 mCPbeginL = mNL-mWSzL-mOffL; mCPendL = mNL-mOffL;290 }291 else mCPbeginC = mCPendC = mCPbeginL = mCPendL = 0;292 }293 309 } 294 310 … … 323 339 case PIK_Up : 324 340 case PIK_Down : 325 printf("Process()-Debug- CursorUp/Down(%d) Index= %d %d \n", key, mRindx, mRCindx);341 // printf("Process()-Debug- CursorUp/Down(%d) Index= %d %d \n", key, mRindx, mRCindx); 326 342 if (mNComm > 0) { 327 343 int nmxrec = (mNComm < NMxRecall) ? mNComm : NMxRecall; … … 361 377 /* Pour debugger le code - Reza 23/02/98 362 378 #ifdef DEBUG_PICONS 379 static int lines = 0; 363 380 if ( (kmod == PIKM_Alt) ) { 364 381 char buff[128]; … … 419 436 */ 420 437 421 /* --Methode-- 438 /* --Methode-- */ 422 439 void PIConsole::But1Press(int x, int y) 423 440 { 424 printf("PIConsole::But1Press(%d %d ) \n", x, y); 425 } */ 441 Send(Msg(), PIMsg_Active); 442 AssignKeyboard(); 443 mWGrC->SelGOMode(PI_GOXOR); 444 mWGrC->SelForeground(mFgC); 445 mCPbeginC = x; mCPbeginL = y; 446 mCPendC = mCPendL = -1; 447 } 448 449 /* --Methode-- */ 450 void PIConsole::Ptr1Move(int x, int y) 451 { 452 if (mCPendC >= 0) mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL); 453 mCPendC = x; mCPendL = y; 454 mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL); 455 } 456 457 /* --Methode-- */ 458 void PIConsole::But1Release(int x, int y) 459 { 460 if ( (mCPendC >= 0) && (mCPbeginC >= 0) ) { 461 mWGrC->DrawBox(mCPbeginC, mCPbeginL, mCPendC-mCPbeginC, mCPendL-mCPbeginL); 462 mCPendC = x; mCPendL = y; 463 } 464 else { 465 mCPbeginC = mCPendC = -1; 466 mCPbeginL = mCPendL = -1; 467 } 468 mWGrC->SelGOMode(PI_GOCopy); 469 mWGrC->SelForeground(mFgC); 470 SaveSelection(); 471 } 472 473 /* --Methode-- */ 474 void PIConsole::But2Press(int x, int y) 475 { 476 RequestSelection(); // Pour recuperer la selection = coller (copier/coller) 477 } 426 478 427 479 /* --Methode-- */ … … 446 498 { 447 499 // printf("Debug PIConsole::SelectionLost() %lx (L=%d)\n",(long)mCPBuffer, mCPBufLen); 448 if (mCPBuffer) delete[] mCPBuffer; 500 if (!mCPBuffer) return; 501 delete[] mCPBuffer; 449 502 mCPBuffer = NULL; 450 503 mCPBufLen = 0; 451 mCPbeginC = mCPendC = 0; 452 mCPbeginL = mCPendL = 0; 504 mCPbeginC = mCPendC = -1; 505 mCPbeginL = mCPendL = -1; 506 int i,j; 507 int l1,l2; 508 l1 = mNL+1; l2 = -1; 509 for(i=0; i<mNL; i++) // On enleve le bit select a tous les caracteres 510 for(j=0; j<mNC; j++) 511 if ( mAtt[mLPo[i]+j] & PIVA_Select) { 512 if (l1 > i) l1 = i; 513 if (l2 < i) l2 = i; 514 mAtt[mLPo[i]+j] &= ~PIVA_Select ; 515 } 516 517 if (IsVisible() && l2 > -1) DisplayLines(mWGrC, l1, l2); 518 return; 453 519 } 454 520 … … 464 530 { 465 531 typ = PICP_string; 466 if (!mCPBuffer) { // Il faut effectuer la copie467 int l = (mCPendC-mCPbeginC+1) * (mCPendL-mCPbeginL);468 if (l < 1) l = 1;469 mCPBufLen = l;470 mCPBuffer = new char[l+1];471 int i,j,k;472 k = 0;473 for(j=mCPbeginL; j<mCPendL; j++) {474 for(i=mCPbeginC; i<mCPendC; i++)475 { mCPBuffer[k] = mText[mLPo[j]+i]; k++; }476 mCPBuffer[k] = '\n'; k++;477 }478 mCPBuffer[l] = '\0';479 }480 // printf("PIConsole::ProvideSelection() %d-%d %d-%d -> %d (%lx)\n", mCPbeginL, mCPendL, mCPbeginC, mCPendC,481 // mCPBufLen,(long) mCPBuffer);482 int i; for(i=0; i<40; i++) putchar(mCPBuffer[i]); printf("\n");483 532 len = mCPBufLen; 484 533 return(mCPBuffer); 485 534 } 486 535 487 /* --Methode-- */ 488 void PIConsole::CmdAddChar(int key) 489 { 490 int k, kmx; 491 if ( (mCCP < CmdStrLen) && isprint(key) ) { // Ajout de caracteres 492 if (mCCP < mCLC) { // Insertion au milieu de la chaine 493 kmx = (mCLC < CmdStrLen) ? mCLC : CmdStrLen-1; 494 // printf(" ++DBG++ C=%d L=%d MX=%d KMX=%d\n", mCCP, mCLC, CmdStrLen,kmx); 495 for(k=kmx; k>mCCP; k--) mCmdStr[k] = mCmdStr[k-1]; mCLC = kmx+1; 496 } 497 mCmdStr[mCCP] = key; mCCP++; 498 if (mCCP > mCLC) mCLC = mCCP; 499 } 500 } 536 /* ----------------------------------------------------------------------------- */ 537 /* ---------------------- Methodes protected ------------------------- */ 538 /* ----------------------------------------------------------------------------- */ 539 501 540 502 541 /* --Methode-- … … 519 558 */ 520 559 560 // Gestion du scroll-bar 561 static int Scb_Width = 14; 562 563 /* --Methode-- */ 564 void PIConsole::AssocScrollBar(PIContainer* par, char* nom, bool scb, int sx, int sy, int px, int py) 565 { 566 if (!scb) { 567 mScb = NULL; 568 msgScb = 0; 569 SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 570 return; 571 } 572 573 sx -= Scb_Width; 574 SetSize(sx, sy); 575 SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed); 576 char name[128]; 577 strcpy(name,"ScrollBar_"); 578 strncat(name, nom, 127); 579 msgScb = Msg()+55; 580 mScb = new PIScrollBar (par, name, msgScb, true, Scb_Width, sy, px+sx, py); 581 mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed); 582 583 mScb->SetMsgParent(this); 584 mScb->SetMinMax(0, NbLines()-1); 585 mScb->SetSize(WindNbLines()); 586 mScb->SetValue(NbLines()-WindNbLines()-1); 587 } 588 521 589 /* --Methode-- */ 522 590 void PIConsole::ScrollUp() … … 558 626 PI_RomanFont, PI_RomanFont, PI_BoldFont, 559 627 PI_ItalicFont, PI_RomanFont}; 560 PIColors fgc, bgc ;628 PIColors fgc, bgc, dbgc; 561 629 562 630 g->SelForeground(mFgC); 563 631 g->SelBackground(mBgC); 564 632 fgc = g->GetForeground(); 565 bgc = g->GetBackground();633 dbgc = bgc = g->GetBackground(); 566 634 567 635 int dx = mFLarg; … … 592 660 lva = mAtt[mLPo[l]+j]; 593 661 g->SelFont(mFTaille, vafat[lva]); 662 if (lva & PIVA_Select) bgc = PI_Grey; 663 else bgc = dbgc; 594 664 if (lva & PIVA_Reverse) { 595 665 g->SelForeground(bgc); … … 612 682 613 683 g->SelForeground(fgc); 614 g->SelBackground(bgc); 615 return; 616 } 617 /* --Methode-- */ 618 void PIConsole::ClrCmd() 619 { 620 mCCP = 0; mCLC = 0; mDCOff = 0; 621 mCmdStr[0] = '\0'; 622 } 684 g->SelBackground(dbgc); 685 return; 686 } 623 687 624 688 /* --Methode-- */ 625 689 void PIConsole::UpdCmdLine() 626 690 { 627 char strg[260]; //debug691 // char strg[260]; debug 628 692 int l1,l2; 629 693 l1 = l2 = mNL-1; … … 637 701 mText[mLPo[mNL-1]+j] = mPrompt[j]; 638 702 mAtt[mLPo[mNL-1]+j] = PIVA_Ital; 639 strg[j] = mPrompt[j]; 703 // strg[j] = mPrompt[j]; debug 640 704 } 641 705 jj2 = mWSzC-j1; … … 650 714 mText[mLPo[mNL-1]+j] = mCmdStr[k]; 651 715 mAtt[mLPo[mNL-1]+j] = PIVA_Bold; 652 strg[j] = mCmdStr[k];716 // strg[j] = mCmdStr[k]; debug 653 717 k++; 654 718 } 655 719 656 strg[j] = '\0'; 720 // strg[j] = '\0'; Debug 657 721 // printf("UpdCmdLine() %d %d - %s (%d) \n [%d %d %d] %d\n", koff,kmx,strg,j1+mCCP-koff, mWSzC, j1, jj2, mCCP-(jj2/2)); 658 722 mAtt[mLPo[mNL-1]+j1+mCCP-koff] = PIVA_Reverse; // Pour le curseur 659 723 DisplayLines(mWGrC, l1, l2); 660 661 } 724 } 725 726 /* --Methode-- */ 727 void PIConsole::ClrCmd() 728 { 729 mCCP = 0; mCLC = 0; mDCOff = 0; 730 mCmdStr[0] = '\0'; 731 } 732 733 /* --Methode-- */ 734 void PIConsole::CmdAddChar(int key) 735 { 736 int k, kmx; 737 if ( (mCCP < CmdStrLen) && isprint(key) ) { // Ajout de caracteres 738 if (mCCP < mCLC) { // Insertion au milieu de la chaine 739 kmx = (mCLC < CmdStrLen) ? mCLC : CmdStrLen-1; 740 // printf(" ++DBG++ C=%d L=%d MX=%d KMX=%d\n", mCCP, mCLC, CmdStrLen,kmx); 741 for(k=kmx; k>mCCP; k--) mCmdStr[k] = mCmdStr[k-1]; mCLC = kmx+1; 742 } 743 mCmdStr[mCCP] = key; mCCP++; 744 if (mCCP > mCLC) mCLC = mCCP; 745 } 746 } 747 662 748 663 749 /* --Methode-- */ … … 666 752 mFgC = fc; mBgC = bc; 667 753 SetBackgroundColor(bc); 754 } 755 756 757 /* --Methode-- */ 758 void PIConsole::SaveSelection() 759 { 760 int i,j,k,l; 761 int l1, l2, nl, nc; 762 763 if (mCPbeginC > mCPendC) { j = mCPbeginC; mCPbeginC = mCPendC ; mCPendC = j; } 764 if (mCPbeginL > mCPendL) { j = mCPbeginL; mCPbeginL = mCPendL ; mCPendL = j; } 765 766 nc = (mCPendC-mCPbeginC)/mFLarg; 767 nl = (mCPendL-mCPbeginL)/mFHaut; 768 // printf("*DBG* NC=%d NL=%d \n",nc, nl); 769 l1 = mNL+1; l2 = -1; 770 771 if (mCPBuffer) { 772 delete[] mCPBuffer; 773 mCPBuffer = NULL; 774 mCPBufLen = 0; 775 for(i=0; i<mNL; i++) // On enleve le bit select a tous les caracteres 776 for(j=0; j<mNC; j++) 777 if ( mAtt[mLPo[i]+j] & PIVA_Select) { 778 if (l1 > i) l1 = i; 779 if (l2 < i) l2 = i; 780 mAtt[mLPo[i]+j] &= ~PIVA_Select ; 781 } 782 } 783 784 // printf("**DBG** Save: C= %d %d L = %d %d \n", mCPbeginC, mCPendC, mCPbeginL, mCPendL); 785 786 if (!ClaimSelection()) { 787 mCPbeginC = mCPendC = -1; 788 mCPbeginL = mCPendL = -1; 789 return; 790 } 791 792 793 // On transforme la position sur la fenetre en position en caracteres ds les buffers 794 795 mCPbeginC = mCPbeginC/mFLarg-1; 796 mCPendC = (int) ( (float)mCPendC/(float)mFLarg-0.8 ); 797 mCPbeginL = (int) ( (float)mCPbeginL/(float)mFHaut-0.5 ) ; 798 mCPendL = (int) ( (float)mCPendL/(float)mFHaut-0.3 ) ; 799 // printf("..DBG.. C= %d %d L = %d %d ", mCPbeginC, mCPendC, mCPbeginL, mCPendL); 800 j = mNL-mWSzL-mOffL; 801 mCPbeginL += j; mCPendL += j; 802 // printf(" -> %d %d \n", mCPbeginL, mCPendL); 803 804 if (mCPbeginC < 0) mCPbeginC = 0; 805 if (mCPendC > mNC) mCPendC = mNC; 806 if (mCPbeginL < 0) mCPbeginL = 0; 807 if (mCPendL > mNL) mCPendL = mNL; 808 809 if ( (nc > 0) && (nl > 0) ) { 810 l = (mCPendC-mCPbeginC+1) * (mCPendL-mCPbeginL); 811 if (l < 0) l = 0; 812 mCPBufLen = l; 813 mCPBuffer = new char[l+1]; 814 k = 0; 815 for(j=mCPbeginL; j<mCPendL; j++) { 816 for(i=mCPbeginC; i<mCPendC; i++) { 817 mAtt[mLPo[j]+i] |= PIVA_Select; 818 mCPBuffer[k] = mText[mLPo[j]+i]; k++; 819 } 820 mCPBuffer[k] = '\n'; k++; 821 } 822 mCPBuffer[l] = '\0'; 823 if (l1 > mCPbeginL) l1 = mCPbeginL; 824 if (l2 < (mCPendL-1)) l2 = mCPendL-1; 825 } 826 else { 827 l = 0; 828 mCPbeginC = mCPendC = mCPbeginL = mCPendL = -1; 829 mCPBufLen = 0; 830 mCPBuffer = new char[10]; 831 mCPBuffer[0] = mCPBuffer[1] = '\0'; 832 } 833 834 // printf("*DBG* Save_Display %d %d \n", l1, l2); 835 836 if (l2 > -1) DisplayLines(mWGrC, l1, l2); 668 837 } 669 838 … … 680 849 case 3101 : 681 850 SelectFont(PI_SmallSizeFont); 851 AutoSize(); 682 852 break; 683 853 case 3102 : 684 854 SelectFont(PI_NormalSizeFont); 855 AutoSize(); 685 856 break; 686 857 case 3103 : 687 858 SelectFont(PI_BigSizeFont); 859 AutoSize(); 688 860 break; 689 861 case 3201 : … … 713 885 } 714 886 715 /* --------------------------------------------------------------------------------- */716 /* -------------- Classe PIScConsole : Console avec ScrollBar ------------------- */717 /* --------------------------------------------------------------------------------- */718 719 static int Scb_Width = 12;720 static int Scb_msg = 400;721 722 /* --Methode-- */723 PIScConsole::PIScConsole(PIContainer* par, char* nom, PIMessage msg,724 int nl, int nc, int sx, int sy, int px, int py) :725 PIContainer(par, nom, sx, sy, px, py)726 {727 char name[80];728 strcpy(name,"TextArea_");729 strncat(name, nom, 70);730 mCons = new PIConsole(this, name, msg, nl, nc, sx-Scb_Width, sy, 0, 0);731 mCons->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);732 strcpy(name,"ScrollBar_");733 strncat(name, nom, 70);734 mScb = new PIScrollBar (this, name, Scb_msg, true, Scb_Width, sy, sx-Scb_Width, 0);735 mScb->SetBinding(PIBK_free, PIBK_fixed, PIBK_fixed, PIBK_fixed);736 mCons->AssocScrollBar(mScb);737 Show();738 }739 740 /* --Methode-- */741 PIScConsole::~PIScConsole()742 {743 delete mCons;744 delete mScb;745 }746 -
trunk/SophyaPI/PI/picons.h
r79 r80 17 17 class PIConsole : public PIBaseWdg { 18 18 public: 19 PIConsole(PIContainer* par, char* nom, PIMessage msg, 20 int nl, int nc, int sx=300, int sy=200, int px=0, int py=0);19 PIConsole(PIContainer* par, char* nom, PIMessage msg, int nl, int nc, 20 int sx=300, int sy=200, int px=0, int py=0, bool scb=true); 21 21 ~PIConsole(); 22 22 23 // Interface d utilisation : 23 24 void AddChar(char c, unsigned char va= PIVA_Def, bool ref=true); 24 25 void AddStr(char* strg, unsigned char va= PIVA_Def, bool ref=true); 25 26 26 void SelectFont(PIFontSize sz=PI_NormalSizeFont, bool autosz=true); 27 void SelectFont(PIFontSize sz=PI_NormalSizeFont); 28 void AutoSize(); 29 void PreferedSize(int& sx, int& sy); 27 30 void AcceptCmd(bool acc=true, int nrecmx=20); 28 31 void SetPrompt(char* prompt); 29 32 30 33 inline int WindNbLines() { return mWSzL; } 31 inline int NbLines() { return mNL; } 32 33 void SetDispOffset(int ldeb=-1); 34 void AssocScrollBar(PIScrollBar* scb); 35 34 inline int NbLines() { return mNL; } 36 35 inline string GetCmdString() { mCmdStr[mCLC] = '\0'; return((string)mCmdStr); } 37 36 37 // Gestion des evenements input/draw 38 38 virtual void Draw(PIGraphicGen* g); 39 39 virtual void Resize(); 40 40 virtual void Keyboard(int key, PIKeyModifier kmod); 41 virtual void But1Press(int x, int y); 42 virtual void Ptr1Move(int x, int y); 43 virtual void But1Release(int x, int y); 44 virtual void But2Press(int x, int y); 41 45 virtual void But3Press(int x, int y); 42 46 47 // Gestion de copier/coller 43 48 virtual void PasteSelection(unsigned int typ, void *pdata, unsigned int l); 44 49 virtual void* ProvideSelection(unsigned int& typ, unsigned int& len); … … 47 52 48 53 protected: 54 void AssocScrollBar(PIContainer* par, char* nom, bool scb, int sx, int sy, int px, int py); 49 55 void ScrollUp(); 56 void SetDispOffset(int ldeb=-1); 50 57 void ClearLine(int l); 51 58 void DisplayLines(PIGraphicGen* g, int l1, int l2); … … 54 61 void CmdAddChar(int key); 55 62 void SelFgBgCol(PIColors fc=PI_Black, PIColors bc=PI_White); 63 void SaveSelection(); // Pour copier la selection dans un buffer 64 56 65 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 66 57 67 58 68 int mNL, mNC; // Nb de lignes, colonnes total de la console … … 90 100 91 101 92 class PIScConsole : public PIContainer {93 public :94 PIScConsole(PIContainer* par, char* nom, PIMessage msg,95 int nl, int nc, int sx=300, int sy=200, int px=0, int py=0);96 ~PIScConsole();97 98 inline void AddChar(char c, unsigned char va= PIVA_Def, bool ref=true)99 { mCons->AddChar(c, va, ref); }100 inline void AddStr(char* strg, unsigned char va= PIVA_Def, bool ref=true)101 { mCons->AddStr(strg, va, ref); }102 103 inline void SelectFont(PIFontSize sz=PI_NormalSizeFont)104 { mCons->SelectFont(sz); }105 106 inline void AcceptCmd(bool acc=true)107 { mCons->AcceptCmd(acc); }108 inline void SetPrompt(char* prompt)109 { mCons->SetPrompt(prompt); }110 inline string GetCmdString() { return(mCons->GetCmdString()); }111 112 inline void Refresh() { mCons->Refresh(); }113 114 PIConsole* mCons;115 116 protected:117 PIScrollBar* mScb;118 };119 120 102 #endif -
trunk/SophyaPI/PI/pimenux.cc
r60 r80 360 360 evt.window = XtWindow(PIXtTopWdg()); 361 361 evt.root = DefaultRootWindow(evt.display); 362 evt.serial = 8866559909; 362 evt.serial = PIXGetLastEventSerial(); 363 evt.time = PIXGetLastEventTime(); 363 364 evt.send_event = False; 364 365 evt.same_screen = XQueryPointer(evt.display, evt.window, &(evt.root), … … 399 400 evt.x = px; 400 401 evt.y = py; 401 evt.serial = 8866559909; 402 evt.serial = PIXGetLastEventSerial(); 403 evt.time = PIXGetLastEventTime(); 402 404 evt.send_event = False; 403 405 evt.same_screen = True; -
trunk/SophyaPI/PI/pimsghandler.h
r52 r80 1 #ifndef PIMSGHANDLER_H_SEEN 2 #define PIMSGHANDLER_H_SEEN 3 1 4 /* Classe de gestion de messages */ 2 5 3 6 #include <stdlib.h> 4 5 #ifndef PIMSGHANDLER_H_SEEN6 #define PIMSGHANDLER_H_SEEN7 7 8 8 enum { … … 12 12 PIMsg_Close = 2, 13 13 PIMsg_Resize = 3, 14 PIMsg_ResizeRequest = 4, 14 15 15 16 PIMsg_Click = 21, -
trunk/SophyaPI/PI/piwindowgen.cc
r76 r80 90 90 /* avec un message ActiveWdg de la part de la fenetre */ 91 91 { 92 93 if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) 92 if (ModMsg(msg) == PIMsg_ResizeRequest) { 93 // On change la taille de la fenetre - data est un pointeur sur entier 94 // data[0] represente l'increment (positif ou negatif) en X, data[1] en Y 95 int* nsz = (int*) data; 96 SetSize(XSize()+nsz[0], YSize()+nsz[1]); 97 return; 98 } 99 else if ((msg == BuildMsg(Msg(), PIMsg_Close)) && (sender == this) && mAHC) 94 100 Hide(); // Action par defaut en cas de MsgClose. 95 96 if (ModMsg(msg) == PIMsg_Active) 101 else if (ModMsg(msg) == PIMsg_Active) 97 102 Send(Msg(),PIMsg_Active); 98 103
Note:
See TracChangeset
for help on using the changeset viewer.