forked from mia/Aegisub
Styles editor seems totally finished, although it will probably still conflict on temporary subs filename.
Originally committed to SVN as r1083.
This commit is contained in:
parent
94260f649d
commit
9f58957fd9
|
@ -60,6 +60,7 @@ enum {
|
||||||
CHECKBOX_STYLE_ITALIC,
|
CHECKBOX_STYLE_ITALIC,
|
||||||
CHECKBOX_STYLE_UNDERLINE,
|
CHECKBOX_STYLE_UNDERLINE,
|
||||||
CHECKBOX_STYLE_STRIKEOUT,
|
CHECKBOX_STYLE_STRIKEOUT,
|
||||||
|
CHECKBOX_OUTLINE,
|
||||||
BUTTON_COLOR_1,
|
BUTTON_COLOR_1,
|
||||||
BUTTON_COLOR_2,
|
BUTTON_COLOR_2,
|
||||||
BUTTON_COLOR_3,
|
BUTTON_COLOR_3,
|
||||||
|
@ -80,7 +81,8 @@ enum {
|
||||||
TEXT_SCALE_Y,
|
TEXT_SCALE_Y,
|
||||||
TEXT_ANGLE,
|
TEXT_ANGLE,
|
||||||
TEXT_SPACING,
|
TEXT_SPACING,
|
||||||
TEXT_PREVIEW
|
TEXT_PREVIEW,
|
||||||
|
COMBO_ENCODING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,12 +142,12 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
||||||
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
|
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
|
||||||
Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&OutlineValue));
|
Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&OutlineValue));
|
||||||
Shadow = new wxTextCtrl(this,TEXT_SHADOW,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&ShadowValue));
|
Shadow = new wxTextCtrl(this,TEXT_SHADOW,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&ShadowValue));
|
||||||
OutlineType = new wxCheckBox(this,-1,_("Opaque box"));
|
OutlineType = new wxCheckBox(this,CHECKBOX_OUTLINE,_("Opaque box"));
|
||||||
ScaleX = new wxTextCtrl(this,TEXT_SCALE_X,_T(""),wxDefaultPosition, wxSize(70,20),0,wxTextValidator(wxFILTER_NUMERIC,&ScaleXValue));
|
ScaleX = new wxTextCtrl(this,TEXT_SCALE_X,_T(""),wxDefaultPosition, wxSize(70,20),0,wxTextValidator(wxFILTER_NUMERIC,&ScaleXValue));
|
||||||
ScaleY = new wxTextCtrl(this,TEXT_SCALE_Y,_T(""),wxDefaultPosition, wxSize(70,20),0,wxTextValidator(wxFILTER_NUMERIC,&ScaleYValue));
|
ScaleY = new wxTextCtrl(this,TEXT_SCALE_Y,_T(""),wxDefaultPosition, wxSize(70,20),0,wxTextValidator(wxFILTER_NUMERIC,&ScaleYValue));
|
||||||
Angle = new wxTextCtrl(this,TEXT_ANGLE,_T(""),wxDefaultPosition, wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&AngleValue));
|
Angle = new wxTextCtrl(this,TEXT_ANGLE,_T(""),wxDefaultPosition, wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&AngleValue));
|
||||||
Spacing = new wxTextCtrl(this,TEXT_SPACING,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&SpacingValue));
|
Spacing = new wxTextCtrl(this,TEXT_SPACING,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&SpacingValue));
|
||||||
Encoding = new wxComboBox(this,-1,_T(""),wxDefaultPosition, wxDefaultSize, encodingStrings,wxCB_READONLY);
|
Encoding = new wxComboBox(this,COMBO_ENCODING,_T(""),wxDefaultPosition, wxDefaultSize, encodingStrings,wxCB_READONLY);
|
||||||
SubsPreview = new SubtitlesPreview(this,-1,wxDefaultPosition,wxSize(100,60),wxSUNKEN_BORDER);
|
SubsPreview = new SubtitlesPreview(this,-1,wxDefaultPosition,wxSize(100,60),wxSUNKEN_BORDER);
|
||||||
PreviewText = NULL; // Yes, this IS necessary
|
PreviewText = NULL; // Yes, this IS necessary
|
||||||
PreviewText = new wxTextCtrl(this,TEXT_PREVIEW,Options.AsText(_T("Style editor preview text")));
|
PreviewText = new wxTextCtrl(this,TEXT_PREVIEW,Options.AsText(_T("Style editor preview text")));
|
||||||
|
@ -366,8 +368,15 @@ BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
||||||
EVT_BUTTON(BUTTON_COLOR_2, DialogStyleEditor::OnSetColor2)
|
EVT_BUTTON(BUTTON_COLOR_2, DialogStyleEditor::OnSetColor2)
|
||||||
EVT_BUTTON(BUTTON_COLOR_3, DialogStyleEditor::OnSetColor3)
|
EVT_BUTTON(BUTTON_COLOR_3, DialogStyleEditor::OnSetColor3)
|
||||||
EVT_BUTTON(BUTTON_COLOR_4, DialogStyleEditor::OnSetColor4)
|
EVT_BUTTON(BUTTON_COLOR_4, DialogStyleEditor::OnSetColor4)
|
||||||
|
|
||||||
EVT_CHILD_FOCUS(DialogStyleEditor::OnChildFocus)
|
EVT_CHILD_FOCUS(DialogStyleEditor::OnChildFocus)
|
||||||
EVT_TEXT(TEXT_PREVIEW, DialogStyleEditor::OnPreviewTextChange)
|
EVT_TEXT(TEXT_PREVIEW, DialogStyleEditor::OnPreviewTextChange)
|
||||||
|
EVT_CHECKBOX(CHECKBOX_STYLE_BOLD, DialogStyleEditor::OnCommandPreviewUpdate)
|
||||||
|
EVT_CHECKBOX(CHECKBOX_STYLE_ITALIC, DialogStyleEditor::OnCommandPreviewUpdate)
|
||||||
|
EVT_CHECKBOX(CHECKBOX_STYLE_UNDERLINE, DialogStyleEditor::OnCommandPreviewUpdate)
|
||||||
|
EVT_CHECKBOX(CHECKBOX_STYLE_STRIKEOUT, DialogStyleEditor::OnCommandPreviewUpdate)
|
||||||
|
EVT_CHECKBOX(CHECKBOX_OUTLINE, DialogStyleEditor::OnCommandPreviewUpdate)
|
||||||
|
EVT_COMBOBOX(COMBO_ENCODING, DialogStyleEditor::OnCommandPreviewUpdate)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@ -550,6 +559,8 @@ void DialogStyleEditor::OnChooseFont (wxCommandEvent &event) {
|
||||||
work->bold = (newfont.GetWeight() == wxFONTWEIGHT_BOLD);
|
work->bold = (newfont.GetWeight() == wxFONTWEIGHT_BOLD);
|
||||||
work->italic = (newfont.GetStyle() == wxFONTSTYLE_ITALIC);
|
work->italic = (newfont.GetStyle() == wxFONTSTYLE_ITALIC);
|
||||||
work->underline = newfont.GetUnderlined();
|
work->underline = newfont.GetUnderlined();
|
||||||
|
UpdateWorkStyle();
|
||||||
|
SubsPreview->SetStyle(work);
|
||||||
|
|
||||||
// Comic sans warning
|
// Comic sans warning
|
||||||
if (newfont.GetFaceName() == _T("Comic Sans MS")) {
|
if (newfont.GetFaceName() == _T("Comic Sans MS")) {
|
||||||
|
@ -594,6 +605,15 @@ void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// Command event to update preview
|
||||||
|
void DialogStyleEditor::OnCommandPreviewUpdate (wxCommandEvent &event) {
|
||||||
|
UpdateWorkStyle();
|
||||||
|
SubsPreview->SetStyle(work);
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Converts control value to alignment
|
// Converts control value to alignment
|
||||||
int DialogStyleEditor::ControlToAlign (int n) {
|
int DialogStyleEditor::ControlToAlign (int n) {
|
||||||
|
|
|
@ -118,6 +118,7 @@ private:
|
||||||
void OnSetColor3 (wxCommandEvent &event);
|
void OnSetColor3 (wxCommandEvent &event);
|
||||||
void OnSetColor4 (wxCommandEvent &event);
|
void OnSetColor4 (wxCommandEvent &event);
|
||||||
void OnChildFocus (wxChildFocusEvent &event);
|
void OnChildFocus (wxChildFocusEvent &event);
|
||||||
|
void OnCommandPreviewUpdate (wxCommandEvent &event);
|
||||||
void OnPreviewTextChange (wxCommandEvent &event);
|
void OnPreviewTextChange (wxCommandEvent &event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -343,7 +343,7 @@ void OptionsManager::LoadDefaults() {
|
||||||
|
|
||||||
SetBool(_T("kanji timer interpolation"),true);
|
SetBool(_T("kanji timer interpolation"),true);
|
||||||
|
|
||||||
wxString previewText = _T("Aegisub 0123 ");
|
wxString previewText = _T("Aegisub\N0123 ");
|
||||||
previewText += 0x6708;
|
previewText += 0x6708;
|
||||||
previewText += 0x8a9e;
|
previewText += 0x8a9e;
|
||||||
SetText(_T("Style editor preview text"),previewText);
|
SetText(_T("Style editor preview text"),previewText);
|
||||||
|
|
|
@ -54,6 +54,7 @@ SubtitlesPreview::SubtitlesPreview(wxWindow *parent,int id,wxPoint pos,wxSize si
|
||||||
AssStyle temp;
|
AssStyle temp;
|
||||||
bmp = NULL;
|
bmp = NULL;
|
||||||
style = NULL;
|
style = NULL;
|
||||||
|
vid = NULL;
|
||||||
SetStyle(&temp);
|
SetStyle(&temp);
|
||||||
SetText(_T("preview"));
|
SetText(_T("preview"));
|
||||||
SetSizeHints(size.GetWidth(),size.GetHeight(),-1,-1);
|
SetSizeHints(size.GetWidth(),size.GetHeight(),-1,-1);
|
||||||
|
@ -65,6 +66,7 @@ SubtitlesPreview::SubtitlesPreview(wxWindow *parent,int id,wxPoint pos,wxSize si
|
||||||
SubtitlesPreview::~SubtitlesPreview() {
|
SubtitlesPreview::~SubtitlesPreview() {
|
||||||
delete bmp;
|
delete bmp;
|
||||||
delete style;
|
delete style;
|
||||||
|
delete vid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,8 +131,9 @@ void SubtitlesPreview::UpdateBitmap(int w,int h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get AegiVideoFrame
|
// Get AegiVideoFrame
|
||||||
DummyVideoProvider vid(0.0,10,w,h,wxColour(125,153,176),true);
|
if (!vid) vid = new DummyVideoProvider(0.0,10,w,h,wxColour(125,153,176),true);
|
||||||
AegiVideoFrame frame = vid.GetFrame(0);
|
AegiVideoFrame frame;
|
||||||
|
frame.CopyFrom(vid->GetFrame(0));
|
||||||
|
|
||||||
// Generate subtitles
|
// Generate subtitles
|
||||||
AssFile *subs = new AssFile();
|
AssFile *subs = new AssFile();
|
||||||
|
@ -179,5 +182,7 @@ void SubtitlesPreview::OnPaint(wxPaintEvent &event) {
|
||||||
//////////////
|
//////////////
|
||||||
// Size event
|
// Size event
|
||||||
void SubtitlesPreview::OnSize(wxSizeEvent &event) {
|
void SubtitlesPreview::OnSize(wxSizeEvent &event) {
|
||||||
|
delete vid;
|
||||||
|
vid = NULL;
|
||||||
UpdateBitmap(event.GetSize().GetWidth(),event.GetSize().GetHeight());
|
UpdateBitmap(event.GetSize().GetWidth(),event.GetSize().GetHeight());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
//////////////
|
//////////////
|
||||||
// Prototypes
|
// Prototypes
|
||||||
class AssStyle;
|
class AssStyle;
|
||||||
|
class VideoProvider;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
@ -54,6 +55,7 @@ private:
|
||||||
wxBitmap *bmp;
|
wxBitmap *bmp;
|
||||||
AssStyle *style;
|
AssStyle *style;
|
||||||
wxString showText;
|
wxString showText;
|
||||||
|
VideoProvider *vid;
|
||||||
|
|
||||||
void UpdateBitmap(int w=-1,int h=-1);
|
void UpdateBitmap(int w=-1,int h=-1);
|
||||||
void OnSize(wxSizeEvent &event);
|
void OnSize(wxSizeEvent &event);
|
||||||
|
|
Loading…
Reference in a new issue