2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, 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.
|
|
|
|
//
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// AEGISUB
|
|
|
|
//
|
|
|
|
// Website: http://aegisub.cellosoft.com
|
|
|
|
// Contact: mailto:zeratul@cellosoft.com
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DIALOG_STYLE_MANAGER_H
|
|
|
|
#define DIALOG_STYLE_MANAGER_H
|
|
|
|
|
|
|
|
|
|
|
|
////////////
|
|
|
|
// Includes
|
|
|
|
#include <wx/wxprec.h>
|
|
|
|
#include <vector>
|
|
|
|
#include "ass_style_storage.h"
|
|
|
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
// Prototypes
|
|
|
|
class AssFile;
|
|
|
|
class AssStyle;
|
|
|
|
class SubtitlesGrid;
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////
|
|
|
|
// Manager Class
|
|
|
|
class DialogStyleManager : public wxDialog {
|
|
|
|
private:
|
|
|
|
std::vector<AssStyle*> styleMap;
|
|
|
|
std::vector<AssStyle*> styleStorageMap;
|
|
|
|
|
|
|
|
SubtitlesGrid *grid;
|
|
|
|
|
|
|
|
wxComboBox *CatalogList;
|
|
|
|
wxListBox *StorageList;
|
|
|
|
wxListBox *CurrentList;
|
|
|
|
wxButton *MoveToLocal;
|
|
|
|
wxButton *StorageNew;
|
2006-10-20 00:53:06 +02:00
|
|
|
wxButton *StorageEdit;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxButton *StorageCopy;
|
|
|
|
wxButton *StorageDelete;
|
2006-12-26 22:45:23 +01:00
|
|
|
wxButton *StorageMoveUp;
|
|
|
|
wxButton *StorageMoveDown;
|
|
|
|
wxButton *StorageMoveTop;
|
|
|
|
wxButton *StorageMoveBottom;
|
2006-12-26 23:28:44 +01:00
|
|
|
wxButton *StorageSort;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxButton *MoveToStorage;
|
|
|
|
wxButton *CurrentNew;
|
2006-10-20 00:53:06 +02:00
|
|
|
wxButton *CurrentEdit;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxButton *CurrentCopy;
|
|
|
|
wxButton *CurrentDelete;
|
2006-12-26 22:45:23 +01:00
|
|
|
wxButton *CurrentMoveUp;
|
|
|
|
wxButton *CurrentMoveDown;
|
|
|
|
wxButton *CurrentMoveTop;
|
|
|
|
wxButton *CurrentMoveBottom;
|
2006-12-26 23:28:44 +01:00
|
|
|
wxButton *CurrentSort;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
AssStyleStorage Store;
|
|
|
|
|
|
|
|
void StorageActions (bool state);
|
|
|
|
void LoadCatalog ();
|
|
|
|
void LoadCurrentStyles (AssFile *subs);
|
|
|
|
void LoadStorageStyles ();
|
2006-12-26 22:45:23 +01:00
|
|
|
void UpdateMoveButtons();
|
|
|
|
void MoveStyles(bool storage,int type);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
static int lastx, lasty;
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxSizer *MainSizer;
|
|
|
|
|
|
|
|
DialogStyleManager(wxWindow *parent,SubtitlesGrid *grid);
|
|
|
|
~DialogStyleManager();
|
|
|
|
|
|
|
|
void OnClose (wxCommandEvent &event);
|
|
|
|
void OnChangeCatalog (wxCommandEvent &event);
|
|
|
|
void OnCatalogNew (wxCommandEvent &event);
|
|
|
|
void OnCatalogDelete (wxCommandEvent &event);
|
|
|
|
void OnStorageEdit (wxCommandEvent &event);
|
|
|
|
void OnCurrentEdit (wxCommandEvent &event);
|
2006-12-26 22:45:23 +01:00
|
|
|
void OnCurrentMoveUp (wxCommandEvent &event);
|
|
|
|
void OnCurrentMoveDown (wxCommandEvent &event);
|
|
|
|
void OnCurrentMoveTop (wxCommandEvent &event);
|
|
|
|
void OnCurrentMoveBottom (wxCommandEvent &event);
|
2006-12-26 23:28:44 +01:00
|
|
|
void OnCurrentSort (wxCommandEvent &event);
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnStorageChange (wxCommandEvent &event);
|
|
|
|
void OnCurrentChange (wxCommandEvent &event);
|
|
|
|
void OnCopyToStorage (wxCommandEvent &event);
|
|
|
|
void OnCopyToCurrent (wxCommandEvent &event);
|
|
|
|
void OnStorageCopy (wxCommandEvent &event);
|
|
|
|
void OnCurrentCopy (wxCommandEvent &event);
|
|
|
|
void OnStorageNew (wxCommandEvent &event);
|
|
|
|
void OnCurrentNew (wxCommandEvent &event);
|
2006-12-26 22:45:23 +01:00
|
|
|
void OnStorageMoveUp (wxCommandEvent &event);
|
|
|
|
void OnStorageMoveDown (wxCommandEvent &event);
|
|
|
|
void OnStorageMoveTop (wxCommandEvent &event);
|
|
|
|
void OnStorageMoveBottom (wxCommandEvent &event);
|
2006-12-26 23:28:44 +01:00
|
|
|
void OnStorageSort (wxCommandEvent &event);
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnStorageDelete (wxCommandEvent &event);
|
|
|
|
void OnCurrentDelete (wxCommandEvent &event);
|
2006-12-26 05:48:53 +01:00
|
|
|
void OnCurrentImport (wxCommandEvent &event);
|
2007-02-05 20:09:45 +01:00
|
|
|
void OnKeyDown (wxKeyEvent &event);
|
2007-02-06 04:25:14 +01:00
|
|
|
void CopyToClipboard (wxListBox *list, std::vector<AssStyle*> v);
|
|
|
|
void PasteToCurrent();
|
|
|
|
void PasteToStorage();
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-01-19 11:33:56 +01:00
|
|
|
DECLARE_EVENT_TABLE()
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////
|
|
|
|
// IDs
|
|
|
|
enum {
|
|
|
|
BUTTON_CATALOG_NEW = 1000,
|
|
|
|
BUTTON_CATALOG_DELETE,
|
|
|
|
BUTTON_STORAGE_COPYTO,
|
|
|
|
BUTTON_STORAGE_NEW,
|
2006-10-20 00:53:06 +02:00
|
|
|
BUTTON_STORAGE_EDIT,
|
2006-01-16 22:02:54 +01:00
|
|
|
BUTTON_STORAGE_COPY,
|
|
|
|
BUTTON_STORAGE_DELETE,
|
2006-12-26 22:45:23 +01:00
|
|
|
BUTTON_STORAGE_UP,
|
|
|
|
BUTTON_STORAGE_DOWN,
|
|
|
|
BUTTON_STORAGE_TOP,
|
|
|
|
BUTTON_STORAGE_BOTTOM,
|
2006-12-26 23:28:44 +01:00
|
|
|
BUTTON_STORAGE_SORT,
|
2006-01-16 22:02:54 +01:00
|
|
|
BUTTON_CURRENT_COPYTO,
|
|
|
|
BUTTON_CURRENT_NEW,
|
2006-10-20 00:53:06 +02:00
|
|
|
BUTTON_CURRENT_EDIT,
|
2006-01-16 22:02:54 +01:00
|
|
|
BUTTON_CURRENT_COPY,
|
|
|
|
BUTTON_CURRENT_DELETE,
|
2006-12-26 05:48:53 +01:00
|
|
|
BUTTON_CURRENT_IMPORT,
|
2006-12-26 22:45:23 +01:00
|
|
|
BUTTON_CURRENT_UP,
|
|
|
|
BUTTON_CURRENT_DOWN,
|
|
|
|
BUTTON_CURRENT_TOP,
|
|
|
|
BUTTON_CURRENT_BOTTOM,
|
2006-12-26 23:28:44 +01:00
|
|
|
BUTTON_CURRENT_SORT,
|
2006-01-16 22:02:54 +01:00
|
|
|
LIST_CATALOG,
|
|
|
|
LIST_STORAGE,
|
|
|
|
LIST_CURRENT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-02-05 20:09:45 +01:00
|
|
|
/////////////////
|
|
|
|
// Event handler
|
|
|
|
class DialogStyleManagerEvent : public wxEvtHandler {
|
|
|
|
private:
|
|
|
|
DialogStyleManager *control;
|
|
|
|
void OnKeyDown(wxKeyEvent &event);
|
|
|
|
|
|
|
|
public:
|
|
|
|
DialogStyleManagerEvent(DialogStyleManager *control);
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#endif
|