⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dna3.cc

📁 unix或linux下的DNA分析软件源码 其功能如下 1. Edit up to 256 peptide or DNA sequences simultaneously. 2. Transla
💻 CC
📖 第 1 页 / 共 5 页
字号:
//--------------------------------------------------------------------------//// dna3.cc                                                                  //// Latest revision: 05-04-2000                                              //// Copyright (C) 2000 by Thomas J. Nelson                                   //// All rights reserved.                                                     //// Spreadsheet creation and handling                                        ////--------------------------------------------------------------------------//#include "dna.h"extern Globals g;//--------------------------------------------------------------------//// dialogbox (Motif)                                                  ////  radiotype      method                                             ////  --------      -----------                                         ////  RADIO         simple toggle radio button.                         ////  RADIOTEXT     get text and toggle radio button. Returns           ////                    answer as string in a.radioanswer[][].          ////  RADIOVALUE    get value from slider and toggle radio button.      ////                    Returns answer as string in a.radioanswer[][].  ////                    If a.radio[][] contains an '=', the string is   ////                    also substituted for whatever was after the '='.////  RADIOVALUEWIDE  same as RADIOVALUE except wider.                  ////  boxtype       method                                              ////  -------       ---------------                                     ////  TOGGLE        toggle button with label                            ////  TOGGLESTRING  toggle button with label and a string.              ////  INTCLICKBOX   integer clickbox() using sliders                    ////  FILENAME      getfilename()                                       ////  MULTICLICKBOX multiclickbox()(Assumes you want a rgb)             ////  TOGGLEMULTICLICKBOX  toggle button with label and a multiclickbox.////  NON_EDIT_LIST non-editable list                                   ////  STRING        getstring()                                         ////  LIST          editable list                                       ////  LABEL         heading only                                        ////  NO_LABEL_LIST editable list except no label on button             ////  DOUBLECLICKBOX float clickbox() using sliders, uses clickboxstep[]////                                                                    //// NOTE: It is the calling routine's responsibility to restore the    ////     original parameters if "Cancel" is selected, using the global  ////     variable 'getout', and then to restore 'getout' to 0.          //// All widgets created here must be destroyed before leaving.         ////     This is done by setting w[wc] to each widget as it is created, ////     then deleting all the widgets at once.                         //// All answers are placed into dialoginfo struct by callbacks. This   ////     allows the calling routine to keep the dialog on the screen by ////     setting 'a.keep', and then change the parameters asynchronous- ////     ly. If a.keep is set, calling routine must call dialogbox      ////     again, setting a.keep to RESET, to close the dialog.           //// Boxes and radios can set up groups or gray out unwanted options    ////     using a.f1 function pointer.                                   //// All elements in a.boxwidget[][] must be set to 0 !                 //// The callback f1() can use XtSetSensitive to gray out unwanted      ////     options based on the radio and box settings. It must check     ////     to make sure the widget is not 0 first, because unused widgets ////     are initialized to 0.                                          ////--------------------------------------------------------------------//void dialogbox(dialoginfo &a){ static char dirmask[FILENAMELENGTH]="*"; char tempstring[FILENAMELENGTH]; clickboxinfo *clickboxdata=NULL; Widget *w=NULL; Widget form=0; Widget radiopush[10]; int n,wc=0,i,j,k,value,boxcount=0,radiocount=0,count,result,startpos=0,     multiclickboxcount=0,nonmulticlickboxcount=0; int boxlabelwidth=0; int color[4]; XmString xms; double spacing, bspacing, rspacing, y; char junk[2]; junk[0]=32; junk[1]=0; if(a.keep!=RESET) {        Arg args[100];      clickboxdata = new clickboxinfo[DCOUNT];  // Up to DCOUNT sliders      w = new Widget[200];      char  *ptr, temp[256], *boxstring, radiostring[256];      Widget wid[4], radiobox[DCOUNT], radiobutton[10][DCOUNT], boxbutton[DCOUNT];      Widget radioslider[10][DCOUNT],widget;      ////  Percentages of dialog box width.      ////  To get uniform positioning of widgets, make sure each widget      ////  is attached to a space proportionately equal to its expected width.      ////  Motif expands the dialog box and all other widgets to give the      ////  smallest widget enough pixels and simultaneously keep the       ////  percentages to the set values.      g.getout=0;      g.dialogdone=0;      //----Calculate how large it has to be-----------------------------//      double TOPMARGIN = 2;      double RADIOSTART= 1;      double RADIOEND  = 37;      double BOXSTART  = 37.2;      double CHECKWIDTH= 8;      double LABELEND  = 99;      double BOXEND, LABELSTART;       for(j=0;j<a.noofboxes;j++)       {    boxcount++;           if(a.boxtype[j]!=TOGGLE && a.boxtype[j]!=LABEL)               boxlabelwidth = max(boxlabelwidth, (int)strlen(a.boxes[j]));           if(a.boxtype[j]==MULTICLICKBOX) multiclickboxcount++;           else if(a.boxtype[j]!=LABEL) nonmulticlickboxcount++;      }      BOXEND = LABELSTART = min(80,100-(int)(1.4*boxlabelwidth));      for(i=0;i<10;i++) radiopush[i]=0;      for(i=0;i<a.noofradios;i++)      {   radiopush[i]=0;          for(j=0;j<a.radiono[i];j++)          {   radiocount++;               if(a.radiotype[i][j]==RADIOVALUE || a.radiotype[i][j]==RADIOVALUEWIDE)               {    RADIOEND=29;BOXSTART=48;BOXEND=82;LABELSTART=82; }              if(a.radiotype[i][j]==RADIOTEXT)               {    RADIOEND=31;BOXSTART=40;BOXEND=72;LABELSTART=72; }          }      }      if(a.noofboxes==0) RADIOEND=BOXSTART=BOXEND=LABELSTART=LABELEND=98;      if(a.noofradios==0)      {     RADIOSTART=RADIOEND=BOXSTART=2;             TOPMARGIN=4;             BOXEND=LABELSTART=55;             CHECKWIDTH=8;      }      if(nonmulticlickboxcount==0 && multiclickboxcount>0)      {     RADIOEND=39;            BOXSTART=40;             BOXEND=LABELSTART=63;       }       count = max(boxcount,radiocount)+3;      spacing = (100.0/(double)count);      //------- Create a form dialog shell widget -----------------------//      n=0;      if(a.transient){  XtSetArg(args[n], XmNtransient, True); n++; }      else           {  XtSetArg(args[n], XmNtransient, False); n++; }      XtSetArg(args[n], XmNmarginHeight, 0); n++;      XtSetArg(args[n], XmNmarginWidth, 0); n++;      XtSetArg(args[n], XmNheight, count*28); n++;      XtSetArg(args[n], XmNautoUnmanage, False); n++;      ////  Stop Motif from trying to grab another color if none are available.      if(g.want_colormaps)        {    XtSetArg(args[n], XmNbackground, g.main_bcolor); n++;           XtSetArg(args[n], XmNforeground, g.main_fcolor); n++;      }      XtSetArg(args[n], XmNkeyboardFocusPolicy, XmEXPLICIT); n++;      XtSetArg(args[n], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); n++;      XtSetArg(args[n], XmNdialogTitle, xms = XmStringCreateSimple(a.title));n++;      form = w[wc++] = XmCreateFormDialog(g.main_widget, "DialogForm", args, n);      XmStringFree(xms);      w[wc++] = addlabel(form, a.title, CENTER, 20, 3, 80, 3+spacing);       y=TOPMARGIN+spacing;      rspacing = 1.03*spacing;      for(i=0;i<a.noofradios;i++)      {            ////  'radiobox' is a container widget so leave bottom position            ////  unattached so it can accommodate new pushbuttons. Otherwise,            ////  Motif makes them all different sizes.            ////  'Horizontal' orientation means buttons are stacked vertically.            w[wc++] = addlabel(form,a.radio[i][0],LEFT,RADIOSTART,y,RADIOEND,y+rspacing);             y+=rspacing;            n=0;            XtSetArg(args[n], XmNspacing, 0); n++;            XtSetArg(args[n], XmNradioBehavior, True); n++;            XtSetArg(args[n], XmNradioAlwaysOne, True); n++;            XtSetArg(args[n], XmNleftPosition, RADIOSTART); n++;              XtSetArg(args[n], XmNtopPosition, y); n++;                XtSetArg(args[n], XmNrightPosition, RADIOEND); n++;              XtSetArg(args[n], XmNfractionBase, 100); n++;   // Use percentages            XtSetArg(args[n], XmNtopAttachment, XmATTACH_POSITION); n++;            XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;            XtSetArg(args[n], XmNbottomAttachment, XmATTACH_POSITION); n++;            XtSetArg(args[n], XmNbottomPosition, y+rspacing*.91*(-1+(double)a.radiono[i])); n++;             XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;            XtSetArg(args[n], XmNpacking,XmPACK_COLUMN); n++;            XtSetArg(args[n], XmNnumColumns,50); n++;            XtSetArg(args[n], XmNorientation,XmHORIZONTAL); n++;            XtSetArg(args[n], XmNresizable, False); n++;            XtSetArg(args[n], XmNadjustLast, False); n++;            ////  Stop Motif from trying to grab another color if none are available.            if(g.want_colormaps)              {    XtSetArg(args[n], XmNbackground, g.main_bcolor); n++;                 XtSetArg(args[n], XmNforeground, g.main_fcolor); n++;            }            radiobox[i] = w[wc++] = XmCreateRadioBox(form, "radiobox", args, n);            XtManageChild(radiobox[i]);            for(j=1;j<a.radiono[i];j++)            {                  ////  Create main radio buttons - set shadowThickness to 1 to create                ////  a border.                n=0;                XtSetArg(args[n], XmNresizable, False); n++;                XtSetArg(args[n], XmNspacing, 0); n++;                XtSetArg(args[n], XmNmarginWidth, 4); n++;                XtSetArg(args[n], XmNleftPosition, RADIOSTART); n++;                 XtSetArg(args[n], XmNtopPosition, y); n++;                  XtSetArg(args[n], XmNbottomPosition, y+rspacing); n++;                 XtSetArg(args[n], XmNrightPosition, RADIOEND); n++;                  XtSetArg(args[n], XmNfractionBase, 100); n++;   // Use percentages                XtSetArg(args[n], XmNtopAttachment, XmATTACH_POSITION); n++;                XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;                XtSetArg(args[n], XmNbottomAttachment, XmATTACH_POSITION); n++;                XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;                XtSetArg(args[n], XmNpacking,XmPACK_COLUMN); n++;                XtSetArg(args[n], XmNnumColumns,50); n++;                XtSetArg(args[n], XmNorientation,XmHORIZONTAL); n++;                strcpy(radiostring, a.radio[i][j]);                for(k=strlen(radiostring);k<20;k++)strcat(radiostring,junk);                XtSetArg(args[n], XmNindicatorOn, True); n++;                XtSetArg(args[n], XmNindicatorType, XmONE_OF_MANY); n++;                XtSetArg(args[n], XmNfillOnSelect, True); n++;                XtSetArg(args[n], XmNspacing, 5); n++;                ////  Stop Motif from trying to grab another color if none are available.                if(g.want_colormaps)                  {    XtSetArg(args[n], XmNbackground, g.main_bcolor); n++;                     XtSetArg(args[n], XmNforeground, g.main_fcolor); n++;                }                radiobutton[i][j] = w[wc++] =                       XmCreateToggleButton(radiobox[i],radiostring,args,n);                a.radiowidget[i][j] = radiobutton[i][j];                XtManageChild(radiobutton[i][j]);                if(a.radioset[i]==j)                    XmToggleButtonSetState(radiobutton[i][j], True, True);                 else                    XmToggleButtonSetState(radiobutton[i][j], False, True);                                ////  Set up a callback for each radio button. They must both be

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -