Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/test


Modified Files:
        etox_test.c panel.h selections.c tests.c 


Log Message:
More work on line wrapping, inserts a red "+" at the beginning of wrapped
lines for the time being. Text wrapping is now enabled by default. Also modified
the test programs to handle window resizing. I have seen one odd wrapping
case, I'll commit another fix once I figure out how to reproduce it.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/test/etox_test.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- etox_test.c 29 Jul 2003 05:06:47 -0000      1.27
+++ etox_test.c 1 Aug 2003 21:12:13 -0000       1.28
@@ -1,13 +1,14 @@
 #include "Etox_test.h"
 
 /* globals */
-Evas_Object *clip_msg;
 Evas_Object *clip_test;
 Evas_Object *o_next_box;
 Evas_Object *o_txt_next_box;
 Evas_Object *o_prev_box;
 Evas_Object *o_txt_prev_box;
 Evas_List *pbuttons;
+Evas_Object *o_bg;
+Evas_Object *o_bg_etox;
 
 Ecore_Evas *ee;
 Evas *evas;
@@ -30,6 +31,41 @@
            (((double) timev.tv_usec) / 1000000);
 }
 
+void window_resize(Ecore_Evas *ee)
+{
+       double pw;
+       int ex, ey, ew, eh;
+
+       evas_output_size_get(evas, &win_w, &win_h);
+       evas_object_resize(o_bg, win_w, win_h);
+       evas_object_image_fill_set(o_bg, 0, 0, win_w, win_h);
+
+       evas_object_geometry_get(o_panel, NULL, NULL, &pw, NULL);
+       evas_object_resize(o_panel, pw, win_h);
+       evas_object_image_fill_set(o_panel, 0, 0, pw, win_h);
+
+       ey = win_h / 2;
+       ew = win_w - pw - 20;
+       eh = ey - 10;
+       ex = pw + 10;
+       ey += 10;
+
+       etox_move(e_msg, ex, 10);
+       etox_resize(e_msg, ew, eh);
+
+       evas_object_move(o_bg_etox, ex, ey);
+       evas_object_resize(o_bg_etox, ew, eh);
+
+       evas_object_move(clip_test, ex, ey);
+       evas_object_resize(clip_test, ew, eh);
+
+       etox_move(e_test, ex, ey);
+       etox_resize(e_test, ew, eh);
+
+       return;
+       ee = NULL;
+}
+
 int e_mouse_move(void *data, int type, void * ev)
 {
        Ecore_X_Event_Mouse_Move *e;
@@ -213,25 +249,24 @@
 
 void setup(void)
 {
+       double pw;
+       int ex, ey, ew, eh;
        double width, height;
-       Evas_Object *o_bg;
-       Evas_Object *o_bg_etox;
        char msg[] =
-           "The Etox Test utility consists in a series\n"
-           "of test suites designed to exercise all of\n"
+           "The Etox Test utility consists in a series "
+           "of test suites designed to exercise all of "
            "the etox functions.\n"
-           "Informational messages will be displayed here,\n"
-           "the test text will be presented in the colored\n"
+           "Informational messages will be displayed here, "
+           "the test text will be presented in the colored "
            "rectangle below.\n"
-           "To start a test suite, select it from the\n"
+           "To start a test suite, select it from the "
            "navigation panel on the left.\n";
 
        /* Create interface */
 
        /* Background */
        o_bg = evas_object_image_add(evas);
-       evas_object_image_file_set(o_bg, IM "bg.png",
-                       IM "bg.png");
+       evas_object_image_file_set(o_bg, IM "bg.png", IM "bg.png");
        evas_object_resize(o_bg, win_w, win_h);
        evas_object_image_fill_set(o_bg, 0, 0, win_w, win_h);
        evas_object_move(o_bg, 0, 0);
@@ -241,21 +276,21 @@
        /* Panel */
        setup_panel(evas);
 
-       /* Setup message etox */
-       /* Clip rectangle for bounding where the message text is drawn */
-       clip_msg = evas_object_rectangle_add(evas);
-       evas_object_show(clip_msg);
-       evas_object_move(clip_msg, 120, 10);
-       evas_object_resize(clip_msg, 520, 160);
+       evas_object_geometry_get(o_panel, NULL, NULL, &pw, NULL);
+
+       ey = win_h / 2;
+       ew = win_w - pw - 20;
+       eh = ey - 10;
+       ex = pw + 10;
+       ey += 10;
 
        /* Create message etox */
-       e_msg = etox_new_all(evas, 120, 20, 520, 140, 255, ETOX_ALIGN_LEFT);
+       e_msg = etox_new_all(evas, ex, 10, ew, eh , 255, ETOX_ALIGN_LEFT);
        etox_context_set_align(e_msg, ETOX_ALIGN_LEFT);
        etox_context_set_font(e_msg, "sinon", 14);
        etox_context_set_style(e_msg, "shadow");
        etox_context_set_color(e_msg, 225, 225, 225, 255);
        etox_set_text(e_msg, msg);
-       etox_set_clip(e_msg, clip_msg);
        etox_set_alpha(e_msg, 255);
        etox_set_layer(e_msg, 1000);
        etox_show(e_msg);
@@ -263,23 +298,20 @@
        /* Setup test etox */
        /* Setup test etox background */
        o_bg_etox = evas_object_rectangle_add(evas);
-       evas_object_move(o_bg_etox, 40, 200);
-       evas_object_resize(o_bg_etox, 520, 260);
+       evas_object_move(o_bg_etox, ex, ey);
+       evas_object_resize(o_bg_etox, ew, eh);
        evas_object_color_set(o_bg_etox, 0, 100, 100, 100);
        evas_object_layer_set(o_bg_etox, 100);
        evas_object_show(o_bg_etox);
 
        /* Clip rectangle for bounding where the test text is drawn */
        clip_test = evas_object_rectangle_add(evas);
-       evas_object_color_set(clip_test, 255, 0, 255, 255);
-       evas_object_move(clip_test, 40, 200);
-       evas_object_resize(clip_test, 520, 260);
+       evas_object_move(clip_test, ex, ey);
+       evas_object_resize(clip_test, ew, eh);
        evas_object_show(clip_test);
 
        /* Create test etox */
-       e_test =
-           etox_new_all(evas, 50, 200, 520, 260, 255, ETOX_ALIGN_CENTER);
-       etox_context_set_align(e_test, ETOX_ALIGN_CENTER);
+       e_test = etox_new_all(evas, ex, ey, ew, eh, 255, ETOX_ALIGN_CENTER);
        etox_context_set_font(e_test, "sinon", 14);
        etox_context_set_style(e_test, "plain");
        etox_context_set_color(e_test, 225, 225, 225, 255);
@@ -353,6 +385,8 @@
 
 int main(int argc, const char **argv)
 {
+       Ecore_X_Window win;
+
        ecore_init();
        ecore_app_args_set(argc, argv);
 
@@ -362,7 +396,7 @@
        ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, win_w, win_h);
        if (!ee)
                return 1;
-
+       win = ecore_evas_software_x11_window_get(ee);
        ecore_evas_title_set(ee, "Etox Selection Test");
        ecore_evas_show(ee);
 
@@ -378,6 +412,8 @@
 
        /* program does its data setup here */
        setup();
+
+       ecore_evas_callback_resize_set(ee, window_resize);
 
        /* and now loop forever handling events */
        ecore_main_loop_begin();
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/test/panel.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- panel.h     22 Jul 2003 15:01:27 -0000      1.6
+++ panel.h     1 Aug 2003 21:12:13 -0000       1.7
@@ -1,6 +1,8 @@
 #ifndef __PANEL_H__
 #define __PANEL_H__
 
+extern Evas_Object *o_panel;
+
 int e_slide_panel_in(void *data);
 int e_slide_panel_out(void *data);
 void show_panel(void *_data, Evas *_e, Evas_Object *_o, void *event_info);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/test/selections.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- selections.c        28 Jul 2003 22:04:31 -0000      1.5
+++ selections.c        1 Aug 2003 21:12:13 -0000       1.6
@@ -6,19 +6,32 @@
 
 #define IM PACKAGE_DATA_DIR"/images/"
 
+int win_w = 500, win_h = 200;
 Ecore_Evas *ee;
 Evas *evas;
 Evas_Object *bg;
 Etox *etox;
 char msg[] =
-           "The Etox Test utility consists in a series\n"
-           "of test suites designed to exercise all of\n"
+           "The Etox Test utility consists in a series "
+           "of test suites designed to exercise all of "
            "the etox functions.\n"
-           "Informational messages will be displayed here,\n"
-           "the test text will be presented in the colored\n"
+           "Informational messages will be displayed here, "
+           "the test text will be presented in the colored "
            "rectangle below.\n"
-           "To start a test suite, select it from the\n"
-           "navigation panel on the left.\n";
+           "To start a test suite, select it from the "
+           "navigation panel on the left.";
+
+void
+window_resize(Ecore_Evas *ee)
+{
+       evas_output_size_get(evas, &win_w, &win_h);
+       evas_object_resize(bg, win_w, win_h);
+       evas_object_image_fill_set(bg, 0, 0, win_w, win_h);
+       etox_resize(etox, win_w, win_h);
+
+       return;
+       ee = NULL;
+}
 
 int main(int argc, const char **argv)
 {
@@ -31,7 +44,7 @@
        if (!ecore_evas_init())
                return -1;
 
-       ee= ecore_evas_software_x11_new(NULL, 0, 0, 0, 500, 200);
+       ee= ecore_evas_software_x11_new(NULL, 0, 0, 0, win_w, win_h);
        if (!ee)
                return 1;
 
@@ -46,13 +59,13 @@
 
        evas_object_image_file_set(bg, IM "bg.png", NULL);
        evas_object_move(bg, 0, 0);
-       evas_object_resize(bg, 500, 200);
-       evas_object_image_fill_set(bg, 0, 0, 500, 200);
+       evas_object_resize(bg, win_w, win_h);
+       evas_object_image_fill_set(bg, 0, 0, win_w, win_h);
        evas_object_show(bg);
 
        /* Create message etox */
-       etox = etox_new_all(evas, 10, 10, 480, 180, 255, ETOX_ALIGN_LEFT |
-                       ETOX_ALIGN_BOTTOM);
+       etox = etox_new_all(evas, 0, 0, win_w, win_h, 255,
+                       ETOX_ALIGN_LEFT | ETOX_ALIGN_BOTTOM);
        etox_context_set_font(etox, "sinon", 14);
        etox_context_set_color(etox, 0, 255, 0, 255);
        etox_context_set_style(etox, "shadow");
@@ -101,6 +114,8 @@
        }
 
        etox_append_text(etox, "Well slap my ass and call me Sally!");
+
+       ecore_evas_callback_resize_set(ee, window_resize);
 
        ecore_main_loop_begin();
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/test/tests.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- tests.c     31 Jul 2003 21:39:30 -0000      1.11
+++ tests.c     1 Aug 2003 21:12:13 -0000       1.12
@@ -17,13 +17,14 @@
 void test_basic_init()
 {
        char msg[] =
-           "This series of tests will exercise the most basic\n"
-           "functions of etox, reading and displaying text with\n"
+           "This series of tests will exercise the most basic "
+           "functions of etox, reading and displaying text with "
            "basic formatting.\n"
            "\n"
-           "In addition, prepending, appending and inserting text\n"
+           "In addition, prepending, appending and inserting text "
            "in an existing etox will be tested.\n"
-           "\n" "Click Next to begin the tests.";
+           "\n"
+           "Click Next to begin the tests.";
 
        etox_set_text(e_msg, msg);
 
@@ -35,9 +36,10 @@
 void test_basic_get()
 {
        char msg[] =
-           "The sample text shown below was retrieved from\n"
+           "The sample text shown below was retrieved from "
            "the text in this message etox.\n"
-           "\n" "The function used was etox_get_text.";
+           "\n"
+           "The function used was etox_get_text.";
 
        char *string;
 
@@ -56,9 +58,10 @@
 {
        char msg[] =
            "The text in an etox can be changed on the fly.\n"
-           "The sample paragraph shown below replaced the\n"
+           "The sample paragraph shown below replaced the "
            "text shown in the previous test.\n"
-           "\n" "The function used was etox_set_text.";
+           "\n"
+           "The function used was etox_set_text.";
 
        char string[] =
            "\n"
@@ -77,15 +80,17 @@
 void test_basic_append()
 {
        char msg[] =
-           "Text can be appended to the text already existent\n"
+           "Text can be appended to the text already existent "
            "in the etox.\n"
            "\n"
-           "The second paragraph shown below was appended\n"
-           "at the end of the etox through etox_append_text.\n";
+           "The second paragraph shown below was appended "
+           "at the end of the etox through etox_append_text.";
 
        char string[] =
            "The Tao that is seen\n"
-           "Is not the true Tao\n" "Until you bring fresh toner.\n" "\n";
+           "Is not the true Tao\n"
+           "Until you bring fresh toner.\n"
+           "\n";
 
        /* Change message */
        etox_set_text(e_msg, msg);
@@ -99,15 +104,17 @@
 void test_basic_prepend()
 {
        char msg[] =
-           "Text can be appended to the text already existent\n"
+           "Text can be prepended to the text already existent "
            "in the etox.\n"
            "\n"
-           "The second paragraph shown below was appended\n"
-           "at the end of the etox through etox_append_text.\n";
+           "The second paragraph shown below was prepended "
+           "at the beginning of the etox through etox_prepend_text.";
 
        char string[] =
            "The Tao that is seen\n"
-           "Is not the true Tao\n" "Until you bring fresh toner.\n" "\n";
+           "Is not the true Tao\n"
+           "Until you bring fresh toner.\n"
+           "\n";
 
        /* Change message */
        etox_set_text(e_msg, msg);
@@ -121,15 +128,17 @@
 void test_basic_insert()
 {
        char msg[] =
-           "Text can be appended to the text already existent\n"
+           "Text can be inserted to the text already existent "
            "in the etox.\n"
            "\n"
-           "The second paragraph shown below was appended\n"
-           "at the end of the etox through etox_append_text.\n";
+           "The second paragraph shown below was inserted "
+           "into the etox through etox_insert_text.";
 
        char string[] =
            "The Tao that is seen\n"
-           "Is not the true Tao\n" "Until you bring fresh toner.\n" "\n";
+           "Is not the true Tao\n"
+           "Until you bring fresh toner.\n"
+           "\n";
 
        /* Change message */
        etox_set_text(e_msg, msg);
@@ -156,16 +165,18 @@
 void test_style_init()
 {
        char msg[] =
-           "The text can be applied to the etox with a\n"
+           "The text can be applied to the etox with a "
            "stylized effect.\n"
            "\n"
-           "Click the Next button to cycle through the available\n"
+           "Click the Next button to cycle through the available "
            "text styles.\n"
-           "\n" "A style-less sample paragraph is shown below.\n";
+           "\n"
+           "A style-less sample paragraph is shown below.";
 
        char string[] =
            "Chaos reigns within.\n"
-           "Stop, reflect, and reboot.\n" "Order shall return.\n";
+           "Stop, reflect, and reboot.\n"
+           "Order shall return.\n";
 
 
        etox_set_text(e_msg, msg);




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to