first draft of SDI browser application derived from ROS Explorer
Added: trunk/reactos/subsys/system/ibrowser/
Added: trunk/reactos/subsys/system/ibrowser/Makefile
Added: trunk/reactos/subsys/system/ibrowser/Makefile.MinGW
Added: trunk/reactos/subsys/system/ibrowser/Makefile.PCH
Added: trunk/reactos/subsys/system/ibrowser/expat.license
Added: trunk/reactos/subsys/system/ibrowser/favorites.cpp
Added: trunk/reactos/subsys/system/ibrowser/favorites.h
Added: trunk/reactos/subsys/system/ibrowser/ibrowser.cpp
Added: trunk/reactos/subsys/system/ibrowser/ibrowser.dsp
Added: trunk/reactos/subsys/system/ibrowser/ibrowser.dsw
Added: trunk/reactos/subsys/system/ibrowser/ibrowser.h
Added: trunk/reactos/subsys/system/ibrowser/ibrowser.rc
Added: trunk/reactos/subsys/system/ibrowser/ibrowser_intres.h
Added: trunk/reactos/subsys/system/ibrowser/ibrowser_intres.rc
Added: trunk/reactos/subsys/system/ibrowser/mainframe.cpp
Added: trunk/reactos/subsys/system/ibrowser/mainframe.h
Added: trunk/reactos/subsys/system/ibrowser/make_ibrowser.dsp
Added: trunk/reactos/subsys/system/ibrowser/precomp.cpp
Added: trunk/reactos/subsys/system/ibrowser/precomp.h
Added: trunk/reactos/subsys/system/ibrowser/readme.txt
Added: trunk/reactos/subsys/system/ibrowser/res/
Added: trunk/reactos/subsys/system/ibrowser/res/dot.ico
Added: trunk/reactos/subsys/system/ibrowser/res/dot_red.ico
Added: trunk/reactos/subsys/system/ibrowser/res/dot_trans.ico
Added: trunk/reactos/subsys/system/ibrowser/res/favorites.ico
Added: trunk/reactos/subsys/system/ibrowser/res/ibrowser.ico
Added: trunk/reactos/subsys/system/ibrowser/res/network.ico
Added: trunk/reactos/subsys/system/ibrowser/res/reactos.ico
Added: trunk/reactos/subsys/system/ibrowser/res/toolbar.bmp
Added: trunk/reactos/subsys/system/ibrowser/utility/
Added: trunk/reactos/subsys/system/ibrowser/utility/comutil.h
Deleted: trunk/reactos/subsys/system/ibrowser/utility/dragdropimpl.cpp
Deleted: trunk/reactos/subsys/system/ibrowser/utility/dragdropimpl.h
Deleted:
trunk/reactos/subsys/system/ibrowser/utility/shellbrowserimpl.cpp
Deleted: trunk/reactos/subsys/system/ibrowser/utility/shellbrowserimpl.h
Deleted: trunk/reactos/subsys/system/ibrowser/utility/shellclasses.cpp
Deleted: trunk/reactos/subsys/system/ibrowser/utility/shellclasses.dsp
Deleted: trunk/reactos/subsys/system/ibrowser/utility/shellclasses.dsw
Deleted: trunk/reactos/subsys/system/ibrowser/utility/shellclasses.h
Deleted: trunk/reactos/subsys/system/ibrowser/utility/shelltests.cpp
Deleted: trunk/reactos/subsys/system/ibrowser/utility/splitpath.c
Deleted: trunk/reactos/subsys/system/ibrowser/utility/treedroptarget.h
Modified: trunk/reactos/subsys/system/ibrowser/utility/utility.cpp
Modified: trunk/reactos/subsys/system/ibrowser/utility/utility.h
Modified: trunk/reactos/subsys/system/ibrowser/utility/window.cpp
Modified: trunk/reactos/subsys/system/ibrowser/utility/window.h
Added: trunk/reactos/subsys/system/ibrowser/webchild.cpp
Added: trunk/reactos/subsys/system/ibrowser/webchild.h
Property changes on: trunk/reactos/subsys/system/ibrowser
___________________________________________________________________
Name: svn:ignore
+ *.coff
*.exe
*.d
*.o
*.a
*.sym
*.map
bin
Debug
Release
DRelease
UDebug
URelease
_NO_COMUTIL
doxy-doc
Win32
WineDll
WineRelease
*.ncb
*.opt
*.aps
*.ncb
*.plg
*.suo
buildno.h
notifyhook.dll
*.gch
*.h.pch
pack.*
.gdbinit
start-gdb.bat
libexpat.dll
_____
Added: trunk/reactos/subsys/system/ibrowser/Makefile
--- trunk/reactos/subsys/system/ibrowser/Makefile 2005-01-26
00:03:05 UTC (rev 13301)
+++ trunk/reactos/subsys/system/ibrowser/Makefile 2005-01-26
00:12:33 UTC (rev 13302)
@@ -0,0 +1,47 @@
+#
+# ROS Internet Web Browser
+#
+# Makefile
+#
+
+PATH_TO_TOP := ../../..
+
+TARGET_TYPE := program
+
+TARGET_APPTYPE := windows
+
+TARGET_NAME := ibrowser
+
+TARGET_INSTALLDIR := .
+
+TARGET_CFLAGS := \
+ -D__USE_W32API -DWIN32 -D_ROS_ \
+ -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -DWINVER=0x0500 \
+ -DUNICODE -fexceptions -Wall
+
+TARGET_CPPFLAGS := $(TARGET_CFLAGS)
+
+TARGET_RCFLAGS := -D__USE_W32API -DWIN32 -D_ROS_ -D__WINDRES__
+
+TARGET_SDKLIBS := gdi32.a comctl32.a ole32.a oleaut32.a shell32.a
expat.a
+
+TARGET_GCCLIBS := stdc++ uuid
+
+TARGET_OBJECTS := \
+ ibrowser.o \
+ mainframe.o \
+ webchild.o \
+ favorites.o \
+ utility/utility.o \
+ utility/window.o \
+ utility/xmlstorage.o
+
+TARGET_CPPAPP := yes
+
+TARGET_PCH := precomp.h
+
+DEP_OBJECTS := $(TARGET_OBJECTS)
+
+include $(PATH_TO_TOP)/rules.mak
+include $(TOOLS_PATH)/helper.mk
+include $(TOOLS_PATH)/depend.mk
Property changes on: trunk/reactos/subsys/system/ibrowser/Makefile
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Added: trunk/reactos/subsys/system/ibrowser/Makefile.MinGW
--- trunk/reactos/subsys/system/ibrowser/Makefile.MinGW 2005-01-26
00:03:05 UTC (rev 13301)
+++ trunk/reactos/subsys/system/ibrowser/Makefile.MinGW 2005-01-26
00:12:33 UTC (rev 13302)
@@ -0,0 +1,67 @@
+#
+# ROS Internet Web Browser
+#
+# Makefile.MinGW
+#
+
+CC = gcc
+CXX = g++
+LINK = g++
+
+CFLAGS = -DWIN32 -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501
-DWINVER=0x0500 -fexceptions -Wall -I.
+RCFLAGS = -DWIN32 -D__WINDRES__
+LFLAGS = -Wl,--subsystem,windows
+
+ifdef DEBUG
+CFLAGS += -D_DEBUG -g
+RCFLAGS += -D_DEBUG
+LFLAGS += -g
+else
+CFLAGS += -DNDEBUG -Os
+RCFLAGS += -DNDEBUG
+LFLAGS += -s
+endif
+
+ifndef UNICODE
+UNICODE = 1
+endif
+
+ifeq ($(UNICODE),1)
+CFLAGS += -DUNICODE
+# LFLAGS+= -Wl,--entry,_wWinMain@16
+RCFLAGS += -DUNICODE
+endif
+
+CXXFLAGS = $(CFLAGS)
+
+EXEC_SUFFIX = .exe
+RES_SUFFIX = .coff
+
+VPATH = utility
+
+PROGRAM = ibrowser
+
+TARGET = $(PROGRAM)$(EXEC_SUFFIX)
+
+OBJECTS = \
+ utility.o \
+ window.o \
+ ibrowser.o \
+ webchild.o \
+ mainframe.o \
+ favorites.o \
+ xmlstorage.o
+
+LIBS = gdi32 comctl32 shell32 ole32 uuid oleaut32
+
+all: $(TARGET)
+
+$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) libexpat.dll
+ $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) $(addprefix
-l,$(DELAYIMPORTS))
+
+ibrowser$(RES_SUFFIX): $(PROGRAM)_intres.rc res/*.bmp res/*.ico
+ windres $(RCFLAGS) -o $@ $(PROGRAM)_intres.rc
+
+clean:
+ rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) \
+ desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o
_____
Added: trunk/reactos/subsys/system/ibrowser/Makefile.PCH
--- trunk/reactos/subsys/system/ibrowser/Makefile.PCH 2005-01-26
00:03:05 UTC (rev 13301)
+++ trunk/reactos/subsys/system/ibrowser/Makefile.PCH 2005-01-26
00:12:33 UTC (rev 13302)
@@ -0,0 +1,72 @@
+#
+# ROS Internet Web Browser
+#
+# Makefile.PCH
+#
+# MinGW Makefile with precompiled header support
+#
+
+CC = gcc
+CXX = g++
+LINK = g++
+
+CFLAGS = -DWIN32 -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501
-DWINVER=0x0500 -fexceptions -Wall -I.
+RCFLAGS = -DWIN32 -D__WINDRES__
+LFLAGS = -Wl,--subsystem,windows
+
+ifdef DEBUG
+CFLAGS += -D_DEBUG -g
+RCFLAGS += -D_DEBUG
+LFLAGS += -g
+else
+CFLAGS += -DNDEBUG -Os -march=pentium4
+RCFLAGS += -DNDEBUG
+LFLAGS += -s
+endif
+
+ifndef UNICODE
+UNICODE = 1
+endif
+
+ifeq ($(UNICODE),1)
+CFLAGS += -DUNICODE
+# LFLAGS+= -Wl,--entry,_wWinMain@16
+RCFLAGS += -DUNICODE
+endif
+
+CXXFLAGS = $(CFLAGS)
+
+EXEC_SUFFIX = .exe
+RES_SUFFIX = .coff
+
+VPATH = utility
+
+PROGRAM = ibrowser
+
+TARGET = $(PROGRAM)$(EXEC_SUFFIX)
+
+OBJECTS = \
+ utility.o \
+ window.o \
+ ibrowser.o \
+ webchild.o \
+ mainframe.o \
+ favorites.o \
+ xmlstorage.o
+
+LIBS = gdi32 comctl32 shell32 ole32 oleaut32 uuid
+
+all: precomp.h.gch $(TARGET)
+
+precomp.h.gch: *.h utility/*.h
+ $(CXX) $(CFLAGS) precomp.h
+
+$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) libexpat.dll
+ $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) $(addprefix
-l,$(DELAYIMPORTS))
+
+ibrowser$(RES_SUFFIX): $(PROGRAM)_intres.rc res/*.bmp res/*.ico
+ windres $(RCFLAGS) -o $@ $(PROGRAM)_intres.rc
+
+clean:
+ rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) precomp.h.gch
\
+ utility/*.o
_____
Copied: trunk/reactos/subsys/system/ibrowser/expat.license (from rev
13252, trunk/reactos/subsys/system/explorer/expat.license)
_____
Copied: trunk/reactos/subsys/system/ibrowser/favorites.cpp (from rev
13256, trunk/reactos/subsys/system/explorer/taskbar/favorites.cpp)
--- trunk/reactos/subsys/system/explorer/taskbar/favorites.cpp
2005-01-24 22:02:09 UTC (rev 13256)
+++ trunk/reactos/subsys/system/ibrowser/favorites.cpp 2005-01-26
00:12:33 UTC (rev 13302)
@@ -0,0 +1,494 @@
+/*
+ * Copyright 2004 Martin Fuchs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+
+ //
+ // Explorer and Desktop clone
+ //
+ // favorites.cpp
+ //
+ // Martin Fuchs, 04.04.2004
+ //
+
+
+#include "precomp.h"
+
+
+String DecodeURLString(const char* s)
+{
+ TCHAR buffer[BUFFER_LEN];
+ LPTSTR o = buffer;
+
+ for(const char* p=s; *p; ++p)
+ if (*p == '%') {
+ if (!strncmp(p+1, "20", 2)) {
+ *o++ = ' ';
+ p += 2;
+ } else
+ *o++ = *p;
+ } else
+ *o++ = *p;
+
+ return String(buffer, o-buffer);
+}
+
+
+ /// read .URL file
+bool Bookmark::read_url(LPCTSTR path)
+{
+ char line[BUFFER_LEN];
+
+ tifstream in(path);
+
+ while(in.good()) {
+ in.getline(line, BUFFER_LEN);
+
+ const char* p = line;
+ while(isspace(*p))
+ ++p;
+
+ const char* keyword = p;
+ const char* eq = strchr(p, '=');
+
+ if (eq) {
+ const char* cont = eq + 1;
+ while(isspace(*cont))
+ ++cont;
+
+ if (!strnicmp(keyword, "URL", 3))
+ _url = DecodeURLString(cont);
+ else if (!strnicmp(keyword, "IconFile", 8))
+ _icon_path = DecodeURLString(cont);
+ }
+ }
+
+ return true;
+}
+
+ /// convert XBEL bookmark node
+bool Bookmark::read(const_XMLPos& pos)
+{
+ _url = pos.get("href").c_str();
+
+ if (pos.go_down("title")) {
+ _name = pos->get_content();
+ pos.back();
+ }
+
+ if (pos.go_down("desc")) {
+ _description = pos->get_content();
+ pos.back();
+ }
+
+ if (pos.go_down("info")) {
+ const_XMLChildrenFilter metadata(pos, "metadata");
+
+ for(const_XMLChildrenFilter::const_iterator
it=metadata.begin(); it!=metadata.end(); ++it) {
+ const XMLNode& node = **it;
+ const_XMLPos sub_pos(&node);
+
+ if (node.get("owner") == "ros-explorer") {
+ if (sub_pos.go_down("icon")) {
+ _icon_path =
sub_pos.get("path").c_str();
+ _icon_idx =
XS_toi(sub_pos.get("index"));
+
+ sub_pos.back(); // </icon>
+ }
+ }
+ }
+
+ pos.back(); // </metadata>
+ pos.back(); // </info>
+ }
+
+ return !_url.empty(); // _url is mandatory.
+}
+
+ /// write XBEL bookmark node
+void Bookmark::write(XMLPos& pos) const
+{
+ pos.create("bookmark");
+
+ pos["href"] = _url.c_str();
+
+ if (!_name.empty()) {
+ pos.create("title");
+ pos->set_content(_name);
+ pos.back();
+ }
+
+ if (!_description.empty()) {
+ pos.create("desc");
+ pos->set_content(_description);
+ pos.back();
+ }
+
+ if (!_icon_path.empty()) {
+ pos.create("info");
+ pos.create("metadata");
+ pos["owner"] = "ros-explorer";
+ pos.create("icon");
+ pos["path"] = _icon_path.c_str();
+ pos["index"].printf(XS_TEXT("%d"), _icon_idx);
+ pos.back(); // </icon>
+ pos.back(); // </metadata>
+ pos.back(); // </info>
+ }
+
+ pos.back();
+}
+
+
+ /// read bookmark folder from XBEL formated XML tree
+void BookmarkFolder::read(const_XMLPos& pos)
+{
+ if (pos.go_down("title")) {
+ _name = pos->get_content();
+ pos.back();
+ }
+
+ if (pos.go_down("desc")) {
+ _description = pos->get_content();
+ pos.back();
+ }
+
+ _bookmarks.read(pos);
+}
+
+ /// write bookmark folder content from XBEL formated XML tree
+void BookmarkFolder::write(XMLPos& pos) const
+{
+ pos.create("folder");
+
+ if (!_name.empty()) {
+ pos.create("title");
+ pos->set_content(_name);
+ pos.back();
+ }
+
+ if (!_description.empty()) {
+ pos.create("desc");
+ pos->set_content(_description);
+ pos.back();
+ }
+
+ _bookmarks.write(pos);
+}
+
+
+BookmarkNode::BookmarkNode()
+ : _type(BMNT_NONE)
+{
+ _pbookmark = NULL;
+}
+
+BookmarkNode::BookmarkNode(const Bookmark& bm)
+ : _type(BMNT_BOOKMARK)
+{
+ _pbookmark = new Bookmark(bm);
+}
+
+BookmarkNode::BookmarkNode(const BookmarkFolder& bmf)
+ : _type(BMNT_FOLDER)
+{
+ _pfolder = new BookmarkFolder(bmf);
+}
+
+BookmarkNode::BookmarkNode(const BookmarkNode& other)
+ : _type(other._type)
+{
+ if (other._type == BMNT_BOOKMARK)
+ _pbookmark = new Bookmark(*other._pbookmark);
+ else if (other._type == BMNT_FOLDER)
+ _pfolder = new BookmarkFolder(*other._pfolder);
+ else
+ _pbookmark = NULL;
+}
+
+BookmarkNode::~BookmarkNode()
+{
+ if (_type == BMNT_BOOKMARK)
+ delete _pbookmark;
+ else if (_type == BMNT_FOLDER)
+ delete _pfolder;
+}
+
+BookmarkNode& BookmarkNode::operator=(const Bookmark& bm)
+{
+ clear();
+
+ _pbookmark = new Bookmark(bm);
+
+ return *this;
+}
+
+BookmarkNode& BookmarkNode::operator=(const BookmarkFolder& bmf)
+{
+ clear();
+
+ _pfolder = new BookmarkFolder(bmf);
+
+ return *this;
+}
+
+BookmarkNode& BookmarkNode::operator=(const BookmarkNode& other)
+{
+ clear();
+
+ _type = other._type;
+
+ if (other._type == BMNT_BOOKMARK)
+ _pbookmark = new Bookmark(*other._pbookmark);
+ else if (other._type == BMNT_FOLDER)
+ _pfolder = new BookmarkFolder(*other._pfolder);
+
+ return *this;
+}
+
+void BookmarkNode::clear()
+{
+ if (_type == BMNT_BOOKMARK) {
+ delete _pbookmark;
+ _pbookmark = NULL;
+ }
+ else if (_type == BMNT_FOLDER) {
+ delete _pfolder;
+ _pfolder = NULL;
+ }
+
+ _type = BMNT_NONE;
+}
+
+
+ /// read bookmark list from XBEL formated XML tree
+void BookmarkList::read(const_XMLPos& pos)
+{
+ const XMLNode::Children& children = pos->get_children();
+
+ for(XMLNode::Children::const_iterator it=children.begin();
it!=children.end(); ++it) {
+ const XMLNode& node = **it;
+ const_XMLPos sub_pos(&node);
+
+ if (node == "folder") {
+ BookmarkFolder folder;
+
+ folder.read(sub_pos);
+
+ push_back(folder);
+ } else if (node == "bookmark") {
+ Bookmark bookmark;
+
+ if (bookmark.read(sub_pos))
+ push_back(bookmark);
+ }
+ }
+}
+
+ /// write bookmark list into XBEL formated XML tree
+void BookmarkList::write(XMLPos& pos) const
+{
+ for(const_iterator it=begin(); it!=end(); ++it) {
+ const BookmarkNode& node = *it;
+
+ if (node._type == BookmarkNode::BMNT_FOLDER) {
+ const BookmarkFolder& folder = *node._pfolder;
+
+ folder.write(pos);
+
+ pos.back();
+ } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
+ const Bookmark& bookmark = *node._pbookmark;
+
+ if (!bookmark._url.empty())
+ bookmark.write(pos);
+ }
+ }
+}
+
+
+ /// fill treeview control with bookmark tree content
+void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST
himagelist, HDC hdc_wnd) const
+{
+ TV_INSERTSTRUCT tvi;
+
+ tvi.hParent = parent;
+ tvi.hInsertAfter = TVI_LAST;
+
+ TV_ITEM& tv = tvi.item;
+ tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
+
+ for(const_iterator it=begin(); it!=end(); ++it) {
+ const BookmarkNode& node = *it;
+
+ tv.lParam = (LPARAM)&node;
+
+ if (node._type == BookmarkNode::BMNT_FOLDER) {
+ const BookmarkFolder& folder = *node._pfolder;
+
+ tv.pszText = (LPTSTR)folder._name.c_str();
+ tv.iImage = 3; // folder
+ tv.iSelectedImage = 4; // open folder
+ HTREEITEM hitem = TreeView_InsertItem(hwnd,
&tvi);
+
+ folder._bookmarks.fill_tree(hwnd, hitem,
himagelist, hdc_wnd);
+ } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
+ const Bookmark& bookmark = *node._pbookmark;
+
+ tv.pszText = (LPTSTR)bookmark._name.c_str();
+ tv.iImage = 1; // bookmark
+ tv.iSelectedImage = 2; // selected bookmark
+
+ if (!bookmark._icon_path.empty()) {
+ const Icon& icon =
g_icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
+
+ if ((ICON_ID)icon != ICID_NONE)
+ tv.iImage = tv.iSelectedImage =
icon.add_to_imagelist(himagelist, hdc_wnd);
+ }
+
+ TreeView_InsertItem(hwnd, &tvi);
+ }
+ }
+}
+
+
+/*@@
+
+ /// import Internet Explorer bookmarks from Favorites folder into
bookmark list
+void BookmarkList::import_IE_favorites(ShellDirectory& dir, HWND hwnd)
+{
+ TCHAR path[MAX_PATH], ext[_MAX_EXT];
+
+ dir.smart_scan(SORT_NAME, SCAN_FILESYSTEM);
+
+ for(Entry*entry=dir._down; entry; entry=entry->_next) {
+ if (entry->_shell_attribs & SFGAO_HIDDEN) //
ignore files like "desktop.ini"
+ continue;
+
+ String name;
+
+ if (entry->_etype == ET_SHELL)
+ name =
dir._folder.get_name(static_cast<ShellEntry*>(entry)->_pidl);
+ else
+ name = entry->_display_name;
+
+ if (entry->_data.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY) {
+ BookmarkFolder new_folder;
+
+ new_folder._name = DecodeXMLString(name);
+
+ if (entry->_etype == ET_SHELL) {
+ ShellDirectory new_dir(dir._folder,
static_cast<ShellEntry*>(entry)->_pidl, hwnd);
+
new_folder._bookmarks.import_IE_favorites(new_dir, hwnd);
+ } else {
+ entry->get_path(path);
+ ShellDirectory
new_dir(GetDesktopFolder(), path, hwnd);
+
new_folder._bookmarks.import_IE_favorites(new_dir, hwnd);
+ }
+
+ push_back(new_folder);
+ } else {
+ Bookmark bookmark;
+
+ bookmark._name = DecodeXMLString(name);
+
+ entry->get_path(path);
+ _tsplitpath(path, NULL, NULL, NULL, ext);
+
+ if (!_tcsicmp(ext, TEXT(".url"))) {
+ bookmark.read_url(path);
+ push_back(bookmark);
+ } else {
+ ///@todo read shell links
+ //assert(0);
+ }
+ }
+ }
+}
+
+*/
+
+
+ /// read XBEL bookmark file
+bool Favorites::read(LPCTSTR path)
+{
+ XMLDoc xbel;
+
+ if (!xbel.read(path))
+ if (xbel._last_error == XML_ERROR_NO_ELEMENTS)
+ return false;
+ else
+ MessageBox(0/*@@g_Globals._hwndDesktop*/,
String(xbel._last_error_msg.c_str()),
+ TEXT("ROS Explorer -
reading bookmark file"), MB_OK);
+
+ const_XMLPos pos(&xbel);
+
+ if (!pos.go_down("xbel"))
+ return false;
+
+ super::read(pos);
+
+ pos.back();
+
+ return true;
+}
+
+ /// write XBEL bookmark file
+void Favorites::write(LPCTSTR path) const
+{
+ XMLDoc xbel;
+
+ XMLPos pos(&xbel);
+ pos.create("xbel");
+ super::write(pos);
+ pos.back();
+
+ xbel.write(path, XMLNode::FORMAT_SMART, XMLHeader("1.0",
"UTF-8", "<!DOCTYPE xbel"
+ " PUBLIC \"+//IDN
python.org//DTD XML Bookmark Exchange
Language 1.0//EN//XML\"\n"
+ "
\"http://www.python.org/topics/xml/dtds/xbel-1.0.dtd\">"));
+}
+
+
+/*@@
+
+ /// import Internet Explorer bookmarks from Favorites folder
+bool Favorites::import_IE_favorites(HWND hwnd)
+{
+ WaitCursor wait;
+
+ StartMenuShellDirs dirs;
+
+ try {
+ dirs.push_back(ShellDirectory(GetDesktopFolder(),
SpecialFolderPath(CSIDL_COMMON_FAVORITES, hwnd), hwnd));
+ dirs.push_back(ShellDirectory(GetDesktopFolder(),
SpecialFolderPath(CSIDL_FAVORITES, hwnd), hwnd));
+ } catch(COMException&) {
+ }
+
+ for(StartMenuShellDirs::iterator it=dirs.begin();
it!=dirs.end(); ++it) {
+ StartMenuDirectory& smd = *it;
+ ShellDirectory& dir = smd._dir;
+
+ try {
+ super::import_IE_favorites(dir, hwnd);
+ } catch(COMException&) {
+ }
+ }
+
+ return true;
+}
+
+*/
_____
Copied: trunk/reactos/subsys/system/ibrowser/favorites.h (from rev
13256, trunk/reactos/subsys/system/explorer/taskbar/favorites.h)
_____
Added: trunk/reactos/subsys/system/ibrowser/ibrowser.cpp
--- trunk/reactos/subsys/system/ibrowser/ibrowser.cpp 2005-01-26
00:03:05 UTC (rev 13301)
+++ trunk/reactos/subsys/system/ibrowser/ibrowser.cpp 2005-01-26
00:12:33 UTC (rev 13302)
@@ -0,0 +1,517 @@
+/*
+ * Copyright 2005 Martin Fuchs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+
+ //
+ // ROS Internet Web Browser
+ //
+ // ibrowser.cpp
+ //
+ // Martin Fuchs, 24.01.2005
+ //
+
+
+#include "precomp.h"
+
+#include "ibrowser_intres.h"
+
+#include <locale.h> // for setlocale()
+
+#ifndef __WINE__
+#include <io.h> // for dup2()
+#include <fcntl.h> // for _O_RDONLY
+#endif
+
+
+ // globals
+
+HINSTANCE g_hInstance;
+IconCache g_icon_cache;
+ATOM g_hframeClass;
+
+
+/*@@
+void ExplorerGlobals::read_persistent()
+{
+ // read configuration file
+ _cfg_dir.printf(TEXT("%s\\ReactOS"),
(LPCTSTR)SpecialFolderFSPath(CSIDL_APPDATA,0));
+ _cfg_path.printf(TEXT("%s\\ros-ibrowser-cfg.xml"),
_cfg_dir.c_str());
+
+ if (!_cfg.read(_cfg_path)) {
+ if (_cfg._last_error != XML_ERROR_NO_ELEMENTS)
+ MessageBox(g_Globals._hwndDesktop,
String(_cfg._last_error_msg.c_str()),
+ TEXT("ROS Explorer -
reading user settings"), MB_OK);
+
+ _cfg.read(TEXT("ibrowser-cfg-template.xml"));
+ }
+
+ // read bookmarks
+ _favorites_path.printf(TEXT("%s\\ros-ibrowser-bookmarks.xml"),
_cfg_dir.c_str());
+
+ if (!_favorites.read(_favorites_path)) {
+ _favorites.import_IE_favorites(0);
+ _favorites.write(_favorites_path);
+ }
+}
+
+void ExplorerGlobals::write_persistent()
+{
+ // write configuration file
+ RecursiveCreateDirectory(_cfg_dir);
+
+ _cfg.write(_cfg_path);
+ _favorites.write(_favorites_path);
+}
+
+
+XMLPos ExplorerGlobals::get_cfg()
+{
+ XMLPos cfg_pos(&_cfg);
+
+ cfg_pos.smart_create("ibrowser-cfg");
+
+ return cfg_pos;
+}
+
+XMLPos ExplorerGlobals::get_cfg(const char* path)
+{
+ XMLPos cfg_pos(&_cfg);
+
+ cfg_pos.smart_create("ibrowser-cfg");
+ cfg_pos.create_relative(path);
+
+ return cfg_pos;
+}
+*/
+
+
+Icon::Icon()
+ : _id(ICID_UNKNOWN),
+ _itype(IT_STATIC),
+ _hicon(0)
+{
+}
+
+Icon::Icon(ICON_ID id, UINT nid)
+ : _id(id),
+ _itype(IT_STATIC),
+ _hicon(SmallIcon(nid))
+{
+}
+
+Icon::Icon(ICON_TYPE itype, int id, HICON hIcon)
+ : _id((ICON_ID)id),
+ _itype(itype),
+ _hicon(hIcon)
+{
+}
+
+Icon::Icon(ICON_TYPE itype, int id, int sys_idx)
+ : _id((ICON_ID)id),
+ _itype(itype),
+ _sys_idx(sys_idx)
+{
+}
+
+void Icon::draw(HDC hdc, int x, int y, int cx, int cy, COLORREF
bk_color, HBRUSH bk_brush) const
+{
+ if (_itype == IT_SYSCACHE)
+ ImageList_DrawEx(g_icon_cache.get_sys_imagelist(),
_sys_idx, hdc, x, y, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
+ else
+ DrawIconEx(hdc, x, y, _hicon, cx, cy, 0, bk_brush,
DI_NORMAL);
+}
+
+HBITMAP Icon::create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd,
HDC hdc_wnd) const
+{
+ if (_itype == IT_SYSCACHE) {
+ HIMAGELIST himl = g_icon_cache.get_sys_imagelist();
+
+ int cx, cy;
+ ImageList_GetIconSize(himl, &cx, &cy);
+
+ HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
+ HDC hdc = CreateCompatibleDC(hdc_wnd);
+ HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
+ ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy,
bk_color, CLR_DEFAULT, ILD_NORMAL);
+ SelectBitmap(hdc, hbmp_old);
+ DeleteDC(hdc);
+
+ return hbmp;
+ } else
+ return create_bitmap_from_icon(_hicon, hbrBkgnd,
hdc_wnd);
+}
+
+
+int Icon::add_to_imagelist(HIMAGELIST himl, HDC hdc_wnd, COLORREF
bk_color, HBRUSH bk_brush) const
+{
+ int ret;
+
+ if (_itype == IT_SYSCACHE) {
+ HIMAGELIST himl = g_icon_cache.get_sys_imagelist();
+
+ int cx, cy;
+ ImageList_GetIconSize(himl, &cx, &cy);
+
+ HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
+ HDC hdc = CreateCompatibleDC(hdc_wnd);
+ HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
+ ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy,
bk_color, CLR_DEFAULT, ILD_NORMAL);
+ SelectBitmap(hdc, hbmp_old);
+ DeleteDC(hdc);
+
+ ret = ImageList_Add(himl, hbmp, 0);
+
+ DeleteObject(hbmp);
+ } else
+ ret = ImageList_AddAlphaIcon(himl, _hicon, bk_brush,
hdc_wnd);
+
+ return ret;
+}
+
+HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC
hdc_wnd)
+{
+ int cx = GetSystemMetrics(SM_CXSMICON);
+ int cy = GetSystemMetrics(SM_CYSMICON);
+ HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
+
+ MemCanvas canvas;
+ BitmapSelection sel(canvas, hbmp);
+
+ RECT rect = {0, 0, cx, cy};
+ FillRect(canvas, &rect, hbrush_bkgnd);
+
+ DrawIconEx(canvas, 0, 0, hIcon, cx, cy, 0, hbrush_bkgnd,
DI_NORMAL);
+
+ return hbmp;
+}
+
+int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd)
+{
+ HBITMAP hbmp = create_bitmap_from_icon(hIcon, hbrush_bkgnd,
hdc_wnd);
+
+ int ret = ImageList_Add(himl, hbmp, 0);
+
+ DeleteObject(hbmp);
+
+ return ret;
+}
+
+
+int IconCache::s_next_id = ICID_DYNAMIC;
+
+
+void IconCache::init()
+{
+ _icons[ICID_NONE] = Icon(IT_STATIC, ICID_NONE,
(HICON)0);
+
+ _icons[ICID_IBROWSER] = Icon(ICID_IBROWSER, IDI_IBROWSER);
+ _icons[ICID_BOOKMARK] = Icon(ICID_BOOKMARK, IDI_DOT_TRANS);
+}
+
+
+const Icon& IconCache::extract(const String& path)
+{
+ PathMap::iterator found = _pathMap.find(path);
+
+ if (found != _pathMap.end())
+ return _icons[found->second];
+
+ SHFILEINFO sfi;
+
+#if 1 // use system image list
+ HIMAGELIST himlSys = (HIMAGELIST) SHGetFileInfo(path, 0, &sfi,
sizeof(sfi), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
+
+ if (himlSys) {
+ _himlSys = himlSys;
+
+ const Icon& icon = add(sfi.iIcon/*, IT_SYSCACHE*/);
+#else
+ if (SHGetFileInfo(path, 0, &sfi, sizeof(sfi),
SHGFI_ICON|SHGFI_SMALLICON)) {
+ const Icon& icon = add(sfi.hIcon, IT_CACHED);
+#endif
+
+ ///@todo limit cache size
+ _pathMap[path] = icon;
+
+ return icon;
+ } else
[truncated at 1000 lines; 8277 more skipped]