/*****************************************************************************
Open Source MIT License

Copyright (c) 2017 Matthew Ahmed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*****************************************************************************/

// CopyDlg.h: interface for the CCopyDlg class.
//
//////////////////////////////////////////////////////////////////////

#pragma once

//#include "ZWinDlg.h"
#include "resource.h"
#include "ZDialog.h"

// Forward declarations
class CJpgFolders;
class CParentDlg;

BOOL CopyDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

//class CCopyDlg : public ZDlg  
class CCopyDlg : public CZDialog  
{
public:
	CCopyDlg(HINSTANCE hInst, CSettings * pSet, LPCTSTR sCapt1,
//								LPCTSTR sCapt2 = NULL, ZWin * pOwner = NULL);
//								LPCTSTR sCapt2 = NULL, CWnd * pOwner = NULL);
								LPCTSTR sCapt2 = NULL, CParentDlg * pOwner = NULL,
                ZWinAppDataClone * pzwd = NULL);
	~CCopyDlg();
// ZDialog // 	BOOL OwnProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP);
  enum { IDD = IDD_COPY }; // ZDialog

  void Close(); // Public for parent
  void UpdateForPref();
  BOOL InProgress();

protected:
  // ZDialog
  DECLARE_MESSAGE_MAP()
  HINSTANCE m_hInst;
  TCHAR m_sCapt[100];
  CParentDlg * m_pOwner;

	CSettings * ini;

  HWND m_hProgress;
  BOOL m_bInProgress;
  BOOL m_bAbort;
  INT m_nProgPos;
  INT m_nProgLastPos;
  HWND m_hTextProg;
  LPTSTR m_sArrJpgNames[3];
//  LPTSTR * m_sArrJpgNames;
//  TCHAR m_sSrcJpgOther[100];
//  TCHAR m_sTgtJpgOther[100];
  LPTSTR m_spTgtJpg; // Will point to member of m_sArrJpgNames,
  LPTSTR m_spSrcJpg; // or to ini->s___Other, based on radio button

  TCHAR m_sWinLibDir[MAX_PATH];
  TCHAR m_sWinRipDir[MAX_PATH];

  BOOL ControlsToIni(BOOL bResetBadEdit);

  BOOL CheckProgress(INT nBase, INT nDirsDone, DOUBLE fPctPerDir);
  BOOL CheckProgressFrontLoad(INT nBase, INT nMaxAddToBase, INT nDone);

  BOOL CompareFolders(LPCTSTR sSrc, LPCTSTR sTgt, LPCTSTR sSrcJpg,
                      LPCTSTR sTgtJpg, CJpgFolders & jpf);
  BOOL PathToJpgFolders(LPCTSTR sSearchDir, LPCTSTR sJpgName,
                        CJpgFolders & jpf, BOOL bSkipNoJpg,
                        INT nProgBase, INT nProgMaxAdd);
  void EnableControls(BOOL bNormalCtls);
  void CCopyDlg::ListSubFolders(LPCTSTR sParent, INT nListId);

  BOOL m_bLogDetail;

//  void OnBnTest();

  TCHAR m_sSource[MAX_PATH];
  TCHAR m_sTarget[MAX_PATH];
  //TCHAR m_sSrcJpg[100];
  //TCHAR m_sTgtJpg[100];

  void OnBnFind();
  void OnBnSource();
  void OnBnTarget();
  BOOL GetDefaultTarget(LPTSTR sTarget);

	BOOL OnInitDialog();
	//void OnOk();
	//void OnBnClose();
};

