Fix setting the style editor preview background color
This commit is contained in:
parent
39bff418ca
commit
4472552fab
2 changed files with 8 additions and 18 deletions
|
@ -373,7 +373,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
|
||||||
Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
||||||
Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
||||||
|
|
||||||
previewButton->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogStyleEditor::OnPreviewColourChange, this);
|
previewButton->Bind(EVT_COLOR, &DialogStyleEditor::OnPreviewColourChange, this);
|
||||||
FontName->Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
FontName->Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
||||||
PreviewText->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogStyleEditor::OnPreviewTextChange, this);
|
PreviewText->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogStyleEditor::OnPreviewTextChange, this);
|
||||||
|
|
||||||
|
@ -504,27 +504,18 @@ void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) {
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Change colour of preview's background
|
void DialogStyleEditor::OnPreviewColourChange(wxThreadEvent &evt) {
|
||||||
void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &evt) {
|
SubsPreview->SetColour(evt.GetPayload<agi::Color>());
|
||||||
ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData());
|
OPT_SET("Colour/Style Editor/Background/Preview")->SetColor(evt.GetPayload<agi::Color>());
|
||||||
if (!btn)
|
|
||||||
evt.Skip();
|
|
||||||
else {
|
|
||||||
SubsPreview->SetColour(btn->GetColor());
|
|
||||||
OPT_SET("Colour/Style Editor/Background/Preview")->SetColor(btn->GetColor());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Command event to update preview
|
void DialogStyleEditor::OnCommandPreviewUpdate(wxCommandEvent &event) {
|
||||||
void DialogStyleEditor::OnCommandPreviewUpdate (wxCommandEvent &event) {
|
|
||||||
if (!IsShownOnScreen()) return;
|
|
||||||
UpdateWorkStyle();
|
UpdateWorkStyle();
|
||||||
SubsPreview->SetStyle(*work);
|
SubsPreview->SetStyle(*work);
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Converts control value to alignment
|
int DialogStyleEditor::ControlToAlign(int n) {
|
||||||
int DialogStyleEditor::ControlToAlign (int n) {
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0: return 7;
|
case 0: return 7;
|
||||||
case 1: return 8;
|
case 1: return 8;
|
||||||
|
@ -539,8 +530,7 @@ int DialogStyleEditor::ControlToAlign (int n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Converts alignment value to control
|
int DialogStyleEditor::AlignToControl(int n) {
|
||||||
int DialogStyleEditor::AlignToControl (int n) {
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 7: return 0;
|
case 7: return 0;
|
||||||
case 8: return 1;
|
case 8: return 1;
|
||||||
|
|
|
@ -95,7 +95,7 @@ class DialogStyleEditor : public wxDialog {
|
||||||
void OnCommandPreviewUpdate(wxCommandEvent &event);
|
void OnCommandPreviewUpdate(wxCommandEvent &event);
|
||||||
|
|
||||||
void OnPreviewTextChange(wxCommandEvent &event);
|
void OnPreviewTextChange(wxCommandEvent &event);
|
||||||
void OnPreviewColourChange(wxCommandEvent &event);
|
void OnPreviewColourChange(wxThreadEvent &event);
|
||||||
|
|
||||||
/// @brief Maybe apply changes and maybe close the dialog
|
/// @brief Maybe apply changes and maybe close the dialog
|
||||||
/// @param apply Should changes be applied?
|
/// @param apply Should changes be applied?
|
||||||
|
|
Loading…
Reference in a new issue