void CPropTreeItemFileEdit::OnInsertFile()
{
	CFileDialog dlg(TRUE);
	dlg.m_ofn.Flags |= OFN_FILEMUSTEXIST;

	int startSel, endSel;
	GetSel(startSel, endSel);

	if (dlg.DoModal()== IDOK) {

		idStr currentText = (char *)GetItemValue();
		idStr newText = currentText.Left(startSel) + currentText.Right(currentText.Length() - endSel);

		idStr filename = fileSystem->OSPathToRelativePath(dlg.m_ofn.lpstrFile);
		filename.BackSlashesToSlashes();


		newText.Insert(filename, startSel);

		SetItemValue((LPARAM)newText.c_str());
		m_pProp->RefreshItems(this);

		m_pProp->SendNotify(PTN_ITEMCHANGED, this);

	}
}
void GLIDebugVariableGrid::AddWatchDisplay(const UniformData &watchValue, uint watchOffset)
{
  //Create the initial static item  
  int watchRowIndex = AddRowType(RT_WatchValue, watchOffset);  

  //Assign the name
  SetCellValue(watchRowIndex, NAME_COLUMN_INDEX, watchValue.name);

  //Assign the type from the drop down
  SetTypeSelectionBox(watchRowIndex, TYPE_COLUMN_INDEX, watchValue.type);

  //Check the data
  if(watchValue.isFloatType)
  {
    //Get if the data is valid
    if(watchValue.numTypeElements == 0 ||
       watchValue.floatUniformData.size() != watchValue.numTypeElements)
    {
      SetCellValue(watchRowIndex, VALUE_COLUMN_INDEX, wxT("<unknown>"));
      return;
    }

    //Add the single value
    SetItemValue(watchRowIndex, watchValue.type, watchValue.floatUniformData.size(), &watchValue.floatUniformData[0]);
  }
  else
  {
    //Get if the data is valid
    if(watchValue.numTypeElements == 0 ||
       watchValue.intUniformData.size() != watchValue.numTypeElements)
    {
      SetCellValue(watchRowIndex, VALUE_COLUMN_INDEX, wxT("<unknown>"));
      return;
    }

    //Add the single value
    SetItemValue(watchRowIndex, watchValue.type, watchValue.intUniformData.size(), &watchValue.intUniformData[0]);
  }
}
void StereoObject::SetUpForInputOfPoleOrMatrix()
void GLIDebugVariableGrid::AddUniformDisplay(const UniformRowData &uniformValue, uint uniformOffset)
{
  //Create the initial static item  
  int uniformRowIndex = AddRowType(RT_Uniform, uniformOffset);  

  //Assign the name
  SetCellValue(uniformRowIndex, NAME_COLUMN_INDEX, uniformValue.name);

  //Assign the type
  SetCellValue(uniformRowIndex, TYPE_COLUMN_INDEX, GetGLSLStringType(uniformValue.type));

  //Get the array size
  if(uniformValue.arrayCount == 0)
  {
    SetCellValue(uniformRowIndex, VALUE_COLUMN_INDEX, wxT("<empty>"));
    return;
  }

  //If there is more than one array item, nest them
  if(uniformValue.arrayCount > 1)
  {
    //Update the main label name
    wxString labelName;
    labelName.Printf("%s[%u]", uniformValue.name.c_str(), uniformValue.arrayCount); 
    SetCellValue(uniformRowIndex, NAME_COLUMN_INDEX, labelName);
    SetCellRenderer(uniformRowIndex, NAME_COLUMN_INDEX, new ExpandGridCellRenderer(CELL_RENDER_OFFSET, uniformValue.isExpanded));
    SetCellValue(uniformRowIndex, VALUE_COLUMN_INDEX, wxT("...."));

    //If the array is expanded
    if(uniformValue.isExpanded)
    {
      //Loop an add each item as a sub item
      for(uint i=0; i<uniformValue.arrayCount; i++)
      {
        int arrayRowIndex = AddRowType(RT_UniformArray, i);  

        //Set the name
        labelName.Printf("%s[%u]", uniformValue.name.c_str(), i); 
        SetCellValue(arrayRowIndex, NAME_COLUMN_INDEX, labelName);
        SetCellValue(arrayRowIndex, TYPE_COLUMN_INDEX, GetGLSLStringType(uniformValue.type));

        //Add the description
        if(uniformValue.isFloatType)
        {
          SetItemValue(arrayRowIndex, uniformValue.type, uniformValue.numTypeElements, &uniformValue.floatUniformData[i*uniformValue.numTypeElements]);
        }
        else
        {
          SetItemValue(arrayRowIndex, uniformValue.type, uniformValue.numTypeElements, &uniformValue.intUniformData[i*uniformValue.numTypeElements]);
        }
      }
    }
  }
  else
  {
    //Add the single value
    if(uniformValue.isFloatType)
    {
      SetItemValue(uniformRowIndex, uniformValue.type, uniformValue.floatUniformData.size(), &uniformValue.floatUniformData[0]);
    }
    else
    {
      SetItemValue(uniformRowIndex, uniformValue.type, uniformValue.intUniformData.size(), &uniformValue.intUniformData[0]);
    }
  }
 
}
예제 #5
0
CXmlItem* CXmlItem::SetItemValue(const CString& sName, double dValue, XI_TYPE nType)
{
	ASSERT(nType != XIT_CDATA);
	return SetItemValue(sName, ToString(dValue), nType);
}