]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.C
Painter and scrollbar API patches
[lyx.git] / src / frontends / xforms / XWorkArea.C
1 /**
2  * \file XWorkArea.C
3  * Copyright 1995-2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "XWorkArea.h"
17 #include "debug.h"
18 #include "LyXView.h"
19 #include "lyxrc.h" // lyxrc.show_banner
20 #include "version.h" // lyx_version
21
22 #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
23 #include "lyxlookup.h"
24 #endif
25
26 #include "support/filetools.h" // LibFileSearch
27 #include "support/lstrings.h"
28 #include "support/LAssert.h"
29
30 #include <cmath>
31 #include <cctype>
32
33 // xforms doesn't define this (but it should be in <forms.h>).
34 extern "C"
35 FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
36  
37 using std::endl;
38 using std::abs;
39 using std::hex;
40
41 namespace {
42
43 inline
44 void waitForX()
45 {
46         XSync(fl_get_display(), 0);
47 }
48
49
50 void setXtermCursor(Window win)
51 {
52         static Cursor cursor;
53         static bool cursor_undefined = true;
54         if (cursor_undefined) {
55                 cursor = XCreateFontCursor(fl_get_display(), XC_xterm);
56                 XFlush(fl_get_display());
57                 cursor_undefined = false;
58         }
59         XDefineCursor(fl_get_display(), win, cursor);
60         XFlush(fl_get_display());
61 }
62  
63
64 // FIXME !
65 mouse_button::state x_button_state(unsigned int button)
66 {
67         mouse_button::state b = mouse_button::none;
68         switch (button) {
69                 case Button1:
70                         b = mouse_button::button1;
71                         break;
72                 case Button2:
73                         b = mouse_button::button2;
74                         break;
75                 case Button3:
76                         b = mouse_button::button3;
77                         break;
78                 case Button4:
79                         b = mouse_button::button4;
80                         break;
81                 case Button5:
82                         b = mouse_button::button5;
83                         break;
84                 default: // FIXME
85                         break;
86         }
87         return b;
88 }
89
90
91 // FIXME
92 mouse_button::state x_motion_state(unsigned int state)
93 {
94         mouse_button::state b = mouse_button::none;
95         if (state & Button1MotionMask)
96                 b |= mouse_button::button1;
97         if (state & Button2MotionMask)
98                 b |= mouse_button::button2;
99         if (state & Button3MotionMask)
100                 b |= mouse_button::button3;
101         if (state & Button4MotionMask)
102                 b |= mouse_button::button4;
103         if (state & Button5MotionMask)
104                 b |= mouse_button::button5;
105         return b;
106 }
107
108
109 key_modifier::state x_key_state(unsigned int state)
110 {
111         key_modifier::state k = key_modifier::none;
112         if (state & ControlMask)
113                 k |= key_modifier::ctrl;
114         if (state & ShiftMask)
115                 k |= key_modifier::shift;
116         if (state & Mod1Mask)
117                 k |= key_modifier::alt;
118         return k;
119 }
120
121
122 } // anon namespace
123
124
125 extern "C" {
126         // Just a bunch of C wrappers around static members of WorkArea
127         static
128         void C_WorkArea_scroll_cb(FL_OBJECT * ob, long)
129         {
130                 WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
131                 area->scroll_cb();
132         }
133
134
135         static
136         int C_WorkArea_work_area_handler(FL_OBJECT * ob, int event,
137                                          FL_Coord, FL_Coord,
138                                          int key, void * xev)
139         {
140                 return WorkArea::work_area_handler(ob, event,
141                                                    0, 0, key, xev);
142         }
143
144         static
145         int C_WorkAreaEventCB(FL_FORM * form, void * xev) {
146                 WorkArea * wa = static_cast<WorkArea*>(form->u_vdata);
147                 return wa->event_cb(static_cast<XEvent*>(xev));
148         }
149 }
150
151
152 WorkArea::WorkArea(int x, int y, int w, int h)
153         : splash_(0), splash_text_(0), workareapixmap(0), painter_(*this)
154 {
155         fl_freeze_all_forms();
156
157         //
158         FL_OBJECT * obj;
159
160         // a box
161         if (lyxerr.debugging(Debug::WORKAREA))
162                 lyxerr << "\tbackground box: +"
163                        << x << '+' << y << ' '
164                        << w - 15 << 'x' << h << endl;
165         backgroundbox = obj = fl_add_box(FL_BORDER_BOX,
166                                          x, y,
167                                          w - 15,
168                                          h, "");
169         fl_set_object_resize(obj, FL_RESIZE_ALL);
170         fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
171
172         // Add a splash screen to the centre of the work area
173         string const splash_file = (lyxrc.show_banner) ?
174                 LibFileSearch("images", "banner", "xpm") : string();
175
176         if (!splash_file.empty()) {
177                 int const splash_w = 425;
178                 int const splash_h = 290;
179                 int const splash_x = x + (w - 15 - splash_w) / 2;
180                 int const splash_y = y + (h - splash_h) / 2;
181                 splash_ = obj =
182                         fl_add_pixmapbutton(FL_NORMAL_BUTTON,
183                                             splash_x, splash_y,
184                                             splash_w, splash_h, "");
185                 fl_set_pixmapbutton_file(obj, splash_file.c_str());
186                 fl_set_pixmapbutton_focus_outline(obj, 3);
187                 fl_set_object_boxtype(obj, FL_NO_BOX);
188
189                 int const text_x = splash_x + 260;
190                 int const text_y = splash_y + 255;
191                 splash_text_ = obj =
192                         fl_add_text(FL_NORMAL_TEXT, text_x, text_y, 160, 16,
193                                     lyx_version);
194                 fl_set_object_lsize(obj, FL_NORMAL_SIZE);
195                 fl_mapcolor(FL_FREE_COL2, 0x2b, 0x47, 0x82);
196                 fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
197                 fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
198                 fl_set_object_lcol(obj, FL_FREE_COL3);
199                 fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
200                 fl_set_object_lstyle(obj, FL_BOLD_STYLE);
201         }
202
203         scrollbar = obj = fl_add_scrollbar(FL_VERT_SCROLLBAR,
204                                            x + w - 15,
205                                            y, 17, h, "");
206         fl_set_object_boxtype(obj, FL_UP_BOX);
207         fl_set_object_resize(obj, FL_RESIZE_ALL);
208         fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
209         obj->u_vdata = this;
210         fl_set_object_callback(obj, C_WorkArea_scroll_cb, 0);
211         fl_set_scrollbar_bounds(scrollbar, 0.0, 0.0);
212         fl_set_scrollbar_value(scrollbar, 0.0);
213         fl_set_scrollbar_size(scrollbar, scrollbar->h);
214         
215         ///
216         /// The free object
217
218         int const bw = int(abs(fl_get_border_width()));
219  
220         // Create the workarea pixmap
221         createPixmap(w - 15 - 2 * bw, h - 2 * bw);
222
223         // We add this object as late as possible to avoit problems
224         // with drawing.
225         if (lyxerr.debugging(Debug::WORKAREA))
226                 lyxerr << "\tfree object: +"
227                        << x + bw << '+' << y + bw << ' '
228                        << w - 15 - 2 * bw << 'x'
229                        << h - 2 * bw << endl;
230
231         work_area = obj = fl_add_free(FL_ALL_FREE,
232                                       x + bw, y + bw,
233                                       w - 15 - 2 * bw, // scrollbarwidth
234                                       h - 2 * bw, "",
235                                       C_WorkArea_work_area_handler);
236         obj->wantkey = FL_KEY_ALL;
237         obj->u_vdata = this; /* This is how we pass the WorkArea
238                                 to the work_area_handler. */
239         fl_set_object_boxtype(obj,FL_DOWN_BOX);
240         fl_set_object_resize(obj, FL_RESIZE_ALL);
241         fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
242
243         /// X selection hook - xforms gets it wrong
244         fl_current_form->u_vdata = this;
245         fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_WorkAreaEventCB);
246
247         fl_unfreeze_all_forms();
248 }
249
250
251 WorkArea::~WorkArea()
252 {
253         if (workareapixmap)
254                 XFreePixmap(fl_get_display(), workareapixmap);
255 }
256
257
258 void WorkArea::resize(int xpos, int ypos, int width, int height)
259 {
260         fl_freeze_all_forms();
261
262         int const bw = int(abs(fl_get_border_width()));
263
264         // a box
265         fl_set_object_geometry(backgroundbox, xpos, ypos, width - 15, height);
266
267         //
268         // THE SCROLLBAR
269         //
270         fl_set_object_geometry(scrollbar, xpos + width - 15,
271                                ypos, 17, height);
272
273         // Create the workarea pixmap
274         createPixmap(width - 15 - 2 * bw, height - 2 * bw);
275
276         // the free object
277         fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
278                                width - 15 - 2 * bw,
279                                height - 2 * bw);
280
281         fl_unfreeze_all_forms();
282 }
283
284
285 namespace {
286 void destroy_object(FL_OBJECT * obj)
287 {
288         if (!obj)
289                 return;
290
291         if (obj->visible) {
292                 fl_hide_object(obj);
293         }
294         fl_delete_object(obj);
295         fl_free_object(obj);
296 }
297 } // namespace anon
298
299
300 void WorkArea::createPixmap(int width, int height)
301 {
302         // Three calls to createPixmap are needed to draw the initial view
303         // of LyX. Any more and the splash is destroyed.
304         static int counter = 0;
305         if (++counter == 4) {
306                 destroy_object(splash_);
307                 splash_ = 0;
308                 destroy_object(splash_text_);
309                 splash_text_ = 0;
310         }
311
312         static int cur_width = -1;
313         static int cur_height = -1;
314
315         if (cur_width == width && cur_height == height && workareapixmap)
316                 return;
317
318         cur_width = width;
319         cur_height = height;
320
321         if (workareapixmap)
322                 XFreePixmap(fl_get_display(), workareapixmap);
323
324         if (lyxerr.debugging(Debug::WORKAREA))
325                 lyxerr << "Creating pixmap ("
326                        << width << 'x' << height << ")" << endl;
327
328         workareapixmap = XCreatePixmap(fl_get_display(),
329                                        RootWindow(fl_get_display(), 0),
330                                        width,
331                                        height,
332                                        fl_get_visual_depth());
333         if (lyxerr.debugging(Debug::WORKAREA))
334                 lyxerr << "\tpixmap=" << workareapixmap << endl;
335 }
336
337
338 void WorkArea::greyOut() const
339 {
340         if (!splash_) {
341                 fl_winset(FL_ObjWin(work_area));
342                 fl_rectangle(1, work_area->x, work_area->y,
343                              work_area->w, work_area->h, FL_GRAY63);
344         }
345 }
346
347
348 void WorkArea::setFocus() const
349 {
350         fl_set_focus_object(work_area->form, work_area);
351 }
352
353
354 void WorkArea::setScrollbarParams(int height, int pos, int line_height)
355 {
356         // we need to cache this for scroll_cb
357         doc_height_ = height;
358
359         if (height == 0) {
360                 fl_set_scrollbar_value(scrollbar, 0.0);
361                 fl_set_scrollbar_size(scrollbar, scrollbar->h);
362                 return;
363         }
364
365         long const work_height = workHeight();
366
367         lyxerr[Debug::GUI] << "scroll: height now " << height << endl;
368         lyxerr[Debug::GUI] << "scroll: work_height " << work_height << endl;
369  
370         /* If the text is smaller than the working area, the scrollbar
371          * maximum must be the working area height. No scrolling will
372          * be possible */
373         if (height <= work_height) {
374                 lyxerr[Debug::GUI] << "scroll: doc smaller than workarea !" << endl;
375                 fl_set_scrollbar_bounds(scrollbar, 0.0, 0.0);
376                 fl_set_scrollbar_value(scrollbar, pos);
377                 fl_set_scrollbar_size(scrollbar, scrollbar->h);
378                 return;
379         }
380
381         fl_set_scrollbar_bounds(scrollbar, 0.0, height - work_height);
382         fl_set_scrollbar_increment(scrollbar, work_area->h - line_height, line_height);
383
384         fl_set_scrollbar_value(scrollbar, pos);
385
386         double const slider_size =
387                 (height == 0) ? 1.0 : 1.0 / double(height);
388
389         fl_set_scrollbar_size(scrollbar, scrollbar->h * slider_size);
390 }
391
392
393 // callback for scrollbar slider
394 void WorkArea::scroll_cb()
395 {
396         double const val = fl_get_scrollbar_value(scrollbar);
397         lyxerr[Debug::GUI] << "scroll: val: " << val << endl;
398         lyxerr[Debug::GUI] << "scroll: height: " << scrollbar->h << endl;
399         lyxerr[Debug::GUI] << "scroll: docheight: " << doc_height_ << endl;
400         scrollDocView(int(val));
401         waitForX();
402 }
403
404
405 int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
406                                 FL_Coord, FL_Coord ,
407                                 int key, void * xev)
408 {
409         static int x_old = -1;
410         static int y_old = -1;
411         static long scrollbar_value_old = -1;
412
413         XEvent * ev = static_cast<XEvent*>(xev);
414         WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
415
416         if (!area) return 1;
417
418         switch (event) {
419         case FL_DRAW:
420                 if (!area->work_area ||
421                     !area->work_area->form->visible)
422                         return 1;
423                 lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
424                 area->createPixmap(area->workWidth(), area->workHeight());
425                 area->workAreaExpose();
426                 break;
427         case FL_PUSH:
428                 if (!ev || ev->xbutton.button == 0) break;
429                 // Should really have used xbutton.state
430                 lyxerr[Debug::WORKAREA] << "Workarea event: PUSH" << endl;
431                 area->workAreaButtonPress(ev->xbutton.x - ob->x,
432                                           ev->xbutton.y - ob->y,
433                                           x_button_state(ev->xbutton.button));
434                 break;
435         case FL_RELEASE:
436                 if (!ev || ev->xbutton.button == 0) break;
437                 // Should really have used xbutton.state
438                 lyxerr[Debug::WORKAREA] << "Workarea event: RELEASE" << endl;
439                 area->workAreaButtonRelease(ev->xbutton.x - ob->x,
440                                       ev->xbutton.y - ob->y,
441                                       x_button_state(ev->xbutton.button));
442                 break;
443 #if FL_VERSION < 1 && FL_REVISION < 89
444         case FL_MOUSE:
445 #else
446         case FL_DRAG:
447 #endif
448                 if (!ev || ! area->scrollbar) break;
449                 if (ev->xmotion.x != x_old ||
450                     ev->xmotion.y != y_old ||
451                     fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
452                         ) {
453                         lyxerr[Debug::WORKAREA] << "Workarea event: MOUSE" << endl;
454                         area->workAreaMotionNotify(ev->xmotion.x - ob->x,
455                                              ev->xmotion.y - ob->y,
456                                              x_motion_state(ev->xbutton.state));
457                 }
458                 break;
459 #if FL_VERSION < 1 && FL_REVISION < 89
460         case FL_KEYBOARD:
461 #else
462         case FL_KEYPRESS:
463 #endif
464         {
465                 lyxerr[Debug::WORKAREA] << "Workarea event: KEYBOARD" << endl;
466
467                 KeySym keysym = 0;
468                 char dummy[1];
469                 XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
470 #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
471                 // XForms < 0.89.5 does not have compose support
472                 // so we are using our own compose support
473                 LyXLookupString(ev, dummy, 1, &keysym);
474 #else
475                 XLookupString(xke, dummy, 1, &keysym, 0);
476 //              int num_keys = XLookupString(xke, dummy, 10, &keysym, &xcs);
477 //              lyxerr << "We have " << num_keys << " keys in the returned buffer" << endl;
478 //              lyxerr << "Our dummy string is " << dummy << endl;
479 #endif
480                 if (lyxerr.debugging(Debug::KEY)) {
481                         char const * tmp = XKeysymToString(key);
482                         char const * tmp2 = XKeysymToString(keysym);
483                         string const stm = (tmp ? tmp : "");
484                         string const stm2 = (tmp2 ? tmp2 : "");
485
486                         lyxerr[Debug::KEY] << "WorkArea: Key is `" << stm << "' ["
487                                << key << "]" << endl;
488                         lyxerr[Debug::KEY] << "WorkArea: Keysym is `" << stm2 << "' ["
489                                << keysym << "]" << endl;
490                 }
491
492 #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
493                 if (keysym == NoSymbol) {
494                         lyxerr[Debug::KEY]
495                                 << "Empty kdb action (probably composing)"
496                                 << endl;
497                         break;
498                 }
499                 KeySym ret_key = keysym;
500 #else
501                 // Note that we need this handling because of a bug
502                 // in XForms 0.89, if this bug is resolved in the way I hope
503                 // we can just use the keysym directly with out looking
504                 // at key at all. (Lgb)
505                 KeySym ret_key = 0;
506                 if (!key) {
507                         // We migth have to add more keysyms here also,
508                         // we will do that as the issues arise. (Lgb)
509                         if (keysym == XK_space) {
510                                 ret_key = keysym;
511                                 lyxerr[Debug::KEY] << "Using keysym [A]"
512                                                    << endl;
513                         } else
514                                 break;
515                 } else {
516                         // It seems that this was a bit optimistic...
517                         // With this hacking things seems to be better (Lgb)
518                         //if (!iscntrl(key)) {
519                         //      ret_key = key;
520                         //      lyxerr[Debug::KEY]
521                         //              << "Using key [B]\n"
522                         //              << "Uchar["
523                         //              << static_cast<unsigned char>(key)
524                         //              << endl;
525                         //} else {
526                                 ret_key = (keysym ? keysym : key);
527                                 lyxerr[Debug::KEY] << "Using keysym [B]"
528                                                    << endl;
529                                 //}
530                 }
531
532 #endif
533                 unsigned int const ret_state = xke->state;
534
535                 // If you have a better way to handle "wild-output" of
536                 // characters after the key has been released than the one
537                 // below, please contact me. (Lgb)
538                 static Time last_time_pressed;
539                 static unsigned int last_key_pressed;
540                 static unsigned int last_state_pressed;
541                 lyxerr[Debug::KEY] << "Workarea Diff: "
542                                    << xke->time - last_time_pressed
543                                    << endl;
544                 if (xke->time - last_time_pressed < 25 // should perhaps be tunable
545                     && ret_state == last_state_pressed
546                     && xke->keycode == last_key_pressed) {
547                         lyxerr[Debug::KEY]
548                                 << "Workarea: Purging X events." << endl;
549                         //lyxerr << "Workarea Events: "
550                         //       << XEventsQueued(fl_get_display(), QueuedAlready)
551                         //       << endl;
552                         if (XEventsQueued(fl_get_display(), QueuedAlready) > 0)
553                                 XSync(fl_get_display(), 1);
554                         // This purge make f.ex. scrolling stop immidiatly when
555                         // releasing the PageDown button. The question is if
556                         // this purging of XEvents can cause any harm...
557                         // after some testing I can see no problems, but
558                         // I'd like other reports too.
559                         break;
560                 }
561                 last_time_pressed = xke->time;
562                 last_key_pressed = xke->keycode;
563                 last_state_pressed = ret_state;
564
565                 area->workAreaKeyPress(ret_key, x_key_state(ret_state));
566         }
567         break;
568
569 #if FL_VERSION > 0 || FL_REVISION >= 89
570         case FL_KEYRELEASE:
571                 lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
572                 break;
573 #endif
574
575         case FL_FOCUS:
576                 lyxerr[Debug::WORKAREA] << "Workarea event: FOCUS" << endl;
577                 area->workAreaFocus();
578                 break;
579         case FL_UNFOCUS:
580                 lyxerr[Debug::WORKAREA] << "Workarea event: UNFOCUS" << endl;
581                 area->workAreaUnfocus();
582                 break;
583         case FL_ENTER:
584                 lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
585                 break;
586         case FL_LEAVE:
587                 lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
588                 break;
589         case FL_DBLCLICK:
590                 if (!ev) break;
591                 lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl;
592                 area->workAreaDoubleClick(ev->xbutton.x - ob->x,
593                                           ev->xbutton.y - ob->y,
594                                           x_button_state(ev->xbutton.button));
595                 break;
596         case FL_TRPLCLICK:
597                 if (!ev) break;
598                 lyxerr[Debug::WORKAREA] << "Workarea event: TRPLCLICK" << endl;
599                 area->workAreaTripleClick(ev->xbutton.x - ob->x,
600                                           ev->xbutton.y - ob->y,
601                                           x_button_state(ev->xbutton.button));
602                 break;
603         case FL_OTHER:
604                 if (!ev) break;
605                 lyxerr[Debug::WORKAREA] << "Workarea event: OTHER" << endl;
606                 break;
607         }
608
609         return 1;
610 }
611
612
613 namespace {
614
615 string clipboard_selection;
616 bool clipboard_read = false;
617
618 extern "C" {
619
620         static
621         int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
622                                  void const * data, long size)
623         {
624                 clipboard_selection.erase();
625
626                 if (size > 0)
627                         clipboard_selection.reserve(size);
628                 for (int i = 0; i < size; ++i)
629                         clipboard_selection +=
630                                 static_cast<char const *>(data)[i];
631                 clipboard_read = true;
632                 return 0;
633         }
634
635 }
636
637 } // namespace anon
638
639
640 int WorkArea::event_cb(XEvent * xev)
641 {
642         int ret = 0;
643         switch (xev->type) {
644                 case SelectionRequest:
645                         lyxerr[Debug::GUI] << "X requested selection." << endl;
646                         selectionRequested();
647                         break;
648                 case SelectionClear:
649                         lyxerr[Debug::GUI] << "Lost selection." << endl;
650                         selectionLost();
651                         break;
652         }
653         return ret;
654 }
655
656
657 void WorkArea::haveSelection(bool yes) const
658 {
659         if (!yes) {
660                 XSetSelectionOwner(fl_get_display(), XA_PRIMARY, None, CurrentTime);
661                 return;
662         }
663
664         XSetSelectionOwner(fl_get_display(), XA_PRIMARY, FL_ObjWin(work_area), CurrentTime);
665 }
666
667
668 string const WorkArea::getClipboard() const
669 {
670         clipboard_read = false;
671
672         if (fl_request_clipboard(work_area, 0, request_clipboard_cb) == -1)
673                 return string();
674
675         XEvent ev;
676
677         while (!clipboard_read) {
678                 if (fl_check_forms() == FL_EVENT) {
679                         fl_XNextEvent(&ev);
680                         lyxerr << "Received unhandled X11 event" << endl;
681                         lyxerr << "Type: 0x" << hex << ev.xany.type <<
682                                 " Target: 0x" << hex << ev.xany.window << endl;
683                 }
684         }
685         return clipboard_selection;
686 }
687
688
689 void WorkArea::putClipboard(string const & s) const
690 {
691         static string hold;
692         hold = s;
693
694         fl_stuff_clipboard(work_area, 0, hold.data(), hold.size(), 0);
695 }