00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #define _XMAIN_SOURCE_
00044
00045 #include <stdio.h>
00046
00047 #include "setup.h"
00048 #include "sysdep.h"
00049 #include "commline.h"
00050 #include "symbol.h"
00051
00052 #include <X11/bitmaps/xlogo11>
00053 #include "xsetup.h"
00054 #include "xmain.h"
00055 #include "xmenu_file.h"
00056 #include "xclipstext.h"
00057 #include "xmenu.h"
00058 #include "xclips.h"
00059
00060 Boolean Dribble_status;
00061
00062 Boolean Browse_status[WINDOW_NUM] = {False,False,False,False,False};
00063
00064
00065
00066
00067
00068
00069
00070 Widget toplevel = NULL, dialog = NULL;
00071 Widget dialog_form = NULL, dialog_text = NULL;
00072 Arg TheArgs[10];
00073 XtAppContext app_con;
00074 XEvent TheEvent;
00075 KeySym TheKeysym;
00076 XComposeStatus compose_status;
00077 Pixmap checker, clips_logo;
00078 char *clips_sel_buf;
00079 Boolean quit_get_event = False;
00080 unsigned long clips_count = 0;
00081 unsigned long clips_last_pos = 0;
00082 Boolean send_to_clips = False;
00083
00084 XtActionsRec actionTable[] =
00085 {
00086 {"DialogReturn", DialogReturn},
00087 {"MatchDialogReturnD",MatchDialogReturnD},
00088 {"MatchDialogReturnE",MatchDialogReturnE},
00089 };
00090
00091 char *xclips_translation1 =
00092 "\
00093 Ctrl<Key>A: no-op() \n\
00094 Ctrl<Key>B: no-op() \n\
00095 Ctrl<Key>C: complete-construct-dialog() \n\
00096 Ctrl<Key>D: dribble() \n\
00097 Ctrl<Key>E: reset() \n\
00098 Ctrl<Key>F: no-op() \n\
00099 Ctrl<Key>G: no-op() \n\
00100 Ctrl<Key>H: stop-execution() \n\
00101 Ctrl<Key>I: no-op() \n\
00102 Ctrl<Key>J: no-op() \n\
00103 Ctrl<Key>K: clear-clips() \n\
00104 Ctrl<Key>L: load-constructs() \n\
00105 Ctrl<Key>M: no-op() \n\
00106 Ctrl<Key>N: clear-screen() \n\
00107 Ctrl<Key>O: no-op() \n\
00108 Ctrl<Key>P: no-op() \n\
00109 Ctrl<Key>Q: quit() \n\
00110 Ctrl<Key>R: run() \n\
00111 Ctrl<Key>S: save-rules() \n\
00112 Ctrl<Key>T: step() \n\
00113 Ctrl<Key>U: no-op() \n\
00114 Ctrl<Key>V: edit() \n\
00115 Ctrl<Key>W: no-op() \n\
00116 Ctrl<Key>X: no-op() \n\
00117 Ctrl<Key>Y: no-op() \n\
00118 Ctrl<Key>Z: command-line-clips() \n\
00119 Meta<Key>I: no-op() \n\
00120 Meta<Key>K: no-op() \n\
00121 Meta<Key>Q: no-op() \n\
00122 :Meta<Key>d: no-op() \n\
00123 :Meta<Key>D: no-op() \n\
00124 :Meta<Key>h: no-op() \n\
00125 :Meta<Key>H: no-op() \n\
00126 :Meta<Key>]: no-op() \n\
00127 :Meta<Key>[: no-op() \n\
00128 ~Shift Meta<Key>Delete: no-op() \n\
00129 Shift Meta<Key>Delete: no-op() \n\
00130 ~Shift Meta<Key>BackSpace: no-op() \n\
00131 Shift Meta<Key>BackSpace: no-op() \n\
00132 <Key>Return: Clipsnewline() \n\
00133 <Key>Linefeed: Clipsnewline() \n\
00134 <Key>Delete: delete-clips-previous-character() \n\
00135 <Key>BackSpace: delete-clips-previous-character() \n\
00136 <Key>: insert-clips-char() \n\
00137 <Btn2Down>: insert-clips-selection(PRIMARY, CUT_BUFFER0) \n\
00138 ";
00139
00140 String fallback_resources[] =
00141 {
00142 "*allowHoriz: True",
00143 "*allowVert: True",
00144 "*borderWidth: 4",
00145 "*lineWidth: 4",
00146 "*defaultColumns: 1",
00147 "*forceColumns: True",
00148 "*showGrip: off",
00149
00150 "*MenuButton.width: 75",
00151 "*MenuButton3D.width: 75",
00152 "*watchButton.width: 75",
00153 "*Form.file_dialog*translations: #override \\n <Key>Return: DialogReturn(client_data)",
00154 "*Form.match_dialog*translations: #override \\n <Key>Return: MatchDialogReturnD(client_data)",
00155 "*Form.match_editor*translations: #override \\n <Key>Return: MatchDialogReturnE(client_data)",
00156 "*manager_viewport.height: 300",
00157 "*manager_viewport.width: 300",
00158 "*manager_form.Command.width: 150",
00159 "*Paned*internalBorderWidth: 0",
00160
00161 NULL,
00162 };
00163
00164 #define clips_logo_width 30
00165 #define clips_logo_height 27
00166 static char clips_logo_bits[] = {
00167 0x80, 0xff, 0x01, 0x00, 0xe0, 0xff, 0x07, 0x00, 0x70, 0x20, 0x1d, 0x00,
00168 0x38, 0xb0, 0x3c, 0x00, 0x1c, 0x48, 0x72, 0x00, 0x8c, 0x2f, 0xf9, 0x00,
00169 0x8e, 0xba, 0xc4, 0x00, 0x66, 0xf8, 0xc6, 0x01, 0x37, 0x29, 0x61, 0x03,
00170 0xb3, 0xb6, 0x31, 0x03, 0x4f, 0x88, 0x18, 0x06, 0x23, 0x6c, 0x0c, 0x0f,
00171 0x13, 0x22, 0x86, 0x0c, 0x1f, 0xbf, 0xc3, 0x1c, 0x86, 0x08, 0x60, 0x32,
00172 0x86, 0x04, 0x10, 0x31, 0x7c, 0x02, 0xd8, 0x31, 0x18, 0x05, 0xc4, 0x1d,
00173 0xb8, 0x8a, 0x36, 0x0e, 0x70, 0x93, 0x11, 0x06, 0xe0, 0xee, 0x11, 0x06,
00174 0xc0, 0xa9, 0x09, 0x06, 0x80, 0x73, 0x04, 0x06, 0x00, 0x23, 0x02, 0x06,
00175 0x00, 0x1b, 0xf9, 0x07, 0x00, 0x8b, 0xfc, 0x03, 0x00, 0x87, 0x0c, 0x00};
00176
00177
00178
00179
00180
00181
00182
00183
00184 int main(
00185 int argc,
00186 char **argv)
00187 {
00188 void *theEnv;
00189
00190
00191
00192
00193 toplevel = XtAppInitialize(&app_con,"Xclips",NULL,0,&argc,argv,
00194 fallback_resources,NULL,0);
00195
00196
00197
00198
00199
00200 XtAppAddActions(app_con, actionTable, XtNumber(actionTable));
00201 XtAppAddActions(app_con, ClipsTxtActsTable, ClipsTxtActsTableCount);
00202
00203
00204
00205
00206
00207 checker = XCreateBitmapFromData(XtDisplay(toplevel),
00208 RootWindowOfScreen(XtScreen(toplevel)),
00209 xlogo11_bits,
00210 xlogo11_width,
00211 xlogo11_height);
00212
00213
00214
00215
00216
00217 clips_logo = XCreateBitmapFromData(XtDisplay(toplevel),
00218 RootWindowOfScreen(XtScreen(toplevel)),
00219 clips_logo_bits,
00220 clips_logo_width,
00221 clips_logo_height);
00222
00223
00224
00225
00226
00227 dialog = XtCreateManagedWidget("dialog",panedWidgetClass,
00228 toplevel,NULL,0);
00229
00230
00231
00232
00233
00234 CreatePullDownMenus(dialog);
00235
00236 XtSetArg(TheArgs[0], XtNlabel, "Xclips - CLIPS Version 6.30");
00237 (void) XtCreateManagedWidget("menu",labelWidgetClass,dialog,TheArgs,1);
00238
00239
00240
00241
00242
00243 dialog_form = XtCreateManagedWidget("dialog_form",
00244 formWidgetClass,
00245 dialog,
00246 NULL, 0);
00247
00248 dialog_text = XtVaCreateManagedWidget("dialog_text",
00249 asciiTextWidgetClass,
00250 dialog_form,
00251 XtNheight, 500,
00252 XtNwidth, 600,
00253 XtNeditType, XawtextEdit,
00254 XtNtype, XawAsciiString,
00255 XtNscrollHorizontal, XawtextScrollNever,
00256 XtNscrollVertical, XawtextScrollWhenNeeded,
00257 XtNwrap, XawtextWrapWord,
00258 XtNresize, XawtextResizeNever,
00259 NULL);
00260
00261 XtOverrideTranslations(dialog_text,
00262 XtParseTranslationTable(xclips_translation1));
00263
00264 XtSetKeyboardFocus(dialog_form, dialog_text);
00265
00266 XtRealizeWidget(toplevel);
00267
00268 theEnv = CreateEnvironment();
00269
00270 InitializeInterface();
00271 RerouteStdin(theEnv,argc,argv);
00272 CommandLoop(theEnv);
00273
00274 return(-1);
00275 }
00276