/************************************************************
**
** Application: SyncDiscs
**
** Title:       h.dbox
**
*************************************************************/

/*
*
* Copyright (c) 2015, David Pilling and Chris Johnson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*   * Redistributions of source code must retain the above copyright
*     notice, this list of conditions and the following disclaimer.
*   * Redistributions in binary form must reproduce the above
*     copyright notice, this list of conditions and the following
*     disclaimer in the documentation and/or other materials provided
*     with the distribution.
*   * Neither the name of the copyright holder nor the names of their
*     contributors may be used to endorse or promote products derived
*     from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/


#pragma include_only_once

#ifndef __DBOX__H
#define __DBOX__H



#define FSMAXWIMPMSGPATH 256
#define FILENAMELENGTH 312
#define FILEPATH_WRITABLE_LENGTH 512

#define SYNCINT   0x1
#define SYNCSTR   0x2

typedef struct synctag
{
 char * name;
 int    type;
 void * address;
 int    len;
} synctag;

#define CHSAVE TRUE
#define CHLOAD FALSE




/*************************************************************************
 * In the following structure, the various filenames have been changed   *
 * from pointer to character to character arrays. This is to allow       *
 * multiple instances of the structure, flex allocated, without having   *
 * flex anchors inside a flex structure.                                 *
 *************************************************************************/


typedef struct
{
  char  primary[FILEPATH_WRITABLE_LENGTH];
  char  secondary[FILEPATH_WRITABLE_LENGTH];
  char  scrap[FILEPATH_WRITABLE_LENGTH];
  char  logfile[FILENAMELENGTH];
  char  zonefile[FILENAMELENGTH];
  int   newer;
  int   extra;
  int   overwrite;
  int   log;
  int   compare;
  int   use_zone_file;
  int   timeresolution;
  int   tstamp_eq;
  int   multitask;
  int   copy_dir;
  int   new_log;
  int   num_old_logs;
  int   auto_open_log;
  int   num_fa;
  int   num_fa_resume;
  int   verbose_fileractions;
  int   multiple_fa;
  int   ignore_filetype;
  int   save_log_in_primary;
  int   verbose_log;
  int   disable_trapdelete;
  int   no_delete_ignored;
  int   kill_sparkfs;
#ifdef KILL_TASK
  int   killtasks;
  char  killtasks_filename[FILENAMELENGTH];
#endif
} syncsettings;

#define JOBLIST_MAX 25

typedef struct
{
  int  number;
  syncsettings *settings[JOBLIST_MAX];
} joblist;

/*************************************************************/
/* exported variables */

extern  joblist jobs;
extern int  filer_actions_count;

/*************************************************************/
/* exported functions */

extern os_error *commandline(int argc,char * argv[],int * quit);
extern os_error *opensyncdiscs(void);
extern void make_choices_path (BOOL save, char *path, char *filename);
extern os_error *configinit(void);
extern os_error *config2init(void);
extern os_error *syncdiscsclose(int w,int userhandle);
extern void      init_default_settings (void);
extern os_error *show_log_file (char *logfile);
extern os_error *jobload2 (char *name);
extern  void jobloadinit (void);
extern os_error *jobloadtype (int type, mousestr * m, int userhandle, int *method);
extern os_error *jobload (char *name, int type, int userhandle, int xvolatile);

extern void dbox_insert_path (char *path, int list, BOOL shift);

extern void dbox_shade_menubuttons ( BOOL bPri, BOOL bSec, BOOL bScrap);
extern os_error *open_settings (void);

#endif



/*************  End of h.dbox  ***********************/
