Changeset 18 in Sophya


Ignore:
Timestamp:
Jul 6, 1996, 11:28:11 AM (29 years ago)
Author:
erosmgr
Message:

1) PIApplication SetReady()/Busy()/Blocked() + implementation X
2) Gestion des widgets par les containers (Methodes PIContainer::

ChildAdd, ChildDel, SetAutoDelChilds) et modif ds piwdggen.cc

3) Interception des messages PIMsg_ActiveWdg par PIWindowGen::Process()
4) Appel de Parent->Process() ds PIMsgHandler::Send()
5) Gestion de ButtonPress1() ds PIScDrawWdg:: (Donne les coordonnees

du point + PIMsg_ActiveWdg

6) Envoi de PIMsg_ActiveWdg par PIBaseWdg:: sur ButtonPress1
7) Correction s et petites modifs ds PIDrawWin et PIHisto
8) Correction erreur de delete mDrawers ds PIScDrawWdg::delete
9) Verification/modif PIPixmap:: (SetPixmap(NULL))
10) PIImage:: Nouvelles petites fonctionalites (Cursor, ...) - On peut

supprimer le RzImage et faire SetImage(NULL) en conservant le display.
Amelioration gestion pave.

11) Classe PIPerioX:: Codage avec XToolkit (XtAddTimeOut())
12) pidemo.cc et pidemo.h Version completee avec coupe et fit PSF

Reza 06/07/96

Location:
trunk/SophyaPI/PI
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Makefile

    r17 r18  
    8282 
    8383all: $(LIB)libPI.a
    84 $(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o
     84$(LIB)libPI.a : $(OBJ)piapplgen.o $(OBJ)piapplx.o $(OBJ)pibwdggen.o $(OBJ)pibwdgx.o $(OBJ)picmap.o $(OBJ)picmapgen.o $(OBJ)picmapx.o $(OBJ)picontainergen.o $(OBJ)picontainerx.o $(OBJ)pidrawwin.o $(OBJ)pifilechogen.o $(OBJ)pifilechox.o $(OBJ)pihisto.o $(OBJ)piimage.o $(OBJ)pimenubargen.o $(OBJ)pimenubarx.o $(OBJ)pimenugen.o $(OBJ)pimenux.o $(OBJ)pimsghandler.o $(OBJ)pioptmenugen.o $(OBJ)pioptmenux.o $(OBJ)piperiodx.o $(OBJ)pipixmapgen.o $(OBJ)pipixmapx.o $(OBJ)piscdrawwdg.o $(OBJ)pistdwdggen.o $(OBJ)pistdwdgx.o $(OBJ)piwdggen.o $(OBJ)piwdgx.o $(OBJ)piwindowgen.o $(OBJ)piwindowx.o $(OBJ)pixtbase.o
    8585        $(AR) $(ARFLAGS)  $@ $?
    8686 
     
    180180 pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h picmapx.h \
    181181 picmapgen.h
     182$(OBJ)piperiodx.o: ./piperiodx.cc ./piperiodx.h $(INC)periodic.h
    182183$(OBJ)pipixmapx.o: ./pipixmapx.cc pipixmapx.h pipixmapgen.h pisysdep.h \
    183184 pibwdgx.h pibwdggen.h piwdgx.h piwdggen.h pimsghandler.h picmap.h \
  • trunk/SophyaPI/PI/piapplgen.cc

    r2 r18  
    22
    33PIApplicationGen::PIApplicationGen()
    4 :topcont(NULL), menubar(NULL)
     4:topcont(NULL), menubar(NULL), mState(0)
    55{}
    66
     
    1515return;
    1616}
     17
     18void PIApplicationGen::SetReady()
     19{
     20mState = kReadyState;
     21}
     22
     23void PIApplicationGen::SetBusy()
     24{
     25mState = kBusyState;
     26}
     27
     28void PIApplicationGen::SetBlocked()
     29{
     30mState = kBlockedState;
     31}
     32
     33int PIApplicationGen::GetState()
     34{
     35return mState;
     36}
     37
  • trunk/SophyaPI/PI/piapplgen.h

    r2 r18  
    99class PIApplicationGen : public PIMsgHandler {
    1010public:
     11        enum { kReadyState=0, kBusyState=1, kBlockedState=2 };
     12
    1113                                  PIApplicationGen();
    1214        virtual                   ~PIApplicationGen();
     
    1416        virtual void              Run()=0;
    1517        virtual void              Stop()=0;
     18
     19        virtual void              SetReady();
     20        virtual void              SetBusy();
     21        virtual void              SetBlocked();
     22        virtual int               GetState();
     23
    1624
    1725        virtual PIContainer*      MainWin() {return topcont;}
     
    2230    PIContainer               *topcont;
    2331    PIMenubar                 *menubar;
     32    int                       mState;
    2433};
    2534
  • trunk/SophyaPI/PI/piapplx.cc

    r7 r18  
    11#include <stdio.h>
     2#include <X11/cursorfont.h>
    23#include "piapplx.h"
    34#include "picontainerx.h"
     
    56
    67#define DEBUG_APPLX
     8
     9static Cursor a_curs[3];
     10static bool a_fgcur=false;
    711
    812/* --Methode-- */
     
    3842MBCont()->Show();
    3943topwdg->Manage();
     44
     45if (!a_fgcur)
     46  {
     47  Display *mdsp;
     48  mdsp = XtDisplay (topwdg->XtWdg());
     49  a_curs[0] = XCreateFontCursor(mdsp, XC_arrow);
     50  a_curs[1] = XCreateFontCursor(mdsp, XC_X_cursor);
     51  a_curs[2] = XCreateFontCursor(mdsp, XC_watch);
     52  }
     53
     54mState = -1;
     55SetReady();
    4056}
    4157
     
    4662puts("PIApplicationX::~PIApplicationX()_info : App delete");
    4763#endif
     64Display *mdsp;
     65mdsp = XtDisplay (topwdg->XtWdg());
    4866topwdg->Unmanage();
    4967delete menubar;
     
    5169delete intcont;
    5270delete topwdg;
    53 exit(0);
     71XtCloseDisplay(mdsp);
     72return;
    5473}
    5574
     
    7190return;
    7291}
     92
     93
     94/* --Methode-- */
     95void PIApplicationX::SetReady()
     96{
     97if (mState != kReadyState)
     98  {
     99  Display * mdsp;
     100  mState = kReadyState;
     101  mdsp = XtDisplay (topwdg->XtWdg());
     102  XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[0]);
     103  XFlush(mdsp);
     104  }
     105}
     106
     107/* --Methode-- */
     108void PIApplicationX::SetBusy()
     109{
     110if (mState != kBusyState)
     111  {
     112  Display * mdsp;
     113  mState = kBusyState;
     114  mdsp = XtDisplay (topwdg->XtWdg());
     115//  if ( XtIsRealized(topwdg->XtWdg()) )
     116  XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[2]);
     117  XFlush(mdsp);
     118  }
     119return;
     120}
     121
     122/* --Methode-- */
     123void PIApplicationX::SetBlocked()
     124{
     125if (mState != kBlockedState)
     126  {
     127  Display * mdsp;
     128  mState = kBlockedState;
     129  mdsp = XtDisplay (topwdg->XtWdg());
     130  XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[1]);
     131  XFlush(mdsp);
     132  }
     133}
  • trunk/SophyaPI/PI/piapplx.h

    r2 r18  
    1616  virtual void    Stop() { mStop = false; }
    1717
     18  virtual void    SetReady();
     19  virtual void    SetBusy();
     20  virtual void    SetBlocked();
     21
    1822  PIContainer*    MBCont() { return intcont; }
    1923protected:
  • trunk/SophyaPI/PI/pibwdggen.cc

    r11 r18  
    4343void PIBaseWdgGen::But1Press(int /*x*/, int /*y*/)
    4444{
     45Send(PIMsg_ActiveWdg);
    4546#ifdef DEBUG_RZXB
    4647printf ("PIBaseWdgGen::But1Press PosX,Y= %d %d \n", x, y);
  • trunk/SophyaPI/PI/pibwdgx.cc

    r11 r18  
    584584void PIBaseWdgX::But1Release(int x, int y)
    585585{
     586Send(PIMsg_ActiveWdg);
    586587#ifdef DEBUG_PIBWDGX
    587588printf ("PIBaseWdgX::ButReleasePosX,Y= %d %d \n", x, y);
     
    643644#ifdef DEBUG_PIBWDGX
    644645printf("PIBaseWdgX::Keyboard: Key= %d (%c)  Mod= %d \n", key, (char)key, (int)kmod);
    645 XSync(XtDisplay(this->XtWdg()), 0);
     646XFlush(XtDisplay(this->XtWdg()));
    646647#endif
    647648return;
  • trunk/SophyaPI/PI/picontainergen.cc

    r2 r18  
    11#include "picontainergen.h"
     2
     3
     4#define NCHALGRP 4
    25
    36/* --Methode-- */
     
    58                               int sx, int sy, int px, int py)
    69: PIWdg(par, nom, sx, sy, px, py) , stvis(0)
    7 {}
     10{
     11mNCh = 0;
     12mACSup = mPaSup = false;
     13mChilds = new (PIWdgGen * [NCHALGRP]);
     14mMxCh = NCHALGRP;
     15}
    816
    917
    1018/* --Methode-- */
    1119PIContainerGen::~PIContainerGen()
    12 {}
     20{
     21mPaSup = true;   // Pour prevenir ChildDel()
     22if (mACSup)
     23  for(int i=0; i<mNCh; i++)  delete mChilds[i];
     24delete[] mChilds;
     25}
    1326
    1427/* --Methode-- */
     
    1629{
    1730stvis = 1;
    18 return;
    19 }
    20 
    21 /* --Methode-- */
    22 void PIContainerGen::NewChild(PIWdgGen* /*child*/)
    23 {
    2431return;
    2532}
     
    3845}
    3946
     47/* --Methode-- */
     48void PIContainerGen::ChildAdd(PIWdgGen* child)
     49{
     50if (child == NULL)  return;
     51if (mNCh == mMxCh)
     52  {
     53  PIWdgGen ** och = mChilds;
     54  mChilds = new (PIWdgGen * [mMxCh+NCHALGRP]);
     55  for(int i=0; i<mNCh; i++)  mChilds[i] = och[i];
     56  delete[] och;
     57  mMxCh += NCHALGRP;
     58  } 
     59mChilds[mNCh] = child;   mNCh++;
     60return;
     61}
     62
     63/* --Methode-- */
     64void PIContainerGen::ChildDel(PIWdgGen* child)
     65{
     66if (mPaSup) return;  // Ne rien faire si delete initie par Container-parent
     67if ((child == NULL) || (mNCh < 1))  return;
     68for(int i=0; i<mNCh; i++) 
     69  if (mChilds[i] == child)
     70    {
     71    mNCh--;
     72    mChilds[i] = mChilds[mNCh];
     73    break;
     74    }
     75return;
     76}
     77
     78
     79/* --Methode-- */
     80void PIContainerGen::SetAutoDelChilds(bool ad)
     81{
     82mACSup = ad;
     83return;
     84}
  • trunk/SophyaPI/PI/picontainergen.h

    r2 r18  
    1616  virtual      ~PIContainerGen();
    1717
    18   virtual void         NewChild(PIWdgGen * child);
     18  virtual long         kind() {return ClassId; }
    1919
    2020  virtual void         Show();
     
    2222  virtual int          Visible();
    2323
    24   virtual long         kind() {return ClassId; }
     24  virtual void         ChildAdd(PIWdgGen * child);
     25  virtual void         ChildDel(PIWdgGen * child);
    2526
     27  void                 SetAutoDelChilds(bool ad = false);
    2628protected:
    2729  int                  stvis;
     30  PIWdgGen          ** mChilds;
     31  int                  mNCh, mMxCh;
     32  bool                 mPaSup,mACSup;
    2833};
    2934
  • trunk/SophyaPI/PI/pidemo.cc

    r16 r18  
    55
    66#include "perrors.h"
     7#include "ctimer.h"
    78#include "fitsimage.h"
     9#include "dynccd.h"
    810
    911#include "strecinit.h"
     12
     13#include "psf.h"
     14#include "nbmath.h"
    1015
    1116#include "pidemo.h"
     
    1419
    1520/*  Pour le link dynamique  */
    16 typedef FitsImageR4 * (* UsPrFunc) (FitsImageR4 * myimg, int xp, int yp, int dx, int dy,
    17                                     char * arg1, char * arg2);
     21typedef ImageR4 * (* UsPrFunc) (ImageR4 * myimg, int xp, int yp, int dx, int dy,
     22                                char * arg1, char * arg2);
    1823static UsPrFunc  userFunc[3] = { NULL, NULL, NULL };
    1924static void *dlhandle = NULL;
    2025
    21 static char userlibname[256];
    22 
    23 static int DynLink(char *usln);
    24 
    25 int DynLink(char *usln)
     26/*  Variables globales pour les options et parametres de pidemo  */
     27static int pav_sz=15;
     28static bool rect_pav=true;
     29static int typ_psf=1;
     30static bool prt_pval=true;
     31static DynCCD *mdynccd;   // Initialise ds main()
     32static bool his_ckd=true;
     33static float his_min=0.;
     34static float his_max=2000.;
     35static int his_nbin=200;
     36static bool vis_cursshow=true;
     37static int vis_zoom=1;
     38/*  Fin des options / variables globales                         */
     39
     40static int DynLink(bool fgmk);
     41
     42/* Nouvelle-Fonction */
     43int DynLink(bool fgmk)
    2644{
    2745UsPrFunc uf;
    2846int i, rc;
    2947
    30 if (usln != NULL)  strncpy(userlibname, usln, 255);  userlibname[255] = '\0';
    31 
    32 printf("PIDemo_DynLink(): Relinking from %s \n", userlibname);
     48#ifdef C_NO_SHLIBS
     49puts("PIDemo/DynLink() Warning: Cette version a ete cree sans ShLibs ");
     50puts(" ... Pas de possibite de link dynamique -> Pas de UserProc ... ");
     51for(i=0; i<3; i++)  userFunc[i] = NULL;
     52return(0);
     53#endif
     54
     55TIMEF
    3356if (dlhandle != NULL)  dlclose(dlhandle);
    3457for(i=0; i<3; i++)  userFunc[i] = NULL;
    35 dlhandle =  dlopen(userlibname, RTLD_NOW);
     58
     59if (fgmk)
     60  {
     61  printf("PIDemo_DynLink(): Making user.so, Relinking from user.so -> piup.so \n");
     62  puts("PIDemo_DynLink(): Executing make -f piusmak piup.so ");
     63  system("time make -f piusmak piup.so");
     64  SPLITTIME
     65  }
     66
     67dlhandle =  dlopen("piup.so", RTLD_NOW);
    3668if (dlhandle == NULL) 
    37   { printf("PIDemo_DynLink(), Erreur d'ouverture UserShLib %s \n", userlibname);
     69  { printf("PIDemo_DynLink(), Erreur d'ouverture UserShLib piup.so \n");
    3870  return(100); }
    3971rc = 0;
    4072printf("PIDemo_DynLink(): Searching for PIUserProc_1 (Rc=%d) \n", rc);
    41 uf = dlsym(dlhandle, "PIUserProc_1__FPt9FitsImage1ZfiiiiPcT5");
     73uf = (UsPrFunc) dlsym(dlhandle, "PIUserProc_1__FPt5Image1ZfiiiiPcT5");
    4274if (uf != NULL)  userFunc[0] = uf;
    4375else rc += 2;
    4476printf("PIDemo_DynLink(): Searching for PIUserProc_3 (Rc=%d) \n", rc);
    45 uf = dlsym(dlhandle, "PIUserProc_2__FPt9FitsImage1ZfiiiiPcT5");
     77uf = (UsPrFunc) dlsym(dlhandle, "PIUserProc_2__FPt5Image1ZfiiiiPcT5");
    4678if (uf != NULL)  userFunc[1] = uf;
    4779else rc += 4;
    4880printf("PIDemo_DynLink(): Searching for PIUserProc_3 (Rc=%d) \n", rc);
    49 uf = dlsym(dlhandle, "PIUserProc_3__FPt9FitsImage1ZfiiiiPcT5");
     81uf = (UsPrFunc) dlsym(dlhandle, "PIUserProc_3__FPt5Image1ZfiiiiPcT5");
    5082if (uf != NULL)  userFunc[2] = uf;
    5183else rc += 8;
     
    6193/* --Methode-- */
    6294PIDemoApp::PIDemoApp(char *path)
    63 : PIApplication(300, 200)
    64 {
    65 for(int i=0; i<NMXIMG; i++)
    66   { wpii[i] = NULL;  pii[i] = NULL;  img[i] = NULL; }
    67 mNimg = 0;   mCur = NULL;
    68 mState = 0;
    69 
    70 m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"File");
     95: PIApplication(400, 230)
     96{
     97for(int i=0; i<NMXWIN; i++)
     98  { awp[i] = NULL;  taw[i] = 0; }
     99mNwin = 0;   mTnw = 0;  mCurWin = NULL;  mCurPII = NULL;   
     100
     101m[0] = new PIPDMenu((PIMsgHandler *)Menubar(),"Fichier");
     102m[0]->AppendItem("Options", 10110);
    71103m[0]->AppendItem("Open", 10101);
    72104m[0]->AppendItem("Close", 10102);
     
    75107m[0]->AppendItem("Exit", 10105);
    76108
    77 m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Image");
    78 m[1]->AppendItem("Lut...", 10201);
    79 m[1]->AppendItem("Size*1", 10202);
    80 m[1]->AppendItem("Expand*2", 10203);
    81 m[1]->AppendItem("Compress*2", 10204);
    82 m[1]->AppendItem("Expand*4", 10205);
     109m[1] = new PIPDMenu((PIMsgHandler *)Menubar(),"Visual.");
     110m[1]->AppendItem("Lut...", 10221);
     111m[1]->AppendItem("Size*1", 10211);
     112m[1]->AppendItem("Expand*2", 10212);
     113m[1]->AppendItem("Compress*2", 10208);
     114m[1]->AppendItem("Expand*4", 10214);
    83115m[1]->AppendItem("Compress*4", 10206);
    84 
    85 m[2] = new PIPDMenu((PIMsgHandler *)Menubar(),"Operation");
     116m[1]->AppendItem("CursorOFF", 10231);
     117m[1]->AppendItem("CursorON", 10232);
     118m[1]->AppendItem("PrintLut", 10222);
     119
     120m[2] = new PIPDMenu((PIMsgHandler *)Menubar(),"Ope.Image");
    86121m[2]->AppendItem("UserProc-1", 10301);
    87122m[2]->AppendItem("UserProc-2", 10302);
    88123m[2]->AppendItem("UserProc-3", 10303);
    89 m[2]->AppendItem("PixelHisto", 10304);
    90 m[2]->AppendItem("PrintLut", 10305);
    91 m[2]->AppendItem("CheckDyn", 10306);
     124m[2]->AppendItem("PixelHisto", 10331);
     125m[2]->AppendItem("Info (dyn)", 10332);
     126
     127m[3] = new PIPDMenu((PIMsgHandler *)Menubar(),"Ope.Pave");
     128m[3]->AppendItem("Extract", 10401);
     129m[3]->AppendItem("Coupe", 10410);
     130m[3]->AppendItem("Fit-PSF", 10420);
     131m[3]->AppendItem("PixelHisto", 10431);
     132m[3]->AppendItem("Print", 10432);
     133
     134m[4] = NULL;
    92135
    93136AppendMenu(m[0]);
    94137AppendMenu(m[1]);   
    95138AppendMenu(m[2]);
    96 
    97 zoom = new PIPixmap(this->MainWin(), "Zoom", 120,120,10,10);
    98 labimg = new PILabel(this->MainWin(), "PixelValue", 280, 25, 10, 150);
     139AppendMenu(m[3]);
     140
     141
     142zoom = new PIPixmap(this->MainWin(), "Zoom", 140,140,10,20);
     143
     144mTlb[0] = new PILabel(this->MainWin(), "Img: ", 40, 25, 5, 200);
     145labimg = new PILabel(this->MainWin(), "PixelValue", 345, 25, 50, 200);
    99146labimg->SetLabel("");
    100 
    101 draw = new PIDrawWindow(this, "histo", PIWK_normal, 300, 300, 300, 300);
    102 pixelHisto = new Histo(0,2000, 200);
    103 draw->AddDrawer(piHisto=new PIHisto(pixelHisto));
    104 
     147mTlb[1] = new PILabel(this->MainWin(), "Drw: ", 40, 25, 5, 170);
     148labdrw = new PILabel(this->MainWin(), "Coord", 140, 25, 50, 170);
     149labdrw->SetLabel("");
     150
     151lab = NULL;
    105152// lab =  new PILabel(this->MainWin(), "State", 60, 20, 150, 10);
    106153// lab->SetBorderWidth(1);
    107154 
    108 olb[0] = new PILabel(this->MainWin(), "AutoLut :", 60, 25, 140, 30);
    109 pum[0] = new PIPUMenu((PIMsgHandler *)this, "AutoLut");
    110 pum[0]->AppendItem("+3 Sig", 20303);
    111 pum[0]->AppendItem("+2 Sig", 20302);
    112 pum[0]->AppendItem("+1 Sig", 20301);
    113 pum[0]->AppendItem("-1 Sig", 20299);
    114 pum[0]->AppendItem("-2 Sig", 20298);
    115 opm[0] = new PIOptMenu(this->MainWin(), pum[0], 80, 25, 210, 30);
    116 opm[0]->SetValue(20302);
    117 
    118 olb[1] = new PILabel(this->MainWin(), "Zoom :", 60, 25, 140, 70);
    119 pum[1] = new PIPUMenu((PIMsgHandler *)this, "Zoom");
    120 pum[1]->AppendItem("Agr. * 5", 20105);
    121 pum[1]->AppendItem("Agr. * 4", 20104);
    122 pum[1]->AppendItem("Agr. * 3", 20103);
    123 pum[1]->AppendItem("Agr. * 2", 20102);
    124 pum[1]->AppendItem("* 1", 20101);
    125 pum[1]->AppendItem("Red. / 2", 20098);
    126 pum[1]->AppendItem("Red. / 3", 20097);
    127 pum[1]->AppendItem("Red. / 4", 20096);
    128 pum[1]->AppendItem("Red. / 5", 20095);
    129 opm[1] = new PIOptMenu(this->MainWin(), pum[1], 80, 25, 210, 70);
    130 opm[1]->SetValue(20101);
    131 
    132 olb[2] = new PILabel(this->MainWin(), "ColMap :", 60, 25, 140, 110);
    133 pum[2] = new PIPUMenu((PIMsgHandler *)this, "ColMap");
    134 pum[2]->AppendItem("Grey32", 20201);
    135 pum[2]->AppendItem("GreyInv32", 20202);
    136 pum[2]->AppendItem("ColRJ32", 20203);
    137 pum[2]->AppendItem("ColBR32", 20204);
    138 pum[2]->AppendItem("ColRV32", 20205);
    139 opm[2] = new PIOptMenu(this->MainWin(), pum[2], 80, 25, 210, 110);
    140 opm[2]->SetValue(20203);
    141155
    142156pfc = new PIFileChooser(this,"FileChooser", 5000);
     
    144158  pfc->SetPath(path);
    145159
     160mVisTC = new VisuTools(this, this->MainWin());
     161mCutTC = new CutTools(this, this->MainWin());
     162
     163mVisTC->Show();
     164mTCId = 1;
    146165
    147166mLutw = new LutWind(this);
    148167mUP = new UserProcWind(this);
     168mOptw = new OptionWind(this);
    149169
    150170SetReady();
     
    155175{
    156176int i;
    157 for(i=0; i<3; i++)
    158   {
    159   delete m[i];
    160   delete opm[i];
    161   delete pum[i];
    162   delete olb[i];
    163   }
    164 delete pfc;
     177for(i=0; i<5; i++)  delete m[i];
     178
    165179delete lab;
    166180
    167 for(i=0; i<mNimg; i++)
    168   { 
    169   delete pii[i];
    170   delete img[i];
    171   delete wpii[i];
    172   }
     181for(i=0; i<mNwin; i++)
     182  delete awp[i];
    173183
    174184delete zoom;
    175185delete labimg;
    176 
    177 delete draw;
    178 delete pixelHisto;
    179 delete piHisto;
     186delete labdrw;
     187delete mTlb[0];
     188delete mTlb[1];
     189
     190delete pfc;
     191delete mVisTC;
     192delete mCutTC;
    180193
    181194delete mLutw;
    182195delete mUP;
     196delete mOptw;
    183197
    184198
     
    187201void PIDemoApp::Process(long msg, PIMsgHandler* sender, void* data)
    188202{
    189 CMapId cmap[5] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
    190                    CMAP_COLBR32, CMAP_COLRV32 } ;
    191 
    192 
    193 if  ((mState != 0) && (msg > 9999)) { PIBeep(); return; }
    194 
    195 
    196 if ( (msg > 20000)  && (CurrentPIImage()) )
    197   {
    198   msg -= 20000;
    199   if ((msg < 110) && (msg > 90))  // Zoom
    200     CurrentPIImage()->SetZoom(msg-100);
    201   else if ((msg > 200) && (msg < 206)) // Changement de couleur
    202     CurrentPIImage()->SetColMap(cmap[msg-201]);
    203   else if ((msg > 290) && (msg < 310))
    204     CurrentPIImage()->SetLut( CurrentImage()->minPix, CurrentImage()->maxPix,
    205                                kLutType_Lin, msg-300);
    206   }
    207 
    208 else
    209   {
    210   switch (msg)
     203PIWdg *sndw;
     204
     205if  ((GetState()) && (msg > 9999)) { PIBeep(); return; }
     206
     207if ( (msg >= 5100) && (msg < 5200) )    MBProcess1(msg, sender, data);
     208else if ( (msg >= 10100) && (msg < 10200) )  MBProcess1(msg, sender, data);
     209else if ( (msg >= 10200) && (msg < 10300) )  MBProcess2(msg, sender, data);
     210else if ( (msg >= 10300) && (msg < 10400) )  MBProcess3(msg, sender, data);
     211else if ( (msg >= 10400) && (msg < 10500) )  MBProcess4(msg, sender, data);
     212else if (msg == PIMsg_ActiveWdg)
     213  {
     214  sndw = (PIWdg *)sender;
     215  switch(sndw->kind())
    211216    {
    212     case  PIMsg_ActiveWindow :
    213       mCur = (PIImage *)sender;
     217    case PIWindow::ClassId :
     218      mCurWin = (PIWindow *)sender;
     219      break;
     220    case PIImage::ClassId :
     221      mCurPII = (PIImage *)sender;
     222      break;
     223    }
     224  }
     225else printf("PIDemoApp::Process() BUG?? Msg %d  \n", (int)msg);
     226
     227/*   Changement palette outil  */
     228
     229if (msg != 10410)   
     230  {
     231  if (mTCId != 1)  { mCutTC->Hide();  mVisTC->Show();  mTCId = 1; }
     232  }
     233
     234return;
     235}
     236
     237/* --Methode-- */
     238void PIDemoApp::MBProcess1(long msg, PIMsgHandler* /*sender*/, void* data)
     239{
     240
     241  switch(msg)
     242    {
     243    case 10110:
     244      SetBlocked();
     245      mOptw->Show();
    214246      break;
    215247
     
    234266    case 10104:
    235267      SetBusy();
    236       DynLink(NULL);
     268      DynLink(true);
    237269      SetReady();
    238270      break;
     
    243275
    244276    case 5101 :
     277      SetBusy();
    245278      if (data)  OpenImage(pfc->GetFileName());
    246279      SetReady();
     
    248281
    249282    case 5103 :
    250       if (data)  SaveCurrent(pfc->GetFileName());
     283      SetBusy();
     284      if (data)  SaveCurrentImg(pfc->GetFileName());
    251285      SetReady();
    252286      break;     
    253 
    254     case 10201 :
    255       if ( CurrentPIImage() )  mLutw->Show();
    256       break;
    257 
    258     case 10202 :
    259       if ( CurrentPIImage())
    260         {
    261         CurrentPIImage()->SetZoom(1, false);
    262         CurrentPIImage()->SetOffset(0, 0, false);
    263         CurrentImgWin()->SetSize(CurrentImage()->XSize(),
    264                                   CurrentImage()->YSize());
    265         }
    266       break;
    267 
    268     case 10203 :
    269       if ( CurrentPIImage())
    270         {
    271         CurrentPIImage()->SetZoom(2, false);
    272         CurrentPIImage()->SetOffset(0, 0, false);
    273         CurrentImgWin()->SetSize(CurrentImage()->XSize()*2,
    274                                   CurrentImage()->YSize()*2);
    275         }
    276       break;
    277 
    278     case 10204 :
    279       if ( CurrentPIImage())
    280         {
    281         CurrentPIImage()->SetZoom(-2, false);
    282         CurrentPIImage()->SetOffset(0, 0, false);
    283         CurrentImgWin()->SetSize(CurrentImage()->XSize()/2,
    284                                   CurrentImage()->YSize()/2);
    285         }
    286       break;
     287  }
     288return;
     289}
     290
     291/* --Methode-- */
     292void PIDemoApp::MBProcess2(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
     293{
     294int snx,sny,sx,sy,zm,wt;
     295
     296if (CurrentPIImage() == NULL) return;
     297wt = GetCurrentWType();
     298if ( (wt<1) || (wt>9) ) return;
     299
     300switch (msg)
     301  {
     302  case 10221 :
     303    mLutw->Show();
     304    break;
     305
     306  case 10222 :
     307    CurrentPIImage()->Lut()->Print();
     308    break;
     309
     310  case 10231 :
     311    CurrentPIImage()->ShowCursor(false);
     312    break;
     313
     314  case 10232 :
     315    CurrentPIImage()->ShowCursor(true);
     316    break;
     317
     318  case 10211 :
     319  case 10212 :
     320  case 10214 :
     321  case 10208 :
     322  case 10206 :
     323    SetBusy();
     324    if (wt > 3) return;
     325    zm = msg-10210;
     326    CurrentPIImage()->SetZoom(zm, false);
     327    sx = CurrentWindow()->XSize();
     328    sy = CurrentWindow()->YSize();
     329    if (zm > 0)
     330      {
     331      snx = CurrentImage()->XSize()*zm;
     332      sny = CurrentImage()->YSize()*zm;
     333      }
     334    else
     335      {
     336      snx = CurrentImage()->XSize()/(-zm);
     337      sny = CurrentImage()->YSize()/(-zm);
     338      }
     339    if ((snx != sx) || (sny != sy))
     340      {
     341      CurrentPIImage()->SetOffset(0, 0, false);
     342      CurrentWindow()->SetSize(snx, sny);
     343      }
     344    else   CurrentPIImage()->SetOffset(0, 0);
     345    SetReady();
     346    break;
     347
     348  default:
     349    printf("PIDemoApp::MBProcess2() BUG?? Msg %d  \n", (int)msg);   
     350    break;
     351
     352  }
     353
    287354       
    288     case 10205 :
    289       if ( CurrentPIImage())
    290         {
    291         CurrentPIImage()->SetZoom(4, false);
    292         CurrentPIImage()->SetOffset(0, 0, false);
    293         CurrentImgWin()->SetSize(CurrentImage()->XSize()*4,
    294                                   CurrentImage()->YSize()*4);
    295         }
    296       break;
    297 
    298     case 10206 :
    299       if ( CurrentPIImage())
    300         {
    301         CurrentPIImage()->SetZoom(-4, false);
    302         CurrentPIImage()->SetOffset(0, 0);
    303         CurrentImgWin()->SetSize(CurrentImage()->XSize()/4,
    304                                   CurrentImage()->YSize()/4);
    305         }
    306       break;
    307        
    308 
    309     case 10301:
    310     case 10302:
    311     case 10303:
    312       if ( CurrentPIImage() )
    313         {
    314         SetBlocked();
    315         mUP->SelectUP(msg-10300);
    316         mUP->Show();
    317         }
    318       break;
     355}
     356
     357/* --Methode-- */
     358void PIDemoApp::MBProcess3(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
     359{
     360ImageR4 * pim;
     361Histo * pixelhis;
     362float xmn, xmx, vmn, vsg;
     363int k;
     364
     365if (CurrentPIImage() == NULL) return;
     366
     367switch (msg)
     368  {
     369  case 10301:
     370  case 10302:
     371  case 10303:
     372    mUP->SelectUP(msg-10300);
     373    mUP->Show();
     374  break;
    319375     
    320     case 10304:
    321       pixelHisto->Zero();
    322       for (int i=0; i<CurrentImage()->XSize(); i++)
    323         for (int j=0; j<CurrentImage()->YSize(); j++)
    324           pixelHisto->Add((*CurrentImage())(i,j));
    325       piHisto->Refresh();
    326       draw->Show();
    327       break;
    328 
    329     case 10305:
    330       if ( CurrentPIImage() )
    331         (CurrentPIImage()->Lut())->Print();
    332       break;
    333 
    334     case 10306:
    335       if ( CurrentPIImage() )
    336         {
    337         SetBusy();
    338         CurrentImage()->CheckDyn();
    339         CurrentImage()->Print();
    340         SetReady();
    341         }
    342       break;
    343 
    344              
    345     }
    346   }
    347 }
    348 
    349 /* --Methode-- */
    350 void PIDemoApp::SetBusy()
    351 {
    352 mState = 2;
    353 // lab->SetLabel("Working ...");
    354 }
    355 
    356 /* --Methode-- */
    357 void PIDemoApp::SetReady()
    358 {
    359 mState = 0;
    360 // lab->SetLabel("**Ready**");
    361 }
    362 
    363 /* --Methode-- */
    364 void PIDemoApp::SetBlocked()
    365 {
    366 mState = 1;
    367 // lab->SetLabel("--Dialog--");
    368 }
     376  case 10331:
     377    SetBusy();
     378    pim = (ImageR4 *)CurrentImage();
     379    if (his_ckd)
     380      {
     381      pim->MoySigma(vmn, vsg, his_min, his_max, 5);
     382//    pim->Print();
     383      xmn = vmn-4.*vsg;  xmx = vmn+4.*vsg;
     384      if (xmn < his_min) xmn = his_min;
     385      if (xmx > his_max) xmx = his_max;
     386      }
     387    else { xmn=his_min;  xmx = his_max; }
     388    if ((xmx-xmn) < 1.e-6)  xmx = xmn+1.e-3;
     389    pixelhis = new Histo(xmn, xmx, his_nbin);
     390    for (k=0; k<pim->XSize()*pim->YSize(); k++)
     391      pixelhis->Add((*pim)[k]);
     392    AddHisto(pixelhis);
     393    SetReady();
     394    break;
     395
     396  case 10332:
     397    SetBusy();
     398    printf("\n --- Info (Dynamique) de l'image %s ---- \n",
     399           CurrentPIImage()->Nom().c_str());
     400    CurrentImage()->CheckDyn((double)mdynccd->MinADU, (double)mdynccd->MaxADU);
     401    CurrentImage()->Print();
     402    SetReady();
     403    break;
     404
     405  default:
     406    printf("PIDemoApp::MBProcess3() BUG?? Msg %d  \n", (int)msg);   
     407    break;
     408
     409  }
     410
     411}
     412
     413/* --Methode-- */
     414void PIDemoApp::MBProcess4(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
     415{
     416ImageR4 * pim;
     417Histo * pixelhis;
     418float xmn, xmx, vmn, vsg;
     419int zm, k;
     420int dx, dy;
     421float xc, yc;
     422char strg[128];
     423string s;
     424bool keep=false;
     425
     426if (CurrentPIImage() == NULL) return;
     427
     428if (rect_pav)
     429  {
     430  dx = CurrentPIImage()->XSzPave();
     431  dy = CurrentPIImage()->YSzPave(); 
     432  }
     433else  { dx = dy = pav_sz; }
     434
     435xc = CurrentPIImage()->XPave()+0.5;
     436yc = CurrentPIImage()->YPave()+0.5;
     437
     438pim = NULL;
     439pim = new ImageR4(dx, dy);
     440keep = false;
     441CopiePave((ImageR4 &)(*pim), (ImageR4 &)(*CurrentImage()), xc, yc);
     442
     443switch (msg)
     444  {
     445  case 10401:
     446    sprintf(strg,"P(%d,%d)%s",CurrentPIImage()->XPave(),
     447            CurrentPIImage()->YPave(),CurrentPIImage()->Nom().c_str());
     448    strg[32] = '\0';
     449    zm = vis_zoom+1;
     450    if (zm == 0)  zm = 1;
     451    AddImage(pim, strg, zm);
     452    keep = true;   
     453    break;
     454     
     455  case 10410:
     456    if (mTCId != 2)  { mVisTC->Hide();  mCutTC->Show();  mTCId = 2; }
     457    break;
     458
     459  case 10420:
     460    SetBusy();
     461    keep = FitPSF_Res(pim);
     462    SetReady();
     463    break;
     464
     465  case 10431:
     466    SetBusy();
     467    if (his_ckd)
     468      {
     469      pim->MoySigma(vmn, vsg, his_min, his_max, 2);
     470//    pim->Print();
     471      xmn = vmn-4.*vsg;  xmx = vmn+4.*vsg;
     472      if (xmn < his_min) xmn = his_min;
     473      if (xmx > his_max) xmx = his_max;
     474      }
     475    else { xmn=his_min;  xmx = his_max; }
     476    if ((xmx-xmn) < 1.e-6)  xmx = xmn+1.e-3;
     477    pixelhis = new Histo(xmn, xmx, his_nbin);
     478    for (k=0; k<pim->XSize()*pim->YSize(); k++)
     479      pixelhis->Add((*pim)[k]);
     480    AddHisto(pixelhis);
     481    SetReady();
     482    break;
     483
     484  case 10432:
     485    SetBusy();
     486    pim->CheckDyn((double)mdynccd->MinADU, (double)mdynccd->MaxADU);
     487    printf("\n --- Pave en (%d,%d) de l'image %s ---- \n",
     488           CurrentPIImage()->XPave(), CurrentPIImage()->YPave(),
     489           CurrentPIImage()->Nom().c_str());
     490     if (prt_pval)
     491      pim->PrintImage();
     492    else pim->Print();
     493    SetReady();
     494    break;
     495
     496  default:
     497    printf("PIDemoApp::MBProcess4() BUG?? Msg %d  \n", (int)msg);   
     498    break;
     499
     500  }
     501
     502if (!keep) delete pim;
     503return;
     504}
     505
     506/* --Methode-- */
     507bool PIDemoApp::FitPSF_Res(ImageR4 *pim)
     508{
     509ImageR4 *nois, *resid, *pav;
     510PIImage *pii[2];
     511PILabel *lab[2];
     512PIWindow *win;
     513int rc;
     514
     515if (pim == NULL)  return(false);
     516
     517nois = resid = pav = 0;
     518if(typ_psf<1 || typ_psf>4) typ_psf = 1;
     519PSF mypsf(typ_psf,100.0);
     520
     521TIMEF
     522printf("\n -------- Resultat PIDemoApp::FitPSF_Res() ----------- \n");
     523
     524pav = pim;
     525nois = NoiseImage(pav, mdynccd);
     526PSFStar mypsfstar(&mypsf);
     527rc = mypsfstar.IniFit(*pav, *nois);
     528if(rc!=0)
     529  {
     530  printf("PIDemoApp::FitPSF_Res(), Echec IniFit (rc= %d) \n", rc);
     531  delete nois;  return(false);
     532  }
     533rc = mypsfstar.Fit(*pav, *nois);
     534if(rc!=0)
     535  {
     536  printf("PIDemoApp::FitPSF_Res(), Echec Fit (rc= %d) \n", rc);
     537  delete nois;  return(false);
     538  }
     539
     540mypsfstar.Print(2);
     541
     542float smax,axisrat,tiltdeg;
     543rc = paramga((float) mypsfstar.SigX(),(float) mypsfstar.SigY()
     544            ,(float) mypsfstar.Rho(),&smax,&axisrat,&tiltdeg);
     545if(rc==0)
     546  printf("...   sa=%g sb=%g (%g) teta=%g\n",
     547         smax,smax*axisrat,axisrat,tiltdeg);
     548else puts("Erreur paramga ");
     549
     550resid = new ImageR4(pav->XSize(), pav->YSize());
     551CopieImage((ImageR4 &)(*resid), (ImageR4 &)(*pav));
     552*resid -= mypsfstar;
     553
     554SPLITTIME
     555
     556char strg[256];
     557sprintf(strg, "FitPSF Pave[%d %d]_%s" ,CurrentPIImage()->XPave(),
     558            CurrentPIImage()->YPave(),CurrentPIImage()->Nom().c_str());
     559
     560if ((win=GetWindow(340,230,9,strg)) == NULL) 
     561  { delete nois; delete resid;
     562  return(false); }
     563
     564lab[0] = new PILabel(win, "Info1", 330, 25, 5, 5);
     565sprintf(strg,"Sx= %5.2f Sy= %5.2f Rho=%4.2f Xi2Fit= %g",
     566        (float)mypsfstar.SigX(),(float) mypsfstar.SigY(),
     567        (float)mypsfstar.Rho(), mypsfstar.Xi2());
     568lab[0]->SetLabel((string)strg);
     569lab[1] = new PILabel(win, "Info2", 330, 25, 5, 35);
     570sprintf(strg,"Sa= %5.2f Sb= %5.2f Tet= %5.1f deg",
     571        smax, smax*axisrat, tiltdeg);
     572lab[1]->SetLabel((string)strg);
     573
     574int zm;
     575zm = 150/pav->XSize();
     576if (zm < 1) zm = 1;
     577
     578else zm++;
     579
     580for(int i=0; i<2; i++)
     581  {
     582  pii[i] = new PIImage(win, "Pave", 160, 160, 5+170*i, 65);
     583  pii[i]->SetBinding(true, true, true, true);
     584  pii[i]->SetZoomWin(zoom);
     585  pii[i]->SetTextWin(labimg);
     586  pii[i]->SetZoom(zm, false);
     587  pii[i]->SetAutoDelImage(true);
     588  pii[i]->ShowCursor(false);
     589  }
     590
     591pii[0]->SetImage(pav);
     592pii[1]->SetImage(resid);
     593
     594delete nois;
     595return(true);
     596}
     597
     598
    369599
    370600/* --Methode-- */
     
    377607FitsImageR4 * myimg;
    378608
    379 if (mNimg >= NMXIMG)
    380   {
    381   printf("PIDemoApp::OpenImage_Error Two many images (%d) opened ...\n",mNimg);
     609TIMEF
     610
     611if (mNwin >= NMXWIN)
     612  {
     613  printf("PIDemoApp::OpenImage_Error Two many images (%d) opened ...\n",mNwin);
    382614  printf("   Close some of the images ... ");
    383615  return;
     
    406638  {
    407639  string s(buff);
    408   AddImage(myimg, s);
    409   }
    410 }
    411 
    412 /* --Methode-- */
    413 void PIDemoApp::AddImage(FitsImageR4 * nouv, string const & name)
    414 {
    415 int nimg = mNimg;
     640  AddImage(myimg, s, 0, 1);
     641  }
     642}
     643
     644/* --Methode-- */
     645void PIDemoApp::AddImage(ImageR4 * nouv, string const & name, int zm, int typ)
     646{
     647PIImage *pii;
    416648int sx, sy;
    417649
     
    421653  return;
    422654  }
    423 if (mNimg >= NMXIMG)
    424   {
    425   printf("PIDemoApp::AddImage_Error Two many images (%d) opened ...\n",mNimg);
    426   printf("   Close some of the images ... ");
     655if (mNwin >= NMXWIN)
     656  {
     657  printf("PIDemoApp::AddImage_Error Too many (%d) opened windows...\n",mNwin);
     658  printf("   Close some of the windows ... ");
    427659  return;
    428660  }
    429661
    430 img[nimg] = nouv;
    431 if ( (img[nimg]->XSize() <= 0)  || (img[nimg]->YSize() <= 0))
    432   {
    433   printf("PIDemoApp::OpenImage_Error Pb lecture (FitsImage::Read) \n");
     662if ( (nouv->XSize() <= 0)  || (nouv->YSize() <= 0))
     663  {
     664  printf("PIDemoApp::AddImage_Error Pb lecture (FitsImage::Read ?) \n");
    434665  return;
    435666  }
    436667
    437 sx = img[nimg]->XSize();  sy = img[nimg]->YSize();
     668if (zm == 0)  zm = vis_zoom;
     669sx = nouv->XSize()*zm;  sy = nouv->YSize()*zm;
    438670if (sx > 512) sx = 512;
    439671if (sy > 512) sy = 512;
    440672
    441 wpii[nimg] = new PIWindow(this, (char *)name.c_str(), PIWK_normal,
     673awp[mNwin] = new PIWindow(this, (char *)name.c_str(), PIWK_normal,
    442674                          sx, sy, 200, 200);
    443 pii[nimg] = new PIImage(wpii[nimg], (char *)name.c_str(), sx, sy, 0, 0);
    444 pii[nimg]->SetBinding(true, true, true, true);
    445 pii[nimg]->SetZoomWin(zoom);
    446 pii[nimg]->SetTextWin(labimg);
    447 pii[nimg]->SetImage(img[nimg]);
    448 // pii[nimg]->Apply();
    449 wpii[nimg]->Show();
    450 mCur = pii[nimg];
    451 mNimg++;
     675pii = new PIImage(awp[mNwin], (char *)name.c_str(), sx, sy, 0, 0);
     676pii->SetBinding(true, true, true, true);
     677pii->SetZoomWin(zoom);
     678pii->SetTextWin(labimg);
     679pii->SetZoom(zm, false);
     680pii->SetAutoDelImage(true);
     681pii->ShowCursor(vis_cursshow);
     682pii->SetImage(nouv);
     683awp[mNwin]->SetAutoDelChilds(true);
     684awp[mNwin]->Show();
     685if ((typ < 0) || (typ > 9)) typ = 3;
     686taw[mNwin] = typ;
     687mNwin++;  mTnw++;
    452688return;
    453689}
     690
     691
     692/* --Methode-- */
     693void PIDemoApp::AddHisto(Histo *h)
     694{
     695PIDrawWindow *  draw = NULL;
     696PIHisto *pih;
     697char strg[64];
     698
     699if (h == NULL)
     700  {
     701  printf("PIDemoApp::AddHisto_Error  Cannot Add NULL Histo \n");
     702  return;
     703  }
     704if (mNwin >= NMXWIN)
     705  {
     706  printf("PIDemoApp::AddHisto_Error Too many (%d) opened windows...\n",mNwin);
     707  printf("   Close some of the windows ... ");
     708  return;
     709  }
     710
     711mTnw++;
     712sprintf(strg,"Histo (W %d)",mTnw);
     713draw = new PIDrawWindow(this, strg, PIWK_normal, 300, 300, 300, 300);
     714pih = new PIHisto(h);
     715pih->SetAutoDelHisto(true);
     716draw->AddDrawer(pih);
     717draw->DrawWdg()->SetTextWin(labdrw);
     718awp[mNwin] = draw;
     719draw->Show();
     720draw->SetAutoDelChilds(true);
     721taw[mNwin] = 10;
     722mNwin++;
     723return;
     724}
     725
    454726
    455727/* --Methode-- */
     
    458730int n;
    459731if ((n=GetNumCurrent()) < 0)  return;
    460 zoom->SetPixmap(NULL,0,0);
    461 zoom->EraseWindow();
    462 labimg->SetLabel("");
    463 wpii[n]->Hide();
    464 delete pii[n];
    465 delete img[n];
    466 delete wpii[n];
    467 pii[n] = pii[mNimg-1];
    468 wpii[n] = wpii[mNimg-1];
    469 img[n] = img[mNimg-1];
    470 mNimg--;
    471 mCur = NULL;
     732if ((taw[n] > 0) && (taw[n] < 10))
     733  {
     734  zoom->SetPixmap(NULL,0,0);
     735  zoom->EraseWindow();
     736  labimg->SetLabel("");
     737  mCurPII = NULL;
     738  }
     739else if ((taw[n] > 9) && (taw[n] < 20))
     740  labdrw->SetLabel("");
     741
     742awp[n]->Hide();
     743delete awp[n];
     744awp[n] = awp[mNwin-1];
     745taw[n] = taw[mNwin-1];
     746mNwin--;
     747mCurWin = NULL;
    472748return;
    473749}
    474750
    475751/* --Methode-- */
    476 void PIDemoApp::SaveCurrent(string const & flnm)
    477 {
    478 int n;
    479 if ((n=GetNumCurrent()) < 0)  return;
    480 
     752void PIDemoApp::SaveCurrentImg(string const & flnm)
     753{
     754FitsImageR4 *pim = NULL;
     755bool fgcr=false;
     756
     757if (CurrentImage() == NULL)  return;
    481758if (strlen(flnm.c_str()) <= 0)
    482759  {
     
    486763
    487764printf("PIDemoApp::SaveCurrent: Image %s saved to %s \n",
    488        (char *)pii[n]->Nom().c_str(), (char *)flnm.c_str());
     765       (char *)CurrentPIImage()->Nom().c_str(), (char *)flnm.c_str());
     766/*  $CHECK$ Ca ne marche pas ??? pb avec IsFits()
     767if (CurrentImage()->IsFits())  */   
     768if (GetCurrentWType() == 1)
     769  { pim = (FitsImageR4 *) CurrentImage();
     770  fgcr = false; }
     771else
     772  { pim = new FitsImageR4(*CurrentImage(),1);
     773  fgcr = true; }
     774
     775
    489776TRY {
    490   img[n]->Save(flnm);
     777  pim->Save(flnm);
    491778}  CATCH(merr)
    492   { printf("PIDemoApp::SaveCurrent_Error Exception= %d (%s) \n", merr, PeidaExc(merr));  } ENDTRY;
     779  {
     780  printf("PIDemoApp::SaveCurrent_Error Exception= %d (%s) \n", merr, PeidaExc(merr)); 
     781  if (fgcr) { delete pim; fgcr=false; }
     782  } ENDTRY;
     783
     784if (fgcr)  delete pim;
    493785return;
    494786}
     
    498790{
    499791int n=-1;
    500 if (mNimg <= 0)  return(-1);
    501 for(int i=0; i<mNimg; i++)
    502   if (mCur == pii[i])  { n = i; break; }
     792if (mNwin <= 0)  return(-1);
     793for(int i=0; i<mNwin; i++)
     794  if (mCurWin == awp[i])  { n = i; break; }
    503795
    504796if (n < 0) 
    505   printf(" PIDemoApp::GetNumImg() Curret image not found (%lx)\n",(long)mCur);
     797  printf(" PIDemoApp::GetNumCurrent() Current Window not found (%lx)\n",(long)mCurWin);
    506798
    507799return(n); 
     
    509801
    510802/* --Methode-- */
    511 FitsImageR4 * PIDemoApp::CurrentImage()
    512 {
    513 int n;
    514 n = GetNumCurrent();
    515 if (n < 0)  return(NULL);
    516 else return(img[n]);
    517 }
    518 
    519 /* --Methode-- */
    520 PIWindow * PIDemoApp::CurrentImgWin()
    521 {
    522 int n;
    523 n = GetNumCurrent();
    524 if (n < 0)  return(NULL);
    525 else return(wpii[n]);
     803int PIDemoApp::GetCurrentWType()
     804{
     805int k;
     806k = GetNumCurrent();
     807if (k < 0)  return(0);
     808else return(taw[k]);
     809}
     810
     811/* --Methode-- */
     812ImageR4 * PIDemoApp::CurrentImage()
     813{
     814if (mCurPII == NULL)  return(NULL);
     815return((ImageR4 *)mCurPII->Image());
     816}
     817
     818/* --Methode-- */
     819PIWindow * PIDemoApp::GetWindow(int sx, int sy, int typ, char * nom)
     820{
     821PIWindow * win = NULL;
     822
     823if (mNwin >= NMXWIN)
     824  {
     825  printf("PIDemoApp::GetWindow_Error Too many (%d) opened windows...\n",mNwin);
     826  printf("   Close some of the windows ... ");
     827  return(win);
     828  }
     829
     830awp[mNwin] = new PIWindow(this, nom, PIWK_normal,
     831                          sx, sy, 250, 250);
     832awp[mNwin]->SetAutoDelChilds(true);
     833taw[mNwin] = typ;
     834win = awp[mNwin];
     835win->Show();
     836mNwin++;
     837return(win);
     838}
     839
     840
     841
     842/* ........................................................... */
     843/*       Classe VisuTools  (Controle de visualisation)         */
     844/* ........................................................... */
     845
     846VisuTools::VisuTools(PIDemoApp *par, PIContainer *pw)
     847: PIContainer(pw, "visutools", 200, 160, 185, 5)
     848{
     849dap = par;
     850mTlb = new PILabel(this, "VisuTools", 100, 25, 50, 5);
     851
     852mOlb[0] = new PILabel(this, "AutoLut :", 70, 25, 5, 45);
     853mPum[0] = new PIPUMenu((PIMsgHandler *)this, "AutoLut");
     854mPum[0]->AppendItem("+3 Sig", 303);
     855mPum[0]->AppendItem("+2 Sig", 302);
     856mPum[0]->AppendItem("+1 Sig", 301);
     857mPum[0]->AppendItem("-1 Sig", 299);
     858mPum[0]->AppendItem("-2 Sig", 298);
     859mOpt[0] = new PIOptMenu(this, mPum[0], 90, 25, 80, 45);
     860mOpt[0]->SetValue(302);
     861
     862mOlb[1] = new PILabel(this, "Zoom :", 70, 25, 5, 85);
     863mPum[1] = new PIPUMenu((PIMsgHandler *)this, "Zoom");
     864mPum[1]->AppendItem("Agr. * 8", 108);
     865mPum[1]->AppendItem("Agr. * 6", 106);
     866mPum[1]->AppendItem("Agr. * 5", 105);
     867mPum[1]->AppendItem("Agr. * 4", 104);
     868mPum[1]->AppendItem("Agr. * 3", 103);
     869mPum[1]->AppendItem("Agr. * 2", 102);
     870mPum[1]->AppendItem("* 1", 101);
     871mPum[1]->AppendItem("Red. / 2", 98);
     872mPum[1]->AppendItem("Red. / 3", 97);
     873mPum[1]->AppendItem("Red. / 4", 96);
     874mPum[1]->AppendItem("Red. / 5", 95);
     875mPum[1]->AppendItem("Red. / 6", 94);
     876mPum[1]->AppendItem("Red. / 8", 92);
     877mOpt[1] = new PIOptMenu(this, mPum[1], 90, 25, 80, 85);
     878mOpt[1]->SetValue(101);
     879
     880mOlb[2] = new PILabel(this, "ColMap :", 70, 25, 5, 125);
     881mPum[2] = new PIPUMenu((PIMsgHandler *)this, "ColMap");
     882mPum[2]->AppendItem("Grey32", 201);
     883mPum[2]->AppendItem("GreyInv32", 202);
     884mPum[2]->AppendItem("ColRJ32", 203);
     885mPum[2]->AppendItem("ColBR32", 204);
     886mPum[2]->AppendItem("ColRV32", 205);
     887mOpt[2] = new PIOptMenu(this, mPum[2], 90, 25, 80, 125);
     888mOpt[2]->SetValue(203);
     889
     890FinishCreate();
     891}
     892
     893
     894/* --Methode-- */
     895VisuTools::~VisuTools()
     896{
     897
     898delete mTlb;
     899for(int i=0; i<3; i++)
     900  {
     901  delete mOpt[i];
     902  delete mPum[i];
     903  delete mOlb[i];
     904  }
     905}
     906
     907/* --Methode-- */
     908void VisuTools::Process(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
     909{
     910CMapId cmap[5] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
     911                   CMAP_COLBR32, CMAP_COLRV32 } ;
     912
     913if (dap->CurrentPIImage() == NULL)  return;
     914dap->SetBusy();
     915if ((msg < 110) && (msg > 90))  // Zoom
     916  dap->CurrentPIImage()->SetZoom((int)(msg-100));
     917else if ((msg > 200) && (msg < 206)) // Changement de couleur
     918  dap->CurrentPIImage()->SetColMap(cmap[msg-201]);
     919else if ((msg > 290) && (msg < 310))
     920  dap->CurrentPIImage()->SetLut( dap->CurrentImage()->minPix, dap->CurrentImage()->maxPix,
     921                                 kLutType_Lin, msg-300);
     922dap->SetReady();
     923return;
     924}
     925
     926
     927/* ........................................................... */
     928/*           Classe CutTools  (Controle de coupe)              */
     929/* ........................................................... */
     930
     931/* --Methode-- */
     932CutTools::CutTools(PIDemoApp *par, PIContainer *pw)
     933: PIContainer(pw, "cuttools", 200, 160, 185, 5)
     934{
     935int i;
     936
     937dap = par;
     938
     939mOlb = new PILabel(this, "Coupe:", 70, 25, 5, 5);
     940mPum = new PIPUMenu((PIMsgHandler *)this, "Coupe");
     941mPum->AppendItem("H-V", 101);
     942mPum->AppendItem("Diagonal", 102);
     943mOpt = new PIOptMenu(this, mPum, 90, 25, 80, 5);
     944mOpt->SetValue(101);
     945
     946mBut[0] = new PIButton(this, "Y-", 501, 30, 25, 85, 60);
     947mBut[1] = new PIButton(this, "Y+", 502, 30, 25, 85, 120);
     948mBut[2] = new PIButton(this, "X-", 503, 30, 25, 50, 90);
     949mBut[3] = new PIButton(this, "X+", 504, 30, 25, 120, 90);
     950
     951fgpb = true;
     952fgdiag = false;
     953
     954for(i=0; i<2; i++)
     955  { mDrw[i] = NULL;  mPIH[i] = NULL; }
     956 
     957FinishCreate();
     958
     959}
     960
     961
     962/* --Methode-- */
     963CutTools::~CutTools()
     964{
     965int i;
     966
     967for(i=0; i<4; i++)  delete mBut[i];
     968delete mOpt;
     969delete mPum;
     970delete mOlb;
     971}
     972
     973/* --Methode-- */
     974void CutTools::Show()
     975{
     976PIWindow *win;
     977
     978PIContainer::Show();
     979fgpb = true;
     980
     981if (dap->CurrentPIImage() == NULL) return;
     982if (dap->CurrentImage() == NULL) return;
     983
     984mPx = dap->CurrentPIImage()->XPave();
     985mPy = dap->CurrentPIImage()->YPave();
     986if (rect_pav)
     987  {
     988  mDx = dap->CurrentPIImage()->XSzPave();
     989  mDy = dap->CurrentPIImage()->YSzPave();
     990  }
     991else  { mDx = mDy = pav_sz; }
     992if( mDx%2 == 0 ) mDx++;
     993if( mDy%2 == 0 ) mDy++;
     994mDxy = ( mDx > mDy ) ? mDx : mDy;
     995
     996
     997char strg[128];
     998sprintf(strg, "Coupe Pave_%s" ,dap->CurrentPIImage()->Nom().c_str());
     999
     1000if ((win=dap->GetWindow(600,330,12,strg)) == NULL) 
     1001  { fgpb=true;  return; }
     1002mLab = new PILabel(win, "infc", 590, 25, 5, 5);
     1003for(int i=0; i<2; i++)
     1004  {
     1005  mDrw[i] = new PIScDrawWdg(win, "Coupe", 300, 300, 300*i, 30);
     1006  mPIH[i] = NULL;
     1007  } 
     1008fgpb = false;
     1009FillHistos();
     1010return;
     1011}
     1012
     1013
     1014/* --Methode-- */
     1015void CutTools::Process(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
     1016{
     1017if ((fgpb) || (dap->CurrentPIImage() == NULL))
     1018  {  printf("CutTools::Process, Msg= %d , --PB--\n", (int)msg);
     1019  return; }
     1020
     1021
     1022switch(msg)
     1023  {
     1024  case 101:
     1025    if (fgdiag)
     1026      { fgdiag = false;   FillHistos(); }
     1027    break;
     1028
     1029  case 102:
     1030    if (!fgdiag)
     1031      { fgdiag = true;   FillHistos(); }
     1032    break;
     1033
     1034  case 501:
     1035  case 502:
     1036  case 503:
     1037  case 504:
     1038    switch(msg)
     1039      {
     1040      case 501:
     1041        mPy--;
     1042        break;
     1043      case 502:
     1044        mPy++;
     1045        break;
     1046      case 503:
     1047        mPx--;
     1048        break;
     1049      case 504:
     1050        mPx++;
     1051        break;
     1052      }
     1053    dap->CurrentPIImage()->SetPave(mPx, mPy); 
     1054    mPx = dap->CurrentPIImage()->XPave();
     1055    mPy = dap->CurrentPIImage()->YPave();
     1056    FillHistos();
     1057    break;
     1058
     1059  default:
     1060    printf("CutTools::Process/BUG ??? Msg = %d \n", (int)msg);
     1061    break;
     1062  }
     1063return;
     1064}
     1065
     1066/* --Methode-- */
     1067void CutTools::FillHistos()
     1068{
     1069int i;
     1070int xp,yp;
     1071int dx,dy,dxy;
     1072Histo * his[2];
     1073float xmin,xmax;
     1074int ip,jp,imax,jmax;
     1075ImageR4 *myimg;
     1076char buff[256];
     1077char *txt[2] = {"H-V ","Diag"};
     1078
     1079xp = mPx; yp = mPy;
     1080dx = mDx; dy = mDy;  dxy = mDxy;
     1081
     1082myimg = dap->CurrentImage();
     1083
     1084/*  Recherche du pixel maxi  */
     1085imax = xp;
     1086jmax = yp;
     1087xmax = (float) (*myimg)(imax,jmax);
     1088for(i=0;i<dx;i++) {
     1089  ip = xp -(dx-1)/2 + i;
     1090  if( ip < 0 || ip >= myimg->XSize() ) continue;
     1091  for(int j=0;j<dy;j++) {
     1092    jp = yp -(dy-1)/2 + j;
     1093    if( jp < 0 || jp >= myimg->YSize() ) continue;
     1094    if( (float) (*myimg)(ip,jp) < xmax ) continue;
     1095    imax = ip;
     1096    jmax = jp;
     1097    xmax = (float) (*myimg)(imax,jmax);
     1098  }
     1099}
     1100
     1101i = (fgdiag) ? 1 : 0;
     1102sprintf(buff,"Coupe %s en (%d %d) PixMax= %g en (%d %d)",
     1103        txt[i], xp, yp, xmax, imax, jmax);
     1104mLab->SetLabel((string)buff);
     1105
     1106for(i=0; i<2; i++)  delete mPIH[i];
     1107
     1108if (!fgdiag)   // Histos H-V
     1109  {
     1110  xmin = (float) (xp - (dx-1)/2) - 0.5;
     1111  xmax = (float) (xp + (dx-1)/2) + 0.5;
     1112  his[0] = new Histo(xmin,xmax,dx);
     1113  xmin = (float) (yp - (dy-1)/2) - 0.5;
     1114  xmax = (float) (yp + (dy-1)/2) + 0.5;
     1115  his[1] = new Histo(xmin,xmax,dy);
     1116
     1117  for(i=0;i<dx;i++) {
     1118    ip = xp -(dx-1)/2 + i;
     1119    if( ip < 0 || ip >= myimg->XSize() ) continue;
     1120    his[0]->Add((float) ip,(float) (*myimg)(ip,yp));
     1121    }
     1122  for(i=0;i<dy;i++) {
     1123    ip = yp -(dy-1)/2 + i;
     1124    if( ip < 0 || ip >= myimg->YSize() ) continue;
     1125    his[1]->Add((float) ip,(float) (*myimg)(xp,ip));
     1126    } 
     1127  }
     1128else    // Histo diagonals....
     1129  {
     1130  xmin = (float) -(dxy-1)/2 - 0.5;
     1131  xmax = (float)  (dxy-1)/2 + 0.5;
     1132  his[0] = new Histo(xmin,xmax,dxy);
     1133  his[1] = new Histo(xmin,xmax,dxy);
     1134  for(i=0;i<dxy;i++) {
     1135    ip = xp -(dxy-1)/2 + i;
     1136    jp = yp -(dxy-1)/2 + i;
     1137    if( ip < 0 || ip >= myimg->XSize() ) continue;
     1138    if( jp >= 0 && jp < myimg->YSize() )
     1139           his[0]->Add((float) ip-xp,(float) (*myimg)(ip,jp));
     1140    jp = yp +(dxy-1)/2 - i;
     1141    if( jp >= 0 && jp < myimg->YSize() )
     1142           his[1]->Add((float) ip-xp,(float) (*myimg)(ip,jp));
     1143    }
     1144 
     1145  }
     1146for(i=0; i<2; i++)
     1147  {
     1148  mPIH[i] = new PIHisto(his[i]);
     1149  mPIH[i]->SetAutoDelHisto(true);
     1150  mDrw[i]->AddDrawer(mPIH[i]);
     1151  mDrw[i]->SetTextWin(dap->DrawLabelWdg());
     1152  mPIH[i]->Refresh();
     1153  }
     1154
     1155return;
    5261156}
    5271157
     
    5291159/*       Classe LutWind  (Changement de Lut d'image)           */
    5301160/* ........................................................... */
    531 
    532 
    5331161
    5341162/* --Methode-- */
     
    5811209  delete mOpt[i];
    5821210  delete mPum[i];
     1211  delete mOlb[i];
    5831212  }
    5841213}
     
    5971226  mOpt[0]->SetValue(1100);
    5981227else mOpt[0]->SetValue(1101);
    599 mOpt[1]->SetValueStr("NoAuto");
     1228string s("NoAuto");
     1229mOpt[1]->SetValueStr(s);
    6001230dap->SetBlocked();
    6011231PIWindow::Show();
     
    6051235
    6061236/* --Methode-- */
    607 void LutWind::Process(long msg, PIMsgHandler* sender, void* data)
     1237void LutWind::Process(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
    6081238{
    6091239float min, max;
     
    6771307
    6781308/* --Methode-- */
    679 void UserProcWind::Process(long msg, PIMsgHandler* sender, void* data)
    680 {
    681 FitsImageR4 *mimg, *oimg;
     1309void UserProcWind::Show()
     1310{
     1311dap->SetBlocked();
     1312PIWindow::Show();
     1313return;
     1314}
     1315
     1316
     1317/* --Methode-- */
     1318void UserProcWind::Process(long msg, PIMsgHandler* /*sender*/, void* /*data*/)
     1319{
     1320ImageR4 *mimg, *oimg;
    6821321int xp, yp, dx, dy;
    6831322
     
    6851324  {
    6861325  case 2600:
     1326    this->Hide();
    6871327    dap->SetReady();
    688     this->Hide();
    6891328    break;
    6901329
    6911330  case 2500:
     1331    if ((mUpr < 1) || (mUpr > 3))  mUpr=1;
     1332    if (userFunc[mUpr-1] == NULL)
     1333      { printf("UserProcWind::Process()/Warning: pas de UserProcFunc%d \n", mUpr);
     1334      this->Hide(); dap->SetReady(); return; }
    6921335    mimg = dap->CurrentImage();
    6931336    if (mimg == NULL)  return;
     
    6961339    dx = (dap->CurrentPIImage())->XSzPave();
    6971340    dy = (dap->CurrentPIImage())->YSzPave();
     1341    this->Hide();
    6981342    dap->SetBusy();
    699     this->Hide();
    7001343    oimg = NULL;
    7011344    switch (mUpr)
     
    7081351                            (char *) (mText[2]->GetText().c_str()));
    7091352        break;
    710 /*
    711       case 2 :
    712         oimg = PIUserProc_2(mimg, xp, yp, dx, dy,
    713                             (char *) (mText[1]->GetText().c_str()),
    714                             (char *) (mText[2]->GetText().c_str()));
    715         break;
    716 
    717       case 3 :
    718         oimg = PIUserProc_3(mimg, xp, yp, dx, dy,
    719                             (char *) (mText[1]->GetText().c_str()),
    720                             (char *) (mText[2]->GetText().c_str()));
    721         break;
    722 */
    7231353      }   
    7241354    if (oimg)  dap->AddImage(oimg,mText[0]->GetText());
     
    7321362// Le main  ....
    7331363
     1364/* ........................................................... */
     1365/*    Classe OptionWind  Options et valeurs de parametres      */
     1366/* ........................................................... */
     1367
     1368
     1369/* --Methode-- */
     1370OptionWind::OptionWind(PIDemoApp *par)
     1371: PIWindow((PIMsgHandler *)par, "Options (PIDemo)", PIWK_dialog,
     1372           360, 550, 150, 150)
     1373{
     1374dap = par;
     1375
     1376mLab[0] = new PILabel(this, "PaveSz", 60, 30, 20, 60);
     1377
     1378mLab[1] = new PILabel(this, "MinADU", 60, 30, 20, 190);
     1379mLab[2] = new PILabel(this, "MaxADU", 60, 30, 185, 190);
     1380mLab[3] = new PILabel(this, "Gain", 60, 30, 20, 230);
     1381mLab[4] = new PILabel(this, "RONoise", 60, 30, 185, 230);
     1382
     1383mLab[5] = new PILabel(this, "NBinHis", 60, 30, 20, 320);
     1384mLab[6] = new PILabel(this, "MinHis", 60, 30, 20, 360);
     1385mLab[7] = new PILabel(this, "MaxHis", 60, 30, 185, 360);
     1386
     1387mText[0] = new PIText(this, "PaveSz", 90, 30, 85, 60);
     1388mText[0]->SetText("15");
     1389mText[1] = new PIText(this, "MinADU", 90, 30, 85, 190);
     1390mText[1]->SetText("1.");
     1391mText[2] = new PIText(this, "MaxADU", 90, 30, 250, 190);
     1392mText[2]->SetText("32000.");
     1393mText[3] = new PIText(this, "Gain", 90, 30, 85, 230);
     1394mText[3]->SetText("3.");
     1395mText[4] = new PIText(this, "RONoise", 90, 30, 250, 230);
     1396mText[4]->SetText("10.");
     1397mText[5] = new PIText(this, "NBin", 90, 30, 85, 320);
     1398mText[5]->SetText("200");
     1399mText[6] = new PIText(this, "MinHis", 90, 30, 85, 360);
     1400mText[6]->SetText("0.");
     1401mText[7] = new PIText(this, "MaxHis", 90, 30, 250, 360);
     1402mText[7]->SetText("2000.");
     1403
     1404mTlb[0] = new PILabel(this, "--- Fit/Coupe/PrintPave ---", 160, 25, 100, 20);
     1405mTlb[1] = new PILabel(this, "--- DynCCD ---", 160, 25, 100, 150);
     1406mTlb[2] = new PILabel(this, "--- Histogramme ---", 160, 25, 100, 280);
     1407mTlb[3] = new PILabel(this, "--- Visualisation  ---", 160, 25, 100, 410);
     1408
     1409mOlb[0] = new PILabel(this, "TypePSF", 60, 25, 20, 100);
     1410mPum[0] = new PIPUMenu((PIMsgHandler *)this, "TypPSF");
     1411mPum[0]->AppendItem("Gaussienne", 3101);
     1412mPum[0]->AppendItem("Gauss.Int.", 3102);
     1413mPum[0]->AppendItem("DL-Gauss.", 3103);
     1414mPum[0]->AppendItem("DL-GauInt", 3104);
     1415mOpt[0] = new PIOptMenu(this, mPum[0], 90, 25, 85, 100);
     1416mOpt[0]->SetValue(3101);
     1417
     1418mOlb[1] = new PILabel(this, "Def.Zoom", 60, 25, 20, 450);
     1419mPum[1] = NULL;
     1420mOpt[1] = new PIOptMenu(this, dap->VisTC()->ZoomOptMenu(), 90, 25, 85, 450);
     1421mOpt[1]->SetValue(101);
     1422
     1423mCkb[0] = new PICheckBox(this,"ou Rect.Sel.",3001,140, 30, 200, 60);
     1424mCkb[1] = new PICheckBox(this,"PrintPave-PixVal",3002,140, 30, 200, 100);
     1425mCkb[2] = new PICheckBox(this,"AutoMin/Max",3003,140, 30, 200, 320);
     1426mCkb[3] = new PICheckBox(this,"ShowCursor",3004,140, 30, 200, 450);
     1427for(int i=0; i<4; i++) mCkv[i] = true;
     1428
     1429mBut[0] = new PIButton(this, "Apply", 3500, 70, 30, 90, 500);
     1430mBut[1] = new PIButton(this, "Cancel", 3600, 70, 30, 200, 500);
     1431
     1432FinishCreate();
     1433}
     1434
     1435/* --Methode-- */
     1436OptionWind::~OptionWind()
     1437{
     1438int i;
     1439for(i=0; i<2; i++)
     1440  {
     1441  delete mBut[i];
     1442  delete mOpt[i];
     1443  delete mPum[i];
     1444  delete mOlb[i];
     1445  }
     1446for(i=0; i<8; i++)
     1447  {
     1448  delete mLab[i];
     1449  delete mText[i];
     1450  }
     1451for(i=0; i<4; i++) 
     1452  {
     1453  delete mTlb[i];
     1454  delete mCkb[i];
     1455  }
     1456}
     1457
     1458/* --Methode-- */
     1459void OptionWind::Show()
     1460{
     1461char buff[64];
     1462
     1463dap->SetBlocked();
     1464sprintf(buff,"%d", pav_sz);
     1465mText[0]->SetText(buff);
     1466sprintf(buff,"%g", mdynccd->MinADU);
     1467mText[1]->SetText(buff);
     1468sprintf(buff,"%g", mdynccd->MaxADU);
     1469mText[2]->SetText(buff);
     1470sprintf(buff,"%g", mdynccd->Gain);
     1471mText[3]->SetText(buff);
     1472sprintf(buff,"%g", mdynccd->RONoise);
     1473mText[4]->SetText(buff);
     1474sprintf(buff,"%d", his_nbin);
     1475mText[5]->SetText(buff);
     1476sprintf(buff,"%g", his_min);
     1477mText[6]->SetText(buff);
     1478sprintf(buff,"%g", his_max);
     1479mText[7]->SetText(buff);
     1480
     1481mOpt[0]->SetValue(3100+typ_psf);
     1482mOpt[1]->SetValue(100+vis_zoom);
     1483mCkv[0] = rect_pav;
     1484mCkv[1] = prt_pval;
     1485mCkv[2] = his_ckd;
     1486mCkv[3] = vis_cursshow;
     1487for(int i=0; i<4; i++)
     1488  mCkb[i]->SetState(mCkv[i]);
     1489
     1490PIWindow::Show();
     1491return;
     1492}
     1493
     1494
     1495/* --Methode-- */
     1496void OptionWind::Process(long msg, PIMsgHandler* /*sender*/, void* data)
     1497{
     1498
     1499switch (msg)
     1500  {
     1501  case 3001:
     1502  case 3002:
     1503  case 3003:
     1504  case 3004:
     1505    if (data) mCkv[msg-3001] = true;   // J'ai un pb avec les CheckBox->GetState()  Reza ??
     1506    else mCkv[msg-3001] = false;
     1507    break;
     1508
     1509  case 3600:
     1510    dap->SetReady();
     1511    this->Hide();
     1512    break;
     1513
     1514  case 3500:
     1515    pav_sz = atoi(mText[0]->GetText().c_str());
     1516    mdynccd->MinADU = atof(mText[1]->GetText().c_str());
     1517    mdynccd->MaxADU = atof(mText[2]->GetText().c_str());
     1518    mdynccd->Gain = atof(mText[3]->GetText().c_str());
     1519    mdynccd->RONoise = atof(mText[4]->GetText().c_str());
     1520    his_nbin = atoi(mText[5]->GetText().c_str());
     1521    his_min = atof(mText[6]->GetText().c_str());
     1522    his_max = atof(mText[7]->GetText().c_str());
     1523
     1524    typ_psf = mOpt[0]->GetValue() - 3100;
     1525    vis_zoom = mOpt[1]->GetValue() - 100;
     1526
     1527/*
     1528  Je ne sais pas pourquoi ca ne marche pas comme ca Reza $CHECK$ ???
     1529    rect_pav = mCkb[0]->GetState();
     1530    prt_pval = mCkb[1]->GetState();
     1531    his_ckd = mCkb[2]->GetState();
     1532    vis_cursshow = mCkb[3]->GetState();
     1533*/
     1534    rect_pav = mCkv[0];
     1535    prt_pval = mCkv[1];
     1536    his_ckd = mCkv[2];
     1537    vis_cursshow = mCkv[3];
     1538/*
     1539    printf("\n-- %d %d %d %d -- \n", (int)rect_pav, (int)prt_pval, (int)his_ckd,
     1540           (int)vis_cursshow);
     1541    printf("OptionWind::Process(OK) : %d %d (%d) %d %g %g - %d \n",
     1542            typ_psf, pav_sz, (int)rect_pav, his_nbin, his_min, his_max, vis_zoom);
     1543    for(int i=0; i<4; i++)
     1544       printf("ckb[%d] = %d (%d) - ", i, (int)mCkb[i]->GetState(),mCkv[i]);
     1545    puts(" ... ");       
     1546    mdynccd->Print();
     1547*/
     1548    dap->SetReady();
     1549    this->Hide();
     1550
     1551    break;
     1552  default:
     1553//    printf("OptionWind::Process Msg %d received data= %ld\n", (int)msg, (long)data);
     1554    break;
     1555  }
     1556
     1557}
     1558
     1559
    7341560int main(int narg, char *arg[])
    7351561{
    7361562
    7371563char *path;
    738 int rc;
     1564int i, rc, ofa;
     1565char strg[512];
    7391566
    7401567PeidaStarRecoInitiator InitStarReco;
    741  
    742 if (narg > 1)  path = arg[1];
    743 else path = NULL;
    744 
    745 if (narg > 2)  rc = DynLink(arg[2]);
    746 else rc = DynLink("piup.so");
    747 if (rc != 0)
    748   {
    749   printf("PIApp:: Erreur d'ouverture UserProcFunc Shared-Object ... \n");
    750   exit(0);
    751   }
    752 
    753 PIDemoApp app(path);
    754 
    755 app.Run();
    756 
     1568
     1569ofa = 1;   path = NULL;
     1570if (narg > 1)
     1571  {
     1572  if (strcmp(arg[1],"-h") == 0)
     1573    {
     1574    puts("\n piapp: Programme d analyse interactive EROS-2 (Version demo)");
     1575    puts("Usage: piapp [-p ImagePath] [img1 img2 ...]");
     1576    exit(0);
     1577    }
     1578
     1579  if (strcmp(arg[1],"-p") == 0)
     1580    {
     1581    if (narg == 2) 
     1582      { puts("piapp_Erreur: Pb. d argument (piapp -h) ");  exit(1); }
     1583    else { path = arg[2];  ofa = 3; }
     1584    }
     1585  }
     1586
     1587
     1588mdynccd = new DynCCD(1, 1., 32000., 3., 10.);
     1589PIDemoApp * app = new PIDemoApp(path);
     1590app->SetBusy();
     1591rc = DynLink(false);
     1592for(i=ofa; i<narg; i++)
     1593  {
     1594  if (path)  sprintf(strg,"%s/%s", path, arg[i]);
     1595  else strcpy(strg, arg[i]);
     1596  string s(strg);
     1597  app->OpenImage(s);
     1598  }
     1599puts("appel de Application.Run() ... ");
     1600app->SetReady();
     1601app->Run();
     1602
     1603delete app;
    7571604dlclose(dlhandle);
    7581605exit(0);
    7591606}
     1607
     1608
  • trunk/SophyaPI/PI/pidemo.h

    r8 r18  
    1616
    1717
    18 #define NMXIMG 15   // Nb maxi d'images ouvertes simultanement
     18#define NMXWIN 25   // Nb maxi de fenetres ouvertes simultanement
    1919
     20class VisuTools;
     21class CutTools;
    2022class LutWind;
    2123class UserProcWind;
     24class OptionWind;
    2225
    2326class PIDemoApp : public PIApplication {
     
    2831     virtual void   Process(long msg, PIMsgHandler* sender, void* data=NULL);
    2932
    30      void SetBusy();
    31      void SetReady();
    32      void SetBlocked();
    33      void AddImage(FitsImageR4 * nouv, string const & name);
     33     void AddImage(ImageR4 * nouv, string const & name, int zm=0, int typ=3);
     34     void AddHisto(Histo *h);
    3435     void OpenImage(string const & flnm);
    3536     void CloseCurrent();
    36      void SaveCurrent(string const & flnm);
    37      int GetNumCurrent();
    38      inline PIImage * CurrentPIImage() { return (mCur); }
    39      FitsImageR4 * CurrentImage();
    40      PIWindow * CurrentImgWin();
     37     void SaveCurrentImg(string const & flnm);
     38     inline PIImage * CurrentPIImage() { return (mCurPII); }
     39     ImageR4 * CurrentImage();
     40     PIWindow * CurrentWindow() { return (mCurWin); };
     41     int  GetNumCurrent();
     42     int  GetCurrentWType();
     43
     44     PIWindow * GetWindow(int sx, int sy, int typ, char * nom);
     45
     46     inline VisuTools * VisTC()  { return mVisTC; }
     47     inline CutTools *  CutTC()  { return mCutTC; }
     48
     49     inline PILabel * ImagLabelWdg() { return labimg; }
     50     inline PILabel * DrawLabelWdg() { return labdrw; }
    4151
    4252private:
    43     PIPDMenu  *m[3];
    44     PIPUMenu *pum[3];
    45     PIOptMenu * opm[3];
    46     PILabel *olb[3];
     53    void MBProcess1(long msg, PIMsgHandler* sender, void* data=NULL);
     54    void MBProcess2(long msg, PIMsgHandler* sender, void* data=NULL);
     55    void MBProcess3(long msg, PIMsgHandler* sender, void* data=NULL);
     56    void MBProcess4(long msg, PIMsgHandler* sender, void* data=NULL);
     57    bool FitPSF_Res(ImageR4 *pim);
     58
     59    PIPDMenu  *m[5];
    4760    PIButton * but;
    4861    PIPixmap * zoom;
    49     PILabel  * labimg, *lab;
     62    PILabel  * labimg, *labdrw;
     63    PILabel  *lab, * mTlb[2];
    5064    PIFileChooser * pfc;
    5165
    52     PIDrawWindow *  draw;
    53     PIHisto    *    piHisto;
    54     Histo*          pixelHisto;
    55     PIWindow * wpii[NMXIMG];
    56     PIImage *  pii[NMXIMG];
    57     FitsImageR4 * img[NMXIMG];
    58     int mNimg;
    59     PIImage * mCur;
    60     int mState;
     66    VisuTools *mVisTC;
     67    CutTools *mCutTC;
     68
     69    int mTCId;
     70
     71    PIWindow * awp[NMXWIN];
     72    int taw[NMXWIN];
     73    int mNwin,mTnw;
     74    PIWindow * mCurWin;
     75    PIImage * mCurPII;
    6176
    6277    LutWind * mLutw;
    6378    UserProcWind * mUP;
    64    
     79    OptionWind * mOptw;
    6580};
     81
     82/* --------------------------------------------------------------------------- */
     83
     84class VisuTools : public PIContainer {
     85public :
     86  VisuTools(PIDemoApp *par, PIContainer *pw);
     87  ~VisuTools();
     88  virtual void  Process(long msg, PIMsgHandler* sender, void* data=NULL);
     89
     90  PIPUMenu * ZoomOptMenu() { return mPum[1]; }
     91  PIPUMenu * LutOptMenu() { return mPum[0]; }
     92  PIPUMenu * ColMapOptMenu() { return mPum[2]; }
     93
     94private:
     95  PIDemoApp * dap;
     96  PILabel * mTlb;
     97  PIPUMenu * mPum[3];
     98  PIOptMenu * mOpt[3];
     99  PILabel * mOlb[3];
     100 
     101};
     102
     103/* --------------------------------------------------------------------------- */
     104
     105class CutTools : public PIContainer {
     106public :
     107  CutTools(PIDemoApp *par, PIContainer *pw);
     108  ~CutTools();
     109  virtual void  Show();
     110  virtual void  Process(long msg, PIMsgHandler* sender, void* data=NULL);
     111
     112private:
     113  void FillHistos();
     114
     115  PIDemoApp * dap;
     116  PIButton * mBut[4];
     117  PIPUMenu * mPum;
     118  PIOptMenu * mOpt;
     119  PILabel * mOlb;
     120 
     121  int mDx, mDy, mDxy;
     122  int mPx, mPy;
     123
     124  PIHisto * mPIH[2];
     125  PIScDrawWdg * mDrw[2];
     126  PILabel * mLab;
     127
     128  bool fgpb;
     129  bool fgdiag;
     130 
     131};
     132
     133
     134/* --------------------------------------------------------------------------- */
    66135
    67136class LutWind : public PIWindow {
     
    83152};
    84153
     154/* --------------------------------------------------------------------------- */
     155
    85156class UserProcWind : public PIWindow {
    86157public :
    87158                UserProcWind(PIDemoApp *par);
    88159                ~UserProcWind();
     160  virtual void  Show();
    89161  virtual void  Process(long msg, PIMsgHandler* sender, void* data=NULL);
    90162  void          SelectUP(int n) { mUpr = n; };
     
    99171};
    100172
     173
     174/* --------------------------------------------------------------------------- */
     175
     176class OptionWind : public PIWindow {
     177public :
     178  OptionWind(PIDemoApp *par);
     179  ~OptionWind();
     180  virtual void  Show();
     181  virtual void  Process(long msg, PIMsgHandler* sender, void* data=NULL);
     182
     183private:
     184  PIDemoApp * dap;
     185  PILabel * mLab[8];
     186  PIButton * mBut[2];
     187  PIText * mText[8];
     188  PIPUMenu * mPum[2];
     189  PIOptMenu * mOpt[2];
     190  PILabel * mOlb[2];
     191  PILabel * mTlb[4];
     192  PICheckBox * mCkb[4];
     193  bool mCkv[4];
     194 
     195};
  • trunk/SophyaPI/PI/pidrawwin.cc

    r9 r18  
    55:PIWindow(par, nom, k, sx, sy, px, py)
    66{
    7    mDrawWdg = new PIScDrawWdg(this, "", sx-20, sy-20, 10, 10);
     7   mDrawWdg = new PIScDrawWdg(this, nom, sx-20, sy-20, 10, 10);
    88   mDrawWdg->SetBinding(true, true, true, true);   
    99}
  • trunk/SophyaPI/PI/pidrawwin.h

    r15 r18  
    1717 virtual void    AddDrawer(PIScDrawer*);               
    1818 virtual void    SetAxesFlags(int flags=-1);
     19 inline PIScDrawWdg * DrawWdg() { return mDrawWdg; }
    1920private:
    2021  PIScDrawWdg*   mDrawWdg;
  • trunk/SophyaPI/PI/pifilechox.cc

    r6 r18  
    2121pif = (PIFileChooserX *) usd ;
    2222pif->mSt = 1;
     23pif->MWin()->Unmanage();
    2324pif->Send(pif->Msg(), (void *) (pif->GetFileName().c_str()));
    24 pif->MWin()->Unmanage();
    2525return;
    2626}
     
    3232pif = (PIFileChooserX *) usd ;
    3333pif->mSt = 0;
     34pif->MWin()->Unmanage();
    3435pif->Send(pif->Msg(), NULL);
    35 pif->MWin()->Unmanage();
    3636return;
    3737}
  • trunk/SophyaPI/PI/pihisto.cc

    r17 r18  
    55: PIScDrawer(), mHisto(histo)
    66{
     7  ahisup = false;     // Flag pour suppression automatique de mHisto
    78}
    89
    910PIHisto::~PIHisto()
    1011{
     12  if (ahisup)
     13    delete mHisto;
    1114}
     15
     16void
     17PIHisto::SetAutoDelHisto(bool ad)
     18{
     19  ahisup = ad;
     20}
     21
    1222
    1323void
  • trunk/SophyaPI/PI/pihisto.h

    r9 r18  
    1313  virtual void       DrawStats();
    1414  virtual void       Refresh();  // Recalcule les limites, et reaffiche
     15  void               SetAutoDelHisto(bool ad=false);
    1516protected:
    1617  Histo* mHisto;
     18  bool   ahisup;
     19
    1720  virtual void       AttachTo(PIScDrawWdg*);
    1821  virtual void       UpdateSize();
  • trunk/SophyaPI/PI/piimage.cc

    r15 r18  
    2121
    2222img = NULL;
     23aisup = false;
     24curshow = true;
     25winovis = true;     // $CHECK$ Reza A enlever si possible 17/6/96
    2326zow = NULL;
    2427txw = NULL;
     
    3235xmv0 = ymv0 = -1;
    3336dxmv = dymv = 0;
     37xcurs = ycurs = -1;
    3438zoom = 1;
    3539
     
    4650ActivateMove(3);
    4751
    48 
    4952}
    5053
     
    5558if (zpixm) delete zpixm;
    5659if (lut) delete lut;
     60if (aisup)  delete img;   // Suppression automatique d'image
    5761}
    5862
     
    6872  {
    6973//  SetSize(img->XSize(), img->YSize());
    70   SetPave();
     74  CenterPave();
    7175  if (img->minPix>img->maxPix) img->CheckDyn();
    7276  SetLut(img->minPix, img->maxPix, kLutType_Lin, 1, refr);
     
    8892}
    8993
    90 
     94/* --Methode-- */
     95void PIImage::SetAutoDelImage(bool ad)
     96{
     97aisup = ad;
     98return;
     99}
     100
     101/* --Methode-- */
     102void PIImage::ShowCursor(bool sc)
     103{
     104if (curshow == sc) return;
     105curshow = sc;
     106if (curshow)  DrawCursor();
     107else DrawCursor(-1, -1);
     108return;
     109}
    91110
    92111/* --Methode-- */
     
    94113{
    95114if (lut) delete(lut);
    96 if (lauto)
     115if (lauto && img)
    97116  {
    98117  float fracnul, fracsat;
    99118  float fnd, sigfnd;
    100 
     119  float minpix = min; 
     120  float maxpix = max;
    101121  int npix = img->XSize()*img->YSize();
    102   int vitesse=npix/20000;
    103   vitesse = (vitesse < 1) ? 1 : ((vitesse > 10) ? 10 : vitesse );
    104   int nbsig = lauto; 
    105   float fracmax = 0.95;
    106   float minpix = min; 
    107   float maxpix = max; 
    108 
    109   RzFondSig2Ciel(img, vitesse, fracmax, nbsig, 500, &minpix, &maxpix,
     122  int rc = -1;
     123  if (npix > 2500)  // Ca ne marche pas quand il n'y a pas assez de pixels ...
     124    { 
     125    int vitesse=npix/20000;
     126    vitesse = (vitesse < 1) ? 1 : ((vitesse > 25) ? 25 : vitesse );
     127    int nbin=npix/10;
     128    nbin = (nbin < 1) ? 1 : ((nbin > 500) ? 500 : nbin );
     129    int nbsig = lauto; 
     130    float fracmax = 0.95;
     131    rc = RzFondSig2Ciel(img, vitesse, fracmax, nbsig, nbin, &minpix, &maxpix,
    110132                 &fnd, &sigfnd, &min, &max, &fracnul, &fracsat);
     133    }
     134  if (rc != 0)
     135    {
     136    img->CheckDyn(minpix, maxpix);
     137    min = img->moyPix-3.*img->sigPix;
     138    max = img->moyPix+3.*img->sigPix;
     139    if (min < minpix)  min = minpix;
     140    if (max > maxpix)  max = maxpix;
     141    }
    111142  }
    112143
     
    129160}
    130161
     162/* --Methode-- */
     163void PIImage::SetZoom(float fzm, bool refr)
     164{
     165int zm;
     166
     167if (fzm < 0.01) return;
     168if (fzm < 1.)  zm = -(1./fzm);
     169else zm = (int)(fzm+0.25);
     170SetZoom(zm, refr);
     171return;
     172}
    131173
    132174/* --Methode-- */
     
    137179else if (zm < -10) zoom = -10;
    138180else zoom = zm;
    139 SetOffset();
    140 if (refr) Apply();
    141 return;
    142 }
     181if (img)
     182  { SetOffsetFromPave();
     183  if (refr) Apply(); }
     184return;
     185}
     186
     187/* --Methode-- */
     188float PIImage::GetZoom()
     189{
     190if (zoom >= 1)  return((float)zoom);
     191else return(-1./(float)zoom);
     192}
     193
    143194
    144195/* --Methode-- */
     
    151202if (oy >= (img->YSize()-1))  oy = img->YSize()-2;
    152203offx = ox;  offy = oy;
     204CenterPave();
    153205if (refr) Apply();
    154206return;
    155207}
     208
     209
     210/* --Methode-- */
     211void PIImage::SetPave(int x, int y, bool refr)
     212{
     213int xc, yc;
     214
     215if (img == NULL) 
     216  { offx = offy = 0;
     217  xpav = ypav = 0;
     218  return; }
     219
     220if ( (x >= (img->XSize()-1)) || ( x < 0)  ||
     221     (y >= (img->YSize()-1)) || ( y < 0)  ) return;
     222
     223xpav = x;  ypav = y;
     224if (PosImg2W(xpav,ypav,&xc, &yc))  // Il faut recenter l'image
     225  { SetOffsetFromPave(); 
     226  if (refr) Apply(true);  }
     227else if (refr)
     228  { Apply(false);  if (curshow)  DrawCursor();  }
     229
     230return;
     231}
     232
    156233
    157234/* --Methode-- */
     
    167244void PIImage::Apply(bool mw)
    168245{
    169 if (mw) ComputePixmap();
     246if (img == NULL)  return;
     247if (mw)
     248  {
     249  ComputePixmap();
     250  Send(PIMsg_ActiveWdg);
     251  }
    170252if (zow != NULL)
    171253  {
     
    180262  txw->SetLabel((string)buff);
    181263  }
    182 Send(PIMsg_ActiveWindow, (char *)this);
     264
    183265return;
    184266}
     
    189271// printf("PIImage::Resize\n");
    190272PIPixmap::Resize();
    191 SetPave();
     273CenterPave();
    192274Apply();
    193275return;
     
    195277
    196278/* --Methode-- */
     279void PIImage::Draw(int x0, int y0, int dx, int dy)
     280{
     281PIPixmap::Draw(x0, y0, dx, dy);
     282winovis = false;    // $CHECK$ Reza A enlever si possible 17/6/96
     283if (curshow)
     284  {
     285  int xc,yc;
     286  PosImg2W(xpav, ypav, &xc, &yc);
     287  if ((xc >= x0) && (xc < x0+dx) &&
     288      (yc >= y0) && (yc < y0+dy) )  DrawCursor(xc, yc);
     289  }
     290return;
     291}
     292
     293/* --Methode-- */
    197294void PIImage::But1Press(int x, int y)
    198295{
    199296int xp, yp;
    200297
     298Send(PIMsg_ActiveWdg);
    201299if (img == NULL)  return;
    202300if ( PosW2Img(x, y, &xp, &yp) )  return;
     
    204302xpav = xp;  ypav = yp;
    205303Apply(false);
     304if (curshow)  DrawCursor(-1,-1);
    206305return;
    207306}
     
    224323{
    225324SelPointerShape(PI_ArrowPointer);
     325if (curshow)  DrawCursor();
    226326return;
    227327}
     
    233333int xp, yp;
    234334
     335Send(PIMsg_ActiveWdg);
    235336if (img == NULL)  return;
    236337if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
    237338xmv0 = x;  ymv0 = y;  dxmv = dymv = 0;
    238 Send(PIMsg_ActiveWindow, (char *)this);
     339if (curshow)  DrawCursor(-1,-1);
    239340SelGOMode(PI_GOXOR);
     341if (GetColMapId() == CMAP_COLRJ32)
    240342SelForeground(PI_Yellow);
    241 SelLine(PI_ThinLine);
     343else SelForeground(PI_Magenta);
     344SelLine(PI_NormalLine);
    242345return;
    243346}
     
    261364int xp, yp, xp2, yp2;
    262365
    263 if (img == NULL)  return;
    264366if (img == NULL)  return;
    265367if (xmv0 < 0)  return;
     
    276378
    277379Apply(false);
     380if (curshow)  DrawCursor();
    278381return;
    279382}
     
    285388int xp, yp;
    286389
     390Send(PIMsg_ActiveWdg);
    287391if (img == NULL)  return;
    288392if ( PosW2Img(x, y, &xp, &yp) )  { xmv0 = -1;  return; }
     393if (curshow)  DrawCursor(-1,-1);
    289394SelPointerShape(PI_TDLRArrowPointer);
    290395xmv0 = xp;
    291396ymv0 = yp;
    292 Send(PIMsg_ActiveWindow, (char *)this);
    293397return;
    294398}
     
    476580}
    477581
     582/* --Methode-- */
     583void PIImage::DrawCursor()
     584{
     585int xc, yc;
     586if (PosImg2W(xpav, ypav, &xc, &yc)) DrawCursor(-1, -1);
     587else DrawCursor(xc, yc);
     588return;
     589}
     590
     591#define CURSHSIZE  25
     592 
     593/* --Methode-- */
     594void PIImage::DrawCursor(int xc, int yc)
     595{
     596
     597if ((xcurs>=0) && (ycurs>=0))
     598  PIPixmap::Draw(xcurs-CURSHSIZE, ycurs-CURSHSIZE, CURSHSIZE*2, CURSHSIZE*2);
     599
     600if ((xc >= 0) && (yc >= 0))
     601  {
     602  xcurs = xc;   ycurs = yc;
     603  if (winovis)  return;      // $CHECK$ Reza A enlever si possible 17/6/96
     604  if (zoom < 3)  SelLine(PI_NormalLine);
     605  else SelLine(PI_ThickLine);
     606  SelGOMode(PI_GOCopy);
     607  DrawLine(xcurs-CURSHSIZE, ycurs, xcurs-4, ycurs);
     608  DrawLine(xcurs+4, ycurs, xcurs+CURSHSIZE, ycurs);
     609  DrawLine(xcurs, ycurs-CURSHSIZE, xcurs, ycurs-4);
     610  DrawLine(xcurs, ycurs+4, xcurs, ycurs+CURSHSIZE);
     611  }
     612else { xcurs = ycurs = -1; }
     613
     614return;
     615}
    478616
    479617/* --Methode-- */
     
    498636
    499637
    500 
    501 /* --Methode-- */
    502 void PIImage::SetOffset()
     638/* --Methode-- */
     639int PIImage::PosImg2W(int xp, int yp, int * xiw, int * yiw)
     640{
     641if (zoom > 0)
     642  {
     643  *xiw = (xp-offx)*zoom+(zoom/2);
     644  *yiw = (yp-offy)*zoom+(zoom/2);
     645  }
     646else
     647  {
     648  *xiw = (offx-xp)/zoom;
     649  *yiw = (offy-yp)/zoom;
     650  }
     651
     652if (*xiw > XSize())  *xiw = -1;
     653if (*yiw > YSize())  *yiw = -1;
     654
     655if ((*xiw < 0) || (*yiw < 0))  return(1);
     656else return(0);
     657}
     658
     659
     660/* --Methode-- */
     661void PIImage::SetOffsetFromPave()
    503662{
    504663if (zoom > 0)
     
    522681
    523682/* --Methode-- */
    524 void PIImage::SetPave()
     683void PIImage::CenterPave()
    525684{
    526685int xwsz, ywsz;
    527686
    528 xwsz = XSize();  ywsz = YSize();
     687if (zoom > 0)
     688  { xwsz = XSize()/zoom; 
     689  ywsz = YSize()/zoom;  }
     690else
     691  { xwsz = -(XSize()*zoom);
     692  ywsz = -(YSize()*zoom); }
     693 
    529694if (xwsz > (img->XSize()-offx)) xwsz = (img->XSize()-offx);
    530695if (ywsz > (img->YSize()-offy)) ywsz = (img->YSize()-offy);
  • trunk/SophyaPI/PI/piimage.h

    r11 r18  
    2525
    2626  void SetImage(RzImage *pim, bool refr=true);
     27  void SetAutoDelImage(bool ad = false);
     28
    2729  void SetZoomWin(PIPixmap * zw, bool refr=true);
    2830  inline void SetTextWin(PILabel * tw) { txw = tw; };
     31  void ShowCursor(bool sc=true);
    2932
    3033  void SetLut(float min, float max, int typlut=kLutType_Lin,
     
    3336
    3437  void SetZoom(int zm, bool refr=true);
     38  void SetZoom(float fzm, bool refr=true);
     39  float GetZoom();
     40
    3541  void SetOffset(int ox, int oy, bool refr=true);
     42  void SetPave(int x, int y, bool refr=true);
    3643
    3744  virtual void SetColMap(CMapId cmap, bool refr=true);
     
    4855
    4956  virtual void Resize();
     57  virtual void Draw(int x0, int y0, int dx, int dy);
    5058
    5159  virtual void But1Press(int x, int y);
     
    6775  void ComputeZoomPixmap();
    6876
     77  void DrawCursor();
     78  void DrawCursor(int xc, int yc);
     79
    6980  int PosW2Img(int xiw, int yiw, int * xp, int * yp);
    70   void SetOffset();
    71   void SetPave();
    72   void SetPave(int x, int y, int dx=-1, int dy = -1);
     81  int PosImg2W(int xp, int yp, int * xiw, int * yiw);
     82
     83  void SetOffsetFromPave();
     84  void CenterPave();
    7385
    7486// Les donnees
    7587
    7688  RzImage * img;
     89  bool aisup;
     90  bool curshow;
     91  bool winovis;   // $CHECK$ Reza A enlever si possible 17/6/96
    7792
    7893  unsigned char * pixm;
     
    91106  int xmv0, ymv0;
    92107  int dxmv, dymv;
     108  int xcurs, ycurs;
    93109  int xszpav, yszpav;
    94110
  • trunk/SophyaPI/PI/pimak

    r16 r18  
    7676
    7777#------------------------------------------------- End of Makefile.h -------
    78 all : piapp
     78all : piapp piapp_nosh
    7979
    80 piapp : $(EXE)piapp $(SLB)piup.so user.so
     80piapp : $(EXE)piapp $(SLB)piup.so
     81 
     82piapp_nosh : $(EXE)piapp_nosh
    8183 
    8284
     
    8688              -L$(SLB) -lPI -lOuIm -lerosc -lStarReco \
    8789              -lgcxx -lXm -lXt -lX11 -lm 
     90
     91$(EXE)piapp_nosh  : $(OBJ)pidemo_nosh.o $(LIB)libPI.a $(LIB)libStarReco.a  \
     92               $(LIB)libOutils.a $(LIB)libImages.a $(LIB)libmath.a $(LIB)libdiv.a
     93        g++ -o $(EXE)piapp_nosh $(OBJ)pidemo_nosh.o \
     94              -L$(LIB) -lPI -lStarReco -lImages -lOutils -lmath -ldiv \
     95              -lXm -lXt -lX11 -lm
     96 
    8897$(SLB)piup.so : $(OBJ)piup_def.o \
    8998                $(SLB)libOuIm.so $(SLB)liberosc.so
     
    91100        -none -L$(SLB) -lOuIm -lerosc -lgcxx -lm -lc
    92101
    93 user.so : $(OBJ)piup.o \
    94           $(SLB)libOuIm.so $(SLB)liberosc.so
    95         ld -shared -o user.so -all $(OBJ)piup.o \
    96         -none -L$(SLB) -lOuIm -lerosc -lgcxx -lm -lc
    97 
     102$(OBJ)pidemo_nosh.o: pidemo.cc pidemo.h
     103        g++ -g -O -c -Wall -Wpointer-arith \
     104            -Wmissing-prototypes -Wsynth -I$(INC) -I$(CXI) \
     105            -D C_NO_SHLIBS -o $(OBJ)pidemo_nosh.o pidemo.cc
    98106
    99107$(OBJ)pidemo.o: ./pidemo.cc \
     
    120128 $(INC)utils.h pidrawwin.h \
    121129 $(INC)piup.h
    122 $(OBJ)piup.o: piup.cc  piup.h \
    123  $(INC)perrors.h \
    124  $(INC)exceptions.h \
    125  $(INC)defs.h \
    126  $(INC)fitsimage.h \
    127  $(INC)cimage.h \
    128  $(INC)rzimage.h \
    129  $(INC)rzvect.h \
    130  $(INC)machine.h \
    131  $(INC)datatypes.h \
    132  $(INC)fitsheader.h \
    133  $(INC)fitskeys.h \
    134  $(INC)utils.h $(INC)peida.h
    135130$(OBJ)piup_def.o: piup_def.cc  piup.h \
    136131 $(INC)perrors.h \
  • trunk/SophyaPI/PI/pimsghandler.cc

    r2 r18  
    1818PIMsgHandler::Send(long msg, void* data)
    1919{
    20         Process(msg, this, data);
     20//      Process(msg, this, data);  $CHECK$  Reza 12/06/96
     21// Send par defaut appelle le process du parent $CHECK$
     22if (msgParent)
     23  msgParent->Process(msg, this, data);
     24
    2125}
    2226
  • trunk/SophyaPI/PI/pimsghandler.h

    r8 r18  
    88enum {
    99 // Les messages
    10         PIMsg_ActiveWindow  = 1,
     10        PIMsg_ActiveWdg     = 1,
    1111        PIMsg_OK            = 2,
    1212        PIMsg_Cancel        = 3,
  • trunk/SophyaPI/PI/piperiodx.cc

    r15 r18  
    11#include "piperiodx.h"
    2 #include <algo.h>
    3 #include <signal.h>
    42
    5 PIPeriodX::PIPeriodX(int d)
    6 : PIPeriodGen(d), it(-1)
    7 {}
     3/* Nouvelle-Fonction */
     4static void xttimer_action(XtPointer usd, XtIntervalId * /*tid*/)
     5{
     6PIPeriodX * pip;
     7XtIntervalId id;
     8pip = (PIPeriodX *)usd;
     9pip->DoPeriodic();
     10id = XtAddTimeOut(pip->Interval()*1000, xttimer_action, pip);
     11pip->SetTimerId(id);
     12return;
     13}
    814
     15
     16/* --Methode-- */
     17PIPeriodX::PIPeriodX(int dt, UsPeriodicAction act, void * usp)
     18: Periodic(dt, act, usp)
     19{
     20}
     21
     22/* --Methode-- */
    923PIPeriodX::~PIPeriodX()
    10 {}
     24{
     25if (mFgact) Stop();
     26}
    1127
    12 void
    13 PIPeriodX::Start()
     28/* --Methode-- */
     29void PIPeriodX::Start(int dt)
    1430{
    15   if (it < 0) {
    16     if (!actifs) actifs = new PIPeriodList;
    17     it = 0;
    18     if (actifs->size() == 0) {
    19       signal(SIGALRM, CallBack);
    20       alarm(1);
    21     }
    22     actifs->push_back(this);
    23   }
     31if (mFgact) return;
     32if (dt > 0)  mDt = dt;
     33
     34mTId = XtAddTimeOut(mDt*1000, xttimer_action, this);
     35mFgact = true;
     36return;
    2437}
    2538
     
    2740PIPeriodX::Stop()
    2841{
    29   if (it >= 0) {
    30     it = -1;
    31     remove(actifs->begin(), actifs->end(), this);
    32     if (actifs->size() == 0) {
    33       signal(SIGALRM, NULL);
    34       delete actifs;
    35       actifs = NULL;
    36     }
    37   }
     42if(mFgact)
     43  XtRemoveTimeOut(mTId);
     44mFgact = false;
     45return;
    3846}
    3947
    40 PIPeriodList* PIPeriodX::actifs = NULL;
    41 
    42 void PIPeriodX::CallBack(int)
    43 {
    44   if (!actifs) return;
    45 
    46   for (PIPeriodList::iterator i = actifs->begin(); i != actifs->end(); i++) {
    47     PIPeriodX* p = (PIPeriodX*) *i;
    48     p->it ++;
    49     if (p->it >= p->dt) {
    50       p->it = 0;
    51       p->DoPeriodic();
    52     }
    53   }
    54   alarm(1);
    55 }
    56 
  • trunk/SophyaPI/PI/piperiodx.h

    r15 r18  
    33#define PIPERIODX_H
    44
    5 #include "piperiodgen.h"
     5#include <X11/Intrinsic.h>
     6#include "periodic.h"
    67
    7 class PIPeriodX : public PIPeriodGen {
     8class PIPeriodX : public Periodic {
    89public:
    9   PIPeriodX(int dt);
     10  PIPeriodX(int dt, UsPeriodicAction act=NULL, void * usp=NULL);
    1011  ~PIPeriodX();
    1112
    12   void Start();
    13   void Stop();
     13  virtual void Start(int dt=-1);
     14  virtual void Stop();
    1415
    15   static PIPeriodList* actifs;
    16   static void CallBack(int);
     16  inline void SetTimerId(XtIntervalId id) {mTId=id; }
    1717
    1818protected:
    19   int it;
     19XtIntervalId mTId;
    2020};
    2121
  • trunk/SophyaPI/PI/pipixmapx.cc

    r9 r18  
    3232unsigned char *pp;
    3333
    34 for(j=0; j<ny; j++)
     34if (pixmap)
    3535  {
    36   pp = pixmap+j*nx;
    37   for(i=0; i<nx; i++)
    38     { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
     36  for(j=0; j<ny; j++)
     37    {
     38    pp = pixmap+j*nx;
     39    for(i=0; i<nx; i++)
     40      { XPutPixel(myximg, i, j, cmap->Color(*pp) );  pp++; }
     41    }
     42
     43  for(j=ny; j<YSize(); j++)
     44    for(i=nx; i<XSize(); i++)
     45      XPutPixel(myximg, i, j, 0 );
    3946  }
    40 
    41 for(j=ny; j<YSize(); j++)
    42   for(i=nx; i<XSize(); i++)
    43     XPutPixel(myximg, i, j, 0 );
    44 
    4547PIBaseWdgX::Refresh();
    4648}
     
    8688 
    8789XPutImage(mdsp, xw, mygc, myximg, x0, y0, x0, y0, dx, dy);
    88 XSync(mdsp, 0);
     90XFlush(mdsp);
    8991
    9092return;
     
    129131int depth;
    130132int pad;
     133int i,j;
    131134
    132135xw = XtWindow(XtWdg());
     
    140143if (myximg == NULL)  return;
    141144myximg->data = new char [YSize()*myximg->bytes_per_line];
    142 if (myximg->data == NULL)  XFree(myximg);
     145if (myximg->data == NULL) 
     146  { XFree(myximg); myximg = NULL; }
     147
     148for(j=0; j<YSize(); j++)
     149  for(i=0; i<XSize(); i++)
     150    XPutPixel(myximg, i, j, 0 );
     151
    143152return;
    144153}
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r15 r18  
    22#include "generalfit.h"
    33#include <algo.h>
     4
    45
    56PIScDrawWdg::PIScDrawWdg(PIContainerGen *par, char *nom,
     
    1213  SetAxesFlags(kAxesDflt);
    1314  clip = true;
     15  padsup = false;
     16  mTxw = NULL;
     17  ActivateButton(1);    // Pour pouvoir activer la fenetre et coordonnees
     18  ActivateMove(1);      //    "         "         "        "
    1419  ActivateButton(2);
    1520  ActivateMove(2);
     
    488493PIScDrawWdg::RemoveDrawer(PIScDrawer* d)
    489494{
     495  if (padsup)  return;
    490496  mDrawers.remove(d);
    491497  d->mDrawWdg = NULL;
     
    495501PIScDrawWdg::DeleteDrawers()
    496502{
     503  padsup = true;
    497504  for(list<PIScDrawer*>::iterator i = mDrawers.begin(); i != mDrawers.end(); i++)
    498505    delete *i;
    499    
    500506  mDrawers.erase(mDrawers.begin(),mDrawers.end());
     507  padsup = false;
    501508}
    502509
     
    535542
    536543
     544
     545// Gestion affichage coordonnees du point
     546void
     547PIScDrawWdg::But1Press(int x, int y)
     548{
     549  if (UpdateText(x, y))
     550     SelPointerShape(PI_CrossPointer);
     551  Send(PIMsg_ActiveWdg);
     552
     553}
     554
     555void
     556PIScDrawWdg::Ptr1Move(int x, int y)
     557{
     558  UpdateText(x, y);
     559}
     560
     561void
     562PIScDrawWdg::But1Release(int x, int y)
     563{
     564  if (UpdateText(x, y))
     565    SelPointerShape(PI_ArrowPointer);
     566
     567}
     568
     569bool
     570PIScDrawWdg::UpdateText(int xp, int yp)
     571{
     572  if (mTxw == NULL)  return(false);
     573
     574  char buff[128];
     575  double dx, dy;
     576  Local2Sc(xp, yp, dx, dy);
     577  sprintf(buff, "X= %g  Y= %g",  dx, dy);
     578  mTxw->SetLabel((string)buff);
     579  return(true);
     580
     581}
     582
    537583// Gestion du zoom
    538 
    539584void
    540585PIScDrawWdg::But2Press(int x, int y)
     
    550595  SelGOMode(PI_GOXOR);
    551596  SelLine(PI_ThinLine);
     597  Send(PIMsg_ActiveWdg);
    552598}
    553599
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r15 r18  
    55#include "pisysdep.h"
    66#include PIBWDG_H
     7#include PISTDWDG_H
    78
    89#include <list.h>
     
    6768  virtual void       SetAxesFlags(int flags=kAxesDflt);
    6869 
     70  void   SetTextWin(PILabel * tw) {mTxw = tw; }
     71
    6972  double XMin() const {return xMin;}
    7073  double XMax() const {return xMax;}
     
    7578  void   NoClip() {clip = false;}
    7679  void   Clip() {clip = true;}
    77  
    78  
     80   
     81
     82  virtual void       But1Press(int x, int y);
     83  virtual void       But1Release(int x, int y);
     84  virtual void       Ptr1Move(int x, int y);
     85
    7986  virtual void       But2Press(int x, int y);
    8087  virtual void       But2Release(int x, int y);
     
    103110  PIPointer cPointer;
    104111  PILineAtt cLatt;
     112  PILabel * mTxw; 
    105113  bool clip;
    106  
     114  bool padsup;
     115
     116
    107117private:
    108118  void DrawHTicks(double y, double tickUp, double tickDown, double xBeg, double xStep);
     
    110120  void DrawHLabels(double y, double xBeg, double xStep, int just=0);
    111121  void DrawVLabels(double x, double yBeg, double yStep, int just=0);
     122 
     123  bool  UpdateText(int xp, int yp);
    112124};
    113125
  • trunk/SophyaPI/PI/pisysdep.h

    r15 r18  
    4040  #define PIPIXMAP_H "pipixmapx.h"
    4141
     42  #define PIPERIODIC_H "piperiodicx.h"
     43
    4244#endif
    4345
  • trunk/SophyaPI/PI/pitestapp.cc

    r15 r18  
    207207  this->label->SetLabel(truc);
    208208
    209   if (msg == PIMsg_ActiveWindow)
     209  if (msg == PIMsg_ActiveWdg)
    210210    { /* printf("Process: Setting active ImageWindow (%lx) \n", (long)data); */
    211211    cur = (PIImage *)data; }
  • trunk/SophyaPI/PI/piup.cc

    r13 r18  
    88#include "piup.h"
    99
    10 FitsImageR4 * PIUserProc_1(FitsImageR4 * myimg, int xp, int yp, int dx, int dy,
    11                            char * arg1, char * arg2)
     10ImageR4 * PIUserProc_1(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     11                       char * arg1, char * arg2)
    1212{
    1313printf("**** PIUserProc_1 Pave[%d*%d] en (%d,%d) %s %s  Filtrage passe-bas 3*3 \n",
    1414       dx, dy, xp, yp, arg1, arg2);
    1515ImageR4 filt(3,3);
    16 FitsImageR4 * out;
     16ImageR4 * out;
    1717
    1818// Definition du filtre passe-bas
     
    2323
    2424filt.PrintImage();
    25 out = new FitsImageR4(myimg->XSize(), myimg->YSize());
     25out = new ImageR4(myimg->XSize(), myimg->YSize());
    2626TIMEF ;
    2727FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt);
     
    2929}
    3030 
    31 FitsImageR4 * PIUserProc_2(FitsImageR4 * myimg, int xp, int yp, int dx, int dy,
    32                            char * arg1, char * arg2)
     31ImageR4 * PIUserProc_2(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     32                       char * arg1, char * arg2)
    3333{
    3434printf("**** PIUserProc_2 Pave[%d*%d] en (%d,%d) %s %s  Ombre 3*3 \n",
     
    3636printf(" PIUserProc_2(%d %d %s %s)  Ombre 3*3 \n", xp, yp, arg1, arg2);
    3737ImageR4 filt(3,3);
    38 FitsImageR4 * out;
     38ImageR4 * out;
    3939
    4040// Definition du filtre ombre
     
    4646filt(2,0) = 2.;
    4747filt.PrintImage();
    48 out = new FitsImageR4(myimg->XSize(), myimg->YSize());
     48out = new ImageR4(myimg->XSize(), myimg->YSize());
    4949TIMEF ;
    5050FilterImage((ImageR4 *) myimg, (ImageR4 *)out, &filt);
     
    5353
    5454 
    55 FitsImageR4 * PIUserProc_3(FitsImageR4 * , int xp, int yp, int dx, int dy,
    56                            char * arg1, char * arg2)
     55ImageR4 * PIUserProc_3(ImageR4 * , int xp, int yp, int dx, int dy,
     56                       char * arg1, char * arg2)
    5757{
    5858printf("PIUserProc_3 Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n",
  • trunk/SophyaPI/PI/piup.h

    r11 r18  
    1 #include "fitsimage.h"
     1#include "cimage.h"
    22
    3 FitsImageR4 * PIUserProc_1(FitsImageR4 * myimg, int xp, int yp, int dx, int dy,
    4                            char * arg1, char * arg2);
    5 FitsImageR4 * PIUserProc_2(FitsImageR4 * myimg, int xp, int yp, int dx, int dy,
    6                            char * arg1, char * arg2);
    7 FitsImageR4 * PIUserProc_3(FitsImageR4 * myimg, int xp, int yp, int dx, int dy,
    8                            char * arg1, char * arg2);
     3ImageR4 * PIUserProc_1(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     4                       char * arg1, char * arg2);
     5ImageR4 * PIUserProc_2(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     6                       char * arg1, char * arg2);
     7ImageR4 * PIUserProc_3(ImageR4 * myimg, int xp, int yp, int dx, int dy,
     8                       char * arg1, char * arg2);
  • trunk/SophyaPI/PI/piup_def.cc

    r11 r18  
    88#include "piup.h"
    99
    10 FitsImageR4 * PIUserProc_1(FitsImageR4 * , int xp, int yp, int dx, int dy,
    11                            char * arg1, char * arg2)
     10ImageR4 * PIUserProc_1(ImageR4 * , int xp, int yp, int dx, int dy,
     11                       char * arg1, char * arg2)
    1212{
    1313printf("PIUserProc_1/Dummy Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n",
     
    1616}
    1717 
    18 FitsImageR4 * PIUserProc_2(FitsImageR4 * , int xp, int yp, int dx, int dy,
    19                            char * arg1, char * arg2)
     18ImageR4 * PIUserProc_2(ImageR4 * , int xp, int yp, int dx, int dy,
     19                       char * arg1, char * arg2)
    2020{
    2121printf("PIUserProc_2/Dummy Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n",
     
    2424}
    2525 
    26 FitsImageR4 * PIUserProc_3(FitsImageR4 * , int xp, int yp, int dx, int dy,
    27                            char * arg1, char * arg2)
     26ImageR4 * PIUserProc_3(ImageR4 * , int xp, int yp, int dx, int dy,
     27                       char * arg1, char * arg2)
    2828{
    2929printf("PIUserProc_3/Dummy Pave[%d,%d] en (%d %d) %s %s ne fait rien !\n",
  • trunk/SophyaPI/PI/piwdggen.cc

    r2 r18  
    1212parent = par;
    1313SetMsg(0);
    14 if (par)  par->NewChild(this);
     14if (par)  par->ChildAdd(this);   //  On previent le container parent 
    1515return;
    1616}
     
    2020PIWdgGen::~PIWdgGen()
    2121{
     22if (parent)  parent->ChildDel(this);   //  On previent le container parent
    2223}
    2324
  • trunk/SophyaPI/PI/piwindowgen.cc

    r2 r18  
    11#include "piwindowgen.h"
    22
     3
     4/* --Methode-- */
    35PIWindowGen::PIWindowGen(PIMsgHandler *par, char *nom, PIWindowKind k,
    46                         int sx, int sy, int px, int py)
     
    911
    1012
     13/* --Methode-- */
    1114PIWindowGen::~PIWindowGen()
    1215{}
    1316
    1417
    15 
     18/* --Methode-- */
     19void PIWindowGen::Process(long msg, PIMsgHandler* sender, void* data)
     20/*  On intercepte le message ActiveWdg, avant de le renvoyer, */
     21/*  avec un message ActiveWdg de la part de la fenetre        */
     22{
     23if (msg == PIMsg_ActiveWdg)
     24  Send(msg);
     25ReSend(msg, sender, data);
     26return; 
     27}
  • trunk/SophyaPI/PI/piwindowgen.h

    r2 r18  
    2020
    2121  virtual long      kind() {return ClassId; }
     22
     23  virtual void      Process(long msg, PIMsgHandler* sender, void* data=NULL);
    2224 
    23 protected:
     25protected: 
    2426  PIWindowKind         mWtyp;
    2527};
Note: See TracChangeset for help on using the changeset viewer.