Fl_Menu_add of a menu item with the same name as an existing submenu

title would mess up by replacing that menu title, it now adds a new
item.

Fl_Menu::add() of text starting with '/' to a menu is assummed to be a
filename. So "/foo/bar" creates a single menu item. You can also put
filenames into submenus by doing "submenu//foo/bar", this will create
a submenu called "submenu" with an item "/foo/bar". Menu items
starting with "\_" will insert an item starting with '_' rather than a
divider line. These changes make the menus compatable with fltk 2.0.

Another little fix for the BoXX OpenGL overlays.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1460 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2001-05-19 21:30:23 +00:00
parent 9c19542bd2
commit 07656afb7d
3 changed files with 23 additions and 12 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.6 2001/03/14 17:20:01 spitzak Exp $" // "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7 2001/05/19 21:30:23 spitzak Exp $"
// //
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK). // OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
// //
@ -166,7 +166,11 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
HDC hdc = i->private_dc; HDC hdc = i->private_dc;
if (!hdc) { if (!hdc) {
hdc = i->private_dc = GetDCEx(i->xid, 0, DCX_CACHE); hdc = i->private_dc = GetDCEx(i->xid, 0, DCX_CACHE);
#if 0 // this cast to PIXELFORMATDESCRIPTOR* is needed for cygwin?
SetPixelFormat(i->private_dc, g->pixelformat, (PIXELFORMATDESCRIPTOR*)(&g->pfd));
#else
SetPixelFormat(i->private_dc, g->pixelformat, &g->pfd); SetPixelFormat(i->private_dc, g->pixelformat, &g->pfd);
#endif
#if USE_COLORMAP #if USE_COLORMAP
if (fl_palette) SelectPalette(i->private_dc, fl_palette, FALSE); if (fl_palette) SelectPalette(i->private_dc, fl_palette, FALSE);
#endif #endif
@ -229,5 +233,5 @@ void fl_delete_gl_context(GLContext context) {
#endif #endif
// //
// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.6 2001/03/14 17:20:01 spitzak Exp $". // End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7 2001/05/19 21:30:23 spitzak Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Menu_add.cxx,v 1.9.2.11 2001/02/12 15:34:37 easysw Exp $" // "$Id: Fl_Menu_add.cxx,v 1.9.2.12 2001/05/19 21:30:23 spitzak Exp $"
// //
// Menu utilities for the Fast Light Tool Kit (FLTK). // Menu utilities for the Fast Light Tool Kit (FLTK).
// //
@ -112,16 +112,23 @@ int Fl_Menu_Item::add(
int size = array==local_array ? local_array_size : array->size(); int size = array==local_array ? local_array_size : array->size();
int flags1 = 0; int flags1 = 0;
char* item; const char* item;
for (;;) { /* do all the supermenus: */
/* fill in the buf with name, changing \x to x: */ // split at slashes to make submenus:
for (;;) {
// leading slash makes us assumme it is a filename:
if (*mytext == '/') {item = mytext; break;}
// leading underscore causes divider line:
if (*mytext == '_') {mytext++; flags1 = FL_MENU_DIVIDER;}
// copy to buf, changing \x to x:
q = buf; q = buf;
for (p=mytext; *p && *p != '/'; *q++ = *p++) if (*p=='\\') p++; for (p=mytext; *p && *p != '/'; *q++ = *p++) if (*p=='\\') p++;
*q = 0; *q = 0;
item = buf; item = buf;
if (*item == '_') {item++; flags1 = FL_MENU_DIVIDER;}
if (*p != '/') break; /* not a menu title */ if (*p != '/') break; /* not a menu title */
mytext = p+1; /* point at item title */ mytext = p+1; /* point at item title */
@ -143,7 +150,7 @@ int Fl_Menu_Item::add(
/* find a matching menu item: */ /* find a matching menu item: */
for (; m->text; m = m->next()) for (; m->text; m = m->next())
if (!compare(m->text,item)) break; if (!(m->flags&FL_SUBMENU) && !compare(m->text,item)) break;
if (!m->text) { /* add a new menu item */ if (!m->text) { /* add a new menu item */
int n = m-array; int n = m-array;
@ -254,5 +261,5 @@ void Fl_Menu_::remove(int i) {
} }
// //
// End of "$Id: Fl_Menu_add.cxx,v 1.9.2.11 2001/02/12 15:34:37 easysw Exp $". // End of "$Id: Fl_Menu_add.cxx,v 1.9.2.12 2001/05/19 21:30:23 spitzak Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: fl_overlay_visual.cxx,v 1.4.2.4 2001/05/05 23:39:01 spitzak Exp $" // "$Id: fl_overlay_visual.cxx,v 1.4.2.5 2001/05/19 21:30:23 spitzak Exp $"
// //
// X overlay support for the Fast Light Tool Kit (FLTK). // X overlay support for the Fast Light Tool Kit (FLTK).
// //
@ -76,7 +76,7 @@ XVisualInfo *fl_find_overlay_visual() {
int num; int num;
XVisualInfo *v1=XGetVisualInfo(fl_display, VisualIDMask, &templt, &num); XVisualInfo *v1=XGetVisualInfo(fl_display, VisualIDMask, &templt, &num);
if (v1->screen == fl_screen && v1->c_class == PseudoColor if (v1->screen == fl_screen && v1->c_class == PseudoColor
&& (!v || v1->depth >= v->depth && v1->depth <= 8)) { && (!v || v1->depth > v->depth && v1->depth <= 8)) {
if (v) XFree((char*)v); if (v) XFree((char*)v);
v = v1; v = v1;
fl_transparent_pixel = overlayInfo[i].value; fl_transparent_pixel = overlayInfo[i].value;
@ -99,5 +99,5 @@ XVisualInfo *fl_find_overlay_visual() {
#endif #endif
// //
// End of "$Id: fl_overlay_visual.cxx,v 1.4.2.4 2001/05/05 23:39:01 spitzak Exp $". // End of "$Id: fl_overlay_visual.cxx,v 1.4.2.5 2001/05/19 21:30:23 spitzak Exp $".
// //