![]() |
wxIScan
|
The application object. More...
#include <wxiscanapp.h>
Public Member Functions | |
| virtual bool | OnInit () |
| Program initialization. | |
| virtual void | OnInitCmdLine (wxCmdLineParser &oParser) |
| Initialize command line parameter handling. | |
| virtual bool | OnCmdLineParsed (wxCmdLineParser &oParser) |
| Handle filenames on the command line. | |
| virtual wxString | GetImageFilter () |
| Get the file extension filter for all registered image handlers. | |
Private Member Functions | |
| virtual void | AddImageHandler (wxImageHandler *poHandler) |
| Adds image handlers to the image handler list. | |
Private Attributes | |
| wxLocale | m_oLocale |
| Locale the application is using. | |
| wxString | m_strImageFilter |
| Current image file filter. | |
| wxString | m_strImageFilterList |
| Image file filter list. | |
| wxIScanFrame * | m_poFrame |
| A pointer to the application's main window. | |
The application object.
wxIScanFrame initializes
Definition at line 31 of file wxiscanapp.h.
| void wxIScanApp::AddImageHandler | ( | wxImageHandler * | poHandler | ) | [private, virtual] |
Adds image handlers to the image handler list.
| poHandler | a pointer to the image handler that shall be added. |
Definition at line 195 of file wxiscanapp.cpp.
References m_strImageFilter, and m_strImageFilterList.
Referenced by OnInit().
{
if( poHandler )
{
wxString strExtension= poHandler->GetExtension();
// TODO: Is there a posibility to get files by extension fully
// case insensitive?
//
#ifdef __WXMSW__
m_strImageFilter += wxT( "*." ) + strExtension + wxT( ";" );
m_strImageFilterList += poHandler->GetMimeType() + wxT( " (*." )
+ strExtension
+ wxT( ")|*." ) + strExtension + wxT( "|" );
#else
m_strImageFilter += wxT( "*." ) + strExtension.Lower() + wxT( ";" )
+ wxT( "*." ) + strExtension.Upper() + wxT( ";" );
m_strImageFilterList += poHandler->GetMimeType() + wxT( " (*." )
+ strExtension
+ wxT( ")|*." )
+ strExtension.Lower()
+ wxT( ";*." )
+ strExtension.Upper()
+ wxT( "|" );
#endif
if( wxImage::FindHandler( poHandler->GetName() ) )
{
delete poHandler;
}
else
{
wxImage::AddHandler( poHandler );
}
}
}
| wxString wxIScanApp::GetImageFilter | ( | ) | [virtual] |
Get the file extension filter for all registered image handlers.
Definition at line 233 of file wxiscanapp.cpp.
References m_strImageFilter, and m_strImageFilterList.
{
return _( "All image files" ) + wxString( wxT( "|" ) )
+ m_strImageFilter + wxT( "|" )
+ m_strImageFilterList
+ _( "All files" ) + wxT( "|*.*" );
}
| bool wxIScanApp::OnCmdLineParsed | ( | wxCmdLineParser & | oParser | ) | [virtual] |
Handle filenames on the command line.
Definition at line 168 of file wxiscanapp.cpp.
References m_poFrame, and wxIScanFrame::OpenImage().
{
// Call the base class's OnCmdLineParsed function for default
// parameter handling.
if( !wxApp::OnCmdLineParsed( oParser ) )
{
// Return error.
return false;
}
// Handle filename parameters by calling the top window's
// OpemImage() function.
int nCount= oParser.GetParamCount();
for( int i= 0; i < nCount; i++ )
{
m_poFrame->OpenImage( oParser.GetParam( i ) );
}
// Return OK.
return true;
}
| bool wxIScanApp::OnInit | ( | ) | [virtual] |
Program initialization.
Definition at line 44 of file wxiscanapp.cpp.
References AddImageHandler(), m_oLocale, m_poFrame, wxIScanFrame::RestoreSashSettings(), and wxiscansplash_xpm.
{
// Make sure that the settings are written to a configuration file
// (instead of e. g. the registry on MSW).
wxConfigBase::Set( new wxFileConfig );
// Get application configuration.
wxConfigBase *poConfig = wxConfigBase::Get();
poConfig->SetRecordDefaults();
poConfig->SetPath( wxT( "/Global" ) );
poConfig->Write( wxT( "App" ), argv[0] );
poConfig->Write( wxT( "Locale" ), wxLocale::GetLanguageInfo( wxLocale::GetSystemLanguage() )->CanonicalName );
// Display splash screen.
if( poConfig->Read( wxT( "Splashscreen" ), (long)true ) )
{
new wxSplashScreen( wxBitmap( wxiscansplash_xpm ), wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 500, NULL, wxID_ANY );
}
// Set locale.
if( poConfig->Read( wxT( "I18n" ), (long)true ) )
{
#ifdef __UNIX__
// Add lookup path for subdirectories direct below the
// application's installation directory.
//
// NOTE: We do this because Un*x like OSes do not search
// the application's directory automatically!
//
wxFileName oFileName( argv[0] );
oFileName.Normalize();
m_oLocale.AddCatalogLookupPathPrefix( oFileName.GetPath() );
#endif // __UNIX__
// Initialize locale.
m_oLocale.Init( wxLocale::GetSystemLanguage() );
// Add application catalog.
m_oLocale.AddCatalog( GetAppName() );
// Add standard wxWidgets translation catalog.
m_oLocale.AddCatalog( wxT( "wxstd" ) );
}
// Install image handlers.
AddImageHandler( new wxBMPHandler );
#if wxUSE_LIBPNG
AddImageHandler( new wxPNGHandler );
#endif
#if wxUSE_LIBJPEG
AddImageHandler( new wxJPEGHandler );
#endif
#if wxUSE_LIBTIFF
AddImageHandler( new wxTIFFHandler );
#endif
#if wxUSE_GIF
AddImageHandler( new wxGIFHandler );
#endif
#if wxUSE_PCX
AddImageHandler( new wxPCXHandler );
#endif
#if wxUSE_PNM
AddImageHandler( new wxPNMHandler );
#endif
#if wxUSE_XPM
AddImageHandler( new wxXPMHandler );
#endif
#if wxUSE_ICO_CUR
AddImageHandler( new wxICOHandler );
AddImageHandler( new wxCURHandler );
AddImageHandler( new wxANIHandler );
#endif
#if wxUSE_PDF
AddImageHandler( new wxPDFHandler );
#endif
m_poFrame = new wxIScanFrame( NULL );
if( m_poFrame == NULL )
{
::wxLogFatalError( _( "Failed to create main window." ) );
// Program termination.
return false;
}
m_poFrame->Show();
m_poFrame->RestoreSashSettings();
SetTopWindow( m_poFrame );
// Call the base class's OnInit() function for commandline processing,
// and do some error checking.
//
// Note: A return value of 'false' will cause the application to terminate
// immediately!
//
if( !wxApp::OnInit() )
{
// Program termination.
return false;
}
return true;
}
| void wxIScanApp::OnInitCmdLine | ( | wxCmdLineParser & | oParser | ) | [virtual] |
Initialize command line parameter handling.
Definition at line 154 of file wxiscanapp.cpp.
{
// Call the base class's OnInitCmdLine function for default
// parameter handling ( --help).
wxApp::OnInitCmdLine( oParser );
// Add an optional filename parameter to the parameter list.
oParser.AddParam( wxT( "[Filename #1] [... [Filename #n]]]]" ),
wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE );
}
wxLocale wxIScanApp::m_oLocale [private] |
Locale the application is using.
Definition at line 54 of file wxiscanapp.h.
Referenced by OnInit().
wxIScanFrame* wxIScanApp::m_poFrame [private] |
A pointer to the application's main window.
Definition at line 57 of file wxiscanapp.h.
Referenced by OnCmdLineParsed(), and OnInit().
wxString wxIScanApp::m_strImageFilter [private] |
Current image file filter.
Definition at line 55 of file wxiscanapp.h.
Referenced by AddImageHandler(), and GetImageFilter().
wxString wxIScanApp::m_strImageFilterList [private] |
Image file filter list.
Definition at line 56 of file wxiscanapp.h.
Referenced by AddImageHandler(), and GetImageFilter().