2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_style_editor.cpp
|
|
|
|
/// @brief Style Editor dialogue box
|
|
|
|
/// @ingroup style_editor
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2011-10-10 21:30:11 +02:00
|
|
|
#include <algorithm>
|
2011-10-10 19:28:59 +02:00
|
|
|
|
2011-10-10 21:30:11 +02:00
|
|
|
#include <wx/bmpbuttn.h>
|
2006-04-04 22:41:09 +02:00
|
|
|
#include <wx/colordlg.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#include <wx/fontdlg.h>
|
2007-05-21 05:59:46 +02:00
|
|
|
#include <wx/fontenum.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
|
|
|
|
2006-12-17 21:16:22 +01:00
|
|
|
#include "ass_dialogue.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "ass_file.h"
|
2006-12-17 21:16:22 +01:00
|
|
|
#include "ass_override.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_style.h"
|
2007-07-27 08:14:38 +02:00
|
|
|
#include "ass_style_storage.h"
|
2011-10-10 19:28:48 +02:00
|
|
|
#include "colour_button.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "compat.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "dialog_style_editor.h"
|
2008-01-13 22:27:06 +01:00
|
|
|
#include "help_button.h"
|
2011-10-10 19:28:48 +02:00
|
|
|
#include "include/aegisub/context.h"
|
|
|
|
#include "include/aegisub/subtitles_provider.h"
|
2009-07-24 02:08:25 +02:00
|
|
|
#include "libresrc/libresrc.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "main.h"
|
2011-10-10 19:28:48 +02:00
|
|
|
#include "persist_location.h"
|
2010-12-08 04:36:10 +01:00
|
|
|
#include "selection_controller.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subs_grid.h"
|
|
|
|
#include "subs_preview.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "validators.h"
|
2007-04-17 01:41:06 +02:00
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
static void add_with_label(wxSizer *sizer, wxWindow *parent, wxString const& label, wxWindow *ctrl) {
|
|
|
|
sizer->Add(new wxStaticText(parent, -1, label), wxSizerFlags().Center().Right().Border(wxLEFT | wxRIGHT));
|
|
|
|
sizer->Add(ctrl, wxSizerFlags(1).Left().Expand());
|
|
|
|
}
|
|
|
|
|
|
|
|
static wxSpinCtrl *spin_ctrl(wxWindow *parent, float value, int max_value) {
|
|
|
|
return new wxSpinCtrl(parent, -1, AegiFloatToString(value), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 0, max_value, value);
|
|
|
|
}
|
2007-04-17 01:41:06 +02:00
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
static wxTextCtrl *num_text_ctrl(wxWindow *parent, double value, wxSize size = wxSize(70, 20)) {
|
2011-12-22 22:23:07 +01:00
|
|
|
return new wxTextCtrl(parent, -1, "", wxDefaultPosition, size, 0, NumValidator(value));
|
2011-10-10 19:28:59 +02:00
|
|
|
}
|
|
|
|
|
2011-10-18 00:00:58 +02:00
|
|
|
DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Context *c, AssStyleStorage *store, bool copy_style)
|
2011-10-10 19:28:59 +02:00
|
|
|
: wxDialog (parent, -1, _("Style Editor"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, "DialogStyleEditor")
|
2011-01-16 08:17:36 +01:00
|
|
|
, c(c)
|
2011-10-18 00:00:58 +02:00
|
|
|
, is_new(false)
|
2011-10-10 19:29:09 +02:00
|
|
|
, style(style)
|
2011-01-16 08:17:36 +01:00
|
|
|
, store(store)
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2011-10-18 00:00:58 +02:00
|
|
|
if (copy_style) {
|
|
|
|
is_new = true;
|
|
|
|
style = this->style = new AssStyle(*style);
|
2011-11-25 20:26:48 +01:00
|
|
|
style->name = wxString::Format(_("%s - Copy"), style->name);
|
2011-10-18 00:00:58 +02:00
|
|
|
}
|
|
|
|
else if (!style) {
|
|
|
|
is_new = true;
|
|
|
|
style = this->style = new AssStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
work.reset(new AssStyle(*style));
|
|
|
|
|
2009-07-25 06:49:59 +02:00
|
|
|
SetIcon(BitmapToIcon(GETIMAGE(style_toolbutton_24)));
|
2007-07-05 01:09:40 +02:00
|
|
|
|
2007-04-17 00:13:09 +02:00
|
|
|
// Prepare control values
|
2011-01-20 06:57:30 +01:00
|
|
|
wxString EncodingValue = AegiIntegerToString(style->encoding);
|
2011-10-10 19:28:59 +02:00
|
|
|
wxString alignValues[9] = { "7", "8", "9", "4", "5", "6", "1", "2", "3" };
|
2007-05-21 05:59:46 +02:00
|
|
|
wxArrayString fontList = wxFontEnumerator::GetFacenames();
|
|
|
|
fontList.Sort();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-04-17 00:13:09 +02:00
|
|
|
// Encoding options
|
|
|
|
wxArrayString encodingStrings;
|
|
|
|
AssStyle::GetEncodings(encodingStrings);
|
2007-09-24 19:04:13 +02:00
|
|
|
|
|
|
|
// Create sizers
|
2012-01-08 02:05:25 +01:00
|
|
|
wxSizer *NameSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Style Name"));
|
2007-09-24 19:04:13 +02:00
|
|
|
wxSizer *FontSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Font"));
|
2011-10-10 19:28:59 +02:00
|
|
|
wxSizer *ColorsSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Colors"));
|
|
|
|
wxSizer *MarginSizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Margins"));
|
|
|
|
wxSizer *OutlineBox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Outline"));
|
|
|
|
wxSizer *MiscBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Miscellaneous"));
|
|
|
|
wxSizer *PreviewBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Preview"));
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
// Create controls
|
2011-10-10 19:28:59 +02:00
|
|
|
StyleName = new wxTextCtrl(this, -1, style->name);
|
|
|
|
FontName = new wxComboBox(this, -1, style->font, wxDefaultPosition, wxSize(150, -1), 0, 0, wxCB_DROPDOWN);
|
|
|
|
FontSize = num_text_ctrl(this, style->fontsize, wxSize(50, -1));
|
2011-11-18 19:49:09 +01:00
|
|
|
BoxBold = new wxCheckBox(this, -1, _("&Bold"));
|
|
|
|
BoxItalic = new wxCheckBox(this, -1, _("&Italic"));
|
|
|
|
BoxUnderline = new wxCheckBox(this, -1, _("&Underline"));
|
|
|
|
BoxStrikeout = new wxCheckBox(this, -1, _("&Strikeout"));
|
2011-10-10 19:28:59 +02:00
|
|
|
colorButton[0] = new ColourButton(this, -1, wxSize(55, 16), style->primary.GetWXColor());
|
|
|
|
colorButton[1] = new ColourButton(this, -1, wxSize(55, 16), style->secondary.GetWXColor());
|
|
|
|
colorButton[2] = new ColourButton(this, -1, wxSize(55, 16), style->outline.GetWXColor());
|
|
|
|
colorButton[3] = new ColourButton(this, -1, wxSize(55, 16), style->shadow.GetWXColor());
|
|
|
|
colorAlpha[0] = spin_ctrl(this, style->primary.a, 255);
|
|
|
|
colorAlpha[1] = spin_ctrl(this, style->secondary.a, 255);
|
|
|
|
colorAlpha[2] = spin_ctrl(this, style->outline.a, 255);
|
|
|
|
colorAlpha[3] = spin_ctrl(this, style->shadow.a, 255);
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
margin[i] = spin_ctrl(this, style->Margin[i], 9999);
|
2007-05-22 07:53:08 +02:00
|
|
|
margin[3] = 0;
|
2011-10-10 19:28:59 +02:00
|
|
|
Alignment = new wxRadioBox(this, -1, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
|
|
|
|
Outline = num_text_ctrl(this, style->outline_w, wxSize(50, -1));
|
|
|
|
Shadow = num_text_ctrl(this, style->shadow_w, wxSize(50, -1));
|
2011-11-18 19:49:09 +01:00
|
|
|
OutlineType = new wxCheckBox(this, -1, _("&Opaque box"));
|
2011-10-10 19:28:59 +02:00
|
|
|
ScaleX = num_text_ctrl(this, style->scalex);
|
|
|
|
ScaleY = num_text_ctrl(this, style->scaley);
|
|
|
|
Angle = num_text_ctrl(this, style->angle);
|
|
|
|
Spacing = num_text_ctrl(this, style->spacing);
|
|
|
|
Encoding = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, encodingStrings, wxCB_READONLY);
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
// Set control tooltips
|
2012-02-07 02:22:32 +01:00
|
|
|
StyleName->SetToolTip(_("Style name"));
|
|
|
|
FontName->SetToolTip(_("Font face"));
|
|
|
|
FontSize->SetToolTip(_("Font size"));
|
|
|
|
colorButton[0]->SetToolTip(_("Choose primary color"));
|
|
|
|
colorButton[1]->SetToolTip(_("Choose secondary color"));
|
|
|
|
colorButton[2]->SetToolTip(_("Choose outline color"));
|
|
|
|
colorButton[3]->SetToolTip(_("Choose shadow color"));
|
|
|
|
for (int i=0;i<4;i++) colorAlpha[i]->SetToolTip(_("Set opacity, from 0 (opaque) to 255 (transparent)"));
|
|
|
|
margin[0]->SetToolTip(_("Distance from left edge, in pixels"));
|
|
|
|
margin[1]->SetToolTip(_("Distance from right edge, in pixels"));
|
|
|
|
margin[2]->SetToolTip(_("Distance from top/bottom edge, in pixels"));
|
|
|
|
OutlineType->SetToolTip(_("When selected, display an opaque box behind the subtitles instead of an outline around the text"));
|
|
|
|
Outline->SetToolTip(_("Outline width, in pixels"));
|
|
|
|
Shadow->SetToolTip(_("Shadow distance, in pixels"));
|
|
|
|
ScaleX->SetToolTip(_("Scale X, in percentage"));
|
|
|
|
ScaleY->SetToolTip(_("Scale Y, in percentage"));
|
|
|
|
Angle->SetToolTip(_("Angle to rotate in Z axis, in degrees"));
|
|
|
|
Encoding->SetToolTip(_("Encoding, only useful in unicode if the font doesn't have the proper unicode mapping"));
|
|
|
|
Spacing->SetToolTip(_("Character spacing, in pixels"));
|
|
|
|
Alignment->SetToolTip(_("Alignment in screen, in numpad style"));
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
// Set up controls
|
2006-01-16 22:02:54 +01:00
|
|
|
BoxBold->SetValue(style->bold);
|
|
|
|
BoxItalic->SetValue(style->italic);
|
|
|
|
BoxUnderline->SetValue(style->underline);
|
|
|
|
BoxStrikeout->SetValue(style->strikeout);
|
2007-04-17 00:13:09 +02:00
|
|
|
OutlineType->SetValue(style->borderstyle == 3);
|
|
|
|
Alignment->SetSelection(AlignToControl(style->alignment));
|
2007-06-06 23:42:32 +02:00
|
|
|
// Fill font face list box
|
|
|
|
FontName->Freeze();
|
|
|
|
for (size_t i = 0; i < fontList.size(); i++) {
|
|
|
|
FontName->Append(fontList[i]);
|
|
|
|
}
|
2008-07-16 14:10:00 +02:00
|
|
|
FontName->SetValue(style->font);
|
2007-06-06 23:42:32 +02:00
|
|
|
FontName->Thaw();
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
// Set encoding value
|
|
|
|
bool found = false;
|
|
|
|
for (size_t i=0;i<encodingStrings.Count();i++) {
|
2007-06-06 23:42:32 +02:00
|
|
|
if (encodingStrings[i].StartsWith(EncodingValue)) {
|
2007-04-17 00:13:09 +02:00
|
|
|
Encoding->Select(i);
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) Encoding->Select(0);
|
|
|
|
|
|
|
|
// Style name sizer
|
2011-10-10 19:28:59 +02:00
|
|
|
NameSizer->Add(StyleName, 1, wxALL, 0);
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
// Font sizer
|
|
|
|
wxSizer *FontSizerTop = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxSizer *FontSizerBottom = new wxBoxSizer(wxHORIZONTAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
FontSizerTop->Add(FontName, 1, wxALL, 0);
|
|
|
|
FontSizerTop->Add(FontSize, 0, wxLEFT, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
FontSizerBottom->AddStretchSpacer(1);
|
2011-10-10 19:28:59 +02:00
|
|
|
FontSizerBottom->Add(BoxBold, 0, 0, 0);
|
|
|
|
FontSizerBottom->Add(BoxItalic, 0, wxLEFT, 5);
|
|
|
|
FontSizerBottom->Add(BoxUnderline, 0, wxLEFT, 5);
|
|
|
|
FontSizerBottom->Add(BoxStrikeout, 0, wxLEFT, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
FontSizerBottom->AddStretchSpacer(1);
|
2011-10-10 19:28:59 +02:00
|
|
|
FontSizer->Add(FontSizerTop, 1, wxALL | wxEXPAND, 0);
|
|
|
|
FontSizer->Add(FontSizerBottom, 1, wxTOP | wxEXPAND, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-04-17 00:13:09 +02:00
|
|
|
// Colors sizer
|
2007-05-21 07:38:28 +02:00
|
|
|
wxSizer *ColorSizer[4];
|
|
|
|
wxString colorLabels[] = { _("Primary"), _("Secondary"), _("Outline"), _("Shadow") };
|
2006-01-16 22:02:54 +01:00
|
|
|
ColorsSizer->AddStretchSpacer(1);
|
2007-05-21 07:38:28 +02:00
|
|
|
for (int i=0;i<4;i++) {
|
|
|
|
ColorSizer[i] = new wxBoxSizer(wxVERTICAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
ColorSizer[i]->Add(new wxStaticText(this, -1, colorLabels[i]), 0, wxBOTTOM | wxALIGN_CENTER, 5);
|
|
|
|
ColorSizer[i]->Add(colorButton[i], 0, wxBOTTOM | wxALIGN_CENTER, 5);
|
|
|
|
ColorSizer[i]->Add(colorAlpha[i], 0, wxALIGN_CENTER, 0);
|
|
|
|
ColorsSizer->Add(ColorSizer[i], 0, wxLEFT, i?5:0);
|
2007-05-21 07:38:28 +02:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
ColorsSizer->AddStretchSpacer(1);
|
|
|
|
|
|
|
|
// Margins
|
2007-05-21 08:03:09 +02:00
|
|
|
wxString marginLabels[] = { _("Left"), _("Right"), _("Vert") };
|
2006-01-16 22:02:54 +01:00
|
|
|
MarginSizer->AddStretchSpacer(1);
|
2007-05-21 08:03:09 +02:00
|
|
|
wxSizer *marginSubSizer[3];
|
|
|
|
for (int i=0;i<3;i++) {
|
|
|
|
marginSubSizer[i] = new wxBoxSizer(wxVERTICAL);
|
|
|
|
marginSubSizer[i]->AddStretchSpacer(1);
|
2011-10-10 19:28:59 +02:00
|
|
|
marginSubSizer[i]->Add(new wxStaticText(this, -1, marginLabels[i]), 0, wxCENTER, 0);
|
|
|
|
marginSubSizer[i]->Add(margin[i], 0, wxTOP | wxCENTER, 5);
|
2007-05-21 08:03:09 +02:00
|
|
|
marginSubSizer[i]->AddStretchSpacer(1);
|
2011-10-10 19:28:59 +02:00
|
|
|
MarginSizer->Add(marginSubSizer[i], 0, wxEXPAND | wxLEFT, i?5:0);
|
2007-05-21 08:03:09 +02:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
MarginSizer->AddStretchSpacer(1);
|
|
|
|
|
|
|
|
// Margins+Alignment
|
|
|
|
wxSizer *MarginAlign = new wxBoxSizer(wxHORIZONTAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
MarginAlign->Add(MarginSizer, 1, wxLEFT | wxEXPAND, 0);
|
|
|
|
MarginAlign->Add(Alignment, 0, wxLEFT | wxEXPAND, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Outline
|
2011-10-10 19:28:59 +02:00
|
|
|
add_with_label(OutlineBox, this, _("Outline:"), Outline);
|
|
|
|
add_with_label(OutlineBox, this, _("Shadow:"), Shadow);
|
|
|
|
OutlineBox->Add(OutlineType, 0, wxLEFT | wxALIGN_CENTER, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Misc
|
2011-10-10 19:28:59 +02:00
|
|
|
wxFlexGridSizer *MiscBoxTop = new wxFlexGridSizer(2, 4, 5, 5);
|
|
|
|
add_with_label(MiscBoxTop, this, _("Scale X%:"), ScaleX);
|
|
|
|
add_with_label(MiscBoxTop, this, _("Scale Y%:"), ScaleY);
|
|
|
|
add_with_label(MiscBoxTop, this, _("Rotation:"), Angle);
|
|
|
|
add_with_label(MiscBoxTop, this, _("Spacing:"), Spacing);
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
wxSizer *MiscBoxBottom = new wxBoxSizer(wxHORIZONTAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
add_with_label(MiscBoxBottom, this, _("Encoding:"), Encoding);
|
|
|
|
|
|
|
|
MiscBox->Add(MiscBoxTop, wxSizerFlags().Expand().Center());
|
|
|
|
MiscBox->Add(MiscBoxBottom, wxSizerFlags().Expand().Center().Border(wxTOP));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-04-16 17:08:09 +02:00
|
|
|
// Preview
|
2007-06-06 23:27:42 +02:00
|
|
|
SubsPreview = NULL;
|
|
|
|
PreviewText = NULL;
|
2011-10-10 19:29:17 +02:00
|
|
|
ColourButton *previewButton = 0;
|
2010-08-02 08:31:38 +02:00
|
|
|
if (!SubtitlesProviderFactory::GetClasses().empty()) {
|
2011-10-10 19:28:59 +02:00
|
|
|
PreviewText = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
|
|
|
|
previewButton = new ColourButton(this, -1, wxSize(45, 16), lagi_wxColour(OPT_GET("Colour/Style Editor/Background/Preview")->GetColour()));
|
|
|
|
SubsPreview = new SubtitlesPreview(this, -1, wxDefaultPosition, wxSize(100, 60), wxSUNKEN_BORDER, lagi_wxColour(OPT_GET("Colour/Style Editor/Background/Preview")->GetColour()));
|
2007-06-03 06:54:38 +02:00
|
|
|
|
2012-02-07 02:22:32 +01:00
|
|
|
SubsPreview->SetToolTip(_("Preview of current style"));
|
2010-06-11 04:25:34 +02:00
|
|
|
SubsPreview->SetStyle(*style);
|
2007-06-03 06:54:38 +02:00
|
|
|
SubsPreview->SetText(PreviewText->GetValue());
|
2012-02-07 02:22:32 +01:00
|
|
|
PreviewText->SetToolTip(_("Text to be used for the preview"));
|
|
|
|
previewButton->SetToolTip(_("Colour of preview background"));
|
2007-06-03 06:54:38 +02:00
|
|
|
|
|
|
|
wxSizer *PreviewBottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
PreviewBottomSizer->Add(PreviewText, 1, wxEXPAND | wxRIGHT, 5);
|
|
|
|
PreviewBottomSizer->Add(previewButton, 0, wxEXPAND, 0);
|
|
|
|
PreviewBox->Add(SubsPreview, 1, wxEXPAND | wxBOTTOM, 5);
|
|
|
|
PreviewBox->Add(PreviewBottomSizer, 0, wxEXPAND | wxBOTTOM, 0);
|
2007-06-03 06:54:38 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
wxStaticText *NoSP = new wxStaticText(this, -1, _("No subtitle providers available. Cannot preview subs."));
|
|
|
|
PreviewBox->AddStretchSpacer();
|
2011-10-10 19:28:59 +02:00
|
|
|
PreviewBox->Add(NoSP, 1, wxEXPAND|wxLEFT|wxRIGHT, 8);
|
2007-06-03 06:54:38 +02:00
|
|
|
PreviewBox->AddStretchSpacer();
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Buttons
|
2011-10-10 19:28:59 +02:00
|
|
|
wxStdDialogButtonSizer *ButtonSizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxAPPLY | wxHELP);
|
2007-06-03 06:54:38 +02:00
|
|
|
|
2007-04-16 06:26:42 +02:00
|
|
|
// Left side sizer
|
|
|
|
wxSizer *LeftSizer = new wxBoxSizer(wxVERTICAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
LeftSizer->Add(NameSizer, 0, wxBOTTOM | wxEXPAND, 5);
|
|
|
|
LeftSizer->Add(FontSizer, 0, wxBOTTOM | wxEXPAND, 5);
|
|
|
|
LeftSizer->Add(ColorsSizer, 0, wxBOTTOM | wxEXPAND, 5);
|
|
|
|
LeftSizer->Add(MarginAlign, 0, wxBOTTOM | wxEXPAND, 0);
|
2007-04-16 06:26:42 +02:00
|
|
|
|
|
|
|
// Right side sizer
|
|
|
|
wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
RightSizer->Add(OutlineBox, wxSizerFlags().Expand().Border(wxBOTTOM));
|
|
|
|
RightSizer->Add(MiscBox, wxSizerFlags().Expand().Border(wxBOTTOM));
|
|
|
|
RightSizer->Add(PreviewBox, wxSizerFlags(1).Expand());
|
2007-04-16 06:26:42 +02:00
|
|
|
|
|
|
|
// Controls Sizer
|
|
|
|
wxSizer *ControlSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
ControlSizer->Add(LeftSizer, 0, wxEXPAND, 0);
|
|
|
|
ControlSizer->Add(RightSizer, 1, wxLEFT | wxEXPAND, 5);
|
2007-04-16 06:26:42 +02:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// General Layout
|
2011-10-10 19:29:17 +02:00
|
|
|
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
2011-10-10 19:28:59 +02:00
|
|
|
MainSizer->Add(ControlSizer, 1, wxALL | wxALIGN_CENTER | wxEXPAND, 5);
|
|
|
|
MainSizer->Add(ButtonSizer, 0, wxBOTTOM | wxEXPAND, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
SetSizerAndFit(MainSizer);
|
2011-10-10 19:28:48 +02:00
|
|
|
|
|
|
|
persist.reset(new PersistLocation(this, "Tool/Style Editor"));
|
2011-10-10 19:28:59 +02:00
|
|
|
|
|
|
|
Bind(wxEVT_CHILD_FOCUS, &DialogStyleEditor::OnChildFocus, this);
|
|
|
|
|
|
|
|
if (PreviewText) {
|
|
|
|
Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
|
|
|
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);
|
|
|
|
FontName->Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogStyleEditor::OnCommandPreviewUpdate, this);
|
|
|
|
PreviewText->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogStyleEditor::OnPreviewTextChange, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&DialogStyleEditor::Apply, this, true, true), wxID_OK);
|
|
|
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&DialogStyleEditor::Apply, this, true, false), wxID_APPLY);
|
|
|
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&DialogStyleEditor::Apply, this, false, true), wxID_CANCEL);
|
|
|
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&HelpButton::OpenPage, "Style Editor"), wxID_HELP);
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; ++i)
|
2011-10-10 19:29:17 +02:00
|
|
|
colorButton[i]->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&DialogStyleEditor::OnSetColor, this, i + 1, std::tr1::placeholders::_1));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-10-18 00:00:58 +02:00
|
|
|
DialogStyleEditor::~DialogStyleEditor() {
|
|
|
|
if (is_new)
|
|
|
|
delete style;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
/// @brief Update appearances of a renamed style in \r tags
|
2011-10-18 00:00:58 +02:00
|
|
|
static void ReplaceStyle(wxString tag, int, AssOverrideParameter* param, void *userData) {
|
2006-12-17 21:16:22 +01:00
|
|
|
wxArrayString strings = *((wxArrayString*)userData);
|
2011-10-10 19:28:59 +02:00
|
|
|
if (tag == "\\r" && param->GetType() == VARDATA_TEXT && param->Get<wxString>() == strings[0]) {
|
|
|
|
param->Set(strings[1]);
|
2006-12-17 21:16:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-18 00:00:58 +02:00
|
|
|
void DialogStyleEditor::Apply(bool apply, bool close) {
|
2006-01-16 22:02:54 +01:00
|
|
|
if (apply) {
|
2006-12-17 21:16:22 +01:00
|
|
|
wxString newStyleName = StyleName->GetValue();
|
2006-12-17 21:30:59 +01:00
|
|
|
|
2007-07-27 08:14:38 +02:00
|
|
|
// Get list of existing styles
|
2011-10-18 00:00:58 +02:00
|
|
|
wxArrayString styles = store ? store->GetNames() : c->ass->GetStyles();
|
2007-07-27 08:14:38 +02:00
|
|
|
|
2006-12-17 21:30:59 +01:00
|
|
|
// Check if style name is unique
|
|
|
|
for (unsigned int i=0;i<styles.Count();i++) {
|
2009-07-18 05:45:16 +02:00
|
|
|
if (newStyleName.CmpNoCase(styles[i]) == 0) {
|
2011-10-18 00:00:58 +02:00
|
|
|
if ((store && store->GetStyle(styles[i]) != style) || c->ass->GetStyle(styles[i]) != style) {
|
2011-10-10 19:28:59 +02:00
|
|
|
wxMessageBox("There is already a style with this name. Please choose another name.", "Style name conflict.", wxICON_ERROR|wxOK);
|
2007-04-08 02:21:56 +02:00
|
|
|
return;
|
2006-12-17 21:30:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Style name change
|
2011-09-15 07:16:32 +02:00
|
|
|
bool did_rename = false;
|
2007-03-18 02:20:25 +01:00
|
|
|
if (work->name != newStyleName) {
|
2012-02-07 21:42:44 +01:00
|
|
|
if (!store && !is_new) {
|
2007-03-18 02:20:25 +01:00
|
|
|
// See if user wants to update style name through script
|
2011-10-18 00:00:58 +02:00
|
|
|
int answer = wxMessageBox(_("Do you want to change all instances of this style in the script to this new name?"), _("Update script?"), wxYES_NO | wxCANCEL);
|
2007-03-18 02:20:25 +01:00
|
|
|
|
|
|
|
if (answer == wxCANCEL) return;
|
|
|
|
|
|
|
|
if (answer == wxYES) {
|
2011-09-15 07:16:32 +02:00
|
|
|
did_rename = true;
|
2011-01-16 08:17:36 +01:00
|
|
|
int n = c->subsGrid->GetRows();
|
2007-03-18 02:20:25 +01:00
|
|
|
wxArrayString strings;
|
|
|
|
strings.Add(work->name);
|
|
|
|
strings.Add(newStyleName);
|
|
|
|
for (int i=0;i<n;i++) {
|
2011-01-16 08:17:36 +01:00
|
|
|
AssDialogue *curDiag = c->subsGrid->GetDialogue(i);
|
2007-03-18 02:20:25 +01:00
|
|
|
if (curDiag->Style == work->name) curDiag->Style = newStyleName;
|
|
|
|
curDiag->ParseASSTags();
|
2011-10-10 19:28:59 +02:00
|
|
|
curDiag->ProcessParameters(ReplaceStyle, &strings);
|
2007-03-18 02:20:25 +01:00
|
|
|
curDiag->UpdateText();
|
|
|
|
curDiag->ClearBlocks();
|
|
|
|
}
|
2006-12-17 21:16:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
work->name = newStyleName;
|
|
|
|
}
|
|
|
|
|
2007-04-17 01:41:06 +02:00
|
|
|
UpdateWorkStyle();
|
2006-04-20 01:47:41 +02:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
*style = *work;
|
|
|
|
style->UpdateData();
|
2011-10-18 00:00:58 +02:00
|
|
|
if (is_new) {
|
|
|
|
if (store)
|
|
|
|
store->style.push_back(style);
|
|
|
|
else
|
|
|
|
c->ass->InsertStyle(style);
|
|
|
|
is_new = false;
|
|
|
|
}
|
|
|
|
if (!store)
|
2011-09-15 07:16:32 +02:00
|
|
|
c->ass->Commit(_("style change"), AssFile::COMMIT_STYLES | (did_rename ? AssFile::COMMIT_DIAG_FULL : 0));
|
2007-04-16 06:26:42 +02:00
|
|
|
|
|
|
|
// Update preview
|
2011-10-10 19:28:59 +02:00
|
|
|
if (!close && SubsPreview) SubsPreview->SetStyle(*style);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
if (close) {
|
|
|
|
EndModal(apply);
|
|
|
|
if (PreviewText)
|
|
|
|
OPT_SET("Tool/Style Editor/Preview Text")->SetString(STD_STR(PreviewText->GetValue()));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Update work style
|
2007-04-17 01:41:06 +02:00
|
|
|
void DialogStyleEditor::UpdateWorkStyle() {
|
|
|
|
work->font = FontName->GetValue();
|
|
|
|
FontSize->GetValue().ToDouble(&(work->fontsize));
|
|
|
|
|
|
|
|
ScaleX->GetValue().ToDouble(&(work->scalex));
|
|
|
|
ScaleY->GetValue().ToDouble(&(work->scaley));
|
|
|
|
|
|
|
|
long templ = 0;
|
2011-10-10 19:28:59 +02:00
|
|
|
Encoding->GetValue().BeforeFirst('-').ToLong(&templ);
|
2007-04-17 01:41:06 +02:00
|
|
|
work->encoding = templ;
|
|
|
|
|
|
|
|
Angle->GetValue().ToDouble(&(work->angle));
|
|
|
|
Spacing->GetValue().ToDouble(&(work->spacing));
|
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
work->borderstyle = OutlineType->IsChecked() ? 3 : 1;
|
2007-04-17 01:41:06 +02:00
|
|
|
|
|
|
|
Shadow->GetValue().ToDouble(&(work->shadow_w));
|
|
|
|
Outline->GetValue().ToDouble(&(work->outline_w));
|
|
|
|
|
|
|
|
work->alignment = ControlToAlign(Alignment->GetSelection());
|
|
|
|
|
2011-10-10 19:28:59 +02:00
|
|
|
for (int i=0;i<3;i++)
|
|
|
|
work->Margin[i] = margin[i]->GetValue();
|
2007-05-21 08:03:09 +02:00
|
|
|
work->Margin[3] = margin[2]->GetValue();
|
2007-04-17 01:41:06 +02:00
|
|
|
|
2007-05-21 07:38:28 +02:00
|
|
|
work->primary.a = colorAlpha[0]->GetValue();
|
|
|
|
work->secondary.a = colorAlpha[1]->GetValue();
|
|
|
|
work->outline.a = colorAlpha[2]->GetValue();
|
|
|
|
work->shadow.a = colorAlpha[3]->GetValue();
|
2007-04-17 01:41:06 +02:00
|
|
|
|
|
|
|
work->bold = BoxBold->IsChecked();
|
|
|
|
work->italic = BoxItalic->IsChecked();
|
|
|
|
work->underline = BoxUnderline->IsChecked();
|
|
|
|
work->strikeout = BoxStrikeout->IsChecked();
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Sets color for one of the four color buttons
|
2011-10-10 19:28:59 +02:00
|
|
|
/// @param n Colour to set
|
2011-10-10 19:29:17 +02:00
|
|
|
void DialogStyleEditor::OnSetColor (int n, wxCommandEvent& evt) {
|
|
|
|
ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData());
|
|
|
|
if (!btn) {
|
|
|
|
evt.Skip();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
AssColor *modify;
|
|
|
|
switch (n) {
|
|
|
|
case 1: modify = &work->primary; break;
|
|
|
|
case 2: modify = &work->secondary; break;
|
|
|
|
case 3: modify = &work->outline; break;
|
|
|
|
case 4: modify = &work->shadow; break;
|
2011-10-10 19:28:59 +02:00
|
|
|
default: throw agi::InternalError("attempted setting colour id outside range", 0);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
2011-10-10 19:29:17 +02:00
|
|
|
modify->SetWXColor(btn->GetColour());
|
|
|
|
if (SubsPreview)
|
|
|
|
SubsPreview->SetStyle(*work);
|
2007-04-17 01:41:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void DialogStyleEditor::OnChildFocus (wxChildFocusEvent &event) {
|
|
|
|
UpdateWorkStyle();
|
2011-10-10 19:28:59 +02:00
|
|
|
if (SubsPreview)
|
|
|
|
SubsPreview->SetStyle(*work);
|
2007-04-17 01:41:06 +02:00
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) {
|
2011-10-10 19:28:59 +02:00
|
|
|
SubsPreview->SetText(PreviewText->GetValue());
|
|
|
|
event.Skip();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Change colour of preview's background
|
2011-10-10 19:29:17 +02:00
|
|
|
void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &evt) {
|
|
|
|
ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData());
|
|
|
|
if (!btn)
|
|
|
|
evt.Skip();
|
|
|
|
else {
|
|
|
|
SubsPreview->SetColour(btn->GetColour());
|
|
|
|
OPT_SET("Colour/Style Editor/Background/Preview")->SetColour(STD_STR(btn->GetColour().GetAsString(wxC2S_CSS_SYNTAX)));
|
|
|
|
}
|
2007-05-21 06:53:14 +02:00
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Command event to update preview
|
2007-04-17 01:59:38 +02:00
|
|
|
void DialogStyleEditor::OnCommandPreviewUpdate (wxCommandEvent &event) {
|
2007-05-22 07:53:08 +02:00
|
|
|
if (!IsShownOnScreen()) return;
|
2007-04-17 01:59:38 +02:00
|
|
|
UpdateWorkStyle();
|
2011-10-10 19:28:59 +02:00
|
|
|
SubsPreview->SetStyle(*work);
|
2007-04-17 01:59:38 +02:00
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Converts control value to alignment
|
2006-01-16 22:02:54 +01:00
|
|
|
int DialogStyleEditor::ControlToAlign (int n) {
|
|
|
|
switch (n) {
|
|
|
|
case 0: return 7;
|
|
|
|
case 1: return 8;
|
|
|
|
case 2: return 9;
|
|
|
|
case 3: return 4;
|
|
|
|
case 4: return 5;
|
|
|
|
case 5: return 6;
|
|
|
|
case 6: return 1;
|
|
|
|
case 7: return 2;
|
|
|
|
case 8: return 3;
|
|
|
|
default: return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Converts alignment value to control
|
2006-01-16 22:02:54 +01:00
|
|
|
int DialogStyleEditor::AlignToControl (int n) {
|
|
|
|
switch (n) {
|
|
|
|
case 7: return 0;
|
|
|
|
case 8: return 1;
|
|
|
|
case 9: return 2;
|
|
|
|
case 4: return 3;
|
|
|
|
case 5: return 4;
|
|
|
|
case 6: return 5;
|
|
|
|
case 1: return 6;
|
|
|
|
case 2: return 7;
|
|
|
|
case 3: return 8;
|
|
|
|
default: return 7;
|
|
|
|
}
|
|
|
|
}
|