forked from mia/Aegisub
Modernize DialogTextImport
Originally committed to SVN as r6309.
This commit is contained in:
parent
b36c70ca7d
commit
e40e42ff1c
2 changed files with 15 additions and 47 deletions
|
@ -36,30 +36,25 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "dialog_text_import.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
#include <wx/textctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "dialog_text_import.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
enum {
|
|
||||||
EDIT_ACTOR_SEPARATOR = 1480,
|
|
||||||
EDIT_COMMENT_STARTER
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @brief Constructor
|
|
||||||
///
|
|
||||||
DialogTextImport::DialogTextImport()
|
DialogTextImport::DialogTextImport()
|
||||||
: wxDialog(NULL , -1, _("Text import options"),wxDefaultPosition,wxDefaultSize)
|
: wxDialog(NULL , -1, _("Text import options"))
|
||||||
{
|
{
|
||||||
// Main controls
|
// Main controls
|
||||||
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5);
|
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5);
|
||||||
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
edit_separator = new wxTextCtrl(this, EDIT_ACTOR_SEPARATOR, lagi_wxString(OPT_GET("Tool/Import/Text/Actor Separator")->GetString()));
|
edit_separator = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Import/Text/Actor Separator")->GetString()));
|
||||||
edit_comment = new wxTextCtrl(this, EDIT_COMMENT_STARTER, lagi_wxString(OPT_GET("Tool/Import/Text/Comment Starter")->GetString()));
|
edit_comment = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Import/Text/Comment Starter")->GetString()));
|
||||||
|
|
||||||
// Dialog layout
|
// Dialog layout
|
||||||
fg->Add(new wxStaticText(this, -1, _("Actor separator:")), 0, wxALIGN_CENTRE_VERTICAL);
|
fg->Add(new wxStaticText(this, -1, _("Actor separator:")), 0, wxALIGN_CENTRE_VERTICAL);
|
||||||
|
@ -69,32 +64,14 @@ DialogTextImport::DialogTextImport()
|
||||||
|
|
||||||
main_sizer->Add(fg, 1, wxALL|wxEXPAND, 5);
|
main_sizer->Add(fg, 1, wxALL|wxEXPAND, 5);
|
||||||
main_sizer->Add(CreateSeparatedButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
|
main_sizer->Add(CreateSeparatedButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
|
||||||
main_sizer->SetSizeHints(this);
|
SetSizerAndFit(main_sizer);
|
||||||
SetSizer(main_sizer);
|
|
||||||
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogTextImport::OnOK, this, wxID_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogTextImport::OnOK(wxCommandEvent &) {
|
||||||
/// @brief Destructor
|
|
||||||
///
|
|
||||||
DialogTextImport::~DialogTextImport()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogTextImport::OnOK(wxCommandEvent &)
|
|
||||||
{
|
|
||||||
// Set options
|
|
||||||
OPT_SET("Tool/Import/Text/Actor Separator")->SetString(STD_STR(edit_separator->GetValue()));
|
OPT_SET("Tool/Import/Text/Actor Separator")->SetString(STD_STR(edit_separator->GetValue()));
|
||||||
OPT_SET("Tool/Import/Text/Comment Starter")->SetString(STD_STR(edit_comment->GetValue()));
|
OPT_SET("Tool/Import/Text/Comment Starter")->SetString(STD_STR(edit_comment->GetValue()));
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////
|
|
||||||
// Event table
|
|
||||||
BEGIN_EVENT_TABLE(DialogTextImport,wxDialog)
|
|
||||||
EVT_BUTTON(wxID_OK,DialogTextImport::OnOK)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
|
@ -36,30 +36,21 @@
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/textctrl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class wxTextCtrl;
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class DialogTextImport
|
/// @class DialogTextImport
|
||||||
/// @brief DOCME
|
/// @brief Plain text import separator character selection dialog
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// A simple dialog to let the user select the format of a plain text file
|
||||||
|
/// being imported into Aegisub
|
||||||
class DialogTextImport : public wxDialog {
|
class DialogTextImport : public wxDialog {
|
||||||
private:
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxTextCtrl *edit_separator;
|
wxTextCtrl *edit_separator;
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxTextCtrl *edit_comment;
|
wxTextCtrl *edit_comment;
|
||||||
|
|
||||||
void OnOK(wxCommandEvent &event);
|
void OnOK(wxCommandEvent &);
|
||||||
void OnCancel(wxCommandEvent &event);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogTextImport();
|
DialogTextImport();
|
||||||
virtual ~DialogTextImport();
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue