changeset 18985:f84361735a40

maint: Use Octave coding conventions for some recent patches. * __init_fltk__.cc: Wrap long lines to 80 characters. Use space between function name and opening '(' when calling function. * __go_draw_axes__.m: Wrap long lines to 80 characters. Use space between function name and opening '(' when calling function.
author Rik <rik@octave.org>
date Tue, 05 Aug 2014 09:15:01 -0700
parents 04dc55bf71e8
children 7141d9728ee0
files libinterp/dldfcn/__init_fltk__.cc scripts/plot/util/private/__go_draw_axes__.m
diffstat 2 files changed, 59 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_fltk__.cc	Mon Aug 04 20:49:32 2014 +0100
+++ b/libinterp/dldfcn/__init_fltk__.cc	Tue Aug 05 09:15:01 2014 -0700
@@ -668,8 +668,10 @@
     callback (window_close, static_cast<void*> (this));
 
     // The size of the resize_dummy box also determines the minimum window size
-    resize_dummy = new Fl_Box(5 * status_h + 1, menu_h + 1, ww - 5 * status_h - 1, hh);
-    // read on http://fltk.org/articles.php?L415+I0+T+M1000+P1 how resizable works
+    resize_dummy = new Fl_Box (5 * status_h + 1, menu_h + 1,
+                               ww - 5 * status_h - 1, hh);
+    // See http://fltk.org/articles.php?L415+I0+T+M1000+P1
+    // for how resizable works
     resizable (resize_dummy);
 
     // FIXME: The function below is only available in FLTK >= 1.3
@@ -684,10 +686,12 @@
     canvas = new OpenGL_fltk (0, menu_h, ww, hh, number ());
 
     // The bottom toolbar is a composite of "autoscale", "togglegrid",
-    // "panzoom", "rotate", "help", and "status". Only "status" should be resized.
+    // "panzoom", "rotate", "help", and "status".
+    // Only "status" should be resized.
 
     int toolbar_y = menu_h + hh + 1;
-    status = new Fl_Output (5 * status_h + 1, toolbar_y, ww - 5 * status_h - 1, status_h, "");
+    status = new Fl_Output (5 * status_h + 1, toolbar_y,
+                            ww - 5 * status_h - 1, status_h, "");
 
     status->textcolor (FL_BLACK);
     status->color (FL_GRAY);
@@ -870,7 +874,7 @@
   void update_toolbar_position ()
   {
     int old_canvas_h = canvas->h ();
-    size(w (), old_canvas_h + menu_dy () + status_h + 2);
+    size (w (), old_canvas_h + menu_dy () + status_h + 2);
     canvas->resize (0, menu_dy (), w (), old_canvas_h);
 
     int toolbar_y = canvas->h () + menu_dy () + 1;
@@ -879,14 +883,15 @@
     panzoom->position (2 * status_h, toolbar_y);
     rotate->position (3 * status_h, toolbar_y);
     help->position (4 * status_h, toolbar_y);
-    status->resize (5 * status_h + 1, toolbar_y, w () - 5 * status_h - 1, status_h);
+    status->resize (5 * status_h + 1, toolbar_y,
+                    w () - 5 * status_h - 1, status_h);
 
-    init_sizes();
+    init_sizes ();
     redraw ();
   }
 
   // Called from figure::properties::ID_POSITION
-  // (someone has requested a position change with set(h, "position", [...]))
+  // (someone has requested a position change with set (h, "position", [...]))
   // ww and hh refers to the canvas size, not the plot_window size.
 
   void update_position (int xx, int yy, int ww, int hh)
@@ -962,7 +967,8 @@
     // ax_obj is the last clicked axes object
     if (ax_obj && ax_obj.isa ("axes"))
       {
-        axes::properties& ap = dynamic_cast<axes::properties&>(ax_obj.get_properties ());
+        axes::properties& ap =
+          dynamic_cast<axes::properties&>(ax_obj.get_properties ());
         ap.set (name, value);
       }
     else // no axes object clicked so far, take currentaxes
@@ -971,7 +977,8 @@
         if (gh.ok ())
           {
             graphics_object go = gh_manager::get_object (gh);
-            axes::properties& ap = dynamic_cast<axes::properties&>(go.get_properties ());
+            axes::properties& ap =
+              dynamic_cast<axes::properties&>(go.get_properties ());
             ap.set (name, value);
           }
       }
@@ -1288,7 +1295,7 @@
             set_currentpoint (pos_x, pos_y);
 
             if (fp.get_windowbuttonupfcn ().is_defined ())
-              fp.execute_windowbuttondownfcn (Fl::event_button());
+              fp.execute_windowbuttondownfcn (Fl::event_button ());
 
             gh = pixel2axes_or_ca (pos_x, pos_y);
 
@@ -1327,7 +1334,7 @@
                       (ax_obj.get_properties ());
 
                     // Don't pan or rotate legend
-                    if (ap.get_tag().compare ("legend") < 0)
+                    if (ap.get_tag ().compare ("legend") < 0)
                       {
                         if (ap.rotate3d_is ("on"))
                           view2status (ax_obj);
@@ -1361,8 +1368,10 @@
                     else
                       {  // move the position of the legend
                         Matrix pos = ap.get_position ().matrix_value ();
-                        pos(0) += double (Fl::event_x () - pos_x) / canvas->w();
-                        pos(1) -= double (Fl::event_y () - menu_dy () - pos_y) / canvas->h();
+                        pos(0) += double (Fl::event_x () - pos_x)
+                                  / canvas->w ();
+                        pos(1) -= double (Fl::event_y () - menu_dy () - pos_y)
+                                  / canvas->h ();
                         ap.set_position (pos);
                       }
 
@@ -1400,7 +1409,7 @@
                   axes::properties& ap =
                     dynamic_cast<axes::properties&> (ax.get_properties ());
 
-                  // Parameter controlling how fast we zoom when using the scrool wheel.
+                  // Control how fast to zoom when using scroll wheel.
                   double Vwheel_zoom_speed = ap.get_mouse_wheel_zoom ();
 
                   // Determine if we're zooming in or out.
@@ -1426,8 +1435,9 @@
                 fp.execute_windowbuttonupfcn ();
               }
 
-            if ((Fl::event_button () == 1) && Fl::event_clicks ()) //double click
+            if ((Fl::event_button () == 1) && Fl::event_clicks ())
               {
+                // Double click
                 set_on_ax_obj ("xlimmode", "auto");
                 set_on_ax_obj ("ylimmode", "auto");
                 set_on_ax_obj ("zlimmode", "auto");
@@ -1621,7 +1631,8 @@
                                          bool menubar_is_figure)
   {
     if (instance_ok ())
-      instance->do_toggle_menubar_visibility (str2idx (fig_idx_str), menubar_is_figure);
+      instance->do_toggle_menubar_visibility (str2idx (fig_idx_str),
+                                              menubar_is_figure);
   }
 
 private:
--- a/scripts/plot/util/private/__go_draw_axes__.m	Mon Aug 04 20:49:32 2014 +0100
+++ b/scripts/plot/util/private/__go_draw_axes__.m	Tue Aug 05 09:15:01 2014 -0700
@@ -561,7 +561,9 @@
         if (isempty (obj.displayname))
           titlespec{data_idx} = "title \"\"";
         else
-          tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+          tmp = undo_string_escapes (
+                  __maybe_munge_text__ (enhanced, obj, "displayname")
+                );
           titlespec{data_idx} = ['title "' tmp '"'];
         endif
         usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
@@ -575,14 +577,16 @@
             zdat = zeros (size (xdat));
           endif
           data{data_idx} = [xdat, ydat, zdat]';
-          usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", numel (xdat));
+          usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)",
+                                           numel (xdat));
           ## fputs (plot_stream, "set parametric;\n");
         else
           xdat = obj.xdata(:);
           ydat = obj.ydata(:);
           data{data_idx} = [xdat, ydat]';
-          usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s",
-                                          rows (xdat), xaxisloc_using, yaxisloc_using);
+          usingclause{data_idx} = ...
+            sprintf ("record=%d using ($1):($2) axes %s%s",
+                     rows (xdat), xaxisloc_using, yaxisloc_using);
         endif
 
         style = do_linestyle_command (obj, obj.color, data_idx, mono,
@@ -680,7 +684,9 @@
              if (i > 1 || isempty (obj.displayname))
                titlespec{local_idx} = "title \"\"";
              else
-               tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+               tmp = undo_string_escapes (
+                       __maybe_munge_text__ (enhanced, obj, "displayname")
+                     );
                titlespec{local_idx} = ['title "' tmp '"'];
              endif
              if (isfield (obj, "facecolor"))
@@ -766,7 +772,7 @@
                elseif (__gnuplot_has_feature__ ("transparent_patches")
                        && isscalar (obj.facealpha))
                  colorspec = sprintf ("lc rgb \"#%02x%02x%02x\" fillstyle transparent solid %f",
-                                    round (255*color), obj.facealpha);
+                                      round (255*color), obj.facealpha);
                else
                  colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
                                       round (255*color));
@@ -1115,7 +1121,9 @@
           if (isempty (obj.displayname))
             titlespec{data_idx} = "title \"\"";
           else
-            tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "displayname"));
+            tmp = undo_string_escapes (
+                    __maybe_munge_text__ (enhanced, obj, "displayname")
+                  );
             titlespec{data_idx} = ['title "' tmp '"'];
           endif
           withclause{data_idx} = sprintf ("with pm3d linestyle %d",
@@ -1211,7 +1219,8 @@
           endif
 
           if (flat_interp_face && strcmp (obj.edgecolor, "flat"))
-            fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n",
+            fprintf (plot_stream,
+                     "set pm3d explicit at s %s %s corners2color c3;\n",
                      interp_str, dord);
           elseif (!facecolor_none_or_white)
             if (strcmp (obj.edgecolor, "none"))
@@ -1221,10 +1230,12 @@
                          "set style fill transparent solid %f;\n",
                          obj.facealpha);
               endif
-              fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n",
+              fprintf (plot_stream,
+                       "set pm3d explicit at s %s corners2color c3;\n",
                        interp_str, dord);
             else
-              fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n",
+              fprintf (plot_stream,
+                       "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n",
                        data_idx, interp_str, dord);
 
               if (__gnuplot_has_feature__ ("transparent_surface")
@@ -1443,8 +1454,8 @@
             data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz;
            endif
         endfor
-        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) *
-                 (cmap_sz + rows (addedcmap)) / cmap_sz);
+        fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n",
+                 clim(1), clim(2) * (cmap_sz + rows (addedcmap)) / cmap_sz);
       else
         fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim);
       endif
@@ -1586,7 +1597,8 @@
     endswitch
     if (__gnuplot_has_feature__ ("key_has_font_properties"))
       [fontname, fontsize] = get_fontname_and_size (hlgnd);
-      fontspacespec = [ create_spacingspec(fontname, fontsize, gnuplot_term) create_fontspec(fontname, fontsize, gnuplot_term) ];
+      fontspacespec = [ create_spacingspec(fontname, fontsize, gnuplot_term),
+                        create_fontspec(fontname, fontsize, gnuplot_term) ];
     else
       fontspacespec = "";
     endif
@@ -1658,8 +1670,8 @@
       fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
                usingclause{1}, titlespec{1}, withclause{1});
     else
-      fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
-               usingclause{1}, titlespec{1}, withclause{1});
+      fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n",
+               plot_cmd, usingclause{1}, titlespec{1}, withclause{1});
     endif
     for i = 2:data_idx
       if (have_3d_patch (i))
@@ -1699,8 +1711,8 @@
           fputs (plot_stream, "unset obj 2; \\\n");
           fg_is_set = false;
         endif
-        fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
-                 usingclause{i}, titlespec{i}, withclause{i});
+        fprintf (plot_stream,"%s \"-\" binary format='%%float64' %s %s %s \\\n",
+                 plot_cmd, usingclause{i}, titlespec{i}, withclause{i});
       else
         fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n",
                  usingclause{i}, titlespec{i}, withclause{i});
@@ -1717,7 +1729,7 @@
             fputs (plot_stream, "\n\n");
           endif
           fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j).');
-          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n", data{i}(:,j+1).');
+          fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n",data{i}(:,j+1).');
           fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+2).');
           fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+3).');
         endfor
@@ -1757,7 +1769,7 @@
   endif
 endfunction
 
-function spacing_spec = create_spacingspec(f, s, gp_term)
+function spacing_spec = create_spacingspec (f, s, gp_term)
   # The gnuplot default font size is 10, and default spacing is 1.25.
   # gnuplot has a concept of a figure global font, and sizes everything
   # appropriate to that, including the legend spacing.