Beispiel #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);
	 }
Beispiel #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);
}
Beispiel #3
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);
    }
}
Beispiel #4
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);
}
inline unsigned int msVectorElementLength (const MSString & str_)
{
  return str_.length();
}