Mostly rewrite the kanji timer. Now using a custom control that avoids most of the problems the old implementation using text-boxes had. The new implementation unifies the pre-grouping and post-grouping display into one.
The auto-matching algorithm for Japanese was also rewritten, I think the new code works somewhat better. (For the song I used for testing, I can just hit Enter most of the way through, more than I remember being able to with the old.) There are some slight oddities with the way the display scrolls when the input goes too close to the edge, but while it can feel confusing it should still keep everything you want to see, visible. Fixes #847 and #708. Originally committed to SVN as r3032.
This commit is contained in:
parent
bcd7e64bbd
commit
4f3569b7d9
2 changed files with 796 additions and 470 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2006-2007, Dan Donovan (Dansolo)
|
||||
// Copyright (c) 2006-2009, Dan Donovan (Dansolo), Niels Martin Hansen
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -49,31 +49,30 @@
|
|||
#include <vector>
|
||||
#include "options.h"
|
||||
#include "kana_table.h"
|
||||
#include "ass_file.h"
|
||||
#include "ass_entry.h"
|
||||
|
||||
|
||||
//////////////
|
||||
// Prototypes
|
||||
class SubtitlesGrid;
|
||||
class AssOverrideParameter;
|
||||
class KaraokeLineMatchDisplay;
|
||||
|
||||
|
||||
/////////
|
||||
// Class
|
||||
class DialogKanjiTimer : public wxDialog {
|
||||
private:
|
||||
SubtitlesGrid *grid;
|
||||
AssFile *subs;
|
||||
|
||||
wxTextCtrl *SourceText, *DestText;
|
||||
KaraokeLineMatchDisplay *display;
|
||||
wxComboBox *SourceStyle, *DestStyle;
|
||||
wxListCtrl *GroupsList;
|
||||
wxCheckBox *Interpolate;
|
||||
|
||||
wxString TextBeforeKaraoke;
|
||||
wxString *RegroupSourceText, *RegroupGroups;
|
||||
std::vector<std::pair<int,wxString> > LinesToChange;
|
||||
int *RegroupSourceKLengths;
|
||||
int RegroupSourceSelected, RegroupTotalLen;
|
||||
int SourceIndex, DestIndex;
|
||||
std::vector<std::pair<entryIter,wxString> > LinesToChange;
|
||||
entryIter currentSourceLine;
|
||||
entryIter currentDestinationLine;
|
||||
|
||||
void OnClose(wxCommandEvent &event);
|
||||
void OnStart(wxCommandEvent &event);
|
||||
|
@ -83,30 +82,17 @@ private:
|
|||
void OnSkipDest(wxCommandEvent &event);
|
||||
void OnGoBack(wxCommandEvent &event);
|
||||
void OnAccept(wxCommandEvent &event);
|
||||
int ListIndexFromStyleandIndex(wxString StyleName, int Occurance);
|
||||
int GetSourceArrayPos(bool GoingDown);
|
||||
inline void OnKeyEnter(wxCommandEvent &event);
|
||||
inline void SetSelected();
|
||||
|
||||
void ResetForNewLine();
|
||||
void TryAutoMatch();
|
||||
|
||||
entryIter FindNextStyleMatch(entryIter search_from, const wxString &search_style);
|
||||
entryIter FindPrevStyleMatch(entryIter search_from, const wxString &search_style);
|
||||
|
||||
public:
|
||||
DialogKanjiTimer(wxWindow *parent, SubtitlesGrid *grid);
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
inline void OnMouseEvent(wxMouseEvent &event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
/////////////////
|
||||
// Event handler
|
||||
class DialogKanjiTimerEvent : public wxEvtHandler {
|
||||
private:
|
||||
DialogKanjiTimer *control;
|
||||
void KeyHandler(wxKeyEvent &event);
|
||||
void MouseHandler(wxMouseEvent &event);
|
||||
|
||||
public:
|
||||
DialogKanjiTimerEvent(DialogKanjiTimer *control);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@ -114,7 +100,7 @@ public:
|
|||
///////
|
||||
// IDs
|
||||
enum {
|
||||
BUTTON_KTSTART,
|
||||
BUTTON_KTSTART = 2500,
|
||||
BUTTON_KTLINK,
|
||||
BUTTON_KTUNLINK,
|
||||
BUTTON_KTSKIPSOURCE,
|
||||
|
|
Loading…
Reference in a new issue