Changeset 684 in Sophya


Ignore:
Timestamp:
Dec 13, 1999, 12:13:36 AM (26 years ago)
Author:
ercodmgr
Message:

Correction PSFile::DrawText et protection ds Drw/ImgTools - Reza 12/12/99

Location:
trunk/SophyaPI/PI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pidrwtools.cc

    r563 r684  
    450450
    451451char strg[64];
    452 double xmin, xmax, ymin, ymax;
    453 int axrl = kAxeDirLtoR;
    454 int ayud = kAxeDirDownUp;
    455452int k, kk, kkk;
    456453
     
    458455
    459456  case 2600 :
    460     if ( mCurBW->kind() != PIScDrawWdg::ClassId ) {
     457    {
     458    double xmin, xmax, ymin, ymax;
     459    int axrl = kAxeDirLtoR;
     460    int ayud = kAxeDirDownUp;
     461    PIScDrawWdg* scd=NULL;
     462    scd = dynamic_cast<PIScDrawWdg*>(mCurBW);
     463    if ( scd == NULL ) {
    461464      cerr << "PIDrwTools: SetAxes applicable to PIScDrawWdg only ! " << endl;
    462465      return;
    463466      }
    464     sscanf(mText[0]->GetText().c_str(), "%lg %lg" , &xmin, &xmax);
    465     sscanf(mText[1]->GetText().c_str(), "%lg %lg" , &ymin, &ymax);
     467    if (mText[0]->GetText().length() > 1) {
     468      xmin = -1.;   xmax = 1.;
     469      sscanf(mText[0]->GetText().c_str(), "%lg %lg" , &xmin, &xmax);
     470    }
     471    else {
     472      xmin = scd->XMin();
     473      xmax = scd->XMax();
     474    }
     475    if (mText[1]->GetText().length() > 1) {
     476      ymin = -1.;   ymax = 1.;
     477      sscanf(mText[1]->GetText().c_str(), "%lg %lg" , &ymin, &ymax);
     478    }
     479    else {
     480      ymin = scd->YMin();
     481      ymax = scd->YMax();
     482    }     
    466483    if (mCkb[0]->GetState())  axrl = kAxeDirRtoL ;
    467484    if (mCkb[1]->GetState())  ayud = kAxeDirUpDown;
    468     if ( mCurBW->kind() == PIScDrawWdg::ClassId ) {
    469       ((PIScDrawWdg*)mCurBW)->SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
    470       unsigned int flags = ((PIScDrawWdg*)mCurBW)->GetAxesFlags();
    471       if (mCkb[2]->GetState()) ((PIScDrawWdg*)mCurBW)->SetAxesFlags(flags | kGridOn);
    472       else  ((PIScDrawWdg*)mCurBW)->SetAxesFlags(flags & ~kGridOn);
    473       ((PIScDrawWdg*)mCurBW)->SetLogScale(mCkb[3]->GetState(),
    474                                           mCkb[4]->GetState() );
    475       }
     485    scd->SetLimits(xmin, xmax, ymin, ymax, axrl, ayud);
     486    unsigned int flags = scd->GetAxesFlags();
     487    if (mCkb[2]->GetState()) scd->SetAxesFlags(flags | kGridOn);
     488    else  scd->SetAxesFlags(flags & ~kGridOn);
     489    scd->SetLogScale(mCkb[3]->GetState(), mCkb[4]->GetState() );
     490     
    476491    //    else mCurBW->SetDefaultDrawerLimits(xmin, xmax, ymin, ymax, axrl, ayud);
    477492    mCurBW->Refresh();
     493    }
    478494    break;
    479495
    480496  case 2700 :
    481     if ( mCurBW->kind() == PIScDrawWdg::ClassId ) ((PIScDrawWdg*)mCurBW)->UpdateLimits();
    482     else if ( mCurBW->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mCurBW)->Update3DView();
     497    {
     498    PIScDrawWdg* scd=NULL;
     499    scd = dynamic_cast<PIScDrawWdg*>(mCurBW);
     500    if ( scd != NULL ) scd->UpdateLimits();
     501    else {
     502      PIDraw3DWdg* dr3 = dynamic_cast<PIDraw3DWdg *>(mCurBW);
     503      if (dr3 != NULL) dr3->Update3DView();
     504    }
     505    }
    483506    break;
    484507
     
    502525    kk =  mOpt[3]->GetValue()-400;
    503526    if ( (kk < 1) || (kk > 27) )  kk = 1;
     527    if ((k > 0) && (kk < 3)) {  // Protection contre Marker taille 1 autre que Dotmarker
     528      mOpt[3]->SetValue(403);
     529      kk = 3;
     530    }
    504531    drw->SetMarkerAtt(kk, mrk[k]);
    505532    k =  (mOpt[4]->GetValue()-500);
  • trunk/SophyaPI/PI/piimgtools.cc

    r537 r684  
    320320  case 2800 :
    321321    {
    322     min = atof(mText[0]->GetText().c_str());
    323     max = atof(mText[1]->GetText().c_str());
     322    if (mText[0]->GetText().length() > 0)   
     323      min = atof(mText[0]->GetText().c_str());
     324    else min = mpii->Lut()->Min();
     325    if (mText[1]->GetText().length() > 0)   
     326      max = atof(mText[1]->GetText().c_str());
     327    else max = mpii->Lut()->Max();
     328
    324329    if (msg == 2700) {
    325330      del = max_lut-min_lut;
  • trunk/SophyaPI/PI/psfile.cc

    r547 r684  
    274274#define HEADER     "\
    275275%%%%Title: %s\n\
    276 %%%%Creator: PSFile (N.R. 07/08/99)\n\
     276%%%%Creator: PI-PSFile (N.R. 07/08/99)\n\
    277277%%%%CreationDate: %s\
    278278%%%%Pages: (atend)\n\
     
    604604        }
    605605    } /* End if .ps */
     606// On redefint la fonte par defaut - $CHECK$ Reza 11/12/99
     607mFontAtt = PI_RomanFont;
     608mFontSize = 10;
     609mFontName = PI_DefaultFont;
     610fprintf(mPSFile, "/Courier ff %d FS \n", mFontSize) ;
     611setFontDone = true;
    606612currentPage->tmp = ftell(mPSFile);
    607613}
     
    662668            currentBloc->Tx, currentBloc->Ty,
    663669            currentBloc->X0, currentBloc->Y0);
     670    // On redefint la fonte par defaut - $CHECK$ Reza 11/12/99
     671    mFontAtt = PI_RomanFont;
     672    mFontSize = 10;
     673    mFontName = PI_DefaultFont;
     674    fprintf(mPSFile, "/Courier ff %d FS \n", mFontSize) ;
     675    setFontDone = true;
    664676    currentBloc->tmp = ftell(mPSFile) ;
    665677}
     
    710722                           PIFontAtt FontAtt,
    711723                           int FontSize) {
    712     int change = 0;
     724    bool change = false;
    713725
    714726    /* Couleurs */
     
    721733//DBG      printf("PSFile::DrawString(%s) : FontAtt a change : %d %d \n", s, mFontAtt, FontAtt) ;
    722734      mFontAtt = FontAtt;
    723       change = 1;
     735      change = true;
    724736    }
    725737    if ( (FontSize != PI_NotDefFontSize) && (FontSize != mFontSize) ) {
    726738//DBG      printf("PSFile::DrawString(%s) : FontSize a change : %d %d \n", s, mFontSize, FontSize) ;
    727       mFontSize = (PIFontSize) FontSize;  // $CHECK$ EA ajoute le cast un peu au pif
    728       change = 1;
     739      mFontSize = FontSize; 
     740      change = true;
    729741    }
    730742    if( (FontName != mFontName) ) {
    731743//DBG      printf("PSFile::DrawString(%s) : FontName a change : %d %d \n", s, mFontName, FontName) ;
    732744      mFontName = (PIFontName) FontName ;
    733       change = 1 ;
    734     }
    735     if (change) {
     745      change = true ;
     746    }
     747
     748    if (change || !setFontDone) { // $CHECK$ setFontDone Reza 11/12/99
    736749      string fname ;
    737750      switch(mFontName) {
     
    764777      } // endsw
    765778      fprintf(mPSFile, " ff %d FS ", FontSize) ;
    766     }
    767    
    768    
     779      setFontDone = true ;   // $CHECK$ - doit etre fait uniquement a ce moment
     780    }
     781       
    769782    fprintf(mPSFile, "gs %.2f Ux %.2f Uy m (%s) S gr\n", x, y, s) ;
    770     setFontDone = true ;
    771783}
    772784
Note: See TracChangeset for help on using the changeset viewer.