2006-07-01 04:27:37 +02:00
// Copyright (c) 2006, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
2009-07-29 07:43:02 +02:00
// Aegisub Project http://www.aegisub.org/
2006-07-01 04:27:37 +02:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file dialog_attachments.cpp
/// @brief Manage files attached to the subtitle file
/// @ingroup tools_ui
///
2006-07-01 04:27:37 +02:00
///////////
// Headers
2009-01-04 07:31:48 +01:00
# include "config.h"
2009-09-10 15:06:40 +02:00
# ifndef AGI_PRE
# include <wx/button.h>
2006-07-01 05:06:21 +02:00
# include <wx/dirdlg.h>
# include <wx/filedlg.h>
2006-07-01 06:08:01 +02:00
# include <wx/filename.h>
2009-09-10 15:06:40 +02:00
# include <wx/listctrl.h>
2007-09-12 01:22:26 +02:00
# include <wx/sizer.h>
2009-09-10 15:06:40 +02:00
# endif
2006-07-01 04:27:37 +02:00
# include "ass_attachment.h"
2009-09-10 15:06:40 +02:00
# include "ass_file.h"
2010-05-21 03:13:36 +02:00
# include "compat.h"
2009-09-10 15:06:40 +02:00
# include "dialog_attachments.h"
2008-01-14 00:34:38 +01:00
# include "help_button.h"
2009-07-24 02:08:25 +02:00
# include "libresrc/libresrc.h"
2010-05-21 03:13:36 +02:00
# include "main.h"
2009-09-10 15:06:40 +02:00
# include "utils.h"
2006-07-01 04:27:37 +02:00
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Constructor
/// @param parent
///
2010-07-09 09:31:48 +02:00
DialogAttachments : : DialogAttachments ( wxWindow * parent , AssFile * ass )
2007-06-17 04:51:11 +02:00
: wxDialog ( parent , - 1 , _ ( " Attachment List " ) , wxDefaultPosition , wxDefaultSize , wxDEFAULT_DIALOG_STYLE )
2010-07-09 09:31:48 +02:00
, ass ( ass )
2006-07-01 04:27:37 +02:00
{
2007-07-05 01:09:40 +02:00
// Set icon
2009-07-25 06:49:59 +02:00
SetIcon ( BitmapToIcon ( GETIMAGE ( attach_button_24 ) ) ) ;
2007-07-05 01:09:40 +02:00
2006-07-01 04:27:37 +02:00
// List view
2006-07-09 01:18:07 +02:00
listView = new wxListView ( this , ATTACHMENT_LIST , wxDefaultPosition , wxSize ( 500 , 200 ) ) ;
2006-07-01 04:46:41 +02:00
UpdateList ( ) ;
2006-07-09 01:18:07 +02:00
// Buttons
extractButton = new wxButton ( this , BUTTON_EXTRACT , _ ( " E&xtract " ) ) ;
deleteButton = new wxButton ( this , BUTTON_DELETE , _ ( " &Delete " ) ) ;
extractButton - > Enable ( false ) ;
deleteButton - > Enable ( false ) ;
2006-07-01 04:46:41 +02:00
// Buttons sizer
wxSizer * buttonSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2006-07-01 07:00:03 +02:00
buttonSizer - > Add ( new wxButton ( this , BUTTON_ATTACH_FONT , _ ( " Attach &Font " ) ) , 1 , 0 , 0 ) ;
buttonSizer - > Add ( new wxButton ( this , BUTTON_ATTACH_GRAPHICS , _ ( " Attach &Graphics " ) ) , 1 , 0 , 0 ) ;
2006-07-09 01:18:07 +02:00
buttonSizer - > Add ( extractButton , 1 , 0 , 0 ) ;
buttonSizer - > Add ( deleteButton , 1 , 0 , 0 ) ;
2008-01-14 00:34:38 +01:00
buttonSizer - > Add ( new HelpButton ( this , _T ( " Attachment Manager " ) ) , 1 , wxLEFT , 5 ) ;
buttonSizer - > Add ( new wxButton ( this , wxID_CANCEL , _ ( " &Close " ) ) , 1 , 0 , 0 ) ;
2006-07-01 04:46:41 +02:00
// Main sizer
wxSizer * mainSizer = new wxBoxSizer ( wxVERTICAL ) ;
mainSizer - > Add ( listView , 1 , wxTOP | wxLEFT | wxRIGHT | wxEXPAND , 5 ) ;
mainSizer - > Add ( buttonSizer , 0 , wxALL | wxEXPAND , 5 ) ;
mainSizer - > SetSizeHints ( this ) ;
SetSizer ( mainSizer ) ;
2007-06-20 07:18:47 +02:00
CenterOnParent ( ) ;
2006-07-01 04:46:41 +02:00
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Update list
///
2006-07-01 04:46:41 +02:00
void DialogAttachments : : UpdateList ( ) {
// Clear list
listView - > ClearAll ( ) ;
// Insert list columns
2006-07-01 09:25:37 +02:00
listView - > InsertColumn ( 0 , _ ( " Attachment name " ) , wxLIST_FORMAT_LEFT , 280 ) ;
listView - > InsertColumn ( 1 , _ ( " Size " ) , wxLIST_FORMAT_LEFT , 100 ) ;
listView - > InsertColumn ( 2 , _ ( " Group " ) , wxLIST_FORMAT_LEFT , 100 ) ;
2006-07-01 04:27:37 +02:00
// Fill list
AssAttachment * attach ;
2010-07-09 09:31:48 +02:00
for ( std : : list < AssEntry * > : : iterator cur = ass - > Line . begin ( ) ; cur ! = ass - > Line . end ( ) ; cur + + ) {
2010-05-19 02:44:52 +02:00
attach = dynamic_cast < AssAttachment * > ( * cur ) ;
2006-07-01 04:27:37 +02:00
if ( attach ) {
// Add item
int row = listView - > GetItemCount ( ) ;
2006-07-08 04:30:18 +02:00
listView - > InsertItem ( row , attach - > GetFileName ( true ) ) ;
2006-07-01 04:27:37 +02:00
listView - > SetItem ( row , 1 , PrettySize ( attach - > GetData ( ) . size ( ) ) ) ;
listView - > SetItem ( row , 2 , attach - > group ) ;
2008-01-20 23:38:07 +01:00
listView - > SetItemPtrData ( row , wxPtrToUInt ( attach ) ) ;
2006-07-01 04:27:37 +02:00
}
}
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Destructor
///
2006-07-01 04:27:37 +02:00
DialogAttachments : : ~ DialogAttachments ( ) {
2010-06-24 21:14:13 +02:00
// Remove empty attachments sections from the file
2010-07-09 09:31:48 +02:00
std : : list < AssEntry * > : : iterator cur = ass - > Line . end ( ) ;
2010-06-24 21:14:13 +02:00
- - cur ;
bool found_attachments = false ;
bool removed_any = false ;
wxString last_section_name ;
2010-07-09 09:31:48 +02:00
while ( cur ! = ass - > Line . begin ( ) ) {
2010-06-24 21:14:13 +02:00
if ( ! ( ( * cur ) - > group = = L " [Fonts] " | | ( * cur ) - > group = = L " [Graphics] " ) )
break ;
if ( ( * cur ) - > GetEntryData ( ) = = L " [Fonts] " | | ( * cur ) - > GetEntryData ( ) = = L " [Graphics] " ) {
2010-06-24 22:43:23 +02:00
if ( found_attachments ) {
- - cur ;
continue ;
}
2010-06-24 21:14:13 +02:00
// found section heading with no attachments in, remove it
wxString delgroup = ( * cur ) - > group ;
std : : list < AssEntry * > : : iterator di = cur ;
2010-07-09 09:31:48 +02:00
while ( + + di ! = ass - > Line . end ( ) & & ( * di ) - > group = = delgroup ) {
2010-06-24 21:14:13 +02:00
delete * di ;
2010-07-09 09:31:48 +02:00
ass - > Line . erase ( di ) ;
2010-06-24 21:14:13 +02:00
di = cur ;
}
di = cur ;
- - cur ;
delete * di ;
2010-07-09 09:31:48 +02:00
ass - > Line . erase ( di ) ;
2010-06-24 21:14:13 +02:00
removed_any = true ;
continue ;
}
if ( last_section_name ! = ( * cur ) - > group )
found_attachments = false ;
if ( dynamic_cast < AssAttachment * > ( * cur ) ! = 0 )
found_attachments = true ;
last_section_name = ( * cur ) - > group ;
- - cur ;
}
if ( removed_any ) {
2010-07-09 09:31:48 +02:00
ass - > Commit ( _ ( " remove empty attachments sections " ) ) ;
2010-06-24 21:14:13 +02:00
}
2006-07-01 04:27:37 +02:00
}
///////////////
// Event table
BEGIN_EVENT_TABLE ( DialogAttachments , wxDialog )
EVT_BUTTON ( BUTTON_ATTACH_FONT , DialogAttachments : : OnAttachFont )
2006-07-01 07:00:03 +02:00
EVT_BUTTON ( BUTTON_ATTACH_GRAPHICS , DialogAttachments : : OnAttachGraphics )
2006-07-01 04:27:37 +02:00
EVT_BUTTON ( BUTTON_EXTRACT , DialogAttachments : : OnExtract )
EVT_BUTTON ( BUTTON_DELETE , DialogAttachments : : OnDelete )
2006-07-09 01:18:07 +02:00
EVT_LIST_ITEM_SELECTED ( ATTACHMENT_LIST , DialogAttachments : : OnListClick )
EVT_LIST_ITEM_DESELECTED ( ATTACHMENT_LIST , DialogAttachments : : OnListClick )
EVT_LIST_ITEM_FOCUSED ( ATTACHMENT_LIST , DialogAttachments : : OnListClick )
2006-07-01 04:27:37 +02:00
END_EVENT_TABLE ( )
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Attach font
/// @param event
/// @return
///
2006-07-01 04:27:37 +02:00
void DialogAttachments : : OnAttachFont ( wxCommandEvent & event ) {
2006-07-01 07:00:03 +02:00
// Pick files
2006-07-01 06:08:01 +02:00
wxArrayString filenames ;
wxArrayString paths ;
{
2010-05-21 03:13:36 +02:00
wxFileDialog diag ( this , _ ( " Choose file to be attached " ) , lagi_wxString ( OPT_GET ( " Path/Fonts Collector Destination " ) - > GetString ( ) ) , _T ( " " ) , _T ( " Font Files (*.ttf)|*.ttf " ) , wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE ) ;
2006-07-01 07:00:03 +02:00
if ( diag . ShowModal ( ) = = wxID_CANCEL ) return ;
2006-07-01 06:08:01 +02:00
diag . GetFilenames ( filenames ) ;
diag . GetPaths ( paths ) ;
}
// Create attachments
for ( size_t i = 0 ; i < filenames . Count ( ) ; i + + ) {
//wxFileName file(filenames[i]);
AssAttachment * newAttach = new AssAttachment ( filenames [ i ] ) ;
try {
newAttach - > Import ( paths [ i ] ) ;
}
catch ( . . . ) {
delete newAttach ;
return ;
}
newAttach - > group = _T ( " [Fonts] " ) ;
2010-07-09 09:31:48 +02:00
ass - > InsertAttachment ( newAttach ) ;
2006-07-01 06:08:01 +02:00
}
2010-07-09 09:31:48 +02:00
ass - > Commit ( _ ( " attach font file " ) ) ;
2010-06-24 08:13:51 +02:00
2006-07-01 06:08:01 +02:00
// Update
UpdateList ( ) ;
2006-07-01 04:27:37 +02:00
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Attach graphics
/// @param event
/// @return
///
2006-07-01 07:00:03 +02:00
void DialogAttachments : : OnAttachGraphics ( wxCommandEvent & event ) {
// Pick files
wxArrayString filenames ;
wxArrayString paths ;
{
2007-01-22 20:31:49 +01:00
wxFileDialog diag ( this , _ ( " Choose file to be attached " ) , _T ( " " ) , _T ( " " ) , _T ( " Graphic Files (*.bmp,*.gif,*.jpg,*.ico,*.wmf)|*.bmp ; * . gif ; * . jpg ; * . ico ; * . wmf " ), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
2006-07-01 07:00:03 +02:00
if ( diag . ShowModal ( ) = = wxID_CANCEL ) return ;
diag . GetFilenames ( filenames ) ;
diag . GetPaths ( paths ) ;
}
// Create attachments
for ( size_t i = 0 ; i < filenames . Count ( ) ; i + + ) {
//wxFileName file(filenames[i]);
AssAttachment * newAttach = new AssAttachment ( filenames [ i ] ) ;
try {
newAttach - > Import ( paths [ i ] ) ;
}
catch ( . . . ) {
delete newAttach ;
return ;
}
newAttach - > group = _T ( " [Graphics] " ) ;
2010-07-09 09:31:48 +02:00
ass - > InsertAttachment ( newAttach ) ;
2006-07-01 07:00:03 +02:00
}
2010-07-09 09:31:48 +02:00
ass - > Commit ( _ ( " attach graphics file " ) ) ;
2010-06-24 08:13:51 +02:00
2006-07-01 07:00:03 +02:00
// Update
UpdateList ( ) ;
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Extract
/// @param event
/// @return
///
2006-07-01 04:27:37 +02:00
void DialogAttachments : : OnExtract ( wxCommandEvent & event ) {
2006-07-01 05:06:21 +02:00
// Check if there's a selection
int i = listView - > GetFirstSelected ( ) ;
// Get path
if ( i ! = - 1 ) {
wxString path ;
bool fullPath = false ;
// Multiple or single?
2010-05-21 03:13:36 +02:00
if ( listView - > GetNextSelected ( i ) ! = - 1 ) path = wxDirSelector ( _ ( " Select the path to save the files to: " ) , lagi_wxString ( OPT_GET ( " Path/Fonts Collector Destination " ) - > GetString ( ) ) ) + _T ( " / " ) ;
2006-07-01 05:06:21 +02:00
else {
2006-07-08 04:30:18 +02:00
// Default path
2008-01-20 23:38:07 +01:00
wxString defPath = ( ( AssAttachment * ) wxUIntToPtr ( listView - > GetItemData ( i ) ) ) - > GetFileName ( ) ;
2010-05-21 03:13:36 +02:00
path = wxFileSelector ( _ ( " Select the path to save the file to: " ) , lagi_wxString ( OPT_GET ( " Path/Fonts Collector Destination " ) - > GetString ( ) ) , defPath ) ;
2006-07-01 05:06:21 +02:00
fullPath = true ;
}
if ( path . IsEmpty ( ) ) return ;
// Loop through items in list
while ( i ! = - 1 ) {
2008-01-20 23:38:07 +01:00
AssAttachment * attach = ( AssAttachment * ) wxUIntToPtr ( listView - > GetItemData ( i ) ) ;
2006-07-01 05:06:21 +02:00
wxString filename = path ;
2006-07-08 04:30:18 +02:00
if ( ! fullPath ) filename + = attach - > GetFileName ( ) ;
2006-07-01 05:06:21 +02:00
attach - > Extract ( filename ) ;
i = listView - > GetNextSelected ( i ) ;
}
}
2006-07-01 04:27:37 +02:00
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Delete
/// @param event
///
2006-07-01 04:27:37 +02:00
void DialogAttachments : : OnDelete ( wxCommandEvent & event ) {
2006-07-01 04:46:41 +02:00
// Loop through items in list
int i = listView - > GetFirstSelected ( ) ;
while ( i ! = - 1 ) {
2010-07-09 09:31:48 +02:00
ass - > Line . remove ( ( AssEntry * ) wxUIntToPtr ( listView - > GetItemData ( i ) ) ) ;
2006-07-01 04:46:41 +02:00
i = listView - > GetNextSelected ( i ) ;
}
2010-07-09 09:31:48 +02:00
ass - > Commit ( _ ( " remove attachment " ) ) ;
2010-06-24 08:13:51 +02:00
2006-07-01 04:46:41 +02:00
// Update list
UpdateList ( ) ;
2006-07-01 04:27:37 +02:00
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief List selection changed
/// @param event
///
2006-07-09 01:18:07 +02:00
void DialogAttachments : : OnListClick ( wxListEvent & event ) {
// Check if any is selected
bool hasSel = listView - > GetFirstSelected ( ) ! = - 1 ;
// Set status
extractButton - > Enable ( hasSel ) ;
deleteButton - > Enable ( hasSel ) ;
}
2009-07-29 07:43:02 +02:00
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00