wxSTC SUCKS. Note: never call SetWindowStyle() on it, or it'll break the keyboard handling.

Originally committed to SVN as r2025.
This commit is contained in:
Rodrigo Braz Monteiro 2008-03-11 23:58:43 +00:00
parent 5ceebc02a2
commit 0a931d3f45
6 changed files with 70 additions and 17 deletions

View File

@ -304,6 +304,10 @@
RelativePath=".\src\section.cpp"
>
</File>
<File
RelativePath=".\src\section_entry.cpp"
>
</File>
<File
RelativePath=".\src\text_file_reader.cpp"
>

View File

@ -34,6 +34,7 @@
//
#pragma once
#include "aegistring.h"
namespace Aegilib {
@ -55,7 +56,8 @@ namespace Aegilib {
// Section entry class
class SectionEntry {
private:
protected:
const String& EmptyString() const;
public:
virtual ~SectionEntry() {}

View File

@ -66,7 +66,7 @@ namespace Aegilib {
virtual bool HasMargins() const { return false; }
// Read accessors
virtual String GetText() const { ThrowUnsupported(); return L""; }
virtual const String& GetText() const { ThrowUnsupported(); return EmptyString(); }
virtual Time GetStartTime() const { ThrowUnsupported(); return 0; }
virtual Time GetEndTime() const { ThrowUnsupported(); return 0; }
virtual int GetStartFrame() const { ThrowUnsupported(); return 0; }
@ -74,12 +74,12 @@ namespace Aegilib {
virtual bool IsComment() const { ThrowUnsupported(); return false; }
virtual int GetLayer() const { ThrowUnsupported(); return 0; }
virtual int GetMargin(int n) const { ThrowUnsupported(); return n; }
virtual String GetStyle() const { ThrowUnsupported(); return L""; }
virtual String GetActor() const { ThrowUnsupported(); return L""; }
virtual String GetUserField() const { ThrowUnsupported(); return L""; }
virtual const String& GetStyle() const { ThrowUnsupported(); return EmptyString(); }
virtual const String& GetActor() const { ThrowUnsupported(); return EmptyString(); }
virtual const String& GetUserField() const { ThrowUnsupported(); return EmptyString(); }
// Write acessors
virtual void SetText(String text) { (void) text; ThrowUnsupported(); }
virtual void SetText(const String& text) { (void) text; ThrowUnsupported(); }
virtual void SetStartTime(Time start) { (void) start; ThrowUnsupported(); }
virtual void SetEndTime(Time end) { (void) end; ThrowUnsupported(); }
virtual void SetStartFrame(int start) { (void) start; ThrowUnsupported(); }
@ -87,9 +87,9 @@ namespace Aegilib {
virtual void SetComment(bool isComment) { (void) isComment; ThrowUnsupported(); }
virtual void SetLayer(int layer) { (void) layer; ThrowUnsupported(); }
virtual void SetMargin(int margin,int value) { (void) margin; (void) value; ThrowUnsupported(); }
virtual void SetStyle(String style) { (void) style; ThrowUnsupported(); }
virtual void SetActor(String actor) { (void) actor; ThrowUnsupported(); }
virtual void SetUserField(String userField) { (void) userField; ThrowUnsupported(); }
virtual void SetStyle(const String& style) { (void) style; ThrowUnsupported(); }
virtual void SetActor(const String& actor) { (void) actor; ThrowUnsupported(); }
virtual void SetUserField(const String& userField) { (void) userField; ThrowUnsupported(); }
};
};

View File

@ -101,25 +101,25 @@ namespace Aegilib {
bool HasMargins() const { return true; }
// Read accessors
String GetText() const { return text; }
const String& GetText() const { return text; }
Time GetStartTime() const { return start; }
Time GetEndTime() const { return end; }
bool IsComment() const { return isComment; }
int GetLayer() const { return layer; }
int GetMargin(int n) const { return margin[n]; }
String GetStyle() const { return style; }
String GetActor() const { return actor; }
String GetUserField() const { return effect; }
const String& GetStyle() const { return style; }
const String& GetActor() const { return actor; }
const String& GetUserField() const { return effect; }
// Write acessors
void SetText(String setText) { text = setText; }
void SetText(const String &setText) { text = setText; }
void SetStartTime(Time setStart) { start = setStart; }
void SetEndTime(Time setEnd) { end = setEnd; }
void SetComment(bool _isComment) { isComment = _isComment; }
void SetLayer(int _layer) { layer = _layer; }
void SetMargin(int _margin,int value) { margin[_margin] = value; }
void SetStyle(String _style) { style = _style; }
void SetUserField(String userField) { effect = userField; }
void SetStyle(const String &_style) { style = _style; }
void SetUserField(const String &userField) { effect = userField; }
};
// Style

View File

@ -0,0 +1,47 @@
// Copyright (c) 2008, 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/AEGILIB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "section_entry.h"
using namespace Aegilib;
/////////////////////////////////
// Returns a static empty string
const String& SectionEntry::EmptyString() const
{
static const String str = _T("");
return str;
}

View File

@ -45,7 +45,7 @@
ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name)
: wxStyledTextCtrl(parent, id, pos, size, 0, value)
{
SetWindowStyle(style);
//SetWindowStyle(style);
}