コード例 #1
0
ファイル: propswnd.c プロジェクト: doniexun/OrangeC
EXPRESSION *GetBaseId(EXPRESSION *exp)
{
    if (!exp)
        return NULL;
    if (exp->type == e_int && exp->rendition)
    {
        return exp;
    }
    else
    {
        EXPRESSION *rv = GetBaseId(exp->left);
        if (rv)
            return rv;
        rv = GetBaseId(exp->right);
        return rv;
    }
}
コード例 #2
0
ファイル: propswnd.c プロジェクト: doniexun/OrangeC
static int GetId(EXPRESSION *exp)
{
    EXPRESSION *x = GetBaseId(exp);
    if (x)
        return x->val;
    if (exp->type == e_int)
        return exp->val;
    return 100;
}
コード例 #3
0
ファイル: propswnd.c プロジェクト: doniexun/OrangeC
static void SetId(struct resRes *data, EXPRESSION *exp, int id, CONTROL *ctls)
{
    EXPRESSION *x = GetBaseId(exp);
    if (x)
    {        
        SYM *sp = search(x->rendition, &currentResData->syms);
        if (!sp)
        {
            x->val = id ;
            if (ctls && id < 100)
                x->val = ResNextCtlId(ctls); // if it is a sys ctl id assign a new one...
                                             // otherwise reuse what was there...
            ResAddNewDef(x->rendition, x->val);
        }
    }
}
コード例 #4
0
// Recent List management
void MadRecentList::AddFileToHistory(const wxString& file)
#if (wxMAJOR_VERSION < 3)
{
    size_t i;

    // Check we don't already have this item
    for (i = 0; i < m_fileHistoryN; ++i)
    {
        if ( m_fileHistory[i] && ItemEQ(file, m_fileHistory[i]) )
        {
            // we do have it, move it to the top of the history
            RemoveFileFromHistory (i);
            AddFileToHistory (file);
            return;
        }
    }

    // if we already have a full history, delete the one at the end
    if ( m_fileMaxFiles == m_fileHistoryN )
    {
        RemoveFileFromHistory (m_fileHistoryN - 1);
        AddFileToHistory (file);
        return;
    }

    // Add to the project file history:
    // Move existing files (if any) down so we can insert file at beginning.
    if (m_fileHistoryN < m_fileMaxFiles)
    {
        wxList::compatibility_iterator node = m_fileMenus.GetFirst();
        while (node)
        {
            wxMenu* menu = (wxMenu*) node->GetData();
            if ( m_fileHistoryN == 0 && menu->GetMenuItemCount() )
            {
                menu->AppendSeparator();
            }
            menu->Append(GetBaseId()+m_fileHistoryN, _("[EMPTY]"));
            node = node->GetNext();
        }
        ++m_fileHistoryN;
    }
    // Shuffle files down
    for (i = (m_fileHistoryN-1); i > 0; --i)
    {
        m_fileHistory[i] = m_fileHistory[i-1];
    }
    m_fileHistory[0] = MYcopystring(file);

    for (i = 0; i < m_fileHistoryN; ++i)
    {
        if ( m_fileHistory[i] )
        {
            wxString itemInMenu = m_fileHistory[i];

            // we need to quote '&' characters which are used for mnemonics
            itemInMenu.Replace(_T("&"), _T("&&"));
            wxString buf;
            buf.Printf(s_MRUEntryFormat, i + 1, itemInMenu.c_str());
            wxList::compatibility_iterator node = m_fileMenus.GetFirst();
            while (node)
            {
                wxMenu* menu = (wxMenu*) node->GetData();
                menu->SetLabel(GetBaseId() + i, buf);
                node = node->GetNext();
            }
        }
    }
}
コード例 #5
0
ファイル: recent_list.cpp プロジェクト: JamesWCCheng/wxMEdit
// Recent List management
void wxRecentList::AddFileToHistory(const wxString& item)
{
#if wxMAJOR_VERSION==2
	size_t i;

	// Check we don't already have this item
	for (i = 0; i < m_fileHistoryN; i++)
	{
		if ( m_fileHistory[i] && ItemEqual(item, m_fileHistory[i]) )
		{
			// we do have it, move it to the top of the history
			RemoveFileFromHistory (i);
			AddFileToHistory (item);
			return;
		}
	}

	// if we already have a full history, delete the one at the end
	if ( m_fileMaxFiles == m_fileHistoryN )
	{
		RemoveFileFromHistory (m_fileHistoryN - 1);
		AddFileToHistory (item);
		return;
	}

	// Add to the project item history:
	// Move existing items (if any) down so we can insert item at beginning.
	if (m_fileHistoryN < m_fileMaxFiles)
	{
		wxList::compatibility_iterator node = m_fileMenus.GetFirst();
		while (node)
		{
			wxMenu* menu = (wxMenu*) node->GetData();
			if ( m_fileHistoryN == 0 && menu->GetMenuItemCount() )
			{
				menu->AppendSeparator();
			}
			menu->Append(GetBaseId()+m_fileHistoryN, _("[EMPTY]"));
			node = node->GetNext();
		}
		m_fileHistoryN ++;
	}
	// Shuffle items down
	for (i = (m_fileHistoryN-1); i > 0; i--)
	{
		m_fileHistory[i] = m_fileHistory[i-1];
	}
	m_fileHistory[0] = MYcopystring(item);

	for (i = 0; i < m_fileHistoryN; i++)
	{
		if ( m_fileHistory[i] )
		{
			wxString itemInMenu = m_fileHistory[i];

			// we need to quote '&' characters which are used for mnemonics
			itemInMenu.Replace(_T("&"), _T("&&"));
			wxString buf;
			buf.Printf(s_MRUEntryFormat, i + 1, itemInMenu.c_str());
			wxList::compatibility_iterator node = m_fileMenus.GetFirst();
			while (node)
			{
				wxMenu* menu = (wxMenu*) node->GetData();
				menu->SetLabel(GetBaseId() + i, buf);
				node = node->GetNext();
			}
		}
	}
#else
	// Check if we don't already have this item.
	size_t i, numItems = m_fileHistory.size();
	for (i = 0; i < numItems; i++)
	{
		if (ItemEqual(item, m_fileHistory[i]))
		{
			// we do have it, move it to the top of the history
			RemoveFileFromHistory(i);
			numItems--;
			break;
		}
	}

	// if we already have a full history, delete the one at the end
	if (numItems == m_fileMaxFiles)
	{
		RemoveFileFromHistory(--numItems);
	}

	// add a new menu item to all item menus (they will be updated below)
	for (wxList::compatibility_iterator node = m_fileMenus.GetFirst();
		node;
		node = node->GetNext())
	{
		wxMenu * const menu = (wxMenu *)node->GetData();

		if (!numItems && menu->GetMenuItemCount())
			menu->AppendSeparator();

		// label doesn't matter, it will be set below anyhow, but it can't
		// be empty (this is supposed to indicate a stock item)
		menu->Append(GetBaseId() + numItems, " ");
	}

	// insert the new item in the beginning of the item history
	m_fileHistory.insert(m_fileHistory.begin(), item);
	numItems++;

	// update the labels in all menus
	for (i = 0; i < numItems; i++)
	{

		wxString itemInMenu = m_fileHistory[i];

		for (wxList::compatibility_iterator node = m_fileMenus.GetFirst();
			node;
			node = node->GetNext())
		{
			wxMenu * const menu = (wxMenu *)node->GetData();

			menu->SetLabel(GetBaseId() + i, GetMRUEntryLabel(i, itemInMenu));
		}
	}
#endif
}