Brace and indent mods for readability..

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6736 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2009-04-02 01:19:25 +00:00
parent 8bb63644d2
commit eb6b632b0a

View File

@ -296,7 +296,8 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
}
color(button && !Fl::scheme() ? button->color() : FL_GRAY);
selected = -1;
{int j = 0;
{
int j = 0;
if (m) for (const Fl_Menu_Item* m1=m; ; m1 = m1->next(), j++) {
if (picked) {
if (m1 == picked) {selected = j; picked = 0;}
@ -340,26 +341,27 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
if (X < scr_x) X = scr_x; if (X > scr_x+scr_w-W) X = right_edge-W; //X= scr_x+scr_w-W;
x(X); w(W);
h((numitems ? itemheight*numitems-LEADING : 0)+2*BW+3);
if (selected >= 0)
if (selected >= 0) {
Y = Y+(Hp-itemheight)/2-selected*itemheight-BW;
else {
} else {
Y = Y+Hp;
// if the menu hits the bottom of the screen, we try to draw
// it above the menubar instead. We will not adjust any menu
// that has a selected item.
if (Y+h()>scr_y+scr_h && Y-h()>=scr_y) {
if (Hp>1)
if (Hp>1) {
// if we know the height of the Fl_Menu_, use it
Y = Y-Hp-h();
else if (t)
} else if (t) {
// assume that the menubar item height relates to the first
// menuitem as well
Y = Y-itemheight-h()-Fl::box_dh(box());
else
} else {
// draw the menu to the right
Y = Y-h()+itemheight+Fl::box_dy(box());
}
}
}
if (m) y(Y); else {y(Y-2); w(1); h(1);}
if (t) {
@ -372,8 +374,9 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
int ht = Htitle+2*BW+3;
title = new menutitle(X, Y-ht-dy, Wtitle, ht, t);
}
} else
} else {
title = 0;
}
}
menuwindow::~menuwindow() {
@ -674,7 +677,8 @@ int menuwindow::early_hide_handle(int e) {
return 1;
}
break;
case FL_SHORTCUT: {
case FL_SHORTCUT:
{
for (int mymenu = pp.nummenus; mymenu--;) {
menuwindow &mw = *(pp.p[mymenu]);
int item; const Fl_Menu_Item* m = mw.menu->find_shortcut(&item);
@ -683,11 +687,14 @@ int menuwindow::early_hide_handle(int e) {
if (!m->submenu()) pp.state = DONE_STATE;
return 1;
}
}} break;
}
}
break;
case FL_ENTER:
case FL_MOVE:
case FL_PUSH:
case FL_DRAG: {
case FL_DRAG:
{
#ifdef __QNX__
// STR 704: workaround QNX X11 bug - in QNX a FL_MOVE event is sent
// right after FL_RELEASE...
@ -732,7 +739,9 @@ int menuwindow::early_hide_handle(int e) {
pp.state = MENU_PUSH_STATE;
else
pp.state = PUSH_STATE;
}} return 1;
}
}
return 1;
case FL_RELEASE:
// Mouse must either be held down/dragged some, or this must be
// the second click (not the one that popped up the menu):
@ -813,20 +822,24 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
for (;;) {
// make sure all the menus are shown:
{for (int k = menubar; k < pp.nummenus; k++)
{
for (int k = menubar; k < pp.nummenus; k++) {
if (!pp.p[k]->shown()) {
if (pp.p[k]->title) pp.p[k]->title->show();
pp.p[k]->show();
}
}
}
// get events:
{const Fl_Menu_Item* oldi = pp.current_item;
{
const Fl_Menu_Item* oldi = pp.current_item;
Fl::wait();
if (pp.state == DONE_STATE) break; // done.
if (pp.current_item == oldi) continue;}
// only do rest if item changes:
if (pp.current_item == oldi) continue;
}
// only do rest if item changes:
if(pp.fakemenu) {delete pp.fakemenu; pp.fakemenu = 0;} // turn off "menubar button"
if (!pp.current_item) { // pointing at nothing