2007-06-20 07:18:47 +02:00
// Copyright (c) 2007, Rodrigo Braz Monteiro
2006-01-16 22:02:54 +01:00
// 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-01-16 22:02:54 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file dialog_fonts_collector.cpp
/// @brief Font collector dialogue box
/// @ingroup tools_ui font_collector
///
2006-01-16 22:02:54 +01:00
////////////
// Includes
2009-01-04 07:31:48 +01:00
# include "config.h"
2009-09-10 15:06:40 +02:00
# ifndef AGI_PRE
2006-01-16 22:02:54 +01:00
# include <wx/config.h>
# include <wx/filename.h>
2009-09-10 15:06:40 +02:00
# include <wx/fontenum.h>
2006-12-18 23:24:25 +01:00
# include <wx/wfstream.h>
# include <wx/zipstrm.h>
2009-09-10 15:06:40 +02:00
# endif
2006-01-16 22:02:54 +01:00
# include "ass_dialogue.h"
2009-09-10 15:06:40 +02:00
# include "ass_file.h"
# include "ass_override.h"
2006-01-16 22:02:54 +01:00
# include "ass_style.h"
2006-12-24 22:52:54 +01:00
# include "dialog_fonts_collector.h"
2007-06-20 07:18:47 +02:00
# include "font_file_lister.h"
2009-09-10 15:06:40 +02:00
# include "frame_main.h"
2008-01-13 23:25:26 +01:00
# include "help_button.h"
2009-07-24 02:08:25 +02:00
# include "libresrc/libresrc.h"
2009-09-10 15:06:40 +02:00
# include "options.h"
# include "scintilla_text_ctrl.h"
# include "subs_grid.h"
# include "utils.h"
2007-06-20 07:18:47 +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
/// DOCME
2007-06-20 07:18:47 +02:00
enum IDs {
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
/// DOCME
2007-06-20 07:18:47 +02:00
START_BUTTON = 1150 ,
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
/// DOCME
2007-06-20 07:18:47 +02:00
BROWSE_BUTTON ,
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
/// DOCME
2007-06-20 07:18:47 +02:00
RADIO_BOX
} ;
2006-01-16 22:02:54 +01:00
2008-01-20 07:46:10 +01:00
/////////
// Event
DECLARE_EVENT_TYPE ( EVT_ADD_TEXT , - 1 )
DEFINE_EVENT_TYPE ( EVT_ADD_TEXT )
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
///
2006-01-16 22:02:54 +01:00
DialogFontsCollector : : DialogFontsCollector ( wxWindow * parent )
: wxDialog ( parent , - 1 , _ ( " Fonts Collector " ) , wxDefaultPosition , wxDefaultSize , wxDEFAULT_DIALOG_STYLE )
{
2007-07-05 01:09:40 +02:00
// Set icon
2009-07-25 06:49:59 +02:00
SetIcon ( BitmapToIcon ( GETIMAGE ( font_collector_button_24 ) ) ) ;
2007-07-05 01:09:40 +02:00
2006-07-09 01:07:24 +02:00
// Parent
main = ( FrameMain * ) parent ;
2006-01-16 22:02:54 +01:00
// Destination box
2006-02-20 23:06:38 +01:00
wxString dest = Options . AsText ( _T ( " Fonts Collector Destination " ) ) ;
if ( dest = = _T ( " ?script " ) ) {
wxFileName filename ( AssFile : : top - > filename ) ;
dest = filename . GetPath ( ) ;
}
2008-01-11 04:38:06 +01:00
while ( dest . Right ( 1 ) = = _T ( " / " ) ) dest = dest . Left ( dest . Length ( ) - 1 ) ;
2006-02-20 23:06:38 +01:00
DestBox = new wxTextCtrl ( this , - 1 , dest , wxDefaultPosition , wxSize ( 250 , 20 ) , 0 ) ;
2006-01-16 22:02:54 +01:00
BrowseButton = new wxButton ( this , BROWSE_BUTTON , _ ( " &Browse... " ) ) ;
wxSizer * DestBottomSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2006-12-18 23:24:25 +01:00
DestLabel = new wxStaticText ( this , - 1 , _ ( " Choose the folder where the fonts will be collected to. \n It will be created if it doesn't exist. " ) ) ;
2006-01-16 22:02:54 +01:00
DestBottomSizer - > Add ( DestBox , 1 , wxEXPAND | wxRIGHT , 5 ) ;
DestBottomSizer - > Add ( BrowseButton , 0 , 0 , 0 ) ;
wxSizer * DestSizer = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Destination " ) ) ;
DestSizer - > Add ( DestLabel , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
DestSizer - > Add ( DestBottomSizer , 0 , wxEXPAND , 0 ) ;
2007-06-20 07:18:47 +02:00
// Action radio box
wxArrayString choices ;
2008-01-14 06:54:58 +01:00
choices . Add ( _ ( " Check fonts for availability " ) ) ;
choices . Add ( _ ( " Copy fonts to folder " ) ) ;
choices . Add ( _ ( " Copy fonts to zipped archive " ) ) ;
choices . Add ( _ ( " Attach fonts to current subtitles " ) ) ;
2010-02-09 05:31:33 +01:00
# ifdef _DEBUG
2008-01-14 06:54:58 +01:00
choices . Add ( _ ( " DEBUG: Verify all fonts in system " ) ) ;
# endif
2007-06-20 07:18:47 +02:00
CollectAction = new wxRadioBox ( this , RADIO_BOX , _T ( " Action " ) , wxDefaultPosition , wxDefaultSize , choices , 1 ) ;
2008-01-14 06:54:58 +01:00
size_t lastAction = Options . AsInt ( _T ( " Fonts Collector Action " ) ) ;
if ( lastAction > = choices . GetCount ( ) ) lastAction = 0 ;
CollectAction - > SetSelection ( lastAction ) ;
2006-01-16 22:02:54 +01:00
// Log box
2008-11-09 02:18:15 +01:00
LogBox = new ScintillaTextCtrl ( this , - 1 , _T ( " " ) , wxDefaultPosition , wxSize ( 300 , 210 ) ) ;
2007-06-20 07:18:47 +02:00
LogBox - > SetWrapMode ( wxSTC_WRAP_WORD ) ;
LogBox - > SetMarginWidth ( 1 , 0 ) ;
LogBox - > SetReadOnly ( true ) ;
LogBox - > StyleSetForeground ( 1 , wxColour ( 0 , 200 , 0 ) ) ;
LogBox - > StyleSetForeground ( 2 , wxColour ( 200 , 0 , 0 ) ) ;
LogBox - > StyleSetForeground ( 3 , wxColour ( 200 , 100 , 0 ) ) ;
2006-01-16 22:02:54 +01:00
wxSizer * LogSizer = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Log " ) ) ;
LogSizer - > Add ( LogBox , 1 , wxEXPAND , 0 ) ;
// Buttons sizer
StartButton = new wxButton ( this , START_BUTTON , _ ( " &Start! " ) ) ;
2008-01-13 23:25:26 +01:00
CloseButton = new wxButton ( this , wxID_CANCEL ) ;
2006-01-16 22:02:54 +01:00
StartButton - > SetDefault ( ) ;
2008-01-13 23:25:26 +01:00
wxStdDialogButtonSizer * ButtonSizer = new wxStdDialogButtonSizer ( ) ;
ButtonSizer - > AddButton ( StartButton ) ;
ButtonSizer - > AddButton ( CloseButton ) ;
ButtonSizer - > AddButton ( new HelpButton ( this , _T ( " Fonts Collector " ) ) ) ;
ButtonSizer - > SetAffirmativeButton ( StartButton ) ;
ButtonSizer - > Realize ( ) ;
2006-01-16 22:02:54 +01:00
// Main sizer
wxSizer * MainSizer = new wxBoxSizer ( wxVERTICAL ) ;
2007-06-20 07:18:47 +02:00
MainSizer - > Add ( CollectAction , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2006-01-16 22:02:54 +01:00
MainSizer - > Add ( DestSizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
MainSizer - > Add ( LogSizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
MainSizer - > Add ( ButtonSizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
// Set sizer
SetSizer ( MainSizer ) ;
MainSizer - > SetSizeHints ( this ) ;
2007-06-20 07:18:47 +02:00
CenterOnParent ( ) ;
2006-12-30 21:58:24 +01:00
// Run dummy event to update label
Update ( ) ;
2006-01-16 22:02:54 +01: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-01-16 22:02:54 +01:00
DialogFontsCollector : : ~ DialogFontsCollector ( ) {
2007-06-20 07:18:47 +02:00
FontFileLister : : ClearData ( ) ;
2006-01-16 22:02:54 +01:00
}
///////////////
// Event table
BEGIN_EVENT_TABLE ( DialogFontsCollector , wxDialog )
EVT_BUTTON ( START_BUTTON , DialogFontsCollector : : OnStart )
EVT_BUTTON ( BROWSE_BUTTON , DialogFontsCollector : : OnBrowse )
EVT_BUTTON ( wxID_CLOSE , DialogFontsCollector : : OnClose )
2007-06-20 07:18:47 +02:00
EVT_RADIOBOX ( RADIO_BOX , DialogFontsCollector : : OnRadio )
2008-01-20 07:46:10 +01:00
EVT_COMMAND ( 0 , EVT_ADD_TEXT , DialogFontsCollector : : OnAddText )
2006-01-16 22:02:54 +01: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 Start processing
/// @param event
/// @return
///
2006-01-16 22:02:54 +01:00
void DialogFontsCollector : : OnStart ( wxCommandEvent & event ) {
2008-01-20 07:46:10 +01:00
// Clear
LogBox - > SetReadOnly ( false ) ;
LogBox - > ClearAll ( ) ;
LogBox - > SetReadOnly ( true ) ;
2007-06-20 09:10:41 +02:00
// Action being done
int action = CollectAction - > GetSelection ( ) ;
2006-01-16 22:02:54 +01:00
// Check if it's OK to do it
wxString foldername = DestBox - > GetValue ( ) ;
2007-06-20 09:10:41 +02:00
if ( action = = 1 ) foldername + = _T ( " // " ) ;
2006-01-16 22:02:54 +01:00
wxFileName folder ( foldername ) ;
2007-06-20 09:10:41 +02:00
bool isFolder = folder . IsDir ( ) ;
// Check if it's a folder
if ( action = = 1 & & ! isFolder ) {
wxMessageBox ( _ ( " Invalid destination. " ) , _ ( " Error " ) , wxICON_EXCLAMATION | wxOK ) ;
return ;
}
2006-01-16 22:02:54 +01:00
// Make folder if it doesn't exist
2007-06-20 09:10:41 +02:00
if ( action = = 1 | | action = = 2 ) {
2007-06-20 07:18:47 +02:00
if ( ! folder . DirExists ( ) ) {
2007-06-20 09:10:41 +02:00
folder . Mkdir ( 0777 , wxPATH_MKDIR_FULL ) ;
if ( ! folder . DirExists ( ) ) {
wxMessageBox ( _ ( " Could not create destination folder. " ) , _ ( " Error " ) , wxICON_EXCLAMATION | wxOK ) ;
return ;
}
}
}
// Check if we have a valid archive name
if ( action = = 2 ) {
if ( isFolder | | folder . GetName ( ) . IsEmpty ( ) | | folder . GetExt ( ) ! = _T ( " zip " ) ) {
wxMessageBox ( _ ( " Invalid path for .zip file. " ) , _ ( " Error " ) , wxICON_EXCLAMATION | wxOK ) ;
2007-06-20 07:18:47 +02:00
return ;
}
}
2006-01-16 22:02:54 +01:00
2007-06-20 07:18:47 +02:00
// Start thread
wxThread * worker = new FontsCollectorThread ( AssFile : : top , foldername , this ) ;
worker - > Create ( ) ;
worker - > Run ( ) ;
2006-01-16 22:02:54 +01:00
2007-06-20 07:18:47 +02:00
// Set options
if ( action = = 1 | | action = = 2 ) {
2006-02-20 23:06:38 +01:00
wxString dest = foldername ;
wxFileName filename ( AssFile : : top - > filename ) ;
if ( filename . GetPath ( ) = = dest ) {
dest = _T ( " ?script " ) ;
}
Options . SetText ( _T ( " Fonts Collector Destination " ) , dest ) ;
2006-01-16 22:02:54 +01:00
}
2007-06-20 08:29:20 +02:00
Options . SetInt ( _T ( " Fonts Collector Action " ) , action ) ;
Options . Save ( ) ;
2006-01-16 22:02:54 +01:00
2007-06-20 07:18:47 +02:00
// Set buttons
StartButton - > Enable ( false ) ;
BrowseButton - > Enable ( false ) ;
DestBox - > Enable ( false ) ;
CloseButton - > Enable ( false ) ;
CollectAction - > Enable ( false ) ;
DestLabel - > Enable ( false ) ;
if ( ! worker - > IsDetached ( ) ) worker - > Wait ( ) ;
2006-01-16 22:02:54 +01: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 Close dialog
/// @param event
///
2006-01-16 22:02:54 +01:00
void DialogFontsCollector : : OnClose ( wxCommandEvent & event ) {
EndModal ( 0 ) ;
}
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 Browse location
/// @param event
///
2006-01-16 22:02:54 +01:00
void DialogFontsCollector : : OnBrowse ( wxCommandEvent & event ) {
2006-12-18 23:24:25 +01:00
// Chose file name
2007-06-20 07:18:47 +02:00
if ( CollectAction - > GetSelection ( ) = = 2 ) {
2006-12-18 23:24:25 +01:00
wxFileName fname ( DestBox - > GetValue ( ) ) ;
2007-07-05 17:23:31 +02:00
wxString dest = wxFileSelector ( _ ( " Select archive file name " ) , DestBox - > GetValue ( ) , fname . GetFullName ( ) , _T ( " .zip " ) , _ ( " Zip Archives (*.zip)|*.zip " ) , wxFD_SAVE | wxFD_OVERWRITE_PROMPT ) ;
2006-12-18 23:24:25 +01:00
if ( ! dest . empty ( ) ) {
DestBox - > SetValue ( dest ) ;
}
}
// Choose folder
else {
wxString dest = wxDirSelector ( _ ( " Select folder to save fonts on " ) , DestBox - > GetValue ( ) , 0 ) ;
if ( ! dest . empty ( ) ) {
DestBox - > SetValue ( dest ) ;
}
2006-01-16 22:02:54 +01: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 Radio box changed
/// @param event
///
2007-06-20 07:18:47 +02:00
void DialogFontsCollector : : OnRadio ( wxCommandEvent & event ) {
Update ( event . GetInt ( ) ) ;
2006-12-30 21:58:24 +01: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 controls
/// @param value
///
2007-06-20 07:18:47 +02:00
void DialogFontsCollector : : Update ( int value ) {
2007-06-20 08:29:20 +02:00
// Enable buttons
CloseButton - > Enable ( true ) ;
StartButton - > Enable ( true ) ;
CollectAction - > Enable ( true ) ;
2007-06-20 09:10:41 +02:00
wxString dst = DestBox - > GetValue ( ) ;
2007-06-20 08:29:20 +02:00
2007-06-20 07:18:47 +02:00
// Get value if -1
if ( value = = - 1 ) {
value = CollectAction - > GetSelection ( ) ;
2006-12-18 23:24:25 +01:00
}
2007-06-20 07:18:47 +02:00
2007-06-20 08:29:20 +02:00
// Check or attach
if ( value = = 0 | | value = = 3 ) {
2007-06-20 07:18:47 +02:00
DestBox - > Enable ( false ) ;
BrowseButton - > Enable ( false ) ;
DestLabel - > Enable ( false ) ;
2007-06-20 08:29:20 +02:00
DestLabel - > SetLabel ( _T ( " N/A \n " ) ) ;
2007-06-20 07:18:47 +02:00
}
// Collect to folder
else if ( value = = 1 ) {
DestBox - > Enable ( true ) ;
BrowseButton - > Enable ( true ) ;
DestLabel - > Enable ( true ) ;
2006-12-30 21:58:24 +01:00
DestLabel - > SetLabel ( _ ( " Choose the folder where the fonts will be collected to. \n It will be created if it doesn't exist. " ) ) ;
2007-06-20 09:10:41 +02:00
// Remove filename from browse box
if ( dst . Right ( 4 ) = = _T ( " .zip " ) ) {
wxFileName fn ( dst ) ;
DestBox - > SetValue ( fn . GetPath ( ) ) ;
2006-12-30 21:58:24 +01:00
}
}
2006-01-16 22:02:54 +01:00
2007-06-20 07:18:47 +02:00
// Collect to zip
else if ( value = = 2 ) {
DestBox - > Enable ( true ) ;
BrowseButton - > Enable ( true ) ;
DestLabel - > Enable ( true ) ;
DestLabel - > SetLabel ( _ ( " Enter the name of the destination zip file to collect the fonts to. \n If a folder is entered, a default name will be used. " ) ) ;
2007-06-20 09:10:41 +02:00
// Add filename to browse box
if ( dst . Right ( 4 ) ! = _T ( " .zip " ) ) {
wxFileName fn ( dst + _T ( " // " ) ) ;
fn . SetFullName ( _T ( " fonts.zip " ) ) ;
DestBox - > SetValue ( fn . GetFullPath ( ) ) ;
}
2006-01-16 22:02:54 +01: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 Add text
/// @param event
///
2008-01-20 07:46:10 +01:00
void DialogFontsCollector : : OnAddText ( wxCommandEvent & event ) {
ColourString * str = ( ColourString * ) event . GetClientData ( ) ;
LogBox - > SetReadOnly ( false ) ;
2008-11-09 02:18:15 +01:00
int pos = LogBox - > GetReverseUnicodePosition ( LogBox - > GetLength ( ) ) ;
2008-01-20 07:46:10 +01:00
LogBox - > AppendText ( str - > text ) ;
if ( str - > colour ) {
2008-11-09 02:18:15 +01:00
LogBox - > StartUnicodeStyling ( pos , 31 ) ;
LogBox - > SetUnicodeStyling ( pos , str - > text . Length ( ) , str - > colour ) ;
2008-01-20 07:46:10 +01:00
}
delete str ;
LogBox - > GotoPos ( pos ) ;
LogBox - > SetReadOnly ( true ) ;
}
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 Collect font files
///
2006-01-16 22:02:54 +01:00
void FontsCollectorThread : : CollectFontData ( ) {
2007-07-29 03:21:28 +02:00
FontFileLister : : Initialize ( ) ;
2006-01-16 22:02:54 +01: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 Collector thread
/// @param _subs
/// @param _destination
/// @param _collector
///
2006-01-16 22:02:54 +01:00
FontsCollectorThread : : FontsCollectorThread ( AssFile * _subs , wxString _destination , DialogFontsCollector * _collector )
: wxThread ( wxTHREAD_DETACHED )
{
subs = _subs ;
destination = _destination ;
collector = _collector ;
instance = this ;
}
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 Thread entry
/// @return
///
2006-01-16 22:02:54 +01:00
wxThread : : ExitCode FontsCollectorThread : : Entry ( ) {
// Collect
Collect ( ) ;
2007-06-20 08:29:20 +02:00
// After done, restore status
collector - > Update ( ) ;
2006-01-16 22:02:54 +01:00
// Return
2009-05-18 07:24:07 +02:00
if ( IsDetached ( ) & & TestDestroy ( ) ) Delete ( ) ;
2006-01-16 22:02:54 +01:00
return 0 ;
}
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 Collect
/// @return
///
2006-01-16 22:02:54 +01:00
void FontsCollectorThread : : Collect ( ) {
2007-06-20 07:18:47 +02:00
// Set destination folder
int oper = collector - > CollectAction - > GetSelection ( ) ;
destFolder = collector - > DestBox - > GetValue ( ) ;
if ( oper = = 1 & & ! wxFileName : : DirExists ( destFolder ) ) {
AppendText ( _ ( " Invalid destination directory. " ) , 1 ) ;
return ;
2006-12-18 23:24:25 +01:00
}
2006-01-16 22:02:54 +01:00
2007-06-20 09:10:41 +02:00
// Open zip stream if saving to compressed archive
wxFFileOutputStream * out = NULL ;
zip = NULL ;
if ( oper = = 2 ) {
out = new wxFFileOutputStream ( destFolder ) ;
zip = new wxZipOutputStream ( * out ) ;
}
2007-06-20 07:18:47 +02:00
// Collect font data
2007-07-05 17:23:31 +02:00
AppendText ( _ ( " Collecting font data from system. This might take a while, depending on the number of fonts installed. Results are cached and subsequent executions will be faster... \n " ) ) ;
2007-06-20 07:18:47 +02:00
CollectFontData ( ) ;
2007-07-05 17:23:31 +02:00
AppendText ( _ ( " Done collecting font data. " ) ) ;
AppendText ( _ ( " Scanning file for fonts... " ) ) ;
2006-01-16 22:02:54 +01:00
2007-06-20 07:18:47 +02:00
// Scan file
2008-01-14 06:54:58 +01:00
if ( collector - > CollectAction - > GetSelection ( ) ! = 4 ) {
AssDialogue * curDiag ;
curLine = 0 ;
for ( std : : list < AssEntry * > : : iterator cur = subs - > Line . begin ( ) ; cur ! = subs - > Line . end ( ) ; cur + + ) {
// Collect from style
2010-05-19 02:44:52 +02:00
curStyle = dynamic_cast < AssStyle * > ( * cur ) ;
2008-01-14 06:54:58 +01:00
if ( curStyle ) {
AddFont ( curStyle - > font , 0 ) ;
}
2006-01-16 22:02:54 +01:00
2008-01-14 06:54:58 +01:00
// Collect from dialogue
else {
2010-05-19 02:44:52 +02:00
curDiag = dynamic_cast < AssDialogue * > ( * cur ) ;
2008-01-14 06:54:58 +01:00
if ( curDiag ) {
curLine + + ;
curDiag - > ParseASSTags ( ) ;
curDiag - > ProcessParameters ( GetFonts ) ;
curDiag - > ClearBlocks ( ) ;
}
2006-01-16 22:02:54 +01:00
}
}
}
2008-01-14 06:54:58 +01:00
// For maitenance, gather all on system
else {
wxArrayString fonts = wxFontEnumerator : : GetFacenames ( ) ;
for ( size_t i = 0 ; i < fonts . Count ( ) ; i + + ) AddFont ( fonts [ i ] , 2 ) ;
}
2007-06-20 07:18:47 +02:00
// Copy fonts
2007-07-05 17:23:31 +02:00
AppendText ( wxString ( _ ( " Done. " ) ) + _T ( " \n \n " ) ) ;
2007-06-20 07:18:47 +02:00
switch ( oper ) {
case 0 : AppendText ( _ ( " Checking fonts... \n " ) ) ; break ;
case 1 : AppendText ( _ ( " Copying fonts to folder... \n " ) ) ; break ;
case 2 : AppendText ( _ ( " Copying fonts to archive... \n " ) ) ; break ;
case 3 : AppendText ( _ ( " Attaching fonts to file... \n " ) ) ; break ;
}
bool ok = true ;
2007-06-20 08:29:20 +02:00
bool someOk = false ;
2007-06-20 07:18:47 +02:00
for ( size_t i = 0 ; i < fonts . Count ( ) ; i + + ) {
2007-06-20 08:29:20 +02:00
bool result = ProcessFont ( fonts [ i ] ) ;
if ( result ) someOk = true ;
if ( ! result ) ok = false ;
2007-06-20 07:18:47 +02:00
}
2007-06-20 09:10:41 +02:00
// Close ZIP archive
if ( oper = = 2 ) {
zip - > Close ( ) ;
delete zip ;
delete out ;
AppendText ( wxString : : Format ( _ ( " \n Finished writing to %s. \n " ) , destination . c_str ( ) ) , 1 ) ;
}
2007-06-20 07:18:47 +02:00
// Final result
if ( ok ) {
2008-01-11 05:36:29 +01:00
if ( oper = = 0 ) {
AppendText ( _ ( " Done. All fonts found. " ) , 1 ) ;
}
2007-06-20 08:29:20 +02:00
else {
AppendText ( _ ( " Done. All fonts copied. " ) , 1 ) ;
// Modify file if it was attaching
if ( oper = = 3 & & someOk ) {
wxMutexGuiEnter ( ) ;
subs - > FlagAsModified ( _ ( " font attachment " ) ) ;
collector - > main - > SubsBox - > CommitChanges ( ) ;
wxMutexGuiLeave ( ) ;
}
}
2007-06-20 07:18:47 +02:00
}
else {
if ( oper = = 0 ) AppendText ( _ ( " Done. Some fonts could not be found. " ) , 2 ) ;
else AppendText ( _ ( " Done. Some fonts could not be copied. " ) , 2 ) ;
}
}
2006-01-16 22:02:54 +01: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 Process font
/// @param name
/// @return
///
2007-06-20 07:18:47 +02:00
bool FontsCollectorThread : : ProcessFont ( wxString name ) {
// Action
int action = collector - > CollectAction - > GetSelection ( ) ;
// Font name
AppendText ( wxString : : Format ( _T ( " \" %s \" ... " ) , name . c_str ( ) ) ) ;
// Get font list
wxArrayString files = FontFileLister : : GetFilesWithFace ( name ) ;
bool result = files . Count ( ) ! = 0 ;
// No files found
if ( ! result ) {
AppendText ( _ ( " Not found. \n " ) , 2 ) ;
return false ;
2006-01-16 22:02:54 +01:00
}
2007-06-20 07:18:47 +02:00
// Just checking, found
2008-01-14 06:54:58 +01:00
else if ( action = = 0 | | action = = 4 ) {
2007-06-20 07:18:47 +02:00
AppendText ( _ ( " Found. \n " ) , 1 ) ;
return true ;
2006-12-18 23:24:25 +01:00
}
2007-06-20 07:18:47 +02:00
// Copy font
AppendText ( _T ( " \n " ) ) ;
for ( size_t i = 0 ; i < files . Count ( ) ; i + + ) {
int tempResult = 0 ;
switch ( action ) {
case 1 : tempResult = CopyFont ( files [ i ] ) ; break ;
case 2 : tempResult = ArchiveFont ( files [ i ] ) ? 1 : 0 ; break ;
case 3 : tempResult = AttachFont ( files [ i ] ) ? 1 : 0 ; break ;
2006-01-16 22:02:54 +01:00
}
2007-06-20 07:18:47 +02:00
if ( tempResult = = 1 ) {
AppendText ( wxString : : Format ( _ ( " * Copied %s. \n " ) , files [ i ] . c_str ( ) ) , 1 ) ;
}
else if ( tempResult = = 2 ) {
wxFileName fn ( files [ i ] ) ;
AppendText ( wxString : : Format ( _ ( " * %s already exists on destination. \n " ) , fn . GetFullName ( ) . c_str ( ) ) , 3 ) ;
2006-01-16 22:02:54 +01:00
}
2007-06-20 07:18:47 +02:00
else {
AppendText ( wxString : : Format ( _ ( " * Failed to copy %s. \n " ) , files [ i ] . c_str ( ) ) , 2 ) ;
result = false ;
}
}
// Done
return result ;
}
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 Copy font
/// @param filename
/// @return
///
2007-06-20 07:18:47 +02:00
int FontsCollectorThread : : CopyFont ( wxString filename ) {
wxFileName fn ( filename ) ;
wxString dstName = destFolder + _T ( " // " ) + fn . GetFullName ( ) ;
if ( wxFileName : : FileExists ( dstName ) ) return 2 ;
2009-07-14 04:20:40 +02:00
return wxCopyFile ( filename , dstName , true ) ? 1 : 0 ;
2007-06-20 07:18:47 +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 Archive font
/// @param filename
/// @return
///
2007-06-20 07:18:47 +02:00
bool FontsCollectorThread : : ArchiveFont ( wxString filename ) {
2007-06-20 09:10:41 +02:00
// Open file
wxFFileInputStream in ( filename ) ;
if ( ! in . IsOk ( ) ) return false ;
// Write to archive
try {
wxFileName fn ( filename ) ;
zip - > PutNextEntry ( fn . GetFullName ( ) ) ;
zip - > Write ( in ) ;
}
catch ( . . . ) {
return false ;
}
return true ;
2007-06-20 07:18:47 +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 font
/// @param filename
/// @return
///
2007-06-20 07:18:47 +02:00
bool FontsCollectorThread : : AttachFont ( wxString filename ) {
2007-06-20 08:29:20 +02:00
try {
subs - > InsertAttachment ( filename ) ;
}
catch ( . . . ) {
return false ;
}
return true ;
2007-06-20 07:18:47 +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 Get fonts from ass overrides
/// @param tagName
/// @param par_n
/// @param param
/// @param usr
///
2007-06-20 07:18:47 +02:00
void FontsCollectorThread : : GetFonts ( wxString tagName , int par_n , AssOverrideParameter * param , void * usr ) {
if ( tagName = = _T ( " \\ fn " ) ) {
2009-07-24 04:30:11 +02:00
if ( instance ) instance - > AddFont ( param - > AsText ( ) , 1 ) ;
2006-01-16 22:02:54 +01:00
}
2007-06-20 07:18:47 +02:00
}
2006-12-18 23:24:25 +01: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 Adds a font
/// @param fontname
/// @param mode
///
2008-01-14 06:54:58 +01:00
void FontsCollectorThread : : AddFont ( wxString fontname , int mode ) {
2007-08-20 20:10:27 +02:00
// @-fonts (CJK vertical layout variations) should be listed as the non-@ name
if ( fontname . StartsWith ( _T ( " @ " ) , 0 ) )
fontname . Remove ( 0 , 1 ) ;
2007-06-20 07:18:47 +02:00
if ( fonts . Index ( fontname ) = = wxNOT_FOUND ) {
fonts . Add ( fontname ) ;
2007-01-04 04:53:56 +01:00
2008-01-14 06:54:58 +01:00
if ( mode = = 0 ) AppendText ( wxString : : Format ( _ ( " \" %s \" found on style \" %s \" . \n " ) , fontname . c_str ( ) , curStyle - > name . c_str ( ) ) ) ;
else if ( mode = = 1 ) AppendText ( wxString : : Format ( _ ( " \" %s \" found on dialogue line \" %d \" . \n " ) , fontname . c_str ( ) , curLine ) ) ;
else AppendText ( wxString : : Format ( _ ( " \" %s \" found. \n " ) , fontname . c_str ( ) ) ) ;
2006-12-18 23:24:25 +01:00
}
2007-06-20 07:18:47 +02:00
}
2006-07-09 01:07:24 +02:00
2007-06-20 07:18:47 +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 Append text
/// @param text
/// @param colour
///
2007-06-20 07:18:47 +02:00
void FontsCollectorThread : : AppendText ( wxString text , int colour ) {
2008-01-20 07:46:10 +01:00
ColourString * str = new ColourString ;
str - > text = text ;
str - > colour = colour ;
wxCommandEvent event ( EVT_ADD_TEXT , 0 ) ;
event . SetClientData ( str ) ;
collector - > AddPendingEvent ( event ) ;
2006-01-16 22:02:54 +01:00
}
2007-06-20 07:18:47 +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
/// DOCME
2007-06-20 07:18:47 +02:00
FontsCollectorThread * FontsCollectorThread : : instance ;
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