1
// Copyright (c) 2006, Rodrigo Braz Monteiro
2
// All rights reserved.
4
// Redistribution and use in source and binary forms, with or without
5
// modification, are permitted provided that the following conditions are met:
7
// * Redistributions of source code must retain the above copyright notice,
8
// this list of conditions and the following disclaimer.
9
// * Redistributions in binary form must reproduce the above copyright notice,
10
// this list of conditions and the following disclaimer in the documentation
11
// and/or other materials provided with the distribution.
12
// * Neither the name of the Aegisub Group nor the names of its contributors
13
// may be used to endorse or promote products derived from this software
14
// without specific prior written permission.
16
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
// POSSIBILITY OF SUCH DAMAGE.
28
// -----------------------------------------------------------------------------
32
// Website: http://aegisub.cellosoft.com
33
// Contact: mailto:zeratul@cellosoft.com
41
#include <wx/config.h>
42
#include <wx/stattext.h>
44
#include <wx/button.h>
45
#include "dialog_paste_over.h"
47
#include "help_button.h"
52
DialogPasteOver::DialogPasteOver (wxWindow *parent)
53
: wxDialog (parent,-1,_("Select Fields to Paste Over"),wxDefaultPosition,wxDefaultSize)
58
// Label and list sizer
59
wxSizer *ListSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Fields"));
60
wxStaticText *label = new wxStaticText(this,-1,_("Please select the fields that you want to paste over:"),wxDefaultPosition,wxDefaultSize);
61
ListSizer->Add(label,0,wxEXPAND,0);
64
wxArrayString choices;
65
choices.Add(_("Layer"));
66
choices.Add(_("Start Time"));
67
choices.Add(_("End Time"));
68
choices.Add(_("Style"));
69
choices.Add(_("Actor"));
70
choices.Add(_("Margin Left"));
71
choices.Add(_("Margin Right"));
73
choices.Add(_("Margin Vertical"));
76
choices.Add(_("Margin Top"));
77
choices.Add(_("Margin Bottom"));
79
choices.Add(_("Effect"));
80
choices.Add(_("Text"));
81
ListBox = new wxCheckListBox(this,-1,wxDefaultPosition,wxSize(250,170), choices);
82
ListSizer->Add(ListBox,0,wxEXPAND|wxTOP,5);
85
for (unsigned int i=0;i<choices.Count();i++) ListBox->Check(i,Options.AsBool(wxString::Format(_T("Paste Over #%i"),i)));
88
wxSizer *TopButtonSizer = new wxBoxSizer(wxHORIZONTAL);
89
TopButtonSizer->Add(new wxButton(this, Paste_Over_All, _("All")),1,0,0);
90
TopButtonSizer->Add(new wxButton(this, Paste_Over_None, _("None")),1,0,0);
91
TopButtonSizer->Add(new wxButton(this, Paste_Over_Times, _("Times")),1,0,0);
92
TopButtonSizer->Add(new wxButton(this, Paste_Over_Text, _("Text")),1,0,0);
95
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
96
ButtonSizer->AddButton(new wxButton(this, wxID_OK));
97
ButtonSizer->AddButton(new wxButton(this, wxID_CANCEL));
98
ButtonSizer->AddButton(new HelpButton(this,_T("Paste Over")));
99
ButtonSizer->Realize();
102
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
103
MainSizer->Add(ListSizer,0,wxEXPAND | wxLEFT | wxRIGHT,5);
104
MainSizer->Add(TopButtonSizer,0,wxLEFT | wxRIGHT | wxEXPAND,5);
105
MainSizer->Add(ButtonSizer,0,wxALL | wxEXPAND,5);
107
MainSizer->SetSizeHints(this);
115
DialogPasteOver::~DialogPasteOver() {
121
BEGIN_EVENT_TABLE(DialogPasteOver, wxDialog)
122
EVT_BUTTON(wxID_OK,DialogPasteOver::OnOK)
123
EVT_BUTTON(wxID_CANCEL,DialogPasteOver::OnCancel)
124
EVT_BUTTON(Paste_Over_All,DialogPasteOver::OnAll)
125
EVT_BUTTON(Paste_Over_None,DialogPasteOver::OnNone)
126
EVT_BUTTON(Paste_Over_Text,DialogPasteOver::OnText)
127
EVT_BUTTON(Paste_Over_Times,DialogPasteOver::OnTimes)
133
void DialogPasteOver::OnOK(wxCommandEvent &event) {
135
options.SetCount(10);
136
for (int i=0;i<10;i++) {
137
options[i] = ListBox->IsChecked(i) ? 1 : 0;
138
Options.SetBool(wxString::Format(_T("Paste Over #%i"),i),options[i]==1);
149
void DialogPasteOver::OnCancel(wxCommandEvent &event) {
156
void DialogPasteOver::OnText(wxCommandEvent &event) {
157
for (int i=0;i<9;i++) ListBox->Check(i,false);
158
ListBox->Check(9,true);
164
void DialogPasteOver::OnTimes(wxCommandEvent &event) {
165
for (int i=0;i<10;i++) ListBox->Check(i,false);
166
ListBox->Check(1,true);
167
ListBox->Check(2,true);
173
void DialogPasteOver::OnAll(wxCommandEvent &event) {
174
for (int i=0;i<10;i++) ListBox->Check(i,true);
180
void DialogPasteOver::OnNone(wxCommandEvent &event) {
181
for (int i=0;i<10;i++) ListBox->Check(i,false);
187
wxArrayInt DialogPasteOver::GetOptions() {