]> git.decadent.org.uk Git - videolink.git/blobdiff - videolink.cpp
Removed support for Mozilla 1.7.
[videolink.git] / videolink.cpp
index 3d88f4edb7c57a1fe7e26c8a0ff53f348b00f361..74b8a21a067979a5317ba0abc9bd645558e4dc40 100644 (file)
 #include <nsIURI.h> // required before nsILink.h
 #include <nsILink.h>
 #include <nsIPrefBranch.h>
-#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
-#   include <nsPresContext.h>
-#else
-#   include <nsIPresContext.h>
-    typedef nsIPresContext nsPresContext; // ugh
-#endif
+#include <nsPresContext.h>
 #include <nsIPrefService.h>
 #include <nsIPresShell.h>
-#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
-#   include <nsServiceManagerUtils.h>
-#else
-#   include <nsIServiceManagerUtils.h>
-#endif
+#include <nsServiceManagerUtils.h>
 #include <nsIWebBrowser.h>
 #include <nsString.h>
 
@@ -187,7 +178,6 @@ namespace
        video::frame_params frame_params_;
        std::string output_dir_;
        browser_widget browser_widget_;
-       agent_style_sheet_holder main_style_sheet_, frame_style_sheet_;
 
        dvd_generator generator_;
        typedef std::map<std::string, dvd_generator::pgc_ref>
@@ -210,15 +200,6 @@ namespace
        dvd_generator::mpeg_encoder encoder)
            : frame_params_(frame_params),
              output_dir_(output_dir),
-             main_style_sheet_(
-                 init_agent_style_sheet(
-                     "file://" VIDEOLINK_SHARE_DIR "/videolink.css")),
-             frame_style_sheet_(
-                 init_agent_style_sheet(
-                     std::string("file://" VIDEOLINK_SHARE_DIR "/")
-                     .append(frame_params.common_name)
-                     .append(".css")
-                     .c_str())),
              generator_(frame_params, encoder),
              pending_window_update_(false),
              pending_req_count_(0),
@@ -428,7 +409,6 @@ namespace
                                  Gdk::COLORSPACE_RGB,
                                  true, 8, // has_alpha, bits_per_sample
                                  width, height)),
-                 link_num(0),
                  links_it(doc),
                  link_changing(false)
            {
@@ -437,7 +417,6 @@ namespace
        Glib::RefPtr<Gdk::Pixbuf> norm_pixbuf;
        Glib::RefPtr<Gdk::Pixbuf> diff_pixbuf;
 
-       unsigned link_num;
        link_iterator links_it, links_end;
 
        rectangle link_rect;
@@ -458,13 +437,9 @@ namespace
        nsCOMPtr<nsIDOMWindow> dom_window;
        check(browser->GetContentDOMWindow(getter_AddRefs(dom_window)));
 
-       // If we haven't done so already, apply the stylesheet and
-       // disable scrollbars.
+       // If we haven't done so already, disable scrollbars.
        if (!have_tweaked_page_)
        {
-           apply_agent_style_sheet(main_style_sheet_, pres_shell);
-           apply_agent_style_sheet(frame_style_sheet_, pres_shell);
-
            // This actually only needs to be done once.
            nsCOMPtr<nsIDOMBarProp> dom_bar_prop;
            check(dom_window->GetScrollbars(getter_AddRefs(dom_bar_prop)));
@@ -609,18 +584,6 @@ namespace
                    continue;
                }
 
-               ++state->link_num;
-
-               if (state->link_num >= unsigned(dvd::menu_buttons_max))
-               {
-                   if (state->link_num == unsigned(dvd::menu_buttons_max))
-                       std::cerr << "No more than " << dvd::menu_buttons_max
-                                 << " buttons can be placed on a menu\n";
-                   std::cerr << "Ignoring link to " << uri_and_fragment
-                             << "\n";
-                   continue;
-               }
-
                // Check whether this is a link to a video or a page then
                // add it to the known resources if not already seen; then
                // add it to the menu entries.
@@ -682,12 +645,7 @@ namespace
                check(event_state_man->SetContentState(content,
                                                       NS_EVENT_STATE_HOVER));
 
-#              if MOZ_VERSION_MAJOR > 1                                   \
-                    || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
-                   pres_shell->FlushPendingNotifications(Flush_Display);
-#              else
-                   pres_shell->FlushPendingNotifications(true);
-#              endif
+               pres_shell->FlushPendingNotifications(Flush_Display);
 
                // We may have to exit and wait for image loading
                // to complete, at which point we will be called
@@ -763,15 +721,12 @@ namespace
        nsCOMPtr<nsIPrefBranch> pref_branch;
        check(pref_service->GetBranch("", getter_AddRefs(pref_branch)));
 
-#      if MOZ_VERSION_MAJOR > 1                                 \
-           || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
-           // Disable IE-compatibility kluge that causes backgrounds to
-           // sometimes/usually be missing from snapshots.  This is only
-           // effective from Mozilla 1.8 onward.
-           check(pref_branch->SetBoolPref(
-                     "layout.fire_onload_after_image_background_loads",
-                     true));
-#      endif
+       // Disable IE-compatibility kluge that causes backgrounds to
+       // sometimes/usually be missing from snapshots.  This is only
+       // effective from Mozilla 1.8 onward.
+       check(pref_branch->SetBoolPref(
+                 "layout.fire_onload_after_image_background_loads",
+                 true));
 
        // Set display resolution.  With standard-definition video we
        // will be fitting ~600 pixels across a screen typically
@@ -792,7 +747,7 @@ namespace
        // separately, but don't know how yet.  Setting one to 40
        // but not the other is *bad*, so currently we set neither.
 
-#      if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR < 8
+#      if 0
            check(pref_branch->SetIntPref("browser.display.screen_resolution",
                                          40));
 #      endif
@@ -959,6 +914,10 @@ int main(int argc, char ** argv)
        // Initialise Mozilla
        browser_widget::initialiser browser_init;
        set_browser_preferences();
+       init_agent_style_sheet("file://" VIDEOLINK_SHARE_DIR "/videolink.css");
+       init_agent_style_sheet(std::string("file://" VIDEOLINK_SHARE_DIR "/")
+                              .append(frame_params.common_name).append(".css")
+                              .c_str());
        if (!preview_mode)
            null_prompt_service::install();