2006-12-17 20:41:52 +01: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-12-17 20:41:52 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_paste_over.cpp
|
|
|
|
/// @brief Paste Over set-up dialogue box
|
|
|
|
/// @ingroup secondary_ui
|
|
|
|
///
|
2006-12-17 20:41:52 +01:00
|
|
|
|
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-12-17 20:41:52 +01:00
|
|
|
#include <wx/config.h>
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/sizer.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#include <wx/stattext.h>
|
|
|
|
#endif
|
|
|
|
|
2006-12-17 20:41:52 +01:00
|
|
|
#include "dialog_paste_over.h"
|
2008-01-14 00:34:38 +01:00
|
|
|
#include "help_button.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "main.h"
|
2006-12-17 20:41:52 +01:00
|
|
|
|
2010-06-22 02:03:16 +02:00
|
|
|
/// Button IDs
|
|
|
|
enum {
|
|
|
|
Paste_Over_Times = 1620,
|
|
|
|
Paste_Over_Text,
|
|
|
|
Paste_Over_All,
|
|
|
|
Paste_Over_None
|
|
|
|
};
|
|
|
|
|
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-06-22 02:03:16 +02:00
|
|
|
DialogPasteOver::DialogPasteOver (wxWindow *parent, std::vector<bool>& options)
|
2006-12-17 20:41:52 +01:00
|
|
|
: wxDialog (parent,-1,_("Select Fields to Paste Over"),wxDefaultPosition,wxDefaultSize)
|
2010-06-22 02:03:16 +02:00
|
|
|
, options(options)
|
2006-12-17 20:41:52 +01:00
|
|
|
{
|
2007-01-05 19:27:15 +01:00
|
|
|
// Script mode
|
|
|
|
int mode = 1; // ASS
|
|
|
|
|
2007-09-24 19:40:03 +02:00
|
|
|
// Label and list sizer
|
|
|
|
wxSizer *ListSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Fields"));
|
|
|
|
wxStaticText *label = new wxStaticText(this,-1,_("Please select the fields that you want to paste over:"),wxDefaultPosition,wxDefaultSize);
|
|
|
|
ListSizer->Add(label,0,wxEXPAND,0);
|
|
|
|
|
2006-12-17 20:41:52 +01:00
|
|
|
// List box
|
|
|
|
wxArrayString choices;
|
2007-07-05 17:23:31 +02:00
|
|
|
choices.Add(_("Layer"));
|
|
|
|
choices.Add(_("Start Time"));
|
|
|
|
choices.Add(_("End Time"));
|
|
|
|
choices.Add(_("Style"));
|
|
|
|
choices.Add(_("Actor"));
|
|
|
|
choices.Add(_("Margin Left"));
|
|
|
|
choices.Add(_("Margin Right"));
|
2007-01-05 19:27:15 +01:00
|
|
|
if (mode == 1) {
|
2007-07-05 17:23:31 +02:00
|
|
|
choices.Add(_("Margin Vertical"));
|
2007-01-05 19:27:15 +01:00
|
|
|
}
|
|
|
|
else {
|
2007-07-05 17:23:31 +02:00
|
|
|
choices.Add(_("Margin Top"));
|
|
|
|
choices.Add(_("Margin Bottom"));
|
2007-01-05 19:27:15 +01:00
|
|
|
}
|
2007-07-05 17:23:31 +02:00
|
|
|
choices.Add(_("Effect"));
|
|
|
|
choices.Add(_("Text"));
|
2006-12-17 20:41:52 +01:00
|
|
|
ListBox = new wxCheckListBox(this,-1,wxDefaultPosition,wxSize(250,170), choices);
|
2007-09-24 19:40:03 +02:00
|
|
|
ListSizer->Add(ListBox,0,wxEXPAND|wxTOP,5);
|
2006-12-17 20:41:52 +01:00
|
|
|
|
|
|
|
// Load checked items
|
2010-05-21 03:13:36 +02:00
|
|
|
/// @todo This assumes a static set of fields.
|
2011-11-04 20:42:31 +01:00
|
|
|
options = OPT_GET("Tool/Paste Lines Over/Fields")->GetListBool();
|
2010-06-22 02:03:16 +02:00
|
|
|
for (unsigned int i=0;i<choices.Count();i++) ListBox->Check(i,options[i]);
|
2006-12-17 20:41:52 +01:00
|
|
|
|
|
|
|
// Top buttons
|
|
|
|
wxSizer *TopButtonSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-11-18 19:49:09 +01:00
|
|
|
TopButtonSizer->Add(new wxButton(this, Paste_Over_All, _("&All")),1,0,0);
|
|
|
|
TopButtonSizer->Add(new wxButton(this, Paste_Over_None, _("&None")),1,0,0);
|
|
|
|
TopButtonSizer->Add(new wxButton(this, Paste_Over_Times, _("&Times")),1,0,0);
|
|
|
|
TopButtonSizer->Add(new wxButton(this, Paste_Over_Text, _("T&ext")),1,0,0);
|
2006-12-17 20:41:52 +01:00
|
|
|
|
|
|
|
// Buttons
|
2008-01-14 00:34:38 +01:00
|
|
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
|
|
|
ButtonSizer->AddButton(new wxButton(this, wxID_OK));
|
|
|
|
ButtonSizer->AddButton(new wxButton(this, wxID_CANCEL));
|
2011-09-28 21:43:11 +02:00
|
|
|
ButtonSizer->AddButton(new HelpButton(this,"Paste Over"));
|
2008-01-14 00:34:38 +01:00
|
|
|
ButtonSizer->Realize();
|
2006-12-17 20:41:52 +01:00
|
|
|
|
|
|
|
// Main sizer
|
|
|
|
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
MainSizer->Add(ListSizer,0,wxEXPAND | wxLEFT | wxRIGHT,5);
|
|
|
|
MainSizer->Add(TopButtonSizer,0,wxLEFT | wxRIGHT | wxEXPAND,5);
|
|
|
|
MainSizer->Add(ButtonSizer,0,wxALL | wxEXPAND,5);
|
|
|
|
SetSizer(MainSizer);
|
|
|
|
MainSizer->SetSizeHints(this);
|
|
|
|
Center();
|
|
|
|
}
|
|
|
|
|
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-12-17 20:41:52 +01:00
|
|
|
DialogPasteOver::~DialogPasteOver() {
|
|
|
|
}
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(DialogPasteOver, wxDialog)
|
|
|
|
EVT_BUTTON(wxID_OK,DialogPasteOver::OnOK)
|
|
|
|
EVT_BUTTON(wxID_CANCEL,DialogPasteOver::OnCancel)
|
|
|
|
EVT_BUTTON(Paste_Over_All,DialogPasteOver::OnAll)
|
|
|
|
EVT_BUTTON(Paste_Over_None,DialogPasteOver::OnNone)
|
|
|
|
EVT_BUTTON(Paste_Over_Text,DialogPasteOver::OnText)
|
|
|
|
EVT_BUTTON(Paste_Over_Times,DialogPasteOver::OnTimes)
|
|
|
|
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 OK pressed
|
2010-06-22 02:03:16 +02:00
|
|
|
void DialogPasteOver::OnOK(wxCommandEvent &) {
|
2007-03-28 03:37:13 +02:00
|
|
|
for (int i=0;i<10;i++) {
|
2010-06-22 02:03:16 +02:00
|
|
|
options[i] = ListBox->IsChecked(i);
|
2006-12-17 20:41:52 +01:00
|
|
|
}
|
2010-06-22 02:03:16 +02:00
|
|
|
OPT_SET("Tool/Paste Lines Over/Fields")->SetListBool(options);
|
2006-12-17 20:41:52 +01:00
|
|
|
|
|
|
|
EndModal(1);
|
|
|
|
}
|
|
|
|
|
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 Cancel pressed
|
2010-06-22 02:03:16 +02:00
|
|
|
void DialogPasteOver::OnCancel(wxCommandEvent &) {
|
2006-12-17 20:41:52 +01:00
|
|
|
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 Select Text
|
2010-06-22 02:03:16 +02:00
|
|
|
void DialogPasteOver::OnText(wxCommandEvent &) {
|
2007-03-14 17:39:45 +01:00
|
|
|
for (int i=0;i<9;i++) ListBox->Check(i,false);
|
|
|
|
ListBox->Check(9,true);
|
2006-12-17 20:41:52 +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 Select Times
|
2010-06-22 02:03:16 +02:00
|
|
|
void DialogPasteOver::OnTimes(wxCommandEvent &) {
|
2007-03-14 17:39:45 +01:00
|
|
|
for (int i=0;i<10;i++) ListBox->Check(i,false);
|
2006-12-17 20:41:52 +01:00
|
|
|
ListBox->Check(1,true);
|
|
|
|
ListBox->Check(2,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 Select All
|
2010-06-22 02:03:16 +02:00
|
|
|
void DialogPasteOver::OnAll(wxCommandEvent &) {
|
2007-03-14 17:39:45 +01:00
|
|
|
for (int i=0;i<10;i++) ListBox->Check(i,true);
|
2006-12-17 20:41:52 +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 Select None
|
2010-06-22 02:03:16 +02:00
|
|
|
void DialogPasteOver::OnNone(wxCommandEvent &) {
|
2007-03-14 17:39:45 +01:00
|
|
|
for (int i=0;i<10;i++) ListBox->Check(i,false);
|
2006-12-17 20:41:52 +01:00
|
|
|
}
|