Exemple #1
0
void MSOptionMenu::drawFieldValue(void)
{
  if (frozen()==MSFalse&&owner()->mapped()==MSTrue&&mapped()==MSTrue)
   {
     int sht=fieldValue()->shadowThickness();
     XFillRectangle(display(),window(),backgroundShadowGC(),
		    fieldValue()->x()+sht,fieldValue()->y()+sht,
		    fieldValue()->width()-(sht<<1),fieldValue()->height()-(sht<<1));

     MSString buffer;
     const char *pString=formatOutput(buffer);
     if (pString!=0&&buffer.length()>0)
      {   
	int len=buffer.length();
	if (len>0)
	 {
	   int xx=fieldValue()->x()+fieldValue()->offset();
	   int offset=fieldValue()->highlightThickness()+fieldValue()->shadowThickness();
	   int margin=(fieldValue()->height()-(2*offset+fieldValue()->textHeight()))>>1;
	   int yy=offset+((margin>0)?margin:0)+fieldValue()->textAscent();
	   
	   int vw=fieldValue()->width()-2*fieldValue()->offset()-
	          2*MSOptionMenuDefaultMargin-MSOptionMenuSymbolWidth;
           int tw=fieldValue()->textWidth(pString,len);
           int delta=(vw>tw)?((vw-tw)>>1):0;
	   
	   fieldValue()->foreground(itemForeground(selectedItem()));
	   XDrawString(display(),window(),fieldValue()->textGC(),fieldValue()->textFontStruct(),
		       xx+delta,fieldValue()->y()+yy,pString,len);
	 }
Exemple #2
0
int MSRawConnection::syncSend(const MSString &aString_,int seconds,int microseconds,MSBoolean isAbsolute)
{

  if (isSet(MSProtocolConnection<MSString>::Reset)) return 0;
  struct timeval timeout, now, tvp;
  if (isAbsolute==MSTrue)
   {
     if (0 > microseconds) return 0;
     tvp.tv_sec=seconds;
     tvp.tv_usec=microseconds;
   }
  else
   {
     gettimeofday(&now,NULL);
     timeout.tv_sec=seconds;
     timeout.tv_usec=microseconds;
     tvsum(&now,&timeout,&tvp);
   }
  if(writeChannel()==0)
   {
     MSMessageLog::errorMessage("MSRawConnection::syncSend: No Write Channel\n");
     return 0;
   }
  MSBuffer *b=new MSBuffer;
  if (b==NULL) return 0;
  b->stuff(aString_.string(),aString_.length());
  sendTheBuffer(b);
  return syncWriteSelectLoop(&tvp);
}
Exemple #3
0
int MSRawConnection::send(const MSString& aString_)
{
  if (isSet(MSProtocolConnection<MSString>::Reset)==MSTrue) return MSFalse;
  if (readChannel()==0) return MSFalse; 

  MSBuffer *pBuffer=new MSBuffer;
  pBuffer->stuff(aString_.string(),aString_.length());
  sendTheBuffer(pBuffer);
  if (isSet(MSProtocolConnection<MSString>::WritePause)==MSFalse) writeChannel()->enable();
  // attempt to immediately write the buffer
  return doWrite(MSFalse);
}
Exemple #4
0
MSMBSDate::MSMBSDate(const MSString& aString_,const char* strptimeFormat_)
: MSDate(MSJulian(0))
{
  struct tm aTimeStruct={0};
#if defined(MS_NO_STRPTIME)
  MSMessageLog::errorMessage("MSMBSDate: strptime() not supported for this platform.\n");
  _date=0;
#else
  char *pString=strptime((char *)aString_.string(),(char *)strptimeFormat_,&aTimeStruct);
  if (pString==0) _date=0;
  else _date=as30_360(aTimeStruct.tm_mon+1,aTimeStruct.tm_mday,aTimeStruct.tm_year+1900);
#endif
}
Exemple #5
0
void MSIndexVector::Operations::setFromMSString (void *pData_, unsigned int vectIndex_,
						 const MSString & str_, unsigned int& startPos_, const char) const
{
  if (startPos_<str_.length())
    {
      if (isspace(str_(startPos_)))
	{
	  startPos_ = str_.indexOfAnyBut(MSStringTest(APLUS_ISPACE),startPos_+1);
	  if (startPos_>=str_.length())
	    {
	      return;
	    }
	}

      unsigned int endPos = str_.indexOfAnyOf(MSStringTest(APLUS_ISPACE),startPos_);
      ((Data *)pData_)->elements()[vectIndex_] = str_.subString(startPos_,endPos-startPos_).asUnsigned();
      startPos_ = str_.indexOfAnyBut(MSStringTest(APLUS_ISPACE),endPos);
    }
}
Exemple #6
0
MSError::ErrorStatus MSMBSDate::set(const MSString& aString_) { return set(aString_.string()); }
Exemple #7
0
unsigned int MSIndexVector::Operations::numElements (const MSString & str_, const char) const
{
  return str_.numWords();
}
inline unsigned int msVectorElementLength (const MSString & str_)
{
  return str_.length();
}
Exemple #9
0
MSError::ErrorStatus MSTerm::set(const MSString& sp_)
{ return set(sp_.string()); }