From a645555938899bf6b99ecd362298cdc568b44187 Mon Sep 17 00:00:00 2001 From: namespace Date: Thu, 28 Jun 2007 17:55:42 +0000 Subject: [PATCH] Fixes by Dunk git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk@173 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- CHANGES | 6 ++++ SConstruct | 2 +- install.py | 7 ++--- radiant/brush.h | 8 ++++++ radiant/brushmanip.cpp | 54 +++++++++++++++++++++++++++++++++-- radiant/brushmodule.cpp | 12 ++++++++ radiant/findtexturedialog.cpp | 3 +- radiant/mru.cpp | 9 +++--- radiant/xywindow.cpp | 9 ++++-- 9 files changed, 94 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index ae398ab3..47deae20 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ This is the changelog for developers, != changelog for the end user that we distribute with the binaries. (see changelog) +28/06/2007 (dunkfordyce@gmail.com) +- fixed mnemonics for MRU list +- fixed find functionality +- added option to always use caulk texture for new brushes +- fixed(?) a small bug in install.py that was trying to copy msvc files on linux + 28/06/2007 - Added material-support to brushexport-plugin (Shaderman) diff --git a/SConstruct b/SConstruct index db5d1fd6..418a6002 100644 --- a/SConstruct +++ b/SConstruct @@ -36,7 +36,7 @@ JOBS BUILD Use debug/release to select build settings - ex: BUILD="release" - default is debug + ex: BUILD="release" - default is release """ ) diff --git a/install.py b/install.py index 601ef6b4..0d44ceb9 100644 --- a/install.py +++ b/install.py @@ -113,11 +113,10 @@ copyFileIfExists(libxml2, installRoot) libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll")) copyFileIfExists(libmhash, installRoot) -copySvn("../msvc_redist", installRoot) - if sys.platform[:3] == "win" : - dbghelp = os.path.normpath(os.path.join(thisDir, "../msvc_redist/dbghelp.dll")) - copyFileIfExists(dbghelp, installRoot) + copySvn("../msvc_redist", installRoot) + dbghelp = os.path.normpath(os.path.join(thisDir, "../msvc_redist/dbghelp.dll")) + copyFileIfExists(dbghelp, installRoot) # create version files version = open(os.path.join(thisDir, "include/version.default"), "rt").readline().split(".") diff --git a/radiant/brush.h b/radiant/brush.h index 04d3d1ff..851a9836 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -4170,6 +4170,14 @@ inline const Functor& Scene_ForEachBrush_ForEachFace(scene::Graph& graph, const return functor; } +// d1223m +template +inline const Functor& Scene_ForEachBrush_ForEachFaceInstance(scene::Graph& graph, const Functor& functor) +{ + Scene_forEachBrush(graph, BrushForEachFace(FaceInstanceVisitAll(functor))); + return functor; +} + template inline const Functor& Scene_ForEachSelectedBrush_ForEachFace(scene::Graph& graph, const Functor& functor) { diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index b2acc1fa..441f099d 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -550,19 +550,66 @@ public: } }; +class FaceFindShader +{ + const char* m_find; + const char* m_replace; +public: + FaceFindShader(const char* find) : m_find(find) + { + } + void operator()(FaceInstance& faceinst) const + { + if(shader_equal(faceinst.getFace().GetShader(), m_find)) + { + faceinst.setSelected(SelectionSystem::eFace, true); + } + } +}; + +bool DoingSearch(const char *repl) +{ + return (repl == NULL || (strcmp("textures/", repl)==0)); +} + void Scene_BrushFindReplaceShader(scene::Graph& graph, const char* find, const char* replace) { - Scene_ForEachBrush_ForEachFace(graph, FaceFindReplaceShader(find, replace)); + if (DoingSearch(replace)) + { + Scene_ForEachBrush_ForEachFaceInstance(graph, FaceFindShader(find)); + } + else + { + Scene_ForEachBrush_ForEachFace(graph, FaceFindReplaceShader(find, replace)); + } } void Scene_BrushFindReplaceShader_Selected(scene::Graph& graph, const char* find, const char* replace) { - Scene_ForEachSelectedBrush_ForEachFace(graph, FaceFindReplaceShader(find, replace)); + if (DoingSearch(replace)) + { + Scene_ForEachSelectedBrush_ForEachFaceInstance(graph, + FaceFindShader(find)); + } + else + { + Scene_ForEachSelectedBrush_ForEachFace(graph, + FaceFindReplaceShader(find, replace)); + } } +// TODO: find for components +// d1223m: dont even know what they are... void Scene_BrushFindReplaceShader_Component_Selected(scene::Graph& graph, const char* find, const char* replace) { - Scene_ForEachSelectedBrushFace(graph, FaceFindReplaceShader(find, replace)); + if (DoingSearch(replace)) + { + + } + else + { + Scene_ForEachSelectedBrushFace(graph, FaceFindReplaceShader(find, replace)); + } } @@ -678,6 +725,7 @@ public: } void operator()(FaceInstance& face) const { + printf("checking %s = %s\n", face.getFace().GetShader(), m_name); if(shader_equal(face.getFace().GetShader(), m_name)) { face.setSelected(SelectionSystem::eFace, true); diff --git a/radiant/brushmodule.cpp b/radiant/brushmodule.cpp index 66e7a310..6b47e092 100644 --- a/radiant/brushmodule.cpp +++ b/radiant/brushmodule.cpp @@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA LatchedBool g_useAlternativeTextureProjection(false, "Use alternative texture-projection"); bool g_showAlternativeTextureProjectionOption = false; +bool g_brush_always_caulk; bool getTextureLockEnabled() { @@ -73,6 +74,11 @@ void Brush_constructPreferences(PreferencesPage& page) BoolExportCaller(g_useAlternativeTextureProjection.m_latched) ); } + // d1223m + page.appendCheckBox("", + "Always use caulk for new brushes", + g_brush_always_caulk + ); } void Brush_constructPage(PreferenceGroup& group) { @@ -102,6 +108,12 @@ void Brush_Construct(EBrushType type) { type = eBrushTypeQuake3BP; } + + // d1223m + GlobalPreferenceSystem().registerPreference( + "BrushAlwaysCaulk", + BoolImportStringCaller(g_brush_always_caulk), + BoolExportStringCaller(g_brush_always_caulk)); } Brush_registerCommands(); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 80491d81..52891d80 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -91,8 +91,9 @@ namespace void FindTextureDialog_apply() { StringOutputStream find(256); - find << "textures/" << g_FindTextureDialog.m_strFind.c_str(); StringOutputStream replace(256); + + find << "textures/" << g_FindTextureDialog.m_strFind.c_str(); replace << "textures/" << g_FindTextureDialog.m_strReplace.c_str(); FindReplaceTextures(find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly); } diff --git a/radiant/mru.cpp b/radiant/mru.cpp index 5815aa08..7f3fbeeb 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -90,7 +90,6 @@ inline EscapedMnemonic& operator<<(EscapedMnemonic& ostream, const T& t) void MRU_updateWidget(std::size_t index, const char *filename) { EscapedMnemonic mnemonic(64); - mnemonic.push_back('_'); mnemonic << Unsigned(index + 1) << "- " << ConvertLocaleToUTF8(filename); gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[index]))), mnemonic.c_str()); } @@ -214,22 +213,22 @@ LoadMRU g_load_mru4(4); void MRU_constructMenu(GtkMenu* menu) { { - GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "Recent Files", LoadMRUCaller(g_load_mru1)); + GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_1", LoadMRUCaller(g_load_mru1)); gtk_widget_set_sensitive(GTK_WIDGET(item), FALSE); MRU_AddWidget(item, 0); } { - GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "2", LoadMRUCaller(g_load_mru2)); + GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_2", LoadMRUCaller(g_load_mru2)); gtk_widget_hide(GTK_WIDGET(item)); MRU_AddWidget(item, 1); } { - GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "3", LoadMRUCaller(g_load_mru3)); + GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_3", LoadMRUCaller(g_load_mru3)); gtk_widget_hide(GTK_WIDGET(item)); MRU_AddWidget(item, 2); } { - GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "4", LoadMRUCaller(g_load_mru4)); + GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_4", LoadMRUCaller(g_load_mru4)); gtk_widget_hide(GTK_WIDGET(item)); MRU_AddWidget(item, 3); } diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 4fcdf936..4f545cb5 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -66,7 +66,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "windowobservers.h" - +// d1223m +extern bool g_brush_always_caulk; //!\todo Rewrite. class ClipPoint @@ -1109,7 +1110,11 @@ void XYWnd::NewBrushDrag(int x, int y) m_NewBrushDrag = node.get_pointer(); } - Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs), TextureBrowser_GetSelectedShader(GlobalTextureBrowser())); + // d1223m + //Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs), TextureBrowser_GetSelectedShader(GlobalTextureBrowser())); + Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs), + g_brush_always_caulk ? + "textures/common/caulk" : TextureBrowser_GetSelectedShader(GlobalTextureBrowser())); } void entitycreate_activated(GtkWidget* item) -- 2.39.2