Пример #1
0
static void FilterCB(t_x11 *x11, int dlg_mess, int /*item_id*/,
                     char *set, void *data)
{
    int       nset;
    t_filter *f;
    t_gmx    *gmx;
    t_dlg    *dlg;

    gmx = (t_gmx *)data;
    dlg = gmx->dlgs[edFilter];
    f   = gmx->filter;

#ifdef DEBUG
    printf("item_id: %d, set: %s\n", item_id, set);
#endif
    switch (dlg_mess)
    {
        case DLG_SET:
            if (set)
            {
                if (sscanf(set, "%10d", &nset) == 1)
                {
                    f->bShow[nset] = !f->bShow[nset];
                }
            }
            break;
        case DLG_EXIT:
            HideDlg(dlg);
            write_gmx(x11, gmx, IDDOFILTER);
            break;
    }
}
Пример #2
0
static void ExportCB(t_x11 *x11,int dlg_mess,int item_id,
		     char *set,void *data)
{
  bool   bOk;
  t_gmx  *gmx;
  t_dlg  *dlg;

  gmx=(t_gmx *)data;
  dlg=gmx->dlgs[edExport];
  switch (dlg_mess) {
  case DLG_SET:
    switch (item_id) {
    case eExGrom:
      gmx->ExpMode=eExpGromos;
      break;
    case eExPdb:
      gmx->ExpMode=eExpPDB;
      break;
    default:
      break;
    }
#ifdef DEBUG
    fprintf(stderr,"exportcb: item_id=%d\n",item_id);
#endif
    break;
  case DLG_EXIT:
    if ((bOk=(strcasecmp("ok",set))==0)) 
      strcpy(gmx->confout,EditText(dlg,eExConf));
    HideDlg(dlg);
    if (bOk)
      write_gmx(x11,gmx,IDDOEXPORT);
    break;
  }
}
Пример #3
0
static void QuitCB(t_x11 *x11,int dlg_mess,int item_id,
		   char *set,void *data)
{
  t_gmx  *gmx;
  gmx=(t_gmx *)data;

  hide_mb(gmx);
  if (dlg_mess==DLG_EXIT) {
    if (strcasecmp("yes",set)==0) 
      write_gmx(x11,gmx,IDTERM);
  }
}
Пример #4
0
static void BondsCB(t_x11 *x11, int dlg_mess, int item_id,
                    char *set, void *data)
{
    static int ebond = -1;
    static int ebox  = -1;
    bool       bOk, bBond = false;
    int        nskip, nwait;
    t_gmx     *gmx;
    char      *endptr;

    gmx = (t_gmx *)data;
    if (ebond == -1)
    {
        ebond = gmx->man->molw->bond_type;
        ebox  = gmx->man->molw->boxtype;
    }
    switch (dlg_mess)
    {
        case DLG_SET:
            if (item_id <= eBNR)
            {
                ebond = item_id-1;
                bBond = false;
            }
            else if (item_id <= eBNR+esbNR+1)
            {
                ebox  = item_id-eBNR-2;
                bBond = true;
            }
            else
            {

#define DO_NOT(b) (b) = (!(b))

                switch (item_id)
                {
                    case ebShowH:
                        toggle_hydrogen(x11, gmx->man->molw);
                        break;
                    case ebDPlus:
                        DO_NOT(gmx->man->bPlus);
#ifdef DEBUG
                        fprintf(stderr, "gmx->man->bPlus=%s\n",
                                gmx->man->bPlus ? "true" : "false");
#endif
                        break;
                    case ebRMPBC:
                        toggle_pbc(gmx->man);
                        break;
                    case ebCue:
                        DO_NOT(gmx->man->bSort);
#ifdef DEBUG
                        fprintf(stderr, "gmx->man->bSort=%s\n",
                                gmx->man->bSort ? "true" : "false");
#endif
                        break;
                    case ebSkip:
                        nskip = strtol(set, &endptr, 10);
                        if (endptr != set)
                        {
#ifdef DEBUG
                            fprintf(stderr, "nskip: %d frames\n", nskip);
#endif
                            if (nskip >= 0)
                            {
                                gmx->man->nSkip = nskip;
                            }
                        }
                        break;
                    case ebWait:
                        nwait = strtol(set, &endptr, 10);
                        if (endptr != set)
                        {
#ifdef DEBUG
                            fprintf(stderr, "wait: %d ms\n", nwait);
#endif
                            if (nwait >= 0)
                            {
                                gmx->man->nWait = nwait;
                            }
                        }
                    default:
#ifdef DEBUG
                        fprintf(stderr, "item_id: %d, set: %s\n", item_id, set);
#endif
                        break;
                }
            }
            break;
        case DLG_EXIT:
            bOk = (gmx_strcasecmp("ok", set) == 0);
            HideDlg(gmx->dlgs[edBonds]);
            if (bOk)
            {
                if (bBond)
                {
                    switch (ebond)
                    {
                        case eBThin:
                            write_gmx(x11, gmx, IDTHIN);
                            break;
                        case eBFat:
                            write_gmx(x11, gmx, IDFAT);
                            break;
                        case eBVeryFat:
                            write_gmx(x11, gmx, IDVERYFAT);
                            break;
                        case eBSpheres:
                            write_gmx(x11, gmx, IDBALLS);
                            break;
                        default:
                            gmx_fatal(FARGS, "Invalid bond type %d at %s, %d",
                                      ebond, __FILE__, __LINE__);
                    }
                }
                else
                {
                    switch (ebox)
                    {
                        case esbNone:
                            write_gmx(x11, gmx, IDNOBOX);
                            break;
                        case esbRect:
                            write_gmx(x11, gmx, IDRECTBOX);
                            break;
                        case esbTri:
                            write_gmx(x11, gmx, IDTRIBOX);
                            break;
                        case esbTrunc:
                            write_gmx(x11, gmx, IDTOBOX);
                            break;
                        default:
                            gmx_fatal(FARGS, "Invalid box type %d at %s, %d",
                                      ebox, __FILE__, __LINE__);
                    }
                }
            }
            break;
    }
}
Пример #5
0
static bool HandleClient(t_x11 *x11, int ID, t_gmx *gmx)
{
    t_pulldown *pd;

    pd = gmx->pd;

    switch (ID)
    {
        /* File Menu */
        case IDDUMPWIN:
            write_gmx(x11, gmx, IDDODUMP);
            break;
        case IDDODUMP:
            if (gmx->man->bAnimate)
            {
                hide_but(x11, gmx->man->vbox);
            }
            dump_it(gmx->man);
            if (gmx->man->bAnimate)
            {
                show_but(x11, gmx->man->vbox);
            }
            break;
        case IDCLOSE:
        case IDIMPORT:
        case IDEXPORT:
            ShowDlg(gmx->dlgs[edExport]);
            break;
        case IDDOEXPORT:
            write_sto_conf(gmx->confout, *gmx->man->top.name,
                           &(gmx->man->top.atoms),
                           gmx->man->x, NULL, gmx->man->molw->ePBC, gmx->man->box);
            break;
        case IDQUIT:
            show_mb(gmx, emQuit);
            break;
        case IDTERM:
            done_gmx(x11, gmx);
            return true;

        /* Edit Menu */
        case IDEDITTOP:
            edit_file("topol.gmx");
            break;
        case IDEDITCOORDS:
            edit_file("confin.gmx");
            break;
        case IDEDITPARAMS:
            edit_file("mdparin.gmx");
            break;

        /* Display Menu */
        case IDFILTER:
            if (gmx->filter)
            {
                ShowDlg(gmx->dlgs[edFilter]);
            }
            break;
        case IDDOFILTER:
            do_filter(x11, gmx->man, gmx->filter);
            break;
        case IDANIMATE:
            check_pd_item(pd, IDANIMATE, toggle_animate(x11, gmx->man));
            break;
        case IDLABELSOFF:
            no_labels(x11, gmx->man);
            break;
        case IDRESETVIEW:
            reset_view(gmx->man->view);
            ExposeWin(x11->disp, gmx->man->molw->wd.self);
            break;
        case IDPHOTO:
            show_mb(gmx, emNotImplemented);
            break;
        case IDBONDOPTS:
            ShowDlg(gmx->dlgs[edBonds]);
            break;
        case IDTHIN:
            set_bond_type(x11, gmx->man->molw, eBThin);
            break;
        case IDFAT:
            set_bond_type(x11, gmx->man->molw, eBFat);
            break;
        case IDVERYFAT:
            set_bond_type(x11, gmx->man->molw, eBVeryFat);
            break;
        case IDBALLS:
            set_bond_type(x11, gmx->man->molw, eBSpheres);
            break;
        case IDNOBOX:
            set_box_type(x11, gmx->man->molw, esbNone);
            break;
        case IDRECTBOX:
            set_box_type(x11, gmx->man->molw, esbRect);
            break;
        case IDTRIBOX:
            set_box_type(x11, gmx->man->molw, esbTri);
            break;
        case IDTOBOX:
            set_box_type(x11, gmx->man->molw, esbTrunc);
            break;

        /* Analysis Menu */
        case IDBOND:
        case IDANGLE:
        case IDDIH:
        case IDRMS:
        case IDRDF:
        case IDENERGIES:
        case IDCORR:
            show_mb(gmx, emNotImplemented);
            break;

        /* Help Menu */
        case IDHELP:
            show_mb(gmx, emHelp);
            break;
        case IDABOUT:
            show_logo(x11, gmx->logo);
            break;

        default:
            break;
    }
    return false;
}