void LuaParser::setFuncFilter(QString Filter)
{
    if (FuncProxyModel != NULL)
    {
        FuncProxyModel->setFilterRegExp(QRegExp(Filter, Qt::CaseInsensitive, QRegExp::FixedString));
        if (FuncProxyModel->rowCount() <= 0)
        {
            if (AppProxyModel != NULL)
            {
                delete AppProxyModel;
                AppProxyModel = NULL;
            }
            AppearencesListView->setModel(NULL);

            if (AppsFuncPropListMdl != NULL)
            {
                delete AppsFuncPropListMdl;
                AppsFuncPropListMdl = NULL;
            }
            AppearencePropFuncListView->setModel(NULL);
        }
    }

    SelectFunction(0);
}
示例#2
0
void CPhylogenView::OnLButtonDown(UINT nFlags, CPoint point)
{
    CScrollView::OnLButtonDown(nFlags, point);

    // TODO: Add your message handler code here and/or call default

    SelectFunction();

}
示例#3
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{

    static char firstTime = 1;
    int i, buflen;
    char *command;
    MexFunctionPtr f;

    /* Clear out device table */
    if (firstTime) {
        for (i = 0; i < MAX_DEVS; i++) {
            ppdev_table[i] = NULL;
        }
        firstTime = 0;
    }

    /* Input must be a string. */
    if (mxIsChar(prhs[0]) != 1) {
        mexErrMsgTxt("Command/first input must be a string.");
    }

    /* Input must be a row vector. */
    if (mxGetM(prhs[0]) != 1) {
        mexErrMsgTxt("Command/first input must be a row vector.");
    }

    buflen = (mxGetM(prhs[0]) * mxGetN(prhs[0])) + 1;
    command = mxCalloc(buflen, sizeof(char));
    mxGetString(prhs[0], command, buflen);

    nrhs--;
    prhs++;

    f = SelectFunction(command);
    if (f == NULL) {
        mexErrMsgTxt("Unkown command.\n");
    }
    (*f)(nlhs, plhs, nrhs, prhs);

}
示例#4
0
Overlay::Overlay(PClip _child, AVSValue args, IScriptEnvironment *env) :
GenericVideoFilter(_child) {

  full_range = args[ARG_FULL_RANGE].AsBool(false);  // Maintain CCIR601 range when converting to/from RGB.

  // Make copy of the VideoInfo
  inputVi = (VideoInfo*)malloc(sizeof(VideoInfo));
  memcpy(inputVi, &vi, sizeof(VideoInfo));

  mask = 0;
  opacity = (int)(256.0*args[ARG_OPACITY].AsDblDef(1.0)+0.5);
  offset_x = args[ARG_X].AsInt(0);
  offset_y = args[ARG_Y].AsInt(0);

  overlay = args[ARG_OVERLAY].AsClip();
  overlayVi = overlay->GetVideoInfo();
  overlayConv = SelectInputCS(&overlayVi, env);

  if (!overlayConv) {
    AVSValue new_args[3] = { overlay, false, (full_range) ? "PC.601" : "rec601" };
    try {
      overlay = env->Invoke("ConvertToYV24", AVSValue(new_args, 3)).AsClip();
    } catch (...)  {}

    overlayVi = overlay->GetVideoInfo();
    overlayConv = SelectInputCS(&overlayVi, env);

    if (!overlayConv) {  // ok - now we've tried everything ;)
      env->ThrowError("Overlay: Overlay image colorspace not supported.");
    }
  }

  greymask = args[ARG_GREYMASK].AsBool(true);  // Grey mask, default true
  ignore_conditional = args[ARG_IGNORE_CONDITIONAL].AsBool(false);  // Don't ignore conditionals by default

  if (args[ARG_MASK].Defined()) {  // Mask defined
    mask = args[ARG_MASK].AsClip();
    maskVi = mask->GetVideoInfo();
    if (maskVi.width!=overlayVi.width) {
      env->ThrowError("Overlay: Mask and overlay must have the same image size! (Width is not the same)");
    }
    if (maskVi.height!=overlayVi.height) {
      env->ThrowError("Overlay: Mask and overlay must have the same image size! (Height is not the same)");
    }

    maskConv = SelectInputCS(&maskVi, env);
    if (!maskConv) {
      AVSValue new_args[3] = { mask, false, (full_range) ? "PC.601" : "rec601" };

      try {
        mask = env->Invoke((greymask) ? "ConvertToY8" : "ConvertToYV24", AVSValue(new_args, 3)).AsClip();
      } catch (...)  {}
      maskVi = mask->GetVideoInfo();
      maskConv = SelectInputCS(&maskVi, env);
      if (!maskConv) {
        env->ThrowError("Overlay: Mask image colorspace not supported.");
      }
    }

    maskImg = new Image444(maskVi.width, maskVi.height);

    if (greymask) {
      maskImg->free_chroma();
      maskImg->SetPtr(maskImg->GetPtr(PLANAR_Y), PLANAR_U);
      maskImg->SetPtr(maskImg->GetPtr(PLANAR_Y), PLANAR_V);
    }

  }

  inputCS = vi.pixel_type;
  inputConv = SelectInputCS(inputVi, env);

  if (!inputConv) {
    AVSValue new_args[3] = { child, false, (full_range) ? "PC.601" : "rec601" };
    try {
      child = env->Invoke("ConvertToYV24", AVSValue(new_args, 3)).AsClip();
    } catch (...)  {}

    vi = child->GetVideoInfo();
    memcpy(inputVi, &vi, sizeof(VideoInfo));
    inputConv = SelectInputCS(inputVi, env);
    if (!inputConv) {
      env->ThrowError("Overlay: Colorspace not supported.");
    }
  }

  outputConv = SelectOutputCS(args[ARG_OUTPUT].AsString(0),env);

  if (vi.IsYV24() && inputCS == vi.pixel_type)  // Fast path
    img = NULL;
  else
    img = new Image444(vi.width, vi.height);

  overlayImg = new Image444(overlayVi.width, overlayVi.height);

  func = SelectFunction(args[ARG_MODE].AsString("Blend"), env);

}
示例#5
0
void CPhylogenView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    // TODO: Add your message handler code here and/or call default

    CGenedocDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    POSITION Pos;
    CPhyloGenBase *pPGB;

    CClientDC dc(this);
    OnPrepareDC(&dc);

    int Selection;

    switch ( nChar ) {
    case VK_DOWN:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection += 1;
        if ( Selection >= pDoc->m_pPGBase->m_PhyloList.GetCount() ) Selection = 0;
        SetSelected(Selection, 1);
        break;
    case VK_UP:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection -= 1;
        if ( Selection < 0 ) Selection = pDoc->m_pPGBase->m_PhyloList.GetCount() - 1;
        SetSelected(Selection, 1);
        break;
    case VK_NEXT:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection += 5;
        if ( Selection >= pDoc->m_pPGBase->m_PhyloList.GetCount() ) Selection = 0;
        SetSelected(Selection, 1);
        break;
    case VK_PRIOR:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection -= 5;
        if ( Selection < 0 ) Selection = pDoc->m_pPGBase->m_PhyloList.GetCount() - 1;
        SetSelected(Selection, 1);
        break;
    case VK_HOME:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection = 0;
        SetSelected(Selection, 1);
        break;
    case VK_END:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection = pDoc->m_pPGBase->m_PhyloList.GetCount() - 1;
        SetSelected(Selection, 1);
        break;
    case VK_RETURN:
        Selection = 0;
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            CPhyloGenBase * pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_Selected == 1 ) break;
            Selection++;
        }
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_Selected ) {
                pPGB->m_FirstSelection = 1;
                break;
            }
        }
        CreateFunction();
        SetSelected(Selection, 0 );
        break;
    case VK_SHIFT:
    case VK_SPACE:
        SelectFunction();
        break;
    case VK_DELETE:
        Selection = 0;
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            CPhyloGenBase * pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_Selected == 1 ) break;
            Selection++;
        }
        DeleteFunction();
        SetSelected(Selection, 0 );
        break;
    case VK_ESCAPE:
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_FirstSelection == 1 ) {
                pPGB->m_FirstSelection = 0;
                CRect tRect = pPGB->m_ClientRect;
                dc.LPtoDP( &tRect );
                InvalidateRect( tRect );
            }
        }
        break;
    }

    CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}