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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file dialog_style_manager.h
|
|
|
|
/// @see dialog_style_manager.cpp
|
|
|
|
/// @ingroup style_editor
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2013-07-08 23:43:43 +02:00
|
|
|
#include <future>
|
2013-06-10 15:58:13 +02:00
|
|
|
#include <memory>
|
2009-09-11 04:36:34 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <wx/button.h>
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/combobox.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
#include <wx/dialog.h>
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/listbox.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
|
2012-03-08 05:17:36 +01:00
|
|
|
#include <libaegisub/signal.h>
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "ass_style_storage.h"
|
|
|
|
|
2011-01-16 08:17:36 +01:00
|
|
|
namespace agi { struct Context; }
|
2012-03-08 05:17:42 +01:00
|
|
|
class AssDialogue;
|
2006-01-16 22:02:54 +01:00
|
|
|
class AssFile;
|
|
|
|
class AssStyle;
|
2012-03-08 05:17:36 +01:00
|
|
|
class DialogStyleEditor;
|
2011-07-27 07:36:24 +02:00
|
|
|
class PersistLocation;
|
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
|
|
|
|
2012-10-05 05:22:54 +02:00
|
|
|
class DialogStyleManager : public wxDialog {
|
2012-02-01 01:48:50 +01:00
|
|
|
agi::Context *c; ///< Project context
|
2013-06-10 15:58:13 +02:00
|
|
|
std::unique_ptr<PersistLocation> persist;
|
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
|
|
|
|
2012-03-08 05:17:36 +01:00
|
|
|
agi::signal::Connection commit_connection;
|
2012-10-05 05:22:54 +02:00
|
|
|
agi::signal::Connection active_line_connection;
|
2012-03-08 05:17:36 +01:00
|
|
|
|
2013-07-08 23:43:43 +02:00
|
|
|
std::shared_future<wxArrayString> font_list;
|
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
/// Styles in the current subtitle file
|
2006-01-16 22:02:54 +01:00
|
|
|
std::vector<AssStyle*> styleMap;
|
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
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
/// Style storage manager
|
|
|
|
AssStyleStorage Store;
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
wxComboBox *CatalogList;
|
|
|
|
wxListBox *StorageList;
|
|
|
|
wxListBox *CurrentList;
|
2012-02-01 01:48:50 +01:00
|
|
|
|
2012-03-08 05:17:17 +01:00
|
|
|
wxButton *CatalogDelete;
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
wxButton *MoveToLocal;
|
2012-02-01 01:48:50 +01:00
|
|
|
wxButton *MoveToStorage;
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
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;
|
2012-02-01 01:48:50 +01:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
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
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
/// Load the list of available storages
|
|
|
|
void LoadCatalog();
|
|
|
|
/// Load the style list from the subtitles file
|
2012-03-08 05:17:36 +01:00
|
|
|
void LoadCurrentStyles(int commit_type);
|
2012-02-01 01:48:50 +01:00
|
|
|
/// Enable/disable all of the buttons as appropriate
|
|
|
|
void UpdateButtons();
|
|
|
|
/// Move styles up or down
|
|
|
|
/// @param storage Storage or current file styles
|
|
|
|
/// @param type 0: up; 1: top; 2: down; 3: bottom; 4: sort
|
|
|
|
void MoveStyles(bool storage, int type);
|
|
|
|
|
2012-03-08 05:17:36 +01:00
|
|
|
/// Open the style editor for the given style on the script
|
2012-11-13 17:51:01 +01:00
|
|
|
/// @param style Style to edit, or nullptr for new
|
2012-03-08 05:17:36 +01:00
|
|
|
/// @param new_name Default new name for copies
|
2012-12-30 01:32:36 +01:00
|
|
|
void ShowCurrentEditor(AssStyle *style, std::string const& new_name = "");
|
2012-03-08 05:17:36 +01:00
|
|
|
|
|
|
|
/// Open the style editor for the given style in the storage
|
2012-11-13 17:51:01 +01:00
|
|
|
/// @param style Style to edit, or nullptr for new
|
2012-03-08 05:17:36 +01:00
|
|
|
/// @param new_name Default new name for copies
|
2012-12-30 01:32:36 +01:00
|
|
|
void ShowStorageEditor(AssStyle *style, std::string const& new_name = "");
|
2012-03-08 05:17:36 +01:00
|
|
|
|
2012-03-08 05:17:29 +01:00
|
|
|
/// Save the storage and update the view after a change
|
|
|
|
void UpdateStorage();
|
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
void OnChangeCatalog();
|
|
|
|
void OnCatalogNew();
|
|
|
|
void OnCatalogDelete();
|
2012-03-08 05:17:42 +01:00
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
void OnCopyToCurrent();
|
2012-03-08 05:17:42 +01:00
|
|
|
void OnCopyToStorage();
|
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
void OnCurrentCopy();
|
|
|
|
void OnCurrentDelete();
|
2012-03-08 05:17:42 +01:00
|
|
|
void OnCurrentEdit();
|
2012-02-01 01:48:50 +01:00
|
|
|
void OnCurrentImport();
|
2012-03-08 05:17:42 +01:00
|
|
|
void OnCurrentNew();
|
|
|
|
|
|
|
|
void OnStorageCopy();
|
|
|
|
void OnStorageDelete();
|
|
|
|
void OnStorageEdit();
|
|
|
|
void OnStorageNew();
|
|
|
|
|
2012-02-01 01:48:50 +01:00
|
|
|
void OnKeyDown(wxKeyEvent &event);
|
2007-02-06 04:25:14 +01:00
|
|
|
void PasteToCurrent();
|
|
|
|
void PasteToStorage();
|
|
|
|
|
2012-03-08 05:17:29 +01:00
|
|
|
template<class T>
|
|
|
|
void CopyToClipboard(wxListBox *list, T const& v);
|
|
|
|
|
2012-03-08 05:17:42 +01:00
|
|
|
void OnActiveLineChanged(AssDialogue *new_line);
|
|
|
|
|
2011-01-16 08:17:36 +01:00
|
|
|
public:
|
|
|
|
DialogStyleManager(agi::Context *context);
|
|
|
|
~DialogStyleManager();
|
2007-02-05 20:09:45 +01:00
|
|
|
};
|