source: Sophya/trunk/SophyaPI/PIext/pistdimgapp.cc@ 375

Last change on this file since 375 was 374, checked in by ercodmgr, 26 years ago

Corrections diverses et fichier de numero de version pour piapp Reza 9/8/99

  • Property svn:executable set to *
File size: 32.4 KB
Line 
1#include "machdefs.h"
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5
6#include <typeinfo>
7
8#include <string>
9#include <vector>
10#if defined(__KCC__)
11using std::string ;
12#include <vector.h>
13#endif
14
15
16#include "strutil.h"
17#include "timing.h"
18#include "perrors.h"
19#include "ctimer.h"
20
21#include "psighand.h"
22
23#include "cimage.h" // pour pouvoir faire extract
24
25#include "pistdimgapp.h"
26#include "pihisto2d.h"
27#include "psfile.h"
28#include "piimgtools.h"
29#include "pidrwtools.h"
30
31#include "pistzwin.h"
32
33#include "piinit.h"
34#include "piversion.h"
35#include "piaversion.h"
36
37
38static char ImgDir[256];
39static char WorkDir[256];
40
41
42/* ........................................................... */
43/* Classe PIStdImgApp */
44/* ........................................................... */
45
46/* --Methode-- */
47PIStdImgApp::PIStdImgApp(int narg, char* arg[])
48: PIApplication(420, 320, narg, arg)
49{
50
51// Les menus
52m[0] = new PIMenu(Menubar(),"Fichier");
53m[0]->AppendItem("Help", 10100);
54m[0]->AppendItem("Open-Fits", 10120);
55m[0]->AppendItem("Open-PPF", 10130);
56m[0]->AppendItem("Close", 10110);
57m[0]->AppendItem("delete", 10111);
58// m[0]->AppendItem("Options", 10101);
59m[0]->AppendItem("Exit", 10105);
60
61m[1] = new PIMenu(Menubar(),"Objets");
62m[1]->AppendItem("ObjectManager", 10201);
63m[1]->AppendItem("OpenOutPPF", 10220);
64m[1]->AppendItem("CloseOutPPF", 10230);
65
66m[2] = new PIMenu(Menubar(),"Tools");
67m[2]->AppendItem("Show ImageTools", 10301);
68m[2]->AppendItem("Show DrawerTools", 10302);
69m[2]->AppendItem("Ext.Pave", 10304);
70m[2]->AppendItem("Ext.Pave+Org", 10305);
71m[2]->SetSensitivityMsg(10305, false);
72m[2]->AppendItem("Cuts X,Y", 10306);
73m[2]->SetSensitivityMsg(10306, false);
74mc = new PIMenu(m[2], "StackTools");
75mc->AppendItem("DispNext", 10320);
76mc->AppendItem("Blink 0.5s", 10321);
77mc->AppendItem("Blink 1s", 10322);
78mc->AppendItem("Blink 2s", 10324);
79mc->AppendItem("Stop Blink", 10329);
80mc->AppendItem("RemoveCurrent", 10330);
81m[2]->AppendPDMenu(mc);
82m[2]->SetSensitivity("StackTools", false);
83
84m[3] = new PIMenu(Menubar(),"Window");
85m[3]->AppendItem("StackWindow", 10400);
86m[3]->AppendItem("Window", 10411);
87m[3]->AppendItem("Window 2x1", 10421);
88m[3]->AppendItem("Window 1x2", 10412);
89m[3]->AppendItem("Window 2x2", 10422);
90m[3]->AppendItem("Window 3x1", 10431);
91m[3]->AppendItem("Window 3x3", 10433);
92
93m[4] = new PIMenu(Menubar(),"PostScript");
94m[4]->AppendItem("OpenPS", 10501);
95m[4]->AppendItem("ClosePS", 10505);
96m[4]->AppendItem("Window->PS", 10511);
97m[4]->AppendItem("Image->PS", 10515);
98m[4]->AppendItem("Window->EPS", 10512);
99m[4]->AppendItem("Image->EPS", 10516);
100m[4]->SetSensitivityMsg(10515, false);
101m[4]->SetSensitivityMsg(10516, false);
102
103m[5] = new PIMenu(Menubar(),"Special");
104m[5]->AppendItem("CloseAll", 10601);
105m[5]->AppendCheckItem("Red.Out/Err", 10602);
106m[5]->AppendCheckItem("Catch SigFPE", 10603);
107m[5]->AppendCheckItem("Catch SigSEGV", 10604);
108
109m[6] = new PIMenu(Menubar(),"Modules");
110
111AppendMenu(m[0]);
112AppendMenu(m[1]);
113AppendMenu(m[2]);
114AppendMenu(m[3]);
115AppendMenu(m[4]);
116AppendMenu(m[5]);
117// AppendMenu(m[6]); Menu Modules vide pour le moment
118
119int scsx, scsy;
120ScreenSz(scsx, scsy);
121if (scsy <= 600) mFgScSz = 0;
122else if (scsy <= 800) mFgScSz = 1;
123else if (scsy <= 1024) mFgScSz = 2;
124else mFgScSz = 3;
125int msx = 420+mFgScSz*60;
126int msy = 320+mFgScSz*40;
127MainWin()->SetSize(msx, msy);
128
129int bss = 100+mFgScSz*15;
130gimv = new PIPixmap(MainWin(), "GloV", bss, bss, 5, 5);
131gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
132zoom = new PIPixmap(MainWin(), "Zoom", bss, bss, bss+10, 5);
133zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
134cmapv = new PICMapView(MainWin(), "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
135cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
136
137int cpy = bss+10+14+mFgScSz*2+5;
138
139// Creation d'une console avec gestion des commandes
140mCons = new PIConsole(MainWin(), "Console", 30200, 512, 132, msx, msy-cpy, 0, cpy );
141mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
142mCons->AcceptCmd(true, 50);
143redirecout = false;
144// RedirectStdOutErr(true); pas par defaut
145
146char buff[128];
147mCons->AddStr(" ............ starting piapp .............\n", PIVA_Blue );
148sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
149 (double)PI_VERSIONNUMBER, (float)PeidaVersion());
150mCons->AddStr(buff, PIVA_Blue );
151mCons->AddStr(" ..........................................\n", PIVA_Blue );
152// PrintPeidaVersion();
153
154
155mObjMgr = new NamedObjMgr;
156mCmd = new PIACmd(mObjMgr, this);
157
158char* varenv;
159ImgDir[0] = WorkDir[0] = '\0';
160if ( (varenv=getenv("PEIDA_IMAGES")) != NULL ) strncpy(ImgDir, varenv, 256);
161if ( (varenv=getenv("PEIDA_WORK")) != NULL ) strncpy(WorkDir, varenv, 256);
162
163pfc = new PIFileChooser(this,"FileChooser", 5000);
164
165mObjmgrw = new ObjMgrWind(this);
166mPpinmgrw = new PPInMgrWind(this);
167
168// Attention : A faire apres creation de ObjMgrWind !!!
169mObjMgr->SetImgApp(this);
170
171// Gestion des feneteres widgets et drawers
172mWId = mDId = mBWId = 0;
173mCurWin = NULL;
174mCurWdg = NULL;
175mLastWdg = NULL;
176mGrW = NULL;
177mStW = NULL;
178mGrIdx = mStIdx = -1;
179
180mFCMsg = 0;
181mFgCWImg = false;
182
183// Gestion fichiers PS
184num_eps = 0;
185name_ps = "";
186name_ps = "pia.ps";
187mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
188
189// Gestion OUT-PPF
190mPpfout = NULL;
191name_outppf = "";
192
193// Attributs graphiques courants
194mFCol = mBCol = PI_NotDefColor;
195mLAtt = PI_NotDefLineAtt;
196mFSz = PI_NotDefFontSize;
197mFAtt = PI_NotDefFontAtt;
198mMSz = -1;
199mMrk = PI_NotDefMarker;
200mCmapid = CMAP_OTHER;
201mZoom = 0;
202mAxesFlags = kBoxAxes | kExtTicks | kLabels;
203mXmin = mYmin = -1.;
204mXmax = mYmax = 1;
205SaveGraphicAtt();
206
207// Initialisation
208PIAppInitiator * piai = new PIAppInitiator(this);
209SetReady();
210}
211
212/* --Methode-- */
213PIStdImgApp::~PIStdImgApp()
214{
215int i;
216
217delete mc;
218for(i=0; i<7; i++)
219 if (m[i]) delete m[i];
220
221WindMList::iterator it;
222for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
223
224delete mObjMgr;
225delete mCmd;
226
227delete zoom;
228delete gimv;
229delete cmapv;
230
231delete pfc;
232
233delete mCons;
234
235delete mObjmgrw;
236delete mPpinmgrw;
237
238// Les fichiers
239if (mpsfile) delete mpsfile;
240if (mPpfout) delete mPpfout;
241
242}
243
244/* --Methode-- */
245void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
246{
247PIWdg *sndw;
248PIMessage tmsg, smm;
249
250tmsg = msg;
251msg = UserMsg(msg);
252smm = ModMsg(tmsg);
253
254//printf("SuperDebug: msg=%d Mod=%d State=%d\n", (int)msg, (int)smm, (int)GetState());
255if ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
256
257// Messages active-window
258if (smm == PIMsg_Active)
259 {
260 sndw = dynamic_cast<PIWdg *>(sender);
261 switch(sndw->kind())
262 {
263 case PIWindow::ClassId :
264 mCurWin = dynamic_cast<PIWindow *>(sndw);
265 break;
266
267 case PIScDrawWdg::ClassId :
268 case PIDraw3DWdg::ClassId :
269 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
270// cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
271 if (mFgCWImg) {
272// cerr << "*DBG* ImgTools -> NonSensitive " << endl;
273 m[2]->SetSensitivityMsg(10305, false);
274 m[2]->SetSensitivityMsg(10306, false);
275 m[4]->SetSensitivityMsg(10515, false);
276 m[4]->SetSensitivityMsg(10516, false);
277 mFgCWImg = false;
278 }
279 break;
280 case PIImage::ClassId :
281 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
282 if (!mFgCWImg) {
283// cerr << "*DBG* ImgTools -> Sensitive " << endl;
284 m[2]->SetSensitivityMsg(10305, true);
285 m[2]->SetSensitivityMsg(10306, true);
286 m[4]->SetSensitivityMsg(10515, true);
287 m[4]->SetSensitivityMsg(10516, true);
288 mFgCWImg = true;
289 }
290 break;
291 /*
292 default :
293 mCurWdg = NULL;
294 if (mFgCWImg) {
295 m[2]->SetSensitivityMsg(10305, false);
296 m[2]->SetSensitivityMsg(10306, false);
297 m[4]->SetSensitivityMsg(10515, false);
298 m[4]->SetSensitivityMsg(10516, false);
299 mFgCWImg = false;
300 }
301 break;
302 */
303 }
304 }
305// Message window-close
306else if (smm == PIMsg_Close)
307 {
308 sndw = (PIWdg *)sender;
309 if(sndw->kind() == PIWindow::ClassId)
310 {
311 mCurWin = (PIWindow *)sender;
312 if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false);
313 DeleteWindow(mCurWin);
314 }
315 else
316 printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
317 (int)tmsg, (int)sndw->kind(), (long)sender);
318 }
319
320// Traitement des messages des menus
321else if ( (msg >= 10100) && (msg < 10200) ) MBProcess1(msg, sender, data);
322else if ( (msg >= 10200) && (msg < 10300) ) MBProcess2(msg, sender, data);
323else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data);
324else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data);
325else if ( (msg >= 10500) && (msg < 10600) ) MBProcess5(msg, sender, data);
326else if ( (msg >= 10600) && (msg < 10700) ) MBProcess6(msg, sender, data);
327else if ( msg == 30200 ) { // Objet PIConsole
328 string s = mCons->GetCmdString();
329 string s2 = "\nExecuting " + s + "\n";
330 mCons->AddStr(s2.c_str(), PIVA_Blue, true);
331 SetBusy();
332 TRY {
333 mCmd->Interpret(s);
334 } CATCH(merr) {
335 fflush(stdout);
336 cout << endl;
337 cerr << endl;
338 string es = PeidaExc(merr);
339 cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;
340 }
341
342 SetReady();
343 }
344
345else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n",
346 (int)tmsg,(int)msg,(int)smm);
347
348
349return;
350}
351
352/* --Methode-- */
353void PIStdImgApp::SetReady()
354{
355mCons->SetSensitive();
356gimv->SetSensitive();
357PIApplication::SetReady();
358}
359
360/* --Methode-- */
361void PIStdImgApp::SetBusy()
362{
363mCons->SetUnSensitive();
364gimv->SetUnSensitive();
365PIApplication::SetBusy();
366}
367
368/* --Methode-- */
369void PIStdImgApp::SetBlocked()
370{
371mCons->SetUnSensitive();
372gimv->SetUnSensitive();
373PIApplication::SetBlocked();
374}
375
376
377/* --Methode-- */
378int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid)
379{
380PIImage* pii;
381PIWindow* win;
382int sx, sy, px, py, flag;
383
384if (nouv == NULL)
385 {
386 printf("PIStdImgApp::DispImage_Error Cannot Display NULL image \n");
387 return(-1);
388 }
389
390if ( (nouv->XSize() <= 0) || (nouv->YSize() <= 0))
391 {
392 printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d \n",
393 nouv->XSize(), nouv->YSize());
394 return(-1);
395 }
396
397int zm = 1;
398if (mZoom == 0) { // Facteur de zoom auto
399 zm = (nouv->XSize() > nouv->YSize()) ? nouv->XSize() : nouv->YSize();
400 zm = (zm >= 250) ? 250/zm : 1;
401 }
402else zm = mZoom;
403
404if (zm == 0) zm = 1;
405if (zm < -10) zm = -10;
406if (zm > 10) zm = 10;
407
408if (zm > 0) { sx = nouv->XSize()*zm; sy = nouv->YSize()*zm; }
409else {
410 sx = (int)((float)nouv->XSize()*(-1./float(zm)));
411 sy = (int)((float)nouv->YSize()*(-1./float(zm)));
412 }
413if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
414if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
415px = py = 0;
416win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
417pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
418pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
419pii->SetZoomWin(zoom, false);
420pii->SetGloVWin(gimv, false);
421pii->SetCMapWin(cmapv, false);
422pii->SetZoom(zm, false);
423if ( mCmapid != CMAP_OTHER ) pii->SetColMapId(mCmapid, false);
424pii->ShowCursor(true);
425pii->SetUserData(NULL, oid);
426pii->SetImage(nouv, true);
427// printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() );
428mCurWin = win;
429mCurWdg = pii;
430mLastWdg = pii;
431mBWId++;
432mBWList[mBWId] = pii;
433return(mBWId);
434}
435
436
437/* --Methode-- */
438int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, int oid)
439{
440if (scd == NULL)
441 {
442 printf("PIStdImgApp::DispScDrawer_Error Cannot Add NULL ScDrawer \n");
443 return(-1);
444 }
445
446// Changement d'attributs graphiques courants du drawer
447if (mFCol != PI_NotDefColor) scd->SetColAtt(mFCol, mBCol);
448if (mLAtt != PI_NotDefLineAtt) scd->SetLineAtt(mLAtt);
449if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) scd->SetFontAtt(mFSz, mFAtt);
450if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) scd->SetMarkerAtt(mMSz, mMrk);
451if ( mCmapid != CMAP_OTHER ) scd->SetColMapId(mCmapid);
452
453if ( (opt == Disp_Same) && (mLastWdg) ) {
454 if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
455 else mLastWdg->AddDrawer(scd, true, true, true);
456 scd->Refresh();
457 mDId++;
458 mDrwList[mDId] = scd;
459 return(-mDId);
460}
461else if (opt == Disp_Same) opt = Disp_Next;
462
463PIWindow* win;
464PIScDrawWdg* scw;
465int sx, sy, px, py, flag;
466sx = 200+mFgScSz*100;
467sy = 200+mFgScSz*100;
468win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
469if (typeid(*scd) != typeid(PIHisto2D))
470 scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
471else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
472scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
473scw->SetUserData(NULL, oid);
474if (mFXYlim) // Forcage limites XY
475 scw->SetLimits(mXmin, mXmax, mYmin, mYmax);
476scw->SetAxesFlags(mAxesFlags);
477
478if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true);
479else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
480// Titre du plot
481if (title.length() <= 0) title = name; string t2="";
482scw->SetTitles(title, t2);
483// scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$
484mCurWin = win;
485mCurWdg = scw;
486mLastWdg = scw;
487mBWId++;
488mBWList[mBWId] = scw;
489return(mBWId);
490}
491
492/* --Methode-- */
493int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, int opt, string title, int oid)
494{
495if (dr3 == NULL)
496 {
497 printf("PIStdImgApp::Disp3DDrawer_Error Cannot Add NULL 3DDrawer \n");
498 return(-1);
499 }
500
501// Changement d'attributs graphiques courants du drawer
502if (mFCol != PI_NotDefColor) dr3->SetColAtt(mFCol, mBCol);
503if (mLAtt != PI_NotDefLineAtt) dr3->SetLineAtt(mLAtt);
504if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) dr3->SetFontAtt(mFSz, mFAtt);
505if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) dr3->SetMarkerAtt(mMSz, mMrk);
506if ( mCmapid != CMAP_OTHER ) dr3->SetColMapId(mCmapid);
507
508if ( (opt == Disp_Same) && (mLastWdg) ) {
509 if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
510 else mLastWdg->AddDrawer(dr3, true, true, true);
511 dr3->Refresh();
512 mDId++;
513 mDrwList[mDId] = dr3;
514 return(-mDId);
515}
516else if (opt == Disp_Same) opt = Disp_Next;
517
518PIWindow* win;
519int sx, sy, px, py, flag;
520sx = 200+mFgScSz*100;
521sy = 200+mFgScSz*100;
522win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
523PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
524wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
525wd3->SetUserData(NULL, oid);
526wd3->AddDrawer3D(dr3, true);
527// Titre du plot
528if (title.length() <= 0) title = name; string t2="";
529wd3->SetTitles(title, t2);
530// wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99
531mCurWin = win;
532mCurWdg = wd3;
533mLastWdg = wd3;
534mBWId++;
535mBWList[mBWId] = wd3;
536return(mBWId);
537}
538
539/* --Methode-- */
540void PIStdImgApp::AddText(string const & txt, double xp, double yp)
541{
542if (!mLastWdg) return;
543PIElDrawer *eld=NULL;
544PIScDrawWdg* sdw=NULL;
545PIDraw3DWdg* w3d=NULL;
546PIImage* imgw;
547switch(mLastWdg->kind()) {
548 case PIScDrawWdg::ClassId :
549 sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
550 if (sdw) eld = sdw->BaseDrawer();
551 break;
552 case PIDraw3DWdg::ClassId :
553 w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
554 if (w3d) eld = w3d->BaseDrawer();
555 break;
556 case PIImage::ClassId :
557 imgw = dynamic_cast<PIImage *>(mLastWdg);
558 if (imgw) eld = imgw->MyElDrawer();
559 break;
560 default :
561 break;
562 }
563if (eld) {
564 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) eld->SetFontAtt(mFSz, mFAtt);
565 eld->ElAddText(xp,yp,txt.c_str(),mFCol);
566 eld->Refresh();
567 }
568}
569
570/* --Methode-- */
571void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
572{
573if (nx < 1) nx = 1;
574if (ny < 1) ny = 1;
575if (nx > 8) nx = 8;
576if (ny > 8) ny = 8;
577if ( (sx < 50) && (sy < 50) ) sx = sy = 400+mFgScSz*100;
578char buff[64];
579mWId++;
580int px, py;
581MainWin()->GetScreenPos(px, py);
582sprintf(buff, "PI-GraphicWin (%d)",mWId);
583PIZoneWindow* win = new PIZoneWindow(this, buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
584win->SetUserData(NULL, ny*10+nx); // UserFlag= nY*10 + nX
585mWList[mWId*10+1] = (PIWindow*)win;
586win->SetAutoDelChilds(true);
587// win->Show();
588mGrW = win;
589mGrIdx = 0;
590}
591
592/* --Methode-- */
593void PIStdImgApp::CreateStackWin(int sx, int sy)
594{
595if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
596char buff[64];
597mWId++;
598int px, py;
599MainWin()->GetScreenPos(px, py);
600sprintf(buff, "PI-StackWin (%d)",mWId);
601PIStackWindow* win = new PIStackWindow(this, buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
602win->SetUserData(NULL, 9999); // UserFlag= 9999
603mWList[mWId*10+2] = (PIWindow*)win;
604win->SetAutoDelChilds(true);
605// win->Show();
606mStW = win;
607m[2]->SetSensitivity("StackTools", true);
608mStIdx = 0;
609}
610
611/* --Methode-- */
612PIWindow* PIStdImgApp::GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
613{
614PIWindow* rw;
615
616switch (typ) {
617 case Disp_Next : // Fenetre graphique courante
618 {
619 if (mGrW == NULL) CreateGraphWin();
620 int nx, ny;
621 mGrW->NbZone(nx, ny);
622 PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
623// cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
624 if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
625 flag = mGrIdx;
626 mGrIdx = (mGrIdx+1)%(nx*ny);
627 rw = mGrW;
628 break;
629 }
630
631 case Disp_Stack : // Fenetre de type stack (empilement)
632 {
633 if (mStW == NULL) CreateStackWin(sx, sy);
634 px = py = 0;
635 sx = mStW->XSize();
636 sy = mStW->YSize();
637 flag = mStIdx;
638 mStIdx++;
639 rw = mStW;
640 }
641 break;
642
643 default : // Fenetre ordinaire
644 {
645 int pwx, pwy;
646 MainWin()->GetScreenPos(pwx, pwy);
647 if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
648 rw = new PIWindow(this, nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
649 rw->SetUserData(NULL, 0); // UserFlag= 0
650 mWId++;
651 mWList[mWId*10] = rw;
652 rw->SetAutoDelChilds(true);
653 // rw->Show();
654 px = py = 0;
655 flag = 0;
656 break;
657 }
658 }
659
660rw->Show();
661mCurWin = rw;
662return(rw);
663}
664
665/* --Methode-- */
666void PIStdImgApp::SetZone(int nzx, int nzy)
667{
668if (!mGrW) CreateGraphWin(nzx, nzy);
669else {
670 int k;
671 PIWdg* cwd;
672 for(k=0; k<mGrW->NbChilds(); k++) {
673 if ((cwd = mGrW->GetChild(k)) == NULL) continue;
674 DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
675 }
676 mGrW->SetZone(nzx, nzy);
677 }
678}
679
680/* --Methode-- */
681void PIStdImgApp::StackWinNext()
682{
683if (mStW) mStW->DispNext();
684}
685
686/* --Methode-- */
687void PIStdImgApp::DeleteWindow(PIWindow* w)
688{
689if (w == NULL) return;
690w->Hide();
691bool ownwindow=false; // To Check if this is one of our windows
692WindMList::iterator it;
693for(it = mWList.begin(); it != mWList.end(); it++)
694 if ((*it).second == w) { mWList.erase(it); ownwindow = true; break; }
695if (w == mGrW) { mGrW = NULL; mGrIdx = -1; }
696if (w == mStW) { mStW = NULL; mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
697if (w == mCurWin) mCurWin = NULL;
698
699if (!ownwindow) return; // We do nothing if this is not a window we have created ...
700
701int k;
702PIWdg* cwd;
703for(k=0; k<w->NbChilds(); k++) {
704 if ((cwd = w->GetChild(k)) == NULL) continue;
705 DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
706 }
707delete w;
708return;
709}
710
711/* --Methode-- */
712void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
713{
714if (w == NULL) return;
715BWMList::iterator it;
716for(it = mBWList.begin(); it != mBWList.end(); it++)
717 if ((*it).second == w) { mBWList.erase(it); break; }
718int k;
719PIDrawer* drw;
720for(k=0; k<w->NbDrawers(); k++) {
721 if ((drw = w->GetDrawer(k)) == NULL) continue;
722 DrwMList::iterator itt;
723 for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
724 if ((*itt).second == drw) { mDrwList.erase(itt); break; }
725 }
726
727if (w == mCurWdg) {
728 mCurWdg = NULL;
729 if (mFgCWImg) {
730 m[4]->SetSensitivityMsg(10515, false);
731 m[4]->SetSensitivityMsg(10516, false);
732 mFgCWImg = false;
733 }
734 }
735
736if (w == mLastWdg) mLastWdg = NULL;
737
738PIWdg* pw=NULL;
739if (dwin) pw = (PIWdg*)(w->Parent());
740//DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
741if (dw) delete w;
742if (pw && (pw->kind() == PIWindow::ClassId )) {
743 PIWindow* pww = (PIWindow*) pw;
744 if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
745 DeleteWindow((PIWindow*)pw);
746 }
747return;
748}
749
750
751
752/* --Methode-- */
753void PIStdImgApp::DelWRsId(int k)
754{
755//DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl;
756if (k > 0) { // C'est un BaseWidget
757 BWMList::iterator it;
758 it = mBWList.find(k);
759 if (it == mBWList.end()) return;
760 PIBaseWdg* wd = (*it).second;
761//DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
762 DeleteBaseWidget(wd, true, true);
763 }
764else { // C'est un drawer
765 DrwMList::iterator it;
766 it = mDrwList.find(-k);
767 if (it == mDrwList.end()) return;
768 delete (*it).second;
769 mDrwList.erase(it);
770// cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ;
771 }
772}
773/* --Methode-- */
774bool PIStdImgApp::CheckWRsId(int k)
775{
776if (k > 0) { // C'est un BaseWidget
777 BWMList::iterator it;
778 it = mBWList.find(k);
779 if (it == mBWList.end()) return(false);
780 else return(true);
781 }
782else { // C'est un drawer
783 DrwMList::iterator it;
784 it = mDrwList.find(-k);
785 if (it == mDrwList.end()) return(false);
786 else return(true);
787 }
788}
789
790
791/* --Methode-- */
792void PIStdImgApp::RedirectStdOutErr(bool fg)
793{
794if (fg) {
795 RedirectOutStream(mCons);
796 RedirectErrStream(mCons);
797 m[5]->SetStateMsg(10602, true);
798 redirecout = true;
799 }
800else {
801 RedirectOutStream(NULL);
802 RedirectErrStream(NULL);
803 m[5]->SetStateMsg(10602, false);
804 redirecout = false;
805 }
806return;
807}
808
809/* --Methode-- */
810void PIStdImgApp::CatchSignals(bool fgfpe, bool fgsegv)
811{
812PeidaConfigureSignalhandling(fgfpe, fgsegv, true, true);
813m[5]->SetStateMsg(10603, fgfpe);
814m[5]->SetStateMsg(10604, fgsegv);
815}
816
817/* --Methode-- */
818void PIStdImgApp::CloseAllWindows()
819{
820WindMList::iterator it;
821for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
822mWList.clear();
823mBWList.clear();
824mDrwList.clear();
825}
826
827/* --Methode-- */
828void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
829{
830
831 switch(msg)
832 {
833 case 10100 :
834 mCmd->ShowHelpWindow();
835 break;
836
837 case 10120 :
838 pfc->SetPath(ImgDir);
839 pfc->AcceptNewFile(false);
840 mFCMsg = 10125;
841 pfc->SetMsg(mFCMsg);
842 SetBlocked();
843 pfc->Show();
844 break;
845
846 case 10125 :
847 SetBusy();
848 if (data) {
849 string nomobj="";
850 ObjMgr()->ReadFits(pfc->GetFileName(), nomobj);
851 ObjMgr()->DisplayObj(nomobj, "win");
852 }
853 mFCMsg = 0;
854 SetReady();
855 break;
856
857 case 10130 :
858 pfc->SetPath(WorkDir);
859 pfc->AcceptNewFile(false);
860 mFCMsg = 10135;
861 pfc->SetMsg(mFCMsg);
862 SetBlocked();
863 pfc->Show();
864 break;
865
866 case 10135 :
867 mFCMsg = 0;
868 if (data) {
869 PPInMgrW()->SetFile(pfc->GetFileName());
870 PPInMgrW()->Show();
871 }
872 SetReady();
873 break;
874
875 case 10110 :
876 DeleteWindow(mCurWin);
877 break;
878
879 case 10111 :
880 if (mCurWdg) {
881 int oid = mCurWdg->UserFlag();
882 DeleteBaseWidget(mCurWdg);
883 mObjMgr->DelObj_Id(oid);
884 }
885 break;
886
887 case 10105:
888 Stop();
889 break;
890
891 }
892return;
893}
894
895
896
897/* --Methode-- */
898void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
899{
900
901switch (msg) {
902 case 10201 :
903 ObjMgrW()->Show();
904 break;
905
906 case 10220 :
907 pfc->SetPath(WorkDir);
908 pfc->AcceptNewFile(true);
909 mFCMsg = 10225;
910 pfc->SetMsg(mFCMsg);
911 SetBlocked();
912 pfc->Show();
913 break;
914
915 case 10225 :
916 SetBusy();
917 if (data) {
918 if (mPpfout) {
919 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
920 delete mPpfout;
921 }
922 name_outppf = pfc->GetFileName();
923 mPpfout = NULL;
924 printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
925 mPpfout = new POutPersist(name_outppf);
926 }
927 mFCMsg = 0;
928 SetReady();
929 break;
930
931 case 10230 :
932 if (!mPpfout) break;
933 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
934 delete mPpfout;
935 name_outppf = "";
936 mPpfout = NULL;
937 break;
938
939
940 default:
941 cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " << msg << endl;
942 break;
943}
944
945return;
946}
947
948/* --Methode-- */
949void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
950{
951
952switch (msg) {
953 case 10301 :
954 PIImgTools::ShowPIImgTools();
955 break;
956 case 10302 :
957 PIDrwTools::ShowPIDrwTools();
958 break;
959
960 case 10304 :
961 case 10305 :
962 {
963 PIImage* curpimg = NULL;
964 if (!mCurWdg) return;
965 if (mCurWdg->kind() != PIImage::ClassId) return;
966 curpimg = (PIImage*)mCurWdg;
967 if (curpimg == NULL) return;
968 P2DArrayAdapter* img = curpimg->Image();
969 if (img == NULL) return;
970 int dx = curpimg->XSzPave();
971 int dy = curpimg->YSzPave();
972 int x0 = curpimg->XPave()-dx/2;
973 int y0 = curpimg->YPave()-dy/2;
974 if (x0 < 0) x0 = 0;
975 if (y0 < 0) y0 = 0;
976 int x1 = x0+dx;
977 int y1 = y0+dy;
978 if (x1 > img->XSize()) x1 = img->XSize();
979 if (y1 > img->YSize()) y1 = img->YSize();
980 dx = x1-x0; dy = y1-y0;
981 ImageR4* pim = new ImageR4(dx, dy);
982 int ii, jj;
983 for(jj=0; jj<dy; jj++)
984 for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
985 if (msg == 10305) { // Calcul des coordonnees du sous-pave
986 double xc1, yc1;
987 img->Coord(x0, y0, xc1, yc1);
988 pim->SetOrg((int)xc1, (int)yc1);
989 }
990 string nom = mCurWdg->Nom() + "_pave";
991 ObjMgr()->AddObj(pim, nom);
992 ObjMgr()->DisplayObj(nom, "w");
993 break;
994 }
995
996 case 10306 :
997 {
998 PIImage* curpimg = NULL;
999 if (!mCurWdg) return;
1000 if (mCurWdg->kind() != PIImage::ClassId) return;
1001 curpimg = (PIImage*)mCurWdg;
1002 if (curpimg == NULL) return;
1003 curpimg->ShowCuts(true);
1004 break;
1005 }
1006
1007 case 10320 :
1008 if (mStW) mStW->DispNext();
1009 break;
1010
1011 case 10321 :
1012 case 10322 :
1013 case 10324 :
1014// case 10328 :
1015 if (mStW) mStW->StartAutoDisp((msg-10320)*500);
1016 break;
1017
1018 case 10329 :
1019 if (mStW) mStW->StopAutoDisp();
1020 break;
1021
1022 case 103330 :
1023 if (mStW) {
1024 PIWdg* cw = mStW->CurrentWdg();
1025 if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
1026 }
1027 break;
1028
1029 default:
1030 cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " << msg << endl;
1031 break;
1032 }
1033return;
1034}
1035
1036/* --Methode-- */
1037void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
1038{
1039
1040switch (msg) {
1041
1042 case 10400 :
1043 CreateStackWin();
1044 break;
1045
1046 case 10411 :
1047 CreateGraphWin(1,1);
1048 break;
1049 case 10421 :
1050 CreateGraphWin(1,2);
1051 break;
1052 case 10412 :
1053 CreateGraphWin(2,1);
1054 break;
1055 case 10422 :
1056 CreateGraphWin(2,2);
1057 break;
1058 case 10431 :
1059 CreateGraphWin(1,3);
1060 break;
1061 case 10433 :
1062 CreateGraphWin(3,3);
1063 break;
1064
1065 default:
1066 cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl;
1067 break;
1068 }
1069return;
1070}
1071
1072
1073/* --Methode-- */
1074void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1075{
1076char nomps[64],strg[512];
1077PSFile *mps;
1078int sxt, syt, syo, syo1, sx[4], sy[4];
1079
1080switch (msg)
1081 {
1082 case 10501 :
1083 pfc->SetPath(WorkDir);
1084 pfc->AcceptNewFile(true);
1085 mFCMsg = 10525;
1086 pfc->SetMsg(mFCMsg);
1087 SetBlocked();
1088 pfc->Show();
1089 break;
1090
1091 case 10525 :
1092 SetBusy();
1093 if (data) {
1094 if (mpsfile) {
1095 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
1096 delete mpsfile;
1097 }
1098 name_ps = pfc->GetFileName();
1099 printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
1100 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
1101 }
1102 mFCMsg = 0;
1103 SetReady();
1104 break;
1105
1106 case 10505 :
1107 if (!mpsfile) break;
1108 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
1109 delete mpsfile;
1110 mpsfile = NULL;
1111 name_ps = "";
1112 break;
1113
1114 case 10511 : // Window -> PS
1115 case 10512 : // Window -> EPS
1116 if (CurrentWindow() == NULL) break;
1117 if (msg == 10512)
1118 {
1119 num_eps++;
1120 sprintf(nomps,"pia%d.eps", num_eps);
1121 printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
1122 mps = new PSFile(nomps);
1123 }
1124 else {
1125 if (mpsfile == NULL) {
1126 name_ps = "pia.ps";
1127 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
1128 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
1129 }
1130 printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());
1131 mps = mpsfile;
1132 }
1133 CurrentWindow()->PSPrint(mps,0,0);
1134
1135 if (msg == 10512) delete mps; // fichier eps
1136 break;
1137
1138 case 10515 : // Image -> PS
1139 case 10516 : // Image -> EPS
1140 {
1141 PIImage* curpimg = NULL;
1142 if (!mCurWdg) return;
1143 if (mCurWdg->kind() != PIImage::ClassId) return;
1144 curpimg = (PIImage*)mCurWdg;
1145 if (curpimg == NULL) return;
1146 if (msg == 10516)
1147 {
1148 num_eps++;
1149 sprintf(nomps,"pia%d.eps", num_eps);
1150 printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
1151 mps = new PSFile(nomps);
1152 }
1153 else {
1154 if (mpsfile == NULL) {
1155 name_ps = "pia.ps";
1156 mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
1157 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
1158 }
1159 printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());
1160 mps = mpsfile;
1161 }
1162
1163 sx[0] = gimv->XSize();
1164 sy[0] = gimv->YSize();
1165 sx[1] = zoom->XSize();
1166 sy[1] = zoom->YSize();
1167 sx[2] = cmapv->XSize();
1168 sy[2] = cmapv->YSize();
1169 sx[3] = curpimg->XSize();
1170 sy[3] = curpimg->YSize();
1171 if (sy[1] > sy[0]) { syo1 = sy[1]+50; syo = sy[1]+sy[2]+60; }
1172 else { syo1 = sy[0]+50; syo = sy[0]+sy[2]+60; }
1173 syt = sy[3]+syo;
1174 sxt = sx[3];
1175 if (sxt < (sx[0]+sx[1]+20)) sxt = sx[0]+sx[1]+20;
1176 if (sxt < sx[2]) sxt = sx[2];
1177
1178 // Pour ecrire le titre
1179 mps->NewPage((float)sxt, (float)syt, PI_Portrait);
1180 mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
1181 sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(),
1182 curpimg->XPave(), curpimg->YPave());
1183 mps->DrawString(10., 25., strg, PI_Black, PI_BoldFont, 20);
1184 mps->EndBloc();
1185
1186 // Les quatre fenetres glovimage, zoom, cmap, image
1187 gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
1188 zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
1189 cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
1190 curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
1191
1192 if (msg == 10516) delete mps; // fichier eps
1193 break;
1194 }
1195
1196 default:
1197 cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " << msg << endl;
1198 break;
1199 }
1200
1201}
1202
1203
1204/* --Methode-- */
1205void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1206{
1207switch (msg) {
1208 case 10601:
1209 CloseAllWindows();
1210 break;
1211 case 10602:
1212 RedirectStdOutErr(*((bool*)data));
1213 break;
1214 case 10603:
1215 case 10604:
1216 CatchSignals(m[5]->GetStateMsg(10603), m[5]->GetStateMsg(10604));
1217 break;
1218 default:
1219 cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " << msg << endl;
1220 break;
1221 }
1222return;
1223}
1224
1225
1226/* --Methode-- */
1227void PIStdImgApp::SetColAtt(PIColors fg, PIColors bg)
1228{
1229 mFCol = fg;
1230 mBCol = bg;
1231}
1232/* --Methode-- */
1233void PIStdImgApp::SetLineAtt(PILineAtt lat)
1234{
1235 mLAtt = lat;
1236}
1237/* --Methode-- */
1238void PIStdImgApp::SetFontAtt(PIFontSize fsz, PIFontAtt fat)
1239{
1240 mFSz = fsz;
1241 mFAtt = fat;
1242}
1243/* --Methode-- */
1244void PIStdImgApp::SetMarkerAtt(int sz, PIMarker mrk)
1245{
1246 mMSz = sz;
1247 mMrk = mrk;
1248}
1249/* --Methode-- */
1250void PIStdImgApp::SetColMapId(CMapId cid)
1251{
1252 mCmapid = cid;
1253}
1254/* --Methode-- */
1255void PIStdImgApp::SetZoomAtt(int zoom)
1256{
1257 if ( (zoom > 10) || (zoom < -10) ) zoom = 0;
1258 mZoom = zoom;
1259}
1260/* --Methode-- */
1261void PIStdImgApp::SetAxesAtt(unsigned int axfl)
1262{
1263 mAxesFlags = axfl;
1264}
1265/* --Methode-- */
1266void PIStdImgApp::SetXYLimits(double xmin, double xmax, double ymin, double ymax)
1267{
1268 mXmin = xmin; mXmax= xmax;
1269 mYmin = ymin; mYmax= ymax;
1270}
1271
1272/* --Methode-- */
1273void PIStdImgApp::SaveGraphicAtt()
1274{
1275 mSFCol = mFCol;
1276 mSBCol = mBCol;
1277 mSLAtt = mLAtt;
1278 mSFSz = mFSz;
1279 mSFAtt = mFAtt;
1280 mSMSz = mMSz;
1281 mSMrk = mMrk;
1282 mSCmapid = mCmapid;
1283 mSZoom = mZoom;
1284 mSAxesFlags = mAxesFlags;
1285 mSXmin = mXmin; mSXmax = mXmax;
1286 mSYmin = mYmin; mSYmax = mYmax;
1287 mSFXYlim = mFXYlim;
1288}
1289
1290/* --Methode-- */
1291void PIStdImgApp::RestoreGraphicAtt()
1292{
1293 mFCol = mSFCol;
1294 mBCol = mSBCol;
1295 mLAtt = mSLAtt;
1296 mFSz = mSFSz;
1297 mFAtt = mSFAtt;
1298 mMSz = mSMSz;
1299 mMrk = mSMrk;
1300 mCmapid = mSCmapid;
1301 mZoom = mSZoom;
1302 mAxesFlags = mSAxesFlags;
1303 mXmin = mSXmin; mXmax = mSXmax;
1304 mYmin = mSYmin; mYmax = mSYmax;
1305 mFXYlim = mSFXYlim;
1306}
Note: See TracBrowser for help on using the repository browser.