void operator()(const char* name) const { EntityClassFilterMode filterMode; if(filterMode.filter_mp_sp) { if(string_empty(GlobalRadiant().getGameMode()) || string_equal(GlobalRadiant().getGameMode(), "sp")) { if(string_equal_n(name, filterMode.sp_ignore_prefix, strlen(filterMode.sp_ignore_prefix))) { globalOutputStream() << "Ignoring '" << name << "'\n"; return; } } else { if(string_equal_n(name, filterMode.mp_ignore_prefix, strlen(filterMode.mp_ignore_prefix))) { globalOutputStream() << "Ignoring '" << name << "'\n"; return; } } } // for a given name, we grab the first .def in the vfs // this allows to override baseq3/scripts/entities.def for instance StringOutputStream relPath(256); relPath << m_directory << name; scanner.scanFile(g_collector, relPath.c_str()); }
void MultiMon_Construct() { // detect multiple monitors GdkScreen* screen = gdk_display_get_default_screen(gdk_display_get_default()); gint m = gdk_screen_get_n_monitors(screen); globalOutputStream() << "default screen has " << m << " monitors\n"; for(int j = 0; j != m; ++j) { GdkRectangle geom; gdk_screen_get_monitor_geometry(screen, j, &geom); globalOutputStream() << "monitor " << j << " geometry: " << geom.x << ", " << geom.y << ", " << geom.width << ", " << geom.height << "\n"; if(j == 0) { // I am making the assumption that monitor 0 is always the primary monitor on win32. Tested on WinXP with gtk+-2.4. primaryMonitor = geom; } } if(m > 1) { g_multimon_globals.m_bStartOnPrimMon = true; } GlobalPreferenceSystem().registerPreference("StartOnPrimMon", BoolImportStringCaller(g_multimon_globals.m_bStartOnPrimMon), BoolExportStringCaller(g_multimon_globals.m_bStartOnPrimMon)); GlobalPreferenceSystem().registerPreference("NoSysMenuPopups", BoolImportStringCaller(g_Multimon_enableSysMenuPopups.m_latched), BoolExportStringCaller(g_Multimon_enableSysMenuPopups.m_latched)); g_Multimon_enableSysMenuPopups.useLatched(); PreferencesDialog_addInterfacePreferences(FreeCaller1<PreferencesPage&, MultiMonitor_constructPreferences>()); }
void MouseEventManager::loadCameraEventDefinitions () { xml::NodeList camviews = GlobalRegistry().findXPath("user/ui/input//cameraview"); if (camviews.size() > 0) { // Find all the camera definitions xml::NodeList eventList = camviews[0].getNamedChildren("event"); if (eventList.size() > 0) { globalOutputStream() << "MouseEventManager: Camera Definitions found: " << eventList.size() << "\n"; for (unsigned int i = 0; i < eventList.size(); i++) { // Get the event name const std::string eventName = eventList[i].getAttributeValue("name"); // Check if any recognised event names are found and construct the according condition. if (eventName == "EnableFreeLookMode") { _cameraConditions[ui::camEnableFreeLookMode] = getCondition(eventList[i]); } else if (eventName == "DisableFreeLookMode") { _cameraConditions[ui::camDisableFreeLookMode] = getCondition(eventList[i]); } else { globalOutputStream() << "MouseEventManager: Warning: Ignoring unknown event name: " << eventName << "\n"; } } } else { // No Camera definitions found! globalOutputStream() << "MouseEventManager: Critical: No camera event definitions found!\n"; } } else { // No Camera definitions found! globalOutputStream() << "MouseEventManager: Critical: No camera event definitions found!\n"; } }
void MouseEventManager::loadButtonDefinitions () { xml::NodeList buttons = GlobalRegistry().findXPath("user/ui/input//buttons"); if (buttons.size() > 0) { // Find all the button definitions xml::NodeList buttonList = buttons[0].getNamedChildren("button"); if (buttonList.size() > 0) { globalOutputStream() << "MouseEventManager: Buttons found: " << buttonList.size() << "\n"; for (unsigned int i = 0; i < buttonList.size(); i++) { const std::string name = buttonList[i].getAttributeValue("name"); unsigned int id = string::toInt(buttonList[i].getAttributeValue("id")); if (name != "" && id > 0) { // Save the button ID into the map _buttonId[name] = id; } else { globalOutputStream() << "MouseEventManager: Warning: Invalid button definition found.\n"; } } } else { // No Button definitions found! globalOutputStream() << "MouseEventManager: Critical: No button definitions found!\n"; } } else { // No Button definitions found! globalOutputStream() << "MouseEventManager: Critical: No button definitions found!\n"; } }
void OpenGLModule::sharedContextCreated() { // report OpenGL information globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*>(glGetString(GL_VENDOR)) << "\n"; globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*>(glGetString(GL_RENDERER)) << "\n"; globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*>(glGetString(GL_VERSION)) << "\n"; globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)) << "\n"; GLenum err = glewInit(); if (err != GLEW_OK) { // glewInit failed globalErrorStream() << "GLEW error: " << reinterpret_cast<const char*>(glewGetErrorString(err)); } GlobalRenderSystem().extensionsInitialised(); GlobalRenderSystem().realise(); _font = glfont_create("Sans 8"); m_font = _font.getDisplayList(); m_fontHeight = _font.getPixelHeight(); }
void CGameDescription::Dump(){ globalOutputStream() << "game description file: " << makeQuoted( mGameFile.c_str() ) << "\n"; for ( GameDescription::iterator i = m_gameDescription.begin(); i != m_gameDescription.end(); ++i ) { globalOutputStream() << ( *i ).first.c_str() << " = " << makeQuoted( ( *i ).second.c_str() ) << "\n"; } }
bool Buttons_press(ButtonMask& buttons, guint button, guint state) { if(buttons == 0 && bitfield_enable(buttons, ButtonMask_for_event_button(button)) != 0) { ASSERT_MESSAGE(g_accel_enabled, "Buttons_press: accelerators not enabled"); g_accel_enabled = false; for(WindowSet::iterator i = g_accel_windows.begin(); i != g_accel_windows.end(); ++i) { GtkWindow* toplevel = *i; ASSERT_MESSAGE(window_has_accel(toplevel), "ERROR"); ASSERT_MESSAGE(GTK_WIDGET_TOPLEVEL(toplevel), "disabling accel for non-toplevel window"); gtk_window_remove_accel_group(toplevel, global_accel); #if 0 globalOutputStream() << reinterpret_cast<unsigned int>(toplevel) << ": disabled global accelerators\n"; #endif #if 0 accel_group_test(toplevel, global_accel); #endif } } buttons = bitfield_enable(buttons, ButtonMask_for_event_button(button)); #if 0 globalOutputStream() << "Buttons_press: "; print_buttons(buttons); #endif return false; }
bool Buttons_release(ButtonMask& buttons, guint button, guint state) { if(buttons != 0 && bitfield_disable(buttons, ButtonMask_for_event_button(button)) == 0) { ASSERT_MESSAGE(!g_accel_enabled, "Buttons_release: accelerators are enabled"); g_accel_enabled = true; for(WindowSet::iterator i = g_accel_windows.begin(); i != g_accel_windows.end(); ++i) { GtkWindow* toplevel = *i; ASSERT_MESSAGE(!window_has_accel(toplevel), "ERROR"); ASSERT_MESSAGE(GTK_WIDGET_TOPLEVEL(toplevel), "enabling accel for non-toplevel window"); gtk_window_add_accel_group(toplevel, global_accel); #if 0 globalOutputStream() << reinterpret_cast<unsigned int>(toplevel) << ": enabled global accelerators\n"; #endif #if 0 accel_group_test(toplevel, global_accel); #endif } GlobalQueuedAccelerators_commit(); } buttons = bitfield_disable(buttons, ButtonMask_for_event_button(button)); #if 0 globalOutputStream() << "Buttons_release: "; print_buttons(buttons); #endif return false; }
void accel_group_test(GtkWindow* toplevel, GtkAccelGroup* accel) { guint n_entries; gtk_accel_group_query(accel, '4', (GdkModifierType)0, &n_entries); globalOutputStream() << "grid4: " << n_entries << "\n"; globalOutputStream() << "toplevel accelgroups: " << g_slist_length(gtk_accel_groups_from_object(G_OBJECT(toplevel))) << "\n"; }
static void GlobalGL_sharedContextCreated (void) { // report OpenGL information globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*> (glGetString(GL_VENDOR)) << "\n"; globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*> (glGetString(GL_RENDERER)) << "\n"; globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*> (glGetString(GL_VERSION)) << "\n"; globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*> (glGetString(GL_EXTENSIONS)) << "\n"; QGL_sharedContextCreated(GlobalOpenGL()); GlobalShaderCache().realise(); GlobalTexturesCache().realise(); /* use default font here (Sans 10 is gtk default) */ GtkSettings *settings = gtk_settings_get_default(); gchar* fontname; g_object_get(settings, "gtk-font-name", &fontname, (char*) 0); g_font = glfont_create(fontname); // Fallbacks if (g_font.getPixelHeight() == -1) g_font = glfont_create("Sans 10"); if (g_font.getPixelHeight() == -1) g_font = glfont_create("fixed 10"); if (g_font.getPixelHeight() == -1) g_font = glfont_create("courier new 10"); GlobalOpenGL().m_font = g_font.getDisplayList(); GlobalOpenGL().m_fontHeight = g_font.getPixelHeight(); }
void SoundManager::initialiseModule(const ApplicationContext& ctx) { globalOutputStream() << "SoundManager::initialiseModule called\n"; // Pass a SoundFileLoader to the filesystem SoundFileLoader loader(*this); GlobalFileSystem().forEachFile( SOUND_FOLDER, // directory "*", // required extension loader, // loader callback 99 // max depth ); globalOutputStream() << _soundFiles.size() << " sound files found." << std::endl; // Create the SoundPlayer if sound is not disabled const ApplicationContext::ArgumentList& args = ctx.getCmdLineArgs(); ApplicationContext::ArgumentList::const_iterator found( std::find(args.begin(), args.end(), "--disable-sound") ); if (found == args.end()) { globalOutputStream() << "SoundManager: initialising sound playback" << std::endl; _soundPlayer = boost::shared_ptr<SoundPlayer>(new SoundPlayer); } else { globalOutputStream() << "SoundManager: sound ouput disabled" << std::endl; } }
void LoadCommandMap( const char* path ){ StringOutputStream strINI( 256 ); strINI << path << "shortcuts.ini"; FILE* f = fopen( strINI.c_str(), "r" ); if ( f != 0 ) { fclose( f ); globalOutputStream() << "loading custom shortcuts list from " << makeQuoted( strINI.c_str() ) << "\n"; Version version = version_parse( COMMANDS_VERSION ); Version dataVersion = { 0, 0 }; { char value[1024]; if ( read_var( strINI.c_str(), "Version", "number", value ) ) { dataVersion = version_parse( value ); } } if ( version_compatible( version, dataVersion ) ) { globalOutputStream() << "commands import: data version " << dataVersion << " is compatible with code version " << version << "\n"; ReadCommandMap visitor( strINI.c_str() ); GlobalShortcuts_foreach( visitor ); globalOutputStream() << "parsed " << Unsigned( visitor.count() ) << " custom shortcuts\n"; } else { globalOutputStream() << "commands import: data version " << dataVersion << " is not compatible with code version " << version << "\n"; } } else { globalOutputStream() << "failed to load custom shortcuts from " << makeQuoted( strINI.c_str() ) << "\n"; } }
// called whenever we need to open/close/check the console log file void Sys_LogFile( bool enable ){ if ( enable && !g_hLogFile ) { // settings say we should be logging and we don't have a log file .. so create it if ( !SettingsPath_get()[0] ) { return; // cannot open a log file yet } // open a file to log the console (if user prefs say so) // the file handle is g_hLogFile // the log file is erased StringOutputStream name( 256 ); name << SettingsPath_get() << "radiant.log"; g_hLogFile = fopen( name.c_str(), "w" ); if ( g_hLogFile != 0 ) { globalOutputStream() << "Started logging to " << name.c_str() << "\n"; time_t localtime; time( &localtime ); globalOutputStream() << "Today is: " << ctime( &localtime ) << "This is NetRadiant '" RADIANT_VERSION "' compiled " __DATE__ "\n" RADIANT_ABOUTMSG "\n"; } else{ gtk_MessageBox( 0, "Failed to create log file, check write permissions in Radiant directory.\n", "Console logging", eMB_OK, eMB_ICONERROR ); } } else if ( !enable && g_hLogFile != 0 ) { // settings say we should not be logging but still we have an active logfile .. close it time_t localtime; time( &localtime ); globalOutputStream() << "Closing log file at " << ctime( &localtime ) << "\n"; fclose( g_hLogFile ); g_hLogFile = 0; } }
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){ if ( string_equal( command, "About" ) ) { globalOutputStream() << "Sample Demo Plugin\n"; } if ( string_equal( command, "Do Something" ) ) { globalOutputStream() << "Sample Command\n"; } }
void radio_button_print_state( GtkRadioButton* button ){ globalOutputStream() << "toggle button: "; for ( GSList* radio = gtk_radio_button_group( button ); radio != 0; radio = g_slist_next( radio ) ) { globalOutputStream() << gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio->data ) ); } globalOutputStream() << "\n"; }
// Constructor EventManager () : _modifiers(), _mouseEvents(_modifiers) { globalOutputStream() << "EventManager started.\n"; // Create an empty GClosure _accelGroup = gtk_accel_group_new(); globalOutputStream() << "EventManager started.\n"; }
void CGameDialog::SavePrefs(){ StringOutputStream strGlobalPref( 256 ); strGlobalPref << g_Preferences.m_global_rc_path->str << "global.pref"; globalOutputStream() << "saving global preferences to " << strGlobalPref.c_str() << "\n"; if ( !Preferences_Save_Safe( g_global_preferences, strGlobalPref.c_str() ) ) { globalOutputStream() << "failed to save global preferences to " << strGlobalPref.c_str() << "\n"; } }
void CGameDialog::LoadPrefs(){ // load global .pref file StringOutputStream strGlobalPref( 256 ); strGlobalPref << g_Preferences.m_global_rc_path->str << "global.pref"; globalOutputStream() << "loading global preferences from " << makeQuoted( strGlobalPref.c_str() ) << "\n"; if ( !Preferences_Load( g_global_preferences, strGlobalPref.c_str(), "global" ) ) { globalOutputStream() << "failed to load global preferences from " << strGlobalPref.c_str() << "\n"; } }
/* Constructor: Load the definitions from the XMLRegistry */ ToolbarCreator::ToolbarCreator() { globalOutputStream() << "ToolbarCreator: Loading toolbar information from registry.\n"; try { // Query the registry loadToolbars(); } catch (std::runtime_error &e) { globalOutputStream() << "ToolbarCreator: Warning: " << e.what() << "\n"; } globalOutputStream() << "ToolbarCreator: Finished loading toolbar information.\n"; }
void print_buttons( ButtonMask mask ){ globalOutputStream() << "button state: "; if ( ( mask & MouseButton::Left ) != 0 ) { globalOutputStream() << "Left "; } if ( ( mask & MouseButton::Right ) != 0 ) { globalOutputStream() << "Right "; } if ( ( mask & MouseButton::Middle ) != 0 ) { globalOutputStream() << "Middle "; } globalOutputStream() << "\n"; }
void MouseEventManager::loadObserverEventDefinitions () { xml::NodeList observers = GlobalRegistry().findXPath("user/ui/input//observer"); if (observers.size() > 0) { // Find all the observer definitions xml::NodeList eventList = observers[0].getNamedChildren("event"); if (eventList.size() > 0) { globalOutputStream() << "MouseEventManager: Observer Definitions found: " << eventList.size() << "\n"; for (unsigned int i = 0; i < eventList.size(); i++) { // Get the event name const std::string eventName = eventList[i].getAttributeValue("name"); // Check if any recognised event names are found and construct the according condition. if (eventName == "Manipulate") { _observerConditions[ui::obsManipulate] = getCondition(eventList[i]); } else if (eventName == "Select") { _observerConditions[ui::obsSelect] = getCondition(eventList[i]); } else if (eventName == "ToggleSelection") { _observerConditions[ui::obsToggle] = getCondition(eventList[i]); } else if (eventName == "ToggleFaceSelection") { _observerConditions[ui::obsToggleFace] = getCondition(eventList[i]); } else if (eventName == "CycleSelection") { _observerConditions[ui::obsReplace] = getCondition(eventList[i]); } else if (eventName == "CycleFaceSelection") { _observerConditions[ui::obsReplaceFace] = getCondition(eventList[i]); } else if (eventName == "CopyTexture") { _observerConditions[ui::obsCopyTexture] = getCondition(eventList[i]); } else if (eventName == "PasteTexture") { _observerConditions[ui::obsPasteTexture] = getCondition(eventList[i]); } else if (eventName == "PasteTextureToBrush") { _observerConditions[ui::obsPasteTextureToBrush] = getCondition(eventList[i]); } else if (eventName == "JumpToObject") { _observerConditions[ui::obsJumpToObject] = getCondition(eventList[i]); } else { globalOutputStream() << "MouseEventManager: Warning: Ignoring unknown event name: " << eventName << "\n"; } } } else { // No observer definitions found! globalOutputStream() << "MouseEventManager: Critical: No observer event definitions found!\n"; } } else { // No observer definitions found! globalOutputStream() << "MouseEventManager: Critical: No observer event definitions found!\n"; } }
GdkGLConfig* glconfig_new(){ GdkGLConfig* glconfig = 0; for ( configs_iterator i = configs, end = configs + 2; i != end; ++i ) { glconfig = gdk_gl_config_new( ( *i ).attribs ); if ( glconfig != 0 ) { globalOutputStream() << "OpenGL window configuration: " << ( *i ).name << "\n"; return glconfig; } } globalOutputStream() << "OpenGL window configuration: colour-buffer = auto, depth-buffer = none\n"; return gdk_gl_config_new_by_mode( (GdkGLConfigMode)( GDK_GL_MODE_RGBA | GDK_GL_MODE_DOUBLE ) ); }
const char* misc_model_dialog(GtkWidget* parent) { StringOutputStream buffer(1024); buffer << g_qeglobals.m_userGamePath.c_str() << "models/"; if(!file_readable(buffer.c_str())) { // just go to fsmain buffer.clear(); buffer << g_qeglobals.m_userGamePath.c_str() << "/"; } const char *filename = file_dialog (parent, TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name()); if (filename != 0) { // use VFS to get the correct relative path const char* relative = path_make_relative(filename, GlobalFileSystem().findRoot(filename)); if(relative == filename) { globalOutputStream() << "WARNING: could not extract the relative path, using full path instead\n"; } return relative; } return 0; }
void EClassManager::initialiseModule(const ApplicationContext& ctx) { globalOutputStream() << "EntityClassDoom3::initialiseModule called." << std::endl; GlobalFileSystem().addObserver(*this); realise(); }
void WaveFrontModule::exportSelectionAsOBJ(const cmd::ArgumentList& args) { const SelectionInfo& info = GlobalSelectionSystem().getSelectionInfo(); if (info.totalCount == 0) { globalErrorStream() << "Nothing selected, cannot export." << std::endl; return; } // Query the filename from the user ui::IFileChooserPtr chooser = GlobalDialogManager().createFileChooser( _("Save as Obj"), false, false, "*.obj", ".obj" ); chooser->setCurrentPath(GlobalRegistry().get(RKEY_MAP_PATH)); std::string path = chooser->display(); if (!path.empty()) { globalOutputStream() << "Exporting selection as OBJ to " << path << std::endl; // Instantiate a new exporter WaveFrontExporter exporter(path); exporter.exportSelection(); } }
// advance camera to next point void Pointfile_Next (void) { if(!s_pointfile.shown()) return; if (s_check_point+2 == s_pointfile.end()) { globalOutputStream() << "End of pointfile\n"; return; } CPointfile::const_iterator i = ++s_check_point; CamWnd& camwnd = *g_pParentWnd->GetCamWnd(); Camera_setOrigin(camwnd, *i); g_pParentWnd->GetXYWnd()->SetOrigin(*i); { Vector3 dir(vector3_normalised(vector3_subtracted(*(++i), Camera_getOrigin(camwnd)))); Vector3 angles(Camera_getAngles(camwnd)); angles[CAMERA_YAW] = static_cast<float>(radians_to_degrees(atan2(dir[1], dir[0]))); angles[CAMERA_PITCH] = static_cast<float>(radians_to_degrees(asin(dir[2]))); Camera_setAngles(camwnd, angles); } }
void PicoPrintFunc( int level, const char *str ) { if( str == 0 ) return; switch( level ) { case PICO_NORMAL: globalOutputStream() << str << "\n"; break; case PICO_VERBOSE: //globalOutputStream() << "PICO_VERBOSE: " << str << "\n"; break; case PICO_WARNING: globalErrorStream() << "PICO_WARNING: " << str << "\n"; break; case PICO_ERROR: globalErrorStream() << "PICO_ERROR: " << str << "\n"; break; case PICO_FATAL: globalErrorStream() << "PICO_FATAL: " << str << "\n"; break; } }
/* Parses the XML Document for toolbars and instantiates them * Returns nothing, toolbars can be obtained via GetToolbar() */ void ToolbarManager::loadToolbars() { xml::NodeList toolbarList = GlobalRegistry().findXPath("//ui//toolbar"); if (!toolbarList.empty()) { // Create a new tooltips element _tooltips = gtk_tooltips_new(); gtk_tooltips_enable(_tooltips); for (std::size_t i = 0; i < toolbarList.size(); i++) { std::string toolbarName = toolbarList[i].getAttributeValue("name"); if (toolbarExists(toolbarName)) { //globalOutputStream() << "This toolbar already exists: "; continue; } globalOutputStream() << "Found toolbar: " << toolbarName << std::endl; _toolbars.insert(toolbarName); } } else { throw std::runtime_error("No toolbars found."); } }
bool MapResource_saveFile(const MapFormat& format, scene::Node& root, GraphTraversalFunc traverse, const char* filename) { //ASSERT_MESSAGE(path_is_absolute(filename), "MapResource_saveFile: path is not absolute: " << makeQuoted(filename)); globalOutputStream() << "Open file " << filename << " for write..."; TextFileOutputStream file(filename); if(!file.failed()) { globalOutputStream() << "success\n"; ScopeDisableScreenUpdates disableScreenUpdates(path_get_filename_start(filename), "Saving Map"); format.writeGraph(root, traverse, file); return true; } globalErrorStream() << "failure\n"; return false; }
NodeSmartReference ModelResource_load(ModelLoader* loader, const char* name) { ScopeDisableScreenUpdates disableScreenUpdates(path_get_filename_start(name), "Loading Model"); NodeSmartReference model(g_nullModel); { ArchiveFile* file = GlobalFileSystem().openFile(name); if(file != 0) { globalOutputStream() << "Loaded Model: \"" << name << "\"\n"; model = loader->loadModel(*file); file->release(); } else { globalErrorStream() << "Model load failed: \"" << name << "\"\n"; } } model.get().m_isRoot = true; return model; }