LRESULT CALLBACK ConfigDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
		case WM_INITDIALOG:
			CenterWindow(hwnd,GetWindow(hwnd,GW_OWNER));
			SetCheckBox(hwnd,ID_ASKSELECT,opAskSelect);
			SetCheckBox(hwnd,ID_ADDINDEX,opAddIndex);
			return TRUE;
		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case ID_DEFAULTS:
					SetCheckBox(hwnd,ID_ASKSELECT,TRUE);
					SetCheckBox(hwnd,ID_ADDINDEX,TRUE);
					break;
				case IDCANCEL:
					EndDialog(hwnd,FALSE);
					break;
				case IDOK:
					opAskSelect=GetCheckBox(hwnd,ID_ASKSELECT);
					opAddIndex=GetCheckBox(hwnd,ID_ADDINDEX);
					EndDialog(hwnd,TRUE);
					break;
				default:
					break;
			}
			break;
		default:
			break;
    }
    return FALSE;
}
Exemple #2
0
void CExportObjFile::OnExportObjForSoftCheck() 
{
	SetCheckBox(IDC_EXPORT_OBJ_FOR_3DSMAX_CHECK,	m_exportFor3DSMax = FALSE );
	SetCheckBox(IDC_EXPORT_OBJ_FOR_MAYA_CHECK,		m_exportForMaya = FALSE );
	SetCheckBox(IDC_EXPORT_OBJ_FOR_SOFT_CHECK,		m_exportForSoft = FALSE );

	SetCheckBox(IDC_EXPORT_OBJ_FOR_SOFT_CHECK,		m_exportForSoft = TRUE );	
}
void CImportObjFileFormat::OnImportObjFromSoftimageCheck() 
{
	// TODO: Add your control notification handler code here
	SetCheckBox(IDC_IMPORT_OBJ_FROM_3DSMAX_CHECK,		m_from3DSMax = FALSE );
	SetCheckBox(IDC_IMPORT_OBJ_FROM_MAYA_CHECK,			m_from3DSMax = FALSE );
	SetCheckBox(IDC_IMPORT_OBJ_FROM_SOFTIMAGE_CHECK,	m_from3DSMax = FALSE );

	SetCheckBox(IDC_IMPORT_OBJ_FROM_SOFTIMAGE_CHECK,		m_from3DSMax = TRUE );
}
void CTreeOptionsCtrlEx::UpdateCheckBoxGroup(HTREEITEM hItem)
{
	SetRedraw(FALSE);

	//Iterate through all children and if all the checkboxes are checked, then also
	//automatically check the item. If no checkboxes are checked, then
	//also automatically uncheck the item.
	HTREEITEM hParent = hItem;
	if (hParent && IsCheckBox(hParent))
	{
		BOOL bNoCheckBoxesChecked = TRUE;
		BOOL bAllCheckBoxesChecked = TRUE;
		HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD);
		while (hChild)
		{
			if (IsCheckBox(hChild))
			{
				BOOL bThisChecked;
				VERIFY(GetCheckBox(hChild, bThisChecked));
				bNoCheckBoxesChecked = bNoCheckBoxesChecked && !bThisChecked;
				bAllCheckBoxesChecked = bAllCheckBoxesChecked && bThisChecked;
			}

			//Move on to the next item
			hChild = GetNextItem(hChild, TVGN_NEXT);
		}

		if (bNoCheckBoxesChecked)
		{
			BOOL bOldState;
			GetCheckBox(hParent, bOldState);
			SetCheckBox(hParent, FALSE);
			if (bOldState != FALSE)
				NotifyParent(BN_CLICKED, hParent);
		}
		else if (bAllCheckBoxesChecked)
		{
			BOOL bOldState;
			GetCheckBox(hParent, bOldState);
			SetCheckBox(hParent, FALSE); //gets rid of the semi state
			SetCheckBox(hParent, TRUE);
			if (bOldState != TRUE)
				NotifyParent(BN_CLICKED, hParent);
		}
		else
		{
			BOOL bEnable;
			VERIFY(GetCheckBoxEnable(hParent, bEnable));
			SetEnabledSemiCheckBox(hParent, bEnable);
		}
	}

	//Reset the redraw flag
	SetRedraw(TRUE);
}
void CTexturePropDlg::SetupBPPIdent()
{
	// disable checkboxes that can't be converted to from the current format
	EnableCheckBox(IDC_FORMAT_32BIT, m_BPPIdent != BPP_32P);
	EnableCheckBox(IDC_FORMAT_DXT1, m_BPPIdent != BPP_32P);
	EnableCheckBox(IDC_FORMAT_DXT3, m_BPPIdent != BPP_32P);
	EnableCheckBox(IDC_FORMAT_DXT5, m_BPPIdent != BPP_32P);
	EnableCheckBox(IDC_FORMAT_32P, m_BPPIdent == BPP_32P);

	SetCheckBox(IDC_FORMAT_32BIT, m_BPPIdent == BPP_32);
	SetCheckBox(IDC_FORMAT_DXT1, m_BPPIdent == BPP_S3TC_DXT1);
	SetCheckBox(IDC_FORMAT_DXT3, m_BPPIdent == BPP_S3TC_DXT3);
	SetCheckBox(IDC_FORMAT_DXT5, m_BPPIdent == BPP_S3TC_DXT5);
	SetCheckBox(IDC_FORMAT_32P, m_BPPIdent == BPP_32P);
}
Exemple #6
0
void plMultipassMtlDlg::UpdateLayerDisplay() 
{
    int numlayers = fPBlock->GetInt(kMultCount);

    fNumTexSpin->SetValue(numlayers, FALSE);

    int i;
    for (i = 0; i < numlayers && i < NSUBMTLS; i++)
    {
        Mtl *m = fPBlock->GetMtl(kMultPasses, curTime, i);
        TSTR nm;
        if (m) 
            nm = m->GetName();
        else 
            nm = "None";
        fLayerBtns[i]->SetText(nm.data());
        
        ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_SHOW);
        ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_SHOW);
        SetCheckBox(fhRollup, kLayerID[i].activeID, fPBlock->GetInt(kMultOn, curTime, i));  
    }

    for (i = numlayers; i < NSUBMTLS; i++)
    {
        ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_HIDE);
        ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_HIDE);
    }
}
Exemple #7
0
void  WardShaderDlg::LoadDialog(BOOL draw) 
{
	if (pShader && hRollup) {
		dlevSpin->SetValue(FracToPc(pShader->GetDiffuseLevel()),FALSE);
		dlevSpin->SetKeyBrackets(KeyAtCurTime(PB_DIFFUSE_LEV));

		slevSpin->SetValue(FracToPc(pShader->GetSpecularLevel()/SPEC_MAX),FALSE);
		slevSpin->SetKeyBrackets(KeyAtCurTime(PB_SPECULAR_LEV));

		glxSpin->SetValue( 100.0f * ((ALPHA_MAX - pShader->GetGlossiness())/ALPHA_SZ),FALSE);
		glxSpin->SetKeyBrackets(KeyAtCurTime(PB_GLOSSINESS_X));
		glySpin->SetValue(100.0f * ((ALPHA_MAX - pShader->GetGlossinessY())/ALPHA_SZ),FALSE);
		glySpin->SetKeyBrackets(KeyAtCurTime(PB_GLOSSINESS_Y));

		trSpin->SetValue(FracToPc(pMtl->GetOpacity( curTime )),FALSE);
		trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime));

		CheckButton(hRollup, IDC_LOCK_AD, pShader->GetLockAD() );
		CheckButton(hRollup, IDC_LOCK_DS, pShader->GetLockDS() );
		SetCheckBox(hRollup, IDC_NORMALIZE_CHECK, !pShader->GetNormalizeOn() ); 
	 	UpdateLockADTex( FALSE ); //don't send to mtl

		UpdateColSwatches();
		UpdateHilite();
	}
}
void CTreeOptionsCtrlEx::HandleCheckBox(HTREEITEM hItem, BOOL bCheck)
{
	//Turn of redraw to Q all the changes we're going to make here
	SetRedraw(FALSE);

	//Toggle the state
	BOOL bOldState;
	GetCheckBox(hItem, bOldState);
	VERIFY(SetCheckBox(hItem, !bCheck));
	if (bOldState != !bCheck)
		NotifyParent(BN_CLICKED, hItem);

	//If the item has children, then iterate through them and for all items
	//which are check boxes set their state to be the same as the parent
	HTREEITEM hChild = GetNextItem(hItem, TVGN_CHILD);
	while (hChild)
	{
		if (IsCheckBox(hChild)){
			BOOL bThisChecked;
			GetCheckBox(hChild, bThisChecked);
			SetCheckBox(hChild, !bCheck);
			if (bThisChecked != !bCheck)
				NotifyParent(BN_CLICKED, hChild);
		}

		//Move on to the next item
		hChild = GetNextItem(hChild, TVGN_NEXT);
	}

	//Get the parent item and if it is a checkbox, then iterate through 
	//all its children and if all the checkboxes are checked, then also
	//automatically check the parent. If no checkboxes are checked, then
	//also automatically uncheck the parent.
	HTREEITEM hParent = GetNextItem(hItem, TVGN_PARENT);
	UpdateCheckBoxGroup(hParent);

	//Reset the redraw flag
	SetRedraw(TRUE);
}
Exemple #9
0
void  OrenNayarShaderDlg::LoadDialog(BOOL draw) 
{
	if (pShader && hRollup) {
		shSpin->SetValue(FracToPc(pShader->GetGlossiness()),FALSE);
		shSpin->SetKeyBrackets(KeyAtCurTime(onb_glossiness));

		ssSpin->SetValue(FracToPc(pShader->GetSpecularLevel()),FALSE);
		ssSpin->SetKeyBrackets(KeyAtCurTime(onb_specular_level));

		softSpin->SetValue(pShader->GetSoftenLevel(),FALSE);
		softSpin->SetKeyBrackets(KeyAtCurTime(onb_soften));

		trSpin->SetValue(FracToPc(pMtl->GetOpacity( curTime )),FALSE);
		trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime));

		dlevSpin->SetValue(FracToPc(pShader->GetDiffuseLevel()),FALSE);
		dlevSpin->SetKeyBrackets(KeyAtCurTime(onb_diffuse_level));

		roughSpin->SetValue(FracToPc(pShader->GetDiffuseRoughness()),FALSE);
		roughSpin->SetKeyBrackets(KeyAtCurTime(onb_roughness));

		CheckButton(hRollup, IDC_LOCK_AD, pShader->GetLockAD() );
		CheckButton(hRollup, IDC_LOCK_DS, pShader->GetLockDS() );
	 	UpdateLockADTex( FALSE ); //don't send to mtl

		BOOL colorSelfIllum = pShader->IsSelfIllumClrOn();
		SetCheckBox(hRollup,IDC_SI_COLORON, colorSelfIllum ); 
		if( colorSelfIllum ) {
//			ShowWindow( siSpin->GetHwnd(), SW_HIDE );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_EDIT), SW_HIDE );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_SPIN), SW_HIDE );

			ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_SHOW );
		} else {
			// disable the color swatch
			ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_HIDE );
			// show self-illum slider
//			ShowWindow( siSpin->GetHwnd(), SW_SHOW );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_EDIT), SW_SHOW );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_SPIN), SW_SHOW );

			siSpin->SetValue(FracToPc(pShader->GetSelfIllum()), FALSE);
			siSpin->SetKeyBrackets(KeyAtCurTime(onb_self_illum_amnt));
		}

		UpdateColSwatches();
		UpdateHilite();
	}
}
static BOOL CALLBACK PrefsDlgProc(
		HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    BOOL err;
	SkeletonExporter *se = (SkeletonExporter*)GetWindowLong(hWnd,GWL_USERDATA);
	if (!se && msg!=WM_INITDIALOG) return FALSE;

	switch (msg) {
		case WM_INITDIALOG:	
			// Update class pointer
			se = (SkeletonExporter*)lParam;
			SetWindowLong(hWnd,GWL_USERDATA,lParam);

			// Setup preferences initial state
			SetCheckBox(hWnd, CHECK_ADM, se->makeADM);
			SetCheckBox(hWnd, CHECK_ADL, se->makeADL);
			SetCheckBox(hWnd, CHECK_ADO, se->makeADO);
			//SetCheckBox(hWnd, CHECK_ADD, se->makeADD);
			SetCheckBox(hWnd, CHECK_ADP, se->makeADP);
			SetCheckBox(hWnd, CHECK_ADS, se->makeADS);
			SetCheckBox(hWnd, CHECK_RAY, se->makeRAY);
			buddy=GetDlgItem(hWnd, IDC_CSRATE);
			SendDlgItemMessage(hWnd, IDC_SPIN1, UDM_SETBUDDY, (LONG)buddy, 0L);
			SendDlgItemMessage(hWnd, IDC_SPIN1, UDM_SETRANGE, 0L, MAKELONG(1, 1000));
            SendDlgItemMessage(hWnd, IDC_SPIN1, UDM_SETPOS, 0L, MAKELONG(20, 0));
			break;

		case WM_DESTROY:
			break;

		case WM_COMMAND:
			switch (LOWORD(wParam)) {
				case IDC_CANCEL:
					EndDialog(hWnd,1);
					break;

				case IDC_OK:
					// Retrieve preferences
					se->makeADM = GetCheckBox(hWnd, CHECK_ADM);
                    se->makeADL = GetCheckBox(hWnd, CHECK_ADL);
                    se->makeADO = GetCheckBox(hWnd, CHECK_ADO);
                    //se->makeADD = GetCheckBox(hWnd, CHECK_ADD);
                    se->makeADP = GetCheckBox(hWnd, CHECK_ADP);
                    se->makeADS = GetCheckBox(hWnd, CHECK_ADS);
                    se->makeRAY = GetCheckBox(hWnd, CHECK_RAY);
			        se->cs_rate=GetDlgItemInt(hWnd, IDC_CSRATE, &err, FALSE);
					EndDialog(hWnd,0);
				break;
			}
			break;

		default:
			return FALSE;
		}	
	return TRUE;
} 
Exemple #11
0
void CompositeDlg::UpdateSubTexNames() 
	{
	for (int i=theTex->offset; i<theTex->subTex.Count(); i++) {
		if (i-theTex->offset>=NDLG) break;

		Texmap *m = theTex->subTex[i];
		TSTR nm;
		if (m) 	nm = m->GetFullName();
		else 	nm = GetString(IDS_DS_NONE);
		TSTR buf;
		buf.printf(_T("%s %d:"),GetString(IDS_RB_MAP2),i+1);
		iBut[i-theTex->offset]->SetText(nm.data());
		SetDlgItemText(hPanel, labelIDs[i-theTex->offset], buf);
//		SetCheckBox(hPanel, mapOnIDs[i-theTex->offset], theTex->mapOn[i]);
		int on;
		Interval iv;
		theTex->pblock->GetValue(comptex_ons,0,on,iv,i);
		SetCheckBox(hPanel, mapOnIDs[i-theTex->offset], on);
		}
	}
Exemple #12
0
BOOL FAR PASCAL WatchDlgProc (
   HWND     hDlg,
   unsigned message,
   WORD     wParam,
   LONG     lParam)

{  static int count;
   switch (message)
   {  case WM_INITDIALOG:
      {  count = 0;
	 count += SetCheckBox(hDlg, IDC_WATCH_COMPILE,    GetWatchItem("compilations"));
	 count += SetCheckBox(hDlg, IDC_WATCH_FACTS,      GetWatchItem("facts"));
	 count += SetCheckBox(hDlg, IDC_WATCH_INSTANCE,   GetWatchItem("instances"));
	 count += SetCheckBox(hDlg, IDC_WATCH_RULES,      GetWatchItem("rules"));
	 count += SetCheckBox(hDlg, IDC_WATCH_GENERIC,    GetWatchItem("generic-functions"));
	 count += SetCheckBox(hDlg, IDC_WATCH_MESSAGE,    GetWatchItem("messages"));
	 count += SetCheckBox(hDlg, IDC_WATCH_DEFFUN,     GetWatchItem("deffunctions"));
	 count += SetCheckBox(hDlg, IDC_WATCH_STATS,      GetWatchItem("statistics"));
	 count += SetCheckBox(hDlg, IDC_WATCH_GLOBAL,     GetWatchItem("globals"));
	 count += SetCheckBox(hDlg, IDC_WATCH_SLOT,       GetWatchItem("slots"));
	 count += SetCheckBox(hDlg, IDC_WATCH_ACTIVE,     GetWatchItem("activations"));
	 count += SetCheckBox(hDlg, IDC_WATCH_METHOD,     GetWatchItem("methods"));
	 count += SetCheckBox(hDlg, IDC_WATCH_FOCUS,      GetWatchItem("focus"));
	 count += SetCheckBox(hDlg, IDC_WATCH_MSGHANDLER, GetWatchItem("message-handlers"));
	 if (count == IDC_WATCH_COUNT )
	    EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), FALSE);
	 else if ( count == 0 )
	    EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), FALSE);
	 return (TRUE);
      }

      case WM_COMMAND:
      {  switch (wParam)
	 {  case IDC_OK:
	       SetWatchItem ("compilations",     IsDlgButtonChecked (hDlg, IDC_WATCH_COMPILE),NULL);
	       SetWatchItem ("statistics",       IsDlgButtonChecked (hDlg, IDC_WATCH_STATS),NULL);
#if DEFTEMPLATE_CONSTRUCT
	       SetWatchItem ("facts",            IsDlgButtonChecked (hDlg, IDC_WATCH_FACTS),NULL);
#endif
#if OBJECT_SYSTEM
	       SetWatchItem ("instances",        IsDlgButtonChecked (hDlg, IDC_WATCH_INSTANCE),NULL);
	       SetWatchItem ("slots",            IsDlgButtonChecked (hDlg, IDC_WATCH_SLOT),NULL);
	       SetWatchItem ("messages",         IsDlgButtonChecked (hDlg, IDC_WATCH_MESSAGE),NULL);
	       SetWatchItem ("message-handlers", IsDlgButtonChecked (hDlg, IDC_WATCH_MSGHANDLER),NULL);
#endif
#if DEFFUNCTION_CONSTRUCT
	       SetWatchItem ("deffunctions",     IsDlgButtonChecked (hDlg, IDC_WATCH_DEFFUN),NULL);
#endif
#if DEFRULE_CONSTRUCT
	       SetWatchItem ("rules",            IsDlgButtonChecked (hDlg, IDC_WATCH_RULES),NULL);
	       SetWatchItem ("activations",      IsDlgButtonChecked (hDlg, IDC_WATCH_ACTIVE),NULL);
	       SetWatchItem ("focus",            IsDlgButtonChecked (hDlg, IDC_WATCH_FOCUS),NULL);
#endif
#if DEFGENERIC_CONSTRUCT
	       SetWatchItem ("generic-functions",IsDlgButtonChecked (hDlg, IDC_WATCH_GENERIC),NULL);
	       SetWatchItem ("methods",          IsDlgButtonChecked (hDlg, IDC_WATCH_METHOD),NULL);
#endif
#if DEFGLOBAL_CONSTRUCT
	       SetWatchItem ("globals",          IsDlgButtonChecked (hDlg, IDC_WATCH_GLOBAL),NULL);
#endif

	    case IDC_CANCEL:
	    {  EndDialog ( hDlg, IDOK);
	       return ( TRUE );
	    }

	    case IDC_WATCH_COMPILE:
	    case IDC_WATCH_FACTS:
	    case IDC_WATCH_INSTANCE:
	    case IDC_WATCH_RULES:
	    case IDC_WATCH_GENERIC:
	    case IDC_WATCH_MESSAGE:
	    case IDC_WATCH_DEFFUN:
	    case IDC_WATCH_STATS:
	    case IDC_WATCH_GLOBAL:
	    case IDC_WATCH_SLOT:
	    case IDC_WATCH_METHOD:
	    case IDC_WATCH_MSGHANDLER:
	    case IDC_WATCH_ACTIVE:
	    case IDC_WATCH_FOCUS:
	    {  if (IsDlgButtonChecked (hDlg, wParam))
	       {  SetCheckBox ( hDlg, wParam, 0);
		  count --;
	       }
	       else
	       {  SetCheckBox(hDlg, wParam, 1);
		  count++;
	       }
	       if (count == IDC_WATCH_COUNT )
		  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), FALSE);
	       else if ( count == 0 )
		  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), FALSE);
	       else
	       {  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), TRUE);
		  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE ), TRUE);
	       }
	       return (TRUE);
	    }

	    case IDC_WATCH_ALL:
		 {  WORD x;
	       for ( x=IDC_WATCH_START; x<=IDC_WATCH_END; x++)
		  SetCheckBox ( hDlg,x,1);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), FALSE);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), TRUE);
	       count = IDC_WATCH_COUNT;
	       return ( TRUE );
	    }

	    case IDC_WATCH_NONE:
	    {  WORD x;
	       for ( x=IDC_WATCH_START; x<=IDC_WATCH_END; x++)
		  SetCheckBox ( hDlg,x,0);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), FALSE);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), TRUE);
	       count = 0;
	       return ( TRUE );
	    }
	 }
      }
   }
   return ( FALSE );
}
Exemple #13
0
BOOL FAR PASCAL OptionDlgProc (
   HWND     hDlg,
   unsigned message,
   WORD     wParam,
   LONG     lParam)

{  static char Number[4];

   switch (message)
   {  case WM_INITDIALOG:
      {  extern BOOL Complete;
	 SetCheckBox ( hDlg, IDC_WARN_JOE, warnings);
	 SetCheckBox ( hDlg, IDC_PREF_COMPLETE, Complete );
	 SendDlgItemMessage ( hDlg, IDC_EDIT, EM_LIMITTEXT, 3, 0 );
	 sprintf(Number,"%d", rulestep );
	 SendDlgItemMessage(hDlg, IDC_EDIT, WM_SETTEXT,0, (LONG)Number);
	 return (TRUE);
      }

      case WM_COMMAND:
      {  switch (wParam)
	 {  case IDC_WARN_JOE:
	    case IDC_PREF_COMPLETE:
	    {  SetCheckBox(hDlg, wParam, !(IsDlgButtonChecked (hDlg, wParam)));
	       return (TRUE);
	    }

	    case IDC_OK:
	    {  extern BOOL Complete;
	       int temp;
	       int x;
	       int flag = 0;

	       SendDlgItemMessage ( hDlg, IDC_EDIT, WM_GETTEXT,4, (LONG)Number);
	       temp = atoi (Number);
	       for (x=0; x<strlen(Number); x++)
		  if ( !isdigit (Number[x]))
		     flag=1;
		     
	       if (temp < 1 || temp > 999 || flag)
	       {  sprintf(Number,"%d", rulestep );
		  SendDlgItemMessage ( hDlg, IDC_EDIT, WM_SETTEXT,0, (LONG)Number);
		  MessageBeep(0);
		  MessageBox(hDlg,"Must be between 1 and 999 inclusive",
		     "Step Rule Firing Increment", MB_ICONHAND|MB_OK);
		  SetFocus(GetDlgItem(hDlg, IDC_EDIT));
		  break;
	       }
	       rulestep = temp;

	       warnings = IsDlgButtonChecked (hDlg, IDC_WARN_JOE);
	       Complete = IsDlgButtonChecked (hDlg, IDC_PREF_COMPLETE);
	    }

	    case IDC_CANCEL:
	    {  EndDialog ( hDlg, IDOK );
	       return TRUE;
	    }
	 }
      }
   }
   return ( FALSE );
}
Exemple #14
0
BOOL FAR PASCAL ExecDlg (
   HWND       hDlg,
   unsigned   message,
   WORD       wParam,
   LONG       lParam)

{  switch (message)
   {  case WM_INITDIALOG:
      {  WPARAM item;
	 SetWindowText ( hDlg, (LPSTR)"Execution Options" );

	 /*-----------------------------+
	 | Initalize Strategy Combo Box |
	 +-----------------------------*/
#if CONFLICT_RESOLUTION_STRATEGIES
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Depth"));
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Breadth"));
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "LEX"));
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "MEA"));
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Complexity"));
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Simplicity"));
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Random"));

	 switch (  GetStrategy())
	 {   case DEPTH_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"Depth"));
		  break;
	     case BREADTH_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"Breadth"));
		  break;
	     case LEX_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"LEX"));
		  break;
	     case MEA_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"MEA"));
		  break;
	     case COMPLEXITY_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"Complexity"));
		  break;
	     case SIMPLICITY_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"Simplicity"));
		  break;
	     case RANDOM_STRATEGY:
		  item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"Random"));
		  break;
	 }
#else
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Depth"));
	 item = (int) SendDlgItemMessage(hDlg,IDC_EXE_STRATEGY,CB_FINDSTRING,0,(LPARAM)((LPSTR)"Depth"));
#endif
	 SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_SETCURSEL, item, 0);

	 /*-----------------------------+
	 | Initalize Salience Combo Box |
	 +-----------------------------*/
#if DYNAMIC_SALIENCE
	 SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_ADDSTRING,0,(LPARAM)((LPSTR) "When Defined"));
	 SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_ADDSTRING,0,(LPARAM)((LPSTR) "When Activated"));
	 SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_ADDSTRING,0,(LPARAM)((LPSTR) "Every Cycle"));

	 switch (GetSalienceEvaluation())
	 {   case WHEN_DEFINED:
		item = (int) SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_FINDSTRING,0,(LPARAM)((LPSTR) "When Defined"));
		break;
	     case WHEN_ACTIVATED:
		item = (int) SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_FINDSTRING,0,(LPARAM)((LPSTR) "When Activated"));
		break;
	     case EVERY_CYCLE:
		item = (int) SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_FINDSTRING,0,(LPARAM)((LPSTR) "Every Cycle"));
		break;
	 }
#else
	 SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_ADDSTRING,0,(LPARAM)((LPSTR) "When Defined"));
	 item = SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_FINDSTRING,0,(LPARAM)((LPSTR) "When Defined"));
#endif
	 SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_SETCURSEL, item, 0);

	  /*-----------------------------------+
	 | Disable Incremental reset check box |
	 | if any rules are in the system.     |
	 +------------------------------------*/
	 if ( GetNextDefrule (NULL) != NULL )
	 {  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), TRUE);
	 }

	 /*----------------------------+
	 | Initalize Other Check Boxes |
	 +----------------------------*/
	 SetCheckBox(hDlg, IDC_EXE_STATIC, GetStaticConstraintChecking());
	 SetCheckBox(hDlg, IDC_EXE_DYNAMIC, GetDynamicConstraintChecking());
	 SetCheckBox(hDlg, IDC_EXE_AUTO, GetAutoFloatDividend());
#if DEFGLOBAL_CONSTRUCT
	 SetCheckBox(hDlg, IDC_EXE_GLOBAL, GetResetGlobals());
#endif
#if DEFTEMPLATE_CONSTRUCT
	 SetCheckBox(hDlg, IDC_EXE_FACT, GetFactDuplication());
#endif
#if INCREMENTAL_RESET & (! RUN_TIME)
	 SetCheckBox(hDlg, IDC_EXE_RESET, GetIncrementalReset());
#endif
#if (!RUN_TIME)
	 SetCheckBox(hDlg, IDC_EXE_SEQUENCE, GetSequenceOperatorRecognition());
#endif
	 return (TRUE);
      }

      case WM_COMMAND:
      {  switch ( wParam )
	 {  case IDC_OK:
	    {  int value;
			 char Msg[40];

#if DYNAMIC_SALIENCE
	       /*--------------------------+
	       | Decode Salience Combo Box |
	       +--------------------------*/
	       value = (int) SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_GETCURSEL, 0, 0);

			 SendDlgItemMessage (hDlg, IDC_EXE_SALIENCE, CB_GETLBTEXT, value, (LONG)Msg );

			 if ( strcmp (Msg, "When Defined"  ) == 0 )
		  SetSalienceEvaluation(WHEN_DEFINED);
			 else if (strcmp(Msg, "When Activated" ) == 0)
		  SetSalienceEvaluation(WHEN_ACTIVATED);
	       else
		  SetSalienceEvaluation(EVERY_CYCLE);
#endif

#if CONFLICT_RESOLUTION_STRATEGIES
	       /*--------------------------+
	       | Decode Strategy Combo Box |
	       +--------------------------*/
	       value = (int) SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_GETCURSEL, 0, 0);
	       SendDlgItemMessage (hDlg, IDC_EXE_STRATEGY, CB_GETLBTEXT, value, (LONG)Msg );

			 if ( strcmp (Msg, "Depth"  ) == 0 )
		  SetStrategy(DEPTH_STRATEGY);
			 else if (strcmp(Msg, "Breadth" ) == 0)
		  SetStrategy(BREADTH_STRATEGY);
			 else if (strcmp(Msg, "LEX") == 0 )
		  SetStrategy(LEX_STRATEGY);
			 else if (strcmp(Msg, "MEA") == 0 )
		  SetStrategy(MEA_STRATEGY);
			 else if (strcmp(Msg, "Complexity") == 0 )
		  SetStrategy(COMPLEXITY_STRATEGY);
			 else if (strcmp(Msg, "Simplicity") == 0 )
		  SetStrategy(SIMPLICITY_STRATEGY);
	       else
		  SetStrategy(RANDOM_STRATEGY);
#endif

			 /*-------------------------+
	       | Decode Other Check Boxes |
	       +-------------------------*/
	       SetStaticConstraintChecking ( IsDlgButtonChecked(hDlg, IDC_EXE_STATIC));
	       SetDynamicConstraintChecking ( IsDlgButtonChecked(hDlg, IDC_EXE_DYNAMIC));
			 SetAutoFloatDividend ( IsDlgButtonChecked(hDlg, IDC_EXE_AUTO));

#if DEFGLOBAL_CONSTRUCT
	       SetResetGlobals ( IsDlgButtonChecked(hDlg, IDC_EXE_GLOBAL));
#endif
#if DEFTEMPLATE_CONSTRUCT
	       SetFactDuplication( IsDlgButtonChecked(hDlg, IDC_EXE_FACT));
#endif
#if INCREMENTAL_RESET & (! RUN_TIME )
	       SetIncrementalReset ( IsDlgButtonChecked(hDlg, IDC_EXE_RESET));
#endif
#if ( ! RUN_TIME )
	       SetSequenceOperatorRecognition ( IsDlgButtonChecked(hDlg, IDC_EXE_SEQUENCE));
#endif
		 }

	    case IDC_CANCEL:
		 {  EndDialog( hDlg, IDOK);
			 return (TRUE);
	    }

	    /*-------------------+
	    | Toggle Check Boxes |
	    +-------------------*/
	    case IDC_EXE_RESET:
	    case IDC_EXE_STATIC:
	    case IDC_EXE_DYNAMIC:
	    case IDC_EXE_GLOBAL:
	    case IDC_EXE_FACT:
	    case IDC_EXE_AUTO:
	    case IDC_EXE_SEQUENCE:
	    {  SetCheckBox ( hDlg, wParam, !IsDlgButtonChecked (hDlg, wParam));
	       return (TRUE);
	    }

	 }
      }
   }
   return (FALSE);
}
void cScreenGangs::init()
{
	if(!g_InitWin)
		return;

	Focused();
	g_InitWin = false;

////////////////////

	cConfig cfg;

	selection = GetLastSelectedItemFromList(ganglist_id);
	sel_recruit = GetLastSelectedItemFromList(recruitlist_id);

	int cost = tariff.goon_mission_cost(MISS_GUARDING);
	ss.str("");
	ss << "Gangs: " << cost << " gold / week";
	EditTextItem(ss.str(), gangcost_id);

	ClearListBox(missionlist_id);
	AddToListBox(missionlist_id, 0, "GUARDING");
	AddToListBox(missionlist_id, 1, "SABOTAGE");
	AddToListBox(missionlist_id, 2, "SPY ON GIRLS");
	AddToListBox(missionlist_id, 3, "RECAPTURE");
	AddToListBox(missionlist_id, 4, "ACQUIRE TERRITORY");
	AddToListBox(missionlist_id, 5, "PETTY THEFT");
	AddToListBox(missionlist_id, 6, "GRAND THEFT");
	AddToListBox(missionlist_id, 7, "KIDNAPPING");
	AddToListBox(missionlist_id, 8, "CATACOMBS");
	AddToListBox(missionlist_id, 9, "TRAINING");
	AddToListBox(missionlist_id, 10, "RECRUITING");

	SetCheckBox(netautobuy_id, (g_Gangs.GetNetRestock() > 0));
	SetCheckBox(healautobuy_id, (g_Gangs.GetHealingRestock() > 0));

	// weapon upgrades
	int *wlev = g_Gangs.GetWeaponLevel();
	ss.str("");
	ss << "Weapon Level: " << *wlev;
	if((*wlev) < 4)
	{
		EnableButton(weaponup_id);
		ss << " Next: "
		   << tariff.goon_weapon_upgrade(*wlev)
		   << "g";
	}
	else
		DisableButton(weaponup_id);
	std::string s = ss.str();
	g_LogFile.ss() << "weapon text = '" << s << "'" << std::endl;
	g_LogFile.ssend();
	EditTextItem(s, weaponlevel_id);

	int *nets = g_Gangs.GetNets();
	ss.str("");
	ss << "Nets ("
	   << tariff.nets_price(1)
	   << "g each): " << *nets;
	DisableButton(netbuy_id, *nets >= 60);
	DisableCheckBox(netautobuy_id, *nets < 1);
	EditTextItem(ss.str(), netdesc_id);

	int *potions = g_Gangs.GetHealingPotions();
	ss.str("");
	ss << "Heal Potions ("
	   << tariff.healing_price(1)
	   << "g each): " <<
	   *potions
	;
	EditTextItem(ss.str(), healdesc_id);
	DisableButton(healbuy_id, *potions >= 200);
	DisableCheckBox(healautobuy_id, *potions < 1);

    std::string message;
	buffer[0] = '\0';
	if(g_Gangs.GetNumGangs() > 0)
	{
		cost = 0;
		for(int i=0; i < g_Gangs.GetNumGangs(); i++)
		{
			sGang* g = g_Gangs.GetGang(i);
			if (g == nullptr)
				g = g_Gangs.GetGang(i-1);

			cost += tariff.goon_mission_cost(g->m_MissionID);
		}
		message = "Weekly Cost: ";
		message += toString(cost);
	}
	else
		message = "Weekly Cost: 0";

	EditTextItem(message, totalcost_id);

	ClearListBox(ganglist_id);

	int num = 0;
	sGang* current = g_Gangs.GetGang(0);

/*
 *		loop through the gangs, populating the list box
 */
	g_LogFile.ss() << "Setting gang mission descriptions" << std::endl;
	g_LogFile.ssend();
	for(current = g_Gangs.GetGang(0); current; current = current->m_Next)
	{
/*
 *			format the string with the gang name, mission and number of men
 */
		std::string Data[9];
		ss.str("");
		ss << current->m_Name;
		Data[0] = ss.str();
		ss.str("");
		ss << current->m_Num;
		Data[1] = ss.str();
		ss.str("");
		ss << short_mission_desc(current->m_MissionID);
		Data[2] = ss.str();
		ss.str("");
		ss << (int)current->m_Skills[SKILL_COMBAT] << "%";
		Data[3] = ss.str();
		ss.str("");
		ss << (int)current->m_Skills[SKILL_MAGIC] << "%";
		Data[4] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_INTELLIGENCE] << "%";
		Data[5] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_AGILITY] << "%";
		Data[6] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_CONSTITUTION] << "%";
		Data[7] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_CHARISMA] << "%";
		Data[8] = ss.str();

//		g_LogFile.ss() << "Gang:\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2]
//			<< "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << "\t" << Data[6] << std::endl;
//      g_LogFile.ssend();

/*
 *			add the box to the list; red highlight gangs that are low on numbers
 */
		AddToListBox( ganglist_id, num++, Data, 9, (current->m_Num < 6 ? LISTBOX_RED : LISTBOX_BLUE) );
	}

	ClearListBox(recruitlist_id);

	num = 0;
	current = g_Gangs.GetHireableGang(0);

/*
 *		loop through the gangs, populating the list box
 */
	g_LogFile.ss() << "Setting recruitable gang info" << std::endl;
	g_LogFile.ssend();
	for(current = g_Gangs.GetHireableGang(0); current; current = current->m_Next)
	{
/*
 *			format the string with the gang name, mission and number of men
 */
		std::string Data[8];
		ss.str("");
		ss << current->m_Name;
		Data[0] = ss.str();
		ss.str("");
		ss << current->m_Num;
		Data[1] = ss.str();
		ss.str("");
		ss << (int)current->m_Skills[SKILL_COMBAT] << "%";
		Data[2] = ss.str();
		ss.str("");
		ss << (int)current->m_Skills[SKILL_MAGIC] << "%";
		Data[3] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_INTELLIGENCE] << "%";
		Data[4] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_AGILITY] << "%";
		Data[5] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_CONSTITUTION] << "%";
		Data[6] = ss.str();
		ss.str("");
		ss << (int)current->m_Stats[STAT_CHARISMA] << "%";
		Data[7] = ss.str();

//		g_LogFile.ss() << "Recruitable\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2]
//			<< "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << std::endl;
//      g_LogFile.ssend();

/*
 *			add the box to the list
 */
		AddToListBox( recruitlist_id, num++, Data, 8, (current->m_Num < 6 ? LISTBOX_RED : LISTBOX_BLUE) );
	}

	if(selection == -1 && GetListBoxSize(ganglist_id) >= 1)
		selection = 0;

	if(selection >= 0)
	{
		while(selection > GetListBoxSize(ganglist_id) && selection != -1)
			selection--;
	}
	if(selection >= 0)
		SetSelectedItemInList(ganglist_id, selection);

	if(sel_recruit == -1 && GetListBoxSize(recruitlist_id) >= 1)
		sel_recruit = 0;
	if(sel_recruit >= 0)
		SetSelectedItemInList(recruitlist_id, sel_recruit);

	DisableButton(ganghire_id, (g_Gangs.GetNumHireableGangs() <= 0)
							|| (g_Gangs.GetNumGangs() >= 8)
							|| (sel_recruit == -1));
	DisableButton(gangfire_id, (g_Gangs.GetNumGangs() <= 0)
							|| (selection == -1));

	potions = nullptr;
	wlev = nullptr;
	nets = nullptr;
}
INT_PTR CALLBACK CSMOpts::OptionDialogProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
	static CSMOpts *imp = NULL;

	switch( message ) 
	{
		case WM_INITDIALOG:	// 初始化选项对话框
			{
				imp = reinterpret_cast< CSMOpts* >( lParam );
				CenterWindow( hWnd,GetParent( hWnd ) );

				m_hCheckAnim		= GetDlgItem( hWnd, IDC_CHECK_ANIM );
				m_hListAnim		= GetDlgItem( hWnd, IDC_LIST_ANIM );
				m_hBtnAddAnim		= GetDlgItem( hWnd, IDC_BUTTON_ADD );
				m_hBtnEditAnim	= GetDlgItem( hWnd, IDC_BUTTON_EDIT );
				m_hBtnDelAnim		= GetDlgItem( hWnd, IDC_BUTTON_DELETE );

				m_hCheckTag		=	GetDlgItem( hWnd, IDC_CHECK_TAGS );
				m_hBtnHead		=	GetDlgItem( hWnd, IDC_BUTTON_HEAD );
				m_hBtnUpper		=	GetDlgItem( hWnd, IDC_BUTTON_UPPER );
				m_hBtnLower		=	GetDlgItem( hWnd, IDC_BUTTON_LOWER );
				m_hBtnProp		=	GetDlgItem( hWnd, IDC_BUTTON_PROPERTY );
				m_hBtnHeadX		=	GetDlgItem( hWnd, IDC_BUTTON_HEAD_X );
				m_hBtnUpperX	=	GetDlgItem( hWnd, IDC_BUTTON_UPPER_X );
				m_hBtnLowerX	=	GetDlgItem( hWnd, IDC_BUTTON_LOWER_X );
				m_hBtnPropX		=	GetDlgItem( hWnd, IDC_BUTTON_PROPERTY_X );
				m_hCheckProp	=	GetDlgItem( hWnd, IDC_CHECK_PROPERTY );
				m_hComBoxMount	=	GetDlgItem( hWnd, IDC_COMBO_MOUNTTO );

				SendMessage( m_hListAnim, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ( LPARAM )LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );
				// 创建动画列表的列标题
				LVCOLUMN listCol;
				memset( &listCol, 0, sizeof( LVCOLUMN ) );
				listCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_FMT | LVCF_SUBITEM;
				listCol.fmt = LVCFMT_LEFT;
				listCol.pszText = "Name";
				listCol.cchTextMax = sizeof( listCol.pszText );
				listCol.cx = 80;
				listCol.iSubItem = 0;
				SendMessage( m_hListAnim, LVM_INSERTCOLUMN, 0, ( LPARAM )&listCol );
				listCol.pszText = "First Frame";
				listCol.cchTextMax = sizeof( listCol.pszText );
				listCol.cx = 80;
				listCol.iSubItem = 0;
				SendMessage( m_hListAnim, LVM_INSERTCOLUMN, 1, ( LPARAM )&listCol );
				listCol.pszText = "Last Frame";
				listCol.cchTextMax = sizeof( listCol.pszText );
				listCol.cx = 80;
				listCol.iSubItem = 0;
				SendMessage( m_hListAnim, LVM_INSERTCOLUMN, 2, ( LPARAM )&listCol );

				SetCheckBox( hWnd, IDC_CHECK_ANIM, FALSE );
				imp->EnableAnimControls( FALSE );
				
				if ( FALSE )//imp->GetNumObj() < 3 )
				{
					// 不足以导出头部、上身、下身,禁止TAG
					SetCheckBox( hWnd, IDC_CHECK_TAGS, FALSE );
					imp->EnableTagControls( imp->IfExportTags() );

					EnableWindow( m_hCheckTag, FALSE );
				}
				else
				{
					SetCheckBox( hWnd, IDC_CHECK_TAGS, FALSE );
					imp->EnableTagControls( FALSE );

					string str;
					str = "Upper";
					SendMessage( m_hComBoxMount, CB_ADDSTRING, 0, ( LPARAM )str.c_str() );
					str = "Head";
					SendMessage( m_hComBoxMount, CB_ADDSTRING, 0, ( LPARAM )str.c_str() );
					str = "Lower";
					SendMessage( m_hComBoxMount, CB_ADDSTRING, 0, ( LPARAM )str.c_str() );

				}

				return TRUE;
			}

		case WM_COMMAND:
			switch( wParam )
			{
			case IDC_CHECK_ANIM:
				imp->EnableAnimControls( IsDlgButtonChecked( hWnd, IDC_CHECK_ANIM ) );
				break;
			case IDC_CHECK_TAGS:
				imp->EnableTagControls( IsDlgButtonChecked( hWnd, IDC_CHECK_TAGS ) );
				break;
			case IDC_CHECK_PROPERTY:
				imp->EnablePropControls( IsDlgButtonChecked( hWnd, IDC_CHECK_PROPERTY ) );
				break;
			case IDC_BUTTON_ADD:	// 添加动画
				{
					imp->SetEditingAnim( FALSE );
					if ( TRUE == imp->ShowAnimDialog() )
					{
						AnimRecord &newAnim = imp->GetNewAnimRecord();

						int itemCount = SendMessage( m_hListAnim, LVM_GETITEMCOUNT, 0, 0 );
						
						LVITEM listItem;
						memset( &listItem, 0, sizeof( LVITEM ) );

						char buffer[64];
						ZeroMemory( buffer, 64 );
						strcpy( buffer, newAnim.animName.c_str() );
						listItem.mask = LVIF_TEXT;
						listItem.cchTextMax = static_cast< int >( newAnim.animName.size() );
						listItem.pszText = buffer;
						listItem.iItem = itemCount;
						listItem.iSubItem = 0;
						SendMessage( m_hListAnim, LVM_INSERTITEM, 0, ( LPARAM )&listItem );

						itoa( newAnim.firstFrame, buffer, 10 );
						listItem.cchTextMax = sizeof( buffer );
						listItem.pszText = buffer;
						listItem.iItem = itemCount;
						listItem.iSubItem = 1;
						SendMessage( m_hListAnim, LVM_SETITEM, 0, ( LPARAM )&listItem );

						itoa( newAnim.lastFrame, buffer, 10 );
						listItem.cchTextMax = sizeof( buffer );
						listItem.pszText = buffer;
						listItem.iItem = itemCount;
						listItem.iSubItem = 2;
						SendMessage( m_hListAnim, LVM_SETITEM, 0, ( LPARAM )&listItem );

						imp->SetSettedFrame( max( newAnim.lastFrame, imp->GetSettedFrame() ) );
					}
					break;
				}
			case IDC_BUTTON_EDIT:	// 编辑动画
				{
					int nSel = -1;
					nSel = SendMessage( m_hListAnim, LVM_GETSELECTIONMARK, 0, 0 );
					int nSelCount = SendMessage( m_hListAnim, LVM_GETSELECTEDCOUNT, 0, 0 );
					if ( nSelCount != 0 )
					{
						AnimRecord curAnim;

						LVITEM listItem;
						memset( &listItem, 0, sizeof( LVITEM ) );

						char buffer[64];
						ZeroMemory( buffer, 64 );
						listItem.mask = LVIF_TEXT;
						listItem.iItem = nSel;
						listItem.cchTextMax = 64;
						listItem.pszText = buffer;
						listItem.iSubItem = 0;
						SendMessage( m_hListAnim, LVM_GETITEM, 0, ( LPARAM )&listItem );
						curAnim.animName = listItem.pszText;

						listItem.iSubItem = 1;
						SendMessage( m_hListAnim, LVM_GETITEM, 0, ( LPARAM )&listItem );
						curAnim.firstFrame = atoi( listItem.pszText );
						
						listItem.iSubItem = 2;
						SendMessage( m_hListAnim, LVM_GETITEM, 0, ( LPARAM )&listItem );
						curAnim.lastFrame = atoi( listItem.pszText );

						imp->SetCurAnimRecord( curAnim.animName, curAnim.firstFrame, curAnim.lastFrame );

						imp->SetEditingAnim( TRUE );
						if ( TRUE == imp->ShowAnimDialog() )
						{
							curAnim = imp->GetCurAnimRecord();
							
							ZeroMemory( buffer, 64 );
							strcpy( buffer, curAnim.animName.c_str() );
							listItem.iSubItem = 0;
							listItem.pszText = buffer;
							SendMessage( m_hListAnim, LVM_SETITEM, 0, ( LPARAM )&listItem );

							itoa( curAnim.firstFrame, buffer, 10 );
							listItem.iSubItem = 1;
							listItem.pszText = buffer;
							SendMessage( m_hListAnim, LVM_SETITEM, 0, ( LPARAM )&listItem );

							itoa( curAnim.lastFrame, buffer, 10 );
							listItem.iSubItem = 2;
							listItem.pszText = buffer;
							SendMessage( m_hListAnim, LVM_SETITEM, 0, ( LPARAM )&listItem );
						}
					}
					break;
				}
			case IDC_BUTTON_DELETE:	// 删除动画
				{
					int nSel = -1;
					nSel = SendMessage( m_hListAnim, LVM_GETSELECTIONMARK, 0, 0 );
					int nSelCount = SendMessage( m_hListAnim, LVM_GETSELECTEDCOUNT, 0, 0 );
					if ( nSelCount != 0 )
					{
						SendMessage( m_hListAnim, LVM_DELETEITEM, nSel, 0 );
					}
					break;
				}
			case IDC_BUTTON_HEAD: // 选择头部
				{
					if ( TRUE == imp->ShowObjListDialog() )
					{
						imp->m_sHeadNode = imp->m_sGettingNode;
						SetDlgItemText( hWnd, IDC_EDIT_HEAD, imp->m_sHeadNode.c_str() );
					}
					break;
				}
			case IDC_BUTTON_UPPER: // 选择上半身
				{
					if ( TRUE == imp->ShowObjListDialog() )
					{
						imp->m_sUpperNode = imp->m_sGettingNode;
						SetDlgItemText( hWnd, IDC_EDIT_UPPER, imp->m_sUpperNode.c_str() );
					}
					break;
				}
			case IDC_BUTTON_LOWER: // 选择下半身
				{
					if ( TRUE == imp->ShowObjListDialog() )
					{
						imp->m_sLowerNode = imp->m_sGettingNode;
						SetDlgItemText( hWnd, IDC_EDIT_LOWER, imp->m_sLowerNode.c_str() );
					}
					break;
				}
			case IDC_BUTTON_PROPERTY: // 选择道具
				{
					if ( TRUE == imp->ShowObjListDialog() )
					{
						imp->m_sPropNode = imp->m_sGettingNode;
						SetDlgItemText( hWnd, IDC_EDIT_PROPERTY, imp->m_sPropNode.c_str() );
					}
					break;
				}
			case IDC_BUTTON_HEAD_X: // 取消头部的选择
				{
					imp->m_sHeadNode = "";
					SetDlgItemText( hWnd, IDC_EDIT_HEAD, imp->m_sHeadNode.c_str() );
					break;
				}
			case IDC_BUTTON_UPPER_X: // 取消上半身的选择
				{
					imp->m_sUpperNode = "";
					SetDlgItemText( hWnd, IDC_EDIT_UPPER, imp->m_sUpperNode.c_str() );
					break;
				}
			case IDC_BUTTON_LOWER_X: // 取消下半身的选择
				{
					imp->m_sLowerNode = "";
					SetDlgItemText( hWnd, IDC_EDIT_LOWER, imp->m_sLowerNode.c_str() );
					break;
				}
			case IDC_BUTTON_PROPERTY_X: // 取消道具的选择
				{
					imp->m_sPropNode = "";
					SetDlgItemText( hWnd, IDC_EDIT_PROPERTY, imp->m_sPropNode.c_str() );
					break;
				}
			case IDC_OK:	// 确定
				{
					// 是否导出动画、TAG、道具
					imp->SetExportAnim( hWnd, IsDlgButtonChecked( hWnd, IDC_CHECK_ANIM ) );
					imp->SetExportTags( hWnd, IsDlgButtonChecked( hWnd, IDC_CHECK_TAGS ) );
					imp->SetExportProp( hWnd, IsDlgButtonChecked( hWnd, IDC_CHECK_PROPERTY ) );

					if ( imp->IfExportAnim() == TRUE )
					{
						// 从UI获取动画数据
						int animCount = SendMessage( m_hListAnim, LVM_GETITEMCOUNT, 0, 0 );
						for ( int i = 0; i < animCount; i ++ )
						{
							AnimRecord anim;

							LVITEM listItem;
							memset( &listItem, 0, sizeof( LVITEM ) );

							char buffer[64];
							ZeroMemory( buffer, 64 );
							listItem.mask = LVIF_TEXT;
							listItem.iItem = i;
							listItem.cchTextMax = 64;
							listItem.pszText = buffer;
							listItem.iSubItem = 0;
							SendMessage( m_hListAnim, LVM_GETITEM, 0, ( LPARAM )&listItem );
							anim.animName = listItem.pszText;

							listItem.iSubItem = 1;
							SendMessage( m_hListAnim, LVM_GETITEM, 0, ( LPARAM )&listItem );
							anim.firstFrame = atoi( listItem.pszText );

							listItem.iSubItem = 2;
							SendMessage( m_hListAnim, LVM_GETITEM, 0, ( LPARAM )&listItem );
							anim.lastFrame = atoi( listItem.pszText );

							imp->AddAnimRecord( anim );
						}
					}

					if ( imp->IfExportTags() == TRUE )
					{
						char buf[64];
						ZeroMemory( buf, 64 );
						GetDlgItemText( hWnd, IDC_EDIT_HEAD, buf, 64 );
						imp->m_sHeadNode = buf;

						ZeroMemory( buf, 64 );
						GetDlgItemText( hWnd, IDC_EDIT_UPPER, buf, 64 );
						imp->m_sUpperNode = buf;

						ZeroMemory( buf, 64 );
						GetDlgItemText( hWnd, IDC_EDIT_LOWER, buf, 64 );
						imp->m_sLowerNode = buf;

						if ( imp->IfExprotProperty() )
						{
							ZeroMemory( buf, 64 );
							GetDlgItemText( hWnd, IDC_EDIT_PROPERTY, buf, 64 );
							imp->m_sPropNode = buf;

							int curSel = SendMessage( m_hComBoxMount, CB_GETCURSEL, 0, 0 );
							ZeroMemory( buf, 64 );
							SendMessage( m_hComBoxMount, CB_GETLBTEXT, ( WPARAM )curSel, ( LPARAM )buf );
							imp->m_propMountTo = buf;
						}
					}

					EndDialog( hWnd, IDOK );
					return TRUE;
				}

			case IDC_CANCEL:	// 取消
				EndDialog( hWnd, 0 );
				return TRUE;	
			}
			return TRUE;

		case WM_CLOSE:
			EndDialog( hWnd, 0 );
			return TRUE;
	}
	return 0;
}
void cScreenGirlDetails::init()
{
	if (selected_girl == 0)
	{
		g_WinManager.Pop();
		g_InitWin = true;
		g_LogFile.write("ERROR - girl details screen, selected_girl is null");
		/*
		*		adding this because the game will crash if we
		*		go past this point with a null girl
		*
		*		Now as to why it was null in the first place ...
		*		-- doc
		*/
		return;
	}

	g_CurrentScreen = SCREEN_GIRLDETAILS;
	if (!g_InitWin) return;

	Focused();
	g_InitWin = false;

	////////////////////
	if (selected_girl->health() <= 0)
	{
		// `J` instead of removing dead girls from the list which breaks the game, just skip past her in the list.
		NextGirl();								// `J` currently this prevents scrolling backwards past her - need to fix that.
//		selected_girl = remove_selected_girl();
		if (selected_girl == 0)
		{
			g_WinManager.Pop();
			g_InitWin = true;
			return;
		}
	}

	u_int job = (Day0Night1 ? selected_girl->m_NightJob : selected_girl->m_DayJob);
	SetJob = true;

	EditTextItem(selected_girl->m_Realname, girlname_id);

	string detail;
	if (DetailLevel == 0)		detail = g_Girls.GetDetailsString(selected_girl);
	else if (DetailLevel == 1)	detail = g_Girls.GetMoreDetailsString(selected_girl);
	else						detail = g_Girls.GetThirdDetailsString(selected_girl);
	EditTextItem(detail, girldesc_id);

	if (selected_girl)
	{
		if (lastsexact != -1)
		{
			PrepareImage(girlimage_id, selected_girl, lastsexact, true, ImageNum);
			lastsexact = -1;
		}
		else
		{
			if (selected_girl->m_newRandomFixed >= 0)
			{
				PrepareImage(girlimage_id, selected_girl, IMGTYPE_PROFILE, false, selected_girl->m_newRandomFixed);
			}
			else
			{
				PrepareImage(girlimage_id, selected_girl, IMGTYPE_PROFILE, true, ImageNum);
			}
		}
	}

	SliderRange(houseperc_id, 0, 100, g_Girls.GetStat(selected_girl, STAT_HOUSE), 10);
	ss.str("");
	ss << gettext("House Percentage: ") << SliderValue(houseperc_id) << gettext("%");
	EditTextItem(ss.str(), housepercval_id);

	ClearListBox(jobtypelist_id);

	// `J` Replacing accom buttons with slider
	if (accomdown_id != -1)	DisableButton(accomdown_id, selected_girl->m_AccLevel < 1);
	if (accomup_id != -1)	DisableButton(accomup_id, selected_girl->m_AccLevel > 9);
	if (accom_id != -1)
	{
		SliderRange(accom_id, 0, 9, selected_girl->m_AccLevel, 1);
		SliderMarker(accom_id, g_Girls.PreferredAccom(selected_girl));
	}
	if (accomval_id != -1)
	{
		stringstream acc;
		acc << "Accommodation: " << g_Girls.Accommodation(SliderValue(accom_id));
		if (cfg.debug.log_extradetails())
		{
			int val = SliderValue(accom_id) - g_Girls.PreferredAccom(selected_girl);
			if (val != 0) acc << "  ( " << (val > 0 ? "+" : "") << val << " )";
		}
		EditTextItem(acc.str(), accomval_id);
	}
	DisableButton(interact_id, (g_TalkCount <= 0));
	DisableButton(takegold_id, (selected_girl->m_Money <= 0));
	SetCheckBox(antipreg_id, (selected_girl->m_UseAntiPreg));

	bool InMovieStudio = (selected_girl->m_InStudio);
	bool InArena = (selected_girl->m_InArena);
	bool InCentre = (selected_girl->m_InCentre);
	bool InClinic = (selected_girl->m_InClinic);
	bool InHouse = (selected_girl->m_InHouse);
	bool InFarm = (selected_girl->m_InFarm);
	bool InDungeon = (selected_girl->m_DayJob == JOB_INDUNGEON);
	DisableButton(reldungeon_id, !InDungeon);
	DisableButton(senddungeon_id, InDungeon);

	// Disable dungeon if selected girl is in a non-brothel building
//	if (InMovieStudio || InArena || InCentre || InClinic || InFarm || InHouse) 
//	{
//		DisableButton(senddungeon_id, true);
//	}

	if (InArena)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_ARENASTAFF, g_Arena.m_JobManager.JobFilterName[JOBFILTER_ARENASTAFF]);
		AddToListBox(jobtypelist_id, JOBFILTER_ARENA, g_Arena.m_JobManager.JobFilterName[JOBFILTER_ARENA]);
		RefreshJobList();
		if (job >= g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENA] && job < g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENA + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_ARENA);
		else // if (job >= g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENASTAFF] && job < g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENASTAFF + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_ARENASTAFF);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InClinic)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_CLINIC, g_Clinic.m_JobManager.JobFilterName[JOBFILTER_CLINIC]);
		AddToListBox(jobtypelist_id, JOBFILTER_CLINICSTAFF, g_Clinic.m_JobManager.JobFilterName[JOBFILTER_CLINICSTAFF]);
		RefreshJobList();
		if (job >= g_Clinic.m_JobManager.JobFilterIndex[JOBFILTER_CLINIC] && job < g_Clinic.m_JobManager.JobFilterIndex[JOBFILTER_CLINIC + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_CLINIC);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_CLINICSTAFF);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InCentre)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_COMMUNITYCENTRE, g_Centre.m_JobManager.JobFilterName[JOBFILTER_COMMUNITYCENTRE]);
		AddToListBox(jobtypelist_id, JOBFILTER_COUNSELINGCENTRE, g_Centre.m_JobManager.JobFilterName[JOBFILTER_COUNSELINGCENTRE]);
		RefreshJobList();
		if (job >= g_Centre.m_JobManager.JobFilterIndex[JOBFILTER_COUNSELINGCENTRE] && job < g_Centre.m_JobManager.JobFilterIndex[JOBFILTER_COUNSELINGCENTRE + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_COUNSELINGCENTRE);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_COMMUNITYCENTRE);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InHouse)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_HOUSE, g_House.m_JobManager.JobFilterName[JOBFILTER_HOUSE]);
		SetSelectedItemInList(jobtypelist_id, JOBFILTER_HOUSE);
		RefreshJobList();
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InMovieStudio)
	{
		Day0Night1 = SHIFT_NIGHT;
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_STUDIOCREW, g_Studios.m_JobManager.JobFilterName[JOBFILTER_STUDIOCREW]);
		AddToListBox(jobtypelist_id, JOBFILTER_MOVIESTUDIO, g_Studios.m_JobManager.JobFilterName[JOBFILTER_MOVIESTUDIO]);
		RefreshJobList();
		if (job >= g_Studios.m_JobManager.JobFilterIndex[JOBFILTER_MOVIESTUDIO] && job < g_Studios.m_JobManager.JobFilterIndex[JOBFILTER_MOVIESTUDIO + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_MOVIESTUDIO);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_STUDIOCREW);
		HideButton(day_id, true);
		HideButton(night_id, true);

	}
	else if (InFarm)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_FARMSTAFF, g_Farm.m_JobManager.JobFilterName[JOBFILTER_FARMSTAFF]);
		AddToListBox(jobtypelist_id, JOBFILTER_LABORERS, g_Farm.m_JobManager.JobFilterName[JOBFILTER_LABORERS]);
		AddToListBox(jobtypelist_id, JOBFILTER_PRODUCERS, g_Farm.m_JobManager.JobFilterName[JOBFILTER_PRODUCERS]);
		RefreshJobList();
		if (job >= g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_LABORERS] && job < g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_LABORERS + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_LABORERS);
		else if (job >= g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_PRODUCERS] && job < g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_PRODUCERS + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_PRODUCERS);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_FARMSTAFF);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));

	}
	else if (!InDungeon)
	{  // if not in dungeon, set up job lists
		// add the job filters
		//	for(int i=0; i<NUMJOBTYPES; i++)  // loop through all job types
		for (unsigned int i = 0; i <= JOBFILTER_BROTHEL; i++)  // temporary limit to job types shown
		{
			AddToListBox(jobtypelist_id, i, g_Brothels.m_JobManager.JobFilterName[i]);
		}

		// set the job filter
		int jobtype = 0;
		for (unsigned int i = 0; i < NUMJOBTYPES; i++)
		{
			if (job >= g_Brothels.m_JobManager.JobFilterIndex[i] && job < g_Brothels.m_JobManager.JobFilterIndex[i + 1])
			{
				jobtype = i;
				break;
			}
		}
		SetSelectedItemInList(jobtypelist_id, jobtype);
		RefreshJobList();

		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else
	{  // if in dungeon, effectively disable job lists
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, -1, gettext("Languish in dungeon"));
		HideButton(day_id, true);
		HideButton(night_id, true);
	}

	ClearListBox(traitlist_id);
	for (int i = 0; i < MAXNUM_TRAITS; i++)
	{
		if (selected_girl->m_Traits[i])
		{
			stringstream st;
			st << selected_girl->m_Traits[i]->m_Name;
			if (selected_girl->m_TempTrait[i] > 0) st << "   (" << selected_girl->m_TempTrait[i] << ")";
			AddToListBox(traitlist_id, i, g_Traits.GetTranslateName(st.str()));
		}
	}
	EditTextItem("", traitdesc_id);
}
void cScreenGangs::init()
{
	g_CurrentScreen = SCREEN_GANGMANAGEMENT;
	if (!g_InitWin) return;
	Focused();
	g_InitWin = false;

	selection = GetLastSelectedItemFromList(ganglist_id);
	sel_recruit = GetLastSelectedItemFromList(recruitlist_id);

	ClearListBox(missionlist_id);
	AddToListBox(missionlist_id, 0, "GUARDING");
	AddToListBox(missionlist_id, 1, "SABOTAGE");
	AddToListBox(missionlist_id, 2, "SPY ON GIRLS");
	AddToListBox(missionlist_id, 3, "RECAPTURE");
	AddToListBox(missionlist_id, 4, "ACQUIRE TERRITORY");
	AddToListBox(missionlist_id, 5, "PETTY THEFT");
	AddToListBox(missionlist_id, 6, "GRAND THEFT");
	AddToListBox(missionlist_id, 7, "KIDNAPPING");
	AddToListBox(missionlist_id, 8, "CATACOMBS");
	AddToListBox(missionlist_id, 9, "TRAINING");
	AddToListBox(missionlist_id, 10, "RECRUITING");
	AddToListBox(missionlist_id, 11, "SERVICE");

	SetCheckBox(controlcatacombs_id, (g_Gangs.Control_Gangs()));
	SliderRange(girlspercslider_id, 0, 100, g_Gangs.Gang_Gets_Girls(), 1);
	SliderRange(itemspercslider_id, 0, 100, g_Gangs.Gang_Gets_Girls() + g_Gangs.Gang_Gets_Items(), 1);
	ss.str("");	ss << "Girls : " << g_Gangs.Gang_Gets_Girls() << "%";	EditTextItem(ss.str(), ganggetsgirls_id);
	ss.str("");	ss << "Items : " << g_Gangs.Gang_Gets_Items() << "%";	EditTextItem(ss.str(), ganggetsitems_id);
	ss.str("");	ss << "Beasts : " << g_Gangs.Gang_Gets_Beast() << "%";	EditTextItem(ss.str(), ganggetsbeast_id);

	SetCheckBox(netautobuy_id, (g_Gangs.GetNetRestock() > 0));
	SetCheckBox(healautobuy_id, (g_Gangs.GetHealingRestock() > 0));

	// weapon upgrades
	int *wlev = g_Gangs.GetWeaponLevel();
	ss.str("");	ss << "Weapon Level: " << *wlev;
	if ((*wlev) < 4)
	{
		EnableButton(weaponup_id);
		ss << " Next: " << tariff.goon_weapon_upgrade(*wlev) << "g";
	}
	else DisableButton(weaponup_id);
	g_LogFile.ss() << "weapon text = '" << ss.str() << "'" << endl; g_LogFile.ssend();
	EditTextItem(ss.str(), weaponlevel_id);

	int *nets = g_Gangs.GetNets();
	ss.str(""); ss << "Nets (" << tariff.nets_price(1) << "g each): " << *nets;
	EditTextItem(ss.str(), netdesc_id);
	DisableButton(netbuy_id, *nets >= 60);
	DisableButton(netbuy10_id, *nets >= 60);
	DisableButton(netbuy20_id, *nets >= 60);
	DisableCheckBox(netautobuy_id, *nets < 1);

	int *potions = g_Gangs.GetHealingPotions();
	ss.str(""); ss << "Heal Potions (" << tariff.healing_price(1) << "g each): " << *potions;
	EditTextItem(ss.str(), healdesc_id);
	DisableButton(healbuy_id, *potions >= 200);
	DisableButton(healbuy10_id, *potions >= 200);
	DisableButton(healbuy20_id, *potions >= 200);
	DisableCheckBox(healautobuy_id, *potions < 1);

	int cost = 0;
	if (g_Gangs.GetNumGangs() > 0)
	{
		for (int i = 0; i < g_Gangs.GetNumGangs(); i++)
		{
			sGang* g = g_Gangs.GetGang(i);
			if (g == 0) g = g_Gangs.GetGang(i - 1);
			cost += tariff.goon_mission_cost(g->m_MissionID);
		}
	}
	ss.str(""); ss << "Weekly Cost: " << cost;
	EditTextItem(ss.str(), totalcost_id);
	if (gold_id >= 0)
	{
		ss.str(""); ss << "Gold: " << g_Gold.ival();
		EditTextItem(ss.str(), gold_id);
	}

	ClearListBox(ganglist_id);
	int num = 0;
	sGang* current = g_Gangs.GetGang(0);

	// loop through the gangs, populating the list box
	g_LogFile.write("Setting gang mission descriptions\n");
	for (current = g_Gangs.GetGang(0); current; current = current->m_Next)
	{
		// format the string with the gang name, mission and number of men
		string Data[11];
		ss.str("");	ss << current->m_Name;								Data[0] = ss.str();
		ss.str("");	ss << current->m_Num;								Data[1] = ss.str();
		ss.str("");	ss << short_mission_desc(current->m_MissionID);		Data[2] = ss.str();
		ss.str("");	ss << current->m_Skills[SKILL_COMBAT] << "%";		Data[3] = ss.str();
		ss.str("");	ss << current->m_Skills[SKILL_MAGIC] << "%";		Data[4] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_INTELLIGENCE] << "%";	Data[5] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_AGILITY] << "%";		Data[6] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_CONSTITUTION] << "%";	Data[7] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_CHARISMA] << "%";		Data[8] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_STRENGTH] << "%";		Data[9] = ss.str();
		ss.str("");	ss << current->m_Skills[SKILL_SERVICE] << "%";		Data[10] = ss.str();

		//		cerr << "Gang:\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2]
		//			<< "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << "\t" << Data[6] << endl;

		/*
		*			add the box to the list; red highlight gangs that are low on numbers
		*/
		int color = (current->m_Num < 6 ? COLOR_RED : COLOR_BLUE);
		if (current->m_Num < 6 && (current->m_MissionID == MISS_SERVICE || current->m_MissionID == MISS_TRAINING)) color = COLOR_YELLOW;
		AddToListBox(ganglist_id, num++, Data, 11, color);
	}

	ClearListBox(recruitlist_id);
	num = 0;
	current = g_Gangs.GetHireableGang(0);

	// loop through the gangs, populating the list box
	g_LogFile.write("Setting recruitable gang info\n");
	for (current = g_Gangs.GetHireableGang(0); current; current = current->m_Next)
	{
		// format the string with the gang name, mission and number of men
		string Data[10];
		ss.str("");	ss << current->m_Name;								Data[0] = ss.str();
		ss.str("");	ss << current->m_Num;								Data[1] = ss.str();
		ss.str("");	ss << current->m_Skills[SKILL_COMBAT] << "%";		Data[2] = ss.str();
		ss.str("");	ss << current->m_Skills[SKILL_MAGIC] << "%";		Data[3] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_INTELLIGENCE] << "%";	Data[4] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_AGILITY] << "%";		Data[5] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_CONSTITUTION] << "%";	Data[6] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_CHARISMA] << "%";		Data[7] = ss.str();
		ss.str("");	ss << current->m_Stats[STAT_STRENGTH] << "%";		Data[8] = ss.str();
		ss.str("");	ss << current->m_Skills[SKILL_SERVICE] << "%";		Data[9] = ss.str();

		//		cerr << "Recruitable\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2]
		//			<< "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << endl;

		/*
		*			add the box to the list
		*/
		int color = (current->m_Num < 6 ? COLOR_RED : COLOR_BLUE);
		AddToListBox(recruitlist_id, num++, Data, 10, color);
	}

	if (selection == -1 && GetListBoxSize(ganglist_id) >= 1) selection = 0;

	if (selection >= 0)
	{
		while (selection > GetListBoxSize(ganglist_id) && selection != -1) selection--;
	}
	if (selection >= 0) SetSelectedItemInList(ganglist_id, selection);
	if (sel_recruit == -1 && GetListBoxSize(recruitlist_id) >= 1) sel_recruit = 0;
	if (sel_recruit >= 0) SetSelectedItemInList(recruitlist_id, sel_recruit);

	DisableButton(ganghire_id, (g_Gangs.GetNumHireableGangs() <= 0) || (g_Gangs.GetNumGangs() >= g_Gangs.GetMaxNumGangs()) || (sel_recruit == -1));
	DisableButton(gangfire_id, (g_Gangs.GetNumGangs() <= 0) || (selection == -1));

	potions = wlev = nets = 0;
}
Exemple #19
0
//Set general alamr output display 
void CTabAlarmDlg::SetCommonAlarmInfo(WORD wInputAlarm,WORD wVideoLost,WORD wMotionAlarm,
									  int nChannelCount,int nInputAlarmCount)
{
	SetCheckBox(nChannelCount,nInputAlarmCount);
	int i = 0;
	int nInputAlarmID = 1029;
	int nVideoLost = 1077;
	int nMotionID = 1061;
	//External input channel alarm 
	if(0 != wInputAlarm)
	{
		for(i=0;i<m_nInputAlarmCount;i++)
		{
			WORD wAI = (WORD)pow(2,i);
			WORD wInput = wInputAlarm | (~wAI);
			WORD wReverse = ~wInput;
			if(0 == wReverse)
			{
				int nIsChecked = ((CButton*)GetDlgItem(nInputAlarmID + i))->GetCheck();
				if(1 == nIsChecked)
				{
					((CButton*)GetDlgItem(nInputAlarmID + i))->SetCheck(0);
				}
				else
				{
					((CButton*)GetDlgItem(nInputAlarmID + i))->SetCheck(1);
				}
			}
		}
	}
	//Video loss alarm 
	if(0 != wVideoLost)
	{
		for(i=0;i<m_nChannelCount;i++)
		{
			WORD wAV = (WORD)pow(2,i);
			WORD wVideo = wVideoLost | (~wAV);
			WORD wReverse = ~wVideo;
			if(0 == wReverse)
			{
				int nIsChecked = ((CButton*)GetDlgItem(nVideoLost + i))->GetCheck();
				if(1 == nIsChecked)
				{
					((CButton*)GetDlgItem(nVideoLost + i))->SetCheck(0);
				}
				else
				{
					((CButton*)GetDlgItem(nVideoLost + i))->SetCheck(1);
				}
			}
		}
	}
	//Motion detection alarm 
	if(0 != wMotionAlarm)
	{
		for(i=0;i<m_nChannelCount;i++)
		{
			WORD wAV = (WORD)pow(2,i);
			WORD wMotion = wMotionAlarm | (~wAV);
			WORD wReverse = ~wMotion;
			if(0 == wReverse)
			{
				int nIsChecked = ((CButton*)GetDlgItem(nMotionID + i))->GetCheck();
				if(1 == nIsChecked)
				{
					((CButton*)GetDlgItem(nMotionID + i))->SetCheck(0);
				}
				else
				{
					((CButton*)GetDlgItem(nMotionID + i))->SetCheck(1);
				}
			}
		}
	}
	//TRACE(" %d  %d  %d \n",wInputAlarm,wVideoLost,wMotionAlarm);
}
Exemple #20
0
static INT_PTR CALLBACK GetLocationDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	LocationDialog *theDlg = (LocationDialog *)GetWindowLongPtr( hWnd, GWLP_USERDATA );

	Interval valid = FOREVER;
	HWND hMap = GetDlgItem(hWnd, IDC_MAP_PICTURE);

    
    switch (msg) {
    case WM_INITDIALOG:
		theDlg = (LocationDialog *)lParam;
		SetWindowLongPtr( hWnd, GWLP_USERDATA, (LONG_PTR)theDlg );

        // Set the initial lat and long.
        theDlg->updatedLatitude = (double)theDlg->theLatitude;
        theDlg->updatedLongitude = (double)theDlg->theLongitude;

        // Subclass the map owner draw button.
        theDlg->oldMapProc = (WNDPROC)GetWindowLongPtr(hMap, GWLP_WNDPROC);
        SetWindowLongPtr(hMap, GWLP_WNDPROC, (LONG_PTR)MapProc);
		SetWindowLongPtr(hMap, GWLP_USERDATA, (LONG_PTR)theDlg );

        // Initialize items.
        theDlg->initCityList();
        theDlg->initMapList(GetDlgItem(hWnd, IDC_MAP_NAME));
        theDlg->changeMap(hWnd, hMap);
		CenterWindow(hWnd,GetParent(hWnd));

#ifdef DAYLIGHT_CITY_PICKER_BIG_CITY_DEFAULT
		SetCheckBox(hWnd, IDC_NEAREST, true);
#endif // DAYLIGHT_CITY_PICKER_BIG_CITY_DEFAULT

		break;

    case WM_DRAWITEM:
        theDlg->displayMap(hWnd, ((LPDRAWITEMSTRUCT)lParam)->hwndItem);
	    theDlg->displayCross(hWnd, theDlg->theLatitude, theDlg->theLongitude);
        break;
        
	case WM_COMMAND:

        // First check for ok or cancel.
	    switch (LOWORD(wParam)) {
		case IDOK:
			EndDialog(hWnd,1);
			break;

		case IDCANCEL:
    		EndDialog(hWnd,0);
			break;
		}

        // Then check for notifications.
        switch(HIWORD(wParam)) {
        case LBN_SELCHANGE:
             // User chose a city from the list box or map from combo box.
            if (GetDlgItem(hWnd, IDC_CITYLIST) == (HWND)lParam) 
                theDlg->chooseCity(hWnd, SendMessage((HWND)lParam, LB_GETCURSEL,0,0));
            else {
                int sel = SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0);
                if (theDlg->mapIndex != sel) {
                    lastMap = theDlg->mapIndex = sel;
					lastCity = 0;
                    theDlg->changeMap(hWnd, GetDlgItem(hWnd, IDC_MAP_PICTURE));
                }
            }
            break;

        case LBN_DBLCLK:
            // User may have double-clicked a city; if so, accept it and end dialog.
            if (GetDlgItem(hWnd, IDC_CITYLIST) == (HWND)lParam) {
                theDlg->chooseCity(hWnd, SendMessage((HWND)lParam, LB_GETCURSEL,0,0));
				EndDialog(hWnd,1);
			}
            break;
        default:
    		break;
        }
        break;
        
	default:
    	return 0;
    }
    
    return 1;
}
Exemple #21
0
BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{	
	WORD lw = LOWORD (wParam);
	WORD hw = HIWORD (wParam);
	static BOOL bKeyScanOn;
	static BOOL bTPlaySoundOnSuccessfulHkDismount;
	static BOOL bTDisplayBalloonOnSuccessfulHkDismount;

	switch (msg)
	{
	case WM_INITDIALOG:
		{
			LVCOLUMNW col;
			HWND hList = GetDlgItem (hwndDlg, IDC_HOTKEY_LIST);

			bKeyScanOn = FALSE;
			nSelectedHotkeyId = -1;
			currentVKeyCode = 0;
			memcpy (tmpHotkeys, Hotkeys, sizeof(tmpHotkeys));
			memset (vkeysDown, 0, sizeof(vkeysDown));

			SendMessageW (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,
				LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_LABELTIP 
				); 

			memset (&col,0,sizeof(col));               
			col.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT;  
			col.pszText = GetString ("ACTION");                           
			col.cx = CompensateXDPI (341);
			col.fmt = LVCFMT_LEFT;
			SendMessageW (hList,LVM_INSERTCOLUMNW,0,(LPARAM)&col);

			col.pszText = GetString ("SHORTCUT");  
			col.cx = CompensateXDPI (190);           
			col.fmt = LVCFMT_LEFT;
			SendMessageW (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&col);

			LocalizeDialog (hwndDlg, "IDD_HOTKEYS_DLG");

			SetCheckBox (hwndDlg, IDC_HK_MOD_CTRL, TRUE);
			SetCheckBox (hwndDlg, IDC_HK_MOD_SHIFT, FALSE);
			SetCheckBox (hwndDlg, IDC_HK_MOD_ALT, TRUE);
			SetCheckBox (hwndDlg, IDC_HK_MOD_WIN, FALSE);

			SetCheckBox (hwndDlg, IDC_HK_DISMOUNT_PLAY_SOUND, bPlaySoundOnSuccessfulHkDismount);
			SetCheckBox (hwndDlg, IDC_HK_DISMOUNT_BALLOON_TOOLTIP, bDisplayBalloonOnSuccessfulHkDismount);

			bTPlaySoundOnSuccessfulHkDismount = bPlaySoundOnSuccessfulHkDismount;
			bTDisplayBalloonOnSuccessfulHkDismount = bDisplayBalloonOnSuccessfulHkDismount;

			EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE);
			EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE);

			DisplayHotkeyList(hwndDlg);
			
			SetTimer (hwndDlg, 0xfe, 10, NULL);
			return 1;
		}

	case WM_TIMER:
		{
			if ((nSelectedHotkeyId > -1) && (GetFocus () == GetDlgItem (hwndDlg, IDC_HOTKEY_KEY)))
			{
				wchar_t keyName [MAX_KEY_COMB_NAME_LEN];
				UINT tmpVKeyCode;

				keyName[0] = 0;

				ScanAndProcessKey (&tmpVKeyCode, &keyName[0]);

				if (keyName[0] != 0)
				{
					currentVKeyCode = tmpVKeyCode;
					SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), keyName);
					EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), TRUE);
				}
				else if ((currentVKeyCode != 0) && GetKeyName (currentVKeyCode, keyName))
				{
					SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), keyName);
				}
			}
			return 1;
		}

	case WM_NOTIFY:
		if (wParam == IDC_HOTKEY_LIST)
		{
			if (((LPNMHDR) lParam)->code == LVN_ITEMACTIVATE
				|| ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED && (((LPNMLISTVIEW) lParam)->uNewState & LVIS_FOCUSED))
			{
				LVITEM item;
				memset(&item,0,sizeof(item));
				nSelectedHotkeyId = ((LPNMLISTVIEW) lParam)->iItem;
				currentVKeyCode = 0;
				memset (vkeysDown, 0, sizeof(vkeysDown));
				SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), GetString ("PRESS_A_KEY_TO_ASSIGN"));

				EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), (tmpHotkeys[nSelectedHotkeyId].vKeyCode > 0));

				EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE);
				bKeyScanOn = TRUE;
				return 1;
			}
		}

		return 0;

	case WM_COMMAND:
		if (lw == IDC_HOTKEY_KEY && hw == EN_CHANGE)
		{
			if (!bKeyScanOn && nSelectedHotkeyId < 0 && GetWindowTextLengthW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY)))
				SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L"");
		}

		if (lw == IDC_HOTKEY_ASSIGN)
		{
			BOOL bOwnActiveShortcut = FALSE;

			if (nSelectedHotkeyId >= 0 && currentVKeyCode != 0)
			{
				UINT modifiers = 0; 
				if (GetCheckBox (hwndDlg, IDC_HK_MOD_CTRL))
					modifiers = MOD_CONTROL;

				if (GetCheckBox (hwndDlg, IDC_HK_MOD_ALT))
					modifiers |= MOD_ALT;

				if (GetCheckBox (hwndDlg, IDC_HK_MOD_SHIFT))
					modifiers |= MOD_SHIFT;

				if (GetCheckBox (hwndDlg, IDC_HK_MOD_WIN))
					modifiers |= MOD_WIN;

				// Check if it's not already assigned
				if (ShortcutInUse (currentVKeyCode, modifiers, tmpHotkeys))
				{
					Error ("SHORTCUT_ALREADY_IN_USE", hwndDlg);
					return 1;
				}

				// Check for reserved system keys
				switch (currentVKeyCode)
				{
				case VK_F1:
				case VK_F12:
					/* F1 is help and F12 is reserved for use by the debugger at all times */
					if (modifiers == 0)
					{
						Error ("CANNOT_USE_RESERVED_KEY", hwndDlg);
						return 1;
					}
					break;
				}

				bOwnActiveShortcut = ShortcutInUse (currentVKeyCode, modifiers, Hotkeys);

				// Test if the shortcut can be assigned without errors
				if (!bOwnActiveShortcut
					&& !RegisterHotKey (hwndDlg, nSelectedHotkeyId, modifiers, currentVKeyCode))
				{
					handleWin32Error(hwndDlg, SRC_POS);
					return 1;
				}
				else
				{
					if (!bOwnActiveShortcut && !UnregisterHotKey (hwndDlg, nSelectedHotkeyId))
						handleWin32Error(hwndDlg, SRC_POS);

					tmpHotkeys[nSelectedHotkeyId].vKeyCode = currentVKeyCode;
					tmpHotkeys[nSelectedHotkeyId].vKeyModifiers = modifiers;

					SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L"");
					EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE);
					EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE);
					nSelectedHotkeyId = -1;
					bKeyScanOn = FALSE;
					currentVKeyCode = 0;
					memset (vkeysDown, 0, sizeof(vkeysDown));
				}
			}
			DisplayHotkeyList(hwndDlg);
			return 1;
		}

		if (lw == IDC_HOTKEY_REMOVE)
		{
			if (nSelectedHotkeyId >= 0)
			{
				tmpHotkeys[nSelectedHotkeyId].vKeyCode = 0;
				tmpHotkeys[nSelectedHotkeyId].vKeyModifiers = 0;
				SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L"");
				EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE);
				EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE);
				nSelectedHotkeyId = -1;
				bKeyScanOn = FALSE;
				currentVKeyCode = 0;
				memset (vkeysDown, 0, sizeof(vkeysDown));
				DisplayHotkeyList(hwndDlg);
			}
			return 1;
		}

		if (lw == IDC_RESET_HOTKEYS)
		{
			int i;

			for (i = 0; i < NBR_HOTKEYS; i++)
			{
				tmpHotkeys[i].vKeyCode = 0;
				tmpHotkeys[i].vKeyModifiers = 0;
			}
			SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L"");
			EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE);
			EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE);
			nSelectedHotkeyId = -1;
			bKeyScanOn = FALSE;
			currentVKeyCode = 0;
			memset (vkeysDown, 0, sizeof(vkeysDown));
			DisplayHotkeyList(hwndDlg);
			return 1;
		}

		if (lw == IDC_HK_DISMOUNT_PLAY_SOUND)
		{
			bTPlaySoundOnSuccessfulHkDismount = GetCheckBox (hwndDlg, IDC_HK_DISMOUNT_PLAY_SOUND);
		}

		if (lw == IDC_HK_DISMOUNT_BALLOON_TOOLTIP)
		{
			bTDisplayBalloonOnSuccessfulHkDismount = GetCheckBox (hwndDlg, IDC_HK_DISMOUNT_BALLOON_TOOLTIP);
		}

		if (lw == IDCANCEL || lw == IDCLOSE)
		{
			KillTimer (hwndDlg, 0xfe);
			EndDialog (hwndDlg, IDCANCEL);
			return 1;
		}

		if (lw == IDOK)
		{
			HWND hwndMainDlg = hwndDlg;

			while (GetParent (hwndMainDlg) != NULL)
			{
				hwndMainDlg = GetParent (hwndMainDlg);
			}
			UnregisterAllHotkeys (hwndMainDlg, Hotkeys);
			memcpy (Hotkeys, tmpHotkeys, sizeof(Hotkeys));
			RegisterAllHotkeys (hwndMainDlg, Hotkeys);
			KillTimer (hwndDlg, 0xfe);
			bPlaySoundOnSuccessfulHkDismount = bTPlaySoundOnSuccessfulHkDismount;
			bDisplayBalloonOnSuccessfulHkDismount = bTDisplayBalloonOnSuccessfulHkDismount;

			SaveSettings (hwndDlg);
			EndDialog (hwndDlg, IDCANCEL);
			return 1;
		}
		return 0;

	case WM_CLOSE:

		KillTimer (hwndDlg, 0xfe);
		EndDialog (hwndDlg, IDCANCEL);
		return 1;
	}
	return 0;
}
Exemple #22
0
BOOL CTexturePropDlg::OnInitDialog()
{
	char str[32];
	RECT rect;


	CDialog::OnInitDialog();

	m_bAllowChange = FALSE;

	SetDlgItemInt(IDC_TEXTUREPROP_FLAGS, m_TextureFlags);

	SetCheckBox(IDC_PREFER16BIT,	m_bPrefer16Bit);
	SetCheckBox(IDC_NOSYSCACHE,		m_bNoSysCache);
	SetCheckBox(IDC_FULLBRITE,		m_bFullBrights);
	SetCheckBox(IDC_32BITSYSCOPY,	m_b32BitSysCopy);
	SetCheckBox(IDC_PREFER4444,		m_bPrefer4444);
	SetCheckBox(IDC_PREFER5551,		m_bPrefer5551);

	SetDlgItemInt(IDC_TEXTURE_GROUP, m_TextureGroup);

	SetDlgItemText(IDC_DTX_COMMAND_STRING2, m_CommandString);
	SetDlgItemInt(IDC_NUMBER_OF_MIPMAPS, (int)m_nMipmaps);
	SetDlgItemInt(IDC_DTX_NONS3TCMIPMAPOFFSET, (int)m_NonS3TCMipmapOffset);
	SetDlgItemInt(IDC_UIMIPMAPOFFSET, m_UIMipmapOffset);
	SetDlgItemInt(IDC_TEXTUREPRIORITY, m_TexturePriority);
	SetDlgItemInt(IDC_DETAILTEXTUREANGLE, m_DetailTextureAngle);

	sprintf(str, "%f", m_DetailTextureScale);
	SetDlgItemText(IDC_DETAILTEXTURESCALE, str);


	m_bAllowChange = TRUE;

	// Move us into the upper-left corner.
	GetWindowRect(&rect);
	MoveWindow(0, 0, rect.right-rect.left, rect.bottom-rect.top, TRUE);

	SetupBPPIdent();

	// Create the preview window?
	if(m_pPreviewTexture)
	{
		g_pTexturePropDlg = this;

		// Close the preview thread if it's previously been opened
		if (m_hPreviewThread)
		{
			SetEvent(m_heventPreviewSync);
			WaitForSingleObject(m_hPreviewThread, INFINITE);
			CloseHandle(m_hPreviewThread);
			ResetEvent(m_heventPreviewSync);
		}

		m_hPreviewThread = CreateThread(NULL, 0, PreviewThreadFn, this, 0, (unsigned long *)&m_PreviewThreadID);
		// Wait until the thread says it's done with the dialog pointer
		WaitForSingleObject(m_heventPreviewSync, INFINITE);
		ResetEvent(m_heventPreviewSync);
		// Cut the thread's priority
		SetThreadPriority(m_hPreviewThread, THREAD_PRIORITY_LOWEST);
		SetFocus();
	}

	return TRUE;
}
LRESULT CALLBACK AFPluginsOptionsProc(HWND hwnd, UINT umsg, WPARAM wparm, LPARAM lparm)
{
    char		 str[MAX_PATH+256],dir[MAX_PATH];
	char	     lpszTitle[]="Select audio file plug-in directory:";
    int 		 index;
    PluginNode	*pnode;
    AFPlugin	*plugin;
    LPNMHDR		 lpnmhdr;
	BROWSEINFO   bi;
	LPITEMIDLIST lpidl;

    switch (umsg)
    {
		case WM_INITDIALOG:
			SetDlgItemText(hwnd,ID_PLUGINDIR,"Audio file plug-in &directory (takes effect on startup)");
			SetDlgItemText(hwnd,ID_PLUGINLIST,"Audio file &plug-ins");
			pnode=afFirstPlugin;
			while (pnode!=NULL)
			{
				wsprintf(str,"%s %s (%s)",AFNODE(pnode)->Description,AFNODE(pnode)->Version,pnode->pluginFileName);
				index=(int)SendDlgItemMessage(hwnd,ID_PLUGINS,LB_ADDSTRING,0,(LPARAM)str);
				SendDlgItemMessage(hwnd,ID_PLUGINS,LB_SETITEMDATA,(WPARAM)index,(LPARAM)(AFNODE(pnode)));
				pnode=pnode->next;
			}
			SetCheckBox(hwnd,ID_PLUGINALLOW,opAllowMultipleAFPlugins);
			CorrectDirString(afPluginDir);
			SetDlgItemText(hwnd,ID_DIR,afPluginDir);

			CheckCurAFSel(hwnd);
			DisableApply(hwnd);

			return TRUE;
		case WM_NOTIFY:
			lpnmhdr=(LPNMHDR)lparm;
			switch (lpnmhdr->code)
			{
				case PSN_APPLY:
					TrackPropPage(hwnd,3);
					opAllowMultipleAFPlugins=GetCheckBox(hwnd,ID_PLUGINALLOW);
					GetDlgItemText(hwnd,ID_DIR,afPluginDir,sizeof(afPluginDir));
					CorrectDirString(afPluginDir);
					DisableApply(hwnd);
					SetWindowLong(hwnd,DWL_MSGRESULT,PSNRET_NOERROR);
					break;
				case PSN_RESET:
					DisableApply(hwnd);
					TrackPropPage(hwnd,3);
					break;
				default:
					break;
			}
			break;
		case WM_COMMAND:
			switch (LOWORD(wparm))
			{
				case ID_DIR:
					GetDlgItemText(hwnd,ID_DIR,dir,sizeof(dir));
					if (!DirectoryExists(dir))
						CreateDirectoryRecursive(dir);
					bi.hwndOwner=hwnd;
					bi.pidlRoot=NULL;
					bi.pszDisplayName=dir;
					bi.lpszTitle=lpszTitle;
					bi.ulFlags=BIF_RETURNONLYFSDIRS;
					bi.lpfn=BrowseProc;
					if (dir[lstrlen(dir)-1]=='\\')
						dir[lstrlen(dir)-1]=0;
					bi.lParam=(LPARAM)dir;
					if ((lpidl=SHBrowseForFolder(&bi))!=NULL)
					{
						SHGetPathFromIDList(lpidl,dir);
						CorrectDirString(dir);
						SetDlgItemText(hwnd,ID_DIR,dir);
						EnableApply(hwnd);
					}
					break;
				case ID_PLUGINS:
					switch (HIWORD(wparm))
					{
						case LBN_DBLCLK:
							CheckCurAFSel(hwnd);
							plugin=(AFPlugin*)GetCurPlugin(hwnd);
							if ((plugin!=NULL) && (plugin->Config!=NULL))
								plugin->Config(hwnd);
							break;
						case LBN_KILLFOCUS:
						case LBN_SETFOCUS:
						case LBN_SELCANCEL:
						case LBN_SELCHANGE:
							CheckCurAFSel(hwnd);
							break;
						default:
							break;
					}
					break;
				case ID_PLUGINCONFIG:
					plugin=(AFPlugin*)GetCurPlugin(hwnd);
					if ((plugin!=NULL) && (plugin->Config!=NULL))
						plugin->Config(hwnd);
					break;
				case ID_PLUGINABOUT:
					plugin=(AFPlugin*)GetCurPlugin(hwnd);
					if ((plugin!=NULL) && (plugin->About!=NULL))
						plugin->About(hwnd);
					break;
				case ID_PLUGINALLOW:
					EnableApply(hwnd);
					break;
				default:
					break;
			}
			break;
		default:
			break;
    }
    return FALSE;
}