Exemple #1
0
/*
** Updates metadata and settings when changed.
**
*/
void CDialogManage::CTabSkins::Update(CMeterWindow* meterWindow, bool deleted)
{
	if (meterWindow)
	{
		if (!deleted && m_IgnoreUpdate)
		{
			// Changed setting from dialog, no need to update
			m_IgnoreUpdate = false;
		}
		else if (m_SkinWindow && m_SkinWindow == meterWindow) 
		{
			// Update from currently open skin
			m_HandleCommands = false;
			if (deleted)
			{
				DisableControls();
				m_SkinWindow = NULL;
			}
			else
			{
				SetControls();
			}
			m_HandleCommands = true;
		}
		else if (wcscmp(meterWindow->GetFolderPath().c_str(), m_SkinFolderPath.c_str()) == 0 &&
				 wcscmp(meterWindow->GetFileName().c_str(), m_SkinFileName.c_str()) == 0)
		{
			ReadSkin();
		}
	}
	else
	{
		// Populate tree
		HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
		TreeView_DeleteAllItems(item);

		TVINSERTSTRUCT tvi = {0};
		tvi.hInsertAfter = TVI_LAST;
		tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
		tvi.item.iImage = tvi.item.iSelectedImage = 0;

		if (!Rainmeter->m_SkinFolders.empty())
		{
			PopulateTree(item, tvi);
		}
	}
}
Exemple #2
0
void SelectProxy::SetOptions (BOOL UseProxy, TCHAR *HostName, TCHAR *UserName, TCHAR *Password, int Port, BOOL ProxyAnonymous, int ProxyType)
{
  Button_SetCheck (HUseProxy, UseProxy ? BST_CHECKED : BST_UNCHECKED);
  Button_SetCheck (HProxyAnonymous, ProxyAnonymous ? BST_CHECKED : BST_UNCHECKED);
  Edit_SetText (HUserName, UserName);
  Edit_SetText (HHostName, HostName);
  Edit_SetText (HPassword, Password);
  if (Port < 0)
    Port = 0;
  if (Port > 65535)
    Port = 65535;
  TCHAR Buf[DEFAULT_BUF_SIZE];
  _itot (Port, Buf, 10);
  Edit_SetText (HPort, Buf);
  DisableControls ();
  ComboBox_SetCurSel (HProxyType, ProxyType);
}
void SetPage(HWND hDlg, int value)
{
  MADB_Dsn    *Dsn=       (MADB_Dsn *)GetWindowLongPtr(GetParent(hwndTab[0]), DWLP_USER);
  unsigned int new_page=  GetNextActiveTab(CurrentPage, value);

  /* Save if last page or all following pages are disabled */
  if (value > 0 && (CurrentPage == LASTPAGE || new_page== CurrentPage))
  {
    GetDialogFields();
    if (Dsn->isPrompt || SaveDSN(hDlg, Dsn))
    {
      SendMessage(hwndMain, WM_DESTROY, 0, 0);
    }
    return;
  }

	ShowWindow(hwndTab[CurrentPage != (unsigned int)(-1) ? CurrentPage : 0], SW_HIDE);

	CurrentPage= new_page;

	ShowWindow(hwndTab[CurrentPage], SW_SHOW);

  DisableControls(Dsn);

  /* Disabling prev button if needed*/
  new_page= GetNextActiveTab(CurrentPage, -1);
  EnableWindow(GetDlgItem(hwndTab[CurrentPage], PB_PREV), (CurrentPage != new_page) ? TRUE : FALSE);

  /* Switching caption of the Next/Finish button if needed*/
  new_page= GetNextActiveTab(CurrentPage, 1);
	SendMessage(GetDlgItem(hwndTab[CurrentPage], PB_NEXT), WM_SETTEXT, 0, (CurrentPage == new_page) ? (LPARAM)"Finish" : (LPARAM)"Next >");
	SetFocus(hwndTab[CurrentPage]);

  /* If not a prompt - disable finish button in case of empty DS name(for prompt it may be empty/invalid)
     TODO: I think it rather has to check if the name is valid DS name */
	if (Dsn->isPrompt ==  MAODBC_CONFIG && CurrentPage == new_page)
  {
	  EnableWindow(GetDlgItem(hwndTab[CurrentPage], PB_NEXT), 
	               Edit_GetTextLength(GetDlgItem(hwndTab[0], txtDsnName)) ? TRUE : FALSE);
  }
}
Exemple #4
0
//=============================================================================================================
void Avatar::SetState(unsigned int newstate)
{
    switch( newstate )
    {
    case Empowered:
        state |= Empowered;
        empowerticks = 0;
        power = 0;
        break;

    case Exploded:
        DisableControls(true);

        velocity = D3DXVECTOR2(0, 0);
        shieldticks = shield.count() + 2;
        empowerticks = power.count() + 2;
        flashticks = 0;

        // ha nincs életünk, akkor csak robbanunk
        if( Health == 0 )
        {
            state = Exploded;
            explode();
        }
        // ha van akkor robbanunk és halhatatlanok leszünk
        else
        {
            state = Exploded|Invincible;
            Integrity = MaxIntegrity;

            --Health;
            explode();
        }

        break;

    default:
        break;
    }
}
Exemple #5
0
void CDialogTest::OnButtonStart() 
{
	if(!m_bReadValueTest)
	{
		//开启自动测量线程
		m_sValue1 = _T("");
		m_sValue10 = _T("");
		m_sValue11 = _T("");
		m_sValue12 = _T("");
		m_sValue13 = _T("");
		m_sValue14 = _T("");
		m_sValue15 = _T("");
		m_sValue16 = _T("");
		m_sValue17 = _T("");
		m_sValue18 = _T("");
		m_sValue19 = _T("");
		m_sValue2 = _T("");
		m_sValue20 = _T("");
		m_sValue3 = _T("");
		m_sValue4 = _T("");
		m_sValue5 = _T("");
		m_sValue6 = _T("");
		m_sValue7 = _T("");
		m_sValue8 = _T("");
		m_sValue9 = _T("");
		SetDlgItemText(IDC_BUTTON_START,_T("停止测试"));
		DisableControls();
		m_bReadValueTest	= TRUE;
		m_hReadThread = CreateThread(NULL,0,ReadTestThread,this,0, NULL);
	}
	else
	{
		m_bReadValueTest	= FALSE;
		SetDlgItemText(IDC_BUTTON_START,_T("开始测试"));
		WaitForSingleObject(m_hReadThread,500);
		CloseHandle(m_hReadThread);
		m_hReadThread=NULL;
		EnableControls();
	}
}
Exemple #6
0
void CDialogManage::CTabSkins::ReadSkin()
{
	HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_FILE_TEXT);
	SetWindowText(item, m_SkinFileName.c_str());

	PathSetDlgItemPath(m_Window, IDC_MANAGESKINS_CONFIG_TEXT, m_SkinFolderPath.c_str());

	item = GetDlgItem(m_Window, IDC_MANAGESKINS_EDIT_BUTTON);
	EnableWindow(item, TRUE);

	std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath;
	file += L'\\';
	file += m_SkinFileName;
	m_SkinWindow = Rainmeter->GetMeterWindowByINI(file);
	if (!m_SkinWindow)
	{
		DisableControls();
	}

	SetControls();

	WCHAR* buffer = new WCHAR[MAX_LINE_LENGTH];

	item = GetDlgItem(m_Window, IDC_MANAGESKINS_AUTHOR_TEXT);
	GetPrivateProfileString(L"Rainmeter", L"Author", NULL, buffer, MAX_LINE_LENGTH, file.c_str());
	SetWindowText(item, buffer);

	item = GetDlgItem(m_Window, IDC_MANAGESKINS_ADDMETADATA_LINK);
	if (GetPrivateProfileSection(L"Metadata", buffer, 8, file.c_str()) > 0)
	{
		ShowWindow(item, SW_HIDE);

		// Set metadata
		item = GetDlgItem(m_Window, IDC_MANAGESKINS_VERSION_TEXT);
		GetPrivateProfileString(L"Metadata", L"Version", NULL, buffer, MAX_LINE_LENGTH, file.c_str());
		SetWindowText(item, buffer);

		item = GetDlgItem(m_Window, IDC_MANAGESKINS_LICENSE_TEXT);
		GetPrivateProfileString(L"Metadata", L"License", NULL, buffer, MAX_LINE_LENGTH, file.c_str());
		SetWindowText(item, buffer);

		item = GetDlgItem(m_Window, IDC_MANAGESKINS_DESCRIPTION_TEXT);
		std::wstring text;
		if (GetPrivateProfileString(L"Metadata", L"Information", NULL, buffer, MAX_LINE_LENGTH, file.c_str()) > 0)
		{
			text = buffer;
		}
		else
		{
			// For backwards compatibility
			GetPrivateProfileString(L"Metadata", L"Description", NULL, buffer, MAX_LINE_LENGTH, file.c_str());
			text = buffer;

			if (GetPrivateProfileString(L"Metadata", L"Instructions", NULL, buffer, MAX_LINE_LENGTH, file.c_str()) > 0)
			{
				text += L"\r\n\r\n";
				text += buffer;
			}
		}

		// Replace | with newline
		std::wstring::size_type pos;
		while ((pos = text.find_first_of(L'|')) != std::wstring::npos)
		{
			size_t count = (pos + 1 < text.length() && text[pos + 1] == L' ') ? 2 : 1;
			if (text[pos - 1] == L' ')
			{
				--pos;
				count += 1;
			}
			text.replace(pos, count, L"\r\n");
		}

		SetWindowText(item, text.c_str());

		int lines = Edit_GetLineCount(item);
		ShowScrollBar(item, SB_VERT, (BOOL)(lines > 6));
	}
	else
	{
		ShowWindow(item, SW_SHOWNORMAL);

		item = GetDlgItem(m_Window, IDC_MANAGESKINS_VERSION_TEXT);
		SetWindowText(item, L"");

		item = GetDlgItem(m_Window, IDC_MANAGESKINS_LICENSE_TEXT);
		SetWindowText(item, L"");

		item = GetDlgItem(m_Window, IDC_MANAGESKINS_DESCRIPTION_TEXT);
		SetWindowText(item, L"");
		ShowScrollBar(item, SB_VERT, FALSE);
	}

	delete [] buffer;
}
Exemple #7
0
INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
{
	LPNMHDR nm = (LPNMHDR)lParam;
	switch (nm->code)
	{
	case NM_CLICK:
		if (nm->idFrom == IDC_MANAGESKINS_ADDMETADATA_LINK)
		{
			std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath;
			file += L'\\';
			file += m_SkinFileName;
			WritePrivateProfileString(L"Rainmeter", L"\r\n[Metadata]\r\nName=\r\nInformation=\r\nLicense=\r\nVersion", L"", file.c_str());
			SendMessage(m_Window, WM_COMMAND, MAKEWPARAM(IDC_MANAGESKINS_EDIT_BUTTON, 0), 0);
			ShowWindow(nm->hwndFrom, SW_HIDE);
		}
		break;

	case NM_DBLCLK:
		if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW && !m_SkinFileName.empty())
		{
			OnCommand(MAKEWPARAM(IDC_MANAGESKINS_LOAD_BUTTON, 0), 0);
		}
		break;

	case NM_RCLICK:
		if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW)
		{
			POINT pt;
			GetCursorPos(&pt);

			TVHITTESTINFO ht;
			ht.pt = pt;
			ScreenToClient(nm->hwndFrom, &ht.pt);

			if (TreeView_HitTest(nm->hwndFrom, &ht) && !(ht.flags & TVHT_NOWHERE))
			{
				TreeView_SelectItem(nm->hwndFrom, ht.hItem);

				TVITEM tvi = {0};
				tvi.hItem = TreeView_GetSelection(nm->hwndFrom);
				tvi.mask = TVIF_STATE;

				HMENU menu = LoadMenu(Rainmeter->GetResourceInstance(), MAKEINTRESOURCE(IDR_MANAGESKINS_MENU));
				if (menu && TreeView_GetItem(nm->hwndFrom, &tvi))
				{
					HMENU subMenu;
					MENUITEMINFO mii = {0};
					mii.cbSize = sizeof(MENUITEMINFO);
					mii.fMask = MIIM_STRING;

					if (m_SkinFileName.empty())
					{
						// It's a folder
						subMenu = GetSubMenu(menu, 0);
						SetMenuDefaultItem(subMenu, IDM_MANAGESKINSMENU_EXPAND, MF_BYCOMMAND);

						if (tvi.state & TVIS_EXPANDED)
						{
							mii.dwTypeData = GetString(ID_STR_COLLAPSE);
							SetMenuItemInfo(subMenu, IDM_MANAGESKINSMENU_EXPAND, MF_BYCOMMAND, &mii);
						}
					}
					else
					{
						// It's a skin
						subMenu = GetSubMenu(menu, 1);
						SetMenuDefaultItem(subMenu, IDM_MANAGESKINSMENU_LOAD, MF_BYCOMMAND);

						if (m_SkinWindow)
						{
							mii.dwTypeData = GetString(ID_STR_UNLOAD);
							SetMenuItemInfo(subMenu, IDM_MANAGESKINSMENU_LOAD, MF_BYCOMMAND, &mii);
						}
						else
						{
							EnableMenuItem(subMenu, IDM_MANAGESKINSMENU_REFRESH, MF_BYCOMMAND | MF_GRAYED);
						}
					}

					// Show context menu
					TrackPopupMenu(
						subMenu,
						TPM_RIGHTBUTTON | TPM_LEFTALIGN,
						pt.x,
						pt.y,
						0,
						m_Window,
						NULL
					);

					DestroyMenu(menu);
				}
			}
		}
		break;

	case TVN_SELCHANGED:
		if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW)
		{
			m_SkinWindow = NULL;
			m_SkinFileName.clear();
			m_SkinFolderPath.clear();

			// Temporarily disable handling commands
			m_HandleCommands = false;

			WCHAR buffer[MAX_PATH];

			// Get current selection name
			TVITEM tvi = {0};
			tvi.hItem = TreeView_GetSelection(nm->hwndFrom);
			tvi.mask = TVIF_TEXT | TVIF_CHILDREN;
			tvi.pszText = buffer;
			tvi.cchTextMax = MAX_PATH;
			TreeView_GetItem(nm->hwndFrom, &tvi);

			if (tvi.cChildren == 0)
			{
				// Current selection is file
				m_SkinFileName = buffer;
				tvi.mask = TVIF_TEXT;
			
				// Loop through parents to get skin folder
				m_SkinFolderPath.clear();
				while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != NULL)
				{
					TreeView_GetItem(nm->hwndFrom, &tvi);
					m_SkinFolderPath.insert(0, 1, L'\\');
					m_SkinFolderPath.insert(0, buffer);
				}

				m_SkinFolderPath.resize(m_SkinFolderPath.length() - 1);  // Get rid of trailing slash

				ReadSkin();
			}
			else
			{
				DisableControls(true);
			}

			m_HandleCommands = true;
		}
		break;

	default:
		return FALSE;
	}

	return TRUE;
}
Exemple #8
0
//=============================================================================================================
void Avatar::Update()
{
    // robbanáskor mi történjen
    if( state & Exploded )
    {
        // lehetne az életet is nézni, de akkor eggyel elöbb hal
        bool alive = ((state & Invincible) == Invincible);

        // lejárt-e a várakozási idö
        if( flashticks > (unsigned)(alive ? 5 : 20) )
        {
            // nincs több élet, meghalt
            if( !alive )
            {
                dead();
            }
            // van még élet, egy kis idöre halhatatlan lesz
            else
            {
                flashticks = 0;
                power = 0;
                empowerticks = 0;
                Position = InitialPosition;

                DisableControls(false);
                state = Invincible;
            }
        }
        else
            ++flashticks;
    }
    else
    {
        // halhatatlan modban vagyunk
        if( state & Invincible )
        {
            // lejárt-e az idö
            if( flashticks > 25 )
            {
                flashticks = 0;
                state &= (~Invincible);
            }
            else
            {
                ++flashticks;

                // villogtatjuk
                if( flashticks % 4 == 0 )
                    drawornot = !drawornot;
            }
        }

        // felvett egy powerupot
        if( state & Empowered )
        {
            if( empowerticks > (size_t)power.count() + 1 )
                state &= (~Empowered);
            else
            {
                ++empowerticks;
                power.step();
            }
        }

        // találat érte, de a pajzs felfogta
        if( shieldticks <= shield.count() + 1 )
        {
            shield.step();
            ++shieldticks;
        }
    }

    // minden mennyiséget a felbontáshoz kell igazitani
    float maxvel = GameVariables::CorrelateH(Speed);
    float accel = GameVariables::CorrelateH(Acceleration);
    float resist = GameVariables::CorrelateH(Resistance);
    float length;

    direction.x = direction.y = 0;

    if( state & Forward )
        direction.x = (state & Backward ? 0.0f : 1.0f);
    else if( state & Backward )
        direction.x = -1;

    if( state & Up )
        direction.y = (state & Down ? 0.0f : -1.0f);
    else if( state & Down )
        direction.y = 1;

    D3DXVec2Normalize(&direction, &direction);
    velocity += direction * accel;

    D3DXVec2Normalize(&resistance, &velocity);
    length = D3DXVec2Length(&velocity);

    // max sebesség
    if( length > maxvel )
        velocity = resistance * maxvel;

    // légellenállás
    if( length > resist )
        velocity -= resistance * resist;
    else
        velocity.x = velocity.y = 0;

    // fix idöközönként lehet löni
    if( state & Shoot )
    {
        if( cooldown == 0 )
        {
            shoot();
            cooldown = WeaponCooldown;
        }
    }

    Position.extend(velocity);

    // ne menjen ki a képernyöröl
    if( DummyFramework::CHelper::Clamp2<float>(Position.current.x, Bounds.x, Bounds.z - Image->Size.x) )
        velocity.x = 0;

    if( DummyFramework::CHelper::Clamp2<float>(Position.current.y, Bounds.y, Bounds.w - Image->Size.y) )
        velocity.y = 0;

    if( cooldown > 0 )
        --cooldown;
}
Exemple #9
0
BOOL CALLBACK SelectProxy::run_dlgProc (UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
  switch (message)
  {
  case WM_INITDIALOG:
    {
      HPort = ::GetDlgItem (_hSelf, IDC_PORT);
      HUserName = ::GetDlgItem (_hSelf, IDC_USERNAME);
      HHostName = ::GetDlgItem (_hSelf, IDC_HOSTNAME);
      HPassword = ::GetDlgItem (_hSelf, IDC_PASSWORD);
      HUseProxy = ::GetDlgItem (_hSelf, IDC_USEPROXY);
      HProxyAnonymous = ::GetDlgItem (_hSelf, IDC_ANONYMOUS_LOGIN);
      HProxyType = ::GetDlgItem (_hSelf, IDC_PROXY_TYPE);
      ComboBox_AddString (HProxyType, _T ("FTP Web Proxy"));
      ComboBox_AddString (HProxyType, _T ("FTP Gateway"));
      SendEvent (EID_UPDATE_SELECT_PROXY);
      return TRUE;
    }
    break;
  case WM_COMMAND:
    {
      switch (LOWORD (wParam))
      {
      case IDOK:
        if (HIWORD (wParam) == BN_CLICKED)
        {
          SendEvent (EID_APPLY_PROXY_SETTINGS);
          display (false);
        }
        break;
      case IDCANCEL:
        if (HIWORD (wParam) == BN_CLICKED)
        {
          SendEvent (EID_UPDATE_SELECT_PROXY); // Reset all settings
          display (false);
        }
        break;
      case IDC_USEPROXY:
      case IDC_ANONYMOUS_LOGIN:
        {
          if (HIWORD (wParam) == BN_CLICKED)
            DisableControls ();
        }
        break;
      case IDC_PROXY_TYPE:
        if (HIWORD (wParam) == CBN_SELCHANGE)
          DisableControls ();
        break;
      case IDC_PORT:
        if (HIWORD (wParam) == EN_CHANGE)
        {
          TCHAR *EndPtr = 0;
          int x;
          TCHAR Buf[DEFAULT_BUF_SIZE];
          Edit_GetText (HPort, Buf, DEFAULT_BUF_SIZE);
          if (!*Buf)
            return FALSE;

          x = _tcstol (Buf, &EndPtr, 10);
          if (*EndPtr)
            Edit_SetText (HPort, _T ("0"));
          else if (x > 65535)
            Edit_SetText (HPort, _T ("65535"));
          else if (x < 0)
            Edit_SetText (HPort, _T ("0"));

          return FALSE;
        }
      }
    }
    break;
  }
  return FALSE;
}
//
// OnCommand()
//
BOOL CBidDialogSmall::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	int nID = LOWORD(wParam);
	int nCode = HIWORD(wParam);
	int nMessageType = wParam;
	int nBid;

	//
	// Respond to a button press
	//
	if (wParam == WMS_BIDDING_RESTART) 
	{
		OnBidRestart();
		return TRUE;
	}
	//
	if (wParam == WMS_FLASH_BUTTON)
	{
		FlashButton(lParam);
		return TRUE;
	}

	// check for bid level press
	if ((nCode == BN_CLICKED) && (nID >= IDC_BID_LEVEL_1) && (nID <= IDC_BID_LEVEL_7))
	{
		// check current mode
		if ((m_nCurrMode != BD_MODE_WAITFORBID) && (m_nCurrMode != BD_MODE_MANUAL_BID))
			return TRUE;
		//
		m_nSelectedLevel = nID - IDC_BID_LEVEL_1 + 1;

		// enable/disable buttons
		EnableControls();
		// highlight the level
		((CButton*)GetDlgItem(nID))->SetState(TRUE);
		//
		DisableControls();
		//
		return TRUE;
	}

	// check for bid suit press
	if ((nCode == BN_CLICKED) && (nID >= IDC_SUIT_CLUBS) && (nID <= IDC_SUIT_NOTRUMP) )
	{
		// check current mode
		if ((m_nCurrMode != BD_MODE_WAITFORBID) && (m_nCurrMode != BD_MODE_MANUAL_BID))
			return TRUE;
		//
		int nSelectedSuit = nID - IDC_SUIT_CLUBS;
		int nBid = MAKEBID(nSelectedSuit, m_nSelectedLevel);
		if (m_nCurrMode == BD_MODE_MANUAL_BID)
		{
			// record the bid
			int nPos = pDOC->GetCurrentPlayerPosition();
			if (nPos == SOUTH)
				pDOC->GetCurrentPlayer()->EnterHumanBid(nBid);
			int nCode = pDOC->EnterBid(nPos, nBid);
			UpdateBidDisplay(nPos, nBid);	

			// and check the result of the bid
			ProcessBidReturnCode(nCode);
			if (nCode == 0)
			{
				// bid entered OK, move on to the next player
				int nPos = pDOC->GetCurrentPlayerPosition();
				GetComputerBids(nPos);
			}
		}
		else
		{
			RegisterBid(nBid);
		}
		return TRUE;
	}

	// check for double/redouble
	if ( (nID == IDC_BID_DOUBLE) || (nID == IDC_BID_REDOUBLE) ) 
	{
		if (nID == IDC_BID_DOUBLE)
			nBid = BID_DOUBLE;
		else if (nID == IDC_BID_REDOUBLE)
			nBid = BID_REDOUBLE;
		else
			nBid = nID - IDC_BID_PASS;

		//
		RegisterBid(nBid);
		return TRUE;
	}
	//
	return CBidDialog::OnCommand(wParam, lParam);
}
void CBidDialog::InitBiddingSequence()
{
	// check for autotrain mode
	if (m_nCurrMode == BD_MODE_AUTO_TRAIN)
		return;

	// get display mode
	m_bUseSuitSymbols = theApp.GetValue(tbUseSuitSymbols);

	// get manual bid option
	m_bManualBidding = theApp.GetValue(tbManualBidding);

	// get pause option
	m_bInsertBiddingPause = theApp.GetValue(tbInsertBiddingPause);
	if (m_bInsertBiddingPause)
		m_nBiddingPauseLength = theApp.GetValue(tnBiddingPauseLength) * 100;
	else
		m_nBiddingPauseLength = 0;

	// get speech option
	m_bSpeechEnabled = theApp.GetValue(tbEnableSpokenBids);

	// get bidding engine info
//	m_nBiddingEngine = theApp.GetValue(tnBiddingEngine);
//	m_bTrainingMode = theApp.GetValue(tbNNetTrainingMode);
	m_nBiddingEngine = 0;
	m_bTrainingMode = FALSE;

	// start the bidding process
	CEasyBDoc* pDoc = CEasyBDoc::GetDoc();
	if (!pDoc || !pDoc->IsInitialized())
		return;
	m_nComputerBid = NONE;
	EnableControls();
	DisableControls();
	
	// clear bid displays
	for(int i=0;i<4;i++)
	{
		SetDlgItemText(IDC_BID_SOUTH+i,"");
		((CStatic*)GetDlgItem(IDCI_BID_SOUTH+i))->SetIcon(NULL);
	}

	// and start bidding, if appropriate
	// but return if just initializing
	if (!theApp.IsBiddingInProgress())
		return;
	int nDealer = pDOC->GetDealer();
	if ((nDealer != SOUTH) || m_bTrainingMode)
	{
		GetComputerBids(nDealer);
	} 
	else 
	{
		UpdateBidDisplay(SOUTH,0,TRUE);	
		m_nCurrMode = BD_MODE_WAITFORBID;
		pDOC->ShowAutoHint();
	}

	// show dealer
	int nPos = pDOC->GetDealer();
	CString strTitle = FormString("Bid  (Dealer = %s)", PositionToString(nPos));
//	if (m_bTrainingMode)
//		strTitle += _T(" (Training Mode)");
	SetWindowText(strTitle);
}
//
// GetComputerBids()
//
// gets the computer players' bids, starting with the specified 
// player position
//
// return code:
// 0  = OK
// 1  = bidding complete
// -1 = passed out or error
//
int CBidDialog::GetComputerBids(int nStart)
{
	int i,nBid;
	m_nCurrMode = BD_MODE_EVALUATE;

	//
	UpdateWindow();
	if (m_bTrainingMode)
	{
		// get the current computer's bid
		nBid = PLAYER(nStart).Bid();
		m_nComputerBid = nBid;
		UpdateBidDisplay(nStart, nBid, FALSE, TRUE);	
		DisableControls();
		m_nCurrMode = BD_MODE_TRAIN;
		return 0;
	}
	else if (m_bManualBidding)
	{
		// get the current computer's bid
		UpdateBidDisplay(nStart, -2, TRUE, FALSE);	
		DisableControls();
		m_nCurrMode = BD_MODE_MANUAL_BID;
		return 0;
	}
	else
	{
		// get computer bids through East
		for(i=nStart;i<=EAST;i++) 
		{
			// insert cadence delay here
			if (m_bInsertBiddingPause)
			{
				UpdateBidDisplay(i, -2);	
				::Sleep(m_nBiddingPauseLength);
			}
			else if (m_bSpeechEnabled)
			{
				// also insert a short pause if speaking
				UpdateBidDisplay(i, -2);	
				::Sleep(100);
			}

			//
			nBid = PLAYER(i).Bid();
			UpdateBidDisplay(i,nBid);	
			int nCode = pDOC->EnterBid(i,nBid);

			// then proceed
			if (nCode == -99)
			{
				DealNewHands();
				return -1;
			}
//			else if (nCode >= 0)
//			{
//				UpdateBidDisplay(i,nBid);	
//			}
			else if (nCode == 1) 
			{
				// 3 passes, and bidding is complete
				if (BiddingDone())
					return 1;
				else
					return 0;
			}
			else if (nCode == -1) 
			{
				AfxMessageBox("Error in Bidding Dialog!");
				return -1;
			}
		}

		// else all went OK
		UpdateBidDisplay(SOUTH,0,TRUE);	
		DisableControls();
		m_nCurrMode = BD_MODE_WAITFORBID;
		pDOC->ShowAutoHint();
		return 0;
	}
}