~ubuntu-branches/ubuntu/precise/guayadeque/precise

« back to all changes in this revision

Viewing changes to src/RaListBox.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-05-14 15:08:03 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110514150803-8b5evqetnaj35j34
Tags: 0.3.1~dfsg0-1
* New upstream release.
* Strip wxsqlite3 stuff out of upstream's tarballs.
* Update get-orig-source target in debian/rules.
* Update gbp config file.
* Bump Standards.
* Build-depend on libwxsqlite3-2.8-dev
* Enable parallel builds.
* Link binaries against the system-wide copy of wxsqlite3.
* Point sources to the correct wxcurl's headers location.
* Update copyright file as per DEP-5
* Improve debian/watch to handle the ~dfsg\d* suffix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -------------------------------------------------------------------------------- //
2
 
//      Copyright (C) 2008-2010 J.Rios
 
2
//      Copyright (C) 2008-2011 J.Rios
3
3
//      anonbeat@gmail.com
4
4
//
5
5
//    This Program is free software; you can redistribute it and/or modify
6
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)
 
7
//    the Free Software Foundation; either version 3, or (at your option)
8
8
//    any later version.
9
9
//
10
10
//    This Program is distributed in the hope that it will be useful,
19
19
//
20
20
// -------------------------------------------------------------------------------- //
21
21
#include "RaListBox.h"
 
22
 
 
23
#include "Accelerators.h"
22
24
#include "Commands.h"
23
25
#include "Config.h"
24
26
#include "Images.h"
30
32
 
31
33
// -------------------------------------------------------------------------------- //
32
34
guRaListBox::guRaListBox( wxWindow * parent, guLibPanel * libpanel, guDbLibrary * db, const wxString &label ) :
33
 
             guListBox( parent, db, label, wxLB_MULTIPLE | guLISTVIEW_ALLOWDRAG | guLISTVIEW_HIDE_HEADER )
 
35
             guAccelListBox( parent, db, label )
34
36
{
35
37
    m_LibPanel = libpanel;
36
38
 
37
39
    m_NormalStar   = new wxBitmap( guImage( ( guIMAGE_INDEX ) ( guIMAGE_INDEX_star_normal_tiny + GURATING_STYLE_MID ) ) );
38
40
    m_SelectStar = new wxBitmap( guImage( ( guIMAGE_INDEX ) ( guIMAGE_INDEX_star_highlight_tiny + GURATING_STYLE_MID ) ) );
39
41
 
 
42
    CreateAcceleratorTable();
 
43
 
40
44
    ReloadItems();
41
45
};
42
46
 
50
54
}
51
55
 
52
56
// -------------------------------------------------------------------------------- //
 
57
void guRaListBox::CreateAcceleratorTable( void )
 
58
{
 
59
    wxAcceleratorTable AccelTable;
 
60
    wxArrayInt AliasAccelCmds;
 
61
    wxArrayInt RealAccelCmds;
 
62
 
 
63
    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_SAVE );
 
64
    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_EDITTRACKS );
 
65
    AliasAccelCmds.Add( ID_SONG_PLAY );
 
66
    AliasAccelCmds.Add( ID_SONG_ENQUEUE_AFTER_ALL );
 
67
    AliasAccelCmds.Add( ID_SONG_ENQUEUE_AFTER_TRACK );
 
68
    AliasAccelCmds.Add( ID_SONG_ENQUEUE_AFTER_ALBUM );
 
69
    AliasAccelCmds.Add( ID_SONG_ENQUEUE_AFTER_ARTIST );
 
70
    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_SEARCH );
 
71
 
 
72
    RealAccelCmds.Add( ID_RATING_SAVETOPLAYLIST );
 
73
    RealAccelCmds.Add( ID_RATING_EDITTRACKS );
 
74
    RealAccelCmds.Add( ID_RATING_PLAY );
 
75
    RealAccelCmds.Add( ID_RATING_ENQUEUE_AFTER_ALL );
 
76
    RealAccelCmds.Add( ID_RATING_ENQUEUE_AFTER_TRACK );
 
77
    RealAccelCmds.Add( ID_RATING_ENQUEUE_AFTER_ALBUM );
 
78
    RealAccelCmds.Add( ID_RATING_ENQUEUE_AFTER_ARTIST );
 
79
    RealAccelCmds.Add( ID_LIBRARY_SEARCH );
 
80
 
 
81
    if( guAccelDoAcceleratorTable( AliasAccelCmds, RealAccelCmds, AccelTable ) )
 
82
    {
 
83
        SetAcceleratorTable( AccelTable );
 
84
    }
 
85
 
 
86
}
 
87
 
 
88
// -------------------------------------------------------------------------------- //
53
89
void guRaListBox::GetItemsList( void )
54
90
{
55
91
    m_Db->GetRatings( m_Items );
102
138
    int SelCount = GetSelectedCount();
103
139
    int ContextMenuFlags = m_LibPanel->GetContextMenuFlags();
104
140
 
105
 
    MenuItem = new wxMenuItem( Menu, ID_RATING_PLAY, _( "Play" ), _( "Play the selected tracks" ) );
 
141
    MenuItem = new wxMenuItem( Menu, ID_RATING_PLAY,
 
142
                            wxString( _( "Play" ) ) + guAccelGetCommandKeyCodeString( ID_SONG_PLAY ),
 
143
                            _( "Play the selected tracks" ) );
106
144
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_player_tiny_light_play ) );
107
145
    Menu->Append( MenuItem );
108
 
 
109
 
    MenuItem = new wxMenuItem( Menu, ID_RATING_ENQUEUE, _( "Enqueue" ), _( "Add current selected tracks to playlist" ) );
110
 
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
111
 
    Menu->Append( MenuItem );
112
 
 
113
 
    MenuItem = new wxMenuItem( Menu, ID_RATING_ENQUEUE_ASNEXT, _( "Enqueue Next" ), _( "Add current selected tracks to playlist as Next Tracks" ) );
114
 
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
115
 
    Menu->Append( MenuItem );
 
146
    MenuItem->Enable( SelCount );
 
147
 
 
148
    MenuItem = new wxMenuItem( Menu, ID_RATING_ENQUEUE_AFTER_ALL,
 
149
                            wxString( _( "Enqueue" ) ) + guAccelGetCommandKeyCodeString( ID_SONG_ENQUEUE_AFTER_ALL ),
 
150
                            _( "Add current selected tracks to playlist" ) );
 
151
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
 
152
    Menu->Append( MenuItem );
 
153
    MenuItem->Enable( SelCount );
 
154
 
 
155
    wxMenu * EnqueueMenu = new wxMenu();
 
156
 
 
157
    MenuItem = new wxMenuItem( EnqueueMenu, ID_RATING_ENQUEUE_AFTER_TRACK,
 
158
                            wxString( _( "Current Track" ) ) +  guAccelGetCommandKeyCodeString( ID_SONG_ENQUEUE_AFTER_TRACK ),
 
159
                            _( "Add current selected tracks to playlist after the current track" ) );
 
160
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
 
161
    EnqueueMenu->Append( MenuItem );
 
162
    MenuItem->Enable( SelCount );
 
163
 
 
164
    MenuItem = new wxMenuItem( EnqueueMenu, ID_RATING_ENQUEUE_AFTER_ALBUM,
 
165
                            wxString( _( "Current Album" ) ) +  guAccelGetCommandKeyCodeString( ID_SONG_ENQUEUE_AFTER_ALBUM ),
 
166
                            _( "Add current selected tracks to playlist after the current album" ) );
 
167
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
 
168
    EnqueueMenu->Append( MenuItem );
 
169
    MenuItem->Enable( SelCount );
 
170
 
 
171
    MenuItem = new wxMenuItem( EnqueueMenu, ID_RATING_ENQUEUE_AFTER_ARTIST,
 
172
                            wxString( _( "Current Artist" ) ) +  guAccelGetCommandKeyCodeString( ID_SONG_ENQUEUE_AFTER_ARTIST ),
 
173
                            _( "Add current selected tracks to playlist after the current artist" ) );
 
174
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
 
175
    EnqueueMenu->Append( MenuItem );
 
176
    MenuItem->Enable( SelCount );
 
177
 
 
178
    Menu->Append( wxID_ANY, _( "Enqueue after" ), EnqueueMenu );
116
179
 
117
180
    if( SelCount )
118
181
    {
120
183
        {
121
184
            Menu->AppendSeparator();
122
185
 
123
 
            MenuItem = new wxMenuItem( Menu, ID_RATING_EDITTRACKS, _( "Edit Songs" ), _( "Edit the selected tracks" ) );
 
186
            MenuItem = new wxMenuItem( Menu, ID_RATING_EDITTRACKS,
 
187
                                wxString( _( "Edit Songs" ) ) +  guAccelGetCommandKeyCodeString( ID_PLAYER_PLAYLIST_EDITTRACKS ),
 
188
                                _( "Edit the selected tracks" ) );
124
189
            MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_edit ) );
125
190
            Menu->Append( MenuItem );
126
191
        }
127
192
 
128
193
        Menu->AppendSeparator();
129
194
 
130
 
        MenuItem = new wxMenuItem( Menu, ID_RATING_SAVETOPLAYLIST, _( "Save to PlayList" ), _( "Save the selected tracks to PlayList" ) );
131
 
        MenuItem->SetBitmap( guImage( guIMAGE_INDEX_doc_save ) );
 
195
        MenuItem = new wxMenuItem( Menu, ID_RATING_SAVETOPLAYLIST,
 
196
                                wxString( _( "Save to PlayList" ) ) +  guAccelGetCommandKeyCodeString( ID_PLAYER_PLAYLIST_SAVE ),
 
197
                                _( "Save the selected tracks to PlayList" ) );
 
198
        MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_doc_save ) );
132
199
        Menu->Append( MenuItem );
133
200
 
134
201
        if( ContextMenuFlags & guLIBRARY_CONTEXTMENU_COPY_TO )
135
202
        {
 
203
            Menu->AppendSeparator();
136
204
            m_LibPanel->CreateCopyToMenu( Menu, ID_RATING_COPYTO );
137
205
        }
138
206
    }