// -*- c-basic-offset: 4 -*-

/** @file hugin1/base_wx/platform.h
 *
 *  @brief implementation of huginApp Class
 *
 *  @author Pablo d'Angelo <pablo.dangelo@web.de>
 *
 *  $Id: huginApp.cpp 2510 2007-10-28 22:24:11Z dangelo $
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This software is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public
 *  License along with this software. If not, see
 *  <http://www.gnu.org/licenses/>.
 *
 */

#ifndef HUGIN1_BASE_PLATFORM_H
#define HUGIN1_BASE_PLATFORM_H

#include <hugin_shared.h>
#include "panoinc_WX.h"
#include "hugin_config.h"
#if wxUSE_ON_FATAL_EXCEPTION
#include <wx/debugrpt.h>
#endif

#ifdef __WXMSW__
#define HUGIN_CONV_FILENAME (*wxConvCurrent)
#else
#define HUGIN_CONV_FILENAME (*wxConvFileName)
#endif

/** return filter for image files, needed by file open dialog 
  it contains all image format vigra can read and some other format */
WXIMPEX wxString GetFileDialogImageFilters();
/** return a filter for the main image files (JPG/TIFF/PNG) only */
WXIMPEX wxString GetMainImageFilters();
/** return filter for image and raw files, needed by file open dialog */
WXIMPEX wxString GetFileDialogImageAndRawFilters();
/** return true, if given extension is in list of known raw extension (comparision is case insensitive */
WXIMPEX bool IsRawExtension(const wxString& testExt);

#if defined __WXMAC__ || defined __WXOSX_COCOA__

#include <wx/osx/core/cfstring.h>
#include <wx/osx/private.h>

CFStringRef MacCreateCFStringWithWxString(const wxString& string);

wxString MacGetPathToMainExecutableFileOfBundle(CFStringRef bundlePath);
wxString MacGetPathToMainExecutableFileOfRegisteredBundle(CFStringRef BundleIdentifier);

#if defined MAC_SELF_CONTAINED_BUNDLE

wxString MacGetPathToBundledResourceFile(CFStringRef filename);
wxString MacGetPathToBundledFrameworksDirectory();
wxString MacGetPathToBundledExecutableFile(CFStringRef filename);
wxString MacGetPathToBundledAppMainExecutableFile(CFStringRef appname);
wxString MacGetPathToUserDomainTempDir();
wxString MacGetPathToUserAppSupportAutoPanoFolder();

#endif // MAC_SELF_CONTAINED_BUNDLE

#endif //__WXMAC__

/** returns all invalid characters for the filename (mainly characters, which does not work with gnu make) */
WXIMPEX const wxString getInvalidCharacters();
/** returns true, if the given strings contains invalid characters */
WXIMPEX bool containsInvalidCharacters(const wxString stringToTest);
/** shows a dialog about filename with invalid characters, all names in filelist will be show in list */
WXIMPEX void ShowFilenameWarning(wxWindow* parent, const wxArrayString filelist);

#if wxUSE_ON_FATAL_EXCEPTION
/** shows debug report dialog box from wxWidgets */
WXIMPEX void GenerateReport(wxDebugReport::Context ctx);
#endif

#endif
