~ubuntu-branches/ubuntu/trusty/guayadeque/trusty

« back to all changes in this revision

Viewing changes to src/.svn/text-base/FileRenamer.h.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-02-09 13:39:39 UTC
  • mfrom: (3.1.2 maverick)
  • Revision ID: james.westby@ubuntu.com-20110209133939-w4i25g4hvsgw4yvw
Tags: 0.2.7-3
* Upload to unstable.
* Pass -Wl,--as-needed to the linker.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -------------------------------------------------------------------------------- //
 
2
//      Copyright (C) 2008-2010 J.Rios
 
3
//      anonbeat@gmail.com
 
4
//
 
5
//    This Program is free software; you can redistribute it and/or modify
 
6
//    it under the terms of the GNU General Public License as published by
 
7
//    the Free Software Foundation; either version 2, or (at your option)
 
8
//    any later version.
 
9
//
 
10
//    This Program is distributed in the hope that it will be useful,
 
11
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
//    GNU General Public License for more details.
 
14
//
 
15
//    You should have received a copy of the GNU General Public License
 
16
//    along with this program; see the file LICENSE.  If not, write to
 
17
//    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
//    http://www.gnu.org/copyleft/gpl.h"tml
 
19
//
 
20
// -------------------------------------------------------------------------------- //
 
21
#ifndef FILERENAMER_H
 
22
#define FILERENAMER_H
 
23
 
 
24
#include "DbLibrary.h"
 
25
 
 
26
#include <wx/string.h>
 
27
#include <wx/listbox.h>
 
28
#include <wx/gdicmn.h>
 
29
#include <wx/font.h>
 
30
#include <wx/colour.h>
 
31
#include <wx/settings.h>
 
32
#include <wx/stattext.h>
 
33
#include <wx/textctrl.h>
 
34
#include <wx/bitmap.h>
 
35
#include <wx/image.h>
 
36
#include <wx/icon.h>
 
37
#include <wx/bmpbuttn.h>
 
38
#include <wx/button.h>
 
39
#include <wx/sizer.h>
 
40
#include <wx/statbox.h>
 
41
#include <wx/dialog.h>
 
42
 
 
43
// -------------------------------------------------------------------------------- //
 
44
wxString inline NormalizeField( const wxString &name )
 
45
{
 
46
    // Special chars: < > : " / \ | ? *
 
47
    wxString RetVal = name;
 
48
    RetVal.Replace( wxT( "<" ), wxT( "_" ) );
 
49
    RetVal.Replace( wxT( ">" ), wxT( "_" ) );
 
50
    RetVal.Replace( wxT( ":" ), wxT( "_" ) );
 
51
    RetVal.Replace( wxT( "\"" ), wxT( "_" ) );
 
52
    RetVal.Replace( wxT( "/" ), wxT( "_" ) );
 
53
    RetVal.Replace( wxT( "\\" ), wxT( "_" ) );
 
54
    RetVal.Replace( wxT( "|" ), wxT( "_" ) );
 
55
    RetVal.Replace( wxT( "?" ), wxT( "_" ) );
 
56
    RetVal.Replace( wxT( "*" ), wxT( "_" ) );
 
57
    if( RetVal[ 0 ] == wxT( '.' ) )
 
58
        RetVal[ 0 ] = wxT( '_' );
 
59
    return RetVal;
 
60
}
 
61
 
 
62
// -------------------------------------------------------------------------------- //
 
63
class guFileRenamer : public wxDialog
 
64
{
 
65
  protected:
 
66
    wxListBox *         m_FilesListBox;
 
67
    wxTextCtrl *        m_NameTextCtrl;
 
68
    wxTextCtrl *        m_PatTextCtrl;
 
69
    wxBitmapButton *    m_PatApplyBtn;
 
70
    wxBitmapButton *    m_PatRevertBtn;
 
71
 
 
72
    guDbLibrary *       m_Db;
 
73
    int                 m_CurFile;
 
74
    wxArrayString       m_Files;
 
75
 
 
76
    void OnFileSelected( wxCommandEvent& event );
 
77
    void OnPatternChanged( wxCommandEvent& event );
 
78
    void OnPatternApply( wxCommandEvent& event );
 
79
    void OnPattternRevert( wxCommandEvent& event );
 
80
 
 
81
    void OnOKButton( wxCommandEvent& event );
 
82
 
 
83
  public:
 
84
    guFileRenamer( wxWindow * parent, guDbLibrary * db, const wxArrayString &files );
 
85
    ~guFileRenamer();
 
86
 
 
87
    wxArrayString GetRenamedNames( void );
 
88
 
 
89
};
 
90
 
 
91
#endif
 
92
// -------------------------------------------------------------------------------- //