BOOL CALLBACK tab_OverviewCallback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: char szString[256]; g_hDlg_Overview = hDlg; // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); // Initialize the server console text. sprintf( szString, " === S K U L L T A G | Statsmaker ===" ); SetDlgItemText( hDlg, IDC_CONSOLEBOX, szString ); Printf( "\n\n" ); Printf( "Welcome!\n" ); GUI_UpdateStatisticsDisplay( ); g_hThread = CreateThread( NULL, 0, COLLECTOR_StartCollecting, 0, 0, 0 ); break; } return FALSE; }
BOOL CALLBACK settings_AdminTab_Callback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); g_hDlg_AdminTab = hDlg; // Set the text limits for the input box. SendDlgItemMessage( hDlg, IDC_LOGFILE, EM_SETLIMITTEXT, 128, 0 ); // Initialize the "Enable timestamp" checkbox. SendDlgItemMessage( hDlg, IDC_LOGFILENAME_TIMESTAMP, BM_SETCHECK, ( sv_logfilenametimestamp ) ? BST_CHECKED : BST_UNCHECKED, 0 ); SendDlgItemMessage( hDlg, IDC_ENABLELOGGING, BM_SETCHECK, ( Logfile ) ? BST_CHECKED : BST_UNCHECKED, 0 ); SetDlgItemText( hDlg, IDC_LOGFILE, g_szDesiredLogFilename ); // [BB] Initialize the "Server control" checkbox. SendDlgItemMessage( hDlg, IDC_ALLOWRCON, BM_SETCHECK, ( strlen ( sv_rconpassword ) > 4 ) ? BST_CHECKED : BST_UNCHECKED, 0 ); SetDlgItemText( hDlg, IDC_RCONPASSWORD, sv_rconpassword ); settings_AdminTab_ShowOrHideItems( hDlg ); break; case WM_COMMAND: if ( LOWORD( wParam ) == IDC_TIMESTAMP || LOWORD( wParam ) == IDC_ENABLELOGGING || LOWORD( wParam ) == IDC_ALLOWRCON ) settings_AdminTab_ShowOrHideItems( hDlg ); if ( LOWORD( wParam ) == IDC_VIEWLOGFILE ) { if ( FileExists( g_szActualLogFilename )) I_RunProgram( g_szActualLogFilename ); } if ( LOWORD( wParam ) == IDC_MESSAGES ) DialogBox( g_hInst, MAKEINTRESOURCE( IDD_MESSAGEOPTIONS ), hDlg, SERVERCONSOLE_MessagesCallback ); if ( LOWORD( wParam ) == IDC_BANLIST ) DialogBox( g_hInst, MAKEINTRESOURCE( IDD_BANLIST ), hDlg, SERVERCONSOLE_BanListCallback ); break; } return FALSE; }
BOOL CALLBACK tab_PortCallback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: g_PortInfo[(int) lParam].hDlg = hDlg; // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); break; } return FALSE; }
BOOL CALLBACK flags_GenericTabCallback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); // Go through and claim the checkboxes on this tab. for ( unsigned int i = 0; i < NUMBER_OF_FLAGS; i++ ) { if ( GetDlgItem( hDlg, g_Flags[i].iControlID ) != NULL ) { g_Flags[i].hObject = GetDlgItem( hDlg, g_Flags[i].iControlID ); // Check to see if we need to disable the flag. EnableWindow( g_Flags[i].hObject, !g_Flags[i].bDisabled ); if ( g_Flags[i].bDisabled ) *g_Flags[i].ulFlagVariable &= ~g_Flags[i].ulThisFlag; } } // Init the drop-down boxes. for ( unsigned int i = 0; i < NUMBER_OF_DROPDOWNS; i++ ) { if ( GetDlgItem( hDlg, g_MultiFlags[i].iControlID ) != NULL ) { g_MultiFlags[i].hObject = GetDlgItem( hDlg, g_MultiFlags[i].iControlID ); for ( int setting = 0; setting < g_MultiFlags[i].numPairings; setting++ ) SendDlgItemMessage( hDlg, g_MultiFlags[i].iControlID, CB_INSERTSTRING, -1, (WPARAM)(LPSTR)g_MultiFlags[i].dataPairings[setting].name ); } } // Are the LMS textboxes on this tab? if ( GetDlgItem( hDlg, IDC_LMSSPECTATORS_VALUE ) != NULL ) { g_hDlg_LMS = hDlg; SendDlgItemMessage( hDlg, IDC_LMSWEAPONS_VALUE, EM_SETLIMITTEXT, 12, 0 ); SendDlgItemMessage( hDlg, IDC_LMSSPECTATORS_VALUE, EM_SETLIMITTEXT, 12, 0 ); } flags_WriteValuesToForm( ); break; case WM_COMMAND: // Check if user changed any of the checkboxes. for ( unsigned int i = 0; i < NUMBER_OF_FLAGS; i++ ) { // They did! Update the flags. if ( g_Flags[i].iControlID == LOWORD( wParam ) ) { flags_ReadValuesFromForm( ); break; } } // Check if user changed any of the dropdowns. for ( unsigned int i = 0; i < NUMBER_OF_DROPDOWNS; i++ ) { // They did! Update the flags. if ( g_MultiFlags[i].iControlID == LOWORD( wParam ) && HIWORD( wParam ) == CBN_SELCHANGE ) { flags_ReadValuesFromForm( ); break; } } // User is typing in some new flags. if ( HIWORD ( wParam ) == EN_CHANGE ) { switch ( LOWORD( wParam )) { case IDC_LMSSPECTATORS_VALUE: flags_ReadNewValue( hDlg, LOWORD( wParam ), g_ulLMSSpectatorSettings ); break; case IDC_LMSWEAPONS_VALUE: flags_ReadNewValue( hDlg, LOWORD( wParam ), g_ulLMSAllowedWeapons ); break; } } break; } return FALSE; }
BOOL CALLBACK settings_AccessTab_Callback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); g_hDlg_AccessTab = hDlg; SendDlgItemMessage( hDlg, IDC_PASSWORD, EM_SETLIMITTEXT, 32, 0 ); SendDlgItemMessage( hDlg, IDC_JOINPASSWORD, EM_SETLIMITTEXT, 32, 0 ); SendDlgItemMessage( hDlg, IDC_RCONPASSWORD, EM_SETLIMITTEXT, 32, 0 ); SendDlgItemMessage( hDlg, IDC_MAXCLIENTS, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_MAXPLAYERS, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG( MAXPLAYERS,0 )); SendDlgItemMessage( hDlg, IDC_SPIN6, UDM_SETRANGE, 0, MAKELONG( MAXPLAYERS,0 )); SetDlgItemText( hDlg, IDC_PASSWORD, sv_password.GetGenericRep( CVAR_String ).String ); SendDlgItemMessage( hDlg, IDC_REQUIREPW, BM_SETCHECK, sv_forcepassword ? BST_CHECKED : BST_UNCHECKED, 0 ); SetDlgItemText( hDlg, IDC_JOINPASSWORD, sv_joinpassword.GetGenericRep( CVAR_String ).String ); SendDlgItemMessage( hDlg, IDC_REQUIREJOINPW, BM_SETCHECK, sv_forcejoinpassword ? BST_CHECKED : BST_UNCHECKED, 0 ); SetDlgItemText( hDlg, IDC_RCONPASSWORD, sv_rconpassword.GetGenericRep( CVAR_String ).String ); SendDlgItemMessage( hDlg, IDC_ALLOWRCON, BM_SETCHECK, strlen( sv_rconpassword ) ? BST_CHECKED : BST_UNCHECKED, 0 ); SetDlgItemText( hDlg, IDC_MAXPLAYERS, sv_maxplayers.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_MAXCLIENTS, sv_maxclients.GetGenericRep( CVAR_String ).String ); // Update voting checkboxes. SendDlgItemMessage( hDlg, IDC_ALLOW_CALLVOTE, BM_SETCHECK, ( sv_nocallvote != 1 ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_DUELLIMIT, BM_SETCHECK, ( !sv_noduellimitvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_FRAGLIMIT, BM_SETCHECK, ( !sv_nofraglimitvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_KICKLIMIT, BM_SETCHECK, ( !sv_nokickvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_POINTLIMIT, BM_SETCHECK, ( !sv_nopointlimitvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_TIMELIMIT, BM_SETCHECK, ( !sv_notimelimitvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_WINLIMIT, BM_SETCHECK, ( !sv_nowinlimitvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_MAP, BM_SETCHECK, ( !sv_nomapvote ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_ALLOWVOTE_SPECTATOR, BM_SETCHECK, ( sv_nocallvote != 2 ? BST_CHECKED : BST_UNCHECKED ), 0 ); settings_AccessTab_ShowOrHideItems( hDlg ); break; case WM_COMMAND: switch ( LOWORD( wParam ) ) { case IDC_ALLOW_CALLVOTE: case IDC_REQUIREPW: case IDC_REQUIREJOINPW: // Enable / disable the password fields. settings_AccessTab_ShowOrHideItems( hDlg ); break; case IDC_BANLIST: DialogBox( g_hInst, MAKEINTRESOURCE( IDD_BANLIST ), hDlg, SERVERCONSOLE_BanListCallback ); /* SERVERCONSOLE_IPLIST_Display( hDlg, IPLIST_BAN ); break; case IDC_WHITELIST: SERVERCONSOLE_IPLIST_Display( hDlg, IPLIST_WHITE ); break; case IDC_ADMINLIST: SERVERCONSOLE_IPLIST_Display( hDlg, IPLIST_ADMIN ); break; */ break; } } return FALSE; }
BOOL CALLBACK settings_GameplayTab_Callback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: g_hDlg_GameplayTab = hDlg; // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); // Limit the input length for the spin boxes. SendDlgItemMessage( hDlg, IDC_FRAGLIMIT, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_TIMELIMIT, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_POINTLIMIT, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_DUELLIMIT, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_WINLIMIT, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_MAXLIVES, EM_SETLIMITTEXT, 4, 0 ); SendDlgItemMessage( hDlg, IDC_TIMELIMITSPIN, UDM_SETRANGE, 0, MAKELONG( 9999,0 )); SendDlgItemMessage( hDlg, IDC_FRAGLIMITSPIN, UDM_SETRANGE, 0, MAKELONG( 9999,0 )); SendDlgItemMessage( hDlg, IDC_POINTLIMITSPIN, UDM_SETRANGE, 0, MAKELONG( 9999,0 )); SendDlgItemMessage( hDlg, IDC_DUELLIMITSPIN, UDM_SETRANGE, 0, MAKELONG( 9999,0 )); SendDlgItemMessage( hDlg, IDC_WINLIMITSPIN, UDM_SETRANGE, 0, MAKELONG( 9999,0 )); SendDlgItemMessage( hDlg, IDC_MAXLIVESSPIN, UDM_SETRANGE, 0, MAKELONG( 9999,0 )); // Initialize all the fields. SetDlgItemText( hDlg, IDC_FRAGLIMIT, fraglimit.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_TIMELIMIT, timelimit.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_POINTLIMIT, pointlimit.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_DUELLIMIT, duellimit.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_WINLIMIT, winlimit.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_MAXLIVES, sv_maxlives.GetGenericRep( CVAR_String ).String ); // Fill the list with game modes, and select the current one. for ( int i = 0; i < NUM_GAMEMODES; i++ ) SendDlgItemMessage( hDlg, IDC_GAMEPLAYMODE, CB_INSERTSTRING, -1, (WPARAM)(LPSTR) GameModeVals[i].name ); SendDlgItemMessage( hDlg, IDC_GAMEPLAYMODE, CB_SETCURSEL, (LONG) GAMEMODE_GetCurrentMode( ), 0 ); // Fill and select modifiers. for ( int i = 0; i < NUM_MODIFIERS; i++ ) SendDlgItemMessage( hDlg, IDC_MODIFIER, CB_INSERTSTRING, -1, (WPARAM)(LPSTR) ModifierVals[i].name ); SendDlgItemMessage( hDlg, IDC_MODIFIER, CB_SETCURSEL, (LONG) GAMEMODE_GetModifier( ), 0 ); // Fill and select skills. for ( int i = 0; i < NUM_SKILLS; i++ ) SendDlgItemMessage( hDlg, IDC_SKILL, CB_INSERTSTRING, -1, (WPARAM)(LPSTR) GameskillVals[i].name ); SendDlgItemMessage( hDlg, IDC_SKILL, CB_SETCURSEL, gameskill.GetGenericRep( CVAR_Int ).Int, 0 ); // Fill and select botskills. for ( int i = 0; i < NUM_BOTSKILLS; i++ ) SendDlgItemMessage( hDlg, IDC_BOTSKILL, CB_INSERTSTRING, -1, (WPARAM)(LPSTR) BotskillVals[i].name ); SendDlgItemMessage( hDlg, IDC_BOTSKILL, CB_SETCURSEL, botskill.GetGenericRep( CVAR_Int ).Int, 0 ); settings_GameplayTab_ShowOrHideItems( hDlg ); break; case WM_COMMAND: if ( LOWORD( wParam ) == IDC_GAMEPLAYMODE ) settings_GameplayTab_ShowOrHideItems( hDlg ); if ( LOWORD( wParam ) == IDC_MAPLIST ) DialogBox( g_hInst, MAKEINTRESOURCE( IDD_MAPROTATION ), hDlg, SERVERCONSOLE_MapRotationCallback ); if ( LOWORD( wParam ) == IDC_SHOWFLAGS ) DialogBox( g_hInst, MAKEINTRESOURCE( IDD_DMFLAGS ), hDlg, SERVERCONSOLE_DMFlagsCallback ); break; } return FALSE; }
BOOL CALLBACK settings_ServerTab_Callback( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: g_hDlg_ServerTab = hDlg; // Enable tab gradients on XP and later. if ( pEnableThemeDialogTexture != NULL ) pEnableThemeDialogTexture ( hDlg, ETDT_ENABLETAB ); // Limit the input length for the text boxes. SendDlgItemMessage( hDlg, IDC_SERVERNAME, EM_SETLIMITTEXT, 96, 0 ); SendDlgItemMessage( hDlg, IDC_WADURL, EM_SETLIMITTEXT, 96, 0 ); SendDlgItemMessage( hDlg, IDC_EMAIL, EM_SETLIMITTEXT, 96, 0 ); // Initialize all the fields. SetDlgItemText( hDlg, IDC_SERVERNAME, sv_hostname.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_EMAIL, sv_hostemail.GetGenericRep( CVAR_String ).String ); SetDlgItemText( hDlg, IDC_WADURL, sv_website.GetGenericRep( CVAR_String ).String ); SendDlgItemMessage( hDlg, IDC_UPDATEMASTER, BM_SETCHECK, ( sv_updatemaster ? BST_CHECKED : BST_UNCHECKED ), 0 ); SendDlgItemMessage( hDlg, IDC_BROADCAST, BM_SETCHECK, ( sv_broadcast ? BST_CHECKED : BST_UNCHECKED ), 0 ); g_fsMOTD = sv_motd.GetGenericRep( CVAR_String ).String; // PWADs. SendMessage( GetDlgItem( hDlg, IDC_PWADS ), WM_SETFONT, (WPARAM) CreateFont( 12, 0, 0, 0, 0, TRUE, 0, 0, 0, 0, 0, 0, 0, "Tahoma" ), (LPARAM) 1 ); { char szString[256]; int iNumChars = 0; sprintf( szString, "PWADs:" ); for( std::list<FString>::iterator i = NETWORK_GetPWADList( )->begin( ); i != NETWORK_GetPWADList( )->end(); ++i ) { iNumChars += i->Len( ); if ( iNumChars > 50 - 3 ) // Determined by width of label { sprintf( szString + strlen ( szString ), "...", *i->GetChars( )); break; } else sprintf( szString + strlen ( szString ), " %s", *i ); } g_ulNumPWADs = NETWORK_GetPWADList( )->size( ); if ( g_ulNumPWADs == 0 ) { ShowWindow( GetDlgItem( hDlg, IDC_WADURL ), SW_HIDE ); ShowWindow( GetDlgItem( hDlg, IDC_WADURLLABEL ), SW_HIDE ); ShowWindow( GetDlgItem( hDlg, IDC_PWADS ), SW_HIDE ); ShowWindow( GetDlgItem( hDlg, IDC_PWADGROUP ), SW_HIDE ); } else SetDlgItemText( hDlg, IDC_PWADS, szString ); } break; case WM_COMMAND: if ( LOWORD( wParam ) == IDC_STARTUPMESSAGE ) DialogBox( g_hInst, MAKEINTRESOURCE( IDD_EDITMOTD ), hDlg, settings_ServerTab_MOTDCallback ); break; } return FALSE; }