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);

	}
}
int CALLBACK SortEntities(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
  int iResult = 0;
  CEntity *pen1 = (CEntity *) lParam1;
  CEntity *pen2 = (CEntity *) lParam2;

  INDEX iFormat;
  CTString strEn1=GetItemValue(pen1, lParamSort, iFormat);
  CTString strEn2=GetItemValue(pen2, lParamSort, iFormat);

  if( iFormat==PDF_STRING)
  {
    iResult = stricmp( strEn1, strEn2);
  }
  else if( iFormat==PDF_COLOR)
  {
    INDEX ubR, ubG, ubB;
    INDEX ubH, ubS, ubV;
    INDEX ubA;
    strEn1.ScanF( "RGB=(%d,%d,%d) HSV=(%d,%d,%d) Alpha=%d", &ubR, &ubG, &ubB, &ubH, &ubS, &ubV, &ubA);
    INDEX iVal1=ubV;
    strEn2.ScanF( "RGB=(%d,%d,%d) HSV=(%d,%d,%d) Alpha=%d", &ubR, &ubG, &ubB, &ubH, &ubS, &ubV, &ubA);
    INDEX iVal2=ubV;
    iResult=iVal1>iVal2;
  }
  else
  {
    if( iFormat==PDF_FLOAT)
    {
      FLOAT fEn1=0;
      FLOAT fEn2=0;
      strEn1.ScanF("%g", &fEn1);
      strEn2.ScanF("%g", &fEn2);
      if( fEn1>fEn2) iResult=1; else iResult=-1;
    }
    else if( iFormat==PDF_INDEX)
    {
      INDEX iEn1=0;
      INDEX iEn2=0;
      strEn1.ScanF("%d", &iEn1);
      strEn2.ScanF("%d", &iEn2);
      if( iEn1>iEn2) iResult=1; else iResult=-1;
    }
  }

  if( theApp.m_bInvertClassSort) return -iResult; else return iResult;
}
Exemplo n.º 3
0
void CArpeggioGraphEditor::ModifyItem(CPoint point, bool Redraw)
{
	int ItemWidth = GetItemWidth();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = GetItemValue(point.y);

	if (ItemIndex < 0 || ItemIndex >= (int)m_pSequence->GetItemCount())
		return;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	m_pSequence->SetItem(ItemIndex, ItemValue);

	CGraphEditor::ModifyItem(point, Redraw);
}
Exemplo n.º 4
0
/*
================
rvPropertyGrid::CancelEdit

Stop editing without saving the data
================
*/
void rvPropertyGrid::CancelEdit ( void )
{
	if ( mState == STATE_EDIT && !mEditLabel )
	{
		if ( !*GetItemValue ( mEditItem ) )
		{
			RemoveItem ( mEditItem );			
		}
	}

	mSelectedItem = mEditItem;
	mEditItem = -1;
	mState = STATE_NORMAL;
	ShowWindow ( mEdit, SW_HIDE );
	SetFocus ( mWindow );	
	SetCurSel ( mSelectedItem );
}
Exemplo n.º 5
0
void CArpeggioGraphEditor::HighlightItem(CPoint point)
{
	int ItemWidth = GetItemWidth();
	int ItemIndex = (point.x - GRAPH_LEFT) / ItemWidth;
	int ItemValue = GetItemValue(point.y);
	int LastItem = m_iHighlightedItem;
	int LastValue = m_iHighlightedValue;

	m_iHighlightedItem = ItemIndex;
	m_iHighlightedValue = ItemValue;

	if (m_GraphRect.PtInRect(point) == 0 || unsigned(ItemIndex) >= m_pSequence->GetItemCount()) { 
		m_iHighlightedItem = -1;
		m_iHighlightedValue = 0;
	}

	if (m_iHighlightedItem != LastItem || m_iHighlightedValue != LastValue) {
		RedrawWindow(NULL);
	}
}
Exemplo n.º 6
0
float COperMysql::GetItemFloat(DWORD row,string &fieldname)
{
	return (float)atof(GetItemValue(row,fieldname).c_str());
}
Exemplo n.º 7
0
float COperMysql::GetItemFloat(DWORD row,WORD index)
{
	return (float)atof(GetItemValue(row,index).c_str());	
}
Exemplo n.º 8
0
string COperMysql::GetItemString(DWORD row,string &fieldname)
{
	return GetItemValue(row,fieldname);
}
Exemplo n.º 9
0
string COperMysql::GetItemString(DWORD row,WORD index)
{

	return GetItemValue(row,index);

}
Exemplo n.º 10
0
void StereoObject::SetUpForInputOfPoleOrMatrix()
Exemplo n.º 11
0
double CXmlItem::GetItemValueF(const CString& sItemName, const CString& sSubItemName) const 
{ 
	return Misc::Atof(GetItemValue(sItemName, sSubItemName)); 
}
Exemplo n.º 12
0
//得到指定行某个字段的数值
float CMysqlStore::GetItemFloat(unsigned long row,
								const unsigned int index)
{
	return (float)atof(GetItemValue(row,index).c_str());
}
Exemplo n.º 13
0
//得到指定行某个字段的字符串类型值
const std::string CMysqlStore::GetItemString(unsigned long row,
											 unsigned int index)
{
	return GetItemValue(row,index);
}
Exemplo n.º 14
0
int CXmlItem::GetItemValueI(const CString& sItemName, const CString& sSubItemName) const 
{ 
	return _ttoi(GetItemValue(sItemName, sSubItemName)); 
}
vector<CLogModel*> CHistoryItemLogParser::ParseLog(long& lPosition, long lLength, char* pBuffer)
{
	map<long long,string> mapHostMacDict;
	string strFormatLog;
	stringstream strErrorMess;
	int iZbxServerId, iValueType, iMaintenance;	
	string strHost, strKey_, strHostName, strIfAddress, strZbIpAddress, strSerialNumber;
	string strTemp;
	string strValue;
	HostInfo tagHostInfo;
	long long lItemId, lClock, lHostId, lServerId;

	
	vector<CLogModel*> vtHistoryItemModelPtr;

	while (lPosition < lLength) 
	{
		//	ResetHostInfo(tagHostInfo);
			// Init database fields
		lClock = iZbxServerId = lHostId = lItemId = iValueType = lServerId = iMaintenance = 0;
		strKey_ = strValue = strHost = strHostName = strIfAddress = strZbIpAddress = strSerialNumber = "";
		CLogModel* pLogModel = RegisterModel();

		//Parse Clock
		lClock = ParseLong((const char*)pBuffer, lPosition, lLength);

		//Parse ServerId
		iZbxServerId = ParseInt((const char*)pBuffer, lPosition, lLength);

		//Parse HostId
		lHostId = ParseLong((const char*)pBuffer, lPosition, lLength);
			
		// Calculate ServerId
		lServerId = ((lHostId - 10000) * 256) + iZbxServerId;

		//Parse Hostname
		strTemp = GetBlock((const char*)pBuffer, lPosition, lLength);
		if(strTemp.compare("") != 0)
		{
			strHostName = strTemp;
			strHostName = CUtilities::ReplaceBlockBracket(strHostName);
			strHost = strHostName;
		}

		//Parse zb IP Address
		strTemp = GetBlock((const char*)pBuffer, lPosition, lLength);
		if(strTemp.compare("") != 0)
		{
			strIfAddress = strTemp;
			strIfAddress = CUtilities::ReplaceBlockBracket(strIfAddress);
			strZbIpAddress = strIfAddress;
		}

		//Parse Maintenance Status
		iMaintenance = ParseInt((const char*)pBuffer, lPosition, lLength);

		//Parse ItemId
		lItemId = ParseLong((const char*)pBuffer, lPosition, lLength);			
			
		//Parse Key_
		strKey_ = GetItemKey((const char*)pBuffer, lPosition, lLength);
			
		//Parse Value Type
		iValueType = ParseInt((const char*)pBuffer, lPosition, lLength);			

		//Parse Value
		if (strKey_.compare(SYSTEM_INFO) == 0 
			|| strKey_.compare(VB_SYSTEM_INFO) == 0 
			|| strKey_.compare(OS_INFO) == 0)
		{
			try
			{
				//ParseSystemInfo((const char*)pBuffer, lPosition, lLength, lServerId, mapHostMacDict, tagHostInfo);
				strValue = GetValueBlock((const char*)pBuffer, lPosition, lLength);
			}
			catch(exception& ex)
			{
				strErrorMess << ex.what() << " " << __FILE__ << " " << __LINE__;
				strFormatLog = CUtilities::FormatLog(ERROR_MSG, "CHistoryItemLogParser", "ParseLog", strErrorMess.str());
				CUtilities::WriteErrorLog(strFormatLog);
			}
		}
		else if (strKey_.compare(SDK_READ_TEXT) == 0 || strKey_.compare(SDK_READ_TEXT_LINUX) == 0)
		{
			strTemp = GetToken((const char*)pBuffer, lPosition, lLength);
			if (strTemp.compare("") != 0)
			{
				strValue = strTemp;
				strSerialNumber = strValue;
				strSerialNumber.erase(std::find_if(tagHostInfo.strSerialNumber.rbegin(), tagHostInfo.strSerialNumber.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), tagHostInfo.strSerialNumber.end());
			}
		}

		else
			strValue = GetItemValue((const char*)pBuffer, lPosition, lLength);
		
		CHistoryItemModel *pHistoryItemModel = dynamic_cast<CHistoryItemModel*>(pLogModel);

		pHistoryItemModel->SetItemId(lItemId);
		pHistoryItemModel->SetKey_(strKey_);
		pHistoryItemModel->SetValueType(iValueType);
		pHistoryItemModel->SetValue(strValue);
		pHistoryItemModel->SetServerId(lServerId);
		pHistoryItemModel->SetZabbixServerId(iZbxServerId);
		pHistoryItemModel->SetHostId(lHostId);
		pHistoryItemModel->SetSerialNumber(strSerialNumber);
		pHistoryItemModel->SetHost(strHost);
		pHistoryItemModel->SetHostName(strHostName);
		pHistoryItemModel->SetZbIpAddress(strZbIpAddress);
		pHistoryItemModel->SetMaintenance(iMaintenance);
		pHistoryItemModel->SetClock(lClock);

		if (ExtractData(pHistoryItemModel))
		{
			vtHistoryItemModelPtr.push_back(pHistoryItemModel);
		}
		else
		{
			delete pHistoryItemModel;
		}
	}
	return vtHistoryItemModelPtr;
}
Exemplo n.º 16
0
long CMysqlStore::GetItemLong(unsigned long row,
							  const std::string &fieldname)
{
	return atol(GetItemValue(row,fieldname).c_str());
}
Exemplo n.º 17
0
//得到指定行某个字段的整数值
long CMysqlStore::GetItemLong(unsigned long row,
							  const unsigned int index)
{
	return atol(GetItemValue(row,index).c_str());
}
Exemplo n.º 18
0
float CMysqlStore::GetItemFloat(unsigned long row,
								const std::string &fieldname)
{
	return (float)atof(GetItemValue(row,fieldname).c_str());
}
Exemplo n.º 19
0
long COperMysql::GetItemLong(DWORD row,WORD index)			
{
	return atol(GetItemValue(row,index).c_str());
}
Exemplo n.º 20
0
long COperMysql::GetItemLong(DWORD row,string &fieldname)
{
	return atol(GetItemValue(row,fieldname).c_str());
}
Exemplo n.º 21
0
const std::string CMysqlStore::GetItemString(unsigned long row,
											 const std::string &fieldname)
{
	return GetItemValue(row,fieldname);
}