diff --git a/aegisub/build/aegisub_vs2008/aegisub_vs2008.vcproj b/aegisub/build/aegisub_vs2008/aegisub_vs2008.vcproj
index 2ddc0eb31..73701e826 100644
--- a/aegisub/build/aegisub_vs2008/aegisub_vs2008.vcproj
+++ b/aegisub/build/aegisub_vs2008/aegisub_vs2008.vcproj
@@ -1099,6 +1099,14 @@
RelativePath="..\..\src\dialog_search_replace.h"
>
+
+
+
+
diff --git a/aegisub/src/Makefile.am b/aegisub/src/Makefile.am
index a2defeaa3..148130dda 100644
--- a/aegisub/src/Makefile.am
+++ b/aegisub/src/Makefile.am
@@ -224,6 +224,7 @@ aegisub_2_2_SOURCES = \
dialog_properties.cpp \
dialog_resample.cpp \
dialog_search_replace.cpp \
+ dialog_selected_choices.cpp \
dialog_selection.cpp \
dialog_shift_times.cpp \
dialog_spellchecker.cpp \
diff --git a/aegisub/src/dialog_selected_choices.cpp b/aegisub/src/dialog_selected_choices.cpp
new file mode 100644
index 000000000..cfda2006f
--- /dev/null
+++ b/aegisub/src/dialog_selected_choices.cpp
@@ -0,0 +1,76 @@
+// Copyright (c) 2010, Thomas Goyne
+// 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/
+//
+// $Id$
+
+/// @file dialog_selected_choices.cpp
+/// @brief wxMultiChoiceDialog with Select All and Select None
+/// @ingroup
+
+#include "dialog_selected_choices.h"
+
+#include
+
+SelectedChoicesDialog::SelectedChoicesDialog(wxWindow *parent, wxString const& message, wxString const& caption, wxArrayString const& choices) {
+ Create(parent, message, caption, choices);
+
+ wxButton *selAll = new wxButton(this, -1, _("Select All"));
+ wxButton *selNone = new wxButton(this, -1, _("Select None"));
+ Bind(wxEVT_COMMAND_BUTTON_CLICKED, &SelectedChoicesDialog::SelectAll, this, selAll->GetId());
+ Bind(wxEVT_COMMAND_BUTTON_CLICKED, &SelectedChoicesDialog::SelectNone, this, selNone->GetId());
+
+ wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
+ buttonSizer->Add(selAll, wxSizerFlags(0).Left());
+ buttonSizer->Add(selNone, wxSizerFlags(0).Right());
+
+ wxSizer *sizer = GetSizer();
+ sizer->Insert(2, buttonSizer, wxSizerFlags(0).Center());
+ sizer->Fit(this);
+}
+
+void SelectedChoicesDialog::SelectAll(wxCommandEvent&) {
+ wxArrayInt sel(m_listbox->GetCount(), 1);
+ sel[0] = 0;
+ std::partial_sum(sel.begin(), sel.end(), sel.begin());
+ SetSelections(sel);
+}
+
+void SelectedChoicesDialog::SelectNone(wxCommandEvent&) {
+ SetSelections(wxArrayInt());
+}
+
+int GetSelectedChoices(wxWindow *parent, wxArrayInt& selections, wxString const& message, wxString const& caption, wxArrayString const& choices) {
+ SelectedChoicesDialog dialog(parent, message, caption, choices);
+ dialog.SetSelections(selections);
+
+ if (dialog.ShowModal() != wxID_OK) return -1;
+
+ selections = dialog.GetSelections();
+ return selections.GetCount();
+}
diff --git a/aegisub/src/dialog_selected_choices.h b/aegisub/src/dialog_selected_choices.h
new file mode 100644
index 000000000..c6e3bd3ff
--- /dev/null
+++ b/aegisub/src/dialog_selected_choices.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2010, Thomas Goyne
+// 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/
+//
+// $Id$
+
+/// @file dialog_selected_choices.cpp
+/// @brief wxMultiChoiceDialog with Select All and Select None
+/// @ingroup
+
+#ifndef AGI_PRE
+#include
+#endif
+
+/// @class SelectedChoicesDialog
+/// @brief wxMultiChoiceDialog with Select All and Select None
+class SelectedChoicesDialog : public wxMultiChoiceDialog {
+ SelectedChoicesDialog(SelectedChoicesDialog const&);
+ SelectedChoicesDialog& operator=(SelectedChoicesDialog const&);
+
+ void SelectAll(wxCommandEvent&);
+ void SelectNone(wxCommandEvent&);
+
+public:
+ SelectedChoicesDialog(wxWindow *parent, wxString const& message, wxString const& caption, wxArrayString const& choices);
+};
+
+int GetSelectedChoices(wxWindow *parent, wxArrayInt& selections, wxString const& message, wxString const& caption, wxArrayString const& choices);
diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp
index 0d62292f2..38b2757ee 100644
--- a/aegisub/src/dialog_style_manager.cpp
+++ b/aegisub/src/dialog_style_manager.cpp
@@ -48,6 +48,7 @@
#include "ass_file.h"
#include "ass_style.h"
#include "compat.h"
+#include "dialog_selected_choices.h"
#include "dialog_style_editor.h"
#include "dialog_style_manager.h"
#include "help_button.h"
@@ -852,7 +853,7 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
// Get selection
wxArrayInt selections;
- int res = wxGetSelectedChoices(selections,_("Choose styles to import:"),_("Import Styles"),styles);
+ int res = GetSelectedChoices(this,selections,_("Choose styles to import:"),_("Import Styles"),styles);
if (res == -1 || selections.Count() == 0) return;
bool modified = false;