2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, 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.
|
|
|
|
//
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// AEGISUB
|
|
|
|
//
|
|
|
|
// Website: http://aegisub.cellosoft.com
|
|
|
|
// Contact: mailto:zeratul@cellosoft.com
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
////////////
|
|
|
|
// Includes
|
|
|
|
#include <wx/wxprec.h>
|
2006-12-24 18:42:09 +01:00
|
|
|
#include "subs_edit_ctrl.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
// Prototypes
|
|
|
|
class SubtitlesGrid;
|
|
|
|
class TimeEdit;
|
|
|
|
class SubsEditBox;
|
|
|
|
class AudioDisplay;
|
|
|
|
class HiliModTextCtrl;
|
2006-12-24 05:54:35 +01:00
|
|
|
class wxScintilla;
|
|
|
|
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
//////////////////
|
|
|
|
// Edit box class
|
|
|
|
class SubsEditBox : public wxPanel {
|
2006-12-24 05:54:35 +01:00
|
|
|
friend class SubsTextEditHandler;
|
2006-12-24 18:42:09 +01:00
|
|
|
friend class SubsTextEditCtrl;
|
2007-01-08 04:05:26 +01:00
|
|
|
friend class AudioDisplay;
|
2006-12-24 05:54:35 +01:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
private:
|
2006-12-27 01:00:41 +01:00
|
|
|
bool splitLineMode;
|
|
|
|
bool setupDone;
|
2006-01-16 22:02:54 +01:00
|
|
|
bool enabled;
|
|
|
|
bool textEditReady;
|
|
|
|
bool controlState;
|
|
|
|
wxColour origBgColour;
|
|
|
|
wxColour disabledBgColour;
|
|
|
|
|
|
|
|
SubtitlesGrid *grid;
|
|
|
|
wxCheckBox *CommentBox;
|
|
|
|
wxComboBox *StyleBox;
|
|
|
|
wxComboBox *ActorBox;
|
|
|
|
TimeEdit *StartTime;
|
|
|
|
TimeEdit *EndTime;
|
|
|
|
TimeEdit *Duration;
|
|
|
|
HiliModTextCtrl *Layer;
|
|
|
|
HiliModTextCtrl *MarginL;
|
|
|
|
HiliModTextCtrl *MarginR;
|
|
|
|
HiliModTextCtrl *MarginV;
|
2006-06-27 06:13:34 +02:00
|
|
|
HiliModTextCtrl *Effect;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxRadioButton *ByTime;
|
|
|
|
wxRadioButton *ByFrame;
|
|
|
|
wxCheckBox *SyntaxHighlight;
|
|
|
|
|
|
|
|
wxButton *Bold;
|
|
|
|
wxButton *Italics;
|
|
|
|
wxButton *Underline;
|
|
|
|
wxButton *Strikeout;
|
|
|
|
wxButton *FontName;
|
|
|
|
wxButton *Color1;
|
|
|
|
wxButton *Color2;
|
|
|
|
wxButton *Color3;
|
|
|
|
wxButton *Color4;
|
|
|
|
|
2006-12-27 01:00:41 +01:00
|
|
|
wxSizer *TopSizer;
|
|
|
|
wxSizer *MiddleBotSizer;
|
|
|
|
wxSizer *MiddleSizer;
|
|
|
|
wxSizer *MainSizer;
|
|
|
|
wxSizer *DummySizer;
|
|
|
|
wxSizer *BottomSizer;
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
void SetControlsState(bool state);
|
2006-02-19 04:33:13 +01:00
|
|
|
void CommitTimes(bool start,bool end,bool fromStart);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
int BlockAtPos(int pos);
|
|
|
|
|
2006-12-24 05:54:35 +01:00
|
|
|
void OnEditText(wxScintillaEvent &event);
|
|
|
|
void OnNeedStyle(wxScintillaEvent &event);
|
2007-01-02 06:00:55 +01:00
|
|
|
void OnCharAdded(wxScintillaEvent &event);
|
2007-01-02 19:09:56 +01:00
|
|
|
void OnUpdateUI(wxScintillaEvent &event);
|
2006-12-24 05:54:35 +01:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnButtonColor1(wxCommandEvent &event);
|
|
|
|
void OnButtonColor2(wxCommandEvent &event);
|
|
|
|
void OnButtonColor3(wxCommandEvent &event);
|
|
|
|
void OnButtonColor4(wxCommandEvent &event);
|
|
|
|
void OnButtonFontFace(wxCommandEvent &event);
|
|
|
|
void OnButtonBold(wxCommandEvent &event);
|
|
|
|
void OnButtonItalics(wxCommandEvent &event);
|
|
|
|
void OnButtonUnderline(wxCommandEvent &event);
|
|
|
|
void OnButtonStrikeout(wxCommandEvent &event);
|
|
|
|
|
|
|
|
void OnSyntaxBox(wxCommandEvent &event);
|
|
|
|
void OnFrameRadio(wxCommandEvent &event);
|
|
|
|
void OnTimeRadio(wxCommandEvent &event);
|
2006-12-24 17:17:40 +01:00
|
|
|
void OnKeyDown(wxScintillaEvent &event);
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnStyleChange(wxCommandEvent &event);
|
|
|
|
void OnActorChange(wxCommandEvent &event);
|
|
|
|
void OnLayerChange(wxCommandEvent &event);
|
|
|
|
void OnStartTimeChange(wxCommandEvent &event);
|
|
|
|
void OnEndTimeChange(wxCommandEvent &event);
|
|
|
|
void OnDurationChange(wxCommandEvent &event);
|
|
|
|
void OnMarginLChange(wxCommandEvent &event);
|
|
|
|
void OnMarginRChange(wxCommandEvent &event);
|
|
|
|
void OnMarginVChange(wxCommandEvent &event);
|
|
|
|
void OnCommentChange(wxCommandEvent &event);
|
2006-06-27 06:13:34 +02:00
|
|
|
void OnEffectChange(wxCommandEvent &event);
|
2006-12-27 01:00:41 +01:00
|
|
|
void OnSize(wxSizeEvent &event);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
int linen;
|
|
|
|
AudioDisplay *audio;
|
|
|
|
SubsTextEditCtrl *TextEdit;
|
|
|
|
|
|
|
|
SubsEditBox(wxWindow *parent,SubtitlesGrid *gridp);
|
|
|
|
|
2007-01-23 05:42:08 +01:00
|
|
|
void SetOverride (wxString tag,wxString preValue=_T(""),int pos=-1,bool getFocus=true);
|
2006-02-19 05:55:10 +01:00
|
|
|
void SetStyleFlag (wxString tag,wxString preValue=_T(""),int pos=-1);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-12-27 01:00:41 +01:00
|
|
|
void SetSplitLineMode(wxSize size=wxSize(-1,-1));
|
2007-01-08 06:32:29 +01:00
|
|
|
void CommitText(bool weak=false);
|
2007-01-09 03:13:23 +01:00
|
|
|
void Update(bool timeOnly=false,bool weak=false);
|
2006-01-16 22:02:54 +01:00
|
|
|
void UpdateGlobals();
|
2007-01-09 03:13:23 +01:00
|
|
|
void SetToLine(int n,bool weak=false);
|
2006-01-16 22:02:54 +01:00
|
|
|
void UpdateFrameTiming();
|
2007-01-24 03:25:45 +01:00
|
|
|
void DoKeyPress(wxKeyEvent &event);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-01-19 11:33:56 +01:00
|
|
|
DECLARE_EVENT_TABLE()
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////
|
|
|
|
// Event handler
|
|
|
|
class SubsEditBoxEvent : public wxEvtHandler {
|
|
|
|
private:
|
|
|
|
SubsEditBox *control;
|
|
|
|
void OnKeyPress(wxKeyEvent &event);
|
|
|
|
|
|
|
|
public:
|
|
|
|
SubsEditBoxEvent(SubsEditBox *control);
|
2006-01-19 11:33:56 +01:00
|
|
|
DECLARE_EVENT_TABLE()
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////
|
|
|
|
// IDs
|
|
|
|
enum {
|
|
|
|
EDIT_BOX = 1300,
|
|
|
|
SYNTAX_BOX,
|
|
|
|
RADIO_TIME_BY_FRAME,
|
|
|
|
RADIO_TIME_BY_TIME,
|
|
|
|
STYLE_COMBOBOX,
|
|
|
|
ACTOR_COMBOBOX,
|
|
|
|
LAYER_BOX,
|
|
|
|
STARTTIME_BOX,
|
|
|
|
ENDTIME_BOX,
|
|
|
|
DURATION_BOX,
|
|
|
|
MARGINL_BOX,
|
|
|
|
MARGINR_BOX,
|
|
|
|
MARGINV_BOX,
|
2006-06-27 06:13:34 +02:00
|
|
|
EFFECT_BOX,
|
2006-01-16 22:02:54 +01:00
|
|
|
COMMENT_CHECKBOX,
|
|
|
|
|
|
|
|
BUTTON_BOLD,
|
|
|
|
BUTTON_ITALICS,
|
|
|
|
BUTTON_UNDERLINE,
|
|
|
|
BUTTON_STRIKEOUT,
|
|
|
|
BUTTON_FONT_NAME,
|
|
|
|
BUTTON_COLOR1,
|
|
|
|
BUTTON_COLOR2,
|
|
|
|
BUTTON_COLOR3,
|
|
|
|
BUTTON_COLOR4
|
|
|
|
};
|