Esempio n. 1
0
void ScreenUpdates_Disable (const std::string& message, const std::string& title)
{
	if (g_wait_stack.empty()) {
		map::AutoSaver().stopTimer();

		while (gtk_events_pending()) {
			gtk_main_iteration();
		}

		const bool isActiveApp = MainFrame_isActiveApp();

		g_wait = create_wait_dialog(title, message);

		if (isActiveApp) {
			gtk_widget_show(GTK_WIDGET(g_wait.m_window));
			gtk_grab_add(GTK_WIDGET(g_wait.m_window));
			ScreenUpdates_process();
		}
	} else if (GTK_WIDGET_VISIBLE(g_wait.m_window)) {
		gtk_label_set_text(g_wait.m_label, message.c_str());
		ScreenUpdates_process();
	}
	g_wait_stack.push_back(message);
}
Esempio n. 2
0
void MessageGenerator::doType(StringStack& parent, int indent, const char* tag, IXmlType* type, StringBuffer& buf)
{
    const char* typeName = type->queryName();

    if (type->isComplexType())
    {
        if (typeName && std::find(parent.begin(),parent.end(),typeName) != parent.end())
        {
            //DBGLOG("Recursive type: %s, ignored", type->queryName());
        }
        else 
        {
            int flds = type->getFieldCount();
            for (int i=0; i<flds; i++)
            {
                const char* fldName = type->queryFieldName(i);
                buf.appendf("<%s>", fldName);
                if (typeName)
                    parent.push_back(typeName);
                doType(parent,indent+1,fldName,type->queryFieldType(i),buf);
                buf.appendf("</%s>", fldName);
                if (typeName)
                    parent.pop_back();
            }
        }
    }
    else if (type->isArray())
    {
        if (typeName && std::find(parent.begin(),parent.end(),typeName) != parent.end())
        {
            //DBGLOG("Recursive type: %s, ignored", type->queryName());
        }
        else
        {
            const char* itemName = type->queryFieldName(0);
            IXmlType* itemType = type->queryFieldType(0);
            if (typeName)
                parent.push_back(typeName);
            for (int i=0; i<m_items; i++)
            {
                buf.appendf("<%s>", itemName);
                doType(parent,indent+2,itemName, itemType, buf);
                buf.appendf("</%s>", itemName);
            }
            if (m_ecl2esp)
                buf.appendf("<%s/>", itemName);
            if (typeName)
                parent.pop_back();
        }
    }
    else
    {
        //TODO: handle restriction etc
        if (strcmp(typeName,"string")==0) // string type: [tag-typeName]
        {
            if (m_gx)
                buf.append("*** MISSING ***");
            else
                if (m_ecl2esp)
                    buf.append("[?]");
                else
                    buf.appendf("[%s]", tag);
        }
        else
            setDefaultValue(buf,type,tag);
    }
}
Esempio n. 3
0
void MessageGenerator::doType(StringStack& parent, int indent, const char* tag, IXmlType* type, IPTree* tmplat, StringBuffer& buf)
{
    const char* typeName = type->queryName();
    if (type->isComplexType())
    {
        if (typeName && std::find(parent.begin(),parent.end(),typeName) != parent.end())
        {
            //DBGLOG("Recursive type: %s, ignored", typeName);
        }
        else 
        {
            int flds = type->getFieldCount();
            for (int i=0; i<flds; i++)
            {
                const char* fldName = type->queryFieldName(i);
                buf.appendf("<%s>", fldName);
                IPTree* existing = tmplat->queryBranch(fldName);
                if (typeName)
                    parent.push_back(typeName);
                if (existing)
                    doType(parent,indent+1,fldName, type->queryFieldType(i), existing, buf);
                else
                    doType(parent,indent+1,fldName,type->queryFieldType(i),buf);
                buf.appendf("</%s>", fldName);
                if (typeName)
                    parent.pop_back();
            }
        }
    }
    else if (type->isArray())
    {
        if (typeName && std::find(parent.begin(),parent.end(),typeName) != parent.end())
        {
            //DBGLOG("Recursive type: %s, ignored", typeName);
        }
        else 
        {
            const char* itemName = type->queryFieldName(0);
            IXmlType* itemType = type->queryFieldType(0);
            int childCount = tmplat->numChildren();
            if (typeName)
                parent.push_back(typeName);
            if (childCount>0)
            {
                Owned<IPTreeIterator> items = tmplat->getElements(itemName);
                for (items->first(); items->isValid(); items->next())
                {
                    buf.appendf("<%s>", itemName);
                    doType(parent,indent+2,itemName,itemType,&items->query(),buf);
                    buf.appendf("</%s>", itemName);
                }
            }
            else
            {
                for (int i=0; i<m_items; i++)
                {
                    buf.appendf("<%s>", itemName);
                    doType(parent,indent+2,itemName, itemType, buf);
                    buf.appendf("</%s>", itemName);
                }
                if (m_ecl2esp)
                    buf.appendf("<%s/>", itemName);
            }
            if (typeName)
                parent.pop_back();
        }
    }
    else
    {
        const char* existing = tmplat->queryProp(".");
        if (existing && isNotBlank(existing))
            encodeXML(existing,buf);
        else if (m_gx)
            buf.append("*** MISSING ***");
        else
        {
            DefValMap::const_iterator it = m_cfgDefValues.find(tag);
            if (it != m_cfgDefValues.end())
                buf.append(it->second.c_str());
            else
                type->getSampleValue(buf,tag);
        }
    }
}