CHDK_DE Vorschauversion  Trunk Rev. 5163
 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 1260 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 1654 der Datei gui_fselect.c.

1655 {
1656  return running == 0;
1657 }
int _module_exit_alt ( )

Definiert in Zeile 1659 der Datei gui_fselect.c.

1660 {
1661  exit_fselect(0);
1662  return 0;
1663 }
int _module_unloader ( )

Definiert in Zeile 1642 der Datei gui_fselect.c.

1643 {
1644  // Free file copy buffer if allocated
1645  if (ubuf)
1646  {
1647  ufree(ubuf);
1648  ubuf = 0;
1649  }
1650  finalize_fselect();
1651  return 0;
1652 }
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 1450 der Datei gui_fselect.c.

1451 {
1452  finalize_fselect();
1453 
1455 
1456  if (fselect_on_select)
1457  {
1458  fselect_on_select(file);
1459  // if called mode will return control to filemanager - we need to redraw it
1460  gui_fselect_redraw = 2;
1461  }
1462 
1463  running = 0;
1464 }
void finalize_fselect ( )

Definiert in Zeile 1444 der Datei gui_fselect.c.

1445 {
1448 }
static int find_jpg ( const char *  folder,
const char *  match,
int  nested 
)
static

Definiert in Zeile 933 der Datei gui_fselect.c.

934 {
935  DIR *d;
936  fs_dirent de;
937  int rv = 0;
938 
939  // Open directory
940  d = opendir_fselect(folder);
941 
942  if (d)
943  {
944  // Process contents
945  while (fs_readdir(d, &de, folder) && !rv)
946  {
947  if (!de.deleted)
948  {
949  // Sub directory? Process recursively (but only 'nested' levels deep)
950  if (de.isdir)
951  {
952  if (!de.isparent && !de.iscurrent && nested)
953  {
954  // Search sub-directory
955  char *path = malloc(strlen(folder) + strlen(de.de->d_name) + 2);
956  sprintf(path, "%s/%s", folder, de.de->d_name);
957  if (find_jpg(path, match, nested-1))
958  rv = 1;
959  free(path);
960  }
961  }
962  else
963  {
964  //If the four digits of the Canon number are the same AND file is JPG
965  if (is_jpg(de.de->d_name) && (strncmp(match+4, de.de->d_name+4, 4) == 0))
966  rv = 1;
967  }
968  }
969  }
970  closedir(d);
971  }
972 
973  return rv;
974 }
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 1204 der Datei gui_fselect.c.

1205 {
1206  if (btn == MBOX_BTN_YES)
1207  {
1208  copy_file(items.dir, selected->name, "A", "DISKBOOT.BIN", 1);
1209  gui_browser_progress_show("Please reboot",100);
1210  }
1211 }
static void fselect_delete_file_cb ( unsigned int  btn)
static

Definiert in Zeile 918 der Datei gui_fselect.c.

919 {
920  if (btn==MBOX_BTN_YES)
921  {
922  started();
924  finished();
926  }
927  gui_fselect_redraw = 2;
928 }
static void fselect_delete_folder_cb ( unsigned int  btn)
static

Definiert in Zeile 1055 der Datei gui_fselect.c.

1056 {
1057  if (btn==MBOX_BTN_YES)
1058  {
1060  gui_fselect_readdir = 1;
1061  }
1062  gui_fselect_redraw = 2;
1063 }
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 1089 der Datei gui_fselect.c.

1090 {
1092 
1093  fitem *ptr;
1094 
1095  for (ptr=items.head; ptr; ptr=ptr->next)
1096  if (ptr->marked)
1097  add_item(&marked_items, ptr->name, ptr->size, ptr->mtime, 1, ptr->isdir, ptr->isparent, ptr->isvalid);
1098 
1099  if (!marked_items.count)
1100  if (selected && selected->isvalid && !selected->isdir)
1102 
1104 }
static unsigned int fselect_marked_count ( )
static

Definiert in Zeile 1160 der Datei gui_fselect.c.

1161 {
1162  register unsigned int cnt = fselect_real_marked_count();
1163 
1164  if (!cnt)
1165  {
1166  if (selected && selected->isvalid && !selected->isdir)
1167  ++cnt;
1168  }
1169 
1170  return cnt;
1171 }
static void fselect_marked_delete_cb ( unsigned int  btn)
static

Definiert in Zeile 1174 der Datei gui_fselect.c.

1175 {
1176  fitem *ptr;
1177  unsigned int del_cnt=0, cnt;
1178 
1179  if (btn != MBOX_BTN_YES) return;
1180 
1181  cnt = fselect_marked_count();
1182  for (ptr=items.head; ptr; ptr=ptr->next)
1183  if (ptr->marked && ptr->isvalid && !ptr->isdir)
1184  {
1185  started();
1186  ++del_cnt;
1187  if (cnt)
1189  delete_file(items.dir, ptr->name);
1190  finished();
1191  }
1192 
1193  if (del_cnt == 0 && selected)
1194  {
1195  started();
1197  finished();
1198  }
1199  gui_fselect_readdir = 1;
1200  gui_fselect_redraw = 2;
1201 }
static void fselect_marked_inverse_selection ( )
static

Definiert in Zeile 1214 der Datei gui_fselect.c.

1215 {
1216  fitem *ptr;
1217 
1218  for (ptr=items.head; ptr; ptr=ptr->next)
1219  if (ptr->isvalid && !ptr->isdir)
1220  ptr->marked = !ptr->marked;
1221 
1222  gui_fselect_redraw = 2;
1223 }
static void fselect_marked_paste_cb ( unsigned int  btn)
static

Definiert in Zeile 1107 der Datei gui_fselect.c.

1108 {
1109  fitem *ptr;
1110  int i = 0;
1111 
1112  if (btn != MBOX_BTN_YES) return;
1113 
1114  if (strcmp(marked_items.dir, items.dir) != 0)
1115  {
1116  for (ptr=marked_items.head; ptr; ptr=ptr->next)
1117  {
1118  if (ptr->isvalid && !ptr->isdir)
1119  {
1120  started();
1121 
1122  ++i;
1123  if (marked_items.count)
1125 
1126  int copied = copy_file(marked_items.dir, ptr->name, items.dir, ptr->name, 0);
1127 
1128  if (copied && (marked_operation == MARKED_OP_CUT))
1129  {
1131  }
1132 
1133  finished();
1134  }
1135  }
1137  {
1139  }
1140  gui_fselect_readdir = 1;
1141  }
1142  gui_fselect_redraw = 2;
1143 }
static void fselect_marked_toggle ( )
static

Definiert in Zeile 1073 der Datei gui_fselect.c.

1074 {
1075  if (selected && selected->isvalid && !selected->isdir)
1076  {
1078  }
1079 }
static void fselect_mpopup_cb ( unsigned int  actn)
static

Definiert in Zeile 1379 der Datei gui_fselect.c.

1380 {
1381  switch (actn)
1382  {
1383  case MPOPUP_CUT:
1386  break;
1387  case MPOPUP_COPY:
1390  break;
1391  case MPOPUP_PASTE:
1395  break;
1396  case MPOPUP_DELETE:
1400  break;
1401  case MPOPUP_RMDIR:
1403  break;
1404  case MPOPUP_MKDIR:
1406  break;
1407  case MPOPUP_RENAME:
1409  break;
1410  case MPOPUP_PURGE_DCIM:
1411  //If selected folder is A/DCIM or A/RAW (this is to purge all RAW files in any sub-folder)
1413  break;
1414  case MPOPUP_PURGE_DIR:
1415  //If selected item is a Canon folder
1417  break;
1418  case MPOPUP_PURGE_FILE:
1419  //If selected item is a file produced by the camera
1421  break;
1422  case MPOPUP_SELINV:
1424  break;
1425  case MPOPUP_CANCEL:
1426  break;
1427 
1428  case MPOPUP_RAWOPS:
1430  break;
1431 
1432  case MPOPUP_CHDK_REPLACE:
1433  gui_mbox_init((int)"Replacing CHDK", (int)"Do you want to replace current CHDK with this file",
1435  break;
1436  case MPOPUP_EDITOR:
1437  gui_mbox_init((int)"Editor", (int)"edit", MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL);
1438  break;
1439  }
1440  gui_fselect_redraw = 2;
1441 }
static void fselect_mpopup_rawop_cb ( unsigned int  actn)
static

Definiert in Zeile 1317 der Datei gui_fselect.c.

1318 {
1319  switch (actn) {
1320  case MPOPUP_RAW_AVERAGE:
1323  break;
1324  case MPOPUP_RAW_ADD:
1327  break;
1328  case MPOPUP_RAW_DEVELOP:
1329  sprintf(buf, "%s/%s", items.dir, selected->name);
1331  break;
1332  case MPOPUP_SUBTRACT:
1334  break;
1335  case MPOPUP_DNG_TO_CRW:
1337  break;
1338  }
1339 }
static void fselect_purge_cb_DCIM ( unsigned int  btn)
static

Definiert in Zeile 998 der Datei gui_fselect.c.

999 {
1000  if (btn == MBOX_BTN_YES)
1001  {
1002  //If selected folder is A/DCIM or A/RAW (this is to purge all RAW files in any sub-folder)
1004  }
1005 }
static void fselect_purge_cb_dir ( unsigned int  btn)
static

Definiert in Zeile 1007 der Datei gui_fselect.c.

1008 {
1009  if (btn == MBOX_BTN_YES)
1010  {
1011  //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)
1013  }
1014 }
static void fselect_purge_cb_file ( unsigned int  btn)
static

Definiert in Zeile 1016 der Datei gui_fselect.c.

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

Definiert in Zeile 1146 der Datei gui_fselect.c.

1147 {
1148  fitem *ptr;
1149  register unsigned int cnt = 0;
1150 
1151  for (ptr=items.head; ptr; ptr=ptr->next)
1152  {
1153  if (ptr->isvalid && !ptr->isdir && ptr->marked)
1154  ++cnt;
1155  }
1156  return cnt;
1157 }
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 1244 der Datei gui_fselect.c.

1245 {
1246  fitem *ptr;
1247  if (btn != MBOX_BTN_YES) return;
1248 
1249  for (ptr=items.head; ptr; ptr=ptr->next)
1250  {
1251  if (ptr->marked && ptr->isvalid && !ptr->isdir && chk_name(ptr->name,selected->name))
1252  {
1254  }
1255  }
1256  gui_fselect_readdir = 1;
1257  gui_fselect_redraw = 2;
1258 }
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  char c = 'k';
828  if (n >= 1024*1024*1024) // GB
829  {
830  n = n >> 20; // Note: can't round this up in case of overflow
831  c = 'G';
832  }
833  else if (n >= 1024*1024) // MB
834  {
835  n = (n + 512) >> 10;
836  c = 'M';
837  }
838  n += 512;
839  unsigned long f = ((n & 0x3FF) * 10) >> 10; // 1 digit of remainder % 1024
840  sprintf(dbuf+j, "%3d.%1d%c", n >> 10, f, c);
841  }
842  }
843  j += SIZE_SIZE;
844  dbuf[j++] = 0x06; // Vertical line
845 
846  // print modification time
847  if (ptr->mtime)
848  {
849  struct tm *time = localtime(&(ptr->mtime));
850  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);
851  }
852  else
853  {
854  sprintf(dbuf+j, "%14s", "");
855  }
856  j += TIME_SIZE;
857  dbuf[j] = 0;
858 
859  draw_string_justified(main_x, off_body_y, dbuf, cl_marked, SPACING, main_w-SCROLLBAR, TEXT_LEFT|TEXT_FILL);
860  }
861 
862  //fill the rest of body
863  if (i>0 && i<BODY_LINES)
864  {
866  }
867 
868  // scrollbar
869  int off_sbar_x = main_x + main_w - SCROLLBAR;
871  if (items.count > BODY_LINES)
872  {
873  i = BODY_FONT_LINES - 1;
874  j = (i * BODY_LINES) / items.count;
875  if (j < 20) j = 20;
876  i = ((i - j) * selected->n) / (items.count-1);
877  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);
878  }
879 
880  //footer
881  int max_footer_len = NAME_SIZE + SIZE_SIZE + SPACING;
882  i = strlen(items.dir);
883  if (i > max_footer_len)
884  {
885  strncpy(dbuf, items.dir+i-max_footer_len, max_footer_len);
886  dbuf[0] = '.';
887  dbuf[1] = '.';
888  }
889  else
890  {
891  strcpy(dbuf, items.dir);
892  }
894 
895  if (sum_size)
896  {
897  sprintf(dbuf, "%d b", sum_size); //selected size
898  }
899  else
900  {
901  unsigned int fr = GetFreeCardSpaceKb();
902  unsigned int tot = GetTotalCardSpaceKb();
903  if (tot != 0)
904  tot = (fr * 100) / tot;
905 
906  if (fr < 1024*1024)
907  sprintf(dbuf, "%dM (%d%%)", fr>>10, tot);
908  else
909  sprintf(dbuf, "%d.%dG (%d%%)", fr>>20, ((fr&0x000FFFFF)*100)>>20, tot);
910  }
911  draw_string(main_x+main_w-strlen(dbuf)*FONT_WIDTH-BORDER, foot_y, dbuf, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); // free space
912 
913  gui_fselect_redraw = 0;
914  }
915 }
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 1467 der Datei gui_fselect.c.

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

Definiert in Zeile 1626 der Datei gui_fselect.c.

1627 {
1628  // just free resource. callback called with NULL ptr
1629  exit_fselect(0);
1630 }
static void gui_fselect_marked_free_data ( )
static

Definiert in Zeile 1082 der Datei gui_fselect.c.

1083 {
1086 }
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 1368 der Datei gui_fselect.c.

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

Definiert in Zeile 1374 der Datei gui_fselect.c.

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

Definiert in Zeile 1341 der Datei gui_fselect.c.

1342 {
1343  if (name)
1344  {
1345  sprintf(selected_file,"%s/%s", items.dir, name);
1347  gui_fselect_readdir = 1;
1348  gui_fselect_redraw = 2;
1349  }
1350 }
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 1291 der Datei gui_fselect.c.

1292 {
1293  fitem *ptr;
1294  int i=0;
1295  started();
1296  msleep(100);
1297  finished();
1298 
1300  {
1301  for (ptr=items.head; ptr; ptr=ptr->next)
1302  if (ptr->marked && ptr->isvalid && !ptr->isdir)
1303  {
1304  sprintf(selected_file, "%s/%s", items.dir, ptr->name);
1307  }
1308  }
1309  else
1310  {
1311  sprintf(selected_file, "%s/%s", items.dir, selected->name);
1313  }
1314  gui_fselect_readdir = 1;
1315 }
void process_raw_files ( void  )

Definiert in Zeile 1226 der Datei gui_fselect.c.

1227 {
1228  fitem *ptr;
1229 
1231  {
1232  for (ptr=items.head; ptr; ptr=ptr->next)
1233  if (ptr->marked && ptr->isvalid && !ptr->isdir)
1234  {
1235  sprintf(selected_file, "%s/%s", items.dir, ptr->name);
1237  }
1239  gui_fselect_readdir = 1;
1240  gui_fselect_redraw = 2;
1241  }
1242 }
static void purge_file ( const char *  folder,
const char *  file 
)
static

Definiert in Zeile 978 der Datei gui_fselect.c.

979 {
980  //If no JPG found, delete RAW file
981  if (is_raw(file))
982  if (!find_jpg(folder, file, 0))
983  delete_file(folder, file);
984 }
static void purge_file_DCIM ( const char *  folder,
const char *  file 
)
static

Definiert in Zeile 990 der Datei gui_fselect.c.

991 {
992  //If no JPG found, delete RAW file (search all sub-folders of A/DCIM for JPG)
993  if (is_raw(file))
994  if (!find_jpg("A/DCIM", file, 1))
995  delete_file(folder, file);
996 }
static void rename_cb ( const char *  name)
static

Definiert in Zeile 1352 der Datei gui_fselect.c.

1353 {
1354  if (name)
1355  {
1356  sprintf(selected_file, "%s/%s", items.dir, selected->name);
1357  sprintf(buf, "%s/%s", items.dir, name);
1359  gui_fselect_readdir = 1;
1360  gui_fselect_redraw = 2;
1361  }
1362 }
static void setup_batch_subtract ( void  )
static

Definiert in Zeile 1261 der Datei gui_fselect.c.

1262 {
1263  fitem *ptr;
1264  int i;
1265  char *p = buf + sprintf(buf,"%s %s\n",selected->name,lang_str(LANG_FSELECT_SUB_FROM));
1266  for (ptr=items.head, i=0; ptr; ptr=ptr->next)
1267  {
1268  if (ptr->marked && ptr->isvalid && !ptr->isdir && (ptr->size >= camera_sensor.raw_size))
1269  {
1270  if ( i < MAX_SUB_NAMES )
1271  {
1272  sprintf(p, "%s\n",ptr->name);
1273  // keep a pointer to the one before the end, so we can stick ...and more on
1274  if (i < MAX_SUB_NAMES - 1)
1275  {
1276  p += strlen(p);
1277  }
1278  }
1279  i++;
1280  }
1281  }
1282  if (i > MAX_SUB_NAMES)
1283  {
1284 // "...%d more files"
1286  }
1289 }
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 1667 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 1364 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.