-
Notifications
You must be signed in to change notification settings - Fork 15
/
CHANGES
2600 lines (1861 loc) · 107 KB
/
CHANGES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
+ Added SystemMenuBar for Apple OS X.
/////////////////////////////////////////////////////////////////////
+ Change ItemGroup to follow other group standards : now NO begin() is called
anymore in constructor, alternatively one can now use the MenuSection service
to automatically genenerate begin() / end () calls
see fluid/fluid_menus.cxx use and doxygen autodocumentation for more info
/////////////////////////////////////////////////////////////////////
+ New Widget image() extensions and API
now context dependent image() API has been added to the Widget
it is now possible to affect up to 4 different images for common events.
it is also possible to use alternatively on MultipleImage even more,
up to 8 different combination of flags see buttons demo for use of these new API
+ new Browser features and API
now it is possible to affect images to node depending on their state closed, open and belowmouse.
new tree API available to rapidly implement load tree browser with arborescent data (add_leaf(),
add_group(), set_symbol(), get_symbol()) see browser demo for demonstrating these new features
+ More genericity to Image and derived classes, now SharedImage::get() allow to load an image
from its name without specifying it's type.
+ Generic fetch() Image method allow to preload an image without drawing it, then new dimension
info. api will allow to dynamically discover its pixel type, depth, scanline size, and other
useful parameters. Used in FileIcon2.cxx to load generically any image with a pixel buffer
or pixmap data buffer.
+ Smart adjustements made to symbols in widgets when image data doesn't match widget size
but still widget has a border
+ Added generic color_average() Image algo and inactive() API to Image base class, quite differently
from fltk1.1.x, in fltk2 this algo is generic so it will suit potentially any kind of image
and pixel depth (tested successfully with pixmaps, png, jpegs).So now inactive images can have
its data modified by calling inactive() method as in fltk1.1.x to desaturate them. see buttons demo
for demonstration. Still one can override this color_average() method to change the algo.
/////////////////////////////////////////////////////////////////////
1. Fl_Window::clear_border() will remove the border from a window,
and Fl_Window::border() will return false if this has been done.
The functions set_border() and border(value) have been deleted.
You can no longer toggle the border on/off. This only worked on
IRIX 4Dwm (and flwm) and did not work on WIN32. This was only used
by Fl_Window::fullscreen to work on IRIX, this hack is now
localized to the fullscreen() method.
On X turning off the border causes "override redirect". This is
only good for short-lived windows where you either don't care if
they get buried or if you have Fl::grab() on. However this is the
only reliable and fast way to get a window with no border and is
exactly what is wanted for menus and tooltips and that is what fltk
needs now so that is what it is going to do...
On X turning off the border also turns on X "save_under" which on
many X servers (like XFree86) can make the window pop-down much
faster. This *would* be nice for modal() windows but it looks like
most window managers do not move this property from the child to
the border, so setting it is worse than useless.
2. Fltk no longer moves windows from the specified position() to try
to get them on the screen. Notice that most (all?) X window
managers do this anyway, so if you are developing under X make
sure you are not accidentally placing windows off-screen, in case
you want to run on WIN32 or on other X window managers.
A new method Fl_Window::move(x,y) is the same as position(x,y) but
it clamps the position such that the border and contents of the
window stay on the screen.
The Fl_Window::hotspot(x,y) methods also do this clamping. They
take an optional third boolean argument "offscreen", which if true
will disable the clamping.
3. Fl_Window::show_inside(window) will make the window with a normal
system border and behavior, but place it inside the other window as
though it was the desktop. This is what Windows calls "mdi
interface". Typically the other window (which must already be
shown) is a child window so that space can remain around it for a
title bar.
Notice that parent() of the window must be zero and it will remain
zero after this is called. Fltk uses a zero parent to indicate
that the system is managing the window.
On systems that don't support nested desktops (ie X) this does
show(window), which produces a normal overlapping window, which
IMHO is actually a much nicer interface. Iconizing the outer
window will iconize all the inside windows for most X window
managers.
4. Menu items have a new flag, FL_MENU_STAYS_UP. This indicates that
picking this item does the callback but does not dismiss the menu.
Normal check+radio buttons are back to the original behavior. You
can set this flag on any items you want, not just check+radio.
These changes have been typed into the WIN32 code but have not been
tested!
CHECKED IN 10/2/99
////////////////////////////////////////////////////////////////
Cleaned up and sped up the Fl_Group code (suggestions from Curtis)
Removed the hack that saved a malloc for 1 child of a group. This
allows Fl_Group::array() to be an inline method, which probably saves
more space than the hack did.
Simplified Fl_Valuator by making step_ a single value.
Cleaned up the code for Fl_Slider a lot.
Fl_Slider::slider_size() is now an integer number of pixels. This may
be incompatable but makes it possible to draw fixed-sized glyphs as
the slider. I added a method slider_position(W,S) so that a subclass
can find out the pixel position of the slider in order to draw it.
Fl_Scrollbar now has a minimum slider_size of a square, and clicking
outside the slider causes page up/down.
CHECKED IN 10/3/99
////////////////////////////////////////////////////////////////
Fl_Gl_Window::ortho() sets the glViewport() to maximum size and places
the upper right corner at the upper right of the window. This is so
that text and images can have origins outside the bottom or left edges
and still draw.
Disabled XDBE use everywhere. It does not work on the newest versions
of Irix (on Octanes and Infernos) and I give up. The code is there
but ./configure turns it off for everybody.
Some other fixes from 1.0.6
////////////////////////////////////////////////////////////////
Much simpler and *minimal* thread support in Fl_lock.cxx. I was
worried about fltk getting too far away from it's job of doing GUI.
This minimal version has 3 calls: Fl::lock(), Fl::unlock(), and
Fl::awake(). Fl::lock() serves the "initialization" purpose.
To create threads or do any other locks requires non-fltk code. This
is probably "correct" in that this is not fltk's job, but it may be
too much of a pain and may cause people to write non-portable code.
So it may pay off to put the portable wrappers back in?
Other changes:
I moved the creation of the pipe to Fl::lock() and other changes so
that if it is not called the overhead is minimal.
Fl::lock() is a "recursive lock". This makes the Windoze version and
Unix version match.
On Windoze it uses a "CRITICAL_SECTION" rather than a "mutex". This
is much lighter object since it is process-local and is the
equivalent of a pthread mutex.
////////////////////////////////////////////////////////////////
Simpler plugin support:
The function fl_load_plugin(name, type) tries each of the following
locations to load a shared object:
$HOME/.type/name (on Windoze it uses $WINDIR if $HOME not set)
/usr/local/lib/type/name
/lib/type/name
The first one it finds it then loads, and it runs "main(int argc,
char**argv)" with argc == 1 and argv[0] == plugin file name (this
allows relative pathnames to be used by the plugin). I used "main"
because C++ does not mangle the name, if everybody thinks this is
stupid we could probably go back to the fltk_plugin idea.
fl_load_plugin() returns true if the plugin was found and main() returns
zero.
Fltk itself calls this function ONCE, like this (ps this is not done
by the Windows version yet):
fl_load_plugin(theme, "fltk/themes");
where "theme" is either the -theme switch or "default".
The plugin is free to call fl_load_plugin itself if it needs several
pieces of code.
Several rather simple examples of plugins are provided in the themes
subdirectory. To use them link this directory to ~/.fltk/themes. If
we want to write a theme that parses a file, I suggest we look into
reading KDE themes, though it should not be hard to write one that
reads the existing files.
////////////////////////////////////////////////////////////////
I rewrote Fl_Style_Definer so that the list of styles is publically
accessible, thus allowing the plugins to read them.
////////////////////////////////////////////////////////////////
Fixed the Fl_Color_Chooser so the color chips are visible.
Checked in oct 27
////////////////////////////////////////////////////////////////
FL_SYMBOL_LABEL obeys alignment (makes them square too, without the #
sign)
Fixed the buttons vanishing in the label demo program (this was a
problem with the forms emulation).
fl_width uses XTextWidth, which should allow kerning fonts to work
(though I suspect X does not support these anyway). We should use
GetTextExtents on Win32.
Made the sliders & scrollbars highlight when you are pointing at the
trough.
Fixed the pagesize of the scrollbars.
Removed the remaining occurances of \nnn printing of characters from
labels and input widgets.
Checked in 11/2
////////////////////////////////////////////////////////////////
Alexandar Mai's changes for OS2
Larry Charltons changes for Borland C++.
Moved all the forms emulation and glut emulation to their own source
files. They are now under ./forms and ./glut in the top-level
directory.
Tried to clean up the lock/unlock. I moved the entire implementation
of Fl_Mutex and and fl_create_thread to the header file as inline
functions. Also added Fl_SignalMutex, which is both a mutex and a
signalling mechanism between threads.
You MUST call Fl::lock() to initialize the thread support, so I moved
the initialization there. The reason is that if fltk tries to do
unlock() without lock() having been done pthreads can crash (or at
least go into a bad state). Fixed the demo program to do this.
Restored old version where Fl_Widget::color(), etc are simple inline
functions! This was an awful lot of work. See the email.
Checked in 11/6
////////////////////////////////////////////////////////////////
Removed aspect ratio from size_range. This is unsupported on Win32
and on many X window managers.
Replaced Fl_Style_Definer with Fl_Named_Style subclass. This should
avoid problems with static variables not being created by the
compiler, and is also a lot simpler. Need to do the same thing for
the boxtypes, too...
All the styles are named with the class name with "Fl_" stripped from
the start. However I fixed the lookup function so that '_' and ' '
match.
Removed Fl_Box::default_style. It is (I believe) useless for a
theme to modify this one.
Fixes win_gravity.
Fixed fluid to not require libfltk_forms
Removed the "no box fudge factors" from fl_glyph. The callers should
adjust the area correctly instead. I have found that such factors in
the lower levels are a real pain to get around.
////////////////////////////////////////////////////////////////
Rewrote the glpuzzle demo program to not use glut and put this in the
test directory (the original still remains in the glut directory)
Fl_Style uses the existence of the revert function to determine if
they are local or not, got rid of the "dynamic" member.
Put the inactive boxtypes code back, but this time I fixed the code so
it produces the same colors (rounded to the nearest entry in the
colormap) as Carl's code does. The output looks identical to me.
Also restored the box edge patterns to the less-motif and more rounded
style I was using (not sure if this was intended by Carl or a
mistake).
////////////////////////////////////////////////////////////////
Removed the highlight value from Fl_Boxtype. Replaced with a
boxdrawing function that draws flat normally and another box type if
either highlight or value is on. The value is passed to this other
boxtype, so it can draw up/down as necessary.
Got rid of the cast-away-const stuff in Fl_Menu_Item::draw. This does
not work anyway as the menu-title flag is not set until the first time
the item is drawn, preventing modifications to the menu title from
inheriting from the menu-title style. Instead it directly references
the menu-title style for box&color, ignoring the menu item's style.
It also directly references the menu_item default style in some cases
to get around menu items which set the selection color.
Made both the menu items and the menu titles use "selected" colors to
indicate that they are chosen. This makes them consistent with each
other. Note that themes that set the highlighted color on menu items
have to change to set the selected color instead.
Made Fl_Style::dynamic() be an inline method.
Moved all the Fl_Style code into it's own source file, also merged in
the Fl_Input_Style code to it.
Added "leading" to the style structure. This is extra line spacing
between text items. The Fl_Browser, Fl_Input/Output, and menu windows
use this. Replaces fl_extra_menu_spacing. The default is zero except
for menu windows which default to 4. Unfortunately the menu item box
size is added to this, so if you set the menu item box you probably
need to change this value. Perhaps this box and the selected color
should be on the menu window style so all the related stuff is in the
same place?
////////////////////////////////////////////////////////////////
Fixed the fonts demo to show characters with the high bit set
(including the "hole" that MicroSoft filled in on their fonts)
I want the default appearance to be *identical* on all platforms. If
this means changing it to be more windoze-like for people to accept
the toolkit as-is, then I'll do that. Current differences from win98
appearance are:
1. The black triangles in menus and scrollbar buttons are larger.
2. Vertical spacing between menu items is much smaller.
3. Highlighting of menubar is disabled, to be consistent with the fact
that highlight is disabled everywhere else.
4. Check boxes and radio buttons in menus look just like check and
radio buttons on the main windows.
5. The shading of button borders were selected to look more rounded and
friendly, and they do match *some* Win32 applications.
Changes required:
Made FL_NORMAL_SIZE be 12 (it is recommended you shrink all your
widgets to match, for instance menubars should be 25 pixels tall).
Made FL_HIGHLIGHT_UP/DOWN_BOX draw a THIN box. We do not seem to be
using the FL_FLAT_UP/DOWN_BOX and maybe these should be deleted.
Carl: if the user changes the colors on windoze it will wipe out any
loaded theme. I recommend you split the color-setting portion from
the rest of fl_windows() and put it as a static function into
Fl_win32. Call it when the first window is shown and in response to
the event. Don't call fl_windows() anywhere by default. Also remove
the duplicate code from Fl::arg().
////////////////////////////////////////////////////////////////
It uses the current font size instead of fl_height() to measure text
vertically. This I think it the source of differences in appearance
between X and Win32. On X the font reports a height that is often
much larger than the point size used to select it. This also requires
widgets to open the display just to measure themselves. With this fix
the default "leading" of 2 looks correct (and in fact it cannot be
less than 2 for some X fonts, although True Type fonts are ok).
While I was at it I changed fl_width to return int instead of double.
Almost every call just cast it to int anyway. (if a system ever
returns float we can add a new call for that)
Fl_Tile and Fl_Tabs do their callback() on changes made by the user.
////////////////////////////////////////////////////////////////
Stopped embossed boxes from drawing engraved when pushed. This seems
more consistent with Carl's other boxes.
Restored the 3-d choice mark. But maybe a down-arrow would be
better. I altered the code so the FL_Choice and Fl_Menu_Button draw
the glyph in exactly the same position and size.
////////////////////////////////////////////////////////////////
Made the individual glyph functions private to the widgets that use
them. You can still replace them in styles, and even call them by
copying the pointer out of the default style.
Make draw_glyph() check active_r(), as all calls to it were doing
this. This cut out some code.
Tried to fix the indented glyph types in fl_windows.cxx.
////////////////////////////////////////////////////////////////
Made the FL_UP_BOX and FL_NORMAL_BOX back to the same thing. This
change had broken several old programs that hard-coded the name
FL_UP_BOX into them. This also removed some ugly stuff that was done
to try to keep the box edge patterns working (a better solution would
have been to make the "normal" box be it's own class).
Changed the calls to get the wheel deltas to inline functions that
match the design of fltk better. They are Fl::event_dx(), etc.
Deleted the "wheel mode" (if an X user wants to disable the wheel they
can do so by setting the button numbers to zero).
Removed the configuration for the wheel. In particular I wanted to
make sure that calls to "getconf" are not in any source code other
than options, so that we can rewrite this before release to a straight
parser. The wheel now reports it's position in "pixels" (assumming
that each click is 12 pixels, which appears to be MicroSoft's intent).
Browser changed to have the wheel move by "pixels" and to do something
(not sure if it is correct) if wheel is moved with a button held down.
Rearranged and simplified the Fl.cxx and Fl_Group.cxx event handling
so the new FL_MOUSEWHEEL events are handled by the same case as
several other events, and hopefully new events will also go there.
////////////////////////////////////////////////////////////////
Made fl_rgb(const char*) understand KDE nnn,nnn,nnn format. This gets
rid of the need for a special parser for KDE. Removed
Fl_get_system_colors.cxx and split it into fl_rgb.cxx and
fl_background.cxx. The functions fl_foreground and fl_text_background
were removed as they are not used by themes.
I redid most (all?) of the changes Carl accidentally deleted. In
particular this includes the reservation of FL_KEYUP event number and
the rewriting of the Fl.cxx and Fl_Group.cxx event handling code.
At the moment the wheel moves by 14*3 pixels per 120 units reported by
Windows (or per single click reported by X) to correspond to 3 lines
at standard line spacing. Still awaiting information about how the UI
really works, as the current one makes very little sense. I just
deleted the configuration stuff, but if we want it we must move the
"setting" to fl_options.cxx, like all the other settings are. (I
would prefer not to have UI-behavior options if at all possible, as it
can lead to extreme bloat).
Further investigation of the boxtypes shows that the "down" boxes are
incompatable with fltk1.0, in that making a "down" button and pushing
it would display an "up" box. I changed the box definitions to do
this. This revealed several places in fl_glyph where it was
accidentally sending FL_VALUE to the glyph box, which I suspect is why
Carl had problems with the previous up box. I tried to fix all the
occurances I found, but there may be a few more. "highlight_down_box"
will not work (it will go up when pushed) but I could not find any
code that used it, so we may just want to remove it? I tried the
Alternative theme and scheme in several test programs and did not see
any problems.
////////////////////////////////////////////////////////////////
More work on keyboard navigation. Still having problems with tabs.
Cleaned up Fl_Widget.H:
Got rid of the geti/seti functions and wrote them as real functions,
this made the code shorter in even the simplest programs (probably
because the savings of not passing an argument to the function more
than outweighed the additional code of one function per style entry).
Removed the need for Fl_Group to be a friend by making several
protected functions public. This should also eliminate the need for a
lot of kludges with the Fl_X class used to get around protection of
the Fl_Window, but I have not fixed this yet.
Larry Charlton's fix so input/output can scroll due to position()
calls even if they don't have the focus.
////////////////////////////////////////////////////////////////
Fixed selection of multiline Fl_Input when mouse is dragged out top of
the widget, it puts point at start of text rather than the end.
Fl_Input "grabs" the focus on FL_SHORTCUT if the user types any
letters and nothing responds to the FL_KEYBOARD event. This allows
the navigation to be done without the annoying "dead keyboard" effect
of other systems.
It looks like only buttons can use the boxtype focus highlighting, and
even then the colors are wrong. *All* other widgets need to
special-case the drawing code.
Vincent's change to make FL_NO_BOX draw highlighting broke Fl_Dial and
any other widget that assummes it can do minimum update (because the
widget is erased before it's draw() is called). Not sure how to fix
this. It also looks like only buttons are able to use the boxtype
focus code (all other widgets need to draw the selection in their own
way). If the code was moved to draw_button() it could also use the
labelcolor to draw the focus so it is visible on dark-colored buttons.
For now vincent's code only happens if FL_DAMAGE_HIGHLIGHT is on on
the widget.
////////////////////////////////////////////////////////////////
Keyboard focus now works for the following:
Buttons (space fires the button). Clicking on a button gives it focus.
Menu buttons and choices work, space brings up the menu.
All valuators except scrollbars. The arrows, space, backspace, home,
and end move the. The sliders/rollers only use arrows in the
direction they point, allowing other arrows to do navigation. All
valuators have a linesize() and pagesize(), which are integer numbers
of the step() value to move on an arrow or shift-arrow.
Tabs work very much like Windoze. You can use Ctrl+Tab to cycle the
tabs enclosing the focus. You can also navigate to the tabs and use
left/right arrows or space/backspace to switch tabs.
Browser works, not extensively tested, but it looks good to me.
Input fields grab the focus back if the user starts typing letters,
hopefully getting rid of the "dead text field" effect that Windoze and
Motif have. This works great if there is a single text field, but
this may need some work if there are multiple ones (it currently goes
to the last text field).
Scrollbars specifically refuse the focus. This is to prevent them
from being navigated to when grouped into a scroll or browser.
Menubars are not done yet. They will have a default shortcut of the
alt down/up keystroke (but fltk needs some fixes to detect this), this
will put them in exactly the same mode as though you clicked on the
title of the first menu (ie it is already opened!).
////////////////////////////////////////////////////////////////
add_idle adds the new callback to the end of the idle list, rather
than the start, as suggested by Cliff Miller. Allows a callback to
remove/add itself.
Fixed the redraw of the huge scrolling menu (it was not testing for
the FL_EXPOSE_DAMAGE bit)
Fixed the bad redraw of the checkmark in the menu of the menubar demo
(caused by it using the wrong color for a highlighted menu title if
the highlight color was zero)
////////////////////////////////////////////////////////////////
I think I have sucessfully migrated all of Carl's stuff so it is a
plugin, yet works EXACTLY the same. See below for description of the
fltk interface to theme plugins. This IMHO is highly desirable as it
removes the database and string constants from the base fltk code, as
it is *extremely unlikely* these will have anything to do with any
standard multi-toolkit theme system that may appear, since fltk is not
quite in a standards-setting position yet :-)
Since one theme can call another (mostly I needed to remove the revert
calls from them and put that call in loadtheme), I migrated the
fl_windows, fl_motif, etc functions back as theme plugins as well.
This is the intention of plugins, they aren't just supposed to call a
single function back in the main program!
This still needs some work. It would be nice if most possibilities
could be named with a single keyword. Maybe: if the named theme
plugin is missing, the theme name is passed as an argument to the
default theme plugin?
changes:
Moved the code in fl_windows, fl_motif, fl_kde, fl_kde_colors,
fl_options, and conf* out of the library and to the themes
subdirectory. See other email describing this. PLEASE READ, I
believe this new system works EXACTLY the same!
Changed the config symbol FLTK_LIBDIR to CONFIGDIR and made it contain
the "/lib/fltk" portion so that can be changed by the programmer.
Removed the "schemes" that simply loaded a theme without doing
anything else (Classic, Essai, KDE1, Motif, Windows). These work with
my rewrite, I removed them just to try to reduce the file count and
some confusion.
Removed some unused arguments from the Fl_Menu.cxx functions.
Added a (possibly quite slow) version of fl_font(name) to return fonts
by name, used this to replace code in the themes.
DESCRIPTION OF NEW THEMES CODE:
Fl::theme() indicates a plugin to load. Fl::scheme() is now just a
text argument passed in argv[1] of fltk_theme, the theme can interpret
it any way it wants, though usually it will be a filename for it to read.
The default theme is "default" and the default scheme is null. A
theme of null causes no theme plugin to be loaded.
Fl::theme(theme, scheme=0) changes the current theme. If any themes
have been loaded then they are replaced and a redraw is done. This
checks if the theme+scheme is unchanged and returns quickly in that
case.
Fl::scheme(scheme) is emulated by calling Fl::theme(theme(), scheme).
Fl::loadtheme() ensures the current theme is loaded (normally this is
delayed until the first window is shown).
Fl::reloadtheme() forces the current themes to be reexecuted (this is
usually called in response to an event that indicates that data from
the outside world has changed).
Fl::loadtheme(name,scheme=0) allows multiple themes to be loaded atop
each other (it does not reset things).
Fl::theme_unloader(void (*)()) allows a theme to register a call that
should be made to get itself unloaded (mostly to remove event handlers
for dynamically changing themes). Currently only the last one is
remembered!
////////////////////////////////////////////////////////////////
Renamed fl_set_fonts.cxx to fl_list_fonts.cxx (since that is the name
of the function it defines). Added a TOTALLY UNTESTED fl_list_fonts()
to the win32 version.
Added fl_font() and fl_size() that return the most recent values
passed to fl_font(font,size). These can be used to save/restore the
font or to check which one is in use in labeltype functions, and to
avoid having to track it yourself in complex drawing operations.
Patches from Alexander Mai for OS2, mostly to the file chooser
drive-listing code.
The glyph() function is now responsible for changing the color of the
label in response to FL_INACTIVE, the color passed to it is normal.
This matches how label and box drawing functions work, allows a lot
more freedom to design the glyph functions, eliminated some code, and
I found lots of code assummed this anyway...
////////////////////////////////////////////////////////////////
Fixed Fl_Pixmap (constructor was written wrong)
Setting both FL_ALIGN_LEFT|FL_ALIGN_RIGHT on a label makes it cut
the left off if it is too big, but align to the left if it is
smaller. This is very useful for displaying pathnames in buttons in
the file chooser!
Also does the same thing vertically with FL_ALIGN_TOP|FL_ALIGN_BOTTOM.
It now produces FL_KEYUP events, and the menubar uses them: tapping
Alt is a shortcut into/out of the menubar! (To check for a shift
key being "typed" you must look for the 'up' event and also check
Fl::event_clicks() for non zero. This is true if the same key is used
for two events in a row, and is thus only true if the key went down
and up without any intermediate keys)
Calls layout() on windows before they are shown (but after the theme
is loaded). This should be useful for widgets that do automatic
layout, and gets rid of the need to call it yourself.
Nifty new resizable() demo program, as suggested by Curtis. Shows a
realistic layout and some instructions.
////////////////////////////////////////////////////////////////
Added fl_nearest_color(color) to convert an rgb color to the nearest
index.
Some more cleanup of the styles code. Made most of the default styles
private variables in the source code.
Added Fl_Widget::damage_label() which marks outside labels to be
redrawn. This does the correct logic and should replace calls to
damage(FL_DAMAGE_CHILD_LABEL). Used this to fix the red/black labels
in fluid. Also sorted the fluid control panels so keyboard navigation
works.
Fixes to window positioning from inside the program. Fixed the huge
menu. Added a timeout so huge menus autoscroll without having to move
the mouse.
////////////////////////////////////////////////////////////////
Made fl_load_plugin take the argc,argv values directly, rather than
creating them. Moved the code to test for setuid programs and to make
the argc,argv over to fl_load_theme().
If the theme() is not found as a plugin, and there is no scheme() set,
it tries loading the default theme using theme() as the scheme. I.e
if you run it with "-theme blah" and there is no blah.fltp, it acts as
though you typed "-scheme blah". For most users this means that only
the theme() ever needs to be set, and a GUI (like in Fluid) to pick a
theme only needs to set a single string. The only reasons to set the
scheme() are: to pass a string to a non-default theme; or to get a
scheme that has the same name as a theme.
Space selects items off menus (necessary for Choice emulation).
Default style for Choice looks/acts a lot more like a Windows "Combo Box".
The up/down arrows work to change the current item. I also fixed the
classic and motif themes to look like before (although they look a bit
strange if the choice has the keyboard focus).
////////////////////////////////////////////////////////////////
Fltk 2.0 has been changed so that menu items are normal widgets.
Although this complicates some of the simple demo programs, it greatly
improves the usability in large programs with dynamic menus, and
removes a great deal of kruft from fluid.
Fl_Menu_ (and Fl_Menu_Bar, Fl_Choice, and Fl_Menu_Button) are now
subclasses of Fl_Group. Three new widgets: Fl_Item, Fl_Item_Group,
and Fl_Divider have been created to make items that go into menus.
You can put arbitrary widgets into the menu, which produces
interesting visual effects. For future compatability your widgets
should return 0 for any events sent to handle(), or should have
output() or inactive() turned on.
Older code that uses Fl_Menu_Item arrays or Fl_Menu_::add() is
emulated reasonably well, by creating child Fl_Items to copy the
data. The main incompatability is that subsequent changes to the
Fl_Menu_Item array have no effect (since it was copied), and the
functions that return Fl_Menu_Item pointers are either unimplemented
or they return pointers to Fl_Widget instead.
Still to be done: I intend to rewrite the browser in exactly the same
way, so each item is a widget. "lightweight" groups, which generate
widgets on the fly, so that a 10,000 item browser does not need the
space for 10,000 widgets. Fluid needs to be able to create dividers
and should somehow read old setups with dividers in them. Fluid's
internal code should be rewritten to not use Fl_Menu_Items. The file
chooser compiled, but crashes when it attempts to change the items in
the menu. This needs to be tracked down, it may indicate a bug in the
new menu emulation code.
DETAILS:
These changes caused lots of other changes to be made to the fltk
code, mostly (I hope) these are improvements, in some cases they were
just necessary so that menu items could be treated just like widgets:
Many changes to Fl_Group to make it more useful as a base class for
Fl_Menu_:
Fl_Group::remove(index) - removes a child by index number
Fl_Group::replace(int index, Fl_Widget&) - replace a child
Fl_Group::replace(Fl_Widget&, Fl_Widget&) - replace a child
Fl_Widget* Fl_Group::focus(), Fl_Group::focus(int) - the index of
the child of the group that contains the focus. This value is
reused by Fl_Menu_ to track the current item.
Fl_Widget::take_focus() "works" all the time now. If the system is
not giving focus to one of this application's windows, or the widget
is not in a visible window, the widget will get the focus when the
window it is in does. Previous versions did nothing in these cases.
Changed to Fl_Widget to make it more useful for menu items:
The inline functions Fl_Widget::is_group() and
Fl_Widget::is_window() return true if the widget is a subclass of
Fl_Group or Fl_Window. This ability already existed, but these
functions make the code much more readable.
Fl_Widget::takesevents() simplified to do a direct bit check. The
widget is only responsive if this is true for this widget and all
parents, but all examples in the code only called this in response
to events anyway. This was needed to make take_focus() work.
Base Fl_Widget handles shortcuts. A shortcut can be a key
combination stored in the integer value shortcut(), and/or a
printing character marked in the label() by putting an '&' sign
before it. The method Fl_Widget::test_shortcut() returns non-zero
if the current event matches the shortcut (it returns 1 for
shortcut() and 2 for label). The static methods test_shortcut(int)
and test_shortcut(const char*) allow you to run these tests
directly. A widget can do anything it wants with a matching
shortcut. If it returns zero then the shortcut causes the focus to
navigate to that widget.
The flag FL_NO_SHORTCUT_LABEL makes it treat '&' in the label
normally and no shortcuts will match the label. This is useful if
your program is generating strings that may contain '&' for the
labels. This is inverted from an older undocumented flag.
New methods focused(), belowmouse(), and pushed() return true if
the widget is equal to Fl::focus(), Fl::belowmouse(), or Fl::pushed().
Styles for menu items had to be rearranged so that arbitrary widgets can
be put into a menu or browser without horrid kludges in the drawing code:
I merged the previous menu_window and menu_item styles into a single
style called "menu". The big hack is that the glyph_box is used to
draw the box around the individual items, while box is drawn around
the outside of the menu. The selection_color / color is used to
draw the glyph_box around each item.
The new style "Item" is the default style of Fl_Item and controls
the label font, color. The selection_color is used to color in
checkboxes, just like Fl_Check_Button. The glyph and glyph box are
used for the checkmarks.
"Menu title" - Mostly the same, except some fields are irrelevant
now since they are taken from the item. The highlight colors were
moved to the Menu_bar style.
For proper highlighting, menu item draw() methods should use the current
fl_color() to draw the label. This will either be the item's
label_color or it will be the menu style selection_text_color.
All in all, just as confusing as before. You will have to move the
fields in any styles/themes you have designed around.
Fl_Menu_Item has been reverted to the fltk 1.0 version, since it's
main job is to be back-compatable. I also reverted the menubar demo
to test back compatability.
Added a new test/menu.cxx program that demonstrates the creation of
Fl_Item, Fl_Item_Group, and Fl_Divider.
The checkers and glpuzzle programs had to be fixed as the very old
popup() calls it uses are not emulated now.
Submenu titles (ie Fl_Item_Group widgets) do not execute unless they
have a non-zero user_data field. This was done to prevent them from
being selected for Fl_Choice widgets.
;;;
EXTENSIVE changes so that the items in menus are normal widgets, which
is what everybody really wants. See the attached email.
As part of the above, the default appearance of the menus was changed
to be more Windows98-like. In particular the inactive_menu_hack has
been forced to be on because the switching code got very complicated.
You can make individual items not highlight by setting output() on
them, rather than inactive() (this was done for the dividers).
Fl_Choice figures out if motif emulation is on and acts like before in
that case. Currently it checks to see if box() is FL_UP_BOX for this.
Fl_Window uses it's shortcut() to select the key to close itself. The
default shortcut is FL_Escape. Changing it to zero disables the close
on Escape.
Fixed keyboard navigation in the fl_ask and other message popups.
Added two new styles: "Message" and "Message_Icon". These control the
text and the punctuation icon in the message popups.
Fixed the colors of sliders to be fltk1.0 compatable.
Fixed sevaral calls to Fl_Valuator::step() with arguments like "1/100"
(which is zero, not the .01 I expected).
////////////////////////////////////////////////////////////////
Missing source file added.
Changed Fl_x.cxx and Fl_win32.cxx so they are #included by Fl.cxx.
This mostly was done to make variables which are shared by them static
so that I can be sure those variables are not used elsewhere. This is
not tested on win32, the file Fl_x.cxx (or Fl_win32.cxx) must be
removed from the build system!
Added fl_windows_colors() to Fl_x.cxx, although it does not do
anything yet. Perhaps it should read KDE's XGetDefault settings, this
is the closest to what windoze does.
Fl_Input should now allow you to insert foreign letters even if you
have to hold down the Alt or Meta key to type them (untested).
Possible fixes to the shortcut problems people are reporting.
////////////////////////////////////////////////////////////////
-bg switch works even if Fl_Window::show(a,b) is not called, and
overrides any colors loaded by themes.
Removed the fl_background.cxx source file and put that code in
Fl_theme.cxx.
////////////////////////////////////////////////////////////////
Window uses an x,y position of FL_USEDEFAULT to indicate that the
window should be positioned by the system (ie. it works like Win32).
This value is 0x80000000.
Fixed vertical size of titles on popup menus.
All widgets are created with the layout and damage bits turned on, so
that layout gets called on everything the first time the window is
shown.
Changes to what Fl_Group::draw_child and update_child do to make them
useful for subclasses. I am trying to get Fl_Scroll to work much
better so it can be used for the new browser.
////////////////////////////////////////////////////////////////
Fl_Scrollbar uses FL_KEYBOARD instead of FL_SHORTCUT events, like
other widgets. It is up to the scroll or browser (nyi) to send
keystrokes to the scrollbar. With this change all groups try any key
as a shortcut to all children before trying it as a navigation key.
This allows a widget to use arrows or tab as a shortcut.
Vertical Sliders reversed so the minimum() is at the bottom, which is
how everybody wants them and how Forms has them. You can get the
opposite by (like the scrollbars now do) swapping the miniumum() and
maximum() values.
Style changes to make them more consistent and so that a theme only
has to change a few styles:
I added two new fields: window_color and window_box (the names were
picked from the Win32 "COLOR_WINDOW"). These are used to color in
input fields and other sunken areas. I also deleted "off_color"
(replaced by window_color everywhere) and "glyph_box" (replaced by
window_box or box, depending on what the widget wants by default.
(This is incompatable with input/browser, as you must set
window_color to change the color, this can be fixed if necessary by
looking to see if style()->color is non-zero).
Buttons only use the selection_color() if directly set in their
style. This allows the base style to set selection_color and
selection_text_color for all input editing fields. With these two
changes the style of all input fields can be set in default_style.
Sliders have the color and selection_color meanings swapped. Now
color() is the color of the slider, window_color() is the color of
the background. I got tired of these being different than all other
widgets and it was making it difficult to have uniform styles. This
is incompatable.
Fixed the documentation and theme plugins to match this.
////////////////////////////////////////////////////////////////
Fixed the arrow and page up/down direction on vertical scrollbars.
Lots of fixes to clean up Fl_Scroll. The scrollbars are no longer
visible children, so calling clear() and children() and other things
on an Fl_Scroll do what is expected. The redrawing is fixed to use
the same type of clip-out as the group for nice non-blinking resizing.
They scroll automatically to show the widget with the focus. This
required much rewriting and cleanup of Fl_Group code and event
handling.
Changed how scrollbars draw so they don't blink either. Requires a
kludge in motif-style themes to draw the background behind arrow
triangles.
Renamed Fl_Widget::clear_damage(n) to set_damage(n) for obvious
clarity reasons. clear_damage() with no argument remains (it does
set_damage(0))
New call Fl_Widget::relayout() that sets the layout flag.
FL_FOCUS events are sent to all parent widgets whenever a child gets
the focus, even if it is from another child. This allows the parents
to track which child has focus (and the Fl_Scroll to scroll to show
it).
Changed return value of fl_clip_box to be the same as fl_not_clipped,
and implemented partial-clip detection on Win32. This was needed to
get scroll to draw correctly when both scrolling and a child being
damaged happened at the same time.
FL_MOVE events are sent to all widgets even while the mouse is pushed,
as CET requested. The highlight now follows the events, and it can
allow drag&drop interfaces. Disabled while menus are up.
////////////////////////////////////////////////////////////////
Got started on the new browser. You can get it by including the
"Fl_NewBrowser" header file, but eventually I hope this widget will
replace Fl_Browser completely. The only program that uses it is the
"browser" demo program. Right now you can only scroll it and move the
selection with the up/down arrows. Each item in the browser is a
widget, just like in menus. Also check out the #ifdef's in it, you
can change how it is drawn, including duplicating Win32 versions.
Various changes I made while implementing the browser:
Moved Fl_Grab stuff to the main Fl.cxx to get rid of public static
variables. Simpler Fl::grab() that does not require a widget, instead
it is a callback with an arbitrary argument. Cleaned up Fl_Menu.cxx
some.
Fixed popup menu titles to use an FL_UP_BOX if the window_box of the
button is FL_NO_BOX.
Moved Fl_Window:: methods to Fl_Window.cxx to make them easier to
find.
Fl_Output takes the focus when you click on it (so there is only one
selection visible).
Since selection_color() and selection_text_color() can no longer be
zero, I removed the tests for that.
Removed the unused FL_CLOSE to avoid confusion. I moved FL_KEYUP to