home *** CD-ROM | disk | FTP | other *** search
- /* Systems Sciences Laboratory, Webster Research Center */
-
- static char *PROGRAM_information[] =
- {
- "Copyright (c) 1988 Xerox Corporation. All rights reserved.",
- "$Header$",
- "$Locker$"
- }
- ;
-
- /*
- * Copyright protection claimed includes all forms and matters of copyrightable
- * material and information now allowed by statutory or judicial lay or
- * herinafter granted, including without limitation, material generated from
- * the software programs which are displayed on the screen such as icons,
- * screen display looks, etc.
- */
-
-
- /*
- * this defines modifications to the command button widget;
- * it redefines the translation table to accept input from
- * all three mouse buttons; the notify routine is redone to
- * return the number of the pressed mouse button as the call_data
- * parameter;
- *
- */
-
- #include "xfilebrowser.h"
- #include <X11/IntrinsicP.h>
- #include <X11/CommandP.h>
-
-
- /* Private Data */
- extern void My_Notify();
- extern void My_Double();
-
- static char defaultTranslations[] =
- "<Btn1Down>: set() \n\
- <Btn1Up>: mynotify(1) unset() \n\
- <Btn2Down>: set() \n\
- <Btn2Up>: mynotify(2) unset() \n\
- <Btn3Down>: set() \n\
- <Btn3Up>: mynotify(3) unset()";
-
- static char textTranslations[] =
- "<Btn1Up>(2): mydouble()";
-
-
- static XtActionsRec actionsList[] =
- {
- {"mynotify", My_Notify},
- };
-
- static XtActionsRec actionsText[] =
- {
- {"mydouble", My_Double},
- };
-
-
- /************************************
- *
- * Modifications for command buttons
- *
- *************************************/
-
-
-
- /* ARGSUSED */
- void ModCommand_Init(command)
- Widget command;
- {
- XtTranslations modtable;
-
- modtable = XtParseTranslationTable(defaultTranslations);
- XtOverrideTranslations(command, modtable);
- XtAddActions(actionsList, 1);
- }
-
- /***************************
- *
- * Action Procedures
- *
- ***************************/
-
-
- /* ARGSUSED */
- static void My_Notify(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
- {
- CommandWidget cbw = (CommandWidget)w;
- int button;
-
- if (cbw->command.set) {
- button = 0;
- if (params[0] != NULL) {
- if (*params[0] == '1') button = 1;
- else if (*params[0] == '2') button = 2;
- else if (*params[0] == '3') button = 3;
- }
- XtCallCallbacks(w, XtNcallback, (caddr_t)button);
- }
- }
-
-
- /************************************
- *
- * Modifications for text widgets
- *
- *************************************/
-
- /* ARGSUSED */
- void Modtext_Init(command)
- Widget command;
- {
- XtTranslations modtable;
-
- modtable = XtParseTranslationTable(textTranslations);
- XtOverrideTranslations(command, modtable);
- XtAddActions(actionsText, 1);
- }
-
- /* ARGSUSED */
- static void My_Double(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
- {
- XtTextPosition pos1, pos2;
- int i;
- long view_edit = (viewEdit ? 2 : 1);
- struct stat buf;
-
- if (w == listwidget) {
- XtTextGetSelectionPos(listwidget, &pos1, &pos2);
- if (pos1 != pos2 && numfiles != 0 &&
- ( (i = select_file(pos1, pos2)) != -1)) {
- if (stat((*files[i]).d_name, &buf) == -1) {
- disp_message("\ncannot check file stats");
- return;
- }
- }
- else return;
-
- if (buf.st_mode & S_IFDIR)
- DoList(listbutton, (caddr_t)NULL, (caddr_t)0);
- else
- DoEdit(editbutton, (caddr_t)NULL, (caddr_t)view_edit);
- }
- else if (w == grepwidget)
- DoGrepEdit(grepbutton, (caddr_t)NULL, (caddr_t)view_edit);
- }
-