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