BOOL TCHdwProtocolDlg(HWND hwnd,USHORT idButton)
  {
  switch(idButton)
    {
    case HWP_5BITS:
//      CheckButton(hwnd,idButton,~Checked(hwnd,idButton));
      ControlEnable(hwnd,HWP_15BITS,TRUE);
      ControlEnable(hwnd,HWP_2BITS,FALSE);
      if (Checked(hwnd,HWP_2BITS))
        {
        CheckButton(hwnd,HWP_2BITS,FALSE);
        CheckButton(hwnd,HWP_15BITS,TRUE);
        }
      break;
    case HWP_8BITS:
    case HWP_7BITS:
    case HWP_6BITS:
//      CheckButton(hwnd,idButton,~Checked(hwnd,idButton));
      ControlEnable(hwnd,HWP_15BITS,FALSE);
      ControlEnable(hwnd,HWP_2BITS,TRUE);
      if (Checked(hwnd,HWP_15BITS))
        {
        CheckButton(hwnd,HWP_15BITS,FALSE);
        CheckButton(hwnd,HWP_2BITS,TRUE);
        }
    default:
      return(FALSE);
    }
   return(TRUE);
  }
void FillHdwTimeoutDlg(HWND hwnd,DCB *pstComDCB)
  {
  char szTimeout[8];

  sprintf(szTimeout,"%u",pstComDCB->ReadTimeout);
  WinSetDlgItemText(hwnd,HWT_RTIME,szTimeout);
  WinSendDlgItemMsg(hwnd,HWT_RTIME,EM_SETTEXTLIMIT,MPFROMSHORT(5),(MPARAM)NULL);

  sprintf(szTimeout,"%u",pstComDCB->WrtTimeout);
  WinSendDlgItemMsg(hwnd,HWT_WTIME,EM_SETTEXTLIMIT,MPFROMSHORT(5),(MPARAM)NULL);
  WinSetDlgItemText(hwnd,HWT_WTIME,szTimeout);

  if (pstComDCB->Flags3 & F3_INFINITE_WRT_TIMEOUT)
    {
    ControlEnable(hwnd,HWT_WTIMET,FALSE);
    ControlEnable(hwnd,HWT_WTIME,FALSE);
    CheckButton(hwnd,HWT_WINF,TRUE);
    }
  else
    CheckButton(hwnd,HWT_WNORM,TRUE);

  if ((pstComDCB->Flags3 & F3_RTO_MASK) == F3_WAIT_NONE) // first mask significant bits
    {
    ControlEnable(hwnd,HWT_RTIMET,FALSE);
    ControlEnable(hwnd,HWT_RTIME,FALSE);
    CheckButton(hwnd,HWT_RNOWAIT,TRUE);
    }
  else
    {
    if ((pstComDCB->Flags3  & F3_RTO_MASK) == F3_WAIT_SOMETHING)
      CheckButton(hwnd,HWT_RWAITSOME,TRUE);
    else
      CheckButton(hwnd,HWT_RNORM,TRUE);
    }
  }
Exemple #3
0
BOOL CChromaDlg::OnInitDialog()
{
	HWND		hDlg = GetSafeHwnd();
   	int i;
   	FRMTYPEINFO TypeInfo;
   	BOOL        EnableFade;

    PreDoModal(NULL);

	bPreview = bProbePending = NO;
   	ImgGetTypeInfo(GetImage(), &TypeInfo);
   	EnableFade = TypeInfo.DataType != FDT_LINEART && TypeInfo.DataType != FDT_PALETTECOLOR;
    CenterPopup(hDlg);
	lpChromaMask = new CChromaMask(this);
    ControlEnable(hDlg, IDC_DELETEMASK, ImgGetMask(GetImage()) != NULL);
   	iCombo[0] = IDC_CHROMA_NORMAL;
	iCombo[1] = IDC_CHROMA_HSL;
	iCombo[2] = IDC_CHROMA_LUMIN;
   	nCombo    = 3;
	TableCheckComboItem(hDlg, IDC_CHROMASELECT, &iCombo[0], nCombo, lpChromaMask->ChromaColorMode, NO);
   	for (i=0; i < NUM_CHROMAMASKS; i++)
	{
    	InitDlgItemSpin(hDlg, IDC_MASKRANGE1+i, 10, NO, 0, 100);
	   	CheckDlgButton(IDC_MASKACTIVE1+i, FALSE);
	   	SetWindowLong(GetDlgItem(IDC_MASKCOLOR1+i)->GetSafeHwnd(),GWL_ACTIVE, 0);
	}
   	InitDlgItemSpin(hDlg, IDC_CHROMA_FADE, 10, NO, 0, 100);
   	CheckRadioButton(IDC_MASKMODE_REVERSE, IDC_MASKMODE_SUBTRACT, IDC_MASKMODE_ADD);
   	lpChromaMask->SetupChroma();
   	ControlEnable(hDlg, IDC_CHROMA, NO);
   	ControlEnable(hDlg, IDC_RESET, NO);
	ControlEnable( hDlg, IDC_CHROMA_FADE,EnableFade);
return(TRUE);
}
Exemple #4
0
LOCAL BOOL ShieldFloat_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
    int i;
    BOOL active;
    long Color;

    RestorePopup( hDlg, "xyShield", RightPopup );
    for (i=0; i<NUM_COLORMASKS; i++)
    {
        InitDlgItemSpin( hDlg, IDC_MASKRANGE1 + i,
                         ColorMask.MaskRange[i], NO, 0, 100 );
        active = ColorMask.Mask & (1 << i);
        CheckDlgButton( hDlg, IDC_MASKACTIVE1 + i, active );
        CopyRGB(&ColorMask.MaskColor[i].rgb, &Color);
        SetWindowLong( GetDlgItem( hDlg, IDC_MASKCOLOR1+i ), GWL_ACTIVE,
                       Color );
    }
    CheckComboItem( hDlg, IDC_SHIELDSELECT, IDC_MASKINCLUDE,IDC_MASKEXCLUDE,
                    ColorMask.Include ? IDC_MASKINCLUDE : IDC_MASKEXCLUDE);
    CheckDlgButton( hDlg, IDC_SHIELD_IFHIDDEN, !ColorMask.IfHidden );
    SetupShield();
    ColorMask.On = YES;
    ControlEnable( hDlg, IDC_PREVIEW, ColorMask.Mask );
    ControlEnable( hDlg, IDC_RESET, NO );
    return(TRUE);
}
Exemple #5
0
LOCAL void Convert_Enable(HWND hDlg)
/************************************************************************/
{
ControlEnable( hDlg, IDC_EXTNAMES, Convert.ConvertType == CT_CUSTOM);
ControlEnable( hDlg, IDC_PALETTECOLORS, Convert.ConvertType != CT_CUSTOM &&
										Convert.MiniType == IDC_MINICUSTOM);
ControlEnable( hDlg, IDC_MINITYPES, Convert.ConvertType != CT_CUSTOM);
}
Exemple #6
0
VOID CSizeImageDlg::DoSizeInits( )
{
    HWND hDlg = GetSafeHwnd();
    LPFRAME lpFrame;
    LPIMAGE lpImage = GetImage();
    FRMDATATYPE Type = FDT_RGBCOLOR;

    ImgGetInfo(lpImage, NULL, NULL, NULL, &Type);

    /* Be careful to set all values before doing a SetDlg... with them */
    /* The Edit structure is a temorary holding area for sizing dialog boxes */
    m_Distortable = NO;
    m_MaintainSize = NO;
    m_ScaleX = m_ScaleY = 100;
    if ( lpImage )
    {
	    lpFrame = ImgGetBaseEditFrame(lpImage);
	    m_Crop.left  = m_Crop.top = 0;
	    m_Crop.right = lpImage->npix - 1;
	    m_Crop.bottom = lpImage->nlin - 1;
	    m_Resolution = m_CropResolution = m_OrigResolution =
  				          FrameResolution(lpFrame);
	    m_Depth = FrameDepth(lpFrame);
    }
    else
    {
	    m_Resolution = m_CropResolution = 75;
	    m_Depth = 1;
    }
    m_Angle = 0;
    m_Width  = FGET( CROPWIDTH(), m_CropResolution );
    m_Height = FGET( CROPHEIGHT(), m_CropResolution );

    CheckDlgButton( IDC_DISTORT, m_Distortable);
    CheckDlgButton( IDC_SMARTSIZE, m_SmartSize );
    CheckDlgButton( IDC_MAINTAINSIZE, m_MaintainSize );
 
    ControlEnable(hDlg, IDC_DISTORT, !m_MaintainSize);
    ControlEnable(hDlg, IDC_MAINTAINSIZE, !m_Distortable );
    ControlEnable( hDlg, IDC_SMARTSIZE, !m_MaintainSize && 
        !m_Distortable && CANDOTRANSPARENCY(Type));

    InitDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES, 0L, FGET(9999,1) );
    InitDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES, 0L, FGET(9999,1) );
    InitDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, YES, 1, 10000 );
    InitDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, YES, 1, 10000 );
    InitDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO, 1, 10000 );

    ImageMemory( hDlg, IDC_MEMORY, m_Width, m_Height, m_Resolution,
	    m_Depth );

    CheckComboItem(hDlg, IDC_PREF_UNITS, IDC_PREF_UNITFIRST,
	                     IDC_PREF_UNITLAST, m_Units);

    SetUnitLabels();
}
Exemple #7
0
LOCAL void TextureFill_HandleEnable(HWND hDlg, int fFlags)
/************************************************************************/
{
FRMDATATYPE Type = FDT_RGBCOLOR;

ImgGetInfo(GetActiveImage(), NULL, NULL, NULL, &Type);

HandleMergeCombo(hDlg, IDC_MERGEMODE, TRUE, Texture.TextureMergeMode, 0L);
// The following code also goes below and into the shape accelerator
ControlEnable( hDlg, IDC_TRANSPARENT_SCROLL, CANDOTRANSPARENCY(Type) );
ControlEnable( hDlg, IDC_TRANSPARENT, CANDOTRANSPARENCY(Type) );
}
Exemple #8
0
LOCAL void Vignette_HandleEnable(HWND hDlg, int fFlags)
/************************************************************************/
{
FRMDATATYPE Type = FDT_RGBCOLOR;

ImgGetInfo(GetActiveImage(), NULL, NULL, NULL, &Type);

HandleMergeCombo(hDlg, IDC_MERGEMODE, TRUE, Vignette.VigMergeMode, 0L);
// The following code also goes below and into the shape accelerator
ControlEnableGroup( hDlg, IDC_FIRST_MODEL, IDC_LAST_MODEL, ISCOLOR(Type));
ControlEnable( hDlg, IDC_COLORMODEL, ISCOLOR(Type));
ControlEnable( hDlg, IDC_TRANSPARENT, CANDOTRANSPARENCY(Type) );
}
VOID FillHdwFilterDlg(HWND hwnd,DCB *pstComDCB)
  {
  char szReplaceChar[5];

  sprintf(szReplaceChar,"%02X",pstComDCB->ErrChar);
  WinSetDlgItemText(hwnd,HWR_ERRCHAR,szReplaceChar);

  sprintf(szReplaceChar,"%02X",pstComDCB->BrkChar);
  WinSetDlgItemText(hwnd,HWR_BRKCHAR,szReplaceChar);

  if (pstComDCB->Flags2 & F2_ENABLE_ERROR_REPL)
    CheckButton(hwnd,HWR_ENABERR,TRUE);
  else
    {
    ControlEnable(hwnd,HWR_ERRTTT,FALSE);
    ControlEnable(hwnd,HWR_ERRTT,FALSE);
    ControlEnable(hwnd,HWR_ERRT,FALSE);
    ControlEnable(hwnd,HWR_ERRCHAR,FALSE);
    }
  if (pstComDCB->Flags2 & F2_ENABLE_NULL_STRIP)
    CheckButton(hwnd,HWR_ENABNUL,TRUE);

  if (pstComDCB->Flags2 & F2_ENABLE_BREAK_REPL)
    CheckButton(hwnd,HWR_ENABBRK,TRUE);
  else
    {
    ControlEnable(hwnd,HWR_BRKTTT,FALSE);
    ControlEnable(hwnd,HWR_BRKTT,FALSE);
    ControlEnable(hwnd,HWR_BRKT,FALSE);
    ControlEnable(hwnd,HWR_BRKCHAR,FALSE);
    }
  }
Exemple #10
0
LOCAL void Flood_HandleEnable(HWND hDlg, int fFlags)
/************************************************************************/
{
FRMDATATYPE Type = FDT_RGBCOLOR;

ImgGetInfo(GetActiveImage(), NULL, NULL, NULL, &Type);

HandleMergeCombo(hDlg, IDC_MERGEMODE, TRUE, Fill.FloodMergeMode, 0L);

ControlEnableGroup( hDlg, IDC_FIRST_MODEL, IDC_LAST_MODEL, ISCOLOR(Type));
ControlEnable( hDlg, IDC_COLORMODEL, ISCOLOR(Type));
ControlEnable( hDlg, IDC_FLOODRANGE, Type != FDT_LINEART);
ControlEnable( hDlg, IDC_TRANSPARENT,  CANDOTRANSPARENCY(Type));
ControlEnable( hDlg, IDC_FLOODFADE, CANDOTRANSPARENCY(Type));
}
Exemple #11
0
BOOL CObjectsPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_OBJECTS:
			Control.MultipleObjects = !Control.MultipleObjects;
			::CheckDlgButton( hDlg, id, Control.MultipleObjects );
//			if (!Control.MultipleObjects)
//				Control.UseMaskAndObjects = FALSE;
//			::CheckDlgButton( hDlg, IDC_PREF_OBJECTMASKS, Control.UseMaskAndObjects );
			ControlEnable(  hDlg, IDC_PREF_OBJECTMASKS, Control.MultipleObjects );
			SetModified(TRUE);
		break;

		case IDC_PREF_OBJECTMASKS:
			if (!Control.MultipleObjects)
				break;
			Control.UseMaskAndObjects = !Control.UseMaskAndObjects;
			::CheckDlgButton( hDlg, id, Control.UseMaskAndObjects );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
Exemple #12
0
void CChromaDlg::ShowChromaPreview()
{
    HWND hDlg 		= GetSafeHwnd();
	RECT rMask;
	HWND hActiveWnd;
	LPIMAGE lpImage = GetImage();


   	hActiveWnd = m_pView->GetSafeHwnd();
	if (!hActiveWnd)
		return;

	lpChromaMask->iMode = ImgGetViewMode(lpImage);
   	ImgSetViewMode(lpImage, VM_SLIME);
	if (ImgGetMask(lpImage))
		ImgGetMaskRect(lpImage, &rMask);
	else
		ImgGetSelObjectRect(lpImage, &rMask, NO);

	File2DispRect(hActiveWnd, &rMask, &rMask);

	if (Tool.id == IDC_CHROMA)
		AstralUnionRect(&rMask, &rMask, &rPreview);

	ImgGetMaskRect(lpImage, &rPreview);
	File2DispRect(hActiveWnd, &rPreview, &rPreview);
	SetMaskHook(hActiveWnd, (LPMASKHOOK)lpChromaMask);
	AstralCursor( IDC_WAIT );
	::InvalidateRect(hActiveWnd, &rMask, FALSE);
	AstralUpdateWindow(hActiveWnd);
	ControlEnable(hDlg, IDC_RESET, YES );
	AstralCursor(NULL);
}
Exemple #13
0
VOID FillHdwProtocolDlg(HWND hwnd,LINECHAR *pstLineChar)
  {
  WORD idDisableField;
  WORD idEntryField;

  idDisableField = HWP_15BITS;
  switch (pstLineChar->DataBits)
    {
    case 8:
      idEntryField = HWP_8BITS;
      break;
    case 7:
      idEntryField = HWP_7BITS;
      break;
    case 6:
      idEntryField = HWP_6BITS;
      break;
    case 5:
      idEntryField = HWP_5BITS;
      idDisableField = HWP_2BITS;
      break;
    }
  CheckButton(hwnd,idEntryField,TRUE);
  ControlEnable(hwnd,idDisableField,FALSE);
  switch (pstLineChar->StopBits)
    {
    case 0:
      idEntryField = HWP_1BIT;
      break;
    case 1:
      idEntryField = HWP_15BITS;
      break;
    case 2:
      idEntryField = HWP_2BITS;
      break;
    }
  CheckButton(hwnd,idEntryField,TRUE);
  switch (pstLineChar->Parity)
    {
    case 0:
      idEntryField = HWP_NONE;
      break;
    case 1:
      idEntryField = HWP_ODD;
      break;
    case 2:
      idEntryField = HWP_EVEN;
      break;
    case 3:
      idEntryField = HWP_ZERO;
      break;
    case 4:
      idEntryField = HWP_ONE;
      break;
    }
  CheckButton(hwnd,idEntryField,TRUE);
  }
Exemple #14
0
void CToneBalanceDlg::OnMapOptions()
{
	HWND hDlg = GetSafeHwnd();
	CToneBalanceOptionsDlg dlg(this);
	dlg.DoModal();				

	ControlEnable(hDlg, IDC_PREVIEW, !m_bAutoPreview);
	SetAllDlgItemsText(hDlg, IDC_PERCENT, m_bPercentages ? (LPSTR)"%":(LPSTR)"");
	set_quarter_channel(m_lpData->wChannel);
	AutoPreview(m_lpData->lpMap, m_bAutoPreview, YES);
}
void CTabUartToUdp::OnBnClickedButtonSerialportClose()
{
	// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë
	m_ctrlMSComm1.put_PortOpen(FALSE);
	m_socketUartToUdp.Close();
	ControlEnable();
	if (!m_ctrlMSComm1.get_PortOpen())
	{
		AfxMessageBox(_T("Close Serial Port Successful!"));
	}
}
Exemple #16
0
BOOL CObjectsPrefPage::OnInitDialog() 
{
	HWND	hDlg = GetSafeHwnd();

 	CPPPropertyPage::OnInitDialog();
	::CheckDlgButton( hDlg, IDC_PREF_OBJECTS, Control.MultipleObjects );
	//	if (!Control.MultipleObjects)
	//		Control.UseMaskAndObjects = FALSE;
	::CheckDlgButton( hDlg, IDC_PREF_OBJECTMASKS, Control.UseMaskAndObjects );
	ControlEnable(  hDlg, IDC_PREF_OBJECTMASKS, Control.MultipleObjects );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #17
0
BOOL CUndoPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_UNDOTYPE:
//		case IDC_PREF_NOUNDO:
//		case IDC_PREF_MANUALAPPLY:
//		case IDC_PREF_AUTOAPPLY:
			if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
				break;
			Control.NoUndo = (id == IDC_PREF_NOUNDO);
			Control.UseApply = (id == IDC_PREF_MANUALAPPLY);
			ControlEnable( hDlg, IDC_PREF_MASKUNDO, !Control.NoUndo );
			SetModified(TRUE);
		break;

		case IDC_PREF_UNDOMODE:
//		case IDC_PREF_IMAGEUNDO:
//		case IDC_PREF_OBJECTUNDO:
			if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
				break;
			Control.UndoObjects = (id == IDC_PREF_OBJECTUNDO);
			SetModified(TRUE);
		break;

		case IDC_PREF_MASKUNDO:
			Control.UndoMasks = !Control.UndoMasks;
			::CheckDlgButton( hDlg, id, !Control.UndoMasks );
			SetModified(TRUE);
		break;

		case IDC_PREF_DISABLECMDLIST:
    		Control.DoCommandList = !Control.DoCommandList;
	    	::CheckDlgButton( hDlg, id, !Control.DoCommandList );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
void CTabUartToUdp::OnBnClickedButtonSerialportClose()
{
	// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë
	OnCloseCom();
	OnCloseUDP();
	ControlEnable();
	// @@@@@@@@ cxm 2011.11.25 提供给用户暂不提供mscomm控件的串口功能
// 	if (!m_ctrlMSComm1.get_PortOpen())
// 	{
// 		CString str = _T("");
// 		str = _T("成功关闭串口!");
// 		AfxMessageBox(str);
// 		m_pLogFile->OnWriteLogFile(_T("CTabUartToUdp::OnBnClickedButtonSerialportClose"), str, SuccessStatus);
// 	}
	GetDlgItem(IDC_BUTTON_SERIALPORT_OPEN)->EnableWindow(TRUE);
	GetDlgItem(IDC_BUTTON_SERIALPORT_CLOSE)->EnableWindow(FALSE);
}
Exemple #19
0
CToneBalanceDlg::OnInitDialog()
{
	HWND hControl;
	FRMDATATYPE type;
	LPIMAGE lpImage = NULL;
	int i;
	LONG style;
	HWND hDlg = GetSafeHwnd();
	PreDoModal();	
	m_lpData = (LPQUARTERSTRUCT)Alloc(sizeof(QUARTERSTRUCT));
	if (!m_lpData)
		return(FALSE);
	for (i=0;i<3;i++) 	// setup tag sliders
	{
		if (hControl = ::GetDlgItem(hDlg, i+IDC_QUART1))
		{
			style = GetWindowLong(hControl, GWL_EXSTYLE);
			style |= WS_EX_TRANSPARENT;
			SetWindowLong(hControl, GWL_EXSTYLE, style);
		}
	}

	lpImage = GetImage();
	RightPopup( hDlg );
	
	// set channels combo
	type = FrameType(ImgGetBaseEditFrame(lpImage));
	m_lpData->wChannel = IDC_DO_ALL;
	m_MapValues.wChannel = m_lpData->wChannel; //this is not a very good	solution
	ChannelsCombo_Setup(IDC_CHANNELS, type);

	ControlEnable(hDlg, IDC_PREVIEW, !m_bAutoPreview);

	// remove or add percents
	SetAllDlgItemsText(hDlg, IDC_PERCENT, m_bPercentages ? (LPSTR)"%":(LPSTR)"");
	
	m_lpData->lpHistos[0] = NULL;
	ResetAllMaps();
	
	// setup each channel with defaults
	for (i=IDC_DO_ALL; i<=IDC_DO_BLACK;i++)
		reset_channel(i);
	// setup the actual histogram and controls 
	set_quarter_channel(m_lpData->wChannel);
	return CPPMapDlg::OnInitDialog();
}
Exemple #20
0
void CChromaDlg::ShowChromaReset()
	{
    HWND hDlg 		= GetSafeHwnd();
	HWND hActiveWnd;
	LPIMAGE lpImage = GetImage();


   	hActiveWnd = m_pView->GetSafeHwnd();
	if (!hActiveWnd)
		return;

   	ImgSetViewMode(lpImage, lpChromaMask->iMode);
	SetMaskHook(hActiveWnd, NULL);
	AstralCursor( IDC_WAIT);
	::InvalidateRect(hActiveWnd, &rPreview, FALSE);
	AstralUpdateWindow(hActiveWnd);
	AstralCursor( NULL );
	ControlEnable(hDlg, IDC_RESET, NO);
   }
void CTabUartToUdp::OnBnClickedButtonSerialportClose()
{
	// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë

// 	OnCloseCom();
// //	m_bUartThreadclose = TRUE;
// 	m_socketUartToUdp.Close();
// 	ControlEnable();
// 	AfxMessageBox(_T("Close Serial Port Successful!"));
	m_ctrlMSComm1.put_PortOpen(FALSE);
	m_socketUartToUdp.Close();
	ControlEnable();
	if (!m_ctrlMSComm1.get_PortOpen())
	{
		AfxMessageBox(_T("Close Serial Port Successful!"));
	}
	GetDlgItem(IDC_BUTTON_SERIALPORT_OPEN)->EnableWindow(TRUE);
	GetDlgItem(IDC_BUTTON_SERIALPORT_CLOSE)->EnableWindow(FALSE);
}
Exemple #22
0
LOCAL BOOL Vignette_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
CheckComboItem( hDlg, IDC_VIGNETTETYPE, IDC_VIGLINEAR, IDC_VIGRECTANGLE,
	Vignette.Gradient );
CheckComboItem( hDlg, IDC_COLORMODEL, IDC_FIRST_MODEL, IDC_LAST_MODEL,
	Vignette.VigColorModel+IDC_FIRST_MODEL );
InitDlgItemSpin( hDlg, IDC_VIGREPEAT, Vignette.RepeatCount, NO,
	1, 99 );
CheckComboItem( hDlg, IDC_VIGTRANSITION,
	IDC_VIGHARDTRANSITION, IDC_VIGSOFTTRANSITION,
	IDC_VIGHARDTRANSITION + Vignette.SoftTransition );
InitDlgItemSpin( hDlg, IDC_TRANSPARENT, TOPERCENT(255-Vignette.VigOpacity),
	NO, 0, 99 );
InitDlgItemSpin( hDlg, IDC_MIDPOINT, TOPERCENT(Vignette.Midpoint),
	NO, 0, 99 );
ControlEnable( hDlg, IDC_VIGTRANSITION, Vignette.RepeatCount > 1 );
Vignette_HandleEnable(hDlg, 0);
return(FALSE);
}
Exemple #23
0
VOID CExpandImageDlg::DoExpandInits(  )
/***********************************************************************/
{
long Color;
HWND hWnd = GetSafeHwnd();


InitDlgItemSpinFixed(hWnd, IDC_HEIGHT, m_Height, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_WIDTH, m_Width, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDLEFT, m_Left, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDRIGHT,m_Width-m_OrigWidth-m_Left, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDTOP, m_Top, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDBOTTOM,m_Height-m_OrigHeight-m_Top, YES, 0L, FGET(9999,1) );
ImageMemory( hWnd, IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
CheckComboItem(hWnd,IDC_PREF_UNITS, IDC_PREF_UNITFIRST,IDC_PREF_UNITLAST, m_Units);
ControlEnable(hWnd, IDOK, FALSE);
SetUnitLabels(hWnd);
SetColorInfo(&m_FillColor, &m_FillColor, CS_GRAY);
CopyRGB( &m_FillColor.rgb, &Color );
SetWindowLong( ::GetDlgItem(hWnd,IDC_FILLINCOLOR), GWL_ACTIVE, Color );
}
Exemple #24
0
void CChromaMask::SetupChroma()
   {
   int   i;

   InitMaskValue(HMask);
   InitMaskValue(LMask);
   InitMaskValue(SMask);
   InitMaskValue(RMask);
   InitMaskValue(GMask);
   InitMaskValue(BMask);
   InitMaskValue(CMask);
   InitMaskValue(YMask);
   InitMaskValue(MMask);
   InitMaskValue(KMask);

 	for (i = 0; i < NUM_CHROMAMASKS; ++i)
      SetupChromaRange(i);

	if (m_pDlg)
		ControlEnable(m_pDlg->GetSafeHwnd(), IDC_CHROMA, Mask);
   }
Exemple #25
0
BOOL CUndoPrefPage::OnInitDialog() 
{
	ITEMID id;
 	HWND	hDlg = GetSafeHwnd();

 	CPPPropertyPage::OnInitDialog();
	if ( Control.NoUndo )
			id = IDC_PREF_NOUNDO;
	else	id = (Control.UseApply + IDC_PREF_AUTOAPPLY);
	CheckComboItem(  hDlg, IDC_PREF_UNDOTYPE, IDC_PREF_NOUNDO, IDC_PREF_MANUALAPPLY, id );

	if (::GetDlgItem(hDlg, IDC_PREF_UNDOMODE))
		CheckComboItem(  hDlg, IDC_PREF_UNDOMODE,
						IDC_PREF_IMAGEUNDO, IDC_PREF_OBJECTUNDO,
						Control.UndoObjects + IDC_PREF_IMAGEUNDO );
	::CheckDlgButton( hDlg, IDC_PREF_MASKUNDO, !Control.UndoMasks );
	::CheckDlgButton( hDlg, IDC_PREF_DISABLECMDLIST, !Control.DoCommandList );
	ControlEnable( hDlg, IDC_PREF_MASKUNDO, !Control.NoUndo );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #26
0
BOOL CUnitsPrefPage::OnInitDialog() 
{
	LPSTR lpUnit;
	HWND	hDlg = GetSafeHwnd();

 	CPPPropertyPage::OnInitDialog();

	CheckComboItem( hDlg, IDC_PREF_UNITS, IDC_PREF_UNITINCHES, IDC_PREF_UNITPIXELS, Control.Units );
	ControlEnable(  hDlg, IDC_PREF_SCREENWIDTH, Control.Units != IDC_PREF_UNITPIXELS );
	::CheckDlgButton( hDlg, IDC_PREF_USERULERS, View.UseRulers );
	::CheckDlgButton( hDlg, IDC_PREF_DISPLAYPIXELS,
		 		!Control.DisplayPixelValue );
	if ( Control.Units != IDC_PREF_UNITPIXELS )
		AstralSetDlgItemFixed( hDlg, IDC_PREF_SCREENWIDTH,
			Control.ScreenWidth, NO );
	else
		::SetDlgItemInt( hDlg, IDC_PREF_SCREENWIDTH,
			GetSystemMetrics( SM_CXSCREEN ), NO );
	if ( AstralStr( Control.Units-IDC_PREF_UNITINCHES+IDS_INCHES, &lpUnit ))
		::SetDlgItemText( hDlg, IDC_WIDTHLABEL, lpUnit );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
// -----------------------------------------------------------------------
// Select a font
void PropSelectFont(void)
{
    CStr FName;
    CStr BufString;
    long FSize = 0;
    HDC NextDC = 0;
    int i = 0;

    // Note: Font name must always be followed by font size
    if(strlen((char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE)) != 0)
    {
        FSize = atol((char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE));
    }
    ControlEnable(FRMDiagToolhwnd, 0);
    ControlEnable(FRMDiagTBhwnd, 0);
    ControlEnable(FRMDiagPropshwnd, 0);
    if(ComDlgChooseFont(FRMDiaghwnd, (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE), FSize, 0) != 0)
    {
        for(i = 0; i <= LF_FACESIZE - 1; i++)
        {
            if(MyLogFont.lfFaceName[i] == 0) break;
            FName = FName + FName.Chr(MyLogFont.lfFaceName[i]);
        }
        if(FName.Len() != 0)
        {
            BufString = MyFont.iPointSize / 10;
            SetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE, (long) BufString.Get_String());
            SetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE, (long) FName.Get_String());
            ControlSetText(CurrentEditControlSubEdit, FName);
            // Set size
            NextDC = GetDC(hPropListbox);
            GDIWriteClippedText(NextDC, PropCurrentLeft + 1, PropCurrentTop + 1, PropCurrentWidth - 1, PropCurrentHeight, (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE), GetSysColor(COLOR_WINDOWTEXT), WASerifFont, 0, GetSysColor(COLOR_WINDOW));
            ReleaseDC(hPropListbox, NextDC);
            if(GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE) != 0) JumpToAddr((FARPROC) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE));
        }
    }
    ControlEnable(FRMDiagToolhwnd, 1);
    ControlEnable(FRMDiagTBhwnd, 1);
    ControlEnable(FRMDiagPropshwnd, 1);
}
Exemple #28
0
VOID CExpandImageDlg::DoExpandControls(ITEMID id, UINT codeNotify )
/***********************************************************************/
{
BOOL Bool;
WORD idUnits;
LFIXED Right, Bottom;

switch( id )
    {
	case IDC_PREF_UNITS:
	if ( !(idUnits = HandleCombo( GetSafeHwnd(), id, codeNotify )) )
		break;
	Control.Units = idUnits;
	SetUnitInfo((UNIT_TYPE)(Control.Units-IDC_PREF_UNITINCHES), Control.UnitRes, Control.Points);
	CheckComboItem(GetSafeHwnd(), IDC_PREF_UNITS, IDC_PREF_UNITFIRST,
		IDC_PREF_UNITLAST, Control.Units);
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDLEFT, m_Left, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDRIGHT, m_Width-m_OrigWidth-m_Left, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDTOP, m_Top, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDBOTTOM, m_Height-m_OrigHeight-m_Top, YES );
	SetUnitLabels(GetSafeHwnd());
	break;

   case IDC_HEIGHT:
	if (codeNotify == EN_KILLFOCUS)
		{
		if (m_Height < m_OrigHeight)
			{
			m_Height = m_OrigHeight;
			m_Top = 0;
			MessageBeep(0);
			SetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
			ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||
								(m_OrigHeight > m_OrigWidth));
			}
		else
			break;
		}
	else
		{
		if ( ::GetFocus() != ::GetDlgItem( GetSafeHwnd(), id ) )
			break;
		if ( codeNotify != EN_CHANGE )
			break;
		m_Height = GetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, &Bool, YES);
		if (m_Height < m_OrigHeight)
			{
			ControlEnable(GetSafeHwnd(), IDOK, FALSE);
			::SetFocus(::GetDlgItem( GetSafeHwnd(),id));
			break;
			}
		}
	if ((m_OrigHeight + m_Top) > m_Height)
		m_Top = m_Height - m_OrigHeight;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDTOP, m_Top, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDBOTTOM,m_Height - m_OrigHeight- m_Top,YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,
				 m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) || (m_Width > m_OrigWidth));
	break;

    case IDC_WIDTH:
	if (codeNotify == EN_KILLFOCUS)
		{
		if (m_Width < m_OrigWidth)
			{
			m_Width = m_OrigWidth;
			m_Left = 0;
			MessageBeep(0);
			SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
			ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight)
																 ||(m_Width > m_OrigWidth));
			}
		else
			break;
		}
	else
		{
		if ( ::GetFocus() != ::GetDlgItem( GetSafeHwnd(), id ) )
			break;
		if ( codeNotify != EN_CHANGE )
			break;
		m_Width = GetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, &Bool, YES );
		if (m_Width < m_OrigWidth)
			{
			ControlEnable(GetSafeHwnd(), IDOK, FALSE);
			::SetFocus(::GetDlgItem(GetSafeHwnd(),id));
			break;
			}
		}
	if (m_OrigWidth + m_Left > m_Width)
		m_Left = m_Width - m_OrigWidth;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDLEFT, m_Left, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDRIGHT, m_Width - m_OrigWidth - m_Left, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution, m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDLEFT:
	if ( GetFocus() != GetDlgItem(id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Right = m_Width - m_OrigWidth - m_Left;
	m_Left = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Width = (m_OrigWidth + m_Left + Right);
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, (m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDRIGHT:
	if ( GetFocus() != GetDlgItem( id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Right = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Width = m_OrigWidth + m_Left+ Right;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDTOP:
	if ( GetFocus() != GetDlgItem( id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Bottom = m_Height- m_OrigHeight - m_Top;
	m_Top = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Height = m_OrigHeight + m_Top + Bottom;
	SetDlgItemSpinFixed(GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDBOTTOM:
	if ( GetFocus() != GetDlgItem(id) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Bottom = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Height = m_OrigHeight + m_Top + Bottom;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

    default:
	break;
    }
}
Exemple #29
0
BOOL CSizeImageDlg::DoSizeControls( ITEMID id, UINT codeNotify, BOOL bResAdjust )
{
    BOOL bResult = TRUE;
    HWND hDlg = GetSafeHwnd();
    BOOL Bool;
    long x, y;
    int npix, nlin;
    HWND hWnd, hControl;
    RECT rArea;
    LFIXED scale;
    LPIMAGE lpImage;
    FRMDATATYPE Type;

    lpImage = GetImage();
    ImgGetInfo(lpImage, NULL, NULL, NULL, &Type);
    npix = CROPWIDTH();
    nlin = CROPHEIGHT();

    switch( id )
    {
	    case IDC_SMARTSIZE:
	        m_SmartSize = !m_SmartSize;
	        CheckDlgButton( IDC_SMARTSIZE, m_SmartSize );
            break;

	    case IDC_MAINTAINSIZE:
	        m_MaintainSize = !m_MaintainSize;
	        if (m_MaintainSize)
		        m_Distortable = NO;

	        ControlEnable(hDlg, IDC_DISTORT, !m_MaintainSize);
	        ControlEnable(hDlg, IDC_SMARTSIZE, !m_MaintainSize);
	        Bool = !m_MaintainSize || m_Units != IDC_PREF_UNITPIXELS;
	        ControlEnable(hDlg, IDC_WIDTH, Bool);
	        ControlEnable(hDlg, IDC_HEIGHT, Bool);
	        ControlEnable(hDlg, IDC_SCALEX, Bool);
	        ControlEnable(hDlg, IDC_SCALEY, Bool);

	        if (m_MaintainSize)
	        {
		        m_Resolution = m_CropResolution = m_OrigResolution;
		        m_Width  = FGET( npix, m_CropResolution );
		        m_Height = FGET( nlin, m_CropResolution );
		        SetUnitResolution( m_CropResolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
		        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
	        }
	        CheckDlgButton( IDC_MAINTAINSIZE, m_MaintainSize );
	        CheckDlgButton( IDC_SMARTSIZE, !m_MaintainSize && m_SmartSize );
	        break;

	    case IDC_PREF_UNITS:
			{
			WORD wUnits;				
	        if ( !(wUnits = HandleCombo( hDlg, id, codeNotify )) )
		        break;
	        
			m_Units = wUnits;
	        SetUnitInfo((UNIT_TYPE)(m_Units-IDC_PREF_UNITINCHES), m_UnitRes, 
                m_Points);
	        CheckComboItem(hDlg, IDC_PREF_UNITS, IDC_PREF_UNITFIRST,
		        IDC_PREF_UNITLAST, m_Units);

	        Bool = !m_MaintainSize || m_Units != IDC_PREF_UNITPIXELS;
	        ControlEnable(hDlg, IDC_WIDTH, Bool);
	        ControlEnable(hDlg, IDC_HEIGHT, Bool);
	        ControlEnable(hDlg, IDC_SCALEX, Bool);
	        ControlEnable(hDlg, IDC_SCALEY, Bool);

	        if (m_MaintainSize && m_Units == IDC_PREF_UNITPIXELS)
	        {
		        m_CropResolution = m_Resolution;
		        SetUnitResolution( m_CropResolution );
		        m_Width  = FGET( npix, m_CropResolution );
		        m_Height = FGET( nlin, m_CropResolution );
		        y = FMUL( m_CropResolution, m_Height );
		        m_ScaleY = ((y*100L) + nlin/2) / nlin;
		        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
		        x = FMUL( m_CropResolution, m_Width );
		        m_ScaleX = ((x*100L) + npix/2) / npix;
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	       	SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
	       	SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
	        SetUnitLabels();
			}
	        break;

        case IDC_DISTORT:
	        m_Distortable = !m_Distortable;
	        CheckDlgButton( IDC_DISTORT, m_Distortable );
	        if (m_Distortable)
		        m_MaintainSize = NO;
	        ControlEnable(hDlg, IDC_MAINTAINSIZE, !m_MaintainSize);
	        if ( m_ScaleX != m_ScaleY )
	        {
		        m_ScaleX = m_ScaleY;
		        x = (((long)npix * m_ScaleX)+50L)/100L;
		        m_Width  = FGET( x, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	        CheckDlgButton( IDC_SMARTSIZE,m_SmartSize && !m_Distortable);
	        ControlEnable( hDlg, IDC_SMARTSIZE, !m_Distortable && CANDOTRANSPARENCY(Type));
	        ControlEnable(hDlg, IDC_MAINTAINSIZE, !m_Distortable && lpImage);
	        if ( Page.PrintNumeric )
		        break;
	        if ( !(hWnd = ::GetDlgItem( hDlg,IDC_PRINTVIEWPAGE)) )
		        break;
	        if ( !(hControl = ::GetDlgItem( hDlg,IDC_PRINTVIEWIMAGE)) )
		        break;
	        SetLongBit(hControl, GWL_STYLE, IS_RATIO_CONSTRAIN,
		        !m_Distortable );
	        if (!m_Distortable)
	        {
		        ::GetWindowRect(hControl, &rArea);
		        ::ScreenToClient(hWnd, (LPPOINT)&rArea.left);
		        ::ScreenToClient(hWnd, (LPPOINT)&rArea.right);
		        ::MoveWindow(hControl, rArea.left, rArea.top,
			        RectWidth(&rArea)-1, RectHeight(&rArea)-1, TRUE);
	        }
	        break;

        case IDC_HEIGHT:
	        if ( ::GetFocus() != ::GetDlgItem( hDlg,id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_Height = GetDlgItemSpinFixed( hDlg, IDC_HEIGHT, &Bool, YES);
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Height);
		        m_Resolution = FMUL(nlin, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        // y = number of new pixels x 100
	        y = FMUL( m_CropResolution, m_Height );
	        // calculate scale factor = (new pixels * 100) / old pixels
	        m_ScaleY = ((y * 100L) + nlin/2) / nlin;
	        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
	        if ( !m_Distortable )
	        {
		        m_ScaleX = m_ScaleY;
				x = (((long)npix * (long)y) + (nlin/2))/ (long)nlin;
		        m_Width  = FGET( x, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_WIDTH:
	        if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_Width = GetDlgItemSpinFixed( hDlg, IDC_WIDTH, &Bool, YES );
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Width);
		        m_Resolution = FMUL(npix, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        x = FMUL( m_CropResolution, m_Width );
	        m_ScaleX = ((x * 100L) + npix/2L) / (long)npix;
	        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        if ( !m_Distortable )
	        {
				m_ScaleY = m_ScaleX;
				y = (((long)nlin * (long)x) + (npix/2))/ (long)npix;
		        m_Height  = FGET( y, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_RES:
	        if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_Resolution = GetDlgItemSpin( hDlg, IDC_RES, &Bool, NO );
	        if ( m_Resolution <= 0 )
		        m_Resolution = 2;
	        if (m_MaintainSize)
	        {
		        m_Width = FGET(npix, m_Resolution);
		        m_Height = FGET(nlin, m_Resolution);
		        SetUnitResolution( m_Resolution );
		        if (m_Units != IDC_PREF_UNITPIXELS)
		        {
			        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
			        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
			        y = FMUL( m_CropResolution, m_Height );
			        m_ScaleY = ((y*100L) + nlin/2) / nlin;
			        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
			        x = FMUL( m_CropResolution, m_Width );
			        m_ScaleX = ((x*100L) + npix/2) / npix;
			        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
		        }
	        }
	
	        if ( m_Units == IDC_PREF_UNITPIXELS )
            {
	            if ( bResAdjust )
                { // Extract the values again (inch values changed)
			        m_CropResolution = m_Resolution;
			        SetUnitResolution( m_Resolution );
			        ::SetFocus( hWnd = ::GetDlgItem( hDlg,IDC_HEIGHT ) );
					FORWARD_WM_COMMAND(hDlg, IDC_HEIGHT, hWnd, EN_CHANGE,
									   ::SendMessage);
			        ::SetFocus( hWnd = ::GetDlgItem( hDlg,IDC_WIDTH ) );
					FORWARD_WM_COMMAND(hDlg, IDC_WIDTH, hWnd, EN_CHANGE,
									   ::SendMessage);
			        ::SetFocus( ::GetDlgItem( hDlg,id ) );
		        }
	            else
		        { // Change the edit box
			        SetUnitResolution( m_Resolution );
			        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES);
			        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
		        }
            }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_SCALEX:
	        if ( GetFocus() != GetDlgItem( id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_ScaleX = GetDlgItemSpin( hDlg, IDC_SCALEX, &Bool, NO );
	        x = (((long)npix * m_ScaleX)+50L)/100L;
	        m_Width  = FGET( x, m_CropResolution );
	        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Width);
		        m_Resolution = FMUL(npix, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        if ( !m_Distortable )
	        {
		        m_ScaleY = m_ScaleX;
		        y = (((long)nlin * m_ScaleY)+50)/100L;
		        m_Height  = FGET( y, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_SCALEY:
	        if ( GetFocus() != GetDlgItem( id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_ScaleY = GetDlgItemSpin( hDlg, IDC_SCALEY, &Bool, NO );
	        y = (((long)nlin * m_ScaleY)+50)/100L;
	        m_Height = FGET( y, m_CropResolution );
	        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Height);
		        m_Resolution = FMUL(nlin, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        if ( !m_Distortable )
	        {
		        m_ScaleX = m_ScaleY;
		        x = (((long)npix * m_ScaleX)+50L)/100L;
		        m_Width  = FGET( x, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES);
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_MEMORY:
        default:
            bResult = FALSE;
    	    break;
    }
    return bResult;        
}
Exemple #30
0
BOOL TCHandshakeDlg(HWND hwnd,USHORT idButton,DCB *pstComDCB,FIFOINF *pstFIFOinfo)
  {
  switch(idButton)
    {
#ifdef allow_16650_HDW_Xon_HS
    case HWF_HDW_RX_XON_HS:
      if (Checked(hwnd,HWF_HDW_RX_XON_HS))
        {
//        CheckButton(hwnd,HWF_HDW_RX_XON_HS,TRUE);
        ControlEnable(hwnd,HS_FULLDUP,FALSE);
        }
      else
        {
//        CheckButton(hwnd,HWF_HDW_RX_XON_HS,FALSE);
        if (Checked(hwnd,HS_RXFLOW))
          ControlEnable(hwnd,HS_FULLDUP,TRUE);
        }
      break;
#endif
      case HS_CTSOUT:
        if (!Checked(hwnd,HS_CTSOUT))
          {
          CheckButton(hwnd,HS_CTSOUT,TRUE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            if (Checked(hwnd,HWF_HDW_CTS_HS))
              {
              ControlEnable(hwnd,HS_RTSENAB,FALSE);
              ControlEnable(hwnd,HS_RTSTOG,FALSE);
              if (Checked(hwnd,HS_RTSENAB))
                CheckButton(hwnd,HS_RTSINHS,TRUE);
              else
                if (Checked(hwnd,HS_RTSTOG))
                  CheckButton(hwnd,HS_RTSDISAB,TRUE);
              }
          }
        else
          {
          CheckButton(hwnd,HS_CTSOUT,FALSE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            {
            ControlEnable(hwnd,HS_RTSENAB,TRUE);
            ControlEnable(hwnd,HS_RTSTOG,TRUE);
            }
          }
       break;
      case HWF_HDW_CTS_HS:
        if (!Checked(hwnd,HWF_HDW_CTS_HS))
          {
          CheckButton(hwnd,HWF_HDW_CTS_HS,TRUE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            if (Checked(hwnd,HS_CTSOUT))
              {
              ControlEnable(hwnd,HS_RTSENAB,FALSE);
              ControlEnable(hwnd,HS_RTSTOG,FALSE);
              if (Checked(hwnd,HS_RTSENAB))
                CheckButton(hwnd,HS_RTSINHS,TRUE);
              else
                if (Checked(hwnd,HS_RTSTOG))
                  CheckButton(hwnd,HS_RTSDISAB,TRUE);
              }
          }
        else
          {
          CheckButton(hwnd,HWF_HDW_CTS_HS,FALSE);
          if (pstFIFOinfo->wFIFOflags & (FIFO_FLG_TYPE_16750 | FIFO_FLG_TYPE_TI16550C))
            {
            ControlEnable(hwnd,HS_RTSENAB,TRUE);
            ControlEnable(hwnd,HS_RTSTOG,TRUE);
            }
          }
       break;
    case HS_RXFLOW:
    case HS_TXFLOW:
      if (Checked(hwnd,HS_RXFLOW) ||
          Checked(hwnd,HS_TXFLOW))
        {
        ControlEnable(hwnd,HS_XOFFCHART,TRUE);
        ControlEnable(hwnd,HS_XONCHART,TRUE);
        ControlEnable(hwnd,HS_XOFFCHAR,TRUE);
        ControlEnable(hwnd,HS_XONCHAR,TRUE);
        ControlEnable(hwnd,HS_XONCHARTT,TRUE);
        ControlEnable(hwnd,HS_XONCHARTTT,TRUE);
        ControlEnable(hwnd,HS_XOFFCHARTT,TRUE);
        ControlEnable(hwnd,HS_XOFFCHARTTT,TRUE);
        }
      else
        {
        ControlEnable(hwnd,HS_XOFFCHART,FALSE);
        ControlEnable(hwnd,HS_XONCHART,FALSE);
        ControlEnable(hwnd,HS_XOFFCHAR,FALSE);
        ControlEnable(hwnd,HS_XONCHAR,FALSE);
        ControlEnable(hwnd,HS_XONCHARTT,FALSE);
        ControlEnable(hwnd,HS_XONCHARTTT,FALSE);
        ControlEnable(hwnd,HS_XOFFCHARTT,FALSE);
        ControlEnable(hwnd,HS_XOFFCHARTTT,FALSE);
        }
      if (!Checked(hwnd,HS_RXFLOW))
        ControlEnable(hwnd,HS_FULLDUP,FALSE);
      else
        {
#ifdef allow_16650_HDW_Xon_HS
        if (!Checked(hwnd,HWF_HDW_RX_XON_HS))
#endif
          ControlEnable(hwnd,HS_FULLDUP,TRUE);
        }
      break;
    default:
      return(FALSE);
    }
  return(TRUE);
  }