Fourth page of options, grid settings, is complete.
Originally committed to SVN as r704.
This commit is contained in:
parent
0fec62dfd6
commit
a632611cad
5 changed files with 128 additions and 17 deletions
|
@ -65,6 +65,25 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx
|
|||
bmp = NULL;
|
||||
holding = false;
|
||||
|
||||
// Set scrollbar
|
||||
scrollBar = new wxScrollBar(this,GRID_SCROLLBAR,wxDefaultPosition,wxDefaultSize,wxSB_VERTICAL);
|
||||
scrollBar->SetScrollbar(0,10,100,10);
|
||||
|
||||
// Set style
|
||||
UpdateStyle();
|
||||
}
|
||||
|
||||
|
||||
//////////////
|
||||
// Destructor
|
||||
BaseGrid::~BaseGrid() {
|
||||
delete bmp;
|
||||
}
|
||||
|
||||
|
||||
////////////////
|
||||
// Update style
|
||||
void BaseGrid::UpdateStyle() {
|
||||
// Set font
|
||||
wxString fontname = Options.AsText(_T("Grid Font Face"));
|
||||
if (fontname.IsEmpty()) fontname = _T("Tahoma");
|
||||
|
@ -81,20 +100,13 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx
|
|||
lineHeight = fh+4;
|
||||
}
|
||||
|
||||
// Set scrollbar
|
||||
scrollBar = new wxScrollBar(this,GRID_SCROLLBAR,wxDefaultPosition,wxDefaultSize,wxSB_VERTICAL);
|
||||
scrollBar->SetScrollbar(0,10,100,10);
|
||||
|
||||
// Set column widths
|
||||
for (int i=0;i<10;i++) showCol[i] = Options.AsBool(_T("Grid show column ") + IntegerToString(i));
|
||||
SetColumnWidths();
|
||||
}
|
||||
|
||||
|
||||
//////////////
|
||||
// Destructor
|
||||
BaseGrid::~BaseGrid() {
|
||||
delete bmp;
|
||||
// Update
|
||||
AdjustScrollbar();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ public:
|
|||
|
||||
void Clear();
|
||||
void UpdateMaps();
|
||||
void UpdateStyle();
|
||||
|
||||
int GetRows() const;
|
||||
wxArrayInt GetRangeArray(int n1,int n2);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "colour_button.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
|
||||
|
||||
///////////////
|
||||
|
@ -197,8 +198,10 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
|
||||
// Second static box
|
||||
wxControl *control;
|
||||
wxString labels2[9] = { _("Normal"), _("Brackets"), _("Slashes and Parentheses"), _("Tags"), _("Parameters") , _("Error"), _("Error Background"), _("Line Break"), _("Modified Background") };
|
||||
wxString options2[11] = { _T("Normal"), _T("Brackets"), _T("Slashes"), _T("Tags"), _T("Parameters") , _T("Error"), _T("Error Background"), _T("Line Break"), _T("Edit box need enter background"), _T("Edit Font Face"), _T("Edit Font Size") };
|
||||
wxString labels2[9] = { _("Normal"), _("Brackets"), _("Slashes and Parentheses"), _("Tags"), _("Parameters") ,
|
||||
_("Error"), _("Error Background"), _("Line Break"), _("Modified Background") };
|
||||
wxString options2[11] = { _T("Normal"), _T("Brackets"), _T("Slashes"), _T("Tags"), _T("Parameters") ,
|
||||
_T("Error"), _T("Error Background"), _T("Line Break"), _T("Edit box need enter background"), _T("Edit Font Face"), _T("Edit Font Size") };
|
||||
for (int i=0;i<9;i++) {
|
||||
wxString caption = labels2[i]+_T(": ");
|
||||
wxString option = options2[i];
|
||||
|
@ -212,6 +215,8 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
editSizer4->Add(control,1,wxALIGN_CENTER,0);
|
||||
}
|
||||
editSizer4->AddGrowableCol(1,1);
|
||||
|
||||
// Third sizer
|
||||
editSizer5->Add(new wxStaticText(editPage,-1,_("Font: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10);
|
||||
control = new wxTextCtrl(editPage,-1);
|
||||
Bind(control,options2[9]);
|
||||
|
@ -231,6 +236,83 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
editPage->SetSizer(editMainSizer);
|
||||
}
|
||||
|
||||
// Grid page
|
||||
{
|
||||
// Sizers
|
||||
wxSizer *gridMainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer *gridSizer1 = new wxStaticBoxSizer(wxVERTICAL,gridPage,_("Options"));
|
||||
wxSizer *gridSizer2 = new wxStaticBoxSizer(wxVERTICAL,gridPage,_("Style"));
|
||||
wxFlexGridSizer *gridSizer3 = new wxFlexGridSizer(11,2,2,2);
|
||||
wxSizer *gridSizer4 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxSizer *gridSizer5 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// First sizer
|
||||
wxString labels1[2] = { _("Allow grid to take focus"), _("Highlight subtitles that are currently visible in video") };
|
||||
wxString options1[2] = { _T("Grid allow focus"), _T("Highlight subs in frame") };
|
||||
for (int i=0;i<2;i++) {
|
||||
wxCheckBox *control = new wxCheckBox(gridPage,-1,labels1[i]);
|
||||
Bind(control,options1[i]);
|
||||
gridSizer1->Add(control,1,wxEXPAND | wxALL,5);
|
||||
}
|
||||
|
||||
// Second sizer
|
||||
wxControl *control;
|
||||
wxString labels2[12] = { _("Standard Foreground"), _("Standard Background"), _("Selection Foreground"),
|
||||
_("Selection Background"), _("Comment Background"), _("Selected Comment Background"),
|
||||
_("Collision Foreground"), _("Line In Frame Background"), _("Header"),
|
||||
_("Left Column"), _("Active Line Border"), _("Lines") };
|
||||
wxString options2[12] = { _T("standard foreground"), _T("background"), _T("selection foreground"),
|
||||
_("selection background"), _T("comment background"), _T("selected comment background"),
|
||||
_T("collision foreground") , _T("inframe background"), _T("header"),
|
||||
_T("left column"), _T("active border"), _T("lines") };
|
||||
for (int i=0;i<12;i++) {
|
||||
wxString caption = labels2[i] + _T(": ");
|
||||
wxString option = _T("Grid ") + options2[i];
|
||||
control = new ColourButton(gridPage,-1,wxSize(40,10));
|
||||
Bind(control,option);
|
||||
gridSizer3->Add(new wxStaticText(gridPage,-1,caption),0,wxALIGN_CENTER_VERTICAL|wxRIGHT,5);
|
||||
gridSizer3->Add(control,1,wxALIGN_CENTER,0);
|
||||
}
|
||||
gridSizer3->AddGrowableCol(0,1);
|
||||
|
||||
// Third sizer
|
||||
gridSizer4->Add(new wxStaticText(gridPage,-1,_("Font: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10);
|
||||
control = new wxTextCtrl(gridPage,-1);
|
||||
Bind(control,_T("Grid font face"));
|
||||
gridSizer4->Add(control,1,wxEXPAND | wxRIGHT,5);
|
||||
control = new wxTextCtrl(gridPage,-1,_T(""),wxDefaultPosition,wxSize(50,-1),0,NumValidator(NULL,false));;
|
||||
Bind(control,_T("Grid font size"));
|
||||
gridSizer4->Add(control,0,wxEXPAND | wxRIGHT,0);
|
||||
|
||||
// Fourth sizer
|
||||
gridSizer5->Add(new wxStaticText(gridPage,-1,_("Replace override tags with: ")),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10);
|
||||
control = new wxTextCtrl(gridPage,-1);
|
||||
Bind(control,_T("Grid hide overrides char"));
|
||||
gridSizer5->Add(control,1,wxEXPAND | wxRIGHT,5);
|
||||
|
||||
// Sizers
|
||||
gridSizer2->Add(gridSizer3,1,wxEXPAND | wxALL,5);
|
||||
gridSizer2->Add(gridSizer4,0,wxEXPAND | wxALL,5);
|
||||
gridSizer2->Add(gridSizer5,0,wxEXPAND | wxALL,5);
|
||||
gridMainSizer->Add(gridSizer1,0,wxEXPAND | wxALL,0);
|
||||
gridMainSizer->Add(gridSizer2,0,wxEXPAND | wxALL,0);
|
||||
gridMainSizer->AddStretchSpacer(1);
|
||||
gridMainSizer->Fit(gridPage);
|
||||
gridPage->SetSizer(gridMainSizer);
|
||||
}
|
||||
|
||||
// Video page
|
||||
// TODO
|
||||
|
||||
// Audio page
|
||||
// TODO
|
||||
|
||||
// Audio display page
|
||||
// TODO
|
||||
|
||||
// Automation page
|
||||
// TODO
|
||||
|
||||
// List book
|
||||
book->AddPage(generalPage,_("General"),true);
|
||||
book->AddSubPage(filePage,_("File Save/Load"),true);
|
||||
|
@ -337,6 +419,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
|||
// Flags
|
||||
bool mustRestart = false;
|
||||
bool editBox = false;
|
||||
bool grid = false;
|
||||
|
||||
// For each bound item
|
||||
for (unsigned int i=0;i<binds.size();i++) {
|
||||
|
@ -393,6 +476,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
|||
ModType type = Options.GetModType(binds[i].option);
|
||||
if (type == MOD_RESTART) mustRestart = true;
|
||||
if (type == MOD_EDIT_BOX) editBox = true;
|
||||
if (type == MOD_GRID) grid = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,11 +497,18 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
|||
|
||||
// Other modifications
|
||||
if (!mustRestart || justApply) {
|
||||
// Edit box
|
||||
if (editBox) {
|
||||
FrameMain *frame = (FrameMain*) GetParent();
|
||||
frame->EditBox->TextEdit->SetStyles();
|
||||
frame->EditBox->TextEdit->UpdateStyle();
|
||||
}
|
||||
|
||||
// Grid
|
||||
if (grid) {
|
||||
FrameMain *frame = (FrameMain*) GetParent();
|
||||
frame->SubsBox->UpdateStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,11 @@ void OptionsManager::LoadDefaults() {
|
|||
wxColour grid = wxColour(128,128,128);
|
||||
wxColour collision = wxColour(255,0,0);
|
||||
|
||||
// Grid
|
||||
SetModificationType(MOD_GRID);
|
||||
SetBool(_T("Grid allow focus"),true);
|
||||
SetBool(_T("Highlight subs in frame"),true);
|
||||
|
||||
// Grid cosmetic
|
||||
SetColour(_T("Grid standard foreground"),textCol);
|
||||
SetColour(_T("Grid selection background"),selection);
|
||||
|
@ -189,16 +194,15 @@ void OptionsManager::LoadDefaults() {
|
|||
SetColour(_T("Grid left column"),labels);
|
||||
SetColour(_T("Grid active border"),active);
|
||||
SetColour(_T("Grid lines"),grid);
|
||||
wchar_t temp = 0x2600;
|
||||
SetText(_T("Grid hide overrides char"),temp);
|
||||
SetBool(_T("Grid allow focus"),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
|
||||
SetText(_T("Grid Font Face"),_T(""));
|
||||
wchar_t temp = 0x2600;
|
||||
SetText(_T("Grid hide overrides char"),temp);
|
||||
SetModificationType(MOD_AUTOMATIC);
|
||||
|
||||
// Audio Cosmetic
|
||||
SetInt(_T("Audio Spectrum Cutoff"),32);
|
||||
|
|
|
@ -50,7 +50,10 @@ enum ModType {
|
|||
MOD_OFF = -1,
|
||||
MOD_AUTOMATIC,
|
||||
MOD_RESTART,
|
||||
MOD_EDIT_BOX
|
||||
MOD_EDIT_BOX,
|
||||
MOD_GRID,
|
||||
MOD_VIDEO,
|
||||
MOD_AUDIO
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue