Aegisub/aegisub/src/dialog_fonts_collector.h

161 lines
3.8 KiB
C
Raw Normal View History

// 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.
//
// Aegisub Project http://www.aegisub.org/
2006-01-16 22:02:54 +01:00
//
// $Id$
/// @file dialog_fonts_collector.h
/// @see dialog_fonts_collector.cpp
/// @ingroup tools_ui font_collector
///
2006-01-16 22:02:54 +01:00
#ifndef AGI_PRE
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/stc/stc.h>
#include <wx/textctrl.h>
#endif
2006-01-16 22:02:54 +01:00
class AssFile;
class AssStyle;
2006-01-16 22:02:54 +01:00
class AssOverrideParameter;
class DialogFontsCollector;
class wxZipOutputStream;
class ScintillaTextCtrl;
2006-01-16 22:02:54 +01:00
/// DOCME
/// @class FontsCollectorThread
/// @brief DOCME
///
/// DOCME
2006-01-16 22:02:54 +01:00
class FontsCollectorThread : public wxThread {
/// DOCME
2006-01-16 22:02:54 +01:00
AssFile *subs;
/// DOCME
AssStyle *curStyle;
/// DOCME
2006-01-16 22:02:54 +01:00
wxString destination;
/// DOCME
2006-01-16 22:02:54 +01:00
DialogFontsCollector *collector;
/// DOCME
wxZipOutputStream *zip;
/// DOCME
2006-01-16 22:02:54 +01:00
int curLine;
/// DOCME
wxString destFolder;
2006-01-16 22:02:54 +01:00
/// DOCME
2006-01-16 22:02:54 +01:00
static FontsCollectorThread *instance;
/// DOCME
2006-01-16 22:02:54 +01:00
wxArrayString fonts;
bool ProcessFont(wxString fontname);
int CopyFont(wxString filename);
bool ArchiveFont(wxString filename);
bool AttachFont(wxString filename);
2006-01-16 22:02:54 +01:00
void Collect();
void AddFont(wxString fontname,int mode);
2006-01-16 22:02:54 +01:00
void CollectFontData();
void AppendText(wxString text,int colour=0);
2006-01-16 22:02:54 +01:00
public:
FontsCollectorThread(AssFile *subs,wxString destination,DialogFontsCollector *collector);
wxThread::ExitCode Entry();
static void GetFonts (wxString tagName,int par_n,AssOverrideParameter *param,void *usr);
};
/// DOCME
/// @class DialogFontsCollector
/// @brief DOCME
///
/// DOCME
2006-01-16 22:02:54 +01:00
class DialogFontsCollector : public wxDialog {
friend class FontsCollectorThread;
AssFile *subs;
/// DOCME
2006-01-16 22:02:54 +01:00
wxTextCtrl *DestBox;
/// DOCME
ScintillaTextCtrl *LogBox;
/// DOCME
2006-01-16 22:02:54 +01:00
wxButton *BrowseButton;
/// DOCME
2006-01-16 22:02:54 +01:00
wxButton *StartButton;
/// DOCME
2006-01-16 22:02:54 +01:00
wxButton *CloseButton;
/// DOCME
wxStaticText *DestLabel;
/// DOCME
wxRadioBox *CollectAction;
2006-01-16 22:02:54 +01:00
void OnStart(wxCommandEvent &event);
void OnClose(wxCommandEvent &event);
void OnBrowse(wxCommandEvent &event);
void OnRadio(wxCommandEvent &event);
void OnAddText(wxCommandEvent &event);
void Update(int value=-1);
2006-01-16 22:02:54 +01:00
public:
DialogFontsCollector(wxWindow *parent, AssFile *subs);
2006-01-16 22:02:54 +01:00
~DialogFontsCollector();
DECLARE_EVENT_TABLE()
2006-01-16 22:02:54 +01:00
};
/// DOCME
struct ColourString {
/// DOCME
wxString text;
/// DOCME
int colour;
};