Exemplo n.º 1
0
/*********************************************************************\
	Function name    : CCompareTableDialog::SaveResult
	Description      :
	Created at       : 10.10.01, @ 22:16:07
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CCompareTableDialog::SaveResult()
{
	Filename fn;
	if (!fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, String())) return;

	Int32 lMaxLen = 0;

	Int32 a, lNumItems;
	lNumItems = m_wndOutputList.GetItemCount();

	for (a = 0; a < lNumItems; a++)
	{
		BaseContainer data;
		m_wndOutputList.GetItem(a, &data);
		lMaxLen = LMax(lMaxLen, data.GetString(COMPARE_LIST_NAME).GetLength());
	}
	lMaxLen += 2;

	AutoAlloc <BaseFile> pFile;
	if (!pFile)
		return;

	pFile->Open(fn, FILEOPEN_WRITE);
	for (a = 0; a < lNumItems; a++)
	{
		BaseContainer data;
		m_wndOutputList.GetItem(a, &data);
		String str = data.GetString(COMPARE_LIST_NAME);
		WriteString(pFile, str);
		Int32 b = lMaxLen - str.GetLength();
		while (b--) WriteString(pFile, " ");
		WriteString(pFile, data.GetString(COMPARE_LIST_DATA));
		LineBreak(pFile, "");
	}
}
Exemplo n.º 2
0
void StringReplace::Init(const String &strBuildVersion)
{
	DateTime dt;
	BaseContainer bc;
	char ch[100];

	GetDateTimeNow(dt);
	sprintf_safe(ch, sizeof(ch), "%4d%02d%02d", (int)dt.year, (int)dt.month, (int)dt.day);
	m_strDate = ch;
	sprintf_safe(ch, sizeof(ch), "%02d%02d%02d", (int)dt.hour, (int)dt.minute, (int)dt.second);
	m_strTime = ch;
	m_strDateTime = m_strDate + "_" + m_strTime;
	Int32 lVersion = GetC4DVersion();
	sprintf_safe(ch, sizeof(ch), "%.3f", ((Float32)lVersion) / 1000.0f);
	m_strCurrentVersion = ch;
	m_strStartupPath = GeGetStartupPath().GetString();
	m_strPluginPath = GeGetPluginPath().GetString();
	m_strBuildVersion = strBuildVersion;
	bc = GetMachineFeatures();
	m_strReleaseLine = bc.GetString(1000001);
	m_strBuildID = bc.GetString(1000002);
}
Exemplo n.º 3
0
/// ***************************************************************************
/// This function recursive hides or unhides a node and all its following
/// nodes in the same hierarchy level and below object manager and timeline.
/// Only direct children are hidden or revealed, no other branches.
/// @param[in] root The node to start with.
/// @param[in] hide \c true if the hierarchy should be hidden, \c false
///     if it should be revealed by this function.
/// @param[in] doc The BaseDocument to add undos to, if desired. Pass
///     \c nullptr if no undos should be created.
/// @param[in] sameLevel If \c true (default), all objects following *root*
///     in the hierarchy will also be processed by this function.
/// ***************************************************************************
static void HideHierarchy(BaseList2D* root, Bool hide, BaseDocument* doc, Bool sameLevel=true)
{
  while (root)
  {
    if (doc)
      doc->AddUndo(UNDOTYPE_BITS, root);
    const NBITCONTROL control = (hide ? NBITCONTROL_SET : NBITCONTROL_CLEAR);
    root->ChangeNBit(NBIT_OHIDE, control);
    root->ChangeNBit(NBIT_TL1_HIDE, control);
    root->ChangeNBit(NBIT_TL2_HIDE, control);
    root->ChangeNBit(NBIT_TL3_HIDE, control);
    root->ChangeNBit(NBIT_TL4_HIDE, control);
    root->ChangeNBit(NBIT_THIDE, control);
    root->DelBit(BIT_ACTIVE);

    Bool hideChildren = true;
    if (root->IsInstanceOf(Obase))
    {
      BaseObject* op = static_cast<BaseObject*>(root);
      BaseContainer* bc = op->GetDataInstance();
      CriticalAssert(bc);

      if (bc->GetString(CONTAINEROBJECT_PROTECTIONHASH).Content())
        // Don't modify the hierarchy of "protected" Null-Objects.
        hideChildren = false;
      else if (ContainerIsProtected(op))
        // Don't modify the hierarchy of protected Containers.
        hideChildren = false;
    }

    if (hideChildren)
      HideHierarchy(static_cast<BaseList2D*>(root->GetDown()), hide, doc);

    if (!sameLevel) break;
    root = root->GetNext();
  }
}
Exemplo n.º 4
0
void PaletteSubDialog::FromContainer(const BaseContainer &bc)
{
    Int32 i=0;
    m_showLabel    = bc.GetBool(++i);
    m_rows         = bc.GetInt32(++i);
    m_layout       = bc.GetInt32(++i);
    m_searchString = bc.GetString(++i);
    m_paletteID    = bc.GetInt32(++i);
    
    if(m_rowArea != NULL){
        SetInt32(m_rowArea, m_rows);
    }
    if(m_layoutArea != NULL){
        SetInt32(m_layoutArea, m_layout);
    }
    if(m_labelCheckArea != NULL){
        SetBool(m_labelCheckArea,m_showLabel);
    }
    if(m_searchText != NULL){
        SetString(m_searchText, m_searchString);
    }
    
    m_controlsShown = !m_showControls;
}
Exemplo n.º 5
0
/*********************************************************************\
	Function name    : CDialogCustomElement::Save
	Description      :
	Created at       : 27.03.02, @ 14:54:04
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CDialogCustomElement::Save(BaseFile* pFile, String strFill)
{
    if (g_pCustomElements && m_lElement >= 0 && m_lElement < g_pCustomElements->Entries())
    {
        CustomProperty* pProp;

        CCustomElements* pElement = g_pCustomElements->GetItem(m_lElement);
        if (!pElement) return true;
        if (!m_pbcGUI) return false;
        BaseContainer* pBC = &m_pbcGUI[m_lElement];

        pProp = pElement->m_pProp;

        WriteString(pFile, pElement->m_pChResSym);
        WriteString(pFile, " ");
        WriteString(pFile, m_strControlID);
        LineBreak(pFile, strFill);

        WriteString(pFile, "{");
        LineBreak(pFile, strFill + *g_pstrFillSave);
        SaveAlignment(pFile);
        LineBreak(pFile, strFill);

        if (pElement->m_bIsOpen)
        {
            WriteString(pFile, *g_pstrFillSave);
            WriteString(pFile, "OPEN");
            WriteString(pFile, "; ");
            LineBreak(pFile, strFill);
        }

        Int32 i;
        for (i = 0; pProp && pProp[i].type != CUSTOMTYPE_END; i++)
        {
            Bool b = false;
            if (pProp[i].type == CUSTOMTYPE_FLAG)
            {
                if (pBC->GetBool(pProp[i].id))
                {
                    WriteString(pFile, *g_pstrFillSave);
                    WriteString(pFile, pProp[i].ident);
                    WriteString(pFile, "; ");
                    b = true;
                }
            }
            else if (pProp[i].type == CUSTOMTYPE_LONG)
            {
                WriteString(pFile, *g_pstrFillSave);
                WriteString(pFile, pProp[i].ident);
                WriteString(pFile, " ");
                WriteString(pFile, String::IntToString(pBC->GetInt32(pProp[i].id)));

                // XXX: BITMAPBUTTON SIZE is a CUSTOMTYPE_LONG property, yet it
                // requires a tuple for the SIZE parameter. Can we find a better
                // way than hardcoding this?
                // https://github.com/nr-plugins/resedit/issues/2
                if (String(pElement->m_pChResSym) == String("BITMAPBUTTON") &&
                        String(pProp[i].ident) == String("SIZE")) {
                    WriteString(pFile, ", ");
                    WriteString(pFile, String::IntToString(pBC->GetInt32(pProp[i].id)));
                }

                WriteString(pFile, "; ");
                b = true;
            }
            else if (pProp[i].type == CUSTOMTYPE_REAL)
            {
                WriteString(pFile, *g_pstrFillSave);
                WriteString(pFile, pProp[i].ident);
                WriteString(pFile, " ");
                WriteString(pFile, String::FloatToString(pBC->GetFloat(pProp[i].id)));
                WriteString(pFile, "; ");
                b = true;
            }
            else if (pProp[i].type == CUSTOMTYPE_STRING)
            {
                if (pBC->GetString(pProp[i].id).Content())
                {
                    WriteString(pFile, *g_pstrFillSave);
                    WriteString(pFile, pProp[i].ident);
                    WriteString(pFile, " ");
                    WriteString(pFile, pBC->GetString(pProp[i].id));
                    WriteString(pFile, "; ");
                    b = true;
                }
            }
            else if (pProp[i].type == CUSTOMTYPE_VECTOR)
            {
                WriteString(pFile, *g_pstrFillSave);
                WriteString(pFile, pProp[i].ident);
                WriteString(pFile, " ");
                WriteString(pFile, String::FloatToString(pBC->GetVector(pProp[i].id).x));
                WriteString(pFile, " ");
                WriteString(pFile, String::FloatToString(pBC->GetVector(pProp[i].id).y));
                WriteString(pFile, " ");
                WriteString(pFile, String::FloatToString(pBC->GetVector(pProp[i].id).z));
                WriteString(pFile, " ");
                WriteString(pFile, "; ");
                b = true;
            }

            if (b)
                LineBreak(pFile, strFill);
        }
        WriteString(pFile, "}");
    }

    return true;
}