have "enhance contrast" options configurable in preferences
authorgc <gc>
Sun, 17 Apr 2005 15:36:56 +0000 (15:36 +0000)
committergc <gc>
Sun, 17 Apr 2005 15:36:56 +0000 (15:36 +0000)
bin/booh
bin/booh-gui
lib/booh/booh-lib.rb

index 8daa8bb90849b8617a6d8f1d562c8e98d8517e0c..895c6e2065ec726365f7079e50ccf30f69f67b34 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -163,6 +163,13 @@ def handle_options
 
 end
 
+def read_config
+    $config = {}
+end
+
+def write_config
+end
+
 def check_installation
     if $no_check
         return
@@ -689,6 +696,7 @@ def walk_source_dir
 end
 
 handle_options
+read_config
 check_installation
 
 build_html_skeletons
index 6bcef47d31bdf12f5a3dc6606d82c8df94abd64a..50d463b699d948aa42c752fd06543623ac30fc77 100755 (executable)
@@ -1351,7 +1351,8 @@ def preferences
                              [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
                              [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
 
-    dialog.vbox.add(tbl = Gtk::Table.new(0, 0, false))
+    dialog.vbox.add(notebook = Gtk::Notebook.new)
+    notebook.append_page(tbl = Gtk::Table.new(0, 0, false), Gtk::Label.new(utf8(_("Options"))))
     tbl.attach(smp_check = Gtk::CheckButton.new(utf8(_("Use symmetric multi-processing"))),
                0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 2, 2)
     tbl.attach(smp_hbox = Gtk::HBox.new.add(smp_spin = Gtk::SpinButton.new(2, 16, 1)).add(Gtk::Label.new(utf8(_("processors")))).set_sensitive(false),
@@ -1368,6 +1369,12 @@ def preferences
         smp_spin.value = $config['mproc'].to_i
     end
 
+    notebook.append_page(tbl = Gtk::Table.new(0, 0, false), Gtk::Label.new(utf8(_("Advanced"))))
+    tbl.attach(Gtk::Label.new.set_markup(utf8(_("Options to pass to <i>convert</i> when\nperforming 'enhance contrast': "))),
+               0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 2, 2)
+    tbl.attach(enhance_entry = Gtk::Entry.new.set_text($config['convert-enhance'] || $convert_enhance).set_size_request(250, -1),
+               1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2)
+
     dialog.vbox.show_all
     dialog.run { |response|
         if response == Gtk::Dialog::RESPONSE_OK
@@ -1376,6 +1383,8 @@ def preferences
             else
                 $config.delete('mproc')
             end
+
+            $config['convert-enhance'] = enhance_entry.text
         end
     }
     dialog.destroy
index c6893b87599b8a42876dd319d4aedb3f74930d7e..72a4c2e069e219c92049086d1eac8cd4b936c231 100644 (file)
@@ -33,6 +33,7 @@ module Booh
     $verbose_level = 2
     $CURRENT_CHARSET = `locale charmap`.chomp
     $convert = 'convert -interlace line +profile "*"'
+    $convert_enhance = '-contrast -enhance -normalize'
 
     def utf8(string)
         return Iconv::iconv("UTF-8", $CURRENT_CHARSET, string).to_s
@@ -204,7 +205,7 @@ module Booh
                 end
                 convert_options += "-rotate #{rotate} "
                 if felem.attributes["#{attributes_prefix}enhance"]
-                    convert_options += "-contrast -enhance -normalize "
+                    convert_options += ($config['convert-enhance'] || $convert_enhance) + " "
                 end
             end
             for dest in dests
@@ -232,7 +233,7 @@ module Booh
                     convert_options += "-rotate #{rotate} "
                 end
                 if felem.attributes["#{attributes_prefix}enhance"]
-                    convert_options += "-contrast -enhance -normalize "
+                    convert_options += ($config['convert-enhance'] || $convert_enhance) + " "
                 end
             end
             for dest in dests