aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text/e-text-model-test.c
Commit message (Collapse)AuthorAgeFilesLines
* Port to Windows, initial commit:Tor Lillqvist2005-04-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-04-29 Tor Lillqvist <tml@novell.com> Port to Windows, initial commit: * configure.in: Check for Win32, define Automake conditional OS_WIN32. Check for regexec() perhaps in separate -lregex, define REGEX_LIBS if so. Require glib-2.0 >= 2.6 (and thus also gtk+-2.0 >= 2.6) so that we can use the gstdio wrappers for full support of non-ASCII filenames on Win32. Don't use -D_REENTRANT on Win32, has ne special meaning. * gal.pc.in: Require gtk+-2.0 >= 2.6 also here for consistency. * gal-zip.in: New file, used to build zipfile format distribution of gal for Win32. * configure.in * Makefile.am: Add gal-zip(.in). * */Makefile.am * */*.c: Harmonize -I and #include conventions. (Of course, this hasn't anything to do with Windows porting as such, I just got carried away...) Use only -I$(top_srcdir). Use paths to gal headers staring with "gal", except for headers from the same directory as the .c file, which are included as such. Include all gal headers using doublequotes. Sort #includes and remove duplicates and obvious redundancies. Include config.h first without any HAVE_CONFIG_H, then system headers, then other GNOME lib headers, than gal's own headers. Just include gtk.h instead of separate gtk*.h headers. Don't include gi18n.h, include e-i18n.h to use e_gettext() consistently. * gal/Makefile.am: Use -no-undefined on Win32 so that libtool agrees to build a shared library. Because of the bidirectional dependency between libgal and libgal-a11y we can build libgal-a11y sanely as a shared library on Win32, so we don't install any separate libgal-a11y at all. So, on Win32, link the stuff that goes into libgal-a11y also into libgal. Link with REGEX_LIBS. * gal/a11y/Makefile.am: See above. Just build a dummy static libgal-a11y on Win32 (can't convince Automake not to build the library at all on one platform using Automake ifdef, apparently). Then (this is a gross hack) explicitly remove the library after installation in the install-data-local rule. * gal/e-table/Makefile.am * gal/e-table/e-table-config.c: Rename ETABLE_GLADEDIR to GAL_GLADEDIR for consistency. * gal/e-table/e-cell-date.c: No localtime_r() in Microsoft's C library, but its localtime() *is* thread-safe. * gal/e-table/e-cell-text.c * gal/e-table/e-cell-tree.c * gal/e-table/e-cell-vbox.c * gal/e-text/e-text.c * gal/widgets/e-unicode.c: Remove unnecessary inclusion of gdkx.h. * gal/e-table/e-cell-tree.c (ect_realize): Instead of the Xlib macro None (whose value is zero), use the corresponding zero-valued enums from the appropriate GDK type. * gal/e-table/e-table-config.c * gal/e-table/e-table-field-chooser.c * gal/menus/gal-define-views-dialog.c * gal/menus/gal-view-instance-save-as-dialog.c * gal/menus/gal-view-new-dialog.c * gal/widgets/e-categories-master-list-array.c * gal/widgets/e-categories-master-list-dialog.c * gal/widgets/e-categories.c: Use g_build_filename() to construct pathnames at run-time instead of compile-time. On Windows the macros GAL_GLADEDIR and GAL_IMAGESDIR expand to function calls, in order to support installing in a freely chosen location. * gal/e-table/e-table-item.c * gal/e-table/e-cell-vbox.c: Instrad of the Xlib GrabSuccess, use GDK_GRAB_SUCCESS (which has the same value). * gal/e-table/e-table-specification.c (e_table_specification_load_from_file) * gal/e-table/e-table.c (e_table_load_specification) * gal/e-table/e-tree-table-adapter.c (open_file) * gal/menus/gal-view-instance.c (load_current_view) * gal/menus/gal-view-instance.c (load_current_view): On Win32, convert filename to the locale character set before passing to xmlParseFile() which doesn't use UTF-8 filenames. Use gstdio wrappers. * gal/util/Makefile.am: Define GAL_PREFIX as $prefix. Define GAL_LOCALEDIR, GAL_GLADEDIR and GAL_IMAGESDIR also here for e-win32-reloc.c. Include e-win32-reloc.c on Win32. * gal/util/e-iconv.c (e_iconv_init): Use g_win32_getlocale() on Windows. * gal/util/e-util.c * gal/util/e-xml-utils.c: Use g_mkstemp() instead of non-portable mkstemp(). Use GLib pathname manipulation functions. Use gstdio wrappers. * gal/util/e-util-private.h: New file. Contains just Win32 bits for now that redefine the directory names from the Makefile as functions calls. * gal/util/e-win32-reloc.c: New file. Contains a minimal DllMain() and functions to support freely chosen installation location on Windows. * gal/util/e-xml-utils.c: No fsync() in the Microsoft C library. * gal/windgets/Makefile.am: Add -I$(top_srcdir)/gal for consistency with the sibling Makefile.am files. * gal/widgets/e-canvas.c: Instead of the Xlib AlreadyGrabbed, use GDK_GRAB_ALREADY_GRABBED. svn path=/trunk/; revision=29249
* merging the gal-2 branch back to the trunk.Mike Kestner2002-11-011-2/+0
| | | | | | merging the gal-2 branch back to the trunk. svn path=/trunk/; revision=18471
* Changed the license announcement at the top of these files.Christopher James Lahey2001-10-271-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-10-26 Christopher James Lahey <clahey@ximian.com> * gal/e-paned/e-hpaned.c, gal/e-paned/e-hpaned.h, gal/e-paned/e-paned.c, gal/e-paned/e-paned.h, gal/e-paned/e-vpaned.c, gal/e-paned/e-vpaned.h, gal/e-text/e-completion-match.c, gal/e-text/e-completion-match.h, gal/e-text/e-completion-test.c, gal/e-text/e-completion-view.c, gal/e-text/e-completion-view.h, gal/e-text/e-completion.c, gal/e-text/e-completion.h, gal/e-text/e-entry-test.c, gal/e-text/e-entry.c, gal/e-text/e-entry.h, gal/e-text/e-table-text-model.c, gal/e-text/e-table-text-model.h, gal/e-text/e-text-model-repos.c, gal/e-text/e-text-model-repos.h, gal/e-text/e-text-model-test.c, gal/e-text/e-text-model-uri.c, gal/e-text/e-text-model-uri.h, gal/e-text/e-text-model.c, gal/e-text/e-text-model.h, gal/e-text/e-text.c, gal/e-text/e-text.h, gal/util/e-bit-array.c, gal/util/e-bit-array.h, gal/util/e-cache.c, gal/util/e-cache.h, gal/util/e-iconv.c, gal/util/e-iconv.h, gal/util/e-sorter-array.c, gal/util/e-sorter-array.h, gal/util/e-sorter.c, gal/util/e-sorter.h, gal/util/e-text-event-processor-emacs-like.c, gal/util/e-text-event-processor-emacs-like.h, gal/util/e-text-event-processor-types.h, gal/util/e-text-event-processor.c, gal/util/e-text-event-processor.h, gal/util/e-util.c, gal/util/e-util.h, gal/util/e-xml-utils.c, gal/util/e-xml-utils.h, gal/widgets/color-group.c, gal/widgets/color-group.h, gal/widgets/color-palette.c, gal/widgets/color-palette.h, gal/widgets/e-canvas-utils.c, gal/widgets/e-canvas-utils.h, gal/widgets/e-canvas-vbox.c, gal/widgets/e-canvas-vbox.h, gal/widgets/e-canvas.c, gal/widgets/e-canvas.h, gal/widgets/e-categories-master-list-array.c, gal/widgets/e-categories-master-list-array.h, gal/widgets/e-categories-master-list-combo.c, gal/widgets/e-categories-master-list-combo.h, gal/widgets/e-categories-master-list-dialog-model.c, gal/widgets/e-categories-master-list-dialog-model.h, gal/widgets/e-categories-master-list-dialog.c, gal/widgets/e-categories-master-list-dialog.h, gal/widgets/e-categories-master-list.c, gal/widgets/e-categories-master-list.h, gal/widgets/e-categories.c, gal/widgets/e-categories.h, gal/widgets/e-colors.c, gal/widgets/e-colors.h, gal/widgets/e-cursors.c, gal/widgets/e-cursors.h, gal/widgets/e-font.c, gal/widgets/e-font.h, gal/widgets/e-gui-utils.c, gal/widgets/e-gui-utils.h, gal/widgets/e-hscrollbar.c, gal/widgets/e-hscrollbar.h, gal/widgets/e-popup-menu.c, gal/widgets/e-popup-menu.h, gal/widgets/e-printable.c, gal/widgets/e-printable.h, gal/widgets/e-reflow-model.c, gal/widgets/e-reflow-model.h, gal/widgets/e-reflow-sorted.c, gal/widgets/e-reflow-sorted.h, gal/widgets/e-reflow.c, gal/widgets/e-reflow.h, gal/widgets/e-scroll-frame.c, gal/widgets/e-scroll-frame.h, gal/widgets/e-selection-model-array.c, gal/widgets/e-selection-model-array.h, gal/widgets/e-selection-model-simple.c, gal/widgets/e-selection-model-simple.h, gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h, gal/widgets/e-unicode.c, gal/widgets/e-unicode.h, gal/widgets/e-vscrollbar.c, gal/widgets/e-vscrollbar.h, gal/widgets/gtk-combo-box.c, gal/widgets/gtk-combo-box.h, gal/widgets/gtk-combo-stack.c, gal/widgets/gtk-combo-stack.h, gal/widgets/gtk-combo-text.c, gal/widgets/gtk-combo-text.h, gal/widgets/test-color.c, gal/widgets/test-e-font.c, gal/widgets/test-e-font.h, gal/widgets/test-font-loading.c, gal/widgets/widget-color-combo.c, gal/widgets/widget-color-combo.h, gal/widgets/widget-pixmap-combo.c, gal/widgets/widget-pixmap-combo.h, src/e-table/e-table-sorted-variable.c, tests/test-define-views.c, tests/test-shortcut-bar.c, tests/test-table-1.c, tests/test-tree-1.c, tests/test-tree-2.c, tests/test-tree-3.c, tests/test-unicode.c: Changed the license announcement at the top of these files. svn path=/trunk/; revision=14158
* Added. Allows you to attach an ECompletion to an EEntry, and have thatJon Trowbridge2001-02-201-27/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-02-19 Jon Trowbridge <trow@ximian.com> * gal/e-text/e-entry.c (e_entry_enable_completion_full): Added. Allows you to attach an ECompletion to an EEntry, and have that ECompletion be used for (obviously enough) completions. * gal/e-text/e-completion-view.h, gal/e-text/e-completion-view.c: Added. ECompletionView is a widget for displaying the results of a completion request in a format that is appropriate for a drop-down window. * gal/e-text/e-completion.h, gal/e-text/e-completion.c: Added. ECompletion is a "pure virtual base class" for completion-type operations. It is implemented so that completions can be either synchronous or asynchronous. * gal/e-text/e-text.c: Lots of changes to accomodate the ETextModel changes. First of all, we render embedded text objects as being underlined. We also cause the model to emit the appropriate object activation signal when an embedded object is double-clicked. Also, all of the code that moves the cursor in response to user input has been removed. Instead, the EText now listens for "reposition" events from the underlying model, and bases all cursor motions on those. (get_bounds_item_relative): Fixed bug in the handling of differently-anchored text. Being differently-anchored is not a crime or a perversion --- it is an alternative lifestyle that we have to respect. * gal/e-text/e-text-model-uri.h, gal/e-text/e-text-model-uri.c: A sample ETextModel that converts URIs into embedded objects that get opened in the browser when you double-click them. * gal/e-text/e-text-model-repos.h, gal/e-text/e-text-model-repos.c: Added. A group of simple structures & functions for handling various cursor movement rules. These are the sorts of things that are passed as arguments to ETextModel "reposition" event handlers. * gal/e-text/e-text-model.h, gal/e-text/e-text-model.c: Privitized the ETextModel struct and "methodized" all of the operations, so that derived classes can do arbitrarily respond to get/set requests in arbitrarily strange ways. Also added the concept of declaring regions of the text as "embedded text objects". Finally, caused operations that change the text to emit a "reposition" signal that passes information that can be used by a view (like an EText) to move the cursor or selection in an intelligent way in response to those changes. This means that you can now open two ETexts that look at the same ETextModel, and have the cursor in one do the right thing when you edit the other. (As opposed to producing a lot of potential segfaults, as it was before.) svn path=/trunk/; revision=8280
* Commented out this function since it's not being used.Christopher James Lahey2001-02-091-0/+3
| | | | | | | | | 2001-02-08 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-text-model-test.c (describe_model): Commented out this function since it's not being used. svn path=/trunk/; revision=8109
* Reverted the latest change to EText since we're in feature freeze.Christopher James Lahey2001-01-301-5/+3
| | | | | | | | 2001-01-30 Christopher James Lahey <clahey@helixcode.com> * Reverted the latest change to EText since we're in feature freeze. svn path=/trunk/; revision=7912
* Connect to the model's "position" signal. (e_text_init): Set default valueJon Trowbridge2001-01-301-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-01-29 Jon Trowbridge <trow@gnu.org> * gal/e-text/e-text.c (e_text_init): Connect to the model's "position" signal. (e_text_init): Set default value for rgba_object as blue. (e_text_destroy): Disconnect model position signal. (fix_selection): Some extra sanity checking to keep the selection from spilling outside of the bounds of the text string as it expands or contracts. Should be obsolete due to the changes to objectify_uris --- but I'll leave this in here for now, in an attempt to avoid non-\0-terminated strings, segfaults, and all of that fun stuff. (e_text_text_model_position): Move our cursor according to the suggestions made by our ETextModel, via the "position" signal. (text_width_with_objects): Check that text is not NULL. (text_draw_with_objects): Accept an extra GdkGC for use in drawing objects. (e_text_set_arg): Properly handle the "position" signal when changing models. (e_text_draw): Initialize the GC for drawing objects, if necessary. (_insert): Comment out the code that adjustes text->selection_*. The cursor is now moved by the ETextModel directly via the position signal, not by the view. * gal/e-text/e-text-model-uri.c (objectify_uris): Add more sophisticated uri recognition via regular expressions. (objectify_uris): Changed to track position changes as model->text expands and contracts along with the objects. Block the objectification of any chunks of text that straddle our current position. (e_text_model_uri_set_text): Added position info to objectify_uris call. (e_text_model_uri_insert): Added position info to objectify_uris call. (e_text_model_uri_insert_length): Added position info to objectify_uris call. (e_text_model_uri_delete): Added position info to objectify_uris call. * gal/e-text/e-text-model.c (e_text_model_class_init): Added a "position" signal that allows the ETextModel to send cursor positioning information back to any view. We need this for text with objects, where the text string can grow and shrink in ways that the view doesn't expect. (e_text_model_real_insert): Added sanity checking of args and a position emission. (e_text_model_real_insert_length): Added sanity checking of args and a position emission. (e_text_model_real_delete): Added sanity checking of args. (e_text_model_suggest_position): A wrapper around the "position" signal emitter. svn path=/trunk/; revision=7894
* Added; a new test program that demonstrates objects in ETexts.Jon Trowbridge2001-01-271-0/+67
2001-01-26 Jon Trowbridge <trow@gnu.org> * gal/e-text/e-text-model-test.c: Added; a new test program that demonstrates objects in ETexts. * gal/e-text/e-text-model-uri.c: Added; a text model that converts URIs in the text into objects that are passed off to the GNOME URI handler when activated. This is actually still extremely broken; I got it just working enough to test out my EText changes. * gal/e-text/e-text.c: A whole lot of changes, designed to make ETextModel objects render properly. The basic idea of the changes is pretty simple, though. (text_width_with_objects): First of all, this function is an alternative to e_font_utf8_text_width that takes into the account the embedded \1s in the text string and properly accounts for the width of the object strings. (unicode_strlen_with_objects): Next, this function finds the proper strlen of a string, expanding the \1s. (text_draw_with_objects): Finally, this is just a replacement for e_font_draw_utf8_text that does the right thing for objects. I've gone through all of e-text.c and replace calls by those original functions with my new object-enabled alternatives. (split_into_lines): Some tweaking to get line breaking to work properly. Made \1 into a "break character", so that we can break lines between multiple adjacent objects. (Which seemed like the right thing to do, but there may be cases where that is undesireable.) (_get_position_from_xy): Fixed to properly handle embedded objects, and to get the right selection semantics for objects. (Or at least semantics that feel right to me.) Also fixed a bug that caused selection, etc. to not work properly if the text was anchored anywhere other than with GTK_ANCHOR_NORTH*. (_get_position): Hacked to cause objects to activate when they are double-clicked. There is probably a better way to do this. * gal/e-text/e-text-model.c (e_text_model_real_object_count): Provide a default implementation of an object counter. Derived classes might want to override this for efficiency reasons. (e_text_model_strdup_expanded_text): Added. Allocates and returns a string contains the model's text with the objects "expanded" within. * gal/e-text/e-text-model.h: Added obj_count, get_nth_obj, and activate_nth_obj virtual methods to ETextModelClass. svn path=/trunk/; revision=7842