From: Marijn van Vliet Date: Mon, 23 Nov 2009 10:59:59 +0000 (+0000) Subject: Missing files X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=6d54ac994ad1b08f88d23be5e2b5b8e2e45908cb;p=rodin%2Fchimara.git Missing files git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@180 ddfedd41-794f-dd11-ae45-00112f111e67 --- diff --git a/configure.ac b/configure.ac index 1718592..a8c1e75 100644 --- a/configure.ac +++ b/configure.ac @@ -42,12 +42,13 @@ LT_INIT # Libtool 2.2.6 and up #LT_PREREQ([2.2.6]) # ...goddamn Debian still has 1.5 AC_PROG_LIBTOOL # Old way of declaring Libtool AM_GNU_GETTEXT([external]) # Gettext, link to system libintl -IT_PROG_INTLTOOL([0.35.0]) # Intltool +IT_PROG_INTLTOOL # Intltool PKG_PROG_PKG_CONFIG # pkg_config GTK_DOC_CHECK(1.9) # Gtk-Doc # Other utilities used in this package's various make scripts AC_PROG_AWK AC_PATH_PROG([PERL], [perl]) # Perl +AC_PATH_PROG([TEST], [test]) # Test ### TYPES ##################################################################### @@ -63,18 +64,26 @@ GETTEXT_PACKAGE=chimara AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name]) -### CHECK FOR LIBRARIES ####################################################### +### ILIAD ##################################################################### +AC_ARG_ENABLE([iliad], + [AS_HELP_STRING([--enable-iliad],[Compiles Chimara for the iLiad])], + [AS_CASE([${enableval}], + [yes], [iliad=true], + [no], [iliad=false], + [AC_MSG_ERROR([bad value ${enableval} for --enable-iliad])] + )], + [iliad=false] +) + +AM_CONDITIONAL([TARGET_ILIAD], [$TEST "x$iliad" = xtrue]) -GTK_REQUIRED_VERSION=2.8 -GLIB_REQUIRED_VERSION=2.6 -AC_SUBST(GTK_REQUIRED_VERSION) -AC_SUBST(GLIB_REQUIRED_VERSION) +### CHECK FOR LIBRARIES ####################################################### # Libraries needed to build Chimara library PKG_CHECK_MODULES([CHIMARA], [ - glib-2.0 >= $GLIB_REQUIRED_VERSION - gtk+-2.0 >= $GTK_REQUIRED_VERSION + glib-2.0 + gtk+-2.0 gthread-2.0 gmodule-2.0 pango @@ -83,7 +92,7 @@ CHIMARA_LIBS="$CHIMARA_LIBS -lm" AC_SUBST(CHIMARA_LIBS) # Libraries needed to build test programs PKG_CHECK_MODULES([TEST], [ - gtk+-2.0 >= $GTK_REQUIRED_VERSION + gtk+-2.0 gmodule-2.0 ]) @@ -115,6 +124,7 @@ docs/reference/version.xml docs/reference/build-selector-table.pl po/Makefile.in ]) + # Do it AC_OUTPUT diff --git a/tests/barf.c b/tests/barf.c new file mode 100644 index 0000000..540df34 --- /dev/null +++ b/tests/barf.c @@ -0,0 +1,75 @@ +#include + +static gboolean +quit() +{ + gtk_main_quit(); + return TRUE; +} + +static void +barf(GtkButton *button, GtkTextBuffer *buffer) +{ + GtkTextIter end; + gtk_text_buffer_get_end_iter(buffer, &end); + + gtk_text_buffer_move_mark_by_name(buffer, "pager_position", &end); + + gchar *loremipsum; + g_file_get_contents("loremipsum.txt", &loremipsum, NULL, NULL); + gtk_text_buffer_insert(buffer, &end, loremipsum, -1); + g_free(loremipsum); +} + +static void +after_insert(GtkTextBuffer *buffer, GtkTextIter *location, gchar *text, gint len, GtkTextView *textview) +{ + while(gtk_events_pending()) + gtk_main_iteration(); + + GdkRectangle pagerpos, endpos, visiblerect; + GtkTextIter pager, end; + gtk_text_buffer_get_iter_at_mark(buffer, &pager, gtk_text_buffer_get_mark(buffer, "pager_position")); + gtk_text_buffer_get_end_iter(buffer, &end); + + gtk_text_view_get_iter_location(textview, &pager, &pagerpos); + gtk_text_view_get_iter_location(textview, &end, &endpos); + gtk_text_view_get_visible_rect(textview, &visiblerect); + + g_printerr("View height = %d\n", visiblerect.height); + g_printerr("End - Pager = %d\n", endpos.y - pagerpos.y); +} + +int +main(int argc, char **argv) +{ + gtk_init(&argc, &argv); + + GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_size_request(window, 400, 400); + GtkWidget *button = gtk_button_new_with_label("Barf"); + GtkWidget *scrolledwindow = gtk_scrolled_window_new(NULL, NULL); + GtkWidget *textview = gtk_text_view_new(); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD_CHAR); + GtkWidget *vbox = gtk_vbox_new(FALSE, 6); + + gtk_container_add(GTK_CONTAINER(scrolledwindow), textview); + gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); + gtk_container_add(GTK_CONTAINER(window), vbox); + gtk_widget_show_all(window); + + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); + g_signal_connect_after(buffer, "insert-text", G_CALLBACK(after_insert), textview); + + GtkTextIter end; + gtk_text_buffer_get_end_iter(buffer, &end); + gtk_text_buffer_create_mark(buffer, "pager_position", &end, TRUE); + + g_signal_connect(window, "delete-event", G_CALLBACK(quit), NULL); + g_signal_connect(button, "clicked", G_CALLBACK(barf), buffer); + + + gtk_main(); + return 0; +} diff --git a/tests/loremipsum.txt b/tests/loremipsum.txt new file mode 100644 index 0000000..fcb04e8 --- /dev/null +++ b/tests/loremipsum.txt @@ -0,0 +1,19 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vitae dolor orci, et pellentesque risus. Donec porttitor consectetur justo. Duis orci sem, semper vitae dictum a, consectetur at lacus. Sed nec diam ac mauris ultrices ullamcorper. Nunc a est non risus eleifend venenatis id vel lacus. Vivamus tempor convallis sapien, vitae vulputate justo malesuada euismod. Vivamus ornare dignissim volutpat. Integer magna nunc, egestas sit amet venenatis quis, venenatis non tellus. Donec id sodales turpis. Ut sit amet lorem nec libero ornare convallis. Sed rhoncus aliquet iaculis. + +Fusce eu purus sem. Nunc egestas nisl at lectus rutrum ac mattis eros congue. Donec egestas hendrerit neque. Fusce porta tempor urna, eget pellentesque felis volutpat ut. Integer ac sem porta nibh suscipit faucibus. Cras semper ullamcorper tortor, molestie luctus magna luctus in. Pellentesque bibendum orci eu mi interdum dignissim. Integer cursus sodales orci, id interdum turpis volutpat vitae. Nulla a lectus a eros pharetra volutpat in nec justo. Ut porttitor tincidunt lectus, vel consectetur erat vehicula id. Sed iaculis fermentum eros et semper. Etiam dictum tristique augue ac feugiat. Quisque dignissim sollicitudin tellus, eget aliquet enim ultrices posuere. Maecenas fermentum sapien arcu. Quisque facilisis sagittis justo vitae fringilla. Proin sed dapibus dolor. Pellentesque molestie nisl quis urna ultricies ultricies. Vestibulum scelerisque feugiat mattis. Duis a malesuada est. Praesent quis urna nisi. + +Praesent a neque vel dolor condimentum volutpat vitae sit amet ante. Vestibulum quis neque ut ipsum luctus pulvinar vel id ante. Praesent volutpat, sem id congue pharetra, est justo interdum justo, placerat tempus nisl libero tempus justo. Vivamus congue scelerisque massa vitae semper. Nullam vel lacus id nunc posuere viverra. Donec nec magna massa. Pellentesque fermentum magna sed urna euismod non volutpat augue egestas. Nulla sit amet mi massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum venenatis dolor justo, vitae dignissim tellus. Integer lobortis, lorem id laoreet molestie, urna leo tempor turpis, eu commodo erat arcu a arcu. In hac habitasse platea dictumst. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +Pellentesque at nulla a dolor tempus eleifend. Donec et leo felis, quis luctus odio. Ut auctor sem ut libero tempus ultricies. Sed nec ipsum non turpis mollis fringilla. Proin vulputate faucibus convallis. Integer ac ullamcorper quam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris at purus diam. Nunc vitae turpis pretium lectus porttitor pretium. Nulla vitae sem non dolor venenatis congue. + +Sed mauris diam, venenatis eget condimentum a, ultrices a mi. Duis ac enim est. Mauris lectus justo, ullamcorper ut placerat quis, facilisis et elit. Praesent bibendum turpis vitae urna euismod vel vestibulum sem hendrerit. In diam eros, posuere non tincidunt vel, cursus non tortor. Morbi at rhoncus dui. Duis feugiat lacinia iaculis. Integer aliquet mattis nulla, lobortis hendrerit orci dictum vel. Etiam dolor nunc, pharetra quis bibendum in, fringilla eget turpis. Nulla quis purus vel felis luctus ultrices at non velit. Morbi quis dolor sit amet felis iaculis tempor vel ut urna. Praesent aliquet libero eu nunc varius faucibus. Suspendisse et augue quis sapien ullamcorper rutrum. Curabitur luctus magna vitae nisl mollis at dictum massa interdum. Sed vel fermentum ante. + +Phasellus condimentum interdum accumsan. Pellentesque orci nunc, imperdiet non blandit eu, tempus sit amet lacus. Nullam ac tempor dui. Etiam sed enim lacus. Pellentesque tortor massa, molestie et congue quis, posuere sed velit. Nullam gravida ante sem. In ac metus vel risus vehicula hendrerit. Suspendisse volutpat sapien ut dolor pharetra non egestas augue malesuada. Morbi id libero in massa consequat scelerisque iaculis nec sapien. Nam vulputate, risus non rhoncus ultrices, dolor ipsum viverra arcu, sit amet venenatis nibh felis a justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ipsum nibh, congue venenatis sodales eu, cursus et nunc. Donec pulvinar malesuada nibh non pellentesque. Donec felis tellus, auctor sed condimentum non, molestie eget purus. Nam tempor, arcu eu sollicitudin lacinia, tortor turpis accumsan mi, eu suscipit velit eros vel nibh. Etiam feugiat malesuada tincidunt. Aliquam vestibulum, diam nec ultrices accumsan, nunc neque condimentum leo, id accumsan ante nunc ac mi. Nam ac sapien turpis, ut vestibulum lacus. Pellentesque imperdiet viverra erat sed dapibus. In viverra, risus ac condimentum ornare, massa eros facilisis orci, nec elementum mauris mauris eu ante. + +Donec in tortor mi. Suspendisse non sem leo, sed pharetra dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ut metus non mauris ullamcorper commodo. Vivamus elementum mattis arcu ac iaculis. Vestibulum tempor volutpat magna, eu molestie elit fermentum a. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In placerat vulputate odio, et suscipit orci hendrerit sit amet. Quisque ac tempor est. Ut malesuada risus in eros tincidunt tempus. + +Aenean eget nulla eget augue egestas dignissim in ac elit. Donec mauris arcu, fermentum et congue ut, bibendum rhoncus quam. Aenean elementum tincidunt semper. Quisque viverra nisl eu urna sodales pharetra pretium sem tempus. Curabitur pellentesque augue a lectus feugiat auctor. Nunc mollis neque at diam pulvinar tempus. Integer sagittis felis et nunc lobortis mattis. In ultrices lacus eu nisl dictum mollis. Integer eleifend aliquet purus sed rutrum. Donec nec felis purus, sit amet tempor risus. Quisque gravida placerat nibh, aliquet consectetur tellus vehicula eu. + +Suspendisse turpis nulla, facilisis non dapibus eget, malesuada et est. Proin vel odio urna, sed fringilla leo. Pellentesque eleifend arcu in velit porta interdum. Phasellus adipiscing lacinia porta. Pellentesque ac turpis ut massa cursus aliquet. Aliquam vulputate leo non dolor porttitor ac mattis turpis rutrum. Nunc laoreet accumsan eros eu feugiat. Morbi eu congue magna. Praesent malesuada justo fringilla nibh feugiat in porta ipsum volutpat. Proin pharetra turpis non neque gravida at scelerisque tellus vestibulum. Pellentesque lectus lacus, ornare et pharetra ut, luctus at risus. Curabitur malesuada pretium metus, sed imperdiet est convallis at. Vestibulum mi sem, aliquet nec placerat eget, porta vel mi. In magna libero, consequat sed ornare sed, cursus at turpis. Curabitur sit amet sem at lectus suscipit pulvinar. In at neque libero. Aliquam iaculis eleifend nibh at accumsan. Donec tincidunt tincidunt tempor. Etiam sapien nibh, condimentum sed rhoncus sed, imperdiet faucibus ante. Vivamus a nisl a nisl volutpat consectetur. + +Morbi interdum ante vitae ante dignissim in pretium est rhoncus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed nulla metus, feugiat non feugiat nec, porta tristique velit. Vestibulum malesuada vestibulum nunc, ut posuere nunc ultrices eu. Praesent pulvinar ante nec nisi fringilla ac euismod nibh facilisis. Proin dapibus facilisis interdum. Duis odio lacus, aliquam et molestie ac, congue nec orci. Praesent at magna eu velit dapibus lobortis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut at nisl porttitor arcu ultrices accumsan eu vel mi. In quis metus ipsum, eu vehicula mauris. Sed nec purus nibh. Fusce eget massa et nisi facilisis tempor sit amet id orci. Cras interdum, nunc sit amet consectetur aliquam, nisi enim imperdiet lorem, sed suscipit erat lectus et augue. Cras commodo semper posuere. Vivamus in lectus vel urna iaculis suscipit. Fusce in ante metus, quis dictum tortor. Nullam in varius odio. diff --git a/tests/styletest.c b/tests/styletest.c new file mode 100644 index 0000000..3cfd15e --- /dev/null +++ b/tests/styletest.c @@ -0,0 +1,114 @@ +#include +#include +#include +#include +#include + +void print_help(); +void do_style_test(); +void do_link_test(); + +winid_t mainwin; + +void glk_main(void) +{ + event_t ev; + mainwin = glk_window_open(0, 0, 0, wintype_TextBuffer, 0); + if(!mainwin) + return; + + glk_set_window(mainwin); + + char *buffer = calloc(256, sizeof(char)); + assert(buffer); + + glk_put_string("Welcome to the style test\n"); + + glk_request_line_event(mainwin, buffer, 255, 0); + while(strncmp(buffer, "quit", 4)) + { + glk_select(&ev); + if(ev.type == evtype_LineInput) + { + if( !strncmp(buffer, "help", 4) ) { + print_help(); + } + else if( !strncmp(buffer, "style", 4) ) { + do_style_test(); + } + else if( !strncmp(buffer, "link", 4) ) { + do_link_test(); + } + else { + glk_put_string("Huh?\n"); + } + glk_request_line_event(mainwin, buffer, 255, 0); + } + else if(ev.type == evtype_Hyperlink) + { + glk_cancel_line_event(mainwin, NULL); + if(ev.val1 == 1) + glk_put_string("Link 1 was clicked\n"); + if(ev.val1 == 2) + glk_put_string("Link 2 was clicked\n"); + glk_request_line_event(mainwin, buffer, 255, 0); + } + } + + glk_cancel_line_event(mainwin, NULL); + glk_window_clear(mainwin); + free(buffer); +} + +void +do_style_test() { + glk_set_style(style_Normal); + glk_put_string("Normal\n"); + + glk_set_style(style_Emphasized); + glk_put_string("Emphasized\n"); + + glk_set_style(style_Preformatted); + glk_put_string("Preformatted\n"); + + glk_set_style(style_Header); + glk_put_string("Header\n"); + + glk_set_style(style_Subheader); + glk_put_string("Subheader\n"); + + glk_set_style(style_Alert); + glk_put_string("Alert\n"); + + glk_set_style(style_Note); + glk_put_string("Note\n"); + + glk_set_style(style_BlockQuote); + glk_put_string("BlockQuote\n"); + + glk_set_style(style_Input); + glk_put_string("Input\n"); + + glk_set_style(style_User1); + glk_put_string("User1\n"); + + glk_set_style(style_User2); + glk_put_string("User2\n"); + + glk_set_style(style_Normal); +} + +void +do_link_test() { + glk_set_hyperlink(1); + glk_put_string("This is link 1\n"); + glk_set_hyperlink(2); + glk_put_string("This is link 2\n"); + glk_set_hyperlink(0); + glk_request_hyperlink_event(mainwin); +} + +void +print_help() { + glk_put_string("The following commands are supported:\n - help (this help text)\n - style (perform style test)\n - link (perform hyperlink test)\n - quit (quit the program)\n"); +}