Mouse_constructPreferences( page );
}
void Mouse_registerPreferencesPage(){
- PreferencesDialog_addInterfacePage( FreeCaller1<PreferenceGroup&, Mouse_constructPage>() );
+ PreferencesDialog_addInterfacePage( makeCallbackF(Mouse_constructPage) );
}
g_Console_enableLogging = string_equal( string, "true" );
Sys_LogFile( g_Console_enableLogging );
}
-typedef FreeCaller1<const char*, LogConsole_importString> LogConsoleImportStringCaller;
+typedef FreeCaller<void(const char*), LogConsole_importString> LogConsoleImportStringCaller;
void RegisterGlobalPreferences( PreferenceSystem& preferences ){
m_sGameFile = ( *iGame )->mGameFile;
}
-void CGameDialog::GameFileExport( const IntImportCallback& importCallback ) const {
+void CGameDialog::GameFileExport( const ImportExportCallback<int>::Import_t& importCallback ) const {
// use m_sGameFile to set value
std::list<CGameDescription *>::const_iterator iGame;
int i = 0;
self.GameFileImport( value );
}
-void CGameDialog_GameFileExport( CGameDialog& self, const IntImportCallback& importCallback ){
+void CGameDialog_GameFileExport( CGameDialog& self, const ImportExportCallback<int>::Import_t& importCallback ){
self.GameFileExport( importCallback );
}
page.appendCombo(
"Select the game",
StringArrayRange( &( *games.begin() ), &( *games.end() ) ),
- ReferenceCaller1<CGameDialog, int, CGameDialog_GameFileImport>( *this ),
- ReferenceCaller1<CGameDialog, const IntImportCallback&, CGameDialog_GameFileExport>( *this )
+ {ReferenceCaller<CGameDialog, void(int), CGameDialog_GameFileImport>( *this ),
+ ReferenceCaller<CGameDialog, void(const ImportExportCallback<int>::Import_t&), CGameDialog_GameFileExport>( *this )}
);
page.appendCheckBox( "Startup", "Show Global Preferences", m_bGamePrompt );
}
return create_simple_modal_dialog_window( "Global Preferences", m_modal, frame );
}
-class LoadGameFile
-{
-std::list<CGameDescription*>& mGames;
-const char* mPath;
-public:
-LoadGameFile( std::list<CGameDescription*>& games, const char* path ) : mGames( games ), mPath( path ){
-}
-void operator()( const char* name ) const {
- if ( !extension_equal( path_get_extension( name ), "game" ) ) {
- return;
- }
- StringOutputStream strPath( 256 );
- strPath << mPath << name;
- globalOutputStream() << strPath.c_str() << '\n';
-
- xmlDocPtr pDoc = xmlParseFile( strPath.c_str() );
- if ( pDoc ) {
- mGames.push_front( new CGameDescription( pDoc, name ) );
- xmlFreeDoc( pDoc );
- }
- else
- {
- globalErrorStream() << "XML parser failed on '" << strPath.c_str() << "'\n";
- }
-}
-};
-
void CGameDialog::ScanForGames(){
StringOutputStream strGamesPath( 256 );
strGamesPath << AppPath_get() << "games/";
(if that's really needed)
*/
- Directory_forEach( path, LoadGameFile( mGames, path ) );
+ Directory_forEach(path, [&](const char *name) {
+ if (!extension_equal(path_get_extension(name), "game")) {
+ return;
+ }
+ StringOutputStream strPath(256);
+ strPath << path << name;
+ globalOutputStream() << strPath.c_str() << '\n';
+
+ xmlDocPtr pDoc = xmlParseFile(strPath.c_str());
+ if (pDoc) {
+ mGames.push_front(new CGameDescription(pDoc, name));
+ xmlFreeDoc(pDoc);
+ } else {
+ globalErrorStream() << "XML parser failed on '" << strPath.c_str() << "'\n";
+ }
+ });
}
CGameDescription* CGameDialog::GameDescriptionForComboItem(){
return;
}
-static void treeSelection( GtkTreeSelection* selection, gpointer data ){
+static void treeSelection( ui::TreeSelection selection, gpointer data ){
PrefsDlg *dlg = (PrefsDlg*)data;
GtkTreeModel* model;
};
ui::Window PrefsDlg::BuildDialog(){
- PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
+ PreferencesDialog_addInterfacePreferences( makeCallbackF(Interface_constructPreferences) );
Mouse_registerPreferencesPage();
ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
auto store = ui::TreeStore(gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ));
auto view = ui::TreeView(ui::TreeModel(store));
- gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
+ gtk_tree_view_set_headers_visible(view, FALSE );
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
- gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
+ auto column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
+ gtk_tree_view_append_column(view, column );
}
{
- auto selection = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ));
+ auto selection = ui::TreeSelection(gtk_tree_view_get_selection(view ));
selection.connect( "changed", G_CALLBACK( treeSelection ), this );
}
PreferencesPage preferencesPage( *this, getVBox( global ) );
Global_constructPreferences( preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Global", global );
+ auto group = PreferenceTree_appendPage( store, 0, "Global", global );
{
auto game = PreferencePages_addPage( m_notebook, "Game" );
PreferencesPage preferencesPage( *this, getVBox( game ) );
PreferencesPageCallbacks_constructPage( g_interfacePreferences, preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Interface", interfacePage );
+ auto group = PreferenceTree_appendPage( store, 0, "Interface", interfacePage );
PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group );
PreferenceGroupCallbacks_constructGroup( g_interfaceCallbacks, preferenceGroup );
PreferencesPage preferencesPage( *this, getVBox( display ) );
PreferencesPageCallbacks_constructPage( g_displayPreferences, preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Display", display );
+ auto group = PreferenceTree_appendPage( store, 0, "Display", display );
PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group );
PreferenceGroupCallbacks_constructGroup( g_displayCallbacks, preferenceGroup );
PreferencesPageCallbacks_constructPage( g_settingsPreferences, preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Settings", settings );
+ auto group = PreferenceTree_appendPage( store, 0, "Settings", settings );
PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group );
PreferenceGroupCallbacks_constructGroup( g_settingsCallbacks, preferenceGroup );
}
}
- gtk_tree_view_expand_all( GTK_TREE_VIEW( view ) );
+ gtk_tree_view_expand_all(view );
g_object_unref( G_OBJECT( store ) );
}
void GameName_importString( const char* value ){
gamename_set( value );
}
-typedef FreeCaller1<const char*, GameName_importString> GameNameImportStringCaller;
-void GameName_exportString( const StringImportCallback& importer ){
+typedef FreeCaller<void(const char*), GameName_importString> GameNameImportStringCaller;
+void GameName_exportString( const ImportExportCallback<const char *>::Import_t& importer ){
importer( gamename_get() );
}
-typedef FreeCaller1<const StringImportCallback&, GameName_exportString> GameNameExportStringCaller;
+typedef FreeCaller<void(const ImportExportCallback<const char *>::Import_t&), GameName_exportString> GameNameExportStringCaller;
void GameMode_importString( const char* value ){
gamemode_set( value );
}
-typedef FreeCaller1<const char*, GameMode_importString> GameModeImportStringCaller;
-void GameMode_exportString( const StringImportCallback& importer ){
+typedef FreeCaller<void(const char*), GameMode_importString> GameModeImportStringCaller;
+void GameMode_exportString( const ImportExportCallback<const char *>::Import_t& importer ){
importer( gamemode_get() );
}
-typedef FreeCaller1<const StringImportCallback&, GameMode_exportString> GameModeExportStringCaller;
+typedef FreeCaller<void(const ImportExportCallback<const char *>::Import_t&), GameMode_exportString> GameModeExportStringCaller;
void RegisterPreferences( PreferenceSystem& preferences ){