CHDK_DE Vorschauversion  Trunk Rev. 5232
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_fselect.c-Dateireferenz
#include "camera_info.h"
#include "stdlib.h"
#include "keyboard.h"
#include "modes.h"
#include "sd_card.h"
#include "debug_led.h"
#include "lang.h"
#include "gui.h"
#include "gui_draw.h"
#include "gui_lang.h"
#include "gui_mbox.h"
#include "raw.h"
#include "conf.h"
#include "gui_fselect.h"
#include "raw_merge.h"
#include "dng.h"
#include "gui_mpopup.h"
#include "gui_tbox.h"
#include "gui_read.h"
#include "module_load.h"
+ Include-Abhängigkeitsdiagramm für gui_fselect.c:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  _fitem
 
struct  flist
 
struct  fs_dirent
 

Makrodefinitionen

#define BODY_LINES   12
 
#define BODY_FONT_LINES   BODY_LINES * FONT_HEIGHT
 
#define NAME_SIZE   camera_screen.fselect_name_size
 
#define SIZE_SIZE   camera_screen.fselect_size_size
 
#define TIME_SIZE   camera_screen.fselect_time_size
 
#define NAME_FONT_SIZE   NAME_SIZE * FONT_WIDTH
 
#define EXTE_FONT_SIZE   EXTE_SIZE * FONT_WIDTH
 
#define SIZE_FONT_SIZE   SIZE_SIZE * FONT_WIDTH
 
#define TIME_FONT_SIZE   TIME_SIZE * FONT_WIDTH
 
#define SPACING   4
 
#define TAB_DIVIDER   1
 
#define BORDER   2
 
#define SCROLLBAR   4
 
#define MARKED_OP_NONE   0
 
#define MARKED_OP_CUT   1
 
#define MARKED_OP_COPY   2
 
#define MAX_PATH_LEN   100
 
#define MAIN_H   (FONT_HEIGHT + TAB_DIVIDER + BODY_FONT_LINES + TAB_DIVIDER + FONT_HEIGHT)
 
#define MPOPUP_CUT   0x0001
 
#define MPOPUP_COPY   0x0002
 
#define MPOPUP_PASTE   0x0004
 
#define MPOPUP_DELETE   0x0008
 
#define MPOPUP_SELINV   0x0010
 
#define MPOPUP_RAWOPS   0x0020
 
#define MPOPUP_PURGE_DCIM   0x0040
 
#define MPOPUP_PURGE_DIR   0x0080
 
#define MPOPUP_PURGE_FILE   0x0100
 
#define MPOPUP_RMDIR   0x0200
 
#define MPOPUP_MKDIR   0x0400
 
#define MPOPUP_RENAME   0x0800
 
#define MPOPUP_EDITOR   0x1000
 
#define MPOPUP_CHDK_REPLACE   0x2000
 
#define MPOPUP_RAW_ADD   0x0020
 
#define MPOPUP_RAW_AVERAGE   0x0040
 
#define MPOPUP_SUBTRACT   0x0100
 
#define MPOPUP_RAW_DEVELOP   0x0200
 
#define MPOPUP_DNG_TO_CRW   0x0400
 
#define COPY_BUF_SIZE   16384
 
#define MAX_SUB_NAMES   6
 

Typdefinitionen

typedef struct _fitem fitem
 

Funktionen

int gui_fselect_kbd_process ()
 
void gui_fselect_kbd_process_menu_btn ()
 
void gui_fselect_draw (int enforce_redraw)
 
static void free_list (flist *list)
 
static void add_item (flist *list, const char *name, unsigned long size, unsigned long mtime, unsigned char marked, unsigned char isdir, unsigned char isparent, unsigned char isvalid)
 
int fselect_sort (const void *v1, const void *v2)
 
static void sort_list (flist *list)
 
static int chk_ext (const char *ext, const char *tst)
 
static int chk_prefix (const char *name, const char *prefix)
 
static int chk_name (const char *name, const char *tst)
 
static int is_parent (const char *name)
 
static int is_current (const char *name)
 
static int is_raw (const char *name)
 
static int is_jpg (const char *name)
 
static void delete_file (const char *path, const char *name)
 
static void delete_dir (const char *path)
 
static DIRopendir_fselect (const char *path)
 
static int copy_file (const char *src_dir, const char *src_file, const char *dst_dir, const char *dst_file, int overwrite)
 
static int fs_readdir (DIR *d, fs_dirent *de, const char *path)
 
static void process_dir (const char *parent, const char *name, int nested, void(*file_process)(const char *path, const char *file), void(*dir_process)(const char *path))
 
static void fselect_goto_prev (int step)
 
static void fselect_goto_next (int step)
 
static void gui_fselect_free_data ()
 
static void gui_fselect_read_dir ()
 
int gui_fselect_find_start_dir (const char *dir)
 
void gui_fselect_init (int title, const char *prev_dir, const char *default_dir, void(*on_select)(const char *fn))
 
static void fselect_delete_file_cb (unsigned int btn)
 
static int find_jpg (const char *folder, const char *match, int nested)
 
static void purge_file (const char *folder, const char *file)
 
static void purge_file_DCIM (const char *folder, const char *file)
 
static void fselect_purge_cb_DCIM (unsigned int btn)
 
static void fselect_purge_cb_dir (unsigned int btn)
 
static void fselect_purge_cb_file (unsigned int btn)
 
static void fselect_delete_folder_cb (unsigned int btn)
 
static void confirm_delete_directory ()
 
static void fselect_marked_toggle ()
 
static void gui_fselect_marked_free_data ()
 
static void fselect_marked_copy_list ()
 
static void fselect_marked_paste_cb (unsigned int btn)
 
static unsigned int fselect_real_marked_count ()
 
static unsigned int fselect_marked_count ()
 
static void fselect_marked_delete_cb (unsigned int btn)
 
static void fselect_chdk_replace_cb (unsigned int btn)
 
static void fselect_marked_inverse_selection ()
 
void process_raw_files (void)
 
static void fselect_subtract_cb (unsigned int btn)
 
static void setup_batch_subtract (void)
 
void process_dng_to_raw_files (void)
 
static void fselect_mpopup_rawop_cb (unsigned int actn)
 
static void mkdir_cb (const char *name)
 
static void rename_cb (const char *name)
 
static int isPurgeDCIM ()
 
static int isPurgeDir ()
 
static void fselect_mpopup_cb (unsigned int actn)
 
void finalize_fselect ()
 
static void exit_fselect (char *file)
 
int _module_unloader ()
 
int _module_can_unload ()
 
int _module_exit_alt ()
 

Variablen

gui_handler GUI_MODE_FSELECT_MODULE
 
static int running = 0
 
static gui_handlergui_fselect_mode_old
 
static char selected_file [MAX_PATH_LEN]
 
static char buf [MAX_PATH_LEN]
 
static flist items
 
static flist marked_items
 
static fitemtop
 
static fitemselected
 
static char marked_operation
 
static coord main_x
 
static coord main_y
 
static coord main_w
 
static coord body_y
 
static coord foot_y
 
static int gui_fselect_redraw
 
static int gui_fselect_readdir
 
static char * fselect_title
 
static void(* fselect_on_select )(const char *fn)
 
static char raw_operation
 
static struct mpopup_item popup []
 
static struct mpopup_item popup_rawop []
 
static unsigned char * ubuf = 0
 
static int mpopup_rawop_flag
 
libfselect_sym _libfselect
 
ModuleInfo _module_info
 

Makro-Dokumentation

#define BODY_FONT_LINES   BODY_LINES * FONT_HEIGHT

Definiert in Zeile 37 der Datei gui_fselect.c.

#define BODY_LINES   12

Definiert in Zeile 36 der Datei gui_fselect.c.

#define BORDER   2

Definiert in Zeile 50 der Datei gui_fselect.c.

#define COPY_BUF_SIZE   16384

Definiert in Zeile 375 der Datei gui_fselect.c.

#define EXTE_FONT_SIZE   EXTE_SIZE * FONT_WIDTH

Definiert in Zeile 44 der Datei gui_fselect.c.

Definiert in Zeile 101 der Datei gui_fselect.c.

#define MARKED_OP_COPY   2

Definiert in Zeile 55 der Datei gui_fselect.c.

#define MARKED_OP_CUT   1

Definiert in Zeile 54 der Datei gui_fselect.c.

#define MARKED_OP_NONE   0

Definiert in Zeile 53 der Datei gui_fselect.c.

#define MAX_PATH_LEN   100

Definiert in Zeile 62 der Datei gui_fselect.c.

#define MAX_SUB_NAMES   6

Definiert in Zeile 1267 der Datei gui_fselect.c.

#define MPOPUP_CHDK_REPLACE   0x2000

Definiert in Zeile 128 der Datei gui_fselect.c.

#define MPOPUP_COPY   0x0002

Definiert in Zeile 116 der Datei gui_fselect.c.

#define MPOPUP_CUT   0x0001

Definiert in Zeile 115 der Datei gui_fselect.c.

#define MPOPUP_DELETE   0x0008

Definiert in Zeile 118 der Datei gui_fselect.c.

#define MPOPUP_DNG_TO_CRW   0x0400

Definiert in Zeile 152 der Datei gui_fselect.c.

#define MPOPUP_EDITOR   0x1000

Definiert in Zeile 127 der Datei gui_fselect.c.

#define MPOPUP_MKDIR   0x0400

Definiert in Zeile 125 der Datei gui_fselect.c.

#define MPOPUP_PASTE   0x0004

Definiert in Zeile 117 der Datei gui_fselect.c.

#define MPOPUP_PURGE_DCIM   0x0040

Definiert in Zeile 121 der Datei gui_fselect.c.

#define MPOPUP_PURGE_DIR   0x0080

Definiert in Zeile 122 der Datei gui_fselect.c.

#define MPOPUP_PURGE_FILE   0x0100

Definiert in Zeile 123 der Datei gui_fselect.c.

#define MPOPUP_RAW_ADD   0x0020

Definiert in Zeile 148 der Datei gui_fselect.c.

#define MPOPUP_RAW_AVERAGE   0x0040

Definiert in Zeile 149 der Datei gui_fselect.c.

#define MPOPUP_RAW_DEVELOP   0x0200

Definiert in Zeile 151 der Datei gui_fselect.c.

#define MPOPUP_RAWOPS   0x0020

Definiert in Zeile 120 der Datei gui_fselect.c.

#define MPOPUP_RENAME   0x0800

Definiert in Zeile 126 der Datei gui_fselect.c.

#define MPOPUP_RMDIR   0x0200

Definiert in Zeile 124 der Datei gui_fselect.c.

#define MPOPUP_SELINV   0x0010

Definiert in Zeile 119 der Datei gui_fselect.c.

#define MPOPUP_SUBTRACT   0x0100

Definiert in Zeile 150 der Datei gui_fselect.c.

#define NAME_FONT_SIZE   NAME_SIZE * FONT_WIDTH

Definiert in Zeile 43 der Datei gui_fselect.c.

#define NAME_SIZE   camera_screen.fselect_name_size

Definiert in Zeile 39 der Datei gui_fselect.c.

#define SCROLLBAR   4

Definiert in Zeile 51 der Datei gui_fselect.c.

#define SIZE_FONT_SIZE   SIZE_SIZE * FONT_WIDTH

Definiert in Zeile 45 der Datei gui_fselect.c.

#define SIZE_SIZE   camera_screen.fselect_size_size

Definiert in Zeile 40 der Datei gui_fselect.c.

#define SPACING   4

Definiert in Zeile 48 der Datei gui_fselect.c.

#define TAB_DIVIDER   1

Definiert in Zeile 49 der Datei gui_fselect.c.

#define TIME_FONT_SIZE   TIME_SIZE * FONT_WIDTH

Definiert in Zeile 46 der Datei gui_fselect.c.

#define TIME_SIZE   camera_screen.fselect_time_size

Definiert in Zeile 41 der Datei gui_fselect.c.

Dokumentation der benutzerdefinierten Typen

typedef struct _fitem fitem

Dokumentation der Funktionen

int _module_can_unload ( )

Definiert in Zeile 1659 der Datei gui_fselect.c.

1660 {
1661  return running == 0;
1662 }
int _module_exit_alt ( )

Definiert in Zeile 1664 der Datei gui_fselect.c.

1665 {
1666  exit_fselect(0);
1667  return 0;
1668 }
int _module_unloader ( )

Definiert in Zeile 1647 der Datei gui_fselect.c.

1648 {
1649  // Free file copy buffer if allocated
1650  if (ubuf)
1651  {
1652  ufree(ubuf);
1653  ubuf = 0;
1654  }
1655  finalize_fselect();
1656  return 0;
1657 }
static void add_item ( flist list,
const char *  name,
unsigned long  size,
unsigned long  mtime,
unsigned char  marked,
unsigned char  isdir,
unsigned char  isparent,
unsigned char  isvalid 
)
static

Definiert in Zeile 181 der Datei gui_fselect.c.

184 {
185  fitem *p = malloc(sizeof(fitem) + strlen(name));
186  if (p)
187  {
188  p->n = list->count;
189  strcpy(p->name, name);
190  p->size = size;
191  p->mtime = mtime;
192  p->marked = marked;
193  p->isdir = isdir;
194  p->isparent = isparent;
195  p->isvalid = isvalid;
196 
197  p->next = 0;
198  p->prev = list->tail;
199  if (list->tail)
200  list->tail->next = p;
201  list->tail = p;
202  if (list->head == 0)
203  list->head = p;
204 
205  list->count++;
206  }
207 }
static int chk_ext ( const char *  ext,
const char *  tst 
)
static

Definiert in Zeile 289 der Datei gui_fselect.c.

290 {
291  if (ext && (*ext != '.')) // if passed file name, find extension
292  ext = strrchr(ext, '.');
293  if (ext)
294  {
295  ext++;
296  if (strlen(ext) == strlen(tst))
297  {
298  int i;
299  for (i=0; i<strlen(tst); i++)
300  if (toupper(ext[i]) != toupper(tst[i]))
301  return 0;
302  return 1;
303  }
304  }
305  return 0;
306 }
static int chk_name ( const char *  name,
const char *  tst 
)
static

Definiert in Zeile 323 der Datei gui_fselect.c.

324 {
325  if (name && (strlen(name) == strlen(tst)))
326  {
327  int i;
328  for (i=0; i<strlen(tst); i++)
329  if (toupper(tst[i]) != toupper(name[i]))
330  return 0;
331  return 1;
332  }
333  return 0;
334 }
static int chk_prefix ( const char *  name,
const char *  prefix 
)
static

Definiert in Zeile 309 der Datei gui_fselect.c.

310 {
311  if (name && (strlen(name) >= strlen(prefix)))
312  {
313  int i;
314  for (i=0; i<strlen(prefix); i++)
315  if (toupper(prefix[i]) != toupper(name[i]))
316  return 0;
317  return 1;
318  }
319  return 0;
320 }
static void confirm_delete_directory ( )
static
static int copy_file ( const char *  src_dir,
const char *  src_file,
const char *  dst_dir,
const char *  dst_file,
int  overwrite 
)
static

Definiert in Zeile 377 der Datei gui_fselect.c.

378 {
379  int rv = 0;
380 
381  // If source and destination are the same abort (and fail) copy operation
382  if (chk_name(src_dir, dst_dir) && chk_name(src_file, dst_file))
383  return 0;
384 
385  // Get source path and open file
386  sprintf(selected_file, "%s/%s", src_dir, src_file);
387  int fsrc = open(selected_file, O_RDONLY, 0777);
388 
389  if (fsrc >= 0)
390  {
391  // Get destination path, check for overwrite, and open file
392  sprintf(selected_file,"%s/%s", dst_dir, dst_file);
393  if (!overwrite)
394  {
395  struct stat st;
396  if (stat(selected_file, &st) == 0)
397  {
398  close(fsrc);
399  // destination exists, and overwrite not selected, copy failed
400  return 0;
401  }
402  }
403  int fdst = open(selected_file, O_WRONLY|O_CREAT|O_TRUNC, 0777);
404 
405  if (fdst >= 0)
406  {
407  int ss, sd = 0;
408 
409  // Allocate buffer if not already allocated
410  if (ubuf == 0)
411  {
413  if (ubuf == 0)
414  {
415  // umalloc failed - ToDo this should display an error popup?
416  close(fdst);
417  close(fsrc);
418  return 0;
419  }
420  }
421 
422  // Copy contents
423  do
424  {
425  ss = read(fsrc, ubuf, COPY_BUF_SIZE);
426  if (ss > 0)
427  sd = write(fdst, ubuf, ss);
428  } while (ss > 0 && ss == sd);
429 
430  if (ss == 0)
431  rv = 1;
432 
433  close(fdst);
434 
435  struct utimbuf t;
436  t.actime = t.modtime = selected->mtime;
437  utime(selected_file, &t);
438  }
439 
440  close(fsrc);
441  }
442 
443  return rv;
444 }
static void delete_dir ( const char *  path)
static

Definiert in Zeile 362 der Datei gui_fselect.c.

363 {
364  remove(path);
365 }
static void delete_file ( const char *  path,
const char *  name 
)
static

Definiert in Zeile 356 der Datei gui_fselect.c.

357 {
358  sprintf(selected_file, "%s/%s", path, name);
359  remove(selected_file);
360 }
static void exit_fselect ( char *  file)
static

Definiert in Zeile 1457 der Datei gui_fselect.c.

1458 {
1459  finalize_fselect();
1460 
1462 
1463  if (fselect_on_select && file)
1464  {
1465  fselect_on_select(file);
1466  // if called mode will return control to filemanager - we need to redraw it
1467  gui_fselect_redraw = 2;
1468  }
1469 
1470  running = 0;
1471 }
void finalize_fselect ( )

Definiert in Zeile 1451 der Datei gui_fselect.c.

1452 {
1455 }
static int find_jpg ( const char *  folder,
const char *  match,
int  nested 
)
static

Definiert in Zeile 940 der Datei gui_fselect.c.

941 {
942  DIR *d;
943  fs_dirent de;
944  int rv = 0;
945 
946  // Open directory
947  d = opendir_fselect(folder);
948 
949  if (d)
950  {
951  // Process contents
952  while (fs_readdir(d, &de, folder) && !rv)
953  {
954  if (!de.deleted)
955  {
956  // Sub directory? Process recursively (but only 'nested' levels deep)
957  if (de.isdir)
958  {
959  if (!de.isparent && !de.iscurrent && nested)
960  {
961  // Search sub-directory
962  char *path = malloc(strlen(folder) + strlen(de.de->d_name) + 2);
963  sprintf(path, "%s/%s", folder, de.de->d_name);
964  if (find_jpg(path, match, nested-1))
965  rv = 1;
966  free(path);
967  }
968  }
969  else
970  {
971  //If the four digits of the Canon number are the same AND file is JPG
972  if (is_jpg(de.de->d_name) && (strncmp(match+4, de.de->d_name+4, 4) == 0))
973  rv = 1;
974  }
975  }
976  }
977  closedir(d);
978  }
979 
980  return rv;
981 }
static void free_list ( flist list)
static

Definiert in Zeile 166 der Datei gui_fselect.c.

167 {
168  fitem *ptr = list->head;
169 
170  while (ptr)
171  {
172  fitem *prev = ptr;
173  ptr = ptr->next;
174  free(prev);
175  }
176 
177  list->head = list->tail = 0;
178  list->count = 0;
179 }
static int fs_readdir ( DIR d,
fs_dirent de,
const char *  path 
)
static

Definiert in Zeile 464 der Datei gui_fselect.c.

465 {
466  // DO NOT USE 'selected_file' global var.
467  // This function is called from GUI task, 'selected_file' is used by 'KBD' task
468  char pbuf[MAX_PATH_LEN];
469 
470  de->de = readdir(d);
471  de->size = 0;
472  de->mtime = 0;
473  de->deleted = 0;
474  de->isparent = 0;
475  de->iscurrent = 0;
476  de->isdir = 0;
477  de->isvalid = 0;
478  de->ishidden = 0;
479 
480  if (de->de)
481  {
482  if (de->de->d_name[0] == 0xE5)
483  {
484  de->deleted = 1;
485  }
486  else
487  {
488  de->isparent = is_parent(de->de->d_name);
489  de->iscurrent = is_current(de->de->d_name);
490 
491  sprintf(pbuf, "%s/%s", path, de->de->d_name);
492  struct stat st;
493  if (de->isparent || de->iscurrent)
494  {
495  de->isdir = 1;
496  de->isvalid = 1;
497  }
498  else if (stat(pbuf, &st) == 0)
499  {
500  de->size = st.st_size;
501  de->mtime = st.st_mtime;
502  de->isvalid = 1;
503  de->isdir = ((st.st_attrib & DOS_ATTR_DIRECTORY) != 0);
504  de->ishidden = ((st.st_attrib & DOS_ATTR_HIDDEN) != 0);
505  }
506  }
507 
508  return 1;
509  }
510 
511  return 0;
512 }
static void fselect_chdk_replace_cb ( unsigned int  btn)
static

Definiert in Zeile 1211 der Datei gui_fselect.c.

1212 {
1213  if (btn == MBOX_BTN_YES)
1214  {
1215  copy_file(items.dir, selected->name, "A", "DISKBOOT.BIN", 1);
1216  gui_browser_progress_show("Please reboot",100);
1217  }
1218 }
static void fselect_delete_file_cb ( unsigned int  btn)
static

Definiert in Zeile 925 der Datei gui_fselect.c.

926 {
927  if (btn==MBOX_BTN_YES)
928  {
929  started();
931  finished();
933  }
934  gui_fselect_redraw = 2;
935 }
static void fselect_delete_folder_cb ( unsigned int  btn)
static

Definiert in Zeile 1062 der Datei gui_fselect.c.

1063 {
1064  if (btn==MBOX_BTN_YES)
1065  {
1067  gui_fselect_readdir = 1;
1068  }
1069  gui_fselect_redraw = 2;
1070 }
static void fselect_goto_next ( int  step)
static

Definiert in Zeile 591 der Datei gui_fselect.c.

592 {
593  int j;
594  for (j=0; j<step; ++j)
595  {
596  if (selected->next)
597  {
598  selected = selected->next; // next line
599  if (((selected->n - top->n) == (BODY_LINES - 1)) && selected->next)
600  top = top->next;
601  }
602  else if (step == 1)
603  {
604  selected = top = items.head; // off bottom - jump to top
605  }
606  }
607 }
static void fselect_goto_prev ( int  step)
static

Definiert in Zeile 568 der Datei gui_fselect.c.

569 {
570  int j, i;
571 
572  for (j=0; j<step; ++j)
573  {
574  if (selected->prev)
575  {
576  selected = selected->prev; // previous line
577  if (selected == top && top->prev)
578  top = top->prev;
579  }
580  else if (step == 1)
581  {
582  // off top - jump to bottom
583  selected = top = items.tail;
584  while (((selected->n - top->n) < (BODY_LINES - 1)) && top->prev)
585  top = top->prev;
586  }
587  }
588 }
static void fselect_marked_copy_list ( )
static

Definiert in Zeile 1096 der Datei gui_fselect.c.

1097 {
1099 
1100  fitem *ptr;
1101 
1102  for (ptr=items.head; ptr; ptr=ptr->next)
1103  if (ptr->marked)
1104  add_item(&marked_items, ptr->name, ptr->size, ptr->mtime, 1, ptr->isdir, ptr->isparent, ptr->isvalid);
1105 
1106  if (!marked_items.count)
1107  if (selected && selected->isvalid && !selected->isdir)
1109 
1111 }
static unsigned int fselect_marked_count ( )
static

Definiert in Zeile 1167 der Datei gui_fselect.c.

1168 {
1169  register unsigned int cnt = fselect_real_marked_count();
1170 
1171  if (!cnt)
1172  {
1173  if (selected && selected->isvalid && !selected->isdir)
1174  ++cnt;
1175  }
1176 
1177  return cnt;
1178 }
static void fselect_marked_delete_cb ( unsigned int  btn)
static

Definiert in Zeile 1181 der Datei gui_fselect.c.

1182 {
1183  fitem *ptr;
1184  unsigned int del_cnt=0, cnt;
1185 
1186  if (btn != MBOX_BTN_YES) return;
1187 
1188  cnt = fselect_marked_count();
1189  for (ptr=items.head; ptr; ptr=ptr->next)
1190  if (ptr->marked && ptr->isvalid && !ptr->isdir)
1191  {
1192  started();
1193  ++del_cnt;
1194  if (cnt)
1196  delete_file(items.dir, ptr->name);
1197  finished();
1198  }
1199 
1200  if (del_cnt == 0 && selected)
1201  {
1202  started();
1204  finished();
1205  }
1206  gui_fselect_readdir = 1;
1207  gui_fselect_redraw = 2;
1208 }
static void fselect_marked_inverse_selection ( )
static

Definiert in Zeile 1221 der Datei gui_fselect.c.

1222 {
1223  fitem *ptr;
1224 
1225  for (ptr=items.head; ptr; ptr=ptr->next)
1226  if (ptr->isvalid && !ptr->isdir)
1227  ptr->marked = !ptr->marked;
1228 
1229  gui_fselect_redraw = 2;
1230 }
static void fselect_marked_paste_cb ( unsigned int  btn)
static

Definiert in Zeile 1114 der Datei gui_fselect.c.

1115 {
1116  fitem *ptr;
1117  int i = 0;
1118 
1119  if (btn != MBOX_BTN_YES) return;
1120 
1121  if (strcmp(marked_items.dir, items.dir) != 0)
1122  {
1123  for (ptr=marked_items.head; ptr; ptr=ptr->next)
1124  {
1125  if (ptr->isvalid && !ptr->isdir)
1126  {
1127  started();
1128 
1129  ++i;
1130  if (marked_items.count)
1132 
1133  int copied = copy_file(marked_items.dir, ptr->name, items.dir, ptr->name, 0);
1134 
1135  if (copied && (marked_operation == MARKED_OP_CUT))
1136  {
1138  }
1139 
1140  finished();
1141  }
1142  }
1144  {
1146  }
1147  gui_fselect_readdir = 1;
1148  }
1149  gui_fselect_redraw = 2;
1150 }
static void fselect_marked_toggle ( )
static

Definiert in Zeile 1080 der Datei gui_fselect.c.

1081 {
1082  if (selected && selected->isvalid && !selected->isdir)
1083  {
1085  }
1086 }
static void fselect_mpopup_cb ( unsigned int  actn)
static

Definiert in Zeile 1386 der Datei gui_fselect.c.

1387 {
1388  switch (actn)
1389  {
1390  case MPOPUP_CUT:
1393  break;
1394  case MPOPUP_COPY:
1397  break;
1398  case MPOPUP_PASTE:
1402  break;
1403  case MPOPUP_DELETE:
1407  break;
1408  case MPOPUP_RMDIR:
1410  break;
1411  case MPOPUP_MKDIR:
1413  break;
1414  case MPOPUP_RENAME:
1416  break;
1417  case MPOPUP_PURGE_DCIM:
1418  //If selected folder is A/DCIM or A/RAW (this is to purge all RAW files in any sub-folder)
1420  break;
1421  case MPOPUP_PURGE_DIR:
1422  //If selected item is a Canon folder
1424  break;
1425  case MPOPUP_PURGE_FILE:
1426  //If selected item is a file produced by the camera
1428  break;
1429  case MPOPUP_SELINV:
1431  break;
1432  case MPOPUP_CANCEL:
1433  break;
1434 
1435  case MPOPUP_RAWOPS:
1437  break;
1438 
1439  case MPOPUP_CHDK_REPLACE:
1440  gui_mbox_init((int)"Replacing CHDK", (int)"Do you want to replace current CHDK with this file",
1442  break;
1443  case MPOPUP_EDITOR:
1444  gui_mbox_init((int)"Editor", (int)"edit", MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL);
1445  break;
1446  }
1447  gui_fselect_redraw = 2;
1448 }
static void fselect_mpopup_rawop_cb ( unsigned int  actn)
static

Definiert in Zeile 1324 der Datei gui_fselect.c.

1325 {
1326  switch (actn) {
1327  case MPOPUP_RAW_AVERAGE:
1330  break;
1331  case MPOPUP_RAW_ADD:
1334  break;
1335  case MPOPUP_RAW_DEVELOP:
1336  sprintf(buf, "%s/%s", items.dir, selected->name);
1338  break;
1339  case MPOPUP_SUBTRACT:
1341  break;
1342  case MPOPUP_DNG_TO_CRW:
1344  break;
1345  }
1346 }
static void fselect_purge_cb_DCIM ( unsigned int  btn)
static

Definiert in Zeile 1005 der Datei gui_fselect.c.

1006 {
1007  if (btn == MBOX_BTN_YES)
1008  {
1009  //If selected folder is A/DCIM or A/RAW (this is to purge all RAW files in any sub-folder)
1011  }
1012 }
static void fselect_purge_cb_dir ( unsigned int  btn)
static

Definiert in Zeile 1014 der Datei gui_fselect.c.

1015 {
1016  if (btn == MBOX_BTN_YES)
1017  {
1018  //If item is a Canon sub-folder of A/DCIM or A/RAW (this is to purge all RAW files inside a single Canon folder)
1020  }
1021 }
static void fselect_purge_cb_file ( unsigned int  btn)
static

Definiert in Zeile 1023 der Datei gui_fselect.c.

1024 {
1025  if (btn == MBOX_BTN_YES)
1026  {
1027  //Inside a Canon folder (files list)
1028  fitem *ptr, *ptr2;
1029 
1030  //Loop to find all the RAW files in the list
1031  for (ptr=items.head; ptr; ptr=ptr->next)
1032  {
1033  //If file is RAW (Either CRW/CR2 prefix or file extension) and is not marked
1034  if (is_raw(ptr->name) && !ptr->marked)
1035  {
1036  // Flag for checking if matching JPG exists
1037  int found = 0;
1038 
1039  //Loop to find a corresponding JPG file in the list
1040  for (ptr2=items.head; ptr2; ptr2=ptr2->next)
1041  {
1042  //If this is a JPG and the four digits of the Canon number are the same
1043  if (is_jpg(ptr2->name) && (strncmp(ptr->name+4, ptr2->name+4, 4) == 0))
1044  {
1045  found=1;
1046  break;
1047  }
1048  }
1049 
1050  //If no JPG found, delete RAW file
1051  if (found == 0)
1052  delete_file(items.dir, ptr->name);
1053  }
1054  }
1055  gui_fselect_readdir = 1;
1056  }
1057  gui_fselect_redraw = 2;
1058 }
static unsigned int fselect_real_marked_count ( )
inlinestatic

Definiert in Zeile 1153 der Datei gui_fselect.c.

1154 {
1155  fitem *ptr;
1156  register unsigned int cnt = 0;
1157 
1158  for (ptr=items.head; ptr; ptr=ptr->next)
1159  {
1160  if (ptr->isvalid && !ptr->isdir && ptr->marked)
1161  ++cnt;
1162  }
1163  return cnt;
1164 }
int fselect_sort ( const void *  v1,
const void *  v2 
)

Definiert in Zeile 209 der Datei gui_fselect.c.

210 {
211  fitem *i1 = *((fitem **)v1);
212  fitem *i2 = *((fitem **)v2);
213 
214  if (i1->isdir)
215  {
216  if (i2->isdir)
217  {
218  if (i1->isparent)
219  {
220  return -1;
221  }
222  else if (i2->isparent)
223  {
224  return 1;
225  }
226  else
227  {
228  return strcmp(i1->name, i2->name);
229  }
230  }
231  else
232  {
233  return -1;
234  }
235  }
236  else
237  {
238  if (i2->isdir)
239  {
240  return 1;
241  }
242  else
243  {
244  return strcmp(i1->name, i2->name);
245  }
246  }
247 }
static void fselect_subtract_cb ( unsigned int  btn)
static

Definiert in Zeile 1251 der Datei gui_fselect.c.

1252 {
1253  fitem *ptr;
1254  if (btn != MBOX_BTN_YES) return;
1255 
1256  for (ptr=items.head; ptr; ptr=ptr->next)
1257  {
1258  if (ptr->marked && ptr->isvalid && !ptr->isdir && chk_name(ptr->name,selected->name))
1259  {
1261  }
1262  }
1263  gui_fselect_readdir = 1;
1264  gui_fselect_redraw = 2;
1265 }
void gui_fselect_draw ( int  enforce_redraw)

Definiert in Zeile 741 der Datei gui_fselect.c.

742 {
743  int i, j;
744  twoColors cl_marked, cl_selected;
745 
747  {
750  }
751 
752  if (enforce_redraw)
753  gui_fselect_redraw = 2;
754 
755  if (gui_fselect_redraw)
756  {
757  char dbuf[46];
758 
759  if (gui_fselect_redraw == 2)
760  {
761  // Title
763 
765  draw_line(main_x, body_y-1, main_x+main_w-1, body_y-1, COLOR_WHITE); //border head-body
766  draw_line(main_x, foot_y-1, main_x+main_w-1, foot_y-1, COLOR_WHITE); //border body-foot
767  }
768 
769  int off_body_y = body_y;
770 
771  fitem *ptr;
772  unsigned long sum_size = 0;
773  for (i=0, ptr=top; i<BODY_LINES && ptr; ++i, ptr=ptr->next, off_body_y += FONT_HEIGHT)
774  {
775  cl_marked = MAKE_COLOR((ptr==selected)?COLOR_RED:COLOR_GREY, (ptr->marked)?COLOR_YELLOW:COLOR_WHITE);
776 
777  // print name
778  j = strlen(ptr->name);
779  strncpy(dbuf, ptr->name, NAME_SIZE);
780  if (j > NAME_SIZE)
781  dbuf[NAME_SIZE-1] = '~'; // too long name
782 
783  if (ptr->isdir && ptr->isvalid)
784  {
785  if (j < NAME_SIZE)
786  {
787  dbuf[j++] = '/';
788  }
789  else
790  {
791  dbuf[NAME_SIZE-2] = '~';
792  dbuf[NAME_SIZE-1] = '/';
793  }
794  }
795  for (; j < NAME_SIZE; j++)
796  dbuf[j] = ' ';
797  j = NAME_SIZE;
798  dbuf[j++] = 0x06; // Vertical line
799 
800  // print size or <Dir>
801  if (ptr->isdir)
802  {
803  if (!ptr->isvalid)
804  {
805  sprintf(dbuf+j, " ??? ");
806  }
807  else if (ptr->isparent)
808  {
809  sprintf(dbuf+j, " <Up> ");
810  }
811  else
812  {
813  sprintf(dbuf+j, " <Dir>");
814  }
815  }
816  else
817  {
818  unsigned long n = ptr->size;
819 
820  if (ptr->marked)
821  sum_size += n;
822 
823  if (n < 1024)
824  sprintf(dbuf+j, "%5db", n); // " 1023 b"
825  else
826  {
827  static char* suffixes = "kMG";
828  int sfx = 0;
829  if (n >= 4294967245ul) // 4GB - 51 - avoid overflow
830  {
831  sfx = 2; // 'G' suffix
832  n = 4096; // 4G
833  }
834  else
835  {
836  // Round to 1 decimal place (51 = 1024 * 0.05)
837  n += 51;
838  // Reduce and round until < 1M, incrementing size suffix index
839  while (n >= 1024*1024)
840  {
841  n >>= 10;
842  n += 51;
843  sfx += 1;
844  }
845  }
846  unsigned long f = ((n & 0x3FF) * 10) >> 10; // 1 digit of remainder % 1024
847  sprintf(dbuf+j, "%3d.%1d%c", n >> 10, f, suffixes[sfx]);
848  }
849  }
850  j += SIZE_SIZE;
851  dbuf[j++] = 0x06; // Vertical line
852 
853  // print modification time
854  if (ptr->mtime)
855  {
856  struct tm *time = localtime(&(ptr->mtime));
857  sprintf(dbuf+j, "%02u.%02u'%02u %02u:%02u", time->tm_mday, time->tm_mon+1, (time->tm_year<100)?time->tm_year:time->tm_year-100, time->tm_hour, time->tm_min);
858  }
859  else
860  {
861  sprintf(dbuf+j, "%14s", "");
862  }
863  j += TIME_SIZE;
864  dbuf[j] = 0;
865 
866  draw_string_justified(main_x, off_body_y, dbuf, cl_marked, SPACING, main_w-SCROLLBAR, TEXT_LEFT|TEXT_FILL);
867  }
868 
869  //fill the rest of body
870  if (i>0 && i<BODY_LINES)
871  {
873  }
874 
875  // scrollbar
876  int off_sbar_x = main_x + main_w - SCROLLBAR;
878  if (items.count > BODY_LINES)
879  {
880  i = BODY_FONT_LINES - 1;
881  j = (i * BODY_LINES) / items.count;
882  if (j < 20) j = 20;
883  i = ((i - j) * selected->n) / (items.count-1);
884  draw_rectangle(off_sbar_x, body_y+i, off_sbar_x+SCROLLBAR-2, body_y+i+j, MAKE_COLOR(COLOR_WHITE, COLOR_WHITE), RECT_BORDER0|DRAW_FILLED);
885  }
886 
887  //footer
888  int max_footer_len = NAME_SIZE + SIZE_SIZE + SPACING;
889  i = strlen(items.dir);
890  if (i > max_footer_len)
891  {
892  strncpy(dbuf, items.dir+i-max_footer_len, max_footer_len);
893  dbuf[0] = '.';
894  dbuf[1] = '.';
895  }
896  else
897  {
898  strcpy(dbuf, items.dir);
899  }
901 
902  if (sum_size)
903  {
904  sprintf(dbuf, "%d b", sum_size); //selected size
905  }
906  else
907  {
908  unsigned int fr = GetFreeCardSpaceKb();
909  unsigned int tot = GetTotalCardSpaceKb();
910  if (tot != 0)
911  tot = (fr * 100) / tot;
912 
913  if (fr < 1024*1024)
914  sprintf(dbuf, "%dM (%d%%)", fr>>10, tot);
915  else
916  sprintf(dbuf, "%d.%dG (%d%%)", fr>>20, ((fr&0x000FFFFF)*100)>>20, tot);
917  }
918  draw_string(main_x+main_w-strlen(dbuf)*FONT_WIDTH-BORDER, foot_y, dbuf, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); // free space
919 
920  gui_fselect_redraw = 0;
921  }
922 }
int gui_fselect_find_start_dir ( const char *  dir)

Definiert in Zeile 659 der Datei gui_fselect.c.

660 {
661  selected_file[0] = 0;
662  strcpy(items.dir, dir);
663 
664  // Make sure there is something left to check
665  while (strlen(items.dir) > 0)
666  {
667  // Find start of filename part (if present)
668  char *p = strrchr(items.dir,'/');
669 
670  struct stat st;
671  // check if input 'dir' exists
672  if (stat(items.dir,&st) == 0)
673  {
674  // exists - check if it is a directory or file
675  if ((st.st_attrib & DOS_ATTR_DIRECTORY) == 0)
676  {
677  // 'dir' is a file, copy filename to 'selected_file' and remove from 'items.dir'
678  strcpy(selected_file, p+1);
679  *p = 0;
680  }
681  return 1;
682  }
683  else
684  {
685  // could not find 'dir' - try one level up
686  if (p)
687  *p = 0;
688  else
689  return 0;
690  }
691  }
692 
693  return 0;
694 }
static void gui_fselect_free_data ( )
static

Definiert in Zeile 610 der Datei gui_fselect.c.

611 {
612  free_list(&items);
613  top = selected = NULL;
614 }
void gui_fselect_init ( int  title,
const char *  prev_dir,
const char *  default_dir,
void(*)(const char *fn on_select 
)

Definiert in Zeile 697 der Datei gui_fselect.c.

698 {
699  running = 1;
700 
702  main_x = (camera_screen.width - main_w) >> 1;
703  main_y = (camera_screen.height - MAIN_H) >> 1;
704 
707 
708  fselect_title = lang_str(title);
709 
710  // Try and set start directory, and optionally selected file, from inputs
711  if (!gui_fselect_find_start_dir(prev_dir))
712  if (!gui_fselect_find_start_dir(default_dir))
714 
716 
717  // Find selected file if it exists in list
718  if (selected_file[0])
719  {
720  fitem *p = items.head;
721  while (p)
722  {
723  if (chk_name(p->name,selected_file))
724  {
725  break;
726  }
727  p = p->next;
729  }
730  if (!p) selected_file[0] = 0;
731  }
732 
733  fselect_on_select = on_select;
735  gui_fselect_redraw = 2;
738 }
int gui_fselect_kbd_process ( )

Definiert in Zeile 1474 der Datei gui_fselect.c.

1475 {
1476  int i;
1477  int do_exit = 0;
1478 
1480  {
1481  case JOGDIAL_LEFT:
1482  case KEY_UP:
1483  if (selected)
1484  {
1486  else fselect_goto_prev(1);
1487  gui_fselect_redraw = 1;
1488  }
1489  break;
1490  case KEY_DOWN:
1491  case JOGDIAL_RIGHT:
1492  if (selected)
1493  {
1495  else fselect_goto_next(1);
1496  gui_fselect_redraw = 1;
1497  }
1498  break;
1499  case KEY_ZOOM_OUT:
1500  if (selected)
1501  {
1503  gui_fselect_redraw = 1;
1504  }
1505  break;
1506  case KEY_ZOOM_IN:
1507  if (selected)
1508  {
1510  gui_fselect_redraw = 1;
1511  }
1512  break;
1513  case KEY_RIGHT:
1514  if (selected)
1515  {
1517  fselect_goto_next(1);
1518  gui_fselect_redraw = 1;
1519  }
1520  break;
1521  case KEY_LEFT:
1522  if (selected && selected->isvalid)
1523  {
1524  int marked_count = fselect_marked_count();
1525 
1527  mpopup_rawop_flag = 0;
1528 
1529  if (marked_count > 0)
1530  {
1532  if (marked_count > 1)
1534  // doesn't make sense to subtract from itself!
1535  if (selected->marked == 0 && fselect_real_marked_count() > 0)
1537  }
1538 
1540  i |= MPOPUP_PASTE;
1541 
1542  //Check if 'Purge RAW' applies
1543  if (isPurgeDCIM()) // DCIM or RAW selected in A
1544  i |= MPOPUP_PURGE_DCIM;
1545  if (isPurgeDir()) // sub-dir selected in A/DCIM or A/RAW
1546  i |= MPOPUP_PURGE_DIR;
1547  if (is_raw(selected->name)) // raw file selected
1548  i |= MPOPUP_PURGE_FILE;
1549 
1550  if (selected->isdir && !selected->isparent)
1551  i |= MPOPUP_RMDIR;
1552 
1553  if (!selected->isparent) //If item is not UpDir
1554  i |= MPOPUP_RENAME;
1555 
1558 
1559  if ((marked_count > 1) || (selected->size > camera_sensor.raw_size))
1561 
1562  if (chk_ext(selected->name, "bin")) //If item is *.bin file
1563  i |= MPOPUP_CHDK_REPLACE;
1564 
1565  if (mpopup_rawop_flag)
1566  i |= MPOPUP_RAWOPS;
1567 
1569  }
1570  break;
1571  case KEY_SET:
1573  {
1574  if (selected->isdir)
1575  {
1576  if (selected->isparent)
1577  {
1578  char *s = strrchr(items.dir, '/');
1579  if (s) *s = 0;
1580  }
1581  else
1582  {
1584  }
1585  gui_fselect_readdir = 1;
1586  gui_fselect_redraw = 1;
1587  }
1588  else
1589  {
1590  sprintf(selected_file, "%s/%s", items.dir, selected->name);
1591 
1592  char *ext = strrchr(selected->name,'.');
1593  do_exit = 1;
1594 
1595  if (!fselect_on_select)
1596  {
1597  if (chk_ext(ext,"txt") || chk_ext(ext,"log") || chk_ext(ext,"csv"))
1598  {
1599  fselect_on_select = (void (*)(const char*))libtxtread->read_file;
1600  }
1601  else if (chk_ext(ext,"flt"))
1602  {
1603  fselect_on_select = (void (*)(const char*))module_run;
1604  }
1605  }
1606  }
1607  }
1608  break;
1609  case KEY_ERASE:
1610  case KEY_DISPLAY:
1611  if (selected && selected->isvalid)
1612  {
1613  if (selected->isdir)
1614  {
1616  } else
1617  {
1620  }
1621  }
1622  break;
1623  }
1624 
1625  if (do_exit)
1627 
1628  return 0;
1629 }
void gui_fselect_kbd_process_menu_btn ( )

Definiert in Zeile 1631 der Datei gui_fselect.c.

1632 {
1633  // just free resource. callback called with NULL ptr
1634  exit_fselect(0);
1635 }
static void gui_fselect_marked_free_data ( )
static

Definiert in Zeile 1089 der Datei gui_fselect.c.

1090 {
1093 }
static void gui_fselect_read_dir ( )
static

Definiert in Zeile 617 der Datei gui_fselect.c.

618 {
619  DIR *d;
620  fs_dirent de;
621  int fndParent = 0; // Set if parent ".." directory returned by fs_readdir (does not exist on exFat paritions)
622 
624 
625  if ((items.dir[0] == 'A') && (items.dir[1] == 0))
626  d = opendir_fselect("A/");
627  else
629 
630  if (d)
631  {
632  while (fs_readdir(d, &de, items.dir))
633  {
634  if (!de.deleted && !de.iscurrent && (conf.show_hiddenfiles || !de.ishidden))
635  {
636  add_item(&items, de.de->d_name, de.size, de.mtime, 0, de.isdir, de.isparent, de.isvalid);
637  if (de.isparent)
638  fndParent = 1;
639  }
640  }
641  closedir(d);
642  }
643 
644  // If not reading root directory, and ".." not found, then add it (for exFat partitions)
645  if ((strlen(items.dir) > 2) && !fndParent)
646  {
647  add_item(&items, "..", 0, 0, 0, 1, 1, 1);
648  }
649 
650  sort_list(&items);
651 
652  top = selected = items.head;
653 }
static int is_current ( const char *  name)
static

Definiert in Zeile 338 der Datei gui_fselect.c.

338 { return (strcmp(name, ".") == 0); }
static int is_jpg ( const char *  name)
static

Definiert in Zeile 348 der Datei gui_fselect.c.

349 {
350  return (chk_prefix(name,"img_")) && (chk_ext(name,"jpg"));
351 }
static int is_parent ( const char *  name)
static

Definiert in Zeile 337 der Datei gui_fselect.c.

337 { return (strcmp(name, "..") == 0); }
static int is_raw ( const char *  name)
static

Definiert in Zeile 341 der Datei gui_fselect.c.

342 {
343  return ((chk_prefix(name,"crw_") || (chk_prefix(name,"img_")))) &&
344  ((chk_ext(name,"cr2") || (chk_ext(name,"crw") || (chk_ext(name,"dng")))));
345 }
static int isPurgeDCIM ( )
static

Definiert in Zeile 1375 der Datei gui_fselect.c.

1376 {
1377  return (chk_name(items.dir, "A") && (chk_name(selected->name, "DCIM") || chk_name(selected->name, "RAW")));
1378 }
static int isPurgeDir ( )
static

Definiert in Zeile 1381 der Datei gui_fselect.c.

1382 {
1383  return (selected->isdir && !selected->isparent && ((chk_name(items.dir, "A/DCIM")) || (chk_name(items.dir, "A/RAW"))));
1384 }
static void mkdir_cb ( const char *  name)
static

Definiert in Zeile 1348 der Datei gui_fselect.c.

1349 {
1350  if (name)
1351  {
1352  sprintf(selected_file,"%s/%s", items.dir, name);
1354  gui_fselect_readdir = 1;
1355  gui_fselect_redraw = 2;
1356  }
1357 }
static DIR* opendir_fselect ( const char *  path)
static

Definiert in Zeile 368 der Datei gui_fselect.c.

static void process_dir ( const char *  parent,
const char *  name,
int  nested,
void(*)(const char *path, const char *file)  file_process,
void(*)(const char *path)  dir_process 
)
static

Definiert in Zeile 518 der Datei gui_fselect.c.

519 {
520  DIR *d;
521  fs_dirent de;
522 
523  // Get full name
524  char *path;
525  if (name)
526  {
527  path = malloc(strlen(parent) + strlen(name) + 2);
528  sprintf(path, "%s/%s", parent, name);
529  }
530  else
531  {
532  path = (char*)parent;
533  }
534 
535  // Open directory
536  d = opendir_fselect(path);
537 
538  if (d)
539  {
540  // Process contents
541  while (fs_readdir(d, &de, path))
542  {
543  if (!de.deleted)
544  {
545  // Sub directory? Process recursively (but only 'nested' level deep)
546  if (de.isdir)
547  {
548  if (!de.isparent && !de.iscurrent && nested)
549  process_dir(path, de.de->d_name, nested-1, file_process, dir_process);
550  }
551  else if (file_process)
552  {
553  file_process(path, de.de->d_name);
554  }
555  }
556  }
557  closedir(d);
558 
559  if (dir_process)
560  dir_process(path);
561  }
562 
563  if (name)
564  free(path);
565 }
void process_dng_to_raw_files ( void  )

Definiert in Zeile 1298 der Datei gui_fselect.c.

1299 {
1300  fitem *ptr;
1301  int i=0;
1302  started();
1303  msleep(100);
1304  finished();
1305 
1307  {
1308  for (ptr=items.head; ptr; ptr=ptr->next)
1309  if (ptr->marked && ptr->isvalid && !ptr->isdir)
1310  {
1311  sprintf(selected_file, "%s/%s", items.dir, ptr->name);
1314  }
1315  }
1316  else
1317  {
1318  sprintf(selected_file, "%s/%s", items.dir, selected->name);
1320  }
1321  gui_fselect_readdir = 1;
1322 }
void process_raw_files ( void  )

Definiert in Zeile 1233 der Datei gui_fselect.c.

1234 {
1235  fitem *ptr;
1236 
1238  {
1239  for (ptr=items.head; ptr; ptr=ptr->next)
1240  if (ptr->marked && ptr->isvalid && !ptr->isdir)
1241  {
1242  sprintf(selected_file, "%s/%s", items.dir, ptr->name);
1244  }
1246  gui_fselect_readdir = 1;
1247  gui_fselect_redraw = 2;
1248  }
1249 }
static void purge_file ( const char *  folder,
const char *  file 
)
static

Definiert in Zeile 985 der Datei gui_fselect.c.

986 {
987  //If no JPG found, delete RAW file
988  if (is_raw(file))
989  if (!find_jpg(folder, file, 0))
990  delete_file(folder, file);
991 }
static void purge_file_DCIM ( const char *  folder,
const char *  file 
)
static

Definiert in Zeile 997 der Datei gui_fselect.c.

998 {
999  //If no JPG found, delete RAW file (search all sub-folders of A/DCIM for JPG)
1000  if (is_raw(file))
1001  if (!find_jpg("A/DCIM", file, 1))
1002  delete_file(folder, file);
1003 }
static void rename_cb ( const char *  name)
static

Definiert in Zeile 1359 der Datei gui_fselect.c.

1360 {
1361  if (name)
1362  {
1363  sprintf(selected_file, "%s/%s", items.dir, selected->name);
1364  sprintf(buf, "%s/%s", items.dir, name);
1366  gui_fselect_readdir = 1;
1367  gui_fselect_redraw = 2;
1368  }
1369 }
static void setup_batch_subtract ( void  )
static

Definiert in Zeile 1268 der Datei gui_fselect.c.

1269 {
1270  fitem *ptr;
1271  int i;
1272  char *p = buf + sprintf(buf,"%s %s\n",selected->name,lang_str(LANG_FSELECT_SUB_FROM));
1273  for (ptr=items.head, i=0; ptr; ptr=ptr->next)
1274  {
1275  if (ptr->marked && ptr->isvalid && !ptr->isdir && (ptr->size >= camera_sensor.raw_size))
1276  {
1277  if ( i < MAX_SUB_NAMES )
1278  {
1279  sprintf(p, "%s\n",ptr->name);
1280  // keep a pointer to the one before the end, so we can stick ...and more on
1281  if (i < MAX_SUB_NAMES - 1)
1282  {
1283  p += strlen(p);
1284  }
1285  }
1286  i++;
1287  }
1288  }
1289  if (i > MAX_SUB_NAMES)
1290  {
1291 // "...%d more files"
1293  }
1296 }
static void sort_list ( flist list)
static

Definiert in Zeile 249 der Datei gui_fselect.c.

250 {
251  if (list->count)
252  {
253  // sort
254  fitem **sbuf = malloc(list->count*sizeof(fitem*));
255  if (sbuf)
256  {
257  fitem *ptr = list->head;
258  int i = 0;
259  while (ptr)
260  {
261  sbuf[i++] = ptr;
262  ptr = ptr->next;
263  }
264 
265  extern int fselect_sort_nothumb(const void* v1, const void* v2);
266  qsort(sbuf, list->count, sizeof(fitem*), fselect_sort_nothumb);
267 
268  list->head = sbuf[0];
269  list->tail = sbuf[list->count-1];
270  for (i=0; i<list->count-1; i++)
271  {
272  sbuf[i]->n = i;
273  sbuf[i]->next = sbuf[i+1];
274  sbuf[i+1]->prev = sbuf[i];
275  }
276  list->head->prev = 0;
277  list->tail->next = 0;
278  list->tail->n = list->count - 1;
279 
280  free(sbuf);
281  }
282  }
283 }

Variablen-Dokumentation

libfselect_sym _libfselect
Initialisierung:

Definiert in Zeile 1672 der Datei gui_fselect.c.

coord body_y
static

Definiert in Zeile 104 der Datei gui_fselect.c.

char buf[MAX_PATH_LEN]
static

Definiert in Zeile 66 der Datei gui_fselect.c.

coord foot_y
static

Definiert in Zeile 105 der Datei gui_fselect.c.

void(* fselect_on_select)(const char *fn)
static

Definiert in Zeile 111 der Datei gui_fselect.c.

char* fselect_title
static

Definiert in Zeile 109 der Datei gui_fselect.c.

gui_handler* gui_fselect_mode_old
static

Definiert in Zeile 60 der Datei gui_fselect.c.

int gui_fselect_readdir
static

Definiert in Zeile 108 der Datei gui_fselect.c.

int gui_fselect_redraw
static

Definiert in Zeile 107 der Datei gui_fselect.c.

gui_handler GUI_MODE_FSELECT_MODULE
Initialisierung:

Definiert in Zeile 32 der Datei gui_fselect.c.

flist items
static

Definiert in Zeile 93 der Datei gui_fselect.c.

coord main_w
static

Definiert in Zeile 103 der Datei gui_fselect.c.

coord main_x
static

Definiert in Zeile 103 der Datei gui_fselect.c.

coord main_y
static

Definiert in Zeile 103 der Datei gui_fselect.c.

flist marked_items
static

Definiert in Zeile 94 der Datei gui_fselect.c.

char marked_operation
static

Definiert in Zeile 99 der Datei gui_fselect.c.

int mpopup_rawop_flag
static

Definiert in Zeile 1371 der Datei gui_fselect.c.

struct mpopup_item popup_rawop[]
static
Initialisierung:

Definiert in Zeile 154 der Datei gui_fselect.c.

char raw_operation
static

Definiert in Zeile 112 der Datei gui_fselect.c.

int running = 0
static

Definiert in Zeile 59 der Datei gui_fselect.c.

fitem* selected
static

Definiert in Zeile 97 der Datei gui_fselect.c.

char selected_file[MAX_PATH_LEN]
static

Definiert in Zeile 65 der Datei gui_fselect.c.

fitem* top
static

Definiert in Zeile 96 der Datei gui_fselect.c.

unsigned char* ubuf = 0
static

Definiert in Zeile 374 der Datei gui_fselect.c.