From 0acb5f1329d294faf42e247f8c2daf68d82150f6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 20 Dec 2005 00:29:40 +0000 Subject: [PATCH] Renamed various types to fit lower_case_with_underscores convention. Renamed FrameBuffer to the more specific x_frame_buffer and removed "x_" from its accessor function names. Renamed files to match function/class names. --- Makefile | 18 +-- browserwidget.cpp => browser_widget.cpp | 200 ++++++++++++------------ browserwidget.hpp => browser_widget.hpp | 30 ++-- childiterator.cpp => child_iterator.cpp | 14 +- childiterator.hpp => child_iterator.hpp | 20 +-- linkiterator.cpp => link_iterator.cpp | 12 +- linkiterator.hpp => link_iterator.hpp | 18 +-- stylesheets.cpp => style_sheets.cpp | 2 +- stylesheets.hpp => style_sheets.hpp | 0 webdvd.cpp | 73 ++++----- framebuffer.cpp => x_frame_buffer.cpp | 10 +- framebuffer.hpp => x_frame_buffer.hpp | 14 +- 12 files changed, 206 insertions(+), 205 deletions(-) rename browserwidget.cpp => browser_widget.cpp (56%) rename browserwidget.hpp => browser_widget.hpp (73%) rename childiterator.cpp => child_iterator.cpp (61%) rename childiterator.hpp => child_iterator.hpp (53%) rename linkiterator.cpp => link_iterator.cpp (74%) rename linkiterator.hpp => link_iterator.hpp (61%) rename stylesheets.cpp => style_sheets.cpp (98%) rename stylesheets.hpp => style_sheets.hpp (100%) rename framebuffer.cpp => x_frame_buffer.cpp (97%) rename framebuffer.hpp => x_frame_buffer.hpp (63%) diff --git a/Makefile b/Makefile index 989ef7d..caffd0f 100644 --- a/Makefile +++ b/Makefile @@ -31,9 +31,9 @@ else endif cxxsources := \ - auto_proc.cpp browserwidget.cpp childiterator.cpp framebuffer.cpp \ - linkiterator.cpp pixbufs.cpp stylesheets.cpp temp_file.cpp video.cpp \ - webdvd.cpp xpcom_support.cpp + auto_proc.cpp browser_widget.cpp child_iterator.cpp \ + link_iterator.cpp pixbufs.cpp style_sheets.cpp temp_file.cpp video.cpp \ + webdvd.cpp x_frame_buffer.cpp xpcom_support.cpp csources := jquant2.c webdvd : $(cxxsources:.cpp=.o) $(csources:.c=.o) @@ -52,7 +52,7 @@ install : .PHONY : clean distclean install -browserwidget.% : CPPFLAGS += -DMOZ_LIB_DIR='"$(moz_lib_dir)"' +browser_widget.% : CPPFLAGS += -DMOZ_LIB_DIR='"$(moz_lib_dir)"' webdvd.% \ : CPPFLAGS += -DWEBDVD_LIB_DIR='"$(webdvd_lib_dir)"' \ @@ -60,16 +60,16 @@ webdvd.% \ -DMOZ_VERSION_MINOR=$(moz_version_minor) \ -DMOZ_VERSION_PATCHLEVEL=$(moz_version_patchlevel) -browserwidget.% pixbufs.% temp_file.% webdvd.% \ +browser_widget.% pixbufs.% temp_file.% webdvd.% \ : CPPFLAGS += $(shell pkg-config --cflags gtkmm-2.0) -browserwidget.% childiterator.o linkiterator.% stylesheets.% webdvd.% \ -xpcom_support.% \ +browser_widget.% child_iterator.o link_iterator.% style_sheets.% webdvd.% \ +xpcom_support.% \ : CPPFLAGS += $(shell pkg-config --cflags mozilla-gtkmozembed) # These dig a bit deeper into Mozilla -linkiterator.% stylesheets.% webdvd.% \ - : CPPFLAGS += $(addprefix -I$(moz_include_dir)/, \ +link_iterator.% style_sheets.% webdvd.% \ + : CPPFLAGS += $(addprefix -I$(moz_include_dir)/, \ content docshell dom gfx layout necko webshell widget) %.d : %.cpp diff --git a/browserwidget.cpp b/browser_widget.cpp similarity index 56% rename from browserwidget.cpp rename to browser_widget.cpp index a2bed64..0f6b53d 100644 --- a/browserwidget.cpp +++ b/browser_widget.cpp @@ -1,59 +1,59 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#include "browserwidget.hpp" +#include "browser_widget.hpp" #include #include -BrowserWidget::BrowserWidget() +browser_widget::browser_widget() : Gtk::Bin(GTK_BIN(gtk_moz_embed_new())) { } -BrowserWidget::~BrowserWidget() +browser_widget::~browser_widget() { } -GtkMozEmbed * BrowserWidget::gobj() +GtkMozEmbed * browser_widget::gobj() { return GTK_MOZ_EMBED(gobject_); } -const GtkMozEmbed * BrowserWidget::gobj() const +const GtkMozEmbed * browser_widget::gobj() const { return GTK_MOZ_EMBED(gobject_); } -void BrowserWidget::load_uri(const char * uri) +void browser_widget::load_uri(const char * uri) { gtk_moz_embed_load_url(gobj(), uri); } -void BrowserWidget::load_uri(const std::string & uri) +void browser_widget::load_uri(const std::string & uri) { return load_uri(uri.c_str()); } -void BrowserWidget::stop_load() +void browser_widget::stop_load() { gtk_moz_embed_stop_load(gobj()); } -void BrowserWidget::go_back() +void browser_widget::go_back() { gtk_moz_embed_go_back(gobj()); } -void BrowserWidget::go_forward() +void browser_widget::go_forward() { gtk_moz_embed_go_forward(gobj()); } -void BrowserWidget::reload(gint32 flags) +void browser_widget::reload(gint32 flags) { gtk_moz_embed_reload(gobj(), flags); } -bool BrowserWidget::can_go_back() const +bool browser_widget::can_go_back() const { return gtk_moz_embed_can_go_back(const_cast(gobj())); } -bool BrowserWidget::can_go_forward() const +bool browser_widget::can_go_forward() const { return gtk_moz_embed_can_go_forward(const_cast(gobj())); } @@ -83,31 +83,31 @@ namespace }; } -std::string BrowserWidget::get_link_message() const +std::string browser_widget::get_link_message() const { c_scoped_ptr str( gtk_moz_embed_get_link_message(const_cast(gobj()))); return std::string(str.get()); } -std::string BrowserWidget::get_js_status() const +std::string browser_widget::get_js_status() const { c_scoped_ptr str( gtk_moz_embed_get_js_status(const_cast(gobj()))); return std::string(str.get()); } -std::string BrowserWidget::get_title() const +std::string browser_widget::get_title() const { c_scoped_ptr str( gtk_moz_embed_get_title(const_cast(gobj()))); return std::string(str.get()); } -std::string BrowserWidget::get_location() const +std::string browser_widget::get_location() const { c_scoped_ptr str( gtk_moz_embed_get_location(const_cast(gobj()))); return std::string(str.get()); } -already_AddRefed BrowserWidget::get_browser() +already_AddRefed browser_widget::get_browser() { nsIWebBrowser * result = 0; gtk_moz_embed_get_nsIWebBrowser(gobj(), &result); @@ -117,7 +117,7 @@ already_AddRefed BrowserWidget::get_browser() namespace { - void BrowserWidget_signal_link_message_callback(GtkMozEmbed * self, void * data) + void browser_widget_signal_link_message_callback(GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -136,14 +136,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_link_message_info = + const Glib::SignalProxyInfo browser_widget_signal_link_message_info = { "link_message", - (GCallback) &BrowserWidget_signal_link_message_callback, - (GCallback) &BrowserWidget_signal_link_message_callback + (GCallback) &browser_widget_signal_link_message_callback, + (GCallback) &browser_widget_signal_link_message_callback }; - void BrowserWidget_signal_js_status_callback(GtkMozEmbed * self, void * data) + void browser_widget_signal_js_status_callback(GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -162,14 +162,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_js_status_info = + const Glib::SignalProxyInfo browser_widget_signal_js_status_info = { "js_status", - (GCallback) &BrowserWidget_signal_js_status_callback, - (GCallback) &BrowserWidget_signal_js_status_callback + (GCallback) &browser_widget_signal_js_status_callback, + (GCallback) &browser_widget_signal_js_status_callback }; - void BrowserWidget_signal_location_callback(GtkMozEmbed * self, void * data) + void browser_widget_signal_location_callback(GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -188,14 +188,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_location_info = + const Glib::SignalProxyInfo browser_widget_signal_location_info = { "location", - (GCallback) &BrowserWidget_signal_location_callback, - (GCallback) &BrowserWidget_signal_location_callback + (GCallback) &browser_widget_signal_location_callback, + (GCallback) &browser_widget_signal_location_callback }; - void BrowserWidget_signal_title_callback(GtkMozEmbed * self, void * data) + void browser_widget_signal_title_callback(GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -214,14 +214,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_title_info = + const Glib::SignalProxyInfo browser_widget_signal_title_info = { "title", - (GCallback) &BrowserWidget_signal_title_callback, - (GCallback) &BrowserWidget_signal_title_callback + (GCallback) &browser_widget_signal_title_callback, + (GCallback) &browser_widget_signal_title_callback }; - void BrowserWidget_signal_progress_callback( + void browser_widget_signal_progress_callback( GtkMozEmbed * self, gint p0, gint p1, void * data) { typedef SigC::Slot2 SlotType; @@ -241,14 +241,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_progress_info = + const Glib::SignalProxyInfo browser_widget_signal_progress_info = { "progress", - (GCallback) &BrowserWidget_signal_progress_callback, - (GCallback) &BrowserWidget_signal_progress_callback + (GCallback) &browser_widget_signal_progress_callback, + (GCallback) &browser_widget_signal_progress_callback }; - void BrowserWidget_signal_net_state_callback( + void browser_widget_signal_net_state_callback( GtkMozEmbed * self, const char * p0, gint p1, guint p2, void * data) { typedef SigC::Slot3 SlotType; @@ -268,14 +268,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_net_state_info = + const Glib::SignalProxyInfo browser_widget_signal_net_state_info = { "net_state_all", - (GCallback) &BrowserWidget_signal_net_state_callback, - (GCallback) &BrowserWidget_signal_net_state_callback + (GCallback) &browser_widget_signal_net_state_callback, + (GCallback) &browser_widget_signal_net_state_callback }; - void BrowserWidget_signal_net_start_callback(GtkMozEmbed * self, void * data) + void browser_widget_signal_net_start_callback(GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -294,14 +294,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_net_start_info = + const Glib::SignalProxyInfo browser_widget_signal_net_start_info = { "net_start", - (GCallback) &BrowserWidget_signal_net_start_callback, - (GCallback) &BrowserWidget_signal_net_start_callback + (GCallback) &browser_widget_signal_net_start_callback, + (GCallback) &browser_widget_signal_net_start_callback }; - void BrowserWidget_signal_net_stop_callback(GtkMozEmbed * self, void * data) + void browser_widget_signal_net_stop_callback(GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -320,17 +320,17 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_net_stop_info = + const Glib::SignalProxyInfo browser_widget_signal_net_stop_info = { "net_stop", - (GCallback) &BrowserWidget_signal_net_stop_callback, - (GCallback) &BrowserWidget_signal_net_stop_callback + (GCallback) &browser_widget_signal_net_stop_callback, + (GCallback) &browser_widget_signal_net_stop_callback }; - void BrowserWidget_signal_new_window_callback( + void browser_widget_signal_new_window_callback( GtkMozEmbed * self, GtkMozEmbed ** p0, guint p1, void * data) { - typedef SigC::Slot1 SlotType; + typedef SigC::Slot1 SlotType; if (Glib::ObjectBase::_get_current_wrapper((GObject *)self)) { @@ -339,7 +339,7 @@ namespace if (SigC::SlotNode * const slot = Glib::SignalProxyNormal::data_to_slot(data)) { - if (BrowserWidget * result = + if (browser_widget * result = (*(SlotType::Proxy)(slot->proxy_))(p1, slot)) { *p0 = result->gobj(); @@ -357,14 +357,14 @@ namespace return; } - const Glib::SignalProxyInfo BrowserWidget_signal_new_window_info = + const Glib::SignalProxyInfo browser_widget_signal_new_window_info = { "new_window", - (GCallback) &BrowserWidget_signal_new_window_callback, - (GCallback) &BrowserWidget_signal_new_window_callback + (GCallback) &browser_widget_signal_new_window_callback, + (GCallback) &browser_widget_signal_new_window_callback }; - void BrowserWidget_signal_visibility_callback( + void browser_widget_signal_visibility_callback( GtkMozEmbed * self, gboolean p0, void * data) { typedef SigC::Slot1 SlotType; @@ -384,14 +384,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_visibility_info = + const Glib::SignalProxyInfo browser_widget_signal_visibility_info = { "visibility", - (GCallback) &BrowserWidget_signal_visibility_callback, - (GCallback) &BrowserWidget_signal_visibility_callback + (GCallback) &browser_widget_signal_visibility_callback, + (GCallback) &browser_widget_signal_visibility_callback }; - void BrowserWidget_signal_destroy_browser_callback( + void browser_widget_signal_destroy_browser_callback( GtkMozEmbed * self, void * data) { typedef SigC::Slot0 SlotType; @@ -411,14 +411,14 @@ namespace } } - const Glib::SignalProxyInfo BrowserWidget_signal_destroy_info = + const Glib::SignalProxyInfo browser_widget_signal_destroy_info = { "destroy_browser", - (GCallback) &BrowserWidget_signal_destroy_browser_callback, - (GCallback) &BrowserWidget_signal_destroy_browser_callback + (GCallback) &browser_widget_signal_destroy_browser_callback, + (GCallback) &browser_widget_signal_destroy_browser_callback }; - gint BrowserWidget_signal_open_uri_callback( + gint browser_widget_signal_open_uri_callback( GtkMozEmbed * self, const char * p0, void * data) { typedef SigC::Slot1 SlotType; @@ -440,83 +440,83 @@ namespace return 0; } - const Glib::SignalProxyInfo BrowserWidget_signal_open_uri_info = + const Glib::SignalProxyInfo browser_widget_signal_open_uri_info = { "open_uri", - (GCallback) &BrowserWidget_signal_open_uri_callback, - (GCallback) &BrowserWidget_signal_open_uri_callback + (GCallback) &browser_widget_signal_open_uri_callback, + (GCallback) &browser_widget_signal_open_uri_callback }; } // namespace -Glib::SignalProxy0 BrowserWidget::signal_link_message() +Glib::SignalProxy0 browser_widget::signal_link_message() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_link_message_info); + return Glib::SignalProxy0(this, &browser_widget_signal_link_message_info); } -Glib::SignalProxy0 BrowserWidget::signal_js_status() +Glib::SignalProxy0 browser_widget::signal_js_status() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_js_status_info); + return Glib::SignalProxy0(this, &browser_widget_signal_js_status_info); } -Glib::SignalProxy0 BrowserWidget::signal_location() +Glib::SignalProxy0 browser_widget::signal_location() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_location_info); + return Glib::SignalProxy0(this, &browser_widget_signal_location_info); } -Glib::SignalProxy0 BrowserWidget::signal_title() +Glib::SignalProxy0 browser_widget::signal_title() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_title_info); + return Glib::SignalProxy0(this, &browser_widget_signal_title_info); } -Glib::SignalProxy2 BrowserWidget::signal_progress() +Glib::SignalProxy2 browser_widget::signal_progress() { return Glib::SignalProxy2( - this, &BrowserWidget_signal_progress_info); + this, &browser_widget_signal_progress_info); } Glib::SignalProxy3 -BrowserWidget::signal_net_state() +browser_widget::signal_net_state() { return Glib::SignalProxy3( - this, &BrowserWidget_signal_net_state_info); + this, &browser_widget_signal_net_state_info); } -Glib::SignalProxy0 BrowserWidget::signal_net_start() +Glib::SignalProxy0 browser_widget::signal_net_start() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_net_start_info); + return Glib::SignalProxy0(this, &browser_widget_signal_net_start_info); } -Glib::SignalProxy0 BrowserWidget::signal_net_stop() +Glib::SignalProxy0 browser_widget::signal_net_stop() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_net_stop_info); + return Glib::SignalProxy0(this, &browser_widget_signal_net_stop_info); } -Glib::SignalProxy1 BrowserWidget::signal_new_window() +Glib::SignalProxy1 browser_widget::signal_new_window() { - return Glib::SignalProxy1( - this, &BrowserWidget_signal_new_window_info); + return Glib::SignalProxy1( + this, &browser_widget_signal_new_window_info); } -Glib::SignalProxy1 BrowserWidget::signal_visibility() +Glib::SignalProxy1 browser_widget::signal_visibility() { return Glib::SignalProxy1( - this, &BrowserWidget_signal_visibility_info); + this, &browser_widget_signal_visibility_info); } -Glib::SignalProxy0 BrowserWidget::signal_destroy() +Glib::SignalProxy0 browser_widget::signal_destroy() { - return Glib::SignalProxy0(this, &BrowserWidget_signal_destroy_info); + return Glib::SignalProxy0(this, &browser_widget_signal_destroy_info); } -Glib::SignalProxy1 BrowserWidget::signal_open_uri() +Glib::SignalProxy1 browser_widget::signal_open_uri() { return Glib::SignalProxy1( - this, &BrowserWidget_signal_open_uri_info); + this, &browser_widget_signal_open_uri_info); } -BrowserWidget::BrowserWidget(GObject * gobject, bool take_copy) +browser_widget::browser_widget(GObject * gobject, bool take_copy) { assert(GTK_MOZ_EMBED(gobject)); gobject_ = gobject; if (take_copy) reference(); } -Glib::ObjectBase * BrowserWidget::wrap_new(GObject * gobject) +Glib::ObjectBase * browser_widget::wrap_new(GObject * gobject) { - return new BrowserWidget(gobject, false); + return new browser_widget(gobject, false); } -BrowserWidget::Initialiser::Initialiser() +browser_widget::initialiser::initialiser() { gtk_moz_embed_set_comp_path(MOZ_LIB_DIR); gtk_moz_embed_push_startup(); @@ -524,16 +524,16 @@ BrowserWidget::Initialiser::Initialiser() wrap_register(gtk_moz_embed_get_type(), wrap_new); } -BrowserWidget::Initialiser::~Initialiser() +browser_widget::initialiser::~initialiser() { gtk_moz_embed_pop_startup(); } namespace Glib { - BrowserWidget * wrap(GtkMozEmbed * object, bool take_copy) + browser_widget * wrap(GtkMozEmbed * object, bool take_copy) { - return dynamic_cast( + return dynamic_cast( Glib::wrap_auto((GObject*)(object), take_copy)); } } diff --git a/browserwidget.hpp b/browser_widget.hpp similarity index 73% rename from browserwidget.hpp rename to browser_widget.hpp index 2cfc1d7..16d3023 100644 --- a/browserwidget.hpp +++ b/browser_widget.hpp @@ -1,8 +1,8 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#ifndef INC_BROWSERWIDGET_HPP -#define INC_BROWSERWIDGET_HPP +#ifndef INC_BROWSER_WIDGET_HPP +#define INC_BROWSER_WIDGET_HPP #include #include @@ -10,19 +10,19 @@ #include #include -class BrowserWidget; +class browser_widget; class nsIWebBrowser; namespace Glib { - BrowserWidget * wrap(GtkMozEmbed * object, bool take_copy = false); + browser_widget * wrap(GtkMozEmbed * object, bool take_copy = false); } -class BrowserWidget : public Gtk::Bin +class browser_widget : public Gtk::Bin { public: - BrowserWidget(); - virtual ~BrowserWidget(); + browser_widget(); + virtual ~browser_widget(); GtkMozEmbed * gobj(); const GtkMozEmbed * gobj() const; @@ -51,23 +51,23 @@ public: signal_net_state(); Glib::SignalProxy0 signal_net_start(); Glib::SignalProxy0 signal_net_stop(); - Glib::SignalProxy1 signal_new_window(); + Glib::SignalProxy1 signal_new_window(); Glib::SignalProxy1 signal_visibility(); Glib::SignalProxy0 signal_destroy(); Glib::SignalProxy1 signal_open_uri(); // This must be instantiated after Gtk initialisation and before - // instantiation of BrowserWidget. - struct Initialiser + // instantiation of browser_widget. + struct initialiser { - Initialiser(); - ~Initialiser(); + initialiser(); + ~initialiser(); }; private: - BrowserWidget(GObject * gobject, bool take_copy); + browser_widget(GObject * gobject, bool take_copy); static Glib::ObjectBase * wrap_new(GObject * gobject); - friend BrowserWidget * Glib::wrap(GtkMozEmbed * object, bool take_copy); + friend browser_widget * Glib::wrap(GtkMozEmbed * object, bool take_copy); }; -#endif // !INC_BROWSERWIDGET_HPP +#endif // !INC_BROWSER_WIDGET_HPP diff --git a/childiterator.cpp b/child_iterator.cpp similarity index 61% rename from childiterator.cpp rename to child_iterator.cpp index 285b4a8..d6e708e 100644 --- a/childiterator.cpp +++ b/child_iterator.cpp @@ -1,7 +1,7 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#include "childiterator.hpp" +#include "child_iterator.hpp" #include @@ -9,29 +9,29 @@ using xpcom_support::check; -ChildIterator::ChildIterator() +child_iterator::child_iterator() : node_(0) {} -ChildIterator::ChildIterator(nsIDOMNode * node) +child_iterator::child_iterator(nsIDOMNode * node) { check(node->GetFirstChild(&node_)); } -ChildIterator::~ChildIterator() +child_iterator::~child_iterator() { if (node_) node_->Release(); } -already_AddRefed ChildIterator::operator*() const +already_AddRefed child_iterator::operator*() const { assert(node_); node_->AddRef(); return node_; } -ChildIterator & ChildIterator::operator++() +child_iterator & child_iterator::operator++() { nsIDOMNode * next; check(node_->GetNextSibling(&next)); @@ -40,7 +40,7 @@ ChildIterator & ChildIterator::operator++() return *this; } -bool ChildIterator::operator==(const ChildIterator & other) const +bool child_iterator::operator==(const child_iterator & other) const { return node_ == other.node_; } diff --git a/childiterator.hpp b/child_iterator.hpp similarity index 53% rename from childiterator.hpp rename to child_iterator.hpp index edc937c..e099676 100644 --- a/childiterator.hpp +++ b/child_iterator.hpp @@ -1,27 +1,27 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#ifndef INC_CHILDITERATOR_HPP -#define INC_CHILDITERATOR_HPP +#ifndef INC_CHILD_ITERATOR_HPP +#define INC_CHILD_ITERATOR_HPP #include #include #include -class ChildIterator +class child_iterator : public std::iterator, void, void, void> { public: - ChildIterator(); - explicit ChildIterator(nsIDOMNode * node); - ~ChildIterator(); + child_iterator(); + explicit child_iterator(nsIDOMNode * node); + ~child_iterator(); already_AddRefed operator*() const; - ChildIterator & operator++(); - bool operator==(const ChildIterator &) const; - bool operator!=(const ChildIterator & other) const + child_iterator & operator++(); + bool operator==(const child_iterator &) const; + bool operator!=(const child_iterator & other) const { return !(*this == other); } @@ -30,4 +30,4 @@ private: nsIDOMNode * node_; }; -#endif // !INC_CHILDITERATOR_HPP +#endif // !INC_CHILD_ITERATOR_HPP diff --git a/linkiterator.cpp b/link_iterator.cpp similarity index 74% rename from linkiterator.cpp rename to link_iterator.cpp index b751c1d..20d4b4c 100644 --- a/linkiterator.cpp +++ b/link_iterator.cpp @@ -1,17 +1,17 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#include "linkiterator.hpp" +#include "link_iterator.hpp" #include #include #include -LinkIterator::LinkIterator() +link_iterator::link_iterator() {} -LinkIterator::LinkIterator(nsIDOMDocument * document) +link_iterator::link_iterator(nsIDOMDocument * document) { nsCOMPtr htmlDoc(do_QueryInterface(document)); if (!htmlDoc) @@ -27,7 +27,7 @@ LinkIterator::LinkIterator(nsIDOMDocument * document) collection_ = 0; } -already_AddRefed LinkIterator::operator*() const +already_AddRefed link_iterator::operator*() const { assert(collection_); nsIDOMNode * result = 0; @@ -36,7 +36,7 @@ already_AddRefed LinkIterator::operator*() const return dont_AddRef(result); } -LinkIterator & LinkIterator::operator++() +link_iterator & link_iterator::operator++() { assert(collection_); ++index_; @@ -45,7 +45,7 @@ LinkIterator & LinkIterator::operator++() return *this; } -bool LinkIterator::operator==(const LinkIterator & other) const +bool link_iterator::operator==(const link_iterator & other) const { return (collection_ == other.collection_ && (!collection_ || index_ == other.index_)); diff --git a/linkiterator.hpp b/link_iterator.hpp similarity index 61% rename from linkiterator.hpp rename to link_iterator.hpp index 2f93a2f..d2b7a1a 100644 --- a/linkiterator.hpp +++ b/link_iterator.hpp @@ -1,8 +1,8 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#ifndef INC_LINKITERATOR_HPP -#define INC_LINKITERATOR_HPP +#ifndef INC_LINK_ITERATOR_HPP +#define INC_LINK_ITERATOR_HPP #include @@ -12,18 +12,18 @@ class nsIDOMDocument; -class LinkIterator +class link_iterator : public std::iterator, void, void, void> { public: - LinkIterator(); - explicit LinkIterator(nsIDOMDocument * document); + link_iterator(); + explicit link_iterator(nsIDOMDocument * document); already_AddRefed operator*() const; - LinkIterator & operator++(); - bool operator==(const LinkIterator &) const; - bool operator!=(const LinkIterator & other) const + link_iterator & operator++(); + bool operator==(const link_iterator &) const; + bool operator!=(const link_iterator & other) const { return !(*this == other); } @@ -33,4 +33,4 @@ private: unsigned int index_, length_; }; -#endif // !INC_LINKITERATOR_HPP +#endif // !INC_LINK_ITERATOR_HPP diff --git a/stylesheets.cpp b/style_sheets.cpp similarity index 98% rename from stylesheets.cpp rename to style_sheets.cpp index aa34643..5767800 100644 --- a/stylesheets.cpp +++ b/style_sheets.cpp @@ -1,7 +1,7 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#include "stylesheets.hpp" +#include "style_sheets.hpp" #include #include diff --git a/stylesheets.hpp b/style_sheets.hpp similarity index 100% rename from stylesheets.hpp rename to style_sheets.hpp diff --git a/webdvd.cpp b/webdvd.cpp index 5eca6c8..9a5dd04 100644 --- a/webdvd.cpp +++ b/webdvd.cpp @@ -50,15 +50,15 @@ #include #include -#include "browserwidget.hpp" -#include "childiterator.hpp" +#include "browser_widget.hpp" +#include "child_iterator.hpp" #include "dvd.hpp" -#include "framebuffer.hpp" -#include "linkiterator.hpp" +#include "link_iterator.hpp" #include "pixbufs.hpp" -#include "stylesheets.hpp" +#include "style_sheets.hpp" #include "temp_file.hpp" #include "video.hpp" +#include "x_frame_buffer.hpp" #include "xpcom_support.hpp" using xpcom_support::check; @@ -126,7 +126,7 @@ namespace result.bottom = result.top + height; // Merge bounding boxes of all child elements - for (ChildIterator it = ChildIterator(elem), end; it != end; ++it) + for (child_iterator it = child_iterator(elem), end; it != end; ++it) { nsCOMPtr child_node(*it); PRUint16 child_type; @@ -142,10 +142,10 @@ namespace return result; } - class WebDvdWindow : public Gtk::Window + class webdvd_window : public Gtk::Window { public: - WebDvdWindow( + webdvd_window( const video::frame_params & frame_params, const std::string & main_page_uri, const std::string & output_dir); @@ -162,14 +162,14 @@ namespace nsIDOMWindow * dom_window); void generate_dvd(); - enum ResourceType { page_resource, video_resource }; - typedef std::pair ResourceEntry; + enum resource_type { page_resource, video_resource }; + typedef std::pair resource_entry; video::frame_params frame_params_; std::string output_dir_; - BrowserWidget browser_widget_; + browser_widget browser_widget_; nsCOMPtr stylesheet_; std::queue page_queue_; - std::map resource_map_; + std::map resource_map_; std::vector > page_links_; std::vector video_paths_; bool pending_window_update_; @@ -181,7 +181,7 @@ namespace std::vector > page_temp_files_; }; - WebDvdWindow::WebDvdWindow( + webdvd_window::webdvd_window( const video::frame_params & frame_params, const std::string & main_page_uri, const std::string & output_dir) @@ -198,27 +198,27 @@ namespace add(browser_widget_); browser_widget_.show(); browser_widget_.signal_net_state().connect( - SigC::slot(*this, &WebDvdWindow::on_net_state_change)); + SigC::slot(*this, &webdvd_window::on_net_state_change)); add_page(main_page_uri); load_next_page(); } - void WebDvdWindow::add_page(const std::string & uri) + void webdvd_window::add_page(const std::string & uri) { if (resource_map_.insert( - std::make_pair(uri, ResourceEntry(page_resource, 0))) + std::make_pair(uri, resource_entry(page_resource, 0))) .second) { page_queue_.push(uri); } } - void WebDvdWindow::add_video(const std::string & uri) + void webdvd_window::add_video(const std::string & uri) { if (resource_map_.insert( - std::make_pair(uri, ResourceEntry(video_resource, - video_paths_.size() + 1))) + std::make_pair(uri, resource_entry(video_resource, + video_paths_.size() + 1))) .second) { Glib::ustring hostname; @@ -231,7 +231,7 @@ namespace } } - void WebDvdWindow::load_next_page() + void webdvd_window::load_next_page() { assert(!page_queue_.empty()); const std::string & uri = page_queue_.front(); @@ -244,11 +244,11 @@ namespace browser_widget_.load_uri(uri); } - void WebDvdWindow::on_net_state_change(const char * uri, + void webdvd_window::on_net_state_change(const char * uri, gint flags, guint status) { # ifdef DEBUG_ON_NET_STATE_CHANGE - std::cout << "WebDvdWindow::on_net_state_change("; + std::cout << "webdvd_window::on_net_state_change("; if (uri) std::cout << '"' << uri << '"'; else @@ -335,7 +335,7 @@ namespace } } - bool WebDvdWindow::process_page() + bool webdvd_window::process_page() { assert(!page_queue_.empty()); @@ -399,7 +399,7 @@ namespace return true; } - void WebDvdWindow::save_screenshot() + void webdvd_window::save_screenshot() { Glib::RefPtr window(get_window()); assert(window); @@ -415,7 +415,7 @@ namespace ->save(background_temp_->get_name(), "png"); } - struct WebDvdWindow::page_state + struct webdvd_window::page_state { page_state(nsIDOMDocument * doc, int width, int height) : diff_pixbuf(Gdk::Pixbuf::create( @@ -440,14 +440,14 @@ namespace temp_file links_temp; int link_num; - LinkIterator links_it, links_end; + link_iterator links_it, links_end; rectangle link_rect; bool link_changing; Glib::RefPtr norm_pixbuf; }; - void WebDvdWindow::process_links(nsIPresShell * pres_shell, + void webdvd_window::process_links(nsIPresShell * pres_shell, nsIPresContext * pres_context, nsIDOMWindow * dom_window) { @@ -707,7 +707,7 @@ namespace void generate_page_dispatch(std::ostream &, int indent, int first_page, int last_page); - void WebDvdWindow::generate_dvd() + void webdvd_window::generate_dvd() { temp_file temp("webdvd-dvdauthor-"); temp.close(); @@ -818,7 +818,7 @@ namespace " g1 = " << link_num * link_mult + page_num << ";"; // Jump to appropriate resource. - const ResourceEntry & resource_loc = + const resource_entry & resource_loc = resource_map_[page_links[link_num - 1]]; if (resource_loc.first == page_resource) file << @@ -1050,16 +1050,17 @@ int main(int argc, char ** argv) } } - std::auto_ptr fb; + std::auto_ptr fb; if (!preview_mode) { // Spawn Xvfb and set env variables so that Xlib will use it // Use 8 bits each for RGB components, which should translate into // "enough" bits for YUV components. - fb.reset(new FrameBuffer(frame_params.width, frame_params.height, - 3 * 8)); - setenv("XAUTHORITY", fb->get_x_authority().c_str(), true); - setenv("DISPLAY", fb->get_x_display().c_str(), true); + fb.reset(new x_frame_buffer(frame_params.width, + frame_params.height, + 3 * 8)); + setenv("XAUTHORITY", fb->get_authority().c_str(), true); + setenv("DISPLAY", fb->get_display().c_str(), true); } // Initialise Gtk @@ -1118,11 +1119,11 @@ int main(int argc, char ** argv) output_dir = argv[argi + 1]; // Initialise Mozilla - BrowserWidget::Initialiser browser_init; + browser_widget::initialiser browser_init; set_browser_preferences(); // Run the browser/converter - WebDvdWindow window(frame_params, menu_url, output_dir); + webdvd_window window(frame_params, menu_url, output_dir); Gtk::Main::run(window); } catch (std::exception & e) diff --git a/framebuffer.cpp b/x_frame_buffer.cpp similarity index 97% rename from framebuffer.cpp rename to x_frame_buffer.cpp index 2ae42cd..75d9595 100644 --- a/framebuffer.cpp +++ b/x_frame_buffer.cpp @@ -1,7 +1,7 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#include "framebuffer.hpp" +#include "x_frame_buffer.hpp" #include #include @@ -244,20 +244,20 @@ namespace } } -FrameBuffer::FrameBuffer(int width, int height, int depth) +x_frame_buffer::x_frame_buffer(int width, int height, int depth) : display_num_(select_display_num(tcp4_socket_, tcp6_socket_)), auth_file_(create_temp_auth_file(display_num_)), server_proc_(spawn_x_server(display_num_, - get_x_authority(), + get_authority(), width, height, depth)) {} -std::string FrameBuffer::get_x_authority() const +std::string x_frame_buffer::get_authority() const { return auth_file_->get_name(); } -std::string FrameBuffer::get_x_display() const +std::string x_frame_buffer::get_display() const { char display[15]; std::sprintf(display, ":%d", display_num_); diff --git a/framebuffer.hpp b/x_frame_buffer.hpp similarity index 63% rename from framebuffer.hpp rename to x_frame_buffer.hpp index 3e49875..198d586 100644 --- a/framebuffer.hpp +++ b/x_frame_buffer.hpp @@ -1,8 +1,8 @@ // Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. -#ifndef INC_FRAMEBUFFER_HPP -#define INC_FRAMEBUFFER_HPP +#ifndef INC_X_FRAME_BUFFER_HPP +#define INC_X_FRAME_BUFFER_HPP #include #include @@ -12,12 +12,12 @@ #include "temp_file.hpp" // Run Xvfb with a frame buffer of the given dimensions. -class FrameBuffer +class x_frame_buffer { public: - FrameBuffer(int width, int height, int depth); - std::string get_x_authority() const; - std::string get_x_display() const; + x_frame_buffer(int width, int height, int depth); + std::string get_authority() const; + std::string get_display() const; private: auto_fd tcp4_socket_, tcp6_socket_; @@ -26,4 +26,4 @@ private: auto_kill_proc server_proc_; }; -#endif // !INC_FRAMEBUFFER_HPP +#endif // !INC_X_FRAME_BUFFER_HPP -- 2.39.5