forked from mia/Aegisub
Implemented ColourButton class
Originally committed to SVN as r685.
This commit is contained in:
parent
cf94a0e77f
commit
48321dc868
8 changed files with 36 additions and 85 deletions
|
@ -213,11 +213,6 @@ bool AssDialogue::Parse(wxString rawData, bool IsSSA) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////
|
|
||||||
// Keep data flag
|
|
||||||
bool AssDialogue::keepData = true;
|
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Make data
|
// Make data
|
||||||
wxString AssDialogue::MakeData() {
|
wxString AssDialogue::MakeData() {
|
||||||
|
@ -256,14 +251,12 @@ wxString AssDialogue::MakeData() {
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// Update AssDialogue's data line
|
// Update AssDialogue's data line
|
||||||
void AssDialogue::UpdateData () {
|
void AssDialogue::UpdateData () {
|
||||||
if (keepData) SetEntryData(MakeData());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// Get entry data
|
// Get entry data
|
||||||
const wxString AssDialogue::GetEntryData() {
|
const wxString AssDialogue::GetEntryData() {
|
||||||
if (keepData) return AssEntry::GetEntryData();
|
|
||||||
return MakeData();
|
return MakeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +264,6 @@ const wxString AssDialogue::GetEntryData() {
|
||||||
//////////////////
|
//////////////////
|
||||||
// Set entry data
|
// Set entry data
|
||||||
void AssDialogue::SetEntryData(wxString newData) {
|
void AssDialogue::SetEntryData(wxString newData) {
|
||||||
if (keepData) AssEntry::SetEntryData(newData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,8 +160,6 @@ private:
|
||||||
wxString MakeData();
|
wxString MakeData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool keepData;
|
|
||||||
|
|
||||||
std::vector<AssDialogueBlock*> Blocks; // Contains information about each block of text
|
std::vector<AssDialogueBlock*> Blocks; // Contains information about each block of text
|
||||||
|
|
||||||
bool Comment; // Is this a comment line?
|
bool Comment; // Is this a comment line?
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
// Includes
|
// Includes
|
||||||
#include <wx/wx.h>
|
#include <wx/wxprec.h>
|
||||||
#include <wx/grid.h>
|
#include <wx/grid.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "dialog_colorpicker.h"
|
#include "dialog_colorpicker.h"
|
||||||
|
#include "colour_button.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -107,18 +108,14 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
||||||
ColorsSizer->Add(ColorSizer3,0,wxLEFT,5);
|
ColorsSizer->Add(ColorSizer3,0,wxLEFT,5);
|
||||||
ColorsSizer->Add(ColorSizer4,0,wxLEFT,5);
|
ColorsSizer->Add(ColorSizer4,0,wxLEFT,5);
|
||||||
ColorsSizer->AddStretchSpacer(1);
|
ColorsSizer->AddStretchSpacer(1);
|
||||||
ColorButton1 = new wxBitmapButton(this,BUTTON_COLOR_1,wxBitmap(45,16),wxDefaultPosition,wxDefaultSize);
|
colorButton[0] = new ColourButton(this,BUTTON_COLOR_1,wxSize(45,16),style->primary.GetWXColor());
|
||||||
ColorButton2 = new wxBitmapButton(this,BUTTON_COLOR_2,wxBitmap(45,16),wxDefaultPosition,wxDefaultSize);
|
colorButton[1] = new ColourButton(this,BUTTON_COLOR_2,wxSize(45,16),style->secondary.GetWXColor());
|
||||||
ColorButton3 = new wxBitmapButton(this,BUTTON_COLOR_3,wxBitmap(45,16),wxDefaultPosition,wxDefaultSize);
|
colorButton[2] = new ColourButton(this,BUTTON_COLOR_3,wxSize(45,16),style->outline.GetWXColor());
|
||||||
ColorButton4 = new wxBitmapButton(this,BUTTON_COLOR_4,wxBitmap(45,16),wxDefaultPosition,wxDefaultSize);
|
colorButton[3] = new ColourButton(this,BUTTON_COLOR_4,wxSize(45,16),style->shadow.GetWXColor());
|
||||||
SetBitmapColor(1,style->primary.GetWXColor());
|
colorButton[0]->SetToolTip(_("Click to choose primary color"));
|
||||||
SetBitmapColor(2,style->secondary.GetWXColor());
|
colorButton[1]->SetToolTip(_("Click to choose secondary color"));
|
||||||
SetBitmapColor(3,style->outline.GetWXColor());
|
colorButton[2]->SetToolTip(_("Click to choose outline color"));
|
||||||
SetBitmapColor(4,style->shadow.GetWXColor());
|
colorButton[3]->SetToolTip(_("Click to choose shadow color"));
|
||||||
ColorButton1->SetToolTip(_("Click to choose color"));
|
|
||||||
ColorButton2->SetToolTip(_("Click to choose color"));
|
|
||||||
ColorButton3->SetToolTip(_("Click to choose color"));
|
|
||||||
ColorButton4->SetToolTip(_("Click to choose color"));
|
|
||||||
ColorAlpha1Value = wxString::Format(_T("%i"),style->primary.a);
|
ColorAlpha1Value = wxString::Format(_T("%i"),style->primary.a);
|
||||||
ColorAlpha1 = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&ColorAlpha1Value));
|
ColorAlpha1 = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&ColorAlpha1Value));
|
||||||
ColorAlpha2Value = wxString::Format(_T("%i"),style->secondary.a);
|
ColorAlpha2Value = wxString::Format(_T("%i"),style->secondary.a);
|
||||||
|
@ -135,10 +132,10 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
||||||
ColorSizer2->Add(new wxStaticText(this,-1,_("Secondary")),0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer2->Add(new wxStaticText(this,-1,_("Secondary")),0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer3->Add(new wxStaticText(this,-1,_("Outline")),0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer3->Add(new wxStaticText(this,-1,_("Outline")),0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer4->Add(new wxStaticText(this,-1,_("Shadow")),0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer4->Add(new wxStaticText(this,-1,_("Shadow")),0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer1->Add(ColorButton1,0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer1->Add(colorButton[0],0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer2->Add(ColorButton2,0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer2->Add(colorButton[1],0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer3->Add(ColorButton3,0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer3->Add(colorButton[2],0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer4->Add(ColorButton4,0,wxBOTTOM | wxALIGN_CENTER,5);
|
ColorSizer4->Add(colorButton[3],0,wxBOTTOM | wxALIGN_CENTER,5);
|
||||||
ColorSizer1->Add(ColorAlpha1,0,wxALIGN_CENTER,0);
|
ColorSizer1->Add(ColorAlpha1,0,wxALIGN_CENTER,0);
|
||||||
ColorSizer2->Add(ColorAlpha2,0,wxALIGN_CENTER,0);
|
ColorSizer2->Add(ColorAlpha2,0,wxALIGN_CENTER,0);
|
||||||
ColorSizer3->Add(ColorAlpha3,0,wxALIGN_CENTER,0);
|
ColorSizer3->Add(ColorAlpha3,0,wxALIGN_CENTER,0);
|
||||||
|
@ -311,28 +308,6 @@ DialogStyleEditor::~DialogStyleEditor () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
|
||||||
// Sets the color of the bitmap of a button
|
|
||||||
void DialogStyleEditor::SetBitmapColor (int n,wxColour color) {
|
|
||||||
wxBitmapButton *but;
|
|
||||||
switch (n) {
|
|
||||||
case 1: but = ColorButton1; break;
|
|
||||||
case 2: but = ColorButton2; break;
|
|
||||||
case 3: but = ColorButton3; break;
|
|
||||||
case 4: but = ColorButton4; break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
wxBitmap bmp (but->GetBitmapLabel());
|
|
||||||
wxMemoryDC dc;
|
|
||||||
dc.SelectObject(bmp);
|
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
|
||||||
wxBrush brush(color);
|
|
||||||
dc.SetBrush(brush);
|
|
||||||
dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight());
|
|
||||||
but->SetBitmapLabel(bmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
||||||
|
@ -524,19 +499,7 @@ void DialogStyleEditor::OnSetColor (int n) {
|
||||||
case 4: modify = &work->shadow; break;
|
case 4: modify = &work->shadow; break;
|
||||||
default: throw _T("Never gets here");
|
default: throw _T("Never gets here");
|
||||||
}
|
}
|
||||||
DialogColorPicker dlg(this, modify->GetWXColor());
|
modify->SetWXColor(colorButton[n-1]->GetColour());
|
||||||
if (dlg.ShowModal() == wxID_OK) {
|
|
||||||
wxColour color = dlg.GetColor();
|
|
||||||
modify->SetWXColor(color);
|
|
||||||
SetBitmapColor(n, color);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
wxColour newColor = wxGetColourFromUser(this,modify->GetWXColor());
|
|
||||||
if (newColor.Ok()) {
|
|
||||||
modify->SetWXColor(newColor);
|
|
||||||
SetBitmapColor(n,newColor);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
////////////
|
////////////
|
||||||
// Includes
|
// Includes
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
#include "colour_button.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
@ -81,10 +82,7 @@ private:
|
||||||
wxCheckBox *BoxItalic;
|
wxCheckBox *BoxItalic;
|
||||||
wxCheckBox *BoxUnderline;
|
wxCheckBox *BoxUnderline;
|
||||||
wxCheckBox *BoxStrikeout;
|
wxCheckBox *BoxStrikeout;
|
||||||
wxBitmapButton *ColorButton1;
|
ColourButton *colorButton[4];
|
||||||
wxBitmapButton *ColorButton2;
|
|
||||||
wxBitmapButton *ColorButton3;
|
|
||||||
wxBitmapButton *ColorButton4;
|
|
||||||
wxTextCtrl *ColorAlpha1;
|
wxTextCtrl *ColorAlpha1;
|
||||||
wxTextCtrl *ColorAlpha2;
|
wxTextCtrl *ColorAlpha2;
|
||||||
wxTextCtrl *ColorAlpha3;
|
wxTextCtrl *ColorAlpha3;
|
||||||
|
|
|
@ -82,7 +82,6 @@ bool AegisubApp::OnInit() {
|
||||||
Options.SetFile(folderName + _T("/config.dat"));
|
Options.SetFile(folderName + _T("/config.dat"));
|
||||||
Options.Load();
|
Options.Load();
|
||||||
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
|
AssTime::UseMSPrecision = Options.AsBool(_T("Use nonstandard Milisecond Times"));
|
||||||
AssDialogue::keepData = Options.AsBool(_T("Keep raw dialogue data"));
|
|
||||||
|
|
||||||
// Set hotkeys file
|
// Set hotkeys file
|
||||||
Hotkeys.SetFile(folderName + _T("/hotkeys.dat"));
|
Hotkeys.SetFile(folderName + _T("/hotkeys.dat"));
|
||||||
|
|
|
@ -92,6 +92,8 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetText(_T("Auto save path"),_T("autosave"));
|
SetText(_T("Auto save path"),_T("autosave"));
|
||||||
SetText(_T("Auto recovery path"),_T("recovered"));
|
SetText(_T("Auto recovery path"),_T("recovered"));
|
||||||
SetInt(_T("Autoload linked files"),2);
|
SetInt(_T("Autoload linked files"),2);
|
||||||
|
SetText(_T("Text actor separator"),_T(":"));
|
||||||
|
SetText(_T("Text comment starter"),_T("#"));
|
||||||
|
|
||||||
// Dictionary
|
// Dictionary
|
||||||
SetText(_T("Dictionaries path"),_T("dictionaries"));
|
SetText(_T("Dictionaries path"),_T("dictionaries"));
|
||||||
|
@ -112,11 +114,6 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetText(_T("Video resizer"),_T("BilinearResize"));
|
SetText(_T("Video resizer"),_T("BilinearResize"));
|
||||||
|
|
||||||
// Audio Options
|
// Audio Options
|
||||||
SetBool(_T("Audio Link"),true);
|
|
||||||
SetBool(_T("Audio Autocommit"),false);
|
|
||||||
SetBool(_T("Audio Autoscroll"),true);
|
|
||||||
SetBool(_T("Audio SSA Mode"),false);
|
|
||||||
SetBool(_T("Audio Medusa Timing Hotkeys"),false);
|
|
||||||
SetBool(_T("Audio SSA Next Line on Commit"),true);
|
SetBool(_T("Audio SSA Next Line on Commit"),true);
|
||||||
SetBool(_T("Audio SSA Allow Autocommit"),false);
|
SetBool(_T("Audio SSA Allow Autocommit"),false);
|
||||||
SetBool(_T("Audio Autofocus"),false);
|
SetBool(_T("Audio Autofocus"),false);
|
||||||
|
@ -131,6 +128,8 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetInt(_T("Audio Cache"),1);
|
SetInt(_T("Audio Cache"),1);
|
||||||
SetInt(_T("Audio Sample Rate"),0);
|
SetInt(_T("Audio Sample Rate"),0);
|
||||||
SetText(_T("Audio Downmixer"),_T("ConvertToMono"));
|
SetText(_T("Audio Downmixer"),_T("ConvertToMono"));
|
||||||
|
SetText(_T("Audio HD Cache Location"),_T("default"));
|
||||||
|
SetText(_T("Audio HD Cache Name"),_T("audio%02i.tmp"));
|
||||||
|
|
||||||
// Automation
|
// Automation
|
||||||
SetText(_T("Automation Base Path"), AegisubApp::folderName + _T("automation/"));
|
SetText(_T("Automation Base Path"), AegisubApp::folderName + _T("automation/"));
|
||||||
|
@ -139,6 +138,7 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetInt(_T("Automation Trace Level"), 3);
|
SetInt(_T("Automation Trace Level"), 3);
|
||||||
|
|
||||||
// Edit box cosmetic
|
// Edit box cosmetic
|
||||||
|
SetBool(_T("Call Tips Enabled"),true);
|
||||||
SetBool(_T("Syntax Highlight Enabled"),true);
|
SetBool(_T("Syntax Highlight Enabled"),true);
|
||||||
SetColour(_T("Syntax Highlight Normal"),wxColour(0,0,0));
|
SetColour(_T("Syntax Highlight Normal"),wxColour(0,0,0));
|
||||||
SetColour(_T("Syntax Highlight Brackets"),wxColour(20,50,255));
|
SetColour(_T("Syntax Highlight Brackets"),wxColour(20,50,255));
|
||||||
|
@ -190,6 +190,11 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetText(_T("Grid hide overrides char"),temp);
|
SetText(_T("Grid hide overrides char"),temp);
|
||||||
SetBool(_T("Grid allow focus"),true);
|
SetBool(_T("Grid allow focus"),true);
|
||||||
SetBool(_T("Highlight subs in frame"),true);
|
SetBool(_T("Highlight subs in frame"),true);
|
||||||
|
#if defined(__WINDOWS__)
|
||||||
|
SetInt(_T("Grid font size"),8);
|
||||||
|
#else
|
||||||
|
SetInt(_T("Grid font size"),10);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Audio Cosmetic
|
// Audio Cosmetic
|
||||||
SetInt(_T("Audio Spectrum Cutoff"),32);
|
SetInt(_T("Audio Spectrum Cutoff"),32);
|
||||||
|
@ -218,10 +223,14 @@ void OptionsManager::LoadDefaults() {
|
||||||
///// INTERNAL //////
|
///// INTERNAL //////
|
||||||
// Options that are set by the program itself
|
// Options that are set by the program itself
|
||||||
SetInt(_T("Locale Code"),-1);
|
SetInt(_T("Locale Code"),-1);
|
||||||
SetBool(_T("Keep raw dialogue data"),false);
|
|
||||||
|
|
||||||
SetBool(_T("Sync video with subs"),true);
|
SetBool(_T("Sync video with subs"),true);
|
||||||
|
|
||||||
|
SetBool(_T("Audio Link"),true);
|
||||||
|
SetBool(_T("Audio Autocommit"),false);
|
||||||
|
SetBool(_T("Audio Autoscroll"),true);
|
||||||
|
SetBool(_T("Audio SSA Mode"),false);
|
||||||
|
SetBool(_T("Audio Medusa Timing Hotkeys"),false);
|
||||||
|
|
||||||
SetBool(_T("Shift Times ByTime"),true);
|
SetBool(_T("Shift Times ByTime"),true);
|
||||||
SetInt(_T("Shift Times Type"),0);
|
SetInt(_T("Shift Times Type"),0);
|
||||||
SetInt(_T("Shift Times Length"),0);
|
SetInt(_T("Shift Times Length"),0);
|
||||||
|
@ -241,12 +250,6 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetInt(_T("Grid hide overrides"),1);
|
SetInt(_T("Grid hide overrides"),1);
|
||||||
for (int i=0;i<10;i++) SetBool(_T("Grid show column ") + IntegerToString(i),true);
|
for (int i=0;i<10;i++) SetBool(_T("Grid show column ") + IntegerToString(i),true);
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
|
||||||
SetInt(_T("Grid font size"),8);
|
|
||||||
#else
|
|
||||||
SetInt(_T("Grid font size"),10);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i=0;i<9;i++) SetBool(wxString::Format(_T("Paste Over #%i"),i),false);
|
for (int i=0;i<9;i++) SetBool(wxString::Format(_T("Paste Over #%i"),i),false);
|
||||||
SetBool(_T("Paste Over #9"),true);
|
SetBool(_T("Paste Over #9"),true);
|
||||||
|
|
||||||
|
@ -256,8 +259,6 @@ void OptionsManager::LoadDefaults() {
|
||||||
|
|
||||||
SetInt(_T("Audio Display Height"),100);
|
SetInt(_T("Audio Display Height"),100);
|
||||||
SetBool(_T("Audio Spectrum"),false);
|
SetBool(_T("Audio Spectrum"),false);
|
||||||
SetText(_T("Audio HD Cache Location"),_T("default"));
|
|
||||||
SetText(_T("Audio HD Cache Name"),_T("audio%02i.tmp"));
|
|
||||||
|
|
||||||
SetInt(_T("Timing processor key start before thres"),5);
|
SetInt(_T("Timing processor key start before thres"),5);
|
||||||
SetInt(_T("Timing processor key start after thres"),4);
|
SetInt(_T("Timing processor key start after thres"),4);
|
||||||
|
@ -279,9 +280,6 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetBool(_T("Select Match dialogues"),true);
|
SetBool(_T("Select Match dialogues"),true);
|
||||||
SetBool(_T("Select Match comments"),false);
|
SetBool(_T("Select Match comments"),false);
|
||||||
|
|
||||||
SetText(_T("Text actor separator"),_T(":"));
|
|
||||||
SetText(_T("Text comment starter"),_T("#"));
|
|
||||||
|
|
||||||
SetText(_T("Color Picker Recent"), _T("&H000000& &H0000FF& &H00FFFF& &H00FF00& &HFFFF00& &HFF0000& &HFF00FF& &HFFFFFF&"));
|
SetText(_T("Color Picker Recent"), _T("&H000000& &H0000FF& &H00FFFF& &H00FF00& &HFFFF00& &HFF0000& &HFF00FF& &HFFFFFF&"));
|
||||||
SetInt(_T("Color Picker Mode"), 4);
|
SetInt(_T("Color Picker Mode"), 4);
|
||||||
|
|
||||||
|
|
|
@ -378,6 +378,9 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
///////////////////
|
///////////////////
|
||||||
// Update call tip
|
// Update call tip
|
||||||
void SubsTextEditCtrl::UpdateCallTip() {
|
void SubsTextEditCtrl::UpdateCallTip() {
|
||||||
|
// Enabled?
|
||||||
|
if (!Options.AsBool(_T("Call tips enabled"))) return;
|
||||||
|
|
||||||
// Get position and text
|
// Get position and text
|
||||||
const unsigned int pos = GetReverseUnicodePosition(GetCurrentPos());
|
const unsigned int pos = GetReverseUnicodePosition(GetCurrentPos());
|
||||||
wxString text = GetText();
|
wxString text = GetText();
|
||||||
|
|
Loading…
Reference in a new issue