예제 #1
0
// Toggle a flag in the world structure that corresponds to a checkable item
static void toggleWorldFlag(int &globalVal, b3dUInt32 mask, int menuID)
{
  imodvRegisterModelChg();
  imodvFinishChgUnit();
  globalVal = 1 - globalVal;
  setOrClearFlags(&Imodv->imod->view->world, mask, globalVal);
  Imodv->mainWin->setCheckableItem(menuID, globalVal);
  imodvDraw(Imodv);
}
예제 #2
0
void imodvDepthcueToggle(int state)
{
  ImodvApp *a = Imodv;
 
  imodvRegisterModelChg();
  imodvFinishChgUnit();
  a->depthcue = state;
  if (!state)
    a->imod->view->world &= ~VIEW_WORLD_DEPTH_CUE;
  else
    a->imod->view->world |= VIEW_WORLD_DEPTH_CUE;

  imodvDraw(a);
}
예제 #3
0
void imodvDepthcueStartEnd(int value, bool end, bool dragging)
{
  static bool sliding = false;

  if (!sliding) {
    imodvRegisterModelChg();
    imodvFinishChgUnit();
  }
  sliding = dragging;
  if (end) {
    idcData.fend = value;
    Imodv->imod->view->dcend = (float)value * 0.01f;
  } else {
    idcData.fstart = value;
    Imodv->imod->view->dcstart = (float)value * 0.01f;
  }
  imodvDraw(Imodv);
}
예제 #4
0
void ImodvOlist::actionButtonClicked(int which)
{
  Imod *imod = Imodv->imod;
  IobjGroup *group, *ogroup;
  int ob, index, changed = 1;

  if (which != OBJGRP_NEW && which != OBJGRP_DELETE) {
    group = (IobjGroup *)ilistItem(imod->groupList, imod->curObjGroup);
    if (!group)
      return;
  }

  switch (which) {
  case OBJGRP_NEW:
    imodvRegisterModelChg();
    group = objGroupListExpand(&imod->groupList);
    if (!group)
      break;
    ogroup = (IobjGroup *)ilistItem(imod->groupList, imod->curObjGroup);
    if (ogroup)
      group->objList = ilistDup(ogroup->objList);
    imod->curObjGroup = ilistSize(imod->groupList) - 1;
    updateGroups(Imodv);
    break;

  case OBJGRP_DELETE:
    if (imod->curObjGroup < 0)
      return;
    imodvRegisterModelChg();
    if (objGroupListRemove(imod->groupList, imod->curObjGroup))
      break;
    imod->curObjGroup = B3DMIN(B3DMAX(0, imod->curObjGroup - 1),
                               ilistSize(imod->groupList) - 1);
    updateGroups(Imodv);
    break;

  case OBJGRP_CLEAR:
    imodvRegisterModelChg();
    ilistTruncate(group->objList, 0);
    updateGroups(Imodv);
    break;

  case OBJGRP_ADDALL:
    imodvRegisterModelChg();
    if (group->objList)
      ilistTruncate(group->objList, 0);
    for (ob = 0; ob < imod->objsize; ob++)
      if (objGroupAppend(group, ob))
        return;
    updateGroups(Imodv);
    break;

  case OBJGRP_SWAP:
    imodvRegisterModelChg();
    for (ob = 0; ob < imod->objsize; ob++) {
      index = objGroupLookup(group, ob);
      if (index >= 0)
        ilistRemove(group->objList, index);
      else
        if (objGroupAppend(group, ob))
          return;
    }
    updateGroups(Imodv);
    break;

  case OBJGRP_TURNON:
  case OBJGRP_TURNOFF:
  case OBJGRP_OTHERSON:
  case OBJGRP_OTHERSOFF:
    changed = 0;
    for (ob = 0; ob < imod->objsize; ob++) {
      index = objGroupLookup(group, ob);
      if (((index >= 0 && which == OBJGRP_TURNON) || 
           (index < 0 && which == OBJGRP_OTHERSON)) && 
          iobjOff(imod->obj[ob].flags)) {
        imodvRegisterObjectChg(ob);
        imod->obj[ob].flags &= ~IMOD_OBJFLAG_OFF;
        changed = 1;
      } else if (((index >= 0 && which == OBJGRP_TURNOFF) ||
                  (index < 0 && which == OBJGRP_OTHERSOFF)) &&
                 !iobjOff(imod->obj[ob].flags)) {
        imodvRegisterObjectChg(ob);
        imod->obj[ob].flags |= IMOD_OBJFLAG_OFF;
        changed = 1;
      }
    }
    imodvDraw(Imodv);
    imodvDrawImodImages();
    imodvObjedNewView();
    break;

  }
  if (changed)
    imodvFinishChgUnit();
}