add optional sizes and add x-large and xx-large
authorgc <gc>
Wed, 27 Apr 2005 21:11:28 +0000 (21:11 +0000)
committergc <gc>
Wed, 27 Apr 2005 21:11:28 +0000 (21:11 +0000)
bin/booh
bin/booh-gui
data/booh/themes/simple/metadata/parameters.rb
lib/booh/booh-lib.rb

index 4ce1f123cfc6de65a421d4af25cd22e2a9f8be4f..fb8d643bb7309aa5674552785f8d7e371fed377f 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -304,6 +304,10 @@ def img_element(fullpath)
     return '<img src="' + File.basename(fullpath) + '" ' + sizespec + ' border="0"/>'
 end
 
+def size2js(name)
+    return name.gsub(/-/, '')
+end
+
 def substitute_html_sizes(html, sizeobj, type)
     sizestrings = []
     if $images_size.length > 1
@@ -312,7 +316,7 @@ def substitute_html_sizes(html, sizeobj, type)
                 if type == 'thumbnails'
                     sizestrings << '<a href="thumbnails-' + sizeobj2['name'] + '.html">' + sizename(sizeobj2['name']) + '</a>'
                 else
-                    sizestrings << '<a id="link' + sizeobj2['name'] + '">' + sizename(sizeobj2['name']) + '</a>'
+                    sizestrings << '<a id="link' + size2js(sizeobj2['name']) + '">' + sizename(sizeobj2['name']) + '</a>'
                 end
             else
                 sizestrings << sizename(sizeobj2['name'])
@@ -485,7 +489,7 @@ def walk_source_dir
                         if type == 'image'
                             index = images.index(file)
                             html_thumbnails.gsub!(/~~image_iteration~~/,
-                                                  '<a href="image-' + sizeobj['name'] + '.html?current=' + fullscreen_images[sizeobj['name']][index] +
+                                                  '<a href="image-' + size2js(sizeobj['name']) + '.html?current=' + fullscreen_images[sizeobj['name']][index] +
                                                       '" name="' + fullscreen_images[sizeobj['name']][index] + '">' +
                                                       img_element("#{dest_dir}/#{thumbnail_images[sizeobj['name']][index]}") + '</a>')
                             html_thumbnails.gsub!(/~~caption_iteration~~/,
@@ -534,8 +538,8 @@ def walk_source_dir
                     othersizes = []
                     for sizeobj2 in $images_size
                         if sizeobj != sizeobj2
-                            otherimages4js += "var images_#{sizeobj2['name']} = new Array(" + fullscreen_images[sizeobj2['name']].collect { |e| "\"#{e}\"" }.join(', ') + ")\n"
-                            othersizes << "\"#{sizeobj2['name']}\""
+                            otherimages4js += "var images_#{size2js(sizeobj2['name'])} = new Array(" + fullscreen_images[sizeobj2['name']].collect { |e| "\"#{e}\"" }.join(', ') + ")\n"
+                            othersizes << "\"#{size2js(sizeobj2['name'])}\""
                         end
                     end
                     for i in html
@@ -549,7 +553,7 @@ def walk_source_dir
                         i.gsub!(/~~current_size~~/, sizeobj['name'])
                         substitute_html_sizes(i, sizeobj, 'image')
                     end
-                    ios = File.open("#{dest_dir}/image-#{sizeobj['name']}.html", "w")
+                    ios = File.open("#{dest_dir}/image-#{size2js(sizeobj['name'])}.html", "w")
                     ios.write(html)
                     ios.close
                 end
index 85abed92982bf93f875b903b91a1bdca29bbf204..f27fc1980331f30941bee5280d220b710a76fa9f 100755 (executable)
@@ -1418,9 +1418,12 @@ def new_album
     recreate_theme_config = proc {
         theme_sizes.each { |e| sizes.remove(e[:widget]) }
         theme_sizes = []
-        select_theme(theme_button.label, nil)
+        select_theme(theme_button.label, 'all')
         $images_size.each { |s|
-            sizes.add(cb = Gtk::CheckButton.new(sizename(s['name'])).set_active(true))
+            sizes.add(cb = Gtk::CheckButton.new(sizename(s['name'])))
+            if !s['optional']
+                cb.active = true
+            end
             tooltips = Gtk::Tooltips.new
             tooltips.set_tip(cb, utf8(s['description']), nil)
             theme_sizes << { :widget => cb, :value => s['name'] }
index 7a0fc5c6d5c2fe5dd310320f345e5114ab40af8c..70430346fa2633da33b9e40f7ba4ba82a8789750 100644 (file)
@@ -29,6 +29,7 @@ $images_size = [
         'description' => _("Fullscreen 552x414, thumbnails 192x144, should fit 800x600 screens"),
         'fullscreen' => '552x414',
         'thumbnails' => '192x144',
+        'optional' => true,
     },
     {
         'name' => 'medium',
@@ -42,6 +43,20 @@ $images_size = [
         'description' => _("Fullscreen 880x660, thumbnails 300x225, should fit 1280x1024 screens"),
         'fullscreen' => '880x660',
         'thumbnails' => '300x225',
+    },
+    {
+        'name' => 'x-large',
+        'description' => _("Fullscreen 996x747, thumbnails 340x255, should fit 1450x1024 screens"),
+        'fullscreen' => '996x747',
+        'thumbnails' => '340x255',
+        'optional' => true,
+    },
+    {
+        'name' => 'xx-large',
+        'description' => _("Fullscreen 1100x825, thumbnails 375x281, should fit 1600x1200 screens"),
+        'fullscreen' => '1100x825',
+        'thumbnails' => '375x281',
+        'optional' => true,
     }
 ]
 
index dfc138becedda6b90a4bca16fe01f64659005618..6b4f5696f5c41e1a0ddc60f825d90df3c8611b9d 100644 (file)
@@ -41,7 +41,8 @@ module Booh
 
     def sizename(key)
         #- fake for gettext to find these; if themes need more sizes, english name for them should be added here
-        sizenames = { 'small' => utf8(_("small")), 'medium' => utf8(_("medium")), 'large' => utf8(_("large")) }
+        sizenames = { 'small' => utf8(_("small")), 'medium' => utf8(_("medium")), 'large' => utf8(_("large")),
+                      'x-large' => utf8(_("x-large")), 'xx-large' => utf8(_("xx-large")) }
         return sizenames[key] || key
     end
     
@@ -95,12 +96,17 @@ module Booh
         eval File.open("#{themedir}/metadata/parameters.rb").readlines.join
 
         if limit_sizes
-            sizes = limit_sizes.split(/,/)
-            $images_size = $images_size.find_all { |e| sizes.include?(e['name']) }
-            if $images_size.length == 0
-                die _("Can't carry on, no valid size selected.")
+            if limit_sizes != 'all'
+                sizes = limit_sizes.split(/,/)
+                $images_size = $images_size.find_all { |e| sizes.include?(e['name']) }
+                if $images_size.length == 0
+                    die _("Can't carry on, no valid size selected.")
+                end
             end
+        else
+            $images_size = $images_size.find_all { |e| !e['optional'] }
         end
+
         $default_size = $images_size.detect { |sizeobj| sizeobj['default'] }
         if $default_size == nil
             $default_size = $images_size[0]