Пример #1
0
/* write a color bar with (roughly) logarithmic scale as BMP image to FILE.
 */
static void
write_scale(apr_file_t *file)
{
  int x;
  word value = 0, inc = 1;

  /* write header to file */
  write_bitmap_header(file, 64, 1);

  for (x = 0; x < 64; ++x)
    {
      apr_size_t written;
      byte color[3] = { 128, 128, 128 };

      select_color(color, value);
      if (value + (int)inc < 0x10000)
        {
          value += inc;
          if (value >= 8 * inc)
            inc *= 2;
        }

      written = sizeof(color);
      apr_file_write(file, color, &written);
    }
}
Пример #2
0
/* Write the cluster read map for all files in INFO as BMP image to FILE.
 * If MAX_X is not 0, scale all lines to MAX_X pixels.  Use POOL for
 * allocations.
 */
static void
write_bitmap(apr_array_header_t *info,
             int max_x,
             apr_file_t *file,
             apr_pool_t *pool)
{
  int ysize = info->nelts;
  int xsize = 0;
  int x, y;
  apr_size_t row_size;
  apr_size_t written;
  color_t *line, *scaled_line;
  svn_boolean_t do_scale = max_x > 0;

  /* xsize = max cluster number */
  for (y = 0; y < ysize; ++y)
    if (xsize < APR_ARRAY_IDX(info, y, file_stats_t *)->read_map->nelts)
      xsize = APR_ARRAY_IDX(info, y, file_stats_t *)->read_map->nelts;

  /* limit picture dimensions (16k pixels in each direction) */
  if (xsize >= 0x4000)
    xsize = 0x3fff;
  if (ysize >= 0x4000)
    ysize = 0x3fff;
  if (max_x == 0)
    max_x = xsize;

  /* rows in BMP files must be aligned to 4 bytes */
  row_size = APR_ALIGN(max_x * sizeof(color_t), 4);

  /**/
  line = apr_pcalloc(pool, xsize * sizeof(color_t));
  scaled_line = apr_pcalloc(pool, row_size);

  /* write header to file */
  write_bitmap_header(file, max_x, ysize);

  /* write all rows */
  for (y = 0; y < ysize; ++y)
    {
      file_stats_t *file_info = APR_ARRAY_IDX(info, y, file_stats_t *);
      int block_count = file_info->read_map->nelts;
      for (x = 0; x < xsize; ++x)
        {
          color_t color = { 128, 128, 128 };
          if (x < block_count)
            {
              word count = APR_ARRAY_IDX(file_info->read_map, x, word);
              select_color(color, count);
            }

          memcpy(line[x], color, sizeof(color));
        }

      scale_line(scaled_line, max_x, line, block_count ? block_count : 1);

      written = row_size;
      apr_file_write(file, do_scale ? scaled_line : line, &written);
    }
}
Пример #3
0
void repaint(infoptr pic, rectangle area)
{
  point p;
  int n;

  for(p.y = area.bottom_left.y; p.y <= area.top_right.y; p.y++)
    for(p.x = area.bottom_left.x; p.x <= area.top_right.x; p.x++)
    { 
      /* Muutetaan pikselikoordinaatit joukon koordinaateiksi ja iteroidaan */
      if(pic->is_mandel)    /* Mandelbrotin joukko */
	n = iterate(to_dpoint(p, pic),     /* alkupiste  */
		    to_dpoint(p, pic),     /* iteraation lisäys */
		    pic->max_iterations);  /* max iteraatiot */

      else   /* Julian joukko */
	n = iterate(to_dpoint(p, pic),
		    pic->julia_c,
		    pic->max_iterations);

      /* Pikselin väri hajaantumisnopeuden n mukaan */
      SRGP_setColor(select_color(n, pic->max_iterations));
      SRGP_point(p);
    }
}
Пример #4
0
LRESULT CALLBACK ThresholdDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
	static int init;
	char temp[100];
	THRESHOLDOBJ * st;
	int x;
	
	st = (THRESHOLDOBJ *) actobject;
    if ((st==NULL)||(st->type!=OB_THRESHOLD)) return(FALSE);

	for (x=0;x<GLOBAL.objects;x++) if (objects[x]==actobject) 
	{ char tmp[10]; wsprintf(tmp,"%d",x); 
	  //SendDlgItemMessage(ghWndStatusbox,IDC_LISTE,LB_ADDSTRING, 0, (LPARAM)(tmp)); 
	}
					

	switch( message )
	{
		case WM_INITDIALOG:
			{
				SCROLLINFO lpsi;
				
				
				lpsi.cbSize=sizeof(SCROLLINFO);
				lpsi.fMask=SIF_RANGE; // |SIF_POS;
				
				lpsi.nMin=1; lpsi.nMax=1000;
				SetScrollInfo(GetDlgItem(hDlg,IDC_AVGINTERVALBAR),SB_CTL,&lpsi,TRUE);
				SetScrollInfo(GetDlgItem(hDlg,IDC_ADAPTINTERVALBAR),SB_CTL,&lpsi,TRUE);

				lpsi.nMin=-1000; lpsi.nMax=1000;
				SetScrollInfo(GetDlgItem(hDlg,IDC_AVGGAINBAR),SB_CTL,&lpsi,TRUE);

				lpsi.nMin=0; lpsi.nMax=1000;
				SetScrollInfo(GetDlgItem(hDlg,IDC_AVGFROMBAR),SB_CTL,&lpsi,TRUE);
				SetScrollInfo(GetDlgItem(hDlg,IDC_AVGTOBAR),SB_CTL,&lpsi,TRUE);

				lpsi.nMin=0; lpsi.nMax=100;
				SetScrollInfo(GetDlgItem(hDlg,IDC_BARSIZEBAR),SB_CTL,&lpsi,TRUE);
				SetScrollInfo(GetDlgItem(hDlg,IDC_FONTSIZEBAR),SB_CTL,&lpsi,TRUE);

				init=TRUE;
				SetDlgItemInt(hDlg, IDC_AVGINTERVAL, st->interval_len,TRUE);
				SetDlgItemInt(hDlg, IDC_ADAPTINTERVAL, st->adapt_interval,TRUE);
				SetScrollPos(GetDlgItem(hDlg,IDC_AVGINTERVALBAR), SB_CTL,st->interval_len,TRUE);
				SetScrollPos(GetDlgItem(hDlg,IDC_ADAPTINTERVALBAR), SB_CTL,st->adapt_interval,TRUE);

				SetDlgItemInt(hDlg, IDC_AVGGAIN, st->signal_gain,1);
				SetScrollPos(GetDlgItem(hDlg,IDC_AVGGAINBAR), SB_CTL,st->signal_gain,TRUE);

				SetDlgItemInt(hDlg, IDC_BARSIZE, st->barsize,0);
				SetScrollPos(GetDlgItem(hDlg,IDC_BARSIZEBAR), SB_CTL,st->barsize,TRUE);
				SetDlgItemInt(hDlg, IDC_FONTSIZE, st->fontsize,0);
				SetScrollPos(GetDlgItem(hDlg,IDC_FONTSIZEBAR), SB_CTL,st->fontsize,TRUE);

				sprintf(temp,"%.2f",st->from_input);
				SetDlgItemText(hDlg, IDC_AVGFROM, temp);
				SetScrollPos(GetDlgItem(hDlg,IDC_AVGFROMBAR), SB_CTL,(int) size_value(st->in_ports[0].in_min,st->in_ports[0].in_max, st->from_input ,0.0f,1000.0f,0),TRUE);

				sprintf(temp,"%.2f",st->to_input);
				SetDlgItemText(hDlg, IDC_AVGTO, temp);
				SetScrollPos(GetDlgItem(hDlg,IDC_AVGTOBAR), SB_CTL,(int) size_value(st->in_ports[0].in_min,st->in_ports[0].in_max, st->to_input ,0.0f,1000.0f,0),TRUE);

				SetDlgItemInt(hDlg, IDC_BIGADAPT, st->bigadapt,TRUE);
				SetDlgItemInt(hDlg, IDC_SMALLADAPT, st->smalladapt,TRUE);

				SetDlgItemText(hDlg, IDC_METERCAPTION, st->wndcaption);

				CheckDlgButton(hDlg, IDC_AND,st->op);
				CheckDlgButton(hDlg, IDC_OR,!st->op);
				CheckDlgButton(hDlg, IDC_SHOWMETER,st->showmeter);
				CheckDlgButton(hDlg, IDC_RISING,st->rising);
				CheckDlgButton(hDlg, IDC_FALLING,st->falling);
				CheckDlgButton(hDlg, IDC_USE_MEDIAN,st->usemedian);
				CheckDlgButton(hDlg, IDC_BASELINE,st->baseline);
				if (st->baseline) SetDlgItemText(hDlg,IDC_INTERVALUNIT,"Seconds");
				else SetDlgItemText(hDlg,IDC_INTERVALUNIT,"Samples");

				init=FALSE;
			}
			return TRUE;
	
		case WM_CLOSE:
				EndDialog(hDlg, LOWORD(wParam));
				return TRUE;
			break;
		case WM_COMMAND:
			switch (LOWORD(wParam)) 
			{
			case IDC_AND: st->op=TRUE; break;
			case IDC_OR:  st->op=FALSE; break;
			case IDC_RISING: st->rising=IsDlgButtonChecked(hDlg,IDC_RISING); break;
			case IDC_FALLING: st->falling=IsDlgButtonChecked(hDlg,IDC_FALLING); break;
			case IDC_USE_MEDIAN: st->usemedian=IsDlgButtonChecked(hDlg,IDC_USE_MEDIAN); break;
			case IDC_BASELINE: st->baseline=IsDlgButtonChecked(hDlg,IDC_BASELINE); 
				if (st->baseline) SetDlgItemText(hDlg,IDC_INTERVALUNIT,"Seconds");
				else SetDlgItemText(hDlg,IDC_INTERVALUNIT,"Samples");
				break;
			case IDC_SELECTCOLOR:
				st->color=select_color(hDlg,st->color);
				st->redraw=1;
				InvalidateRect(hDlg,NULL,FALSE);
				break;
			case IDC_BKCOLOR:
				st->bkcolor=select_color(hDlg,st->bkcolor);
				st->redraw=1;
				InvalidateRect(hDlg,NULL,FALSE);
				break;
			case IDC_FONTCOL:
				st->fontcolor=select_color(hDlg,st->fontcolor);
				st->redraw=1;
				InvalidateRect(hDlg,NULL,FALSE);
				break;
			case IDC_FONTBKCOL:
				st->fontbkcolor=select_color(hDlg,st->fontbkcolor);
				st->redraw=1;
				InvalidateRect(hDlg,NULL,FALSE);
				break;

			case IDC_AVGFROM:
				GetDlgItemText(hDlg, IDC_AVGFROM,temp,sizeof(temp));
				if (!init)	
					 st->from_input=(float)atof(temp);
				break;
			case IDC_AVGTO:
				GetDlgItemText(hDlg, IDC_AVGTO,temp,sizeof(temp));
				if (!init) 
					st->to_input=(float)atof(temp);
				break;
			case IDC_AVGINTERVAL:
			case IDC_ADAPTINTERVAL:
			case IDC_AVGGAIN:
			case IDC_BIGADAPT:
			case IDC_SMALLADAPT:
			case IDC_METERCAPTION:
				 if (!init) 
					 apply_threshold(hDlg, st);
					break;

			
			case IDC_SHOWMETER:
				{  int i;
				   i=IsDlgButtonChecked(hDlg,IDC_SHOWMETER);
				   if ((st->showmeter)&&(!i)&&(st->displayWnd))  { DestroyWindow(st->displayWnd); st->displayWnd=NULL; }
				   if ((!st->showmeter)&&(i)) 
				   {  
					   if(!(st->displayWnd=CreateWindow("Meter_Class", st->wndcaption, WS_CLIPSIBLINGS| WS_CHILD | WS_CAPTION | WS_THICKFRAME ,st->left, st->top, st->right-st->left, st->bottom-st->top, ghWndMain, NULL, hInst, NULL)))
							report_error("can't create Meter Window");
					   else { st->last_value=0; ShowWindow( st->displayWnd, TRUE ); UpdateWindow( st->displayWnd ); }
				   }
				   st->showmeter=i;
				}
				break;

			}
			return TRUE;
			
		case WM_HSCROLL:
		{
			int nNewPos; float x;

			nNewPos=get_scrollpos(wParam,lParam);

			if (lParam == (long) GetDlgItem(hDlg,IDC_AVGINTERVALBAR))  SetDlgItemInt(hDlg, IDC_AVGINTERVAL,nNewPos,0);
			if (lParam == (long) GetDlgItem(hDlg,IDC_ADAPTINTERVALBAR))  SetDlgItemInt(hDlg, IDC_ADAPTINTERVAL,nNewPos,0);
			if (lParam == (long) GetDlgItem(hDlg,IDC_AVGGAINBAR))  SetDlgItemInt(hDlg, IDC_AVGGAIN,nNewPos,TRUE);
			if (lParam == (long) GetDlgItem(hDlg,IDC_BARSIZEBAR))  SetDlgItemInt(hDlg, IDC_BARSIZE,nNewPos,TRUE);
			if (lParam == (long) GetDlgItem(hDlg,IDC_FONTSIZEBAR))  SetDlgItemInt(hDlg, IDC_FONTSIZE,nNewPos,TRUE);
			if (lParam == (long) GetDlgItem(hDlg,IDC_AVGFROMBAR))
			{  
				  x=size_value(0.0f,1000.0f,(float)nNewPos,st->in_ports[0].in_min,st->in_ports[0].in_max,0);
				  sprintf(temp,"%.2f",x);
				  SetDlgItemText(hDlg, IDC_AVGFROM, temp);

			}
			if (lParam == (long) GetDlgItem(hDlg,IDC_AVGTOBAR))  
			{  
				  x=size_value(0.0f,1000.0f,(float)nNewPos,st->in_ports[0].in_min,st->in_ports[0].in_max,0);
			   	  sprintf(temp,"%.2f",x);
				  SetDlgItemText(hDlg, IDC_AVGTO, temp);
			}
			apply_threshold(hDlg,st);
			if (st->displayWnd) {st->last_value=INVALID_VALUE; st->redraw=1; InvalidateRect(st->displayWnd,NULL,TRUE);}
		
		}	break;
		case WM_SIZE:
		case WM_MOVE:  update_toolbox_position(hDlg);
		case WM_PAINT:
			color_button(GetDlgItem(hDlg,IDC_SELECTCOLOR),st->color);
			color_button(GetDlgItem(hDlg,IDC_BKCOLOR),st->bkcolor);
			color_button(GetDlgItem(hDlg,IDC_FONTCOL),st->fontcolor);
			color_button(GetDlgItem(hDlg,IDC_FONTBKCOL),st->fontbkcolor);
		break;
	}
    return FALSE;
}
Пример #5
0
// ------------------------------------------------------
// CategoryDlg
CategoryDlg::CategoryDlg(QWidget *parent, QString name)
 : QDialog(parent, name, TRUE)
{
   QFont labelFont;
   labelFont.setBold(true);

   QBoxLayout* topLayout = new QVBoxLayout(this);
   QBoxLayout* row4Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row3Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row2Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row1Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row0Layout = new QHBoxLayout(topLayout);

   QLabel *colorLabel = new QLabel ("Color", this);
   colorLabel->setFont(labelFont);
   colorLabel->setAlignment(QLabel::AlignRight|QLabel::AlignVCenter);
   row1Layout->addWidget(colorLabel, 0, AlignLeft);

   m_Color = new QPushButton(this, "color");
   m_Color->setText("...");
   m_Color->setFont(labelFont);
   connect(m_Color, SIGNAL(clicked()),
	   this, SLOT(select_color()));
   row1Layout->addWidget(m_Color);

   QLabel *nameLabel = new QLabel ("Name", this);
   nameLabel->setFont(labelFont);
   nameLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row4Layout->addWidget(nameLabel);

   m_Name = new QLineEdit(this, "Name");
   m_Name->setFont(labelFont);
   row4Layout->addWidget(m_Name);

   QLabel *filterLabel = new QLabel ("Filter", this);
   filterLabel->setFont(labelFont);
   filterLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row3Layout->addWidget(filterLabel);

   m_Filter  = new QLineEdit(this, "Filter");
   m_Filter->setFont(labelFont);
   row3Layout->addWidget(m_Filter);

   QLabel *filteroutLabel = new QLabel ("FilterOut", this);
   filteroutLabel->setFont(labelFont);
   filteroutLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row2Layout->addWidget(filteroutLabel);

   m_FilterOut  = new QLineEdit(this, "FilterOut");
   m_FilterOut->setFont(labelFont);
   row2Layout->addWidget(m_FilterOut);

   QPushButton *ok = new QPushButton("OK", this);
   row0Layout->addWidget(ok, 0, AlignLeft);

   QPushButton *cancel = new QPushButton("Cancel", this);
   row0Layout->addWidget(cancel, 0, AlignRight);

   // Hook on pressing the buttons
   connect(ok, SIGNAL(clicked()), SLOT(accept()));
   connect(cancel, SIGNAL(clicked()), SLOT(reject()));
}
Пример #6
0
LRESULT CALLBACK CounterDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    static int init;
    COUNTEROBJ * st;

    st = (COUNTEROBJ *) actobject;
    if ((st==NULL)||(st->type!=OB_COUNTER)) return(FALSE);

    switch( message )
    {
    case WM_INITDIALOG:
        SCROLLINFO lpsi;
        lpsi.cbSize=sizeof(SCROLLINFO);
        lpsi.fMask=SIF_RANGE|SIF_POS;
        lpsi.nMin=4;
        lpsi.nMax=300;
        SetScrollInfo(GetDlgItem(hDlg,IDC_FONTSIZEBAR),SB_CTL,&lpsi, TRUE);
        SetScrollPos(GetDlgItem(hDlg,IDC_FONTSIZEBAR), SB_CTL,st->fontsize, TRUE);
        SetDlgItemInt(hDlg, IDC_FONTSIZE, st->fontsize, FALSE);
        SetDlgItemText(hDlg, IDC_CAPTION, st->wndcaption);


        SetDlgItemInt(hDlg, IDC_RESETVALUE, (int)st->resetvalue,TRUE);
        switch (st->mode)
        {
        case 0:
            CheckDlgButton(hDlg, IDC_COUNTFT,TRUE);
            break;
        case 1:
            CheckDlgButton(hDlg, IDC_COUNTTF,TRUE);
            break;
        case 2:
            CheckDlgButton(hDlg, IDC_COUNTIV,TRUE);
            break;
        case 3:
            CheckDlgButton(hDlg, IDC_COUNTFREQ,TRUE);
            break;
        }
        CheckDlgButton(hDlg, IDC_SHOWCOUNTER,st->showcounter);
        CheckDlgButton(hDlg, IDC_INTEGER,st->integer);

        return TRUE;

    case WM_CLOSE:
        EndDialog(hDlg, LOWORD(wParam));
        return TRUE;
        break;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_COUNTFT:
            st->mode=0;
            break;
        case IDC_COUNTTF:
            st->mode=1;
            break;
        case IDC_COUNTIV:
            st->mode=2;
            break;
        case IDC_COUNTFREQ:
            st->mode=3;
            break;

        case IDC_RESETCOUNTER:
            st->countervalue=st->resetvalue;
            break;
        case IDC_RESETVALUE:
            st->resetvalue=(float)GetDlgItemInt(hDlg, IDC_RESETVALUE,NULL, 1);
            break;

        case IDC_FONTCOLOR:
            st->fontcolor=select_color(hDlg);
            InvalidateRect(hDlg,NULL,FALSE);
            InvalidateRect(st->displayWnd,NULL,TRUE);
            break;
        case IDC_BKCOLOR:
            st->bkcolor=select_color(hDlg);
            InvalidateRect(hDlg,NULL,FALSE);
            InvalidateRect(st->displayWnd,NULL,TRUE);
            break;
        case IDC_CAPTION:
            GetDlgItemText(hDlg,IDC_CAPTION,st->wndcaption,50);
            SetWindowText(st->displayWnd,st->wndcaption);
            break;

        case IDC_INTEGER:
            st->integer=IsDlgButtonChecked(hDlg,IDC_INTEGER);
            InvalidateRect(st->displayWnd,NULL,TRUE);
            break;

        case IDC_SHOWCOUNTER:
        {   int i;
            i=IsDlgButtonChecked(hDlg,IDC_SHOWCOUNTER);
            if ((st->showcounter)&&(!i)&&(st->displayWnd))  {
                DestroyWindow(st->displayWnd);
                st->displayWnd=NULL;
            }
            if ((!st->showcounter)&&(i))
            {
                if(!(st->displayWnd=CreateWindow("Counter_Class", "Counter", WS_THICKFRAME| WS_CLIPCHILDREN,st->left, st->top, st->right-st->left, st->bottom-st->top, NULL, NULL, hInst, NULL)))
                    report_error("can't create Counter Window");
                else {
                    ShowWindow( st->displayWnd, TRUE );
                    UpdateWindow( st->displayWnd );
                }
            }
            st->showcounter=i;
        }
        break;

        }
        return TRUE;

    case WM_HSCROLL:
        if (lParam == (long) GetDlgItem(hDlg,IDC_FONTSIZEBAR))
        {
            int nNewPos=get_scrollpos(wParam,lParam);
            SetDlgItemInt(hDlg, IDC_FONTSIZE, nNewPos, TRUE);
            st->fontsize=nNewPos;
            if (st->font) DeleteObject(st->font);
            if (!(st->font = CreateFont(-MulDiv(st->fontsize, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial")))
                report_error("Font creation failed!");

            InvalidateRect(st->displayWnd, NULL, TRUE);
        }
        break;

    case WM_SIZE:
    case WM_MOVE:
        update_toolbox_position(hDlg);
    case WM_PAINT:
        color_button(GetDlgItem(hDlg,IDC_FONTCOLOR),st->fontcolor);
        color_button(GetDlgItem(hDlg,IDC_BKCOLOR),st->bkcolor);
        break;
    }
    return FALSE;
}
Пример #7
0
LRESULT CALLBACK ButtonDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
	static int init;
	char temp[100];
	BUTTONOBJ * st;
	int x;
	
	st = (BUTTONOBJ *) actobject;
    if ((st==NULL)||(st->type!=OB_BUTTON)) return(FALSE);
					
	switch( message )
	{
		case WM_INITDIALOG:
			{
				SetDlgItemInt(hDlg, IDC_VALUE1, st->value1,TRUE);
				SetDlgItemInt(hDlg, IDC_VALUE2, st->value2,TRUE);

				SetDlgItemText(hDlg, IDC_BUTTONPATH, st->buttonpath);
				SetDlgItemText(hDlg, IDC_BUTTONCAPTION, st->buttoncaption);

				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Play Session");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Stop Session");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "End Session");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Output Value1 if pressed, else Value2");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Output Value1 if pressed, else INVALID_VALUE");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Toggle Value1 and Value2");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Send Value2 for 1 second");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Display Device Settings");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_ADDSTRING, 0,(LPARAM) (LPSTR) "Display Application Settings");
				SendDlgItemMessage( hDlg, IDC_FUNCTIONCOMBO, CB_SETCURSEL, (WPARAM) (st->buttonfunction), 0L ) ;
				CheckDlgButton(hDlg, IDC_DISPLAYBORDER, st->displayborder);

			}
			return TRUE;
	
		case WM_CLOSE:
				EndDialog(hDlg, LOWORD(wParam));
				return TRUE;
			break;
		case WM_COMMAND:
			switch (LOWORD(wParam)) 
			{
			case IDC_TRANSCOL:
				st->transcolor=select_color(hDlg,st->transcolor);
				st->redraw=1;
				InvalidateRect(hDlg,NULL,FALSE);
				InvalidateRect(st->displayWnd,NULL,FALSE);
				break;
			case IDC_BKCOL:
				st->bkcolor=select_color(hDlg,st->bkcolor);
				st->redraw=1;
				InvalidateRect(hDlg,NULL,FALSE);
				InvalidateRect(st->displayWnd,NULL,FALSE);
				break;
			case IDC_BUTTONPATH:
				GetDlgItemText(hDlg,IDC_BUTTONPATH,st->buttonpath,256); 
				InvalidateRect(st->displayWnd,NULL,FALSE);
				break;

			case IDC_BUTTONCAPTION:
				GetDlgItemText(hDlg, IDC_BUTTONCAPTION, st->buttoncaption, 80);
				SetWindowText(st->displayWnd,st->buttoncaption);
				InvalidateRect(st->displayWnd,NULL,FALSE);
				break;

			case IDC_VALUE1:
				st->value1=GetDlgItemInt(hDlg,IDC_VALUE1,NULL,TRUE); 
				break;
			case IDC_VALUE2:
				st->value2=GetDlgItemInt(hDlg,IDC_VALUE2,NULL,TRUE); 
				break;
			case IDC_FUNCTIONCOMBO:
				if (HIWORD(wParam)==CBN_SELCHANGE)
				{
					st->buttonfunction=SendDlgItemMessage(hDlg, IDC_FUNCTIONCOMBO, CB_GETCURSEL, 0, 0 );
				}
				break;
			case IDC_DISPLAYBORDER:
				 st->displayborder=IsDlgButtonChecked(hDlg,IDC_DISPLAYBORDER);
				 update_border(st->displayWnd,st->displayborder);
  				 st->redraw=1;
  				 InvalidateRect(st->displayWnd,NULL,FALSE);
				break;
			}
			return TRUE;

		case WM_SIZE:
		case WM_MOVE:  update_toolbox_position(hDlg);
		case WM_PAINT:
			color_button(GetDlgItem(hDlg,IDC_TRANSCOL),st->transcolor);
			color_button(GetDlgItem(hDlg,IDC_BKCOL),st->bkcolor);
			break;
	}
    return FALSE;
}