//*****************************************************************************
CSpinButtonCtrl* CCxNDArrayDimItem::CreateSpinControl (CRect rectSpin)
{
	ASSERT_VALID (this);
	ASSERT_VALID (m_pGridRow);

	CCxNDArrayDimGrid* pWndList = (CCxNDArrayDimGrid*)((CCxNDArrayDimRow*)m_pGridRow)->m_pWndList;
	ASSERT_VALID (pWndList);

	CSpinButtonCtrl* pWndSpin = new CCxBCGPSpinButtonCtrl;

	if (!pWndSpin->Create (
		WS_CHILD | WS_VISIBLE | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_NOTHOUSANDS,
		rectSpin, pWndList, BCGPGRIDCTRL_ID_INPLACE))
	{
		return NULL;
	}

	pWndSpin->SetBuddy (m_pWndInPlace);

	//if (m_nMinValue != 0 || m_nMaxValue != 0)
	{
		pWndSpin->SetRange32 (m_nMinValue, m_nMaxValue);
	}

	return pWndSpin;
}
Exemplo n.º 2
0
BOOL COptionsMisc::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  for (int i = 0; i < 2; i++) {
    m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_chkbox[i].ResetBkgColour();//Use current window's background
  }

  OnUseDefUser();

  // For some reason, MFC calls us twice when initializing.
  // Populate the combo box only once.
  if (m_dblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_dblclk_cbox);
  }

  if (m_shiftdblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_shiftdblclk_cbox);
  }

  m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]);
  m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]);

  GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation);
  GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation);

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY));
  pspin->SetRange32(1, 60000);
  pspin->SetBase(10);
  pspin->SetPos(m_AutotypeDelay);

  InitToolTip();
  // Note naming convention: string IDS_xxx corresponds to control IDC_xxx
  AddTool(IDC_MAINTAINDATETIMESTAMPS, IDS_MAINTAINDATETIMESTAMPS);
  AddTool(IDC_OTHERBROWSERLOCATION,   IDS_OTHERBROWSERLOCATION);
  AddTool(IDC_OTHEREDITORLOCATION,    IDS_OTHEREDITORLOCATION);
  ActivateToolTip();

  return TRUE;
}
Exemplo n.º 3
0
BOOL COpPropertyDlg::Create (COperatorWin *opWindow, const NLTEXGEN::ITexGenOperator *op)
{
	// Save operator parameters
	_OpWindow = opWindow;
	_Op = op;

	// Create the dialog
	if (CDialog::Create (IDD_OP_PROPERTY, theApp.m_pMainWnd))
	{
		// The client RECT
		RECT client;
		GetClientRect (&client);
		client.top = DIALOG_MARGIN;
		client.left = DIALOG_MARGIN;

		// Create each widget
		uint i;
		std::string currentCategory;
		for (i=0; i<_Op->getNumParameter(); i++)
		{
			// The parameter
			const CParameter &param = _Op->getParameter(i);

			// New category ?
			if ((i == 0) || (currentCategory != param.Category))
			{
				if (i != 0)
					endCategory (client, currentCategory.c_str ());
				currentCategory = param.Category;
				beginCategory (client);
			}
			else
			{
				client.top += WIDGET_SPACE;
			}
			

			// Type ?
			switch (param.Type)
			{
			case CParameter::TypeEnum:
				{
					if (param.EnumString)
					{
						// Add label
						client.bottom = client.top + LABEL_HEIGHT;
						client.right = client.left + LABEL_WIDTH;
						addLabel(client, (param.Name+string(":")).c_str());

						client.right = WIDGET_RIGHT;
						client.top = client.bottom;
						client.bottom = client.top + COMBO_WINDOW_HEIGHT;
						CExtComboBox *comboBox = new CExtComboBox;
						comboBox->Create (WS_TABSTOP|CBS_DROPDOWNLIST|WS_VISIBLE|WS_CHILD|WS_VSCROLL|CBS_DISABLENOSCROLL, client, this, i+FirstID);
						client.bottom = client.top + COMBO_HEIGHT;
						comboBox->SetFont (GetFont());
						Widgets.push_back(comboBox);
						int j;
						for (j=0; j<param.IntegerMax; j++)
							comboBox->AddString(param.EnumString[j]);
					}
					else
						Widgets.push_back (NULL);
				}
				break;
			case CParameter::TypeColor:
				{
					// Add label
					client.bottom = client.top + LABEL_HEIGHT;
					client.right = client.left + LABEL_WIDTH;
					addLabel(client, (param.Name+string(":")).c_str());

					client.top = client.bottom;
					client.bottom += COLOR_HEIGHT;
					client.right = WIDGET_RIGHT;
					CColorBox *colorBox = new CColorBox;
					colorBox->Create (WS_TABSTOP|WS_VISIBLE|WS_CHILD, client, this, i+FirstID);
					colorBox->SetFont (GetFont());
					Widgets.push_back(colorBox);
				}
				break;
			case CParameter::TypeGradient:
				{
					// Add label
					client.bottom = client.top + LABEL_HEIGHT;
					client.right = client.left + LABEL_WIDTH;
					addLabel(client, (param.Name+string(":")).c_str());

					client.right = WIDGET_RIGHT;
					client.top = client.bottom;
					client.bottom = client.top+GRADIENT_HEIGHT;
					CGradientRectWnd *gradient = new CGradientRectWnd (true);
					gradient->Create (WS_TABSTOP|WS_VISIBLE|WS_CHILD|/*WS_BORDER*/0, client, this, i+FirstID);
					Widgets.push_back(gradient);
				}
				break;
			/*case CParameter::TypeFloat:
				{
					// Add label
					client.bottom = client.top + LABEL_HEIGHT;
					client.right = client.left + LABEL_WIDTH;
					addLabel(client, (param.Name+string(":")).c_str());

					client.right = WIDGET_RIGHT;
					client.top = client.bottom;
					client.bottom = client.top+SLIDER_HEIGHT;
					CSliderCtrl *slider = new CSliderCtrl;
					slider->Create (WS_TABSTOP|TBS_HORZ|WS_VISIBLE|WS_CHILD, client, this, i+FirstID);
					slider->SetRange(SPINNER_MIN, SPINNER_MAX);
					slider->SetFont (GetFont());
					Widgets.push_back(slider);
				}
				break;*/
			case CParameter::TypeFloat:
				{
					client.right = client.left + ROT_BUTTON_WIDTH;
					client.bottom = client.top+ROT_BUTTON_HEIGHT;
					CRotButton *rotButton = new CRotButton;
					rotButton->Create (WS_TABSTOP|WS_VISIBLE|WS_CHILD, client, this, i+FirstID);
					rotButton->init (param.Setup);
					Widgets.push_back(rotButton);

					// Add label
					RECT clientBox = client;
					clientBox.top --;
					clientBox.left = clientBox.right + ROT_BUTTON_LEFT_MARGIN;
					clientBox.bottom = clientBox.top + LABEL_HEIGHT;
					clientBox.right = clientBox.left + LABEL_WIDTH;
					addLabel(clientBox, (param.Name+string(":")).c_str());

					clientBox = client;
					clientBox.left = clientBox.right + ROT_BUTTON_LEFT_MARGIN;
					clientBox.right = clientBox.left + EDIT_WIDTH;
					clientBox.top = clientBox.bottom - EDIT_HEIGHT;
					CMyEdit *edit = new CMyEdit;
					edit->Create (/*WS_BORDER*/0|WS_TABSTOP|ES_LEFT|WS_VISIBLE|WS_CHILD, clientBox, this, i+FirstID);
					edit->SetFont (GetFont());
					Others.push_back(edit);
					rotButton->setEditBox (edit);

					clientBox.left = clientBox.right + ROT_BUTTON_LABEL_MARGIN;
					clientBox.right = clientBox.left + LABEL_WIDTH;
					clientBox.top = clientBox.bottom - EDIT_HEIGHT;
					addLabel(clientBox, param.Setup.Unit);
				}
				break;
			case CParameter::TypeInt:
				{
					// Add label
					client.bottom = client.top + LABEL_HEIGHT;
					client.right = client.left + LABEL_WIDTH;
					addLabel(client, (param.Name+string(":")).c_str());

					client.top = client.bottom;
					client.bottom += EDIT_HEIGHT;
					client.right = client.left+EDIT_WIDTH;
					CMyEdit *edit = new CMyEdit;
					edit->Create (/*WS_BORDER*/0|WS_TABSTOP|ES_LEFT|ES_NUMBER|WS_VISIBLE|WS_CHILD, client, this, i+FirstID);
					edit->SetFont (GetFont());
					Widgets.push_back(edit);

					RECT clientBox = client;
					clientBox.left = clientBox.right;
					clientBox.right = clientBox.left+SPIN_WIDTH;
					CSpinButtonCtrl *spin = new CSpinButtonCtrl;
					spin->Create (/*WS_BORDER*/0|WS_TABSTOP|UDS_WRAP|UDS_ARROWKEYS|WS_VISIBLE|WS_CHILD, clientBox, this, i+FirstID);
					spin->SetRange32( param.IntegerMin, param.IntegerMax);
					Others.push_back(spin);
				}
				break;
			case CParameter::TypeString:
				{
					// Add label
					client.bottom = client.top + LABEL_HEIGHT;
					client.right = client.left + LABEL_WIDTH;
					addLabel(client, (param.Name+string(":")).c_str());

					client.top = client.bottom;
					client.bottom += param.Integer?EDIT_MULTI_LINE_HEIGHT:EDIT_HEIGHT;
					client.right = WIDGET_RIGHT;
					CExtEdit *edit;
					if (param.Integer)
					{
						edit = new CExtEdit;
						edit->Create (WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, client, this, i+FirstID);
					}
					else
					{
						edit = new CMyEdit;
						edit->Create (/*WS_BORDER*/0|WS_TABSTOP|ES_LEFT|WS_VISIBLE|WS_CHILD, client, this, i+FirstID);
					}
					edit->SetFont (GetFont());
					Widgets.push_back(edit);
				}
				break;
			case CParameter::TypeBool:
				{
					client.right = WIDGET_RIGHT;
					client.bottom = client.top+CHECKBOX_HEIGHT;
					CExtBtnOnFlat *edit = new CExtBtnOnFlat;
					string tmp = param.Name;
					tmp[0] = toupper (tmp[0]);
					edit->Create (tmp.c_str(), WS_TABSTOP|BS_AUTOCHECKBOX|WS_VISIBLE|WS_CHILD, client, this, i+FirstID);
					//edit->SetFlat (FALSE);
					edit->SetFont (GetFont());
					Widgets.push_back(edit);
				}
				break;
			default:
				Widgets.push_back (NULL);
			}
		
			client.top = client.bottom;
		}

		if (_Op->getNumParameter())
			endCategory (client, currentCategory.c_str ());
		client.bottom = client.top + DIALOG_MARGIN;
		client.top = 0;
		client.left = 0;
		client.right = DIALOG_CLIENT_WIDTH;

		// Resize the client window
		RECT window;
		RECT realClient;
		GetWindowRect (&window);
		GetClientRect (&realClient);
		SetWindowPos (NULL, 0, 0, 
			(window.right-window.left)+(client.right-client.left)-(realClient.right-realClient.left),
			(window.bottom-window.top)+(client.bottom-client.top)-(realClient.bottom-realClient.top),
			SWP_NOMOVE|SWP_NOZORDER);

		_Initialized = true;

		// Set the name
		updateData();

		return TRUE;
	}
	return FALSE;
}
Exemplo n.º 4
0
BOOL dialogEditor_dataitem::OnInitDialog()
{
	CString sError;
	DWORD dwExtendedStyle = 0;

	pFont = new CFont;
	LOGFONT lf;

	memset(&lf, 0, sizeof(LOGFONT));
	lf.lfHeight = 0xfffffff5;
	lf.lfWeight = FW_REGULAR;
	lf.lfOutPrecision = OUT_STROKE_PRECIS;
	lf.lfClipPrecision = CLIP_STROKE_PRECIS;
	lf.lfQuality = DRAFT_QUALITY;
	lf.lfPitchAndFamily = 0x22;
	lf.lfCharSet = 0;
	strcpy(lf.lfFaceName,"Lucida Console");

	pFont->CreateFontIndirect(&lf);

	if((lpComboBox_type = (CComboBox*)GetDlgItem(IDC_EDITOR_DATAITEM_TYPE)) == NULL)
		return FALSE;

	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Temperature"),0x1);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Pressure"),0x2);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Air/Fuel"),0x3);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Speed"),0x4);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Injector"),0x5);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("General"),0x6);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Switch"),0x7);
	lpComboBox_type->SetItemData(lpComboBox_type->AddString("Boost (Corrected)"),0x9);

	CSpinButtonCtrl* pSpin = NULL;
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_SPINBYTE)) == NULL)
		return FALSE;
	pSpin->SetRange(1,100);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_SPINBIT)) == NULL)
		return FALSE;
	pSpin->SetRange(1,8);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_ADDRESSHIGHSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange32(0,0xFFFFFF);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_ADDRESSLOWSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange32(0,0xFFFFFF);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_OPERANDADDITIONSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange32(0,65536);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_OPERANDSUBTRACTSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange32(0,65536);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_OPERANDMULTIPLIERSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange32(0,65536);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_OPERANDDIVISORSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange32(0,65536);
	if((pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_EDITOR_DATAITEM_DECIMALSSPIN)) == NULL)
		return FALSE;
	pSpin->SetRange(0,3);

	LoadDataFile();
	GetData();
	UpdateLabels(FALSE);

	listDataItem.GetCount() == 0 ? iIndex = 0 : iIndex = 1;
	sError.Format("Editor - Data Item Data File (%i of %i)",iIndex,listDataItem.GetCount());
	SetWindowText(sError);

	return CDialog::OnInitDialog();
}
Exemplo n.º 5
0
BOOL COptionsMisc::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  for (int i = 0; i < 2; i++) {
    m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_chkbox[i].ResetBkgColour(); // Use current window's background
  }

  // Database preferences - can't change in R/O mode of if no DB is open
  if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) {
    GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(FALSE);
    GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(FALSE);
    GetDlgItem(IDC_STATIC_DEFAUTOTYPE)->EnableWindow(FALSE);
    GetDlgItem(IDC_DB_DEF_AUTOTYPE_TEXT)->EnableWindow(FALSE);
    GetDlgItem(IDC_MAINTAINDATETIMESTAMPS)->EnableWindow(FALSE);
    GetDlgItem(IDC_USEDEFUSER)->EnableWindow(FALSE);
  }

  OnUseDefUser();

  // For some reason, MFC calls us twice when initializing.
  // Populate the combo box only once.
  if (m_dblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_dblclk_cbox);
  }

  if (m_shiftdblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_shiftdblclk_cbox);
  }

  m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]);
  m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]);

  GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation);
  GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation);

  CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY));
  pspin->SetRange32(M_prefminAutotypeDelay(), M_prefmaxAutotypeDelay());
  pspin->SetBase(10);
  pspin->SetPos(m_AutotypeDelay);

  if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) {
    m_Help1.Init(IDB_QUESTIONMARK);
    m_Help2.Init(IDB_QUESTIONMARK);
    m_Help3.Init(IDB_QUESTIONMARK);

    // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP
    AddTool(IDC_MAINTAINDATETIMESTAMPSHELP, IDS_MAINTAINDATETIMESTAMPS);
    AddTool(IDC_OTHERBROWSERLOCATIONHELP, IDS_OTHERBROWSERLOCATION);
    AddTool(IDC_OTHEREDITORLOCATIONHELP, IDS_OTHEREDITORLOCATION);
    ActivateToolTip();
  } else {
    m_Help1.EnableWindow(FALSE);
    m_Help1.ShowWindow(SW_HIDE);
    m_Help2.EnableWindow(FALSE);
    m_Help2.ShowWindow(SW_HIDE);
    m_Help3.EnableWindow(FALSE);
    m_Help3.ShowWindow(SW_HIDE);
  }

  return TRUE;  // return TRUE unless you set the focus to a control
}