From ab7d2b568084cc48020926386316473fe14f6554 Mon Sep 17 00:00:00 2001 From: rambetter Date: Wed, 15 Dec 2010 06:42:34 +0000 Subject: [PATCH 01/10] Creating a temporary branch for Rambetter to use in order to fix some outstanding issues while the lib-reassembly is taking place. This branch is starting out as a copy of r347. I [Rambetter] am not able to work on trunk at the moment because it is broken on Windows due to the DLL nightmare that is going on. I would like to fix some bugs in the meantime. Commits that should be imported back into trunk will be clearly marked as such. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@348 8a3a26a2-13c4-0310-b231-cf6edde360e5 From 7f2f9610badcb9170590bc9ac48875ef7b61a5ce Mon Sep 17 00:00:00 2001 From: rambetter Date: Wed, 15 Dec 2010 06:56:33 +0000 Subject: [PATCH 02/10] Backing out r347 and r345. Keeping r346. So, this branch is now r344 with patch r346. DO NOT MERGE THIS CHANGE INTO TRUNK!!!! git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@349 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- config.py | 38 +++++++++++---------------- contrib/camera/camera.def | 1 + contrib/camera/camera_VC9.vcproj | 6 ++--- plugins/entity/entity.def | 1 + plugins/entity/entity_VC9.vcproj | 2 -- plugins/image/image.def | 1 + plugins/image/image_VC9.vcproj | 1 - plugins/imagepng/imagepng.def | 1 + plugins/imagepng/imagepng_VC9.vcproj | 2 -- plugins/imagepng/plugin.cpp | 14 +++++----- plugins/map/map.def | 3 ++- plugins/map/map_VC9.vcproj | 2 -- plugins/mapxml/mapxml.def | 1 + plugins/mapxml/mapxml_VC9.vcproj | 2 -- plugins/model/model.def | 1 + plugins/model/model_VC9.vcproj | 2 -- plugins/shaders/shaders.def | 1 + plugins/shaders/shaders_VC9.vcproj | 2 -- plugins/surface/surface.def | 1 + plugins/surface/surface_VC9.vcproj | 6 ++--- plugins/vfspk3/vfspk3.def | 1 + plugins/vfspk3/vfspk3_VC9.vcproj | 2 -- radiant/file.cpp | 2 +- radiant/gtkdlgs.cpp | 2 +- radiant/mainframe.cpp | 2 +- radiant/preferences.cpp | 10 +++---- radiant/radiant_VC9.vcproj | 28 ++++++++++---------- tools/quake3/q3map2/q3map2_VC9.vcproj | 1 - 28 files changed, 57 insertions(+), 79 deletions(-) diff --git a/config.py b/config.py index 5ae584b..e91e9f1 100644 --- a/config.py +++ b/config.py @@ -273,7 +273,7 @@ class Config: self.FetchGamePaks( self.install_directory ) # NOTE: unrelated to self.setup_platforms - grab support files and binaries and install them if ( self.platform == 'Windows' ): - depsfile = 'GtkR-deps-1.6-5.zip' + depsfile = 'GtkR-deps-1.6-4.zip' if ( not os.path.exists( depsfile ) ): cmd = [ 'wget', '-N', 'http://zerowing.idsoftware.com/files/radiant/developer/1.6.1/%s' % depsfile ] print( repr( cmd ) ) @@ -291,37 +291,28 @@ class Config: # copy all the dependent runtime data to the install directory srcdir = os.path.dirname( backup_cwd ) for f in [ - # USE THE DEPENDENCY WALKER - # tier 1: radiant.exe direct deps - # tier 2: deps of tier 1 DLLs - # etc. - # tier 1 'libxml2/bin/libxml2.dll', - 'libxml2/bin/iconv.dll', 'gtk2/bin/libglib-2.0-0.dll', 'gtk2/bin/libgobject-2.0-0.dll', 'gtk2/bin/libgdk-win32-2.0-0.dll', 'gtk2/bin/libgtk-win32-2.0-0.dll', 'gtk2/bin/intl.dll', - 'gtk2/bin/libpango-1.0-0.dll', - 'gtk2/bin/libpangoft2-1.0-0.dll', - 'gtk2/lib/gtkglext-1.2.0/lib/libgtkglext-win32-1.0-0.dll', - 'gtk2/lib/gtkglext-1.2.0/lib/libgdkglext-win32-1.0-0.dll', - # tier 2 - 'gtk2/bin/libgthread-2.0-0.dll', + 'gtk2/bin/libatk-1.0-0.dll', 'gtk2/bin/libcairo-2.dll', 'gtk2/bin/libgdk_pixbuf-2.0-0.dll', + 'gtk2/bin/libgmodule-2.0-0.dll', + 'gtk2/bin/libpng13.dll', + 'gtk2/bin/libpango-1.0-0.dll', + 'gtk2/bin/libpangoft2-1.0-0.dll', 'gtk2/bin/libpangocairo-1.0-0.dll', 'gtk2/bin/libpangowin32-1.0-0.dll', - 'gtk2/bin/libatk-1.0-0.dll', - 'gtk2/bin/libgmodule-2.0-0.dll', - 'gtk2/bin/libfontconfig-1.dll', - 'gtk2/bin/freetype6.dll', - # tier 3 - 'gtk2/bin/libexpat-1.dll', - 'gtk2/bin/libpng14-14.dll', - 'gtk2/bin/zlib1.dll', - 'gtk2/bin/libgio-2.0-0.dll', + 'gtk2/lib/libgtkglext-win32-1.0-0.dll', + 'gtk2/lib/libgdkglext-win32-1.0-0.dll', + 'gtk2/lib/iconv.dll', + 'gtk2/zlib1.dll', + 'freetype-dev_2.4.2-1_win32/bin/freetype6.dll', + 'fontconfig-dev_2.8.0-2_win32/bin/libfontconfig-1.dll', + 'expat_2.0.1-1_win32/bin/libexpat-1.dll', ]: cmd = [ 'cp', '-v', os.path.join( srcdir, f ), 'install' ] print( repr( cmd ) ) @@ -329,6 +320,9 @@ class Config: for d in [ 'gtk2/etc', 'gtk2/share', + 'fontconfig-dev_2.8.0-2_win32/etc', + 'fontconfig-dev_2.8.0-2_win32/share', + 'freetype-dev_2.4.2-1_win32/share', ]: cmd = [ 'cp', '-r', '-v', os.path.join( srcdir, d ), 'install' ] print( repr( cmd ) ) diff --git a/contrib/camera/camera.def b/contrib/camera/camera.def index ddec12c..6a59743 100644 --- a/contrib/camera/camera.def +++ b/contrib/camera/camera.def @@ -1,6 +1,7 @@ ; camera.def : Declares the module parameters for the DLL. LIBRARY "CAMERA" +DESCRIPTION 'CAMERA Windows Dynamic Link Library' EXPORTS ; Explicit exports can go here diff --git a/contrib/camera/camera_VC9.vcproj b/contrib/camera/camera_VC9.vcproj index bf1b24c..e10dbd7 100755 --- a/contrib/camera/camera_VC9.vcproj +++ b/contrib/camera/camera_VC9.vcproj @@ -40,7 +40,7 @@ #define X_OK 0 @@ -3363,7 +3359,7 @@ void CGameInstall::BuildDialog() { void CGameInstall::Run() { ScanGames(); - if ( m_availGames[0] == GAME_NONE ) { + if (m_availGames[0] == GAME_NONE) { return; } if ( DoModal() == IDCANCEL ) { @@ -3379,8 +3375,8 @@ void CGameInstall::Run() { gameFilePath += ".game"; Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() ); - FILE * fg = fopen( gameFilePath.GetBuffer(), "w" ); - if ( fg == NULL ) { + FILE *fg = fopen( gameFilePath.GetBuffer(), "w" ); + if ( fg == NULL || ferror( fg ) ) { Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() ); } fprintf( fg, "\n - - - - @@ -2428,6 +2420,14 @@ RelativePath="..\..\src\gtk+\gtk\makefile.msc" > + + + + Date: Wed, 15 Dec 2010 09:52:26 +0000 Subject: [PATCH 03/10] Progressing on bringing Radiant 1.6.x to a workable state on Windows. This commit: 1. Reverts to using GtkR-deps-1.6-3.zip (instead of GtkR-deps-1.6-4.zip). Some font-related DLLs are therefore no longer used with this patch. 2. Because of the above #1, now using the really old OpenGL font rendering code on Windows systems. This is controlled via "#ifdef _WIN32" blocks. Linux still uses the new and improved OpenGL font rendering. Note that this old font rendering that Windows now uses (err, has used in the past too) makes use of gdk_gl_font_use_pango_font(), which is really old and crufty. So, with this commit Radiant is fully working (modulo bugs) on Linux and Windows, and OpenGL fonts work too. I WOULD NOT SUGGEST MERGING THIS CHANGE INTO TRUNK. THE CORRECT APPROACH IS TO INSTEAD FIX THE DLL LIBRARY DEPENDENCIES IN TRUNK. I AM ONLY COMMITTING THIS SO THAT I CAN CONTINUE FIXING BUGS IN RADIANT IN THE MEANTIME. There are still a zillion bugs on Windows. For example, I can't even save a .map file at this point. That is my next task, to fix saving of .map files. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@350 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- config.py | 14 +++--- radiant/glwidget.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index e91e9f1..e0f20a0 100644 --- a/config.py +++ b/config.py @@ -273,7 +273,7 @@ class Config: self.FetchGamePaks( self.install_directory ) # NOTE: unrelated to self.setup_platforms - grab support files and binaries and install them if ( self.platform == 'Windows' ): - depsfile = 'GtkR-deps-1.6-4.zip' + depsfile = 'GtkR-deps-1.6-3.zip' if ( not os.path.exists( depsfile ) ): cmd = [ 'wget', '-N', 'http://zerowing.idsoftware.com/files/radiant/developer/1.6.1/%s' % depsfile ] print( repr( cmd ) ) @@ -310,9 +310,9 @@ class Config: 'gtk2/lib/libgdkglext-win32-1.0-0.dll', 'gtk2/lib/iconv.dll', 'gtk2/zlib1.dll', - 'freetype-dev_2.4.2-1_win32/bin/freetype6.dll', - 'fontconfig-dev_2.8.0-2_win32/bin/libfontconfig-1.dll', - 'expat_2.0.1-1_win32/bin/libexpat-1.dll', +# 'freetype-dev_2.4.2-1_win32/bin/freetype6.dll', +# 'fontconfig-dev_2.8.0-2_win32/bin/libfontconfig-1.dll', +# 'expat_2.0.1-1_win32/bin/libexpat-1.dll', ]: cmd = [ 'cp', '-v', os.path.join( srcdir, f ), 'install' ] print( repr( cmd ) ) @@ -320,9 +320,9 @@ class Config: for d in [ 'gtk2/etc', 'gtk2/share', - 'fontconfig-dev_2.8.0-2_win32/etc', - 'fontconfig-dev_2.8.0-2_win32/share', - 'freetype-dev_2.4.2-1_win32/share', +# 'fontconfig-dev_2.8.0-2_win32/etc', +# 'fontconfig-dev_2.8.0-2_win32/share', +# 'freetype-dev_2.4.2-1_win32/share', ]: cmd = [ 'cp', '-r', '-v', os.path.join( srcdir, d ), 'install' ] print( repr( cmd ) ) diff --git a/radiant/glwidget.cpp b/radiant/glwidget.cpp index 7a408f9..57699b3 100644 --- a/radiant/glwidget.cpp +++ b/radiant/glwidget.cpp @@ -33,7 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "stdafx.h" #include + +#ifndef _WIN32 #include +#endif + #include "glwidget.h" #include "qgl.h" @@ -208,6 +212,15 @@ gboolean WINAPI gtk_glwidget_make_current (GtkWidget *widget) } +#ifdef _WIN32 + +GLuint font_list_base; +static gchar font_string[] = "courier 8"; +static gint font_height; +static int font_created = 0; + +#else + // Think about rewriting this font stuff to use OpenGL display lists and glBitmap(). // Bit maps together with display lists may offer a performance increase, but // they would not allow antialiased fonts. @@ -219,31 +232,88 @@ static int y_offset_bitmap_render_pango_units = -1; static PangoContext *ft2_context = NULL; static int _debug_font_created = 0; +#endif + // Units are pixels. Returns a positive value [most likely]. int gtk_glwidget_font_ascent() { +#ifdef _WIN32 + + return 6; // Approximation. + +#else + if (!_debug_font_created) { Error("Programming error: gtk_glwidget_font_ascent() called but font does not exist; " "you should have called gtk_glwidget_create_font() first"); } return font_ascent; + +#endif } // Units are pixels. Returns a positive value [most likely]. int gtk_glwidget_font_descent() { +#ifdef _WIN32 + + return 0; // Approximation. + +#else + if (!_debug_font_created) { Error("Programming error: gtk_glwidget_font_descent() called but font does not exist; " "you should have called gtk_glwidget_create_font() first"); } return font_descent; + +#endif } +#ifdef _WIN32 + +void gtk_glwidget_create_font_win_internal() +{ + if (font_created) return; + font_created = 1; + + PangoFontDescription *font_desc; + PangoFont *font; + PangoFontMetrics *font_metrics; + + font_list_base = qglGenLists (256); + + font_desc = pango_font_description_from_string (font_string); + + font = gdk_gl_font_use_pango_font (font_desc, 0, 256, font_list_base); + + if(font != NULL) + { + font_metrics = pango_font_get_metrics (font, NULL); + + font_height = pango_font_metrics_get_ascent (font_metrics) + + pango_font_metrics_get_descent (font_metrics); + font_height = PANGO_PIXELS (font_height); + + pango_font_metrics_unref (font_metrics); + } + + pango_font_description_free (font_desc); +} + +#endif + void gtk_glwidget_create_font() { +#ifdef _WIN32 + + // Do nothing. + +#else + PangoFontDescription *font_desc; PangoLayout *layout; PangoRectangle log_rect; @@ -294,10 +364,18 @@ void gtk_glwidget_create_font() font_ascent = PANGO_PIXELS_CEIL(font_ascent_pango_units); font_descent = PANGO_PIXELS_CEIL(font_descent_pango_units); y_offset_bitmap_render_pango_units = (font_ascent * PANGO_SCALE) - font_ascent_pango_units; + +#endif } void gtk_glwidget_destroy_font() { +#ifdef _WIN32 + + // Do nothing. + +#else + if (!_debug_font_created) { Error("Programming error: gtk_glwidget_destroy_font() called when font " "does not exist"); @@ -308,6 +386,8 @@ void gtk_glwidget_destroy_font() y_offset_bitmap_render_pango_units = -1; g_object_unref(G_OBJECT(ft2_context)); _debug_font_created = 0; + +#endif } @@ -323,6 +403,14 @@ void gtk_glwidget_destroy_font() // Google for "glDrawPixels clipping". void gtk_glwidget_print_string(const char *s) { +#ifdef _WIN32 + + gtk_glwidget_create_font_win_internal(); + qglListBase(font_list_base); + qglCallLists(strlen(s), GL_UNSIGNED_BYTE, (unsigned char *)s); + +#else + // The idea for this code initially came from the font-pangoft2.c example that comes with GtkGLExt. PangoLayout *layout; @@ -396,12 +484,24 @@ void gtk_glwidget_print_string(const char *s) } g_object_unref(G_OBJECT(layout)); + +#endif } void gtk_glwidget_print_char(char s) { +#ifdef _WIN32 + + gtk_glwidget_create_font_win_internal(); + qglListBase(font_list_base); + qglCallLists(1, GL_UNSIGNED_BYTE, (unsigned char *) &s); + +#else + char str[2]; str[0] = s; str[1] = '\0'; gtk_glwidget_print_string(str); + +#endif } From f482df40a1c1e26f17734fd52e757314020650c0 Mon Sep 17 00:00:00 2001 From: rambetter Date: Thu, 16 Dec 2010 07:08:00 +0000 Subject: [PATCH 04/10] Fixing the native Windows file dialog in Rametter-temp-fixes branch of GtkRadiant. The previous code was Plain Old Wrong (TM) in the way that it handled determining which "Save as type" was selected in the file save dialog. This change affects the function file_dialog() in gtkmisc.cpp. Fix has been tested on Windows 7 when the pattern input parameter is something such as "map" and when it's null. Will test Windows XP shortly and follow up with another commit if it's not working correctly there. THIS COMMIT SHOULD BE MERGED INTO TRUNK AT SOME POINT!!! git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@351 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/gtkmisc.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 6b54918..8af434c 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1123,6 +1123,13 @@ public: return filetype_t(); } + filetype_t GetTypeForIndex(int index) // Zero-based index. + { + if (index >= 0 && index < m_nTypes) + return filetype_t(m_pTypes[index].m_name.c_str(), m_pTypes[index].m_pattern.c_str()); + return filetype_t(); + } + char *m_strWin32Filters; char **m_pstrGTKMasks; private: @@ -1227,9 +1234,6 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c #endif #ifdef _WIN32 - // win32 dialog stores the selected "save as type" extension in the second null-terminated string - char customfilter[FILEDLG_CUSTOM_FILTER_LENGTH]; - if (g_PrefsDlg.m_bNativeGUI) { #ifdef FILEDLG_DBG @@ -1238,19 +1242,22 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c // do that the native way /* Place the terminating null character in the szFile. */ szFile[0] = '\0'; - customfilter[0] = customfilter[1] = customfilter[2] = '\0'; /* Set the members of the OPENFILENAME structure. */ + // See http://msdn.microsoft.com/en-us/library/ms646839%28v=vs.85%29.aspx . ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = (HWND)GDK_WINDOW_HWND (g_pParentWnd->m_pWidget->window); + ofn.nFilterIndex = 1; // The index is 1-based, not 0-based. This basically says, + // "select the first filter by default". if (pattern) { - ofn.nFilterIndex = 0; ofn.lpstrFilter = typelist.m_strWin32Filters; } - else ofn.nFilterIndex = 1; - ofn.lpstrCustomFilter = customfilter; - ofn.nMaxCustFilter = sizeof(customfilter); + else + { + ofn.lpstrFilter = "All files\0*\0\0"; + } + ofn.lpstrCustomFilter = NULL; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFileTitle = NULL; // we don't need to get the name of the file @@ -1283,7 +1290,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c } if(pattern != NULL) - type = typelist.GetTypeForWin32Filter(customfilter+1); + type = typelist.GetTypeForIndex(ofn.nFilterIndex - 1); #ifdef FILEDLG_DBG Sys_Printf("Done.\n"); From b1b208f12e64cdac5c3ada7348492d62e882dd91 Mon Sep 17 00:00:00 2001 From: rambetter Date: Sat, 18 Dec 2010 03:03:55 +0000 Subject: [PATCH 05/10] Improving native Windows file dialog in Rambetter-temp-fixes branch some more. This adds new code and improves code committed in revision 351. - Calling GetOpenFileName() and GetSaveFileName() from a new thread, thus allowing the main thread to continue refreshing GtkRadiant while the native Windows file dialog is open. Prevents the ugly "hall of mirrors" effect. A similar approach is used in the open source Inkscape, so I'm not doing anything too dangerous here. However, this _is_ hacky in my opinion. - Using memset() to zero out the memory of the OPENFILENAME structure. This is safer than selectively setting fields on this structure. We no longer need to explicity set certain field to NULL now. - "all files" filter now lowercase to be consistent with other code. These changes have been tested on Windows XP and Windows 7. THIS COMMIT SHOULD BE MERGED INTO TRUNK AT SOME POINT!!! git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@352 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/gtkmisc.cpp | 93 +++++++++++++++++++++++++++++++++-------- radiant/preferences.cpp | 2 +- 2 files changed, 76 insertions(+), 19 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 8af434c..6ce83c7 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1203,11 +1203,45 @@ private: }; +#ifdef _WIN32 + +static int in_file_dialog = 0; + +typedef struct { + gboolean open; + OPENFILENAME *ofn; + BOOL dlgRtnVal; + int done; +} win32_native_file_dialog_comms_t; + +DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam) +{ + win32_native_file_dialog_comms_t *fileDialogComms; + fileDialogComms = (win32_native_file_dialog_comms_t *) lpParam; + if (fileDialogComms->open) { + fileDialogComms->dlgRtnVal = GetOpenFileName(fileDialogComms->ofn); + } + else { + fileDialogComms->dlgRtnVal = GetSaveFileName(fileDialogComms->ofn); + } + fileDialogComms->done = -1; // No need to synchronize around lock. + return 0; +} + +#endif + /** * @param[in] baseSubDir should have a trailing slash if not @c NULL */ const char* file_dialog (void *parent, gboolean open, const char* title, const char* path, const char* pattern, const char *baseSubDir) { + +#ifdef _WIN32 + HANDLE fileDialogThreadHandle; + win32_native_file_dialog_comms_t fileDialogComms; + int dialogDone; +#endif + // Gtk dialog GtkWidget* file_sel; int loop = 1; @@ -1240,27 +1274,29 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c Sys_Printf("Doing win32 file dialog..."); #endif // do that the native way - /* Place the terminating null character in the szFile. */ - szFile[0] = '\0'; + if (in_file_dialog) return NULL; // Avoid recursive entry. + in_file_dialog = 1; /* Set the members of the OPENFILENAME structure. */ // See http://msdn.microsoft.com/en-us/library/ms646839%28v=vs.85%29.aspx . - ofn.lStructSize = sizeof(OPENFILENAME); + memset(&ofn, 0, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = (HWND)GDK_WINDOW_HWND (g_pParentWnd->m_pWidget->window); ofn.nFilterIndex = 1; // The index is 1-based, not 0-based. This basically says, - // "select the first filter by default". + // "select the first filter as default". if (pattern) { ofn.lpstrFilter = typelist.m_strWin32Filters; } else { - ofn.lpstrFilter = "All files\0*\0\0"; + // TODO: Would be a bit cleaner if we could extract this string from + // GetFileTypeRegistry() instead of hardcoding it here. + ofn.lpstrFilter = "all files\0*.*\0"; // Second '\0' will be added to end of string. } - ofn.lpstrCustomFilter = NULL; + szFile[0] = '\0'; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); - ofn.lpstrFileTitle = NULL; // we don't need to get the name of the file if(path) { // szDirName: Radiant uses unix convention for paths internally @@ -1272,21 +1308,42 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c *w = '\0'; ofn.lpstrInitialDir = szDirName; } - else ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = title; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - /* Display the Open dialog box. */ - // it's open or close depending on 'open' parameter - if (open) - { - if (!GetOpenFileName(&ofn)) - return NULL; // canceled + memset(&fileDialogComms, 0, sizeof(fileDialogComms)); + fileDialogComms.open = open; + fileDialogComms.ofn = &ofn; + + fileDialogThreadHandle = + CreateThread(NULL, // lpThreadAttributes + 0, // dwStackSize, default stack size + win32_native_file_dialog_thread_func, // lpStartAddress, funcion to call + &fileDialogComms, // lpParameter, argument to pass to function + 0, // dwCreationFlags + NULL); // lpThreadId + + dialogDone = 0; + while (1) { + // Avoid blocking indefinitely. Another thread will set fileDialogComms->done to nonzero; + // we don't want to be in an indefinite blocked state when this happens. We want to break + // out of here eventually. + while (gtk_events_pending()) { + gtk_main_iteration(); + } + if (dialogDone) break; + if (fileDialogComms.done) dialogDone = 1; // One more loop of gtk_main_iteration() to get things in sync. + // Avoid tight infinte loop, add a small amount of sleep. + Sleep(10); } - else - { - if (!GetSaveFileName(&ofn)) - return NULL; // canceled + // Make absolutely sure that the thread is finished before we call CloseHandle(). + WaitForSingleObject(fileDialogThreadHandle, INFINITE); + CloseHandle(fileDialogThreadHandle); + + in_file_dialog = 0; + + if (!fileDialogComms.dlgRtnVal) { + return NULL; // Cancelled. } if(pattern != NULL) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 9a71c25..a741e21 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -2218,7 +2218,7 @@ void PrefsDlg::BuildDialog () #ifdef _WIN32 // win32 file dialog - check = gtk_check_button_new_with_label (_("Use win32 file load dialog")); + check = gtk_check_button_new_with_label (_("Use win32 file load dialog (hacky)")); gtk_widget_show (check); // gtk_container_add (GTK_CONTAINER (vbox), check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); From 6412c5ca77d7dc4042c0c5f6fa73ca6578dbbea3 Mon Sep 17 00:00:00 2001 From: rambetter Date: Sun, 19 Dec 2010 01:08:29 +0000 Subject: [PATCH 06/10] Another Windows file dialog change in Rambetter-temp-fixes branch. Handling file extensions better during save operations. This is more Windows-compliant. For example, when saving map: - If ".xmap" filter is selected and user types "foo.map", map will be saved as "foo.map" (previous behavior was "foo.xmap"). - If an unrecognized file extension is typed, GtkRadiant will now honor that but issue a warning popup window: "Unknown file extension for this save operation. Attempt to save anyways?". All known extensions for the type are checked. Previous behavior was that the extension is always changed based on selected filter. I will continue making lots of incremental fixes to Rambetter-temp-fixes. THIS PATCH SHOULD BE MERGED INTO TRUNK. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@353 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/gtkmisc.cpp | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 6ce83c7..f398604 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1123,7 +1123,12 @@ public: return filetype_t(); } - filetype_t GetTypeForIndex(int index) // Zero-based index. + int GetNumTypes() + { + return m_nTypes; + } + + filetype_t GetTypeForIndex(int index) const // Zero-based index. { if (index >= 0 && index < m_nTypes) return filetype_t(m_pTypes[index].m_name.c_str(), m_pTypes[index].m_pattern.c_str()); @@ -1493,17 +1498,33 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c *w = '/'; #if defined(WIN32) - if (g_PrefsDlg.m_bNativeGUI) // filetype mask not supported in gtk dialog yet + if (g_PrefsDlg.m_bNativeGUI) { - // when saving, force an extension depending on filetype /* \todo SPoG - file_dialog should return filetype information separately.. not force file extension.. */ if(!open && pattern != NULL) { // last ext separator w = strrchr(szFile, '.'); - // no extension - w = (w!=NULL) ? w : szFile+strlen(szFile); - strcpy(w, type.pattern+1); + if (w == NULL) { // No extension. + w = szFile + strlen(szFile); + strcpy(w, type.pattern + 1); // Add extension of selected filter type. + } + else { // An extension was explicitly in the filename. + int knownExtension = 0; + for (int i = typelist.GetNumTypes() - 1; i >= 0; i--) { + type = typelist.GetTypeForIndex(i); + if (stricmp(w, type.pattern + 1) == 0) { + knownExtension = 1; + break; + } + } + if (!knownExtension) { + if (gtk_MessageBox(parent, "Unknown file extension for this save operation.\nAttempt to save anyways?", + "GtkRadiant", MB_YESNO) == IDNO) { + return NULL; + } + } + } } } #endif From 2c799718d741e3efca91aedb1c4b143742797ce8 Mon Sep 17 00:00:00 2001 From: rambetter Date: Sun, 19 Dec 2010 01:31:52 +0000 Subject: [PATCH 07/10] Slight fix to r353 in Rambetter-fixes temp: the file suffix in save operation is case sensitive now w.r.t. to checking a registered suffix. The problem was that saving a file foo.MAP does not work. PLEASE MERGE THIS TO TRUNK. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@354 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/gtkmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index f398604..dbcd363 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1513,7 +1513,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c int knownExtension = 0; for (int i = typelist.GetNumTypes() - 1; i >= 0; i--) { type = typelist.GetTypeForIndex(i); - if (stricmp(w, type.pattern + 1) == 0) { + if (strcmp(w, type.pattern + 1) == 0) { knownExtension = 1; break; } From b292b8db59c19c159a1ed11f0f3b658020232687 Mon Sep 17 00:00:00 2001 From: rambetter Date: Sun, 19 Dec 2010 03:44:26 +0000 Subject: [PATCH 08/10] This is a big big GTK file dialog change in Rambetter-temp-fixes branch. Thank you to Markus Fischer who provided some example code on how to use the "new" method of GTK file dialogs. I then did a lot of research into how to shape his code into exactly what I wanted. This is an incomplete change in that I have not cleaned up the code such as removing unused local variables and unused functions yet. However, I wanted to commit this now because it really works beautifully (the GTK file dialog that is). - In CFileType, m_pstrGTKMasks now contains string like "quake3 maps (*.map)" instead of like "quake3 maps <*.map>". Nobody else is using this code except in gtkmisc.cpp so it's a safe change. - Removing all FILEDLG_DBG blocks in gtkmisc.cpp. It really clutters up the code and since it's completely overhauled, it's OK to remove. - Instead of the "old" way of gtk_file_selection_new(), now using gtk_file_chooser_dialog_new() instead. Thx to Markus Fischer for examples. - Actually adding GTK file dialog filters. It works really nice! :-) - Now using the same file extension logic on Windows file dialogs and GTK file dialogs. - Improved file extension logic. "No file extension specified in file to be saved. Attempt to save anyways?" Tested on Win7 and Linux. More related changes on the way. THIS SHOULD BE MERGED INTO TRUNK. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@355 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/gtkmisc.cpp | 215 ++++++++++++++------------------------------ 1 file changed, 68 insertions(+), 147 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index dbcd363..9d584f4 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1025,8 +1025,6 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti // fenris #3078 WHENHELLISFROZENOVER -//#define FILEDLG_DBG - static void file_sel_callback (GtkWidget *widget, gpointer data) { GtkWidget *parent; @@ -1040,11 +1038,6 @@ static void file_sel_callback (GtkWidget *widget, gpointer data) if (GPOINTER_TO_INT (data) == IDOK) *success = true; -#ifdef FILEDLG_DBG - else - Sys_Printf("file_sel_callback != IDOK\n"); -#endif - *loop = 0; } @@ -1197,10 +1190,10 @@ private: for(r = m_pTypes[i].m_name.c_str(); *r!='\0'; r++, w++) *w = *r; *w++ = ' '; - *w++ = '<'; + *w++ = '('; for(r = m_pTypes[i].m_pattern.c_str(); *r!='\0'; r++, w++) *w = *r; - *w++ = '>'; + *w++ = ')'; *w++ = '\0'; } m_pstrGTKMasks[m_nTypes] = NULL; @@ -1253,31 +1246,15 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c char *new_path = NULL; const char* r; - char* w; + char *v, *w; filetype_t type; CFileType typelist; if(pattern != NULL) GetFileTypeRegistry()->getTypeList(pattern, &typelist); -#ifdef FILEDLG_DBG - Sys_Printf("file_dialog: open = %d title = %s path = %s\n", open, title, path); - if (pattern) - { - Sys_Printf("Patterns:\n"); - char** p = typelist.m_pstrGTKMasks; - while(*p!=NULL) - Sys_Printf("%s\n", *p++); - } - else - Sys_Printf("no patterns\n"); -#endif - #ifdef _WIN32 if (g_PrefsDlg.m_bNativeGUI) { -#ifdef FILEDLG_DBG - Sys_Printf("Doing win32 file dialog..."); -#endif // do that the native way if (in_file_dialog) return NULL; // Avoid recursive entry. @@ -1354,9 +1331,6 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c if(pattern != NULL) type = typelist.GetTypeForIndex(ofn.nFilterIndex - 1); -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif } else { @@ -1366,9 +1340,6 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c if (title == NULL) title = open ? _("Open File") : _("Save File"); -#ifdef FILEDLG_DBG - Sys_Printf("Doing Gtk file dialog:\nBuilding new_path.."); -#endif // we expect an actual path below, if the path is NULL we might crash if (!path || path[0] == '\0') { @@ -1390,101 +1361,51 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c // terminate string *w = '\0'; -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); - Sys_Printf("Calling gtk_file_selection_new with title: %s...", title); -#endif - file_sel = gtk_file_selection_new (title); -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); - Sys_Printf("Set the masks..."); -#endif + file_sel = gtk_file_chooser_dialog_new(title, + GTK_WINDOW(parent), + open ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE, + GTK_RESPONSE_ACCEPT, + NULL); + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(file_sel), new_path); + delete[] new_path; -#if 0 //!\todo Add masks to GtkFileSelection in gtk-2.0 - // set the masks - if (pattern) - { - gtk_file_selection_clear_masks (GTK_FILE_SELECTION (file_sel)); - gtk_file_selection_set_masks (GTK_FILE_SELECTION (file_sel), const_cast(typelist.m_pstrGTKMasks)); - } -#endif + // Setting the file chooser dialog to modal and centering it on the parent is done automatically. -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif - - gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_sel)->ok_button), "clicked", - GTK_SIGNAL_FUNC (file_sel_callback), GINT_TO_POINTER (IDOK)); - gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_sel)->cancel_button), "clicked", - GTK_SIGNAL_FUNC (file_sel_callback), GINT_TO_POINTER (IDCANCEL)); - gtk_signal_connect (GTK_OBJECT (file_sel), "delete_event", - GTK_SIGNAL_FUNC (dialog_delete_callback), NULL); - gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_sel)); - - if (parent != NULL) - gtk_window_set_transient_for (GTK_WINDOW (file_sel), GTK_WINDOW (parent)); - -#ifdef FILEDLG_DBG - Sys_Printf("set_data..."); -#endif - bool success = false; - g_object_set_data (G_OBJECT (file_sel), "loop", &loop); - g_object_set_data (G_OBJECT (file_sel), "success", &success); -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif - - if (!open) - { -#ifdef FILEDLG_DBG - Sys_Printf("set_data \"overwrite\" ..."); -#endif - g_object_set_data (G_OBJECT (file_sel), "overwrite", GINT_TO_POINTER (1)); -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif + if (pattern != NULL) { + for (int i = 0; i < typelist.GetNumTypes(); i++) { + GtkFileFilter *filter = gtk_file_filter_new(); + type = typelist.GetTypeForIndex(i); + // We can use type.name here, or m_pstrGTKMasks[i], which includes the actual pattern. + gtk_file_filter_set_name(filter, typelist.m_pstrGTKMasks[i]); + gtk_file_filter_add_pattern(filter, type.pattern); + // "Note that the chooser takes ownership of the filter, so + // you have to ref and sink it if you want to keep a reference." + // So I guess we won't need to garbage collect this. + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(file_sel), filter); + } } - if (new_path != NULL) - { -#ifdef FILEDLG_DBG - Sys_Printf("gtk_file_selection_set_filename... %p (%s)", file_sel, new_path); -#endif - gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_sel), new_path); - delete[] new_path; -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif + if (gtk_dialog_run(GTK_DIALOG(file_sel)) == GTK_RESPONSE_ACCEPT) { + strcpy(szFile, gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_sel))); + } + else { + szFile[0] = '\0'; } - gtk_grab_add (file_sel); -#ifdef FILEDLG_DBG - Sys_Printf("gtk_widget_show... %p", file_sel); -#endif - gtk_widget_show (file_sel); -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif - -#ifdef FILEDLG_DBG - Sys_Printf("gtk_main_iteration..."); -#endif - while (loop) - gtk_main_iteration (); - if(success) - { -#if 0 //!\todo Add masks to GtkFileSelection in gtk2 - if(pattern!=NULL) - type = typelist.GetTypeForGTKMask(GTK_FILE_SELECTION (file_sel)->mask); -#endif - strcpy(szFile, gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_sel))); + if (pattern != NULL) { + GtkFileFilter *filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(file_sel)); + if (filter == NULL) { + type = filetype_t(); + } + else { + type = typelist.GetTypeForGTKMask(gtk_file_filter_get_name(filter)); + } } -#ifdef FILEDLG_DBG - Sys_Printf("Done.\n"); -#endif + gtk_widget_destroy(file_sel); - gtk_grab_remove (file_sel); - gtk_widget_destroy (file_sel); #ifdef _WIN32 } #endif @@ -1497,37 +1418,42 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c if(*w=='\\') *w = '/'; -#if defined(WIN32) - if (g_PrefsDlg.m_bNativeGUI) - { - /* \todo SPoG - file_dialog should return filetype information separately.. not force file extension.. */ - if(!open && pattern != NULL) - { - // last ext separator - w = strrchr(szFile, '.'); - if (w == NULL) { // No extension. + /* \todo SPoG - file_dialog should return filetype information separately.. not force file extension.. */ + if(!open && pattern != NULL) { + v = strrchr(szFile, '/'); + w = strrchr(szFile, '.'); + if ((v && w && w < v) || // Last '.' is before the file. + w == NULL) { // Extension missing. + if (type.pattern[0]) { w = szFile + strlen(szFile); strcpy(w, type.pattern + 1); // Add extension of selected filter type. } - else { // An extension was explicitly in the filename. - int knownExtension = 0; - for (int i = typelist.GetNumTypes() - 1; i >= 0; i--) { - type = typelist.GetTypeForIndex(i); - if (strcmp(w, type.pattern + 1) == 0) { - knownExtension = 1; - break; - } + else { + // type will be empty if for example there were no filters for pattern, + // or if some other UI inconsistencies happen. + if (gtk_MessageBox(parent, "No file extension specified in file to be saved.\nAttempt to save anyways?", + "GtkRadiant", MB_YESNO) == IDNO) { + return NULL; } - if (!knownExtension) { - if (gtk_MessageBox(parent, "Unknown file extension for this save operation.\nAttempt to save anyways?", - "GtkRadiant", MB_YESNO) == IDNO) { - return NULL; - } + } + } + else { // An extension was explicitly in the filename. + bool knownExtension = false; + for (int i = typelist.GetNumTypes() - 1; i >= 0; i--) { + type = typelist.GetTypeForIndex(i); + if (type.pattern[0] && strcmp(w, type.pattern + 1) == 0) { + knownExtension = true; + break; + } + } + if (!knownExtension) { + if (gtk_MessageBox(parent, "Unknown file extension for this save operation.\nAttempt to save anyways?", + "GtkRadiant", MB_YESNO) == IDNO) { + return NULL; } } } } -#endif // prompt to overwrite existing files if (!open) @@ -1535,11 +1461,6 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c if (gtk_MessageBox (parent, "File already exists.\nOverwrite?", "GtkRadiant", MB_YESNO) == IDNO) return NULL; -#ifdef FILEDLG_DBG - // ... let's use a static filename - Sys_Printf("filename: %p\n", szFile); -#endif - return szFile; } From 36a1c4bbadc08ff4702a46916542168446261bb2 Mon Sep 17 00:00:00 2001 From: rambetter Date: Sun, 19 Dec 2010 04:12:29 +0000 Subject: [PATCH 09/10] Cleaning up some file dialog tidbits in Rambetter-temp-fixes branch. Just some code maintenence. Like removing unused local vars. PLS MERGE TO TRUNK. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@356 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/gtkmisc.cpp | 20 +++++++++----------- radiant/preferences.cpp | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 9d584f4..93fed4a 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1203,13 +1203,11 @@ private: #ifdef _WIN32 -static int in_file_dialog = 0; - typedef struct { gboolean open; OPENFILENAME *ofn; BOOL dlgRtnVal; - int done; + bool done; } win32_native_file_dialog_comms_t; DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam) @@ -1222,7 +1220,7 @@ DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam) else { fileDialogComms->dlgRtnVal = GetSaveFileName(fileDialogComms->ofn); } - fileDialogComms->done = -1; // No need to synchronize around lock. + fileDialogComms->done = true; // No need to synchronize around lock, one-way gate. return 0; } @@ -1235,14 +1233,14 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c { #ifdef _WIN32 + static bool in_file_dialog = false; HANDLE fileDialogThreadHandle; win32_native_file_dialog_comms_t fileDialogComms; - int dialogDone; + bool dialogDone; #endif // Gtk dialog GtkWidget* file_sel; - int loop = 1; char *new_path = NULL; const char* r; @@ -1258,7 +1256,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c // do that the native way if (in_file_dialog) return NULL; // Avoid recursive entry. - in_file_dialog = 1; + in_file_dialog = true; /* Set the members of the OPENFILENAME structure. */ // See http://msdn.microsoft.com/en-us/library/ms646839%28v=vs.85%29.aspx . memset(&ofn, 0, sizeof(ofn)); @@ -1305,16 +1303,16 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c 0, // dwCreationFlags NULL); // lpThreadId - dialogDone = 0; + dialogDone = false; while (1) { - // Avoid blocking indefinitely. Another thread will set fileDialogComms->done to nonzero; + // Avoid blocking indefinitely. Another thread will set fileDialogComms->done to true; // we don't want to be in an indefinite blocked state when this happens. We want to break // out of here eventually. while (gtk_events_pending()) { gtk_main_iteration(); } if (dialogDone) break; - if (fileDialogComms.done) dialogDone = 1; // One more loop of gtk_main_iteration() to get things in sync. + if (fileDialogComms.done) dialogDone = true; // One more loop of gtk_main_iteration() to get things in sync. // Avoid tight infinte loop, add a small amount of sleep. Sleep(10); } @@ -1322,7 +1320,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c WaitForSingleObject(fileDialogThreadHandle, INFINITE); CloseHandle(fileDialogThreadHandle); - in_file_dialog = 0; + in_file_dialog = false; if (!fileDialogComms.dlgRtnVal) { return NULL; // Cancelled. diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index a741e21..821f44c 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -2218,7 +2218,7 @@ void PrefsDlg::BuildDialog () #ifdef _WIN32 // win32 file dialog - check = gtk_check_button_new_with_label (_("Use win32 file load dialog (hacky)")); + check = gtk_check_button_new_with_label (_("Use win32 file dialog (hacky)")); gtk_widget_show (check); // gtk_container_add (GTK_CONTAINER (vbox), check); gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0); From a6e2bf8e2dd2b6feaa2c3f72735aa067d0085175 Mon Sep 17 00:00:00 2001 From: TTimo Date: Fri, 24 Dec 2010 19:04:32 +0000 Subject: [PATCH 10/10] misc project file fixes from trunk (e.g. rev 345). fixes the 'missing MSVCR90.DLL' absurdity git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-temp-fixes@357 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- contrib/camera/camera.def | 1 - contrib/camera/camera_VC9.vcproj | 6 ++++-- plugins/entity/entity.def | 1 - plugins/entity/entity_VC9.vcproj | 2 ++ plugins/image/image.def | 1 - plugins/image/image_VC9.vcproj | 1 + plugins/imagepng/imagepng.def | 1 - plugins/imagepng/imagepng_VC9.vcproj | 2 ++ plugins/map/map.def | 3 +-- plugins/map/map_VC9.vcproj | 2 ++ plugins/mapxml/mapxml.def | 1 - plugins/mapxml/mapxml_VC9.vcproj | 2 ++ plugins/model/model.def | 1 - plugins/model/model_VC9.vcproj | 2 ++ plugins/shaders/shaders.def | 1 - plugins/shaders/shaders_VC9.vcproj | 2 ++ plugins/surface/surface.def | 1 - plugins/surface/surface_VC9.vcproj | 6 ++++-- plugins/vfspk3/vfspk3.def | 1 - plugins/vfspk3/vfspk3_VC9.vcproj | 2 ++ radiant/file.cpp | 2 +- radiant/gtkdlgs.cpp | 2 +- radiant/mainframe.cpp | 2 +- radiant/preferences.cpp | 13 ++++++++++--- radiant/radiant_VC9.vcproj | 28 +++++++++++++-------------- tools/quake3/q3map2/q3map2_VC9.vcproj | 1 + 26 files changed, 52 insertions(+), 35 deletions(-) diff --git a/contrib/camera/camera.def b/contrib/camera/camera.def index 6a59743..ddec12c 100644 --- a/contrib/camera/camera.def +++ b/contrib/camera/camera.def @@ -1,7 +1,6 @@ ; camera.def : Declares the module parameters for the DLL. LIBRARY "CAMERA" -DESCRIPTION 'CAMERA Windows Dynamic Link Library' EXPORTS ; Explicit exports can go here diff --git a/contrib/camera/camera_VC9.vcproj b/contrib/camera/camera_VC9.vcproj index e10dbd7..bf1b24c 100755 --- a/contrib/camera/camera_VC9.vcproj +++ b/contrib/camera/camera_VC9.vcproj @@ -40,7 +40,7 @@ #define X_OK 0 @@ -3359,7 +3366,7 @@ void CGameInstall::BuildDialog() { void CGameInstall::Run() { ScanGames(); - if (m_availGames[0] == GAME_NONE) { + if ( m_availGames[0] == GAME_NONE ) { return; } if ( DoModal() == IDCANCEL ) { @@ -3375,8 +3382,8 @@ void CGameInstall::Run() { gameFilePath += ".game"; Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() ); - FILE *fg = fopen( gameFilePath.GetBuffer(), "w" ); - if ( fg == NULL || ferror( fg ) ) { + FILE * fg = fopen( gameFilePath.GetBuffer(), "w" ); + if ( fg == NULL ) { Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() ); } fprintf( fg, "\n - - - - @@ -2428,6 +2420,14 @@ RelativePath="..\..\src\gtk+\gdk\makefile.msc" > + + + +