void menuhelp(void) { scrcolor(Red,BGmain); goto_xy(23,4);print("Abstract"); scrcolor(FGmain,BGmain); goto_xy(1,6); print(" CalcHEP package is created for calculation of \n"); print(" decay and high energy collision processes of \n"); print(" elementary particles in the lowest order (tree) \n"); print(" approximation. The main idea put into the CalcHEP\n"); print(" was to make available passing from the lagrangian\n"); print(" to the final distributions effectively with the \n"); print(" high level of automatization.\n"); print(" Use F2 key to get information about interface \n"); print(" facilities and F1 - as online help. \n"); scrcolor(Yellow,BGmain);print(" Questions:"); scrcolor(Black,BGmain); print("https://answers.launchpad.net/calchep\n"); scrcolor(Yellow,BGmain);print(" Bugs:"); scrcolor(Black,BGmain); print("https://bugs.launchpad.net/calchep\n"); scrcolor(Black,BGmain); chepbox(1,5,53,17); scrcolor(FGmain,BGmain); }
static int message(int x1,int y1,char* txt1) { char txt[STRSIZ]; int mess, marg, i=0, x2, y2; void * dump; int xold, yold; char * c; strcpy(txt,txt1); c=txt; xold = where_x(); yold = where_y(); x2 = x1 + maxline(&y2,txt) /*+4*/; y2 = y1 + y2 + 1; get_text(x1,y1,x2,y2,&dump); chepbox(x1,y1,x2,y2); be_be(); c=strtok(txt,"\n"); while(c) { ++(i); marg = (x2 - x1 - strlen(c)) / 2; if (y1+i == y2) { goto_xy(x1+1+marg ,y1 + i); print("%s",c); }else { char buff[STRSIZ]; memset(buff,' ',x2-x1 -1); memcpy(buff+marg,c,strlen(c)); buff[x2-x1-1]=0; goto_xy(x1+1,y1+i); print(buff); } c=strtok(NULL,"\n"); } ret_: if (blind) mess='Y' ; else do{mess = inkey();} while (mess == KB_SIZE); /* mouse filter */ if (mess == KB_MOUSE) { if ( (mouse_info.but1 !=2) || (mouse_info.row < y1) || (mouse_info.row > y2) || (mouse_info.col < x1) || (mouse_info.col > x2) ) goto ret_; if (mouse_info.row == y2 ) { if (mouse_info.col < (x1+x2)/2 /* -1*/ ) mess='Y'; if (mouse_info.col > (x1+x2)/2 /*+1 */) mess='N'; } } /* end of filter */ put_text(&dump); goto_xy(xold,yold); return mess; } /* message */
void menu0(int col,int row,char* label, char* menstr , void (**funcKey)(int) ,char** funcKeyMess, void ** hscr, int* kk) { int i, j, k, col1, npage,lastrow; long lastpage; int ink; int ncol; void * pscr; int fkPos[11]; int height; char fmt[20]; int lastLine; /* colors */ int label_fg =Yellow; int label_bg =Blue; int help_fg1 =White; int help_fg2 =Black; int help_bg =DarkGray; int box_fg =White; int box_bg =DarkGray; int star_fg =Red; int page_fg =Black; int actFunc_fg=Black; int actFunc_bg=White; int pasFunc_fg=White; int pasFunc_bg=DarkGray; /* save colors */ int fcolor_tmp=fColor; int bcolor_tmp=bColor; void *hscr_=NULL; if(hscr==NULL) hscr=&hscr_; lastLine=maxRow(); if (funcKey == NULL) for (i=0;i<11;i++) fkPos[i]=0; else { int xx; scrcolor(FGmain,BGmain); goto_xy(1,lastLine); clr_eol(); xx=0; for (j=0;j<10;j++) { if(funcKey[j] && funcKeyMess[j]) xx=xx+4+strlen(funcKeyMess[j]);} xx= (80 - xx )/2 ; goto_xy(xx,lastLine); for (i=0;i<10;i++) { fkPos[i]=where_x(); if (funcKey[i] && funcKeyMess[i]) { scrcolor(help_fg1,help_bg); print(" F%i-",i+1); scrcolor(help_fg2,help_bg); print(funcKeyMess[i]); } } fkPos[10]=where_x(); } clearTypeAhead(); if (*kk < 0) *kk = -(*kk); ncol=menstr[0]; sprintf(fmt,"%%%d.%ds",ncol,ncol); height=strlen(menstr)/ncol; if(height==0) { *kk=0; return; } if (row+height+1 >lastLine-2) height=lastLine-3-row; lastpage = 1+ (strlen(menstr)/ncol -1)/height ; if(label[0] ==0 || row == 1) { if (*hscr == NULL) get_text(col,row,col+ncol+1,row+2,hscr);} else { char label_[STRSIZ]; int shft,sz; if (*hscr == NULL) get_text(col,row-1,col+ncol+1,row+2,hscr); for(i=0;i<ncol+2;i++) label_[i]=' '; label_[ncol+2]=0; sz=strlen(label); if(sz >ncol+2) {shft=0;sz=ncol+2;} else shft=(ncol+2 -sz)/2; memcpy(label_+shft,label,sz); scrcolor(label_fg,label_bg); goto_xy(col,row-1); print(label_); } get_text(col,row + 3,col + ncol + 1,row + height + 1,&pscr); if (*kk <= 0 || *kk > lastpage * height ) { npage = 1; k = 1; } else { k = ((*kk) - 1) % height + 1; npage = ((*kk) - 1) / height + 1; } col1 = col + 1; label_1: scrcolor(box_fg,box_bg); chepbox(col,row,col + ncol + 1,row + height + 1); scrcolor(star_fg,box_bg); goto_xy(col+1,row); print("<"); /* goto_xy(col+1,row + height+1); print("?"); */ scrcolor(page_fg,box_bg); if (npage > 1) { goto_xy(col + ncol - 2,row); print("PgUp"); } if (npage < lastpage) { goto_xy(col + ncol - 2,row + height + 1); print("PgDn"); } if(npage<lastpage) lastrow=height; else lastrow = (strlen(menstr)/ncol)%height; lastrow=0; scrcolor(pasFunc_fg,pasFunc_bg); for (j = 1; j <= height; j++) { int shift; goto_xy(col + 1,row + j); shift=1+(j-1 + (npage-1)*height)*ncol; if(shift<strlen(menstr)) {print(fmt,menstr+shift );lastrow++;} else print(fmt," "); } scrcolor(actFunc_fg,actFunc_bg); if (k > lastrow) k = lastrow; goto_xy(col + 1,row + k); if (lastrow) print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol); while (1) { int jump=1,mousePos; scrcolor(pasFunc_fg,pasFunc_bg); ink = inkey(); /* mouse filter */ if ((ink==KB_MOUSE)&&(mouse_info.but1 == 2)) { if (mouse_info.row == lastLine ) for(i=0; i<10;i++) if ((mouse_info.col > fkPos[i]) && (mouse_info.col < fkPos[i+1])) { if (i==9)ink='0'; else ink='1'+i;} if ( (mouse_info.col >= col ) && (mouse_info.col <=col+ncol+1) ) { mousePos = mouse_info.row - row; if (col+ncol+1-mouse_info.col <4) { if (mousePos==0) ink=KB_PAGEU; if (mousePos==height+1) ink=KB_PAGED; } if ((mousePos == 0 ) && ( mouse_info.col-col <4)) ink=KB_ESC; if ((mousePos < 0)&&(mousePos >= height)) { if (mousePos > k) {ink=KB_DOWN; jump=mousePos - k;} if (mousePos < k) {ink=KB_UP; jump=k - mousePos;} if (mousePos==k ) ink=KB_ENTER; } } } /* end of filter */ if (lastrow == 0) goto label_3; label_4: switch (ink) { case KB_MOUSE: if (mouse_info.but1 != 2) break; if (mouse_info.row == lastLine ) for(i=0; i<10;i++) if ((mouse_info.col > fkPos[i]) && (mouse_info.col < fkPos[i+1])) { if (i==9)ink='0'; else ink='1'+i; goto label_4; } if ( (mouse_info.col < col ) || (mouse_info.col >col+ncol+1) || (mouse_info.row < row ) || (mouse_info.row >row+height+1) ) break; mousePos = mouse_info.row - row; if ((mousePos == 0 ) && ( mouse_info.col-col <4)) ink=KB_ESC; if ((mousePos != 0)&&(mousePos != height+1)) { if (mousePos > k) { ink=KB_DOWN; jump=mousePos - k;} if (mousePos < k ) { ink=KB_UP; jump=k - mousePos;} } if (col+ncol+1-mouse_info.col <4) { if (mousePos==0) ink=KB_PAGEU; if (mousePos==height+1) ink=KB_PAGED; } if (mousePos==k ) ink=KB_ENTER; if (ink!=KB_MOUSE) goto label_4; break; case KB_DOWN: if(k==lastrow) { if(npage < lastpage) { k=1; npage++; goto label_1; } else { be_be(); break; } }else {ink= KB_RIGHT; goto label_4;} case KB_UP: if(k==1) { if (npage > 1) { k=height; npage--; goto label_1; } else{ be_be(); break; } } else {ink= KB_LEFT; goto label_4;} case KB_LEFT: goto_xy(col1,row + k); print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol); k = k - jump; if (k == 0) k = lastrow; scrcolor(actFunc_fg,actFunc_bg); goto_xy(col1,row + k); print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol); break; case KB_RIGHT: goto_xy(col1,row + k); print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol); k = k + jump ; if(k > lastrow) k = 1; scrcolor(actFunc_fg,actFunc_bg); goto_xy(col1,row + k); print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol); break; case KB_ENTER: scrcolor(box_fg,box_bg); chepbox(col,row,col+ncol+1,row+2); put_text(&pscr); goto_xy(col1,row + 1); scrcolor(actFunc_fg,actFunc_bg); print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol); *kk = (npage - 1) * height + k; goto_xy(1,lastLine);scrcolor(FGmain,BGmain); clr_eol(); if(hscr==&hscr_) put_text(hscr); refresh_scr(); escpressed(); return; case KB_BACKSP: case KB_ESC: goto label_3; case KB_PAGEU: if (npage > 1) { npage--; goto label_1; } else be_be(); break; case KB_PAGED: if (npage < lastpage) { npage++; goto label_1; } else be_be(); break; case '1': case'2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '0': case KB_F1: case KB_F2: case KB_F3: case KB_F4: case KB_F5: case KB_F6: case KB_F7: case KB_F8: case KB_F9: case KB_F10: { int fk; if (funcKey==NULL) break; if ( ink>='0' && ink <='9') { fk=ink-'0';if (fk==0) fk=10;} else fk=ink-KB_F1+1; if ((funcKey[fk-1]) != NULL) { void * saveHlp; get_text(1,lastLine,maxCol(),lastLine,&saveHlp); scrcolor(box_fg,box_bg); goto_xy(col+1,row); print("%c",boxFrame[1]); goto_xy(1,lastLine);scrcolor(FGmain,BGmain);clr_eol(); (*funcKey[fk-1])((npage-1)*height+k); put_text(&saveHlp); scrcolor(star_fg,box_bg); goto_xy(col+1,row); print("<"); } break; } case 6: /* ^F */ case 'f': case 'F': { char name[32]=""; int key=correctStr(5,23,"Enter name(Esc for exit):",name,30,1); if(key) { char * x=strstr(menstr+1,name); if(x==NULL) { if(blind) sortie(121); else messanykey(10,10, "Not detected"); break; } k= ((x-menstr)-1)/menstr[0]; npage = k/ height + 1; k = k% height + 1; goto label_1; } } break; } } label_3: put_text(hscr); put_text(&pscr); scrcolor(fcolor_tmp,bcolor_tmp); goto_xy(1,lastLine); clr_eol(); *kk = 0; }
void showtext(int x1, int y1, int x2, int y2, char* headline, FILE * fileptr ) { int key; void * pscr; int i,l; linelist currentline=NULL,lastline; int width=x2-x1-1; int fc=fColor,bc=bColor; if (fileptr==NULL || !readnewline(fileptr,width,¤tline)) { messanykey(10,10," File is empty"); return; } if(y2<=y1+1) for (y2=y1+2;y2<maxRow()&&readnewline(fileptr,width,¤tline);y2++) currentline=currentline->next; get_text(x1,y1,x2,y2,&pscr); scrcolor(Black,White); chepbox(x1,y1,x2,y2); scrcolor(Red,White); goto_xy(x1+1,y1); print("*"); l=strlen(headline); if ( l < (x2-x1) ) { goto_xy(x1+(x2-x1-l)/2,y1); scrcolor(White,Black); print(headline); scrcolor(Black,White); } key = KB_PAGEU; do { switch (key) { case KB_PAGEU: for (i=y1+1;i<y2;i++) if (currentline->pred !=NULL) currentline=currentline->pred; break; case KB_UP: for(i=1;i<(y2-y1)/2;i++) if (currentline->pred !=NULL) currentline=currentline->pred; break; case KB_PAGED: for (i=y1+1;i<y2;i++) { readnewline(fileptr,width,¤tline); if (currentline->next !=NULL) currentline=currentline->next; } break; case KB_DOWN: for(i=1;i<(y2-y1)/2;i++) { readnewline(fileptr ,width,¤tline); if (currentline->next !=NULL) currentline=currentline->next; } break; } /* Case */ /* display */ lastline=currentline; goto_xy(x2-4,y1); if( lastline->pred == NULL) for (i=0;i<4;i++) print("%c",boxFrame[1]); else print("PgUp"); for (i =y1+1; i <y2; i++) { goto_xy(x1+1,i); readnewline(fileptr,width,&lastline); if ( lastline !=NULL ) { print("%s",lastline->line); lastline=lastline->next;} print(buff+where_x()+80-x2); } goto_xy(x2-4,y2); if (lastline == NULL) for (i=0;i<4;i++) print("%c",boxFrame[5]); else print("PgDn"); key = inkey(); /* mouse filter */ if ( (key == KB_MOUSE)&&(mouse_info.but1==2) &&(mouse_info.col >= x1)&&(mouse_info.col <= x2) ) { if (x2 - mouse_info.col <4 ) { if(mouse_info.row == y1) key=KB_PAGEU; else if(mouse_info.row == y2) key=KB_PAGED; } if ( (mouse_info.row == y1)&&(mouse_info.col - x1 <3)) key=KB_ESC; if ((mouse_info.row > y1)&&(mouse_info.row < y2)) { if (mouse_info.row < (y1+y2)/2) key=KB_UP; else key=KB_DOWN;} } /* end of filter */ } while ((key != KB_ESC)&&(key !=KB_BACKSP)); scrcolor(fc,bc); put_text(&pscr); while (currentline->pred != NULL ) currentline=currentline->pred; dellinelist(currentline); }
void cheplabel(void) { int key; char fname[STRSIZ]; FILE *f; while(1) { { int X=20,Y=1; scrcolor(FGmain,BGmain); goto_xy(X,Y); print("Skobeltsyn Institute of Nuclear Physics,"); goto_xy(X+8,Y+1); print("Moscow State University."); } { int Y=5; scrcolor(Blue,LightGray); goto_xy(7,Y); print("CalcHEP - a package for Calculation in High Energy Physics"); scrcolor(FGmain,BGmain); goto_xy(15,Y+1); print("Version 2.4.4; Last correction August 23,2006"); } { int Y=7; scrcolor(FGmain,BGmain); goto_xy(3,Y+2);print(" Author of the package:"); scrcolor(Blue,LightGray); print(" Alexander Pukhov"); scrcolor(FGmain,BGmain); goto_xy(14,Y+3);print("For contacts:"); scrcolor(Blue,LightGray); goto_xy(28,Y+3);print("email: <*****@*****.**>"); goto_xy(28,Y+4);print("http://theory.sinp.msu.ru/~pukhov/calchep.html"); goto_xy(28,Y+5);print("http://www.ifh.de/~pukhov/calchep.html"); } { int Y=14; scrcolor(FGmain,BGmain); goto_xy(5,Y);print("The package contains codes written by:"); scrcolor(Blue,LightGray); goto_xy(10,Y+1); scrcolor(Blue,LightGray); print("M.Donckt,V.Edneral,V.Ilyin,D.Kovalenko,A.Kryukov,G.Lepage,A.Semenov"); /* print("G.Belanger,F.Boudjema,A.Djouadi,V.Edneral,V.Ilyin,J.-L.Kneur,"); goto_xy(10,Y+2); print("A.Kryukov,G.Lepage,G.Moultaka,A.Semenov"); */ } { int Y=17; scrcolor(FGmain,BGmain); goto_xy(5,Y);print("The BS models for CalcHEP were developed in collaboration with:"); scrcolor(Blue,LightGray); goto_xy(10,Y+1); scrcolor(Blue,LightGray); print("G.Belanger,A.Belyaev,F.Boudjema,A.Semenov"); } { int X1=19, X2=61, Y1=21, Y2=Y1+2; scrcolor(FGmain,BGmain); goto_xy(X1+2,Y1-1); print("Press F9 or click the box below to get"); scrcolor(Blue,LightGray); chepbox(X1,Y1,X2,Y2); goto_xy(X1+3,Y1+1); print("References and Contributions "); /* goto_xy(X1+3,Y1+2); print(" and relative information. "); */ scrcolor(FGmain,BGmain); goto_xy(3,Y2+1); print("This information is available during the session by means of the F9 key"); clearTypeAhead(); key= inkey(); if(key==KB_F9 || ( key==KB_MOUSE && mouse_info.row>=Y1 && mouse_info.row<=Y2 && mouse_info.col >=X1 && mouse_info.col<=X2 ) ) { sprintf(fname,"%s%cCITE",pathtocomphep,f_slash); f=fopen(fname,"r"); showtext (1, 1, 80,1,"",f); fclose(f); break; } if(key !=KB_MOUSE) break; } } clr_scr(FGmain,BGmain); }
static void prtcllist(int key) { char fullname[STRSIZ]; char hlp[60]; char p1[60], p2[60]; int i, j, pnum; linelist ln; int tabMax,tabSz; static int nTot,nFirst; tabMax=ycons -7; if (key==0) { scrcolor(FGmain,BGmain); for (i = 2; i <= 24; i++) { goto_xy(1,i); clr_eol(); } goto_xy(14,3); scrcolor(Blue,BGmain); print("List of particles (antiparticles)"); nTot=0; nFirst=1; } else { if (nTot <= 3 *tabMax ) return; switch (key) { case KB_DOWN : nFirst+=3; break; case KB_UP : nFirst-=3; break; case KB_PAGED: nFirst +=3*tabMax; break; case KB_PAGEU: nFirst -=3*tabMax; break; } if (nFirst <1) nFirst=1; if (nTot-nFirst+3<3*tabMax ) nFirst=1+3*((nTot+2)/3) -3*tabMax; clrbox(1,4,79,5+tabMax); } goto_xy(3,5); scrcolor(FGmain,BGmain); for(i=0,ln=prtcls_tab.strings; ln; ln=ln->next ) { sscanf(ln->line,"%[^|]%*c%[^|]%*c%[^|]%*c%*[^|]%*c%*[^|]%*c%*[^|]%*c%*[^|]%*c%*[^|]%*c%[^|]", fullname,p1,p2,hlp); trim(p1); locateinbase(p1,&pnum); trim(hlp); if (prtclbase[pnum-1].top != NULL && strcmp(hlp,"*") != 0) { i++; if (i>=nFirst && (i-nFirst)/3 <tabMax ) { print("%s",p1); if (strcmp(p1,p2) == 0) print(" "); else print("(%s)",p2); trim(fullname); print("- %s",fullname); j = i % 3; if (j == 0) goto_xy(3,where_y() + 1); else goto_xy(3 + 26 * j,where_y()); } } } nTot=i; tabSz=MIN((nTot+2)/3,tabMax); chepbox(1,4,79,5+tabSz); if (nFirst >1 ) { goto_xy(72,4); print("PgUp"); } if (nFirst+3*tabSz <= nTot ) { goto_xy(72,5+tabMax); print("PgDn"); } scrcolor(FGmain,BGmain); }