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_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);
|
||||
PreviewText->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogStyleEditor::OnPreviewTextChange, this);
|
||||
|
||||
|
@ -504,26 +504,17 @@ void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) {
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
/// @brief Change colour of preview's background
|
||||
void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &evt) {
|
||||
ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData());
|
||||
if (!btn)
|
||||
evt.Skip();
|
||||
else {
|
||||
SubsPreview->SetColour(btn->GetColor());
|
||||
OPT_SET("Colour/Style Editor/Background/Preview")->SetColor(btn->GetColor());
|
||||
}
|
||||
void DialogStyleEditor::OnPreviewColourChange(wxThreadEvent &evt) {
|
||||
SubsPreview->SetColour(evt.GetPayload<agi::Color>());
|
||||
OPT_SET("Colour/Style Editor/Background/Preview")->SetColor(evt.GetPayload<agi::Color>());
|
||||
}
|
||||
|
||||
/// @brief Command event to update preview
|
||||
void DialogStyleEditor::OnCommandPreviewUpdate(wxCommandEvent &event) {
|
||||
if (!IsShownOnScreen()) return;
|
||||
UpdateWorkStyle();
|
||||
SubsPreview->SetStyle(*work);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/// @brief Converts control value to alignment
|
||||
int DialogStyleEditor::ControlToAlign(int n) {
|
||||
switch (n) {
|
||||
case 0: return 7;
|
||||
|
@ -539,7 +530,6 @@ int DialogStyleEditor::ControlToAlign (int n) {
|
|||
}
|
||||
}
|
||||
|
||||
/// @brief Converts alignment value to control
|
||||
int DialogStyleEditor::AlignToControl(int n) {
|
||||
switch (n) {
|
||||
case 7: return 0;
|
||||
|
|
|
@ -95,7 +95,7 @@ class DialogStyleEditor : public wxDialog {
|
|||
void OnCommandPreviewUpdate(wxCommandEvent &event);
|
||||
|
||||
void OnPreviewTextChange(wxCommandEvent &event);
|
||||
void OnPreviewColourChange(wxCommandEvent &event);
|
||||
void OnPreviewColourChange(wxThreadEvent &event);
|
||||
|
||||
/// @brief Maybe apply changes and maybe close the dialog
|
||||
/// @param apply Should changes be applied?
|
||||
|
|
Loading…
Reference in a new issue