示例#1
0
文件: msgbox.cpp 项目: UkCvs/ukcvs
//////////////////////////////////////////////////////////////////////
// Function Name:	CMsgBox	
// Description:		
// Parameters:		
// Data IN/OUT:		
// Return:		
// Notes:		
//////////////////////////////////////////////////////////////////////
CMsgBox::CMsgBox(const char *text,
		 Font *fontText,
		 const int _mode,
		 const CBox *position,
		 const char *title,
		 Font *fontTitle,
		 const char *icon,
		 int return_button,
		 const result_ default_result)
{
	frameBuffer = CFrameBuffer::getInstance();
	//TRACE("->CMsgBox::CMsgBox\r\n");
	initVar();

	if(title != NULL)	m_cTitle 	= title;
	if(fontTitle != NULL)	m_pcFontTitle 	= fontTitle;
	if(icon != NULL)	m_cIcon 	= icon;
	if(position != NULL)	m_cBoxFrame	= *position;
	m_nMode = _mode;
	//TRACE(" CMsgBox::cText: %d ,m_cTitle %d,m_nMode %d\t\r\n",strlen(text),m_cTitle.size(),m_nMode);

	if(m_nMode & BORDER)
		m_nWindowFrameBorderWidth = WINDOW_FRAME_BORDER_WIDTH;
	else
		m_nWindowFrameBorderWidth = 0;

	//TRACE("  Mode: ");
	//if(_mode & BORDER) TRACE("BORDER ");
	//if(_mode & TITLE) TRACE("TITLE ");
	//if(_mode & FOOT) TRACE("FOOT ");
	//if(_mode & CENTER) TRACE("CENTER");
	//TRACE("\r\n");

	//TRACE_1(" m_nWindowFrameBorderWidth: \t%d\r\n",m_nWindowFrameBorderWidth);


	/* Initialise the window frames first */
	initFramesRel();

	m_pcTextBox = new CTextBox(	text,
					fontText,
					_mode,
					&m_cBoxFrameText);

	if((_mode & AUTO_WIDTH) || (_mode & AUTO_HIGH))
	{
		/* window might changed in size ...*/
		m_cBoxFrameText		= m_pcTextBox->getWindowsPos();

		m_cBoxFrame.iWidth	= m_cBoxFrameText.iWidth + m_nWindowFrameBorderWidth;
		m_cBoxFrame.iHeight	= m_cBoxFrameText.iHeight + m_cBoxFrameFootRel.iHeight +  m_cBoxFrameTitleRel.iHeight + m_nWindowFrameBorderWidth;

		initFramesRel();
	}

	if(_mode & CENTER)
	{
		m_cBoxFrame.iX	= g_settings.screen_StartX + ((g_settings.screen_EndX - g_settings.screen_StartX - m_cBoxFrame.iWidth) >>1);
		m_cBoxFrame.iY	= g_settings.screen_StartY + ((g_settings.screen_EndY - g_settings.screen_StartY - m_cBoxFrame.iHeight) >>2);
	}
示例#2
0
PlayLabel::PlayLabel(int resID,int width,int height,QWidget *parent) :
    m_iResID(resID),QLabel(parent),m_width(width),m_height(height)
{
    initVar();
    setupUI();
    prepareStyle();
    prepareSlot();
}
示例#3
0
文件: stackV.c 项目: Kegeruneku/nife
static void newVar(char * S)
{
char Lib[LDFLT+1];
    strncpy(Lib,S,LDFLT);
    Lib[LDFLT]='\0';
    initVar(Lib);
    dropTrSuite();
}
示例#4
0
MenuWidget::MenuWidget(QWidget *parent) :
    QWidget(parent)
{
    initVar();
    setupUI();
    prepareSyle();
    prepareSlot();
}
示例#5
0
AuthorityMgrWidget::AuthorityMgrWidget(QWidget *parent) :
    QDialog(parent)
{
    setupUI();
    initVar();
    prepareStyle();
    prepareSlot();
}
示例#6
0
//////////////////////////////////////////////////////////////////////
// Function Name:	CListFrame	
// Description:		
// Parameters:		
// Data IN/OUT:		
// Return:		
// Notes:		
//////////////////////////////////////////////////////////////////////
CListFrame::CListFrame(LF_LINES* lines,
		       Font* font_text,
		       const int _mode,
		       const CBox* position,
		       const char* textTitle,
		       Font* font_title)
{
	//TRACE("[CListFrame] new\r\n");
	initVar();

	m_pcWindow = NULL;

 	if(lines != NULL)
 	{
		m_pLines = lines;
		m_nNrOfRows = lines->rows;
		if(m_nNrOfRows > LF_MAX_ROWS)
			m_nNrOfRows = LF_MAX_ROWS;
	}
	if(font_text != NULL)	m_pcFontList = font_text;
	if(font_text != NULL)	m_pcFontHeaderList = font_text;
	if(position != NULL)
	{
		m_cFrame	= *position;
		m_nMaxHeight = m_cFrame.iHeight;
		m_nMaxWidth = m_cFrame.iWidth;
	}

	m_nMode = _mode;
	
#if 0
	TRACE("  Mode: ");
	if(mode & SCROLL) TRACE("SCROLL ");
	if(mode & AUTO_WIDTH) TRACE("AUTO_WIDTH ");
	if(mode & AUTO_HIGH) TRACE("AUTO_HIGH");
	TRACE("\r\n");
#endif


	if(font_title != NULL) 
		m_pcFontTitle = font_title;
	
	if( textTitle != NULL) 
		m_textTitle = textTitle;
		
	m_nFontListHeight  = m_pcFontList->getHeight();
	m_nFontHeaderListHeight = m_pcFontHeaderList->getHeight();
	m_nFontTitleHeight = m_pcFontTitle->getHeight();
	
	//TRACE(" CListFrame::m_nFontTextHeight: %d\t\r\n",m_nFontListHeight);

	/* Initialise the window frames first */
	initFramesRel();

	// than refresh text line array 
	onNewLineArray();
}
示例#7
0
//////////////////////////////////////////////////////////////////////
// Function Name:	CListFrame	
// Description:		
// Parameters:		
// Data IN/OUT:		
// Return:		
// Notes:		
//////////////////////////////////////////////////////////////////////
CListFrame::CListFrame()
{
	//TRACE("[CListFrame] new\r\n");
	initVar();
	initFramesRel();
	
	m_pLines = NULL;
	m_pcWindow = NULL;
}
示例#8
0
文件: stackV.c 项目: Kegeruneku/nife
void IF_debVarCS(void)
{
char *v;
    v = getString();
    if (v != NULL) {
       initVar(v);
       free((void*)v);
    }
}
示例#9
0
//////////////////////////////////////////////////////////////////////
// Function Name:	CListFrame	
// Description:		
// Parameters:		
// Data IN/OUT:		
// Return:		  
// Notes:		
//////////////////////////////////////////////////////////////////////
CListFrame::CListFrame(	LF_LINES* lines)
{
	//TRACE("[CListFrame] new\r\n");
	initVar();

	m_pcWindow = NULL;
 	if(lines != NULL)
 	{
		m_pLines = lines;
		m_nNrOfRows = lines->rows;
		if(m_nNrOfRows > LF_MAX_ROWS)
			m_nNrOfRows = LF_MAX_ROWS;
	}

	/* Initialise the window frames first */
	initFramesRel();

	// than refresh text line array 
	onNewLineArray();
}
示例#10
0
 void init(containProcCls *cp1){cpc=cp1;initVar();}
示例#11
0
//  ~parserCls(){myDebugKey(1,"in ~patrsercls ");}
  parserCls(char *nn):scannerCls(nn)
  {initVar();getToken();nextProcSpecification.addNameFile(nn);}
示例#12
0
void take_fork(int i){
  extern sem_t mutex, s[N];
  extern status state[N];
  sem_wait(&mutex);
  state[i]=HUNGRY;
  try(i);
  sem_post(&mutex);
  sem_wait(&s[i]);
}
 
void leave_fork(int i){
  extern sem_t mutex;
  extern status state[N];
  sem_wait(&mutex);
  state[i]=THINKING;
  try(LEFT(i));
  try(RIGHT(i));
  sem_post(&mutex);
}
 
void try(int i){
  extern sem_t s[N];
  extern status state[N];
 
  if(state[i]==HUNGRY && state[LEFT(i)]!=EATING && state[RIGHT(i)]!=EATING){
    state[i]=EATING;
    sem_post(&s[i]);
  }
}
 
void *cook(){
  //pop out food every 5 sec
  //There is a cooking process that produces food at regular intervals of 5 seconds.
  //The amount produced each time is a random value in the range [0, 100].
  extern int food;
  while(1){
    food+=randint(101);
    printf("food produced. food=%d\n",food);
    sleep(5);
  }
}
 
int main (){
  pthread_t t[N],tc;
  //init threads, each running a philosopher
  int i,j;
  initVar();
  //staring cooking thread:
  printf("starting cook thread:\n");
  pthread_create(&tc,NULL,cook,NULL);
  for (i=0;i<N;i++){
    printf("starting new phil=%d\n",i);
    pthread_create(&t[i],NULL,philosopher,&i);
    //sleeping for 100 usec so the i value doesnt change before the philosopher
    //func creates a local copy;
    usleep(100);
  }
  for (i=0;i<N;i++){
    pthread_join(t[i],NULL);
  }
  //recycle cook thread:
  pthread_join(tc,NULL);
  return 0;
}