]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/findtexturedialog.cpp
more eol-style
[xonotic/netradiant.git] / radiant / findtexturedialog.cpp
index 9cbe68d80dbc1c47aefad50bdb7f9e62c8f835dd..012208c2f6aea05639685ab69112641e2d9fe931 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-//\r
-// Find/Replace textures dialogs\r
-//\r
-// Leonardo Zide (leo@lokigames.com)\r
-//\r
-\r
-#include "stdafx.h"\r
-#include "findtexturedialog.h"\r
-\r
-FindTextureDialog g_TexFindDlg;\r
-FindTextureDialog& g_dlgFind = g_TexFindDlg;\r
-static bool g_bFindActive = true;\r
-\r
-static void OnApply(GtkWidget *widget, gpointer data) \r
-{\r
-  g_dlgFind.UpdateData(TRUE);\r
-  FindReplaceTextures(g_dlgFind.m_strFind, g_dlgFind.m_strReplace,\r
-    g_dlgFind.m_bSelectedOnly, g_dlgFind.m_bForce, FALSE);\r
-}\r
-\r
-static void OnFind(GtkWidget *widget, gpointer data) \r
-{\r
-  g_dlgFind.UpdateData(TRUE);\r
-  FindReplaceTextures(g_dlgFind.m_strFind, g_dlgFind.m_strReplace,\r
-    g_dlgFind.m_bSelectedOnly, FALSE, TRUE);\r
-}\r
-\r
-static void OnOK(GtkWidget *widget, gpointer data) \r
-{\r
-  g_dlgFind.UpdateData(TRUE);\r
-  FindReplaceTextures(g_dlgFind.m_strFind, g_dlgFind.m_strReplace,\r
-    g_dlgFind.m_bSelectedOnly, g_dlgFind.m_bForce, FALSE);\r
-  g_dlgFind.HideDlg ();\r
-}\r
-\r
-static void OnClose(GtkWidget *widget, gpointer data) \r
-{\r
-  g_dlgFind.HideDlg ();\r
-}\r
-\r
-static void popup_selected (GtkWidget *widget, gpointer data) \r
-{\r
-  gchar *str;\r
-\r
-  gtk_label_get (GTK_LABEL (GTK_BIN (widget)->child), &str);\r
-  gtk_entry_set_text (GTK_ENTRY (data), str);\r
-}\r
-\r
-static void find_clicked (GtkWidget *widget, gpointer data) \r
-{\r
-  GtkWidget *menu, *item;\r
-  menu = gtk_menu_new ();\r
-\r
-  for (int i = 0; i < QERApp_GetActiveShaderCount (); i++)\r
-  {\r
-    IShader *pShader = QERApp_ActiveShader_ForIndex (i);\r
-\r
-    item = gtk_menu_item_new_with_label (pShader->getName ());\r
-    gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (popup_selected), data);\r
-    gtk_widget_show (item);\r
-    gtk_menu_append (GTK_MENU (menu), item);\r
-  }\r
-\r
-  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); \r
-}\r
-\r
-static gint find_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)\r
-{\r
-  g_bFindActive = true;\r
-  return FALSE;\r
-}\r
-\r
-static gint replace_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)\r
-{\r
-  g_bFindActive = false;\r
-  return FALSE;\r
-}\r
-\r
-// =============================================================================\r
-// FindTextureDialog class\r
-\r
-FindTextureDialog::FindTextureDialog ()\r
-{\r
-  m_bSelectedOnly = FALSE;\r
-  m_strFind = "";\r
-  m_strReplace = "";\r
-  m_bForce = FALSE;\r
-  m_bLive = TRUE;\r
-}\r
-\r
-FindTextureDialog::~FindTextureDialog ()\r
-{\r
-}\r
-\r
-void FindTextureDialog::BuildDialog ()\r
-{\r
-  GtkWidget *dlg, *vbox, *hbox, *table, *label;\r
-  GtkWidget *button, *check, *entry, *arrow;\r
-\r
-  dlg = m_pWidget;\r
-  gtk_window_set_title (GTK_WINDOW (dlg), "Find / Replace Texture(s)");\r
-  gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (g_pParentWnd->m_pWidget));\r
-\r
-  hbox = gtk_hbox_new (FALSE, 5);\r
-  gtk_widget_show (hbox);\r
-  gtk_container_add (GTK_CONTAINER (dlg), hbox);\r
-  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);\r
-\r
-  vbox = gtk_vbox_new (FALSE, 5);\r
-  gtk_widget_show (vbox);\r
-  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);\r
-\r
-  table = gtk_table_new (2, 3, FALSE);\r
-  gtk_widget_show (table);\r
-  gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);\r
-  gtk_table_set_row_spacings (GTK_TABLE (table), 5);\r
-  gtk_table_set_col_spacings (GTK_TABLE (table), 5);\r
-\r
-  label = gtk_label_new ("Find:");\r
-  gtk_widget_show (label);\r
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,\r
-                    (GtkAttachOptions) (GTK_FILL),\r
-                    (GtkAttachOptions) (0), 0, 0);\r
-  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);\r
-\r
-  label = gtk_label_new ("Replace:");\r
-  gtk_widget_show (label);\r
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,\r
-                    (GtkAttachOptions) (GTK_FILL),\r
-                    (GtkAttachOptions) (0), 0, 0);\r
-  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);\r
-\r
-  entry = gtk_entry_new ();\r
-  gtk_widget_show (entry);\r
-  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,\r
-                    (GtkAttachOptions) (GTK_EXPAND|GTK_FILL),\r
-                    (GtkAttachOptions) (0), 0, 0);\r
-  gtk_signal_connect (GTK_OBJECT (entry), "focus_in_event",\r
-                     GTK_SIGNAL_FUNC (find_focus_in), NULL);\r
-  AddDialogData (entry, &m_strFind, DLG_ENTRY_TEXT);\r
-\r
-  button = gtk_button_new ();\r
-  gtk_widget_show (button);\r
-  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,\r
-                    (GtkAttachOptions) (GTK_FILL),\r
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);\r
-  gtk_signal_connect (GTK_OBJECT (button), "clicked",\r
-                     GTK_SIGNAL_FUNC (find_clicked), entry);\r
-\r
-  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);\r
-  gtk_widget_show (arrow);\r
-  gtk_container_add (GTK_CONTAINER (button), arrow);\r
-\r
-  entry = gtk_entry_new ();\r
-  gtk_widget_show (entry);\r
-  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,\r
-                    (GtkAttachOptions) (GTK_EXPAND|GTK_FILL),\r
-                    (GtkAttachOptions) (0), 0, 0);\r
-  gtk_signal_connect (GTK_OBJECT (entry), "focus_in_event",\r
-                     GTK_SIGNAL_FUNC (replace_focus_in), NULL);\r
-  AddDialogData (entry, &m_strReplace, DLG_ENTRY_TEXT);\r
-\r
-  button = gtk_button_new ();\r
-  gtk_widget_show (button);\r
-  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,\r
-                    (GtkAttachOptions) (GTK_FILL),\r
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);\r
-  gtk_signal_connect (GTK_OBJECT (button), "clicked",\r
-                     GTK_SIGNAL_FUNC (find_clicked), entry);\r
-\r
-  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);\r
-  gtk_widget_show (arrow);\r
-  gtk_container_add (GTK_CONTAINER (button), arrow);\r
-\r
-  check = gtk_check_button_new_with_label ("Use selected brushes only");\r
-  gtk_widget_show (check);\r
-  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);\r
-  AddDialogData (check, &m_bSelectedOnly, DLG_CHECK_BOOL);\r
-\r
-  check = gtk_check_button_new_with_label ("Replace everywhere (selected/active), don't test against Find");\r
-  gtk_widget_show (check);\r
-  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);\r
-  AddDialogData (check, &m_bForce, DLG_CHECK_BOOL);\r
-\r
-  check = gtk_check_button_new_with_label ("Live updates from Texture/Camera windows");\r
-  gtk_widget_show (check);\r
-  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);\r
-  AddDialogData (check, &m_bLive, DLG_CHECK_BOOL);\r
-\r
-  vbox = gtk_vbox_new (FALSE, 5);\r
-  gtk_widget_show (vbox);\r
-  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);\r
-\r
-  button = gtk_button_new_with_label( "Find" );\r
-  gtk_widget_show( button );\r
-  gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );\r
-  gtk_signal_connect( GTK_OBJECT( button ), "clicked",\r
-                      GTK_SIGNAL_FUNC( OnFind ), NULL );\r
-  gtk_widget_set_usize( button, 60, -2 );\r
-\r
-  button = gtk_button_new_with_label ("OK");\r
-  gtk_widget_show (button);\r
-  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);\r
-  gtk_signal_connect (GTK_OBJECT (button), "clicked",\r
-                      GTK_SIGNAL_FUNC (OnOK), NULL);\r
-  gtk_widget_set_usize (button, 60, -2);\r
-\r
-  button = gtk_button_new_with_label ("Apply");\r
-  gtk_widget_show (button);\r
-  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);\r
-  gtk_signal_connect (GTK_OBJECT (button), "clicked",\r
-                      GTK_SIGNAL_FUNC (OnApply), NULL);\r
-  gtk_widget_set_usize (button, 60, -2);\r
-\r
-  button = gtk_button_new_with_label ("Close");\r
-  gtk_widget_show (button);\r
-  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);\r
-  gtk_signal_connect (GTK_OBJECT (button), "clicked",\r
-                      GTK_SIGNAL_FUNC (OnClose), NULL);\r
-  gtk_widget_set_usize (button, 60, -2);\r
-\r
-  gtk_widget_show (dlg);\r
-}\r
-\r
-void FindTextureDialog::updateTextures(const char *p)\r
-{\r
-  if (isOpen())\r
-  {\r
-    if (g_bFindActive)\r
-    {\r
-      setFindStr(p);\r
-    }\r
-    else\r
-    {\r
-      setReplaceStr(p);\r
-    }\r
-  }\r
-}\r
-\r
-bool FindTextureDialog::isOpen()\r
-{\r
-  return (g_dlgFind.m_pWidget == NULL || GTK_WIDGET_VISIBLE (g_dlgFind.m_pWidget) == FALSE) ? false : true;\r
-}\r
-\r
-void FindTextureDialog::setFindStr(const char * p)\r
-{\r
-  g_dlgFind.UpdateData(TRUE);\r
-  if (g_dlgFind.m_bLive)\r
-  {\r
-    g_dlgFind.m_strFind = p;\r
-    g_dlgFind.UpdateData(FALSE);\r
-  }\r
-}\r
-\r
-void FindTextureDialog::setReplaceStr(const char * p)\r
-{\r
-  g_dlgFind.UpdateData(TRUE);\r
-  if (g_dlgFind.m_bLive)\r
-  {\r
-    g_dlgFind.m_strReplace = p;\r
-    g_dlgFind.UpdateData(FALSE);\r
-  }\r
-}\r
-\r
-void FindTextureDialog::show()\r
-{\r
-  g_dlgFind.ShowDlg ();\r
-}\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+//
+// Find/Replace textures dialogs
+//
+// Leonardo Zide (leo@lokigames.com)
+//
+
+#include "stdafx.h"
+#include "findtexturedialog.h"
+
+FindTextureDialog g_TexFindDlg;
+FindTextureDialog& g_dlgFind = g_TexFindDlg;
+static bool g_bFindActive = true;
+
+static void OnApply(GtkWidget *widget, gpointer data) 
+{
+  g_dlgFind.UpdateData(TRUE);
+  FindReplaceTextures(g_dlgFind.m_strFind, g_dlgFind.m_strReplace,
+    g_dlgFind.m_bSelectedOnly, g_dlgFind.m_bForce, FALSE);
+}
+
+static void OnFind(GtkWidget *widget, gpointer data) 
+{
+  g_dlgFind.UpdateData(TRUE);
+  FindReplaceTextures(g_dlgFind.m_strFind, g_dlgFind.m_strReplace,
+    g_dlgFind.m_bSelectedOnly, FALSE, TRUE);
+}
+
+static void OnOK(GtkWidget *widget, gpointer data) 
+{
+  g_dlgFind.UpdateData(TRUE);
+  FindReplaceTextures(g_dlgFind.m_strFind, g_dlgFind.m_strReplace,
+    g_dlgFind.m_bSelectedOnly, g_dlgFind.m_bForce, FALSE);
+  g_dlgFind.HideDlg ();
+}
+
+static void OnClose(GtkWidget *widget, gpointer data) 
+{
+  g_dlgFind.HideDlg ();
+}
+
+static void popup_selected (GtkWidget *widget, gpointer data) 
+{
+  gchar *str;
+
+  gtk_label_get (GTK_LABEL (GTK_BIN (widget)->child), &str);
+  gtk_entry_set_text (GTK_ENTRY (data), str);
+}
+
+static void find_clicked (GtkWidget *widget, gpointer data) 
+{
+  GtkWidget *menu, *item;
+  menu = gtk_menu_new ();
+
+  for (int i = 0; i < QERApp_GetActiveShaderCount (); i++)
+  {
+    IShader *pShader = QERApp_ActiveShader_ForIndex (i);
+
+    item = gtk_menu_item_new_with_label (pShader->getName ());
+    gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (popup_selected), data);
+    gtk_widget_show (item);
+    gtk_menu_append (GTK_MENU (menu), item);
+  }
+
+  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); 
+}
+
+static gint find_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)
+{
+  g_bFindActive = true;
+  return FALSE;
+}
+
+static gint replace_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)
+{
+  g_bFindActive = false;
+  return FALSE;
+}
+
+// =============================================================================
+// FindTextureDialog class
+
+FindTextureDialog::FindTextureDialog ()
+{
+  m_bSelectedOnly = FALSE;
+  m_strFind = "";
+  m_strReplace = "";
+  m_bForce = FALSE;
+  m_bLive = TRUE;
+}
+
+FindTextureDialog::~FindTextureDialog ()
+{
+}
+
+void FindTextureDialog::BuildDialog ()
+{
+  GtkWidget *dlg, *vbox, *hbox, *table, *label;
+  GtkWidget *button, *check, *entry, *arrow;
+
+  dlg = m_pWidget;
+  gtk_window_set_title (GTK_WINDOW (dlg), "Find / Replace Texture(s)");
+  gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (g_pParentWnd->m_pWidget));
+
+  hbox = gtk_hbox_new (FALSE, 5);
+  gtk_widget_show (hbox);
+  gtk_container_add (GTK_CONTAINER (dlg), hbox);
+  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+
+  vbox = gtk_vbox_new (FALSE, 5);
+  gtk_widget_show (vbox);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+
+  table = gtk_table_new (2, 3, FALSE);
+  gtk_widget_show (table);
+  gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
+  gtk_table_set_row_spacings (GTK_TABLE (table), 5);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 5);
+
+  label = gtk_label_new ("Find:");
+  gtk_widget_show (label);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+
+  label = gtk_label_new ("Replace:");
+  gtk_widget_show (label);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+
+  entry = gtk_entry_new ();
+  gtk_widget_show (entry);
+  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_EXPAND|GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_signal_connect (GTK_OBJECT (entry), "focus_in_event",
+                     GTK_SIGNAL_FUNC (find_focus_in), NULL);
+  AddDialogData (entry, &m_strFind, DLG_ENTRY_TEXT);
+
+  button = gtk_button_new ();
+  gtk_widget_show (button);
+  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (GTK_FILL), 0, 0);
+  gtk_signal_connect (GTK_OBJECT (button), "clicked",
+                     GTK_SIGNAL_FUNC (find_clicked), entry);
+
+  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
+  gtk_widget_show (arrow);
+  gtk_container_add (GTK_CONTAINER (button), arrow);
+
+  entry = gtk_entry_new ();
+  gtk_widget_show (entry);
+  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
+                    (GtkAttachOptions) (GTK_EXPAND|GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_signal_connect (GTK_OBJECT (entry), "focus_in_event",
+                     GTK_SIGNAL_FUNC (replace_focus_in), NULL);
+  AddDialogData (entry, &m_strReplace, DLG_ENTRY_TEXT);
+
+  button = gtk_button_new ();
+  gtk_widget_show (button);
+  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (GTK_FILL), 0, 0);
+  gtk_signal_connect (GTK_OBJECT (button), "clicked",
+                     GTK_SIGNAL_FUNC (find_clicked), entry);
+
+  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
+  gtk_widget_show (arrow);
+  gtk_container_add (GTK_CONTAINER (button), arrow);
+
+  check = gtk_check_button_new_with_label ("Use selected brushes only");
+  gtk_widget_show (check);
+  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);
+  AddDialogData (check, &m_bSelectedOnly, DLG_CHECK_BOOL);
+
+  check = gtk_check_button_new_with_label ("Replace everywhere (selected/active), don't test against Find");
+  gtk_widget_show (check);
+  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);
+  AddDialogData (check, &m_bForce, DLG_CHECK_BOOL);
+
+  check = gtk_check_button_new_with_label ("Live updates from Texture/Camera windows");
+  gtk_widget_show (check);
+  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);
+  AddDialogData (check, &m_bLive, DLG_CHECK_BOOL);
+
+  vbox = gtk_vbox_new (FALSE, 5);
+  gtk_widget_show (vbox);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+
+  button = gtk_button_new_with_label( "Find" );
+  gtk_widget_show( button );
+  gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
+  gtk_signal_connect( GTK_OBJECT( button ), "clicked",
+                      GTK_SIGNAL_FUNC( OnFind ), NULL );
+  gtk_widget_set_usize( button, 60, -2 );
+
+  button = gtk_button_new_with_label ("OK");
+  gtk_widget_show (button);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  gtk_signal_connect (GTK_OBJECT (button), "clicked",
+                      GTK_SIGNAL_FUNC (OnOK), NULL);
+  gtk_widget_set_usize (button, 60, -2);
+
+  button = gtk_button_new_with_label ("Apply");
+  gtk_widget_show (button);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  gtk_signal_connect (GTK_OBJECT (button), "clicked",
+                      GTK_SIGNAL_FUNC (OnApply), NULL);
+  gtk_widget_set_usize (button, 60, -2);
+
+  button = gtk_button_new_with_label ("Close");
+  gtk_widget_show (button);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  gtk_signal_connect (GTK_OBJECT (button), "clicked",
+                      GTK_SIGNAL_FUNC (OnClose), NULL);
+  gtk_widget_set_usize (button, 60, -2);
+
+  gtk_widget_show (dlg);
+}
+
+void FindTextureDialog::updateTextures(const char *p)
+{
+  if (isOpen())
+  {
+    if (g_bFindActive)
+    {
+      setFindStr(p);
+    }
+    else
+    {
+      setReplaceStr(p);
+    }
+  }
+}
+
+bool FindTextureDialog::isOpen()
+{
+  return (g_dlgFind.m_pWidget == NULL || GTK_WIDGET_VISIBLE (g_dlgFind.m_pWidget) == FALSE) ? false : true;
+}
+
+void FindTextureDialog::setFindStr(const char * p)
+{
+  g_dlgFind.UpdateData(TRUE);
+  if (g_dlgFind.m_bLive)
+  {
+    g_dlgFind.m_strFind = p;
+    g_dlgFind.UpdateData(FALSE);
+  }
+}
+
+void FindTextureDialog::setReplaceStr(const char * p)
+{
+  g_dlgFind.UpdateData(TRUE);
+  if (g_dlgFind.m_bLive)
+  {
+    g_dlgFind.m_strReplace = p;
+    g_dlgFind.UpdateData(FALSE);
+  }
+}
+
+void FindTextureDialog::show()
+{
+  g_dlgFind.ShowDlg ();
+}