From fa146dd7132bf122d9645267529dde7b64039f48 Mon Sep 17 00:00:00 2001
From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= <vslavik@fastmail.fm>
Date: Sun, 16 Jan 2000 22:54:32 +0000
Subject: [PATCH] added <meta http-equiv> handler

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5462 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 Makefile.in                    |  4 +-
 distrib/msw/tmake/filelist.txt |  1 +
 src/html/htmlwin.cpp           |  1 +
 src/html/m_meta.cpp            | 71 ++++++++++++++++++++++++++++++++++
 src/msw/makefile.b32           |  5 ++-
 src/msw/makefile.bcc           |  5 ++-
 src/msw/makefile.dos           |  2 +-
 src/msw/makefile.g95           | 22 ++++++++---
 src/msw/makefile.sc            |  2 +-
 src/msw/makefile.vc            |  3 +-
 src/msw/makefile.wat           |  2 +-
 src/wxvc.dsp                   |  4 ++
 src/wxvc_dll.dsp               |  4 ++
 13 files changed, 113 insertions(+), 13 deletions(-)
 create mode 100644 src/html/m_meta.cpp

diff --git a/Makefile.in b/Makefile.in
index 0f4881d876..b8339831e8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
 #
-# This file was automatically generated by tmake at 14:06, 2000/01/15
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
 
 #
@@ -2443,6 +2443,7 @@ HTMLOBJS = \
 		m_layout.o \
 		m_links.o \
 		m_list.o \
+		m_meta.o \
 		m_pre.o \
 		m_tables.o \
 		winpars.o
@@ -2464,6 +2465,7 @@ HTMLDEPS = \
 		m_layout.d \
 		m_links.d \
 		m_list.d \
+		m_meta.d \
 		m_pre.d \
 		m_tables.d \
 		winpars.d
diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt
index 379750fedd..62344e0b67 100644
--- a/distrib/msw/tmake/filelist.txt
+++ b/distrib/msw/tmake/filelist.txt
@@ -513,6 +513,7 @@ m_list.cpp	H
 m_dflist.cpp	H
 m_pre.cpp	H
 m_tables.cpp	H
+m_meta.cpp	H
 htmprint.cpp	H
 
 arrimpl.cpp	W
diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp
index 7850f761ce..cdd00d18c2 100644
--- a/src/html/htmlwin.cpp
+++ b/src/html/htmlwin.cpp
@@ -589,6 +589,7 @@ FORCE_LINK(m_pre)
 FORCE_LINK(m_hline)
 FORCE_LINK(m_links)
 FORCE_LINK(m_tables)
+FORCE_LINK(m_meta)
 
 
 #endif
diff --git a/src/html/m_meta.cpp b/src/html/m_meta.cpp
new file mode 100644
index 0000000000..7c0c379b88
--- /dev/null
+++ b/src/html/m_meta.cpp
@@ -0,0 +1,71 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        m_meta.cpp
+// Purpose:     wxHtml module for parsing <meta> tag
+// Author:      Vaclav Slavik
+// RCS-ID:      $Id$
+// Copyright:   (c) 2000 Vaclav Slavik
+// Licence:     wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "wx/wxprec.h"
+
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/fontmap.h"
+#include "wx/html/forcelnk.h"
+#include "wx/html/m_templ.h"
+#include "wx/html/htmlcell.h"
+
+FORCE_LINK_ME(m_meta)
+
+
+
+
+TAG_HANDLER_BEGIN(META, "META")
+
+    TAG_HANDLER_PROC(tag)
+    {
+        if (tag.HasParam(_T("HTTP-EQUIV")) && 
+            tag.GetParam(_T("HTTP-EQUIV")) == _T("Content-Type") &&
+            tag.HasParam(_T("CONTENT")))
+        {
+            wxString content = tag.GetParam(_T("CONTENT"));
+            if (content.Left(19) == _T("text/html; charset="))
+            {
+                wxFontEncoding enc = 
+                    wxTheFontMapper -> CharsetToEncoding(content.Mid(19));
+                if (enc == wxFONTENCODING_SYSTEM) return FALSE;
+                if (enc == m_WParser -> GetInputEncoding()) return FALSE;
+
+                m_WParser -> SetInputEncoding(enc);
+                m_WParser -> GetContainer() -> InsertCell(
+                    new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+            }
+        }
+        return FALSE;
+    }
+
+TAG_HANDLER_END(META)
+
+
+TAGS_MODULE_BEGIN(MetaTag)
+
+    TAGS_MODULE_ADD(META)
+
+TAGS_MODULE_END(MetaTag)
+
+#endif
diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32
index 9bcffc4f6b..278031b387 100644
--- a/src/msw/makefile.b32
+++ b/src/msw/makefile.b32
@@ -1,6 +1,6 @@
 
 
-# This file was automatically generated by tmake at 00:09, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
 
 #
@@ -322,6 +322,7 @@ HTMLOBJS = $(MSWDIR)\helpctrl.obj \
 		$(MSWDIR)\m_layout.obj \
 		$(MSWDIR)\m_links.obj \
 		$(MSWDIR)\m_list.obj \
+		$(MSWDIR)\m_meta.obj \
 		$(MSWDIR)\m_pre.obj \
 		$(MSWDIR)\m_tables.obj \
 		$(MSWDIR)\winpars.obj
@@ -847,6 +848,8 @@ $(MSWDIR)\m_links.obj: $(HTMLDIR)\m_links.$(SRCSUFF)
 
 $(MSWDIR)\m_list.obj: $(HTMLDIR)\m_list.$(SRCSUFF)
 
+$(MSWDIR)\m_meta.obj: $(HTMLDIR)\m_meta.$(SRCSUFF)
+
 $(MSWDIR)\m_pre.obj: $(HTMLDIR)\m_pre.$(SRCSUFF)
 
 $(MSWDIR)\m_tables.obj: $(HTMLDIR)\m_tables.$(SRCSUFF)
diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc
index 4708312ca9..13a90af936 100644
--- a/src/msw/makefile.bcc
+++ b/src/msw/makefile.bcc
@@ -1,6 +1,6 @@
 
 
-# This file was automatically generated by tmake at 00:09, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
 
 #
@@ -147,6 +147,7 @@ COMMONOBJS = \
 		$(MSWDIR)\lboxcmn.obj \
 		$(MSWDIR)\list.obj \
 		$(MSWDIR)\log.obj \
+		$(MSWDIR)\longlong.obj \
 		$(MSWDIR)\memory.obj \
 		$(MSWDIR)\menucmn.obj \
 		$(MSWDIR)\module.obj \
@@ -549,6 +550,8 @@ $(MSWDIR)\list.obj: $(COMMDIR)\list.$(SRCSUFF)
 
 $(MSWDIR)\log.obj: $(COMMDIR)\log.$(SRCSUFF)
 
+$(MSWDIR)\longlong.obj: $(COMMDIR)\longlong.$(SRCSUFF)
+
 $(MSWDIR)\memory.obj: $(COMMDIR)\memory.$(SRCSUFF)
 
 $(MSWDIR)\menucmn.obj: $(COMMDIR)\menucmn.$(SRCSUFF)
diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos
index 388cadba29..c7520d1623 100644
--- a/src/msw/makefile.dos
+++ b/src/msw/makefile.dos
@@ -1,4 +1,4 @@
-# This file was automatically generated by tmake at 18:22, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
 
 #
diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95
index 7bb5fb33d6..1177936f28 100644
--- a/src/msw/makefile.g95
+++ b/src/msw/makefile.g95
@@ -1,4 +1,4 @@
-# This file was automatically generated by tmake at 00:09, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
 
 #
@@ -205,6 +205,7 @@ HTMLOBJS = \
 		$(HTMLDIR)/m_layout.$(OBJSUFF) \
 		$(HTMLDIR)/m_links.$(OBJSUFF) \
 		$(HTMLDIR)/m_list.$(OBJSUFF) \
+		$(HTMLDIR)/m_meta.$(OBJSUFF) \
 		$(HTMLDIR)/m_pre.$(OBJSUFF) \
 		$(HTMLDIR)/m_tables.$(OBJSUFF) \
 		$(HTMLDIR)/winpars.$(OBJSUFF)
@@ -448,7 +449,11 @@ else
   OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ)
 endif
 
+ifndef WXMAKINGDLL
 all:    $(OBJECTS) $(WXLIB) $(ZLIBLIB) $(PNGLIB) $(JPEGLIB) $(XPMLIB) $(TIFFLIB)
+else
+all:    $(OBJECTS) $(ZLIBLIB) $(PNGLIB) $(JPEGLIB) $(XPMLIB) $(TIFFLIB) $(WXDLL)
+endif
 
 ifndef WXMAKINGDLL
 
@@ -502,23 +507,23 @@ endif
 
 
 $(ZLIBLIB): $(ZLIBOBJS)
-	ar $(AROPTIONS) $@ $(ZLIBOBJS)
+	$(AR) $(AROPTIONS) $@ $(ZLIBOBJS)
 	$(RANLIB) $@
 
 $(PNGLIB): $(PNGOBJS)
-	ar $(AROPTIONS) $@ $(PNGOBJS)
+	$(AR) $(AROPTIONS) $@ $(PNGOBJS)
 	$(RANLIB) $@
 
 $(JPEGLIB): $(JPEGOBJS)
-	ar $(AROPTIONS) $@ $(JPEGOBJS)
+	$(AR) $(AROPTIONS) $@ $(JPEGOBJS)
 	$(RANLIB) $@
 
 $(XPMLIB): $(XPMOBJS)
-	ar $(AROPTIONS) $@ $(XPMOBJS)
+	$(AR) $(AROPTIONS) $@ $(XPMOBJS)
 	$(RANLIB) $@
 
 $(TIFFLIB): $(TIFFOBJS)
-	ar $(AROPTIONS) $@ $(TIFFOBJS)
+	$(AR) $(AROPTIONS) $@ $(TIFFOBJS)
 	$(RANLIB) $@
 
 
@@ -586,6 +591,11 @@ clean:
 	-$(RM) ../tiff/*.o
 	-$(RM) ../tiff/*.bak
 	-$(RM) $(WXLIB)
+	-$(RM) $(ZLIBLIB)
+	-$(RM) $(PNGLIB)
+	-$(RM) $(JPEGLIB)
+	-$(RM) $(XPMLIB)
+	-$(RM) $(TIFFLIB)
 
 ifdef WXMAKINGDLL
 	-$(RM) $(WXDLL)
diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc
index 3a3ce79e3d..686fc8307b 100644
--- a/src/msw/makefile.sc
+++ b/src/msw/makefile.sc
@@ -1,6 +1,6 @@
 
 
-# This file was automatically generated by tmake at 00:09, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
 
 # Symantec C++ makefile for the msw objects
diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc
index af305fa68c..2ab1c2fff1 100644
--- a/src/msw/makefile.vc
+++ b/src/msw/makefile.vc
@@ -1,4 +1,4 @@
-# This file was automatically generated by tmake at 00:09, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
 
 # File:     makefile.vc
@@ -339,6 +339,7 @@ HTMLOBJS = ..\html\$D\helpctrl.obj \
 		..\html\$D\m_layout.obj \
 		..\html\$D\m_links.obj \
 		..\html\$D\m_list.obj \
+		..\html\$D\m_meta.obj \
 		..\html\$D\m_pre.obj \
 		..\html\$D\m_tables.obj \
 		..\html\$D\winpars.obj
diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat
index c5cbd08416..c487a6b480 100644
--- a/src/msw/makefile.wat
+++ b/src/msw/makefile.wat
@@ -1,6 +1,6 @@
 #!/binb/wmake.exe
 
-# This file was automatically generated by tmake at 00:09, 2000/01/14
+# This file was automatically generated by tmake at 21:14, 2000/01/16
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
 
 #
diff --git a/src/wxvc.dsp b/src/wxvc.dsp
index b6669e053f..8d2309bbad 100644
--- a/src/wxvc.dsp
+++ b/src/wxvc.dsp
@@ -636,6 +636,10 @@ SOURCE=.\html\m_fonts.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\html\m_meta.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\html\m_hline.cpp
 # End Source File
 # Begin Source File
diff --git a/src/wxvc_dll.dsp b/src/wxvc_dll.dsp
index ee493b4fb8..075a64cf14 100644
--- a/src/wxvc_dll.dsp
+++ b/src/wxvc_dll.dsp
@@ -634,6 +634,10 @@ SOURCE=.\html\m_dflist.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\html\m_meta.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\html\m_fonts.cpp
 # End Source File
 # Begin Source File
-- 
2.47.2