Kill AssDialogue::GetMarginString

It didn't actually make the calling code any shorter or simpler.
This commit is contained in:
Thomas Goyne 2013-07-04 16:09:12 -07:00
parent bb83193253
commit ce23d72399
4 changed files with 4 additions and 18 deletions

View file

@ -269,11 +269,6 @@ void AssDialogue::UpdateText(boost::ptr_vector<AssDialogueBlock>& blocks) {
Text = join(blocks | transformed(get_text), "");
}
std::string AssDialogue::GetMarginString(int which) const {
if (which < 0 || which > 2) throw InvalidMarginIdError();
return std::to_string(Margin[which]);
}
bool AssDialogue::CollidesWith(const AssDialogue *target) const {
if (!target) return false;
return ((Start < target->Start) ? (target->Start < End) : (Start < target->End));

View file

@ -169,9 +169,6 @@ public:
void UpdateText(boost::ptr_vector<AssDialogueBlock>& blocks);
const std::string GetEntryData() const override;
/// @brief Get a margin
/// @param which 0 = left, 1 = right, 2 = vertical
std::string GetMarginString(int which) const;
/// Get the line as SSA rather than ASS
std::string GetSSAText() const override;
/// Does this line collide with the passed line?
@ -184,9 +181,3 @@ public:
AssDialogue(std::string const& data);
~AssDialogue();
};
class InvalidMarginIdError : public agi::InternalError {
public:
InvalidMarginIdError() : InternalError("Invalid margin id", 0) { }
const char *GetName() const { return "internal_error/invalid_margin_id"; }
};

View file

@ -597,9 +597,9 @@ void BaseGrid::GetRowStrings(int row, AssDialogue *line, bool *paint_columns, wx
if (paint_columns[4]) strings[4] = to_wx(line->Style);
if (paint_columns[5]) strings[5] = to_wx(line->Actor);
if (paint_columns[6]) strings[6] = to_wx(line->Effect);
if (paint_columns[7]) strings[7] = to_wx(line->GetMarginString(0));
if (paint_columns[8]) strings[8] = to_wx(line->GetMarginString(1));
if (paint_columns[9]) strings[9] = to_wx(line->GetMarginString(2));
if (paint_columns[7]) strings[7] = std::to_wstring(line->Margin[0]);
if (paint_columns[8]) strings[8] = std::to_wstring(line->Margin[1]);
if (paint_columns[9]) strings[9] = std::to_wstring(line->Margin[2]);
if (paint_columns[10]) {
strings[10].clear();

View file

@ -328,7 +328,7 @@ void SubsEditBox::OnCommit(int type) {
if (type & AssFile::COMMIT_DIAG_META) {
layer->SetValue(line->Layer);
for (size_t i = 0; i < margin.size(); ++i)
change_value(margin[i], to_wx(line->GetMarginString(i)));
change_value(margin[i], std::to_wstring(line->Margin[i]));
comment_box->SetValue(line->Comment);
style_box->Select(style_box->FindString(to_wx(line->Style)));