示例#1
0
static void hide_mb(t_gmx *gmx)
{
  if (gmx->which_mb >= 0 && gmx->which_mb < emNR) {
    HideDlg(gmx->mboxes[gmx->which_mb]);
    gmx->which_mb = -1;
  }
}
示例#2
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;
    }
}
示例#3
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;
  }
}
示例#4
0
static gint surface_inspector_key_press_event( GtkWidget *widget, GdkEventKey* event, gpointer data ) {
	if ( event->keyval == GDK_Escape ) {
		HideDlg();
		return TRUE;
	}
	return FALSE;
}
示例#5
0
static void ExitDlg(t_dlg *dlg)
{
  if (dlg->bGrab) {
    XUngrabPointer(dlg->x11->disp,CurrentTime);
    dlg->bGrab=FALSE;
  }
  HideDlg(dlg);
  if (dlg->flags & DLG_FREEONBUTTON)
    FreeDlg(dlg);
}
示例#6
0
void ToggleSurface(){
#ifdef DBG_SI
	Sys_Printf( "ToggleSurface Module\n" );
#endif
	if ( !g_surfwin ) {
		DoSurface();
	}
	else {
		HideDlg();
	}
}
示例#7
0
void FreeDlg(t_dlg *dlg)
{
  int i;

  if (dlg->dlgitem) {
    HideDlg(dlg);
    dlg->x11->UnRegisterCallback(dlg->x11,dlg->win.self);
    for(i=0; (i<dlg->nitem); i++) {
      FreeDlgItem(dlg,dlg->dlgitem[i]->ID);
      if (dlg->dlgitem[i])
	sfree(dlg->dlgitem[i]);
    }
    sfree(dlg->dlgitem);
    if (dlg->win.self)
      XDestroyWindow(dlg->x11->disp,dlg->win.self);
    dlg->dlgitem=NULL;
  }
}
示例#8
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;
    }
}
示例#9
0
static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
	HideDlg();
	return TRUE;
}