Commit ff030be3 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Finish --draw-actions and add it to documentation

parent 32136757
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -9,9 +9,6 @@ overlay reminder showing what each one does :p

key/option/signal/timeout to totally reload filelist (rescan directories etc)

--draw-actions doesn't work too fine. It conflicts with --draw-filename and
misses some actions if there are non-defined actions in between

The "No more slides left in show" bug was fixed, but now there's a rare
condition (viewing a few images, removing them externally while viewing,
then resizing the window) causing imlib2 warnings.
+4 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ files in slideshow mode, multiple windows will be opened, one per file.
Create borderless windows
.TP 5
.B -d, --draw-filename
Draw the filename at the top-left of the image
Draw the filename at the top\-left of the image
.TP 5
.B -D, --slideshow-delay NUM
For slideshow mode, specifies time delay (seconds, can be a decimal) between automatically
@@ -238,6 +238,9 @@ in multiwindow mode, the window will be closed.
Extra actions which can be set and triggered using the appropriate number
key.
.TP 5
.B --draw-actions
Draw the defined actions and what they do at the top\-left of the image.
.TP 5
.B -m, --montage
Enable montage mode. Montage mode creates a new image consisting of a grid
of thumbnails of the images in the filelist. When montage mode is selected,
+34 −22
Original line number Diff line number Diff line
@@ -1211,12 +1211,21 @@ feh_draw_actions(winwidget w)
   static DATA8 atab[256];
   int i = 0;
   int num_actions = 0;
   int cur_action = 0;
   char index[1];
   char *line;

   D_ENTER(4);

// count the number of defined actions (this method sucks)
   for (num_actions=0;opt.actions[num_actions];num_actions++)
      ;
   /* Count number of defined actions. This method sucks a bit since it needs
    * to be changed if the number of actions changes, but at least it doesn't
    * miss actions 2 to 9 if action1 isn't defined
    */
   for (i = 0; i < 10; i++) {
      if (opt.actions[i])
         num_actions++;
   }

   if (num_actions == 0)
      return;

@@ -1244,12 +1253,14 @@ feh_draw_actions(winwidget w)
// Check for the widest line
   max_tw = tw;

   for (i = 0; opt.actions[i]; i++) {
   for (i = 0; i < 10; i++) {
      if (opt.actions[i]) {
         gib_imlib_get_text_size(fn, opt.actions[i], NULL, &tw, &th,
                                 IMLIB_TEXT_TO_RIGHT);
         if (tw > max_tw)
            max_tw = tw;
      }
   }

   tw = max_tw;
   tw += 3;
@@ -1279,21 +1290,22 @@ feh_draw_actions(winwidget w)
   gib_imlib_text_draw(im, fn, NULL, 1, 1, "defined actions:",
                       IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255);

   for(i = 0; i < num_actions; i++)
   {
      char index[1];
       char *line = emalloc(strlen(opt.actions[i])+5);
   for (i = 0; i < 10; i++) {
      if (opt.actions[i]) {
         cur_action++;
         line = emalloc(strlen(opt.actions[i])+5);
         sprintf(index, "%d", i);
         strcpy(line, index);
         strcat(line, ": ");
         strcat(line, opt.actions[i]);

      gib_imlib_text_draw(im, fn, NULL, 2, ((i+1)*line_th)+2, line,
         gib_imlib_text_draw(im, fn, NULL, 2, (cur_action*line_th)+2, line,
                             IMLIB_TEXT_TO_RIGHT, 0, 0, 0, 255);
      gib_imlib_text_draw(im, fn, NULL, 1, ((i+1)*line_th)+1, line,
         gib_imlib_text_draw(im, fn, NULL, 1, (cur_action*line_th)+1, line,
                             IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255);
         free(line);
      }
   }

   gib_imlib_render_image_on_drawable(w->bg_pmap, im, 0, 0 + th_offset, 1, 1, 0);

+1 −0
Original line number Diff line number Diff line
@@ -969,6 +969,7 @@ show_usage(void)
"     --action2 ACTION      multiple additional actions which can be invoked\n"
"     ...                   using the appropriate number key 1-9\n"
"     --action9 ACTION\n"
"     --draw-actions        Show the defined actions and what they do\n"
" -m, --montage             Enable montage mode. Montage mode creates a new\n"
"                           image consisting of a grid of thumbnails of the\n"
"                           images specified using FILE... When montage mode\n"