Esempio n. 1
0
logical OMenu :: SetupActions (OEHAction *action )
{
  QAction       *before_action = NULL;
  OEHAction     *oeh_action    = NULL;
  OPopupMenu    *sub_menu      = NULL;
  int            count         = 0;
  int            indx0         = 0;
  logical        term          = NO;
BEGINSEQ
  if( !qwidget )                                     ERROR
  if( !action || !action->get_childs() )             ERROR
  if ( !qwidget->actions().isEmpty() )
    before_action = qwidget->actions().first();
  count = action->get_childs()->size();
  
  menu_action = action;
  qwidget->setObjectName(action->GetName());

  while ( indx0 < count )
  {
    oeh_action = action->get_childs()->at(indx0++);
    if ( oeh_action->IsSeparated() )
      AddSeparator(before_action);
    if ( !oeh_action->get_childs() || oeh_action->get_childs()->size() <= 0 )
      AddAction(oeh_action->get_qaction(),before_action);
    else if ( oeh_action->IsGrouped() )
      AddActions(&oeh_action->get_group()->actions(),before_action);
    else
      AddMenu(oeh_action,before_action);
  }
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
	void TrayComponent::handleGotActions (const QList<QAction*>& acts, ActionsEmbedPlace aep)
	{
		if (aep != ActionsEmbedPlace::LCTray && aep != ActionsEmbedPlace::QuickLaunch)
			return;

		AddActions (acts, ActionPos::End);
	}
	void TrayComponent::HandleDockAction (QDockWidget *dw, bool visible)
	{
		QAction *act = dw->toggleViewAction ();
		if (!visible)
			RemoveAction (act);
		else
			AddActions ({ act }, ActionPos::Beginning);
	}
Esempio n. 4
0
TWatch *AddWatch(int conditionCount, int actionCount)
{
	TWatch *t;
	CCALLOC(t, sizeof(TWatch));
	t->index = watchIndex++;
	t->next = inactiveWatches;
	inactiveWatches = t;
	t->actions = AddActions(actionCount);
	t->conditions = AddConditions(conditionCount);
	return t;
}
Esempio n. 5
0
void G_ExecuteCommand(char *action)
{
    alist_t	*al;
    
    al = ParseActions(action);
    al = DoRunActions(al, true);
    if(al)
    {
        AddActions(al);
        DerefActionList(al);
    }
}
Esempio n. 6
0
TWatch *AddWatch(int conditionCount, int actionCount)
{
	TWatch *t = sys_mem_alloc(sizeof(TWatch));

	memset(t, 0, sizeof(TWatch));
	t->index = watchIndex++;
	t->next = inactiveWatches;
	inactiveWatches = t;
	t->actions = AddActions(actionCount);
	t->conditions = AddConditions(conditionCount);
	return t;
}
Esempio n. 7
0
TTrigger *AddTrigger(int x, int y, int actionCount)
{
	TTrigger *t;
	TTrigger **h;

	CCALLOC(t, sizeof(TTrigger));
	t->x = x;
	t->y = y;

	h = &root;
	while (*h) {
		if ((*h)->y < y || ((*h)->y == y && (*h)->x < x))
			h = &((*h)->right);
		else
			h = &((*h)->left);
	}
	*h = t;
	t->actions = AddActions(actionCount);
	return t;
}
Esempio n. 8
0
TTrigger *AddTrigger(int x, int y, int actionCount)
{
	TTrigger *t = sys_mem_alloc(sizeof(TTrigger));
	TTrigger **h;

	memset(t, 0, sizeof(TTrigger));
	t->x = x;
	t->y = y;

	h = &root;
	while (*h) {
		if ((*h)->y < y || ((*h)->y == y && (*h)->x < x))
			h = &((*h)->right);
		else
			h = &((*h)->left);
	}
	*h = t;
	t->actions = AddActions(actionCount);
	return t;
}
Esempio n. 9
0
void TryActions(alist_t *al, dboolean up)
{
    if(!al)
        return;
    
    if(up)
    {
        action_t    *action;
        char        buff[256];
        
        if(al->next || (al->cmd[0] != '+'))
            return;
        
        dstrcpy(buff, al->cmd);
        buff[0] = '-';
        action = FindAction(buff);
        if(action)
            action->proc(action->data, al->param);
        return;
    }

    AddActions(DoRunActions(al, false));
}
Esempio n. 10
0
// Launch and Spawn
bool MHEngine::Launch(const MHObjectRef &target, bool fIsSpawn)
{
    if (m_fInTransition)
    {
        MHLOG(MHLogWarning, "WARN Launch during transition - ignoring");
        return false;
    }

    if (target.m_GroupId.Size() == 0) return false; // No file name.
    QString csPath = GetPathName(target.m_GroupId); // Get path relative to root.

    // Check that the file exists before we commit to the transition.
    // This may block if we cannot be sure whether the object is present.
    QByteArray text;
    if (! m_Context->GetCarouselData(csPath, text))
    {
        if (!m_fBooting)
            EngineEvent(2); // GroupIDRefError
        return false;
    }

    MHApplication *pProgram = (MHApplication*)ParseProgram(text);
    if (! pProgram)
    {
        MHLOG(MHLogWarning, "Empty application");
        return false;
    }
    if (! pProgram->m_fIsApp)
    {
        MHLOG(MHLogWarning, "Expected an application");
        delete pProgram;
        return false;
    }
    if ((__mhlogoptions & MHLogScenes) && __mhlogStream != 0)   // Print it so we know what's going on.
    {
        pProgram->PrintMe(__mhlogStream, 0);
    }

    // Clear the action queue of anything pending.
    m_ActionStack.clear();

    m_fInTransition = true; // Starting a transition

    try
    {
        if (CurrentApp())
        {
            if (fIsSpawn)   // Run the CloseDown actions.
            {
                AddActions(CurrentApp()->m_CloseDown);
                RunActions();
            }

            if (CurrentScene())
            {
                CurrentScene()->Destruction(this);
            }

            CurrentApp()->Destruction(this);

            if (!fIsSpawn)
            {
                delete m_ApplicationStack.pop();    // Pop and delete the current app.
            }
        }

        // Save the path we use for this app.
        pProgram->m_Path = csPath; // Record the path
        int nPos = pProgram->m_Path.lastIndexOf('/');

        if (nPos < 0)
        {
            pProgram->m_Path = "";
        }
        else
        {
            pProgram->m_Path = pProgram->m_Path.left(nPos);
        }

        // Have now got the application.
        m_ApplicationStack.push(pProgram);

        // This isn't in the standard as far as I can tell but we have to do this because
        // we may have events referring to the old application.
        while (!m_EventQueue.isEmpty())
        {
            delete m_EventQueue.dequeue();
        }

        // Activate the application. ....
        CurrentApp()->Activation(this);
        m_fInTransition = false; // The transition is complete
        return true;
    }
    catch (...)
    {
        m_fInTransition = false; // The transition is complete
        return false;
    }
}
BOOL CImpactCtrl::Update() 
{
	CString result;
	CString query;
	int selectionSize;

	Clean();

	query = "set ImpactSelection $DiscoverSelection";
	result=ExecCommand(query);
	if(result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)==0)    
		return FALSE;

	// Calculationg selection size
	query = "size $ImpactSelection";
	result=ExecCommand(query);
	if(result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)==0)    
		return FALSE;
    
	selectionSize = atoi(result);
	if(selectionSize > 0) {
		query = "printformat \"%s\t%s\t%s\t%s\t%s\t%s\t%s\" name kind language etag private protected cname;print $ImpactSelection";
		result=ExecPrint(query);
		if(result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)==0)    
			return FALSE;

		CString szRootName;
		szRootName.LoadString(IDS_IMPACTROOTNAME);
		int nRootIconIdx = GetIconIdx(IDB_IMPACTPROJECT);
		HTREEITEM hRoot = m_ImpactTree.InsertItem(szRootName,nRootIconIdx,nRootIconIdx);

		TVINSERTSTRUCT tvInsert;
		tvInsert.hParent = hRoot;
		tvInsert.hInsertAfter = NULL;
		tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;

		int nStartDelim=0,
			nEndDelim;
		while((nEndDelim=result.Find(_T('\n'),nStartDelim))!=-1) {
			CString szAttrs = result.Mid(nStartDelim,nEndDelim-nStartDelim);
			CEntity* pEntity = new CEntity(szAttrs,_T('\t'));
			// if current language is ELS - give it another try ask a language using another command
			if(!pEntity->GetLanguage().CompareNoCase("ELS")) {
				CString szEtag = pEntity->GetEtag();
				if(szEtag.Find(" ")>-1)	szEtag = "{" + szEtag + "}";
				CString queryLanguage = "language [ etag " + szEtag + " ]";
				pEntity->SetLanguage(ExecCommand(queryLanguage));
			}
			CImpactActionsSet* pSet = CreateActions(pEntity);
			if(pSet!=NULL) {  // if we have impact queries for such an entity
				CImpactItem* pImpactItem = new CImpactItem(pEntity,pSet);

				int nIconIdx = GetIconIdx(pEntity->GetKind());

				tvInsert.item.pszText = (char*)(LPCTSTR)pEntity->GetName();
				tvInsert.item.iImage = nIconIdx;
				tvInsert.item.iSelectedImage = nIconIdx;
				tvInsert.item.lParam = (LPARAM)pImpactItem;

				HTREEITEM hEntityRoot = m_ImpactTree.InsertItem(&tvInsert);
				AddActions(hEntityRoot,pImpactItem);
			} else {
				delete pEntity;
			}

			nStartDelim = nEndDelim+1;
		}
		m_ImpactTree.Expand(hRoot,TVE_EXPAND);
	}

	query = "unset ImpactSelection";
	result=ExecCommand(query);
	return result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)!=0;
}
Esempio n. 12
0
void G_RunAlias(int64 data, char **param)
{
    AddActions(DoRunActions((alist_t *)data, false));
}