antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright ./configure lib/button.c lib/library....


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright ./configure lib/button.c lib/library....
Date: Sun, 22 Aug 2004 21:20:24 -0400

CVSROOT:        /cvsroot/antiright
Module name:    antiright
Branch:         
Changes by:     Jeffrey Bedard <address@hidden> 04/08/23 01:15:56

Modified files:
        .              : configure 
        lib            : button.c library.h menubar.c window.c 
        src            : ACE 
        src/arcd       : arcd.c 
        src/arshell    : arguments.c arshell.c arshell.h dialog.c 
                         menubar.c search.c textedit.c textedit.h 
                         update.c update.h 

Log message:
        Added an IGNORE CASE option to the search and replace dialog.  Changed 
the updating code to use a linked list to store updaters, allowing an 
indefinite amount of such.  Fixed a scope issue with the pixmap transparency 
code.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/configure.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/lib/button.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/lib/library.h.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/lib/menubar.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/lib/window.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/ACE.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arcd/arcd.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/arguments.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/arshell.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/arshell.h.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/dialog.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/menubar.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/search.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/textedit.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/textedit.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/update.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/arshell/update.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: antiright/configure
diff -u antiright/configure:1.38 antiright/configure:1.39
--- antiright/configure:1.38    Thu Aug 19 00:31:31 2004
+++ antiright/configure Mon Aug 23 01:15:56 2004
@@ -28,32 +28,39 @@
 DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"
 
 ICONDIR=/usr/X11R6/include/X11/bitmaps/antiright
-DEFS="$DEFS -DICONDIR=\'\"$ICONDIR\"\'"
+DEFS="$DEFS -DICONDIR='\"$ICONDIR\"'"
 
 cp Makefile.in Makefile
 
 if [ "$PREFIX"="" ]; then
    PREFIX=/usr/local
-   DEFS="$DEFS -DPREFIX=\'\"$PREFIX\"\'"
+   DEFS="$DEFS -DPREFIX='\"$PREFIX\"'"
 fi
 
-# Set up resource file installation directory.  
-if [ -d /usr/lib/X11/app-defaults ]; then
-    RESDIR=/usr/lib/X11/app-defaults
-elif [ -d /etc/X11/app-defaults ]; then
-    RESDIR=/etc/X11/app-defaults
-elif [ -d /usr/local/lib/X11/app-defaults ]; then
-    RESDIR=/usr/local/lib/X11/app-defaults
-else
-    RESDIR=/usr/lib/X11/app-defaults
-fi
+# Set up resource file installation directory.
+testdirs="/usr/lib/X11/app-defaults /etc/X11/app-defaults\
+ /usr/local/lib/X11/app-defaults"
+for dir in $testdirs
+do
+  if [ -d $dir ]; then
+      RESDIR="$dir"
+      break
+  fi
+done
+
+INCLUDE="$INCLUDE -I/usr/local/include -I/usr/X11R6/include"
+LIBDIR="$LIBDIR -L/usr/local/lib -L/usr/X11R6/lib"
 
 if [ -f /usr/include/linux/cdrom.h ]; then
    DEFS="$DEFS -DHAVE_LINUX_CDROM_H"
 fi
 
-INCLUDE="$INCLUDE -I/usr/local/include -I/usr/X11R6/include"
-LIBDIR="$LIBDIR -L/usr/local/lib -L/usr/X11R6/lib"
+# Use libcdaudio, if available.  
+if [ "$(which libcdaudio-config)" != "" ]; then
+    LIBS="$LIBS $(libcdaudio-config --libs)"
+    INCLUDE="$INCLUDE $(libcdaudio-config --cflags)"
+    DEFS="$DEFS -DHAVE_LIBCDAUDIO"
+fi
 
 if [ ! -f /usr/X11R6/include/Xm/XpmP.h ]; then
     LIBS="$LIBS -lXpm"
@@ -68,23 +75,23 @@
 fi
 
 LIBS="$LIBS -lXm -lXt -lX11"
-
 DEFS="$DEFS -D_GNU_SOURCE"
 
-# Append assignments to line 36 of the Makefile. 
-sed "25a\\
-    PREFIX=$PREFIX\\
-    CC=$(which cc)\\
-    MAKE=$(which make)\\
-    INCLUDE=$INCLUDE\\
-    LIBDIR=$LIBDIR\\
-    LIBS=$LIBS\\
-    ICONDIR=$ICONDIR\\
-    CPPFLAGS=$CPPFLAGS\\
-    CFLAGS=$CFLAGS\\
-    DEFS=$DEFS\\
-    RESDIR=$RESDIR\\
-    VERSION=$VERSION\\
-    INSTALL=$(which install)" Makefile > sed.tmp.$$
-# Commit change to the Makefile.  
-mv sed.tmp.$$ Makefile
+ed <<EOF Makefile 1> /dev/null 2> /dev/null 
+25a
+PREFIX=$PREFIX
+CC=$(which cc)
+MAKE=$(which make)
+INCLUDE=$INCLUDE
+LIBDIR=$LIBDIR
+LIBS=$LIBS
+ICONDIR=$ICONDIR
+CPPFLAGS=$CPPFLAGS
+CFLAGS=$CFLAGS
+DEFS=$DEFS
+RESDIR=$RESDIR
+VERSION=$VERSION
+INSTALL=$(which install)
+.
+wq
+EOF
Index: antiright/lib/button.c
diff -u antiright/lib/button.c:1.6 antiright/lib/button.c:1.7
--- antiright/lib/button.c:1.6  Thu Aug 19 00:31:31 2004
+++ antiright/lib/button.c      Mon Aug 23 01:15:56 2004
@@ -40,7 +40,7 @@
   button_widget=XmCreatePushButton(parent_widget, name, ARARGS);
   XtManageChild(button_widget);
   XtAddCallback(button_widget, XmNactivateCallback, callback, client_data);
-  if(client_data != NULL & antiright.arm_status)
+  if((client_data != NULL) & antiright.arm_status)
       XtAddCallback(button_widget, XmNarmCallback, antiright_status_callback,
                    client_data);
   return(button_widget);
@@ -57,10 +57,10 @@
   char* label_string;
 #if XmVERSION > 1 & XmREVISION > 1
   antiright_set(XmNalignment, XmALIGNMENT_CENTER);
-  icon=(Widget)XmCreateIconButton(parent_widget, "icon",
-                                 antiright.arguments, antiright.arguments_int);
-  antiright_label_set_bitmap_from_file(icon, iconfilename);
+  icon=XmCreateIconButton(parent_widget, "icon",
+                         antiright.arguments, antiright.arguments_int);
   XtManageChild(icon);
+  antiright_set_bitmap_from_file(icon, iconfilename);
   XtAddCallback(icon, XmNactivateCallback, callback, client_data);
   label_string=antiright_beautified_label(name);
   antiright_label_string(icon, label_string);
@@ -71,7 +71,7 @@
   form=antiright_form(icon);
   antiright_form_positions(0, ANTIRIGHT_NONE, 0, 100);
   button=antiright_button(form, name, callback, client_data);
-  antiright_label_set_bitmap_from_file(button, iconfilename);
+  antiright_set_bitmap_from_file(button, iconfilename);
   antiright_form_positions(ANTIRIGHT_NONE, 100, 0, 100);
   antiright_form_widgets(button, NULL, NULL, NULL);
   label=antiright_label(form, name);
Index: antiright/lib/library.h
diff -u antiright/lib/library.h:1.8 antiright/lib/library.h:1.9
--- antiright/lib/library.h:1.8 Thu Aug 19 00:31:31 2004
+++ antiright/lib/library.h     Mon Aug 23 01:15:56 2004
@@ -158,12 +158,12 @@
    unattached widget.  */
 enum{ANTIRIGHT_NONE=-1};
 /* This is a debug marking function.  */
-#define ARBUG                                  \
-  {                                            \
-    printf("%s: %d\n", __FILE__, __LINE__);    \
-    fflush(stdout);                            \
-  }                                            \
- 
+#define ARBUG                                          \
+  {                                                    \
+    fprintf(stderr, "%s: %d\n", __FILE__, __LINE__);   \
+    fflush(stdout);                                    \
+  }
+
 Widget
 antiright_widget(Widget parent, WidgetClass widget_class);
 
Index: antiright/lib/menubar.c
diff -u antiright/lib/menubar.c:1.8 antiright/lib/menubar.c:1.9
--- antiright/lib/menubar.c:1.8 Thu Aug 19 00:31:32 2004
+++ antiright/lib/menubar.c     Mon Aug 23 01:15:56 2004
@@ -183,6 +183,7 @@
   antiright_set(XmNmnemonic, 's');
   antiright_manual_button(submenu_widget, "system.antiright");
   ARCLARG;
+  return(submenu_widget);
 }
 
 Widget
Index: antiright/lib/window.c
diff -u antiright/lib/window.c:1.4 antiright/lib/window.c:1.5
--- antiright/lib/window.c:1.4  Mon Aug 16 17:27:05 2004
+++ antiright/lib/window.c      Mon Aug 23 01:15:56 2004
@@ -75,16 +75,22 @@
 {
   Pixel background;
   XpmAttributes attributes;
-  XpmColorSymbol symbol;
+  XpmColorSymbol *symbol=xmalloc(sizeof(XpmColorSymbol));
+
   XtVaGetValues(widget, XmNbackground, &background, NULL);
-  symbol.name=NULL;
-  symbol.value="none";
-  symbol.pixel=background;
-  attributes.colorsymbols=&symbol;
+  symbol->name=NULL;
+  symbol->value="none";
+  symbol->pixel=background;
+  attributes.colorsymbols=symbol;
   attributes.numsymbols=1;
   attributes.valuemask=XpmColorSymbols;
   return(attributes);
 }
+void
+antiright_free_pixmap_attributes(XpmAttributes *attributes)
+{
+  free(attributes->colorsymbols);
+}
 
 void
 antiright_set_widget_pixmaps(Widget label, Pixmap bitmap)
@@ -106,6 +112,7 @@
   attributes=antiright_setup_pixmap_attributes_for_widget(widget);
   XpmCreatePixmapFromData(antiright.display, antiright.root_window, 
                          data, &bitmap, NULL, &attributes);
+  antiright_free_pixmap_attributes(&attributes);
   antiright_set_widget_pixmaps(widget, bitmap);
 }
 
@@ -121,6 +128,7 @@
       attributes=antiright_setup_pixmap_attributes_for_widget(label);
       XpmReadFileToPixmap(antiright.display, antiright.root_window,
                          filename, &bitmap, NULL, &attributes);
+      antiright_free_pixmap_attributes(&attributes);
     }
   else /* File is a bitmap.  */
     {
Index: antiright/src/ACE
diff -u antiright/src/ACE:1.17 antiright/src/ACE:1.18
--- antiright/src/ACE:1.17      Mon Aug 16 18:18:21 2004
+++ antiright/src/ACE   Mon Aug 23 01:15:56 2004
@@ -123,7 +123,8 @@
 }
 Kill_Desktop()
 {
-    kill $(ps xa | grep DESKTOP | awk '{print $1}' | tr '\n' ' ') &> /dev/null 
2> /dev/null
+    kill $(ps xa | grep DESKTOP | awk '{print $1}' | tr '\n' ' ')\
+       &> /dev/null 2> /dev/null
 }
 Desktop_Lite()
 {
Index: antiright/src/arcd/arcd.c
diff -u antiright/src/arcd/arcd.c:1.2 antiright/src/arcd/arcd.c:1.3
--- antiright/src/arcd/arcd.c:1.2       Wed Jul 14 23:42:30 2004
+++ antiright/src/arcd/arcd.c   Mon Aug 23 01:15:56 2004
@@ -29,6 +29,10 @@
 #include <linux/cdrom.h>
 #endif
 
+#ifdef HAVE_LIBCDAUDIO
+#include <cdaudio.h>
+#endif /* HAVE_LIBCDAUDIO  */
+
 /* CD-ROM file descriptor id.  */
 int arcd_file_descriptor;
 /* Track list structure.  */
@@ -62,9 +66,13 @@
 void
 arcd_play()
 {
+#ifdef HAVE_LIBCDAUDIO
+#else
+  cd_play(arcd_file_descriptor, 1);
 #ifdef HAVE_LINUX_CDROM_H
   ioctl(arcd_file_descriptor, CDROMPLAYTRKIND, &arcd_tracks);
 #endif /* HAVE_LINUX_CDROM_H  */
+#endif /* HAVE_LIBCDAUDIO  */
 }
 void
 arcd_initialized_command(int command)
@@ -82,10 +90,16 @@
 arcd_start_play_at_track(int* counter_int,
                         char** argv)
 {
+#ifndef HAVE_LIBCDAUDIO
+#ifdef HAVE_LINUX_CDROM_H
   Boolean track_not_before_first_track, track_not_after_last_track;
-
+#endif /* HAVE_LINUX_CDROM_H  */
+#endif /* not HAVE_LIBCDAUDIO  */
   (*counter_int)++;
   initialize_cdrom();
+#ifdef HAVE_LIBCDAUDIO
+  cd_play(arcd_file_descriptor, atoi(argv[(*counter_int)]));
+#else
 #ifdef HAVE_LINUX_CDROM_H
   track_not_before_first_track = (atoi(argv[(*counter_int)]) 
                                  >= arcd_track_list.cdth_trk0);
@@ -102,6 +116,7 @@
       arcd_usage();
     }
 #endif /* HAVE_LINUX_CDROM_H  */
+#endif /* HAVE_LIBCDAUDIO  */
 }
 
 void
@@ -109,11 +124,51 @@
 {
   /* This prints the number of tracks on the current CD.  */
   initialize_cdrom();
+#ifdef HAVE_LIBCDAUDIO
+  {
+    struct disc_info info;
+    cd_stat(arcd_file_descriptor, &info);
+    printf("%d", info.disc_total_tracks);
+  }
+#else
 #ifdef HAVE_LINUX_CDROM_H
   printf("%d", arcd_track_list.cdth_trk1);
 #endif /* HAVE_LINUX_CDROM_H  */
+#endif /* HAVE_LIBCDAUDIO  */
   fflush(stdout);
 }
+
+#ifdef HAVE_LIBCDAUDIO
+void
+arcd_status()
+{
+  //  struct disc_info info;
+  struct disc_status status;
+  char *action;
+  //initialize_cdrom();
+  //cd_stat(arcd_file_descriptor, &info);
+  cd_poll(arcd_file_descriptor, &status);
+  switch(status.status_mode)
+    {
+    case CDAUDIO_PLAYING:
+      action="Playing";
+      break;
+    case CDAUDIO_PAUSED:
+      action="Paused";
+      break;
+    case CDAUDIO_COMPLETED:
+      action="Finished";
+      break;
+    default:
+      action="Stopped";
+    }
+  printf("%d %d:%d %s", status.status_current_track, 
+        status.status_track_time.minutes, status.status_track_time.seconds, 
+        action);
+  fflush(stdout);
+}
+#endif /* HAVE_LIBCDAUDIO  */
+
 int
 main(int argc, char** argv)    
 {
@@ -124,22 +179,45 @@
        switch(argv[counter_int][1])
          {
          case 'P': /* This pauses play.  */
+#ifdef HAVE_LIBCDAUDIO
+           cd_pause(arcd_file_descriptor);
+#else
 #ifdef HAVE_LINUX_CDROM_H
+           initialize_cdrom();
            arcd_initialized_command(CDROMPAUSE);
 #endif /* HAVE_LINUX_CDROM_H  */
+#endif /* HAVE_LIBCDAUDIO  */
            break;
          case 's': /* This stops the cdrom.  */
+#ifdef HAVE_LIBCDAUDIO
+           initialize_cdrom();
+           cd_stop(arcd_file_descriptor);
+#else
 #ifdef HAVE_LINUX_CDROM_H
            arcd_initialized_command(CDROMSTOP);
 #endif /* HAVE_LINUX_CDROM_H  */
+#endif /* HAVE_LIBCDAUDIO  */
+           break;
+         case 'S':
+           arcd_status();
            break;
          case 'r': /* This resumes play.  */
+#ifdef HAVE_LIBCDAUDIO
+           initialize_cdrom();
+           cd_resume(arcd_file_descriptor);
+#else
 #ifdef HAVE_LINUX_CDROM_H
            arcd_initialized_command(CDROMRESUME);
 #endif /* HAVE_LINUX_CDROM_H  */
+#endif /* HAVE_LIBCDAUDIO  */
            break;
          case 't': /* This starts play from a particular track.  */
            arcd_start_play_at_track(&counter_int, argv);
+           while(1)
+             {
+               sleep(1);
+               arcd_status();
+             }
            break;
          case 'T': 
            arcd_print_number_of_tracks();
Index: antiright/src/arshell/arguments.c
diff -u antiright/src/arshell/arguments.c:1.7 
antiright/src/arshell/arguments.c:1.8
--- antiright/src/arshell/arguments.c:1.7       Mon Aug 16 17:27:05 2004
+++ antiright/src/arshell/arguments.c   Mon Aug 23 01:15:56 2004
@@ -33,15 +33,14 @@
 void
 arshell_transparency_hack()
 {
-  if(arshell.gui.widgets.work==NULL & !arshell.transparency_hacked)
+  if((arshell.gui.widgets.work==NULL) & !arshell.transparency_hacked)
     {
       char *icon;
-      asprintf(&icon, "%s/handtoface.xpm", ICONDIR);
+      asprintf(&icon, "%s/handtoface.xpm", (char*)ICONDIR);
       antiright_set_bitmap_from_file(antiright.parent_widget, icon);
       free(icon);
       arshell.transparency_hacked=True;
-    }
-       
+    }  
 }
 void
 arshell_add_bitmap_button(int *counter_int, char **argv)
@@ -64,7 +63,7 @@
   button=antiright_button(arshell.gui.layout.row_widget, argv[(*counter_int)],
                          arshell_system_cb, argv[(*counter_int)]);
   (*counter_int)++;
-  antiright_label_set_bitmap_from_file(button, argv[(*counter_int)]);
+  antiright_set_bitmap_from_file(button, argv[(*counter_int)]);
 }
 void
 arshell_handle_construction_arguments(int *counter_int, char **argv)
Index: antiright/src/arshell/arshell.c
diff -u antiright/src/arshell/arshell.c:1.6 antiright/src/arshell/arshell.c:1.7
--- antiright/src/arshell/arshell.c:1.6 Mon Aug  9 22:45:02 2004
+++ antiright/src/arshell/arshell.c     Mon Aug 23 01:15:56 2004
@@ -56,6 +56,7 @@
   arshell.gui.menubar.file_widget=NULL;
   arshell.gui.widgets.work=NULL;
   antiright.status_widget=NULL;
+  arshell.timer_id=NULL;
   arshell.edit.filename[0]='\0';
   arshell.update_frequency=1000; /* This is in miliseconds.  */
 }
@@ -98,13 +99,13 @@
   XtGetValues(antiright.parent_widget,
              antiright.arguments,
              antiright.arguments_int);
+#ifdef XmNtoolTipEnable
   if(!override_is_set)
     {
-#ifdef XmNtoolTipEnable
       XtVaSetValues(antiright.parent_widget,
                    XmNtoolTipEnable, True,
                    NULL);
-#endif /* XmNtoolTipEnable  */
     }
+#endif /* XmNtoolTipEnable  */
 }
 
Index: antiright/src/arshell/arshell.h
diff -u antiright/src/arshell/arshell.h:1.9 antiright/src/arshell/arshell.h:1.10
--- antiright/src/arshell/arshell.h:1.9 Thu Aug 19 21:51:11 2004
+++ antiright/src/arshell/arshell.h     Mon Aug 23 01:15:56 2004
@@ -74,7 +74,7 @@
   struct arshell_edit_struct edit;
   struct arshell_flags_struct flags;
   struct arshell_gui_struct gui;
-  struct arshell_update_struct updater[MAX_UPDATERS];
+  struct arshell_update_struct *updater;
   int updaters_int;
   XtIntervalId *timer_id;
   int update_frequency;
Index: antiright/src/arshell/dialog.c
diff -u antiright/src/arshell/dialog.c:1.4 antiright/src/arshell/dialog.c:1.5
--- antiright/src/arshell/dialog.c:1.4  Thu Aug 19 00:31:32 2004
+++ antiright/src/arshell/dialog.c      Mon Aug 23 01:15:56 2004
@@ -40,6 +40,8 @@
 {
   Widget font_selector=(Widget)client_data;
   char* font;
+  widget=NULL;
+  call_data=NULL;
   ARCLARG;
   antiright_set(XmNcurrentFont, (XtArgVal)&font);
   antiright_get_values(font_selector);
Index: antiright/src/arshell/menubar.c
diff -u antiright/src/arshell/menubar.c:1.4 antiright/src/arshell/menubar.c:1.5
--- antiright/src/arshell/menubar.c:1.4 Mon Aug 16 17:27:05 2004
+++ antiright/src/arshell/menubar.c     Mon Aug 23 01:15:56 2004
@@ -135,7 +135,7 @@
   Widget button;
   ARCLARG;
   antiright_set(XmNshadowThickness, 0);
-  button=antiright_button(parent, "button", arshell_open_cb, NULL);
+  button=antiright_button(parent, "button", callback, client_data);
   antiright_set_tooltip(button, description);
   antiright_set_pixmap_from_data(button, icon);
   ARCLARG;
@@ -151,7 +151,8 @@
 }
 
 void
-arshell_toggle_toolbar_cb(Widget widget, XtPointer client_data, XtPointer 
call_data)
+arshell_toggle_toolbar_cb(Widget widget, 
+                         XtPointer client_data, XtPointer call_data)
 {
   if(XmToggleButtonGetState(widget))
     {
@@ -167,12 +168,13 @@
          XtUnmanageChild(XtParent(XtParent(arshell.edit.toolbar)));
        }
     }
+  client_data=NULL;
+  call_data=NULL;
 }
 
 void
 arshell_setup_editor_toolbar()
 {
-  Widget button;
   arshell_initialize_row_manager();
   ARCLARG;
   antiright_set(XmNmarginWidth, 0);
Index: antiright/src/arshell/search.c
diff -u antiright/src/arshell/search.c:1.2 antiright/src/arshell/search.c:1.3
--- antiright/src/arshell/search.c:1.2  Mon Aug 16 17:27:05 2004
+++ antiright/src/arshell/search.c      Mon Aug 23 01:15:56 2004
@@ -20,6 +20,7 @@
 */
 
 #include "arshell.h"
+#include <ctype.h>
 
 XmTextPosition
 arshell_end_of_word(XmTextPosition start)
@@ -92,7 +93,7 @@
 }
 
 void
-arshell_wrap_toggle_cb(Widget widget, XtPointer client_data, XtPointer 
call_data)
+arshell_wrap_toggle_cb()
 {
   arshell.edit.search_options.wrap=
     XmToggleButtonGetState(arshell.edit.search_options.wrap_toggle);
@@ -100,27 +101,27 @@
                         arshell.edit.search_options.wrap, True);
 }
 void
-arshell_preserve_toggle_cb(Widget widget, XtPointer client_data, XtPointer 
call_data)
+arshell_preserve_toggle_cb()
 {
   arshell.edit.search_options.preserve=
     XmToggleButtonGetState(arshell.edit.search_options.preserve_toggle);
 }
 void
-arshell_replace_toggle_cb(Widget widget, XtPointer client_data, XtPointer 
call_data)
+arshell_replace_toggle_cb()
 {
   arshell.edit.search_options.replace=
     XmToggleButtonGetState(arshell.edit.search_options.replace_toggle);
-  ARBUG;
+  
   if(arshell.edit.search_options.replace)
     {
-      ARBUG;
+      
       ARCLARG;
       antiright_set(XmNsensitive, True);
       antiright_set_values(arshell.edit.replace_widget);
-      ARBUG;
+      
       antiright_set_values(arshell.edit.search_options.replace_label);
       ARCLARG;
-      ARBUG;
+      
     }
   else
     {
@@ -132,13 +133,10 @@
     }
 }
 void
-arshell_replace_all_toggle_cb(Widget widget, XtPointer client_data, XtPointer 
call_data)
+arshell_ignore_case_toggle_cb()
 {
-  arshell.edit.search_options.replace_all=
-    XmToggleButtonGetState(arshell.edit.search_options.replace_all_toggle);
-  XmToggleButtonSetState(arshell.edit.search_options.replace_toggle, 
-                        arshell.edit.search_options.replace_all, True);
-  arshell_replace_toggle_cb(widget, client_data, call_data);
+  arshell.edit.search_options.ignore_case=
+    XmToggleButtonGetState(arshell.edit.search_options.ignore_case_toggle);
 }
 
 void
@@ -148,102 +146,159 @@
 {
   XmTextPosition position;
   char *search_string;
-  ARBUG;
+  char *backup_text=NULL;
+  /* The find widget is always used.  */
+  search_string=XmTextFieldGetString(arshell.edit.find_widget);
+  assert(search_string != NULL);
+  if(XmToggleButtonGetState(arshell.edit.search_options.ignore_case_toggle))
+    {
+      /* Convert the text buffer and search string to lower case so
+        that case is not a factor in the search.  */
+      int counter=0;
+      char *lowered_buffer;
+      while(search_string[counter]!='\0')
+       {
+         search_string[counter]=tolower(search_string[counter]);
+         counter++;
+       }
+      backup_text=XmTextGetString(arshell.gui.widgets.work);
+      lowered_buffer=XmTextGetString(arshell.gui.widgets.work);
+      counter=0;
+      while(lowered_buffer[counter]!='\0')
+       {
+         lowered_buffer[counter]=tolower(lowered_buffer[counter]);
+         counter++;
+       }
+      XmTextSetString(arshell.gui.widgets.work, lowered_buffer);
+    }
+  client_data=NULL;
+  
   if(arshell.edit.search_options.replace)
     {
       XmTextPosition end_position;
       char *replacement_string;
-      Boolean search_status;
-      ARBUG;
-      search_string=XmTextFieldGetString(arshell.edit.find_widget);
-      ARBUG;
+      
       XmTextFindString(arshell.gui.widgets.work,
                       XmTextGetInsertionPosition(arshell.gui.widgets.work),
                       search_string,
                       arshell.edit.search_options.direction,
                       &position);
-      ARBUG;
+      /* Restore the buffer if it was converted to lower case during a
+        search with "Ignore Case" set.  */
+      
if(XmToggleButtonGetState(arshell.edit.search_options.ignore_case_toggle))
+       {
+         XmTextSetString(arshell.gui.widgets.work, backup_text);
+         XtFree(backup_text);
+       }
+      
       XtFree(search_string);
-      ARBUG;
+      
       XmTextFindString(arshell.gui.widgets.work,
                       position,
                       " ",
                       XmTEXT_FORWARD,
                       &end_position);
-      ARBUG;
+      
       replacement_string=XmTextFieldGetString(arshell.edit.replace_widget);
       if(end_position>position)
        {
-         ARBUG;
+         
          XmTextReplace(arshell.gui.widgets.work, position, end_position,
                        replacement_string);
-         ARBUG;
+         
        }
       else
        {
-         ARBUG;
-         if(arshell.edit.search_options.wrap && 
!arshell.edit.search_options.wrapped)
+         
+         if(arshell.edit.search_options.wrap 
+            && !arshell.edit.search_options.wrapped)
            {
-             ARBUG;
+             
              arshell.edit.search_options.direction=XmTEXT_BACKWARD;
              arshell.edit.search_options.wrapped=True;
-             ARBUG;
+             
            }
          else
            {
              arshell.edit.search_options.preserve=False;
            }
-         ARBUG;
+         
        }
-      ARBUG;
+      
       XtFree(replacement_string);
-      XmTextSetInsertionPosition(arshell.gui.widgets.work, position);
+      if(arshell.edit.search_options.direction==XmTEXT_FORWARD)
+       XmTextSetInsertionPosition(arshell.gui.widgets.work, 
+                                  arshell_end_of_word(position));
+      else
+       XmTextSetInsertionPosition(arshell.gui.widgets.work, position-1);
+      /* The above use of the position before POSITION prevents
+        the current word from being the highlighted search result
+        when the search directoion is BACKWARD.  */
+      XmTextSetSelection(arshell.gui.widgets.work, position,
+                        arshell_end_of_word(position),
+                        XtLastTimestampProcessed(antiright.display));
       if(arshell.edit.search_options.preserve)
        XtManageChild(widget); 
       call_data=NULL;
-      ARBUG;
+      
     }
   else
     {
-      XmSelectionBoxCallbackStruct *prompt_data;
       Boolean result;
-      ARBUG;
-      search_string=XmTextFieldGetString(arshell.edit.find_widget);
-      assert(search_string != NULL);
-      ARBUG;
+      
+      
+      
       assert(arshell.gui.widgets.work != NULL);
       
       result=XmTextFindString(arshell.gui.widgets.work,
-                             
XmTextGetInsertionPosition(arshell.gui.widgets.work),
+                             XmTextGetInsertionPosition
+                             (arshell.gui.widgets.work),
                              search_string,
                              arshell.edit.search_options.direction,
                              &position);
-      ARBUG;
+      /* Restore the buffer if it was converted to lower case during a
+        search with "Ignore Case" set.  */
+      
if(XmToggleButtonGetState(arshell.edit.search_options.ignore_case_toggle))
+       {
+         XmTextSetString(arshell.gui.widgets.work, backup_text);
+         XtFree(backup_text);
+       }
+      
       if(result)
        {
-         ARBUG;
-         XmTextSetInsertionPosition(arshell.gui.widgets.work, position);
+         
+         XmTextSetSelection(arshell.gui.widgets.work, position,
+                            arshell_end_of_word(position),
+                            XtLastTimestampProcessed(antiright.display));
+         if(arshell.edit.search_options.direction==XmTEXT_FORWARD)
+           XmTextSetInsertionPosition(arshell.gui.widgets.work, 
+                                      arshell_end_of_word(position));
+         else
+           XmTextSetInsertionPosition(arshell.gui.widgets.work, position-1);
+         /* The above use of the position before POSITION prevents
+            the current word from being the highlighted search result
+            when the search directoion is BACKWARD.  */
        }
       else
        {
-         ARBUG;
+         
          if(XmToggleButtonGetState(arshell.edit.search_options.wrap_toggle))
            {
-             ARBUG;
+             
              arshell.edit.search_options.direction=XmTEXT_BACKWARD;
-             
XmToggleButtonSetState(arshell.edit.search_options.preserve_toggle, 
-                                    True, False);
+             XmToggleButtonSetState
+               (arshell.edit.search_options.preserve_toggle, True, False);
              XmToggleButtonSetState(arshell.edit.search_options.wrap_toggle, 
                                     False, False);
            }
-         ARBUG;
+         
        }
-      ARBUG;
+      
       if(XmToggleButtonGetState(arshell.edit.search_options.preserve_toggle))
        XtManageChild(widget); 
-      ARBUG;
+      
       XtFree(search_string);
-      ARBUG;
+      
     }
 }
   
@@ -297,28 +352,29 @@
   arshell.edit.search_options.replace_toggle=
     XmCreateToggleButton(form, "Replace", ARARGS);
   XtManageChild(arshell.edit.search_options.replace_toggle);
-  XtAddCallback(arshell.edit.search_options.replace_toggle, 
XmNvalueChangedCallback,
-               arshell_replace_toggle_cb, NULL);
+  XtAddCallback(arshell.edit.search_options.replace_toggle, 
+               XmNvalueChangedCallback, arshell_replace_toggle_cb, NULL);
   ARCLARG;
   antiright_form_positions(50, 75, 50, 100);
-  arshell.edit.search_options.wrap_toggle=XmCreateToggleButton(form, "Wrap", 
ARARGS);
+  arshell.edit.search_options.wrap_toggle=XmCreateToggleButton(form, "Wrap", 
+                                                              ARARGS);
   XtManageChild(arshell.edit.search_options.wrap_toggle);
-  XtAddCallback(arshell.edit.search_options.wrap_toggle, 
XmNvalueChangedCallback,
-               arshell_wrap_toggle_cb, NULL);
+  XtAddCallback(arshell.edit.search_options.wrap_toggle, 
+               XmNvalueChangedCallback, arshell_wrap_toggle_cb, NULL);
   ARCLARG;
   antiright_form_positions(75, 100, 0, 50);
-  arshell.edit.search_options.replace_all_toggle=
-    XmCreateToggleButton(form, "Replace All", ARARGS);
-  XtManageChild(arshell.edit.search_options.replace_all_toggle);
-  XtAddCallback(arshell.edit.search_options.replace_all_toggle, 
XmNvalueChangedCallback,
-               arshell_replace_all_toggle_cb, NULL);
+  arshell.edit.search_options.ignore_case_toggle=
+    XmCreateToggleButton(form, "Ignore Case", ARARGS);
+  XtManageChild(arshell.edit.search_options.ignore_case_toggle);
+  XtAddCallback(arshell.edit.search_options.ignore_case_toggle, 
+               XmNvalueChangedCallback, arshell_ignore_case_toggle_cb, NULL);
   ARCLARG;
   antiright_form_positions(75, 100, 50, 100);
   arshell.edit.search_options.preserve_toggle=
     XmCreateToggleButton(form, "Preserve Dialog", ARARGS);
   XtManageChild(arshell.edit.search_options.preserve_toggle);
-  XtAddCallback(arshell.edit.search_options.preserve_toggle, 
XmNvalueChangedCallback,
-               arshell_preserve_toggle_cb, NULL);
+  XtAddCallback(arshell.edit.search_options.preserve_toggle, 
+               XmNvalueChangedCallback, arshell_preserve_toggle_cb, NULL);
 
   XtAddCallback(prompt,
                XmNokCallback,
Index: antiright/src/arshell/textedit.c
diff -u antiright/src/arshell/textedit.c:1.12 
antiright/src/arshell/textedit.c:1.13
--- antiright/src/arshell/textedit.c:1.12       Thu Aug 19 00:31:32 2004
+++ antiright/src/arshell/textedit.c    Mon Aug 23 01:15:56 2004
@@ -143,12 +143,12 @@
 arshell_goto_line(unsigned int line)
 {
   /* Declare a counter for the number of lines counted.  */
-  int line_counter=1;
+  unsigned int line_counter=1;
   /* Declare a text position counter. */
   XmTextPosition position=0;
   char *text=XmTextGetString(arshell.gui.widgets.work);
   unsigned int text_length=strlen(text);
-  while((position<text_length) & (line_counter<line))
+  while(((unsigned int)position < text_length) & (line_counter<line))
     {
       if(text[position]=='\n')
        line_counter++;
Index: antiright/src/arshell/textedit.h
diff -u antiright/src/arshell/textedit.h:1.5 
antiright/src/arshell/textedit.h:1.6
--- antiright/src/arshell/textedit.h:1.5        Mon Aug 16 17:27:05 2004
+++ antiright/src/arshell/textedit.h    Mon Aug 23 01:15:56 2004
@@ -33,8 +33,8 @@
   Widget replace_label;
   Widget wrap_toggle;
   Widget preserve_toggle;
-  Widget replace_all_toggle;
-  Boolean replace, wrap, preserve, replace_all, wrapped;
+  Widget ignore_case_toggle;
+  Boolean replace, wrap, preserve, ignore_case, wrapped;
   XmTextDirection direction;
 };
 
@@ -96,5 +96,7 @@
 arshell_upper_selection_case();
 void
 arshell_select_all();
+void
+arshell_get_rid_of_modified_status();
 
 #endif /* AR_TEXTEDIT_H */
Index: antiright/src/arshell/update.c
diff -u antiright/src/arshell/update.c:1.2 antiright/src/arshell/update.c:1.3
--- antiright/src/arshell/update.c:1.2  Thu Aug 19 21:51:11 2004
+++ antiright/src/arshell/update.c      Mon Aug 23 01:15:56 2004
@@ -25,29 +25,33 @@
 void
 arshell_update()
 {
-  int counter;
-  for(counter=0; counter < arshell.updaters_int; counter++)
+  struct arshell_update_struct *iterator=arshell.updater;
+  while(iterator->next!=NULL)
     {
-      char *input_string=
-       antiright_pipe_read(arshell.updater[counter].command_string);
+      char *input_string;
+      iterator=iterator->next;
+      input_string=antiright_pipe_read(iterator->command_string);
       input_string[strlen(input_string)-1]='\0';
-      if(XmIsLabel(arshell.updater[counter].widget))
+      
+      if(XmIsLabel(iterator->widget))
        {
-         antiright_label_string(arshell.updater[counter].widget,
+         antiright_label_string(iterator->widget,
                                 input_string);
        }
-      else if(XmIsScrollBar(arshell.updater[counter].widget))
+      else if(XmIsScrollBar(iterator->widget))
        {
          int value_int=atoi(input_string);
          if((value_int>0)&(value_int<=100))
            {
-             XtVaSetValues(arshell.updater[counter].widget,
+             XtVaSetValues(iterator->widget,
                            XmNsliderSize, value_int,
                            NULL);
            }
        }
-      else if(arshell.updater[counter].widget==arshell.gui.widgets.work)
+      else if(iterator->widget==arshell.gui.widgets.work)
        {
+         assert(arshell.gui.widgets.work != NULL);
+         assert(iterator->widget != NULL);
          /* Append input_string to the work area.  */
          XmTextInsert(arshell.gui.widgets.work,
                       XmTextGetLastPosition(arshell.gui.widgets.work),
@@ -56,7 +60,7 @@
                       XmTextGetLastPosition(arshell.gui.widgets.work),
                       "\n");
        }
-      else if(arshell.updater[counter].widget==antiright.parent_widget)
+      else if(iterator->widget==antiright.parent_widget)
        {
          /* Set the title to input_string.  */
          antiright_set_title(input_string);
@@ -66,12 +70,8 @@
 }
 
 void
-arshell_add_updater(Widget widget, char* command_string)
+arshell_restart_timers()
 {
-  arshell.updater[arshell.updaters_int].widget=widget;
-  strncpy(arshell.updater[arshell.updaters_int].command_string,
-         command_string, ARSHELL_MAX_STRLEN);
-  arshell.updaters_int++;
   if((arshell.timer_id)!=NULL)
     XtRemoveTimeOut((*arshell.timer_id));
   arshell_update();
@@ -80,13 +80,45 @@
 }
 
 void
+arshell_add_updater(Widget widget, char* command_string)
+{
+  struct arshell_update_struct *iterator;
+
+  /* Initialize the global instance, if necessary.  */
+  if(arshell.updater==NULL)
+    {
+      arshell.updater=
+       (struct arshell_update_struct *)xmalloc
+       (sizeof(struct arshell_update_struct));
+      arshell.updater->next=NULL;
+    }
+
+  /* Initialize from global instance.  */
+  iterator=arshell.updater;
+
+  /* Go to the end of the list.  */
+  while(iterator->next!=NULL)
+    iterator=iterator->next;
+
+  /* Append the updating rules.  */
+  iterator->next=
+    (struct arshell_update_struct *)xmalloc
+    (sizeof(struct arshell_update_struct));
+  iterator=iterator->next;
+  iterator->next=NULL;
+  iterator->widget=widget;
+  strncpy(iterator->command_string, command_string, ARSHELL_MAX_STRLEN);
+  arshell_restart_timers();
+}
+
+void
 arshell_update_work_procedure(XtPointer client_data, 
                              XtIntervalId *timer_id)
 {  
   arshell_update();
   *timer_id=
     XtAppAddTimeOut(antiright.app_context, arshell.update_frequency, 
-                   arshell_update_work_procedure, NULL);
+                   arshell_update_work_procedure, client_data);
   arshell.timer_id=timer_id;
 }
 
Index: antiright/src/arshell/update.h
diff -u antiright/src/arshell/update.h:1.2 antiright/src/arshell/update.h:1.3
--- antiright/src/arshell/update.h:1.2  Fri Aug 13 18:18:18 2004
+++ antiright/src/arshell/update.h      Mon Aug 23 01:15:56 2004
@@ -34,6 +34,7 @@
 {
   Widget widget;
   char command_string[ARSHELL_MAX_STRLEN];
+  struct arshell_update_struct *next;
 };
 
 void




reply via email to

[Prev in Thread] Current Thread [Next in Thread]