Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!sun-barr!newstop!sun!argv From: argv@turnpike.Eng.Sun.COM (Dan Heller) Newsgroups: comp.windows.x Subject: Re: Motif text editor Message-ID: <140385@sun.Eng.Sun.COM> Date: 8 Aug 90 22:36:42 GMT References: <2809@auschs.ibm.com> Sender: news@sun.Eng.Sun.COM Distribution: na Organization: O'Reilly && Associates Lines: 34 In article <2809@auschs.ibm.com> sergio@reed.UUCP (Sergio Perrone/30000) writes: > Has anyone spent the time to improve the 'xmeditor' sample Motif application > with features like search and replace? I have edited the xmeditor program to: 1) generalize and abstract all redundant code into self-sufficient functions *2) integrate the WidgetWrap library to take advantage of the varargs interface for creating widgets and set/get routines. 3) add performance enchancments. 4) added comment lines to the code so the reader understands what the code trying to do. 5) removed all global variable references. The result of this was that the source (including new comment lines) is now down to about 700 lines. I added no functionality, but I didn't remove any either. However, now that the code has been abstracted and generalized without globals, it is now a "module" that can be used as a general text editor for any application. A full chapter of the Motif Programmer's Manual (O'Reilly Assoc. Volume 6) is dedicated to the Text widget(s) and will include this code and discussion. The suggestion of adding "features" such as search and replace are addressed as well. -----footnote for item #2 *I have rewritten WidgetWrap to look/act just like the new XtVa* functions in R4. Thus, when Motif 1.1 is done, this code will be portable to 1.1 without mods and without having to use WidgetWrap. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.