--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/reference/ocr-simple/status_message.cc Thu May 18 23:12:51 2006 +0200
@@ -0,0 +1,115 @@
+#include "tcl_interface.h"
+#include "status_message.h"
+
+/* these are ugly, but who cares? */
+
+/* you must reset this to 0 if you want to use these fxns */
+double last_status = 0.0;
+
+void set_string_status(char* s, int partial, int full)
+{
+ set_string_status(s, (double)partial, (double)full);
+}
+
+void set_string_status(char* s, double partial, double full)
+{
+ double fraction = (double)partial / (double)full;
+ if(fraction > 0.9 && last_status < 0.9)
+ {
+ set_status("%s: 90%%...", s);
+ last_status = 0.9;
+ }
+ else if(fraction > 0.8 && last_status < 0.8)
+ {
+ set_status("%s: 80%%...", s);
+ last_status = 0.8;
+ }
+ else if(fraction > 0.7 && last_status < 0.7)
+ {
+ set_status("%s: 70%%...", s);
+ last_status = 0.7;
+ }
+ else if(fraction > 0.6 && last_status < 0.6)
+ {
+ set_status("%s: 60%%...", s);
+ last_status = 0.6;
+ }
+ else if(fraction > 0.5 && last_status < 0.5)
+ {
+ set_status("%s: 50%%...", s);
+ last_status = 0.5;
+ }
+ else if(fraction > 0.4 && last_status < 0.4)
+ {
+ set_status("%s: 40%%...", s);
+ last_status = 0.4;
+ }
+ else if(fraction > 0.3 && last_status < 0.3)
+ {
+ set_status("%s: 30%%...", s);
+ last_status = 0.3;
+ }
+ else if(fraction > 0.2 && last_status < 0.2)
+ {
+ set_status("%s: 20%%...", s);
+ last_status = 0.2;
+ }
+ else if(fraction > 0.1 && last_status < 0.1)
+ {
+ set_status("%s: 10%%...", s);
+ last_status = 0.1;
+ }
+}
+
+void set_display_status(double partial, double full)
+{
+ set_string_status("Displaying Image", partial, full);
+}
+
+void set_display_status(int partial, int full)
+{
+ set_string_status("Displaying Image", partial, full);
+}
+
+void set_read_status(double partial, double full)
+{
+ set_string_status("Reading Image", partial, full);
+}
+
+void set_read_status(int partial, int full)
+{
+ set_string_status("Reading Image", partial, full);
+}
+
+void set_rotation_status(double partial, double full)
+{
+ set_string_status("Rotating Image", partial, full);
+}
+
+void set_rotation_status(int partial, int full)
+{
+ set_string_status("Rotating Image", partial, full);
+}
+
+void set_recognize_status(int p, int f)
+{
+ set_string_status("Recognizing Characters", p, f);
+}
+void set_extract_status(int p, int f)
+{
+ set_string_status("Extracting Words", p, f);
+}
+void set_component_status(int p, int f)
+{
+ set_string_status("Extracting Characters", p, f);
+}
+
+void set_text_display_status(int p, int f)
+{
+ set_string_status("Displaying text", p, f);
+}
+
+void set_spellcheck_status(int p, int f)
+{
+ set_string_status("Spellchecking", p, f);
+}