diff src/DLD-FUNCTIONS/__init_fltk__.cc @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents 1473d0cf86d2
children 4ced6b90fffb
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/__init_fltk__.cc	Thu Jan 20 17:21:27 2011 -0500
+++ b/src/DLD-FUNCTIONS/__init_fltk__.cc	Thu Jan 20 17:24:59 2011 -0500
@@ -98,7 +98,7 @@
 
   ~OpenGL_fltk (void) { }
 
-  void zoom (bool z) 
+  void zoom (bool z)
   {
     in_zoom = z;
     if (! in_zoom)
@@ -107,7 +107,7 @@
 
   bool zoom (void) { return in_zoom; }
   void set_zoom_box (const Matrix& zb) { zoom_box = zb; }
-  
+
   void print (const int fid, const std::string& term)
   {
     print_fid  = fid;
@@ -120,7 +120,7 @@
     setup_viewport (ww, hh);
     redraw ();
   }
-  
+
 private:
   double number;
   opengl_renderer renderer;
@@ -170,7 +170,7 @@
     glVertex2d (zoom_box(2), h () - zoom_box(1));
     glVertex2d (zoom_box(0), h () - zoom_box(1));
   }
- 
+
   void overlay (void)
   {
     glPushMatrix ();
@@ -228,7 +228,7 @@
   {
     static_cast<uimenu::properties*> (data)->execute_callback ();
   }
-  
+
 
 class fltk_uimenu
 {
@@ -302,11 +302,11 @@
                   else
                     menupath.clear ();
                   continue;
-                }   
+                }
               // Menu item?
               std::string itempath = menupath;
               if (!itempath.empty ())
-                itempath += "/";              
+                itempath += "/";
               itempath += m->label ();
 
               if (itempath.compare (findname) == 0)
@@ -315,7 +315,7 @@
         }
       return (-1);
     }
-  
+
   Matrix find_uimenu_children (uimenu::properties& uimenup) const
     {
       Matrix uimenu_childs = uimenup.get_all_children ();
@@ -329,18 +329,18 @@
       Matrix retval = do_find_uimenu_children (uimenu_childs);
       return retval;
     }
-    
+
   Matrix do_find_uimenu_children (Matrix uimenu_childs) const
     {
       octave_idx_type k = 0;
-      
-      
+
+
       Matrix pos = Matrix (uimenu_childs.numel (), 1);
-      
+
       for (octave_idx_type ii = 0; ii < uimenu_childs.numel (); ii++)
       {
         graphics_object kidgo = gh_manager::get_object (uimenu_childs (ii));
-        
+
         if (kidgo.valid_object() && kidgo.isa ("uimenu"))
           {
             uimenu_childs(k) = uimenu_childs(ii);
@@ -348,8 +348,8 @@
               dynamic_cast<uimenu::properties&> (kidgo.get_properties ()).get_position ();
           }
       }
-      
-      uimenu_childs.resize (k, 1);    
+
+      uimenu_childs.resize (k, 1);
       pos.resize (k, 1);
       Matrix retval = Matrix (k, 1);
       // Don't know if this is the best method to sort.
@@ -357,10 +357,10 @@
       Array<octave_idx_type> sidx = pos.sort_rows_idx (DESCENDING);
       for (octave_idx_type ii = 0; ii < k; ii++)
         retval(ii) = uimenu_childs (sidx(ii));
-       
+
       return retval;
     }
-    
+
   void delete_entry(uimenu::properties& uimenup)
     {
       std::string fltk_label = uimenup.get_fltk_label ();
@@ -404,7 +404,7 @@
             }
         }
     }
-            
+
   void update_enable (uimenu::properties& uimenup)
     {
       std::string fltk_label = uimenup.get_fltk_label ();
@@ -449,7 +449,7 @@
           int curr_idx = find_index_by_name(fltk_label.c_str ());
 
           for (idx = curr_idx - 1; idx >= 0; idx--)
-            { 
+            {
               Fl_Menu_Item* item = const_cast<Fl_Menu_Item*>(&menubar->menu () [idx]);
               itemflags = item->flags;
               if (item->label () != NULL)
@@ -484,7 +484,7 @@
             }
         }
     }
-    
+
   void add_entry (uimenu::properties& uimenup)
     {
 
@@ -494,19 +494,19 @@
         {
           bool item_added = false;
           do
-            {  
+            {
               const Fl_Menu_Item* item = menubar->find_item(fltk_label.c_str ());
-              
+
               if (item == NULL)
                 {
                   Matrix uimenu_ch = find_uimenu_children (uimenup);
                   int len = uimenu_ch.numel ();
                   int flags = 0;
-                  if (len > 0) 
+                  if (len > 0)
                     flags = FL_SUBMENU;
                   if ((len == 0) && (uimenup.is_checked ()))
                     flags += FL_MENU_TOGGLE + FL_MENU_VALUE;
-                  menubar->add(fltk_label.c_str (), 0, 0, 0, flags);      
+                  menubar->add(fltk_label.c_str (), 0, 0, 0, flags);
                   item_added = true;
                 }
               else
@@ -532,14 +532,14 @@
           while (!item_added);
           uimenup.set_fltk_label (fltk_label);
         }
-    }  
+    }
 
   void add_to_menu (uimenu::properties& uimenup)
     {
       Matrix kids = find_uimenu_children (uimenup);
       int len = kids.length ();
       std::string fltk_label = uimenup.get_fltk_label ();
-      
+
       add_entry (uimenup);
       update_foregroundcolor (uimenup);
       update_callback (uimenup);
@@ -547,7 +547,7 @@
       update_enable (uimenup);
       update_visible (uimenup);
       update_seperator (uimenup);
-      
+
       for (octave_idx_type ii = 0; ii < len; ii++)
         {
           graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
@@ -563,7 +563,7 @@
     {
       Matrix kids = find_uimenu_children (figp);
       int len = kids.length ();
-      menubar->clear ();      
+      menubar->clear ();
       for (octave_idx_type ii = 0; ii < len; ii++)
         {
           graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
@@ -581,7 +581,7 @@
     {
       Matrix kids;
       std::string type = prop.get_type ();
-      kids = find_uimenu_children (prop);    
+      kids = find_uimenu_children (prop);
       int len = kids.length ();
 
       for (octave_idx_type ii = 0; ii < len; ii++)
@@ -605,7 +605,7 @@
     {
       delete menubar;
     }
-    
+
 private:
   Fl_Menu_Bar* menubar;
 };
@@ -623,18 +623,18 @@
 
     begin ();
     {
-      
+
       uimenu = new
         fltk_uimenu(0, 0, ww, menu_h);
       uimenu->hide ();
-      
+
       canvas = new
         OpenGL_fltk (0, 0, ww , hh - status_h, number ());
 
-      bottom = new 
-        Fl_Box (0, 
-                hh - status_h, 
-                ww, 
+      bottom = new
+        Fl_Box (0,
+                hh - status_h,
+                ww,
                 status_h);
       bottom->box(FL_FLAT_BOX);
 
@@ -766,7 +766,7 @@
     uimenu->show ();
     mark_modified ();
   }
-  
+
   void hide_menubar (void)
   {
     int dm = menu_h;
@@ -777,13 +777,13 @@
                     canvas->w (),
                     canvas->h () + dm);
     uimenu->hide ();
-    mark_modified (); 
+    mark_modified ();
   }
-  
+
   void uimenu_update(graphics_handle gh, int id)
   {
     graphics_object uimenu_obj = gh_manager::get_object (gh);
-    
+
     if (uimenu_obj.valid_object () && uimenu_obj.isa ("uimenu"))
       {
         uimenu::properties& uimenup =
@@ -792,7 +792,7 @@
         graphics_object fig = uimenu_obj.get_ancestor("figure");
         figure::properties& figp =
           dynamic_cast<figure::properties&> (fig.get_properties ());
-        
+
         switch(id)
           {
             case base_properties::ID_BEINGDELETED:
@@ -826,12 +826,12 @@
               uimenu->update_seperator (uimenup);
               break;
           }
-          
+
           if (uimenu->items_to_show ())
             show_menubar ();
           else
             hide_menubar ();
-          
+
           mark_modified();
       }
   }
@@ -841,12 +841,12 @@
     canvas->show ();
     canvas->make_current ();
   }
-  
+
   void hide_canvas (void)
   {
     canvas->hide ();
   }
-  
+
   void mark_modified (void)
   {
     damage (FL_DAMAGE_ALL);
@@ -909,10 +909,10 @@
 
     if (widg == togglegrid)
       toggle_grid ();
-    
+
     if (widg == panzoom)
       gui_mode = pan_zoom;
-    
+
     if (widg == rotate && ndim == 3)
       gui_mode = rotate_zoom;
 
@@ -944,18 +944,18 @@
     octave_value_list args;
     if (fp.get_currentaxes ().ok ())
       args(0) = fp.get_currentaxes ().as_octave_value ();
-    
+
     feval ("grid", args);
     mark_modified ();
   }
-  
-  void pixel2pos 
+
+  void pixel2pos
   (graphics_handle ax, int px, int py, double& xx, double& yy) const
   {
     pixel2pos ( gh_manager::get_object (ax), px, py, xx, yy);
   }
 
-  void pixel2pos 
+  void pixel2pos
   (graphics_object ax, int px, int py, double& xx, double& yy) const
   {
     if (ax && ax.isa ("axes"))
@@ -995,7 +995,7 @@
       }
     return fp.get_currentaxes ();
   }
-  
+
   void pixel2status (graphics_handle ax, int px0, int py0,
                      int px1 = -1, int py1 = -1)
   {
@@ -1025,7 +1025,7 @@
   {
      if (ax && ax.isa ("axes"))
        {
-         axes::properties& ap = 
+         axes::properties& ap =
            dynamic_cast<axes::properties&> (ax.get_properties ());
          std::stringstream cbuf;
          cbuf.precision (4);
@@ -1033,12 +1033,12 @@
          Matrix v (1,2,0);
          v = ap.get("view").matrix_value();
          cbuf << "[azimuth: " << v(0) << ", elevation: " << v(1) << "]";
-    
+
          status->value (cbuf.str ().c_str ());
          status->redraw ();
        }
   }
-  
+
   void set_currentpoint (int px, int py)
   {
     if (!fp.is_beingdeleted ())
@@ -1054,9 +1054,9 @@
   {
     if (ax.valid_object ())
       {
-        axes::properties& ap = 
+        axes::properties& ap =
           dynamic_cast<axes::properties&> (ax.get_properties ());
-    
+
         double xx, yy;
         pixel2pos (ax, px, py, xx, yy);
 
@@ -1101,7 +1101,7 @@
   Cell modifier2cell ()
   {
     string_vector mod;
-    
+
     if (shift & FL_SHIFT)
       mod.append (std::string ("shift"));
     if (shift & FL_CTRL)
@@ -1157,7 +1157,7 @@
 
               shift |= key2shift (key);
               int key_a = key2ascii (key);
-              if (key_a && fp.get_keypressfcn ().is_defined ()) 
+              if (key_a && fp.get_keypressfcn ().is_defined ())
                 {
                   Octave_map evt;
                   evt.assign ("Character", octave_value (key_a));
@@ -1217,7 +1217,7 @@
             py0 = Fl::event_y ();
 
             set_currentpoint (Fl::event_x (), Fl::event_y ());
-            
+
             gh = pixel2axes_or_ca (px0, py0);
 
             if (gh.ok ())
@@ -1225,7 +1225,7 @@
                 ax0 = gh_manager::get_object (gh);
                 set_axes_currentpoint (ax0, px0, py0);
               }
-              
+
             fp.execute_windowbuttondownfcn ();
 
             if (Fl::event_button () == 1 || Fl::event_button () == 3)
@@ -1239,7 +1239,7 @@
                 set_currentpoint (Fl::event_x (), Fl::event_y ());
                 fp.execute_windowbuttonmotionfcn ();
               }
-            
+
             if (Fl::event_button () == 1)
               {
                 if (ax0 && ax0.isa ("axes"))
@@ -1248,14 +1248,14 @@
                       pixel2status (ax0, px0, py0, Fl::event_x (), Fl::event_y ());
                     else
                       view2status (ax0);
-                    axes::properties& ap = 
+                    axes::properties& ap =
                       dynamic_cast<axes::properties&> (ax0.get_properties ());
-                  
+
                     double x0, y0, x1, y1;
                     Matrix pos = fp.get_position ().matrix_value ();
                     pixel2pos (ax0, px0, py0, x0, y0);
                     pixel2pos (ax0, Fl::event_x (), Fl::event_y (), x1, y1);
-                    
+
                     if (gui_mode == pan_zoom)
                       ap.translate_view (x0 - x1, y0 - y1);
                     else if (gui_mode == rotate_zoom)
@@ -1289,22 +1289,22 @@
 
           case FL_MOUSEWHEEL:
             {
-              graphics_object ax = 
-                gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (), 
-                                                          Fl::event_y ()));                                                                      
+              graphics_object ax =
+                gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (),
+                                                          Fl::event_y ()));
               if (ax && ax.isa ("axes"))
                 {
-                  axes::properties& ap = 
+                  axes::properties& ap =
                     dynamic_cast<axes::properties&> (ax.get_properties ());
-                  
+
                   // Determine if we're zooming in or out.
-                  const double factor = 
+                  const double factor =
                     (Fl::event_dy () > 0) ? 1.0 + wheel_zoom_speed : 1.0 - wheel_zoom_speed;
-                  
+
                   // Get the point we're zooming about.
                   double x1, y1;
                   pixel2pos (ax, Fl::event_x (), Fl::event_y (), x1, y1);
-                  
+
                   ap.zoom_about_point (x1, y1, factor, false);
                   mark_modified ();
                 }
@@ -1317,7 +1317,7 @@
                 set_currentpoint (Fl::event_x (), Fl::event_y ());
                 fp.execute_windowbuttonupfcn ();
               }
-          
+
             if (Fl::event_button () == 1)
               {
                 if ( Fl::event_clicks () == 1)
@@ -1478,19 +1478,19 @@
     if (instance_ok ())
       instance->do_print (hnd2idx(gh), fid, term);
   }
-  
+
   static void uimenu_update (const graphics_handle& figh, const graphics_handle& uimenuh, const int id)
   {
     if (instance_ok ())
       instance->do_uimenu_update (hnd2idx(figh), uimenuh, id);
   }
-  
+
   static void update_canvas (const graphics_handle& gh, const graphics_handle& ca)
   {
     if (instance_ok ())
       instance->do_update_canvas (hnd2idx(gh), ca);
   }
-  
+
   static void toggle_menubar_visibility (int fig_idx, bool menubar_is_figure)
   {
     if (instance_ok ())
@@ -1501,7 +1501,7 @@
   {
     toggle_menubar_visibility (str2idx (fig_idx_str), menubar_is_figure);
   }
-  
+
 private:
 
   static figure_manager *instance;
@@ -1575,11 +1575,11 @@
           win->second->show_menubar ();
         else
           win->second->hide_menubar ();
-        
+
         win->second->redraw ();
       }
   }
-  
+
   void do_mark_modified (int idx)
   {
     wm_iterator win;
@@ -1629,7 +1629,7 @@
         win->second->uimenu_update (gh, id);
       }
   }
-  
+
   void do_update_canvas (int idx, graphics_handle ca)
   {
     wm_iterator win;
@@ -1641,8 +1641,8 @@
           win->second->hide_canvas ();
       }
   }
-  
-  
+
+
   // FIXME -- default size should be configurable.
   void default_size (int& x, int& y, int& w, int& h)
   {
@@ -1773,7 +1773,7 @@
       {
         uimenu::properties& uimenup =
           dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ());
-        std::string fltk_label = uimenup.get_label ();  
+        std::string fltk_label = uimenup.get_label ();
         graphics_object go = gh_manager::get_object (uimenu_obj.get_parent ());
         if (go.isa ("uimenu"))
           fltk_label = dynamic_cast<const uimenu::properties&> (go.get_properties ()).get_fltk_label ()
@@ -1783,22 +1783,22 @@
           ;
         else
           error("unexpected parent object\n");
-        
+
         uimenup.set_fltk_label(fltk_label);
       }
   }
-  
+
   void update (const graphics_object& go, int id)
   {
     if (go.isa ("figure"))
       {
         octave_value ov = go.get (caseless_str ("__plot_stream__"));
-        
+
         if (! ov.is_empty ())
           {
             const figure::properties& fp =
               dynamic_cast<const figure::properties&> (go.get_properties ());
-            
+
             switch (id)
               {
                 case base_properties::ID_VISIBLE:
@@ -1821,7 +1821,7 @@
       {
         if (id == uimenu::properties::ID_LABEL)
           uimenu_set_fltk_label (go);
-        
+
         graphics_object fig = go.get_ancestor("figure");
         figure_manager::uimenu_update(fig.get_handle (), go.get_handle (), id);
       }
@@ -1837,8 +1837,8 @@
   void print_figure (const graphics_object& go,
                      const std::string& term,
                      const std::string& file, bool /*mono*/,
-                     const std::string& /*debug_file*/) const 
-  { 
+                     const std::string& /*debug_file*/) const
+  {
     int fid;
     std::istringstream istr (file);
     if (istr >> fid)
@@ -1882,7 +1882,7 @@
 
       graphics_toolkit::register_toolkit (new fltk_graphics_toolkit);
       toolkit_registered = true;
-      
+
       octave_value_list args;
       args(0) = "__fltk_redraw__";
       feval ("add_input_event_hook", args, 0);
@@ -1927,7 +1927,7 @@
     }
 
   octave_value retval;
-  return retval;        
+  return retval;
 }
 
 DEFUN_DLD (__fltk_maxtime__, args, ,"")
@@ -1991,10 +1991,10 @@
     mode_str = "3d";
   else
     mode_str = "none";
-  
-  
+
+
   bool failed = false;
-  
+
   if (args.length () == 1)
     {
       if (args(0).is_string ())
@@ -2013,11 +2013,11 @@
       else
         failed = true;
     }
-    
+
   if (failed)
     error ("MODE must be one of the strings: ""2D"", ""3D"", or ""None"".");
-  
-  
+
+
   return octave_value(mode_str);
 }
 
@@ -2035,22 +2035,22 @@
   // args(0) ... FileFilter in fltk format
   // args(1) ... Title
   // args(2) ... Default Filename
-  // args(3) ... PostionValue [x,y] 
+  // args(3) ... PostionValue [x,y]
   // args(4) ... SelectValue "on"/"off"/"dir"/"create"
-  
+
   std::string file_filter, title, default_name, multi;
   if (args(0).is_string ())
     file_filter = args(0).string_value();
-    
+
   if (args(1).is_string ())
     title = args(1).string_value();
-    
+
   if (args(2).is_string ())
     default_name = args(2).string_value();
-    
+
   if (args(3).is_real_matrix ())
     Matrix pos = args(3).matrix_value();
-    
+
   int multi_type = Fl_File_Chooser::SINGLE;
   std::string flabel = "Filename:";
   if (args(4).is_string ())
@@ -2066,49 +2066,49 @@
       else if (multi == "create")
         multi_type = Fl_File_Chooser::CREATE;
     }
-  
-  Fl_File_Chooser::filename_label = flabel.c_str ();  
+
+  Fl_File_Chooser::filename_label = flabel.c_str ();
   Fl_File_Chooser *fc = new Fl_File_Chooser(default_name.c_str (), file_filter.c_str (), multi_type, title.c_str ());
   fc->preview(0);
-  
+
   if (multi_type == Fl_File_Chooser::CREATE)
     fc->ok_label("Save");
-  
+
   fc->show();
   while (fc->shown ())
         { Fl::wait (); }
 
   octave_value_list fargs, retval;
-  
+
   retval(0) = octave_value(0);
   retval(1) = octave_value(0);
   retval(2) = octave_value(0);
-  
+
   if (fc->value() != NULL)
     {
       int file_count = fc->count ();
       std::string fname;
       std::string sep = file_ops::dir_sep_str ();
       std::size_t idx;
-      
+
       if ((file_count == 1) && (multi_type != Fl_File_Chooser::DIRECTORY))
         {
-          fname = fc->value ();    
+          fname = fc->value ();
           idx = fname.find_last_of(sep);
           retval(0) = fname.substr(idx + 1);
         }
-      else  
+      else
         {
           Cell file_cell = Cell(file_count, 1);
           for (octave_idx_type n = 1; n <= file_count; n++)
             {
-              fname = fc->value (n);    
+              fname = fc->value (n);
               idx = fname.find_last_of(sep);
               file_cell(n - 1) = fname.substr(idx + 1);
             }
           retval(0) = file_cell;
         }
-        
+
       if (multi_type == Fl_File_Chooser::DIRECTORY)
         retval(0) = std::string(fc->value ());
       else
@@ -2117,7 +2117,7 @@
           retval(2) = fc->filter_value();
         }
     }
-  
+
   return retval;
 }