From 4d0f48f30388067fa17b2a38ab843493bc404939 Mon Sep 17 00:00:00 2001 From: harukalover Date: Thu, 2 Jul 2009 17:29:20 +0000 Subject: [PATCH] Fixed the "Overwrite-Insertion in time boxes" option on Linux and enabled it as the default mode for the time edit boxes on all OS's instead of just Windows Originally committed to SVN as r3094. --- aegisub/src/options.cpp | 4 ---- aegisub/src/timeedit_ctrl.cpp | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/aegisub/src/options.cpp b/aegisub/src/options.cpp index 43a40f440..15e156d4c 100644 --- a/aegisub/src/options.cpp +++ b/aegisub/src/options.cpp @@ -123,11 +123,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) { SetText(_T("Spell Checker"),_T("hunspell")); SetModificationType(MOD_AUTOMATIC); SetBool(_T("Link time boxes commit"),true); -#ifdef WIN32 SetBool(_T("Insert mode on time boxes"),true); -#else - SetBool(_T("Insert mode on time boxes"),false); -#endif SetModificationType(MOD_EDIT_BOX); SetBool(_T("Call tips enabled"),false,1700); SetBool(_T("Syntax highlight enabled"),true); diff --git a/aegisub/src/timeedit_ctrl.cpp b/aegisub/src/timeedit_ctrl.cpp index 1e0d08fb1..9652e9c4a 100644 --- a/aegisub/src/timeedit_ctrl.cpp +++ b/aegisub/src/timeedit_ctrl.cpp @@ -46,11 +46,17 @@ #include "vfr.h" #include "options.h" +// Use the multiline style only on wxGTK to workaround some wxGTK bugs with the default singleline style +#ifdef __WXGTK__ +#define TimeEditWindowStyle wxTE_MULTILINE | wxTE_CENTRE +#else +#define TimeEditWindowStyle wxTE_CENTRE +#endif /////////////// // Constructor TimeEdit::TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) : -wxTextCtrl(parent,id,value,pos,size,wxTE_CENTRE | style,validator,name) +wxTextCtrl(parent,id,value,pos,size,TimeEditWindowStyle | style,validator,name) { // Set validator wxTextValidator val(wxFILTER_INCLUDE_CHAR_LIST); @@ -72,6 +78,14 @@ wxTextCtrl(parent,id,value,pos,size,wxTE_CENTRE | style,validator,name) // Other stuff if (!value) SetValue(time.GetASSFormated()); + // This is a multiline control on wxGTK so we need to size it manually there +#ifdef __WXGTK__ + int w, h; + GetTextExtent(GetValue(),&w,&h); + w += 20; + h += 5; + SetSizeHints(w,h,w,h); +#endif ready = true; byFrame = false; isEnd = false;