Author: AlbrechtS
Date: 2012-12-07 08:33:22 -0800 (Fri, 07 Dec 2012)
New Revision: 9739
Log:
Removed unnecessary drawing calls (STR #2898)


Modified:
   branches/branch-3.0/src/fltk3/LightButton.cxx
   branches/branch-3.0/src/fltk3/Menu.cxx

Modified: branches/branch-3.0/src/fltk3/LightButton.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/LightButton.cxx       2012-12-07 16:29:49 UTC 
(rev 9738)
+++ branches/branch-3.0/src/fltk3/LightButton.cxx       2012-12-07 16:33:22 UTC 
(rev 9739)
@@ -3,7 +3,7 @@
 //
 // Lighted button widget for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2012 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -40,7 +40,7 @@
 #include <fltk3/RadioLightButton.h>
 
 
-void fltk3::LightButton::draw() 
+void fltk3::LightButton::draw()
 {
   fltk3::Color col;
   if (this==fltk3::pushed()) {
@@ -53,12 +53,12 @@
                    fltk3::inactive(selection_color())) : color();
   int W;
   int dx, dy;
-  
+
   W  = labelsize();
   dx = fltk3::box_dx(box()) + 2;
   dy = (h() - W) / 2;
   // if (dy < 0) dy = 0;         // neg. offset o.k. for vertical centering
-  
+
   if (down_box()!=fltk3::NO_BOX) {
     // draw other down_box() styles:
     fltk3::Box* db = down_box();
@@ -94,43 +94,42 @@
         if ((W - tW) & 1) tW++; // Make sure difference is even to center
         int tdx = dx + (W - tW) / 2;
         int tdy = dy + (W - tW) / 2;
-        
+
         if (!fltk3::scheme()) {
           fltk3::color(fltk3::SELECTION_COLOR);
           tW --;
           fltk3::pie(tdx - 1, tdy - 1, tW + 3, tW + 3, 0.0, 360.0);
-          fltk3::arc(tdx - 1, tdy - 1, tW + 3, tW + 3, 0.0, 360.0);
           fltk3::color(fltk3::color_average(fltk3::WHITE, 
fltk3::SELECTION_COLOR, 0.2f));
         } else {
           fltk3::color(col);
         }
-        
+
         switch (tW) {
             // Larger circles draw fine...
           default :
             fltk3::pie(tdx, tdy, tW, tW, 0.0, 360.0);
             break;
-            
+
             // Small circles don't draw well on many systems...
           case 6 :
             fltk3::rectf(tdx + 2, tdy, tW - 4, tW);
             fltk3::rectf(tdx + 1, tdy + 1, tW - 2, tW - 2);
             fltk3::rectf(tdx, tdy + 2, tW, tW - 4);
             break;
-            
+
           case 5 :
           case 4 :
           case 3 :
             fltk3::rectf(tdx + 1, tdy, tW - 2, tW);
             fltk3::rectf(tdx, tdy + 1, tW, tW - 2);
             break;
-            
+
           case 2 :
           case 1 :
             fltk3::rectf(tdx, tdy, tW, tW);
             break;
         }
-        
+
         if (!fltk3::scheme()) {
           fltk3::color(fltk3::color_average(fltk3::WHITE, 
fltk3::SELECTION_COLOR, 0.5));
           fltk3::arc(tdx, tdy, tW + 1, tW + 1, 60.0, 180.0);
@@ -159,7 +158,7 @@
 }
 
 
-int fltk3::LightButton::handle(int event) 
+int fltk3::LightButton::handle(int event)
 {
   switch (event) {
     case fltk3::RELEASE:
@@ -176,7 +175,7 @@
  <P>The destructor deletes the check button.
  */
 fltk3::LightButton::LightButton(int X, int Y, int W, int H, const char* l)
-: fltk3::Button(X, Y, W, H, l) 
+: fltk3::Button(X, Y, W, H, l)
 {
   type(fltk3::TOGGLE_BUTTON);
   selection_color(fltk3::YELLOW);
@@ -185,7 +184,7 @@
 
 
 fltk3::RadioLightButton::RadioLightButton(int X,int Y,int W,int H,const char 
*l)
-: fltk3::LightButton(X,Y,W,H,l) 
+: fltk3::LightButton(X,Y,W,H,l)
 {
   type(fltk3::RADIO_BUTTON);
 }

Modified: branches/branch-3.0/src/fltk3/Menu.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Menu.cxx      2012-12-07 16:29:49 UTC (rev 
9738)
+++ branches/branch-3.0/src/fltk3/Menu.cxx      2012-12-07 16:33:22 UTC (rev 
9739)
@@ -3,7 +3,7 @@
 //
 // Menu code for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2012 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -53,7 +53,7 @@
   }
 }
 
-// Advance a pointer to next visible or invisible item of a menu array, 
+// Advance a pointer to next visible or invisible item of a menu array,
 // skipping the contents of submenus.
 static const fltk3::MenuItem* next_visible_or_not(const fltk3::MenuItem* m) {
   int nest = 0;
@@ -131,9 +131,9 @@
 
 extern char fltk3::draw_shortcut;
 
-/** 
-  Measures width of label, including effect of & characters. 
-  Optionally, can get height if hp is not NULL. 
+/**
+  Measures width of label, including effect of & characters.
+  Optionally, can get height if hp is not NULL.
 */
 int fltk3::MenuItem::measure(int* hp, const fltk3::Menu_* m) const {
   fltk3::Label l;
@@ -203,7 +203,6 @@
            fltk3::color(fltk3::SELECTION_COLOR);
            tW --;
            fltk3::pie(x + td + 1, y + d + td - 1, tW + 3, tW + 3, 0.0, 360.0);
-           fltk3::arc(x + td + 1, y + d + td - 1, tW + 3, tW + 3, 0.0, 360.0);
            fltk3::color(fltk3::color_average(fltk3::WHITE, 
fltk3::SELECTION_COLOR, 0.2f));
          } else fltk3::color(labelcolor_);
        } else fltk3::color(labelcolor_);
@@ -278,7 +277,7 @@
 }
 
 menuwindow::menuwindow(const fltk3::MenuItem* m, int X, int Y, int Wp, int Hp,
-                      const fltk3::MenuItem* picked, const fltk3::MenuItem* t, 
+                      const fltk3::MenuItem* picked, const fltk3::MenuItem* t,
                       int menubar, int menubar_title, int right_edge)
   : fltk3::MenuWindow(X, Y, Wp, Hp, 0)
 {
@@ -329,7 +328,7 @@
   if (t) Wtitle = t->measure(&Htitle, button) + 12;
   int W = 0;
   if (m) for (; m->text; m = m->next()) {
-    int hh; 
+    int hh;
     int w1 = m->measure(&hh, button);
     if (hh+LEADING>itemheight) itemheight = hh+LEADING;
     if (m->flags&(fltk3::SUBMENU|fltk3::SUBMENU_POINTER))
@@ -498,7 +497,7 @@
       drawentry(menu->next(drawn_selected), drawn_selected, 1);
       drawentry(menu->next(selected), selected, 1);
     }
-  }        
+  }
   drawn_selected = selected;
 }
 
@@ -611,7 +610,7 @@
 static int forward(int menu) { // go to next item in menu menu if possible
   menustate &pp = *p;
   // fltk3::MenuButton can generate menu=-1. This line fixes it and selectes 
the first item.
-  if (menu==-1) 
+  if (menu==-1)
     menu = 0;
   menuwindow &m = *(pp.p[menu]);
   int item = (menu == pp.menu_number) ? pp.item_number : m.selected;
@@ -654,7 +653,7 @@
       menuwindow *mw = pp.p[--i];
       if (mw) {
         mw->hide();
-        if (mw->title) 
+        if (mw->title)
           mw->title->hide();
       }
     }
@@ -714,7 +713,7 @@
       return 1;
     }
     break;
-  case fltk3::SHORTCUT: 
+  case fltk3::SHORTCUT:
     {
       for (int mymenu = pp.nummenus; mymenu--;) {
        menuwindow &mw = *(pp.p[mymenu]);
@@ -750,7 +749,7 @@
       }
       for (mymenu = pp.nummenus-1; ; mymenu--) {
        item = pp.p[mymenu]->find_selected(mx, my);
-       if (item >= 0) 
+       if (item >= 0)
          break;
        if (mymenu <= 0) {
          // buttons in menubars must be deselected if we move outside of them!
@@ -783,8 +782,8 @@
   case fltk3::RELEASE:
     // Mouse must either be held down/dragged some, or this must be
     // the second click (not the one that popped up the menu):
-    if (   !fltk3::event_is_click() 
-        || pp.state == PUSH_STATE 
+    if (   !fltk3::event_is_click()
+        || pp.state == PUSH_STATE
         || (pp.menubar && pp.current_item && !pp.current_item->submenu()) // 
button
        ) {
 #if 0 // makes the check/radio items leave the menu up
@@ -943,7 +942,7 @@
        // delete all the old menus and create new one:
        while (pp.nummenus > pp.menu_number+1) delete pp.p[--pp.nummenus];
        pp.p[pp.nummenus++]= new menuwindow(menutable, nX, nY,
-                                         title?1:0, 0, 0, title, 0, menubar, 
+                                         title?1:0, 0, 0, title, 0, menubar,
                                            (title ? 0 : cw.x()) );
       }
     } else { // !m->submenu():
@@ -974,13 +973,13 @@
   do the callbacks or change the state of check or radio items.</I>
 
   X,Y is the position of the mouse cursor, relative to the
-  window that got the most recent event (usually you can pass 
+  window that got the most recent event (usually you can pass
   fltk3::event_x() and fltk3::event_y() unchanged here).
 
   \p title is a character string title for the menu.  If
   non-zero a small box appears above the menu with the title in it.
 
-  The menu is positioned so the cursor is centered over the item 
+  The menu is positioned so the cursor is centered over the item
   picked.  This will work even if \p picked is in a submenu.
   If \p picked is zero or not in the menu item table the menu is
   positioned with the cursor in the top-left corner.
@@ -1000,10 +999,10 @@
 }
 
 /**
-  Search only the top level menu for a shortcut.  
+  Search only the top level menu for a shortcut.
   Either &x in the label or the shortcut fields are used.
 
-  This tests the current event, which must be an fltk3::KEYBOARD or 
+  This tests the current event, which must be an fltk3::KEYBOARD or
   fltk3::SHORTCUT, against a shortcut value.
 
   \param ip returns the index of the item, if \p ip is not NULL.

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to