Added a hiragana/katakana table class

Originally committed to SVN as r360.
This commit is contained in:
Rodrigo Braz Monteiro 2006-05-05 18:52:09 +00:00
parent f5d989c554
commit c8d77b16ef
7 changed files with 223 additions and 5 deletions

View file

@ -684,6 +684,7 @@ void FrameMain::SetDisplayMode(int mode) {
UpdateToolbar();
videoBox->VideoSizer->Layout();
MainSizer->Layout();
Layout();
//int cw,ch;
//GetSize(&cw,&ch);
//SetSize(cw-1,ch-1);
@ -1039,7 +1040,7 @@ void FrameMain::StatusTimeout(wxString text,int ms) {
///////////////////////////
// Setup accelerator table
void FrameMain::SetAccelerators() {
wxAcceleratorEntry entry[8];
wxAcceleratorEntry entry[9];
entry[0] = Hotkeys.GetAccelerator(_T("Video global prev frame"),Video_Prev_Frame);
entry[1] = Hotkeys.GetAccelerator(_T("Video global next frame"),Video_Next_Frame);
entry[2] = Hotkeys.GetAccelerator(_T("Video global focus seek"),Video_Focus_Seek);
@ -1048,7 +1049,10 @@ void FrameMain::SetAccelerators() {
entry[5] = Hotkeys.GetAccelerator(_T("Save Subtitles Alt"),Menu_File_Save_Subtitles);
entry[6] = Hotkeys.GetAccelerator(_T("Video global zoom in"),Menu_Video_Zoom_In);
entry[7] = Hotkeys.GetAccelerator(_T("Video global zoom out"),Menu_Video_Zoom_Out);
wxAcceleratorTable table(8,entry);
wxAcceleratorEntry temp;
temp.Set(wxACCEL_CTRL | wxACCEL_ALT,WXK_F12,Kana_Game);
entry[8] = temp;
wxAcceleratorTable table(9,entry);
SetAcceleratorTable(table);
}

View file

@ -204,6 +204,8 @@ private:
void OnPrevLine(wxCommandEvent &event);
void OnToggleTags(wxCommandEvent &event);
void OnKanaGame(wxCommandEvent &event);
void LoadVideo(wxString filename,bool autoload=false);
void LoadAudio(wxString filename,bool FromVideo=false);
void LoadVFR(wxString filename);
@ -358,6 +360,8 @@ enum {
Video_Track_Link_File,
Video_Track_Movement_Empty,
Kana_Game,
Menu_File_Recent = 2000,
Menu_Video_Recent = 2200,
Menu_Audio_Recent = 2400

View file

@ -197,6 +197,8 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
EVT_MENU(Grid_Next_Line,FrameMain::OnNextLine)
EVT_MENU(Grid_Prev_Line,FrameMain::OnPrevLine)
EVT_MENU(Grid_Toggle_Tags,FrameMain::OnToggleTags)
EVT_MENU(Kana_Game, FrameMain::OnKanaGame)
END_EVENT_TABLE()
@ -1249,3 +1251,9 @@ void FrameMain::OnViewSubs (wxCommandEvent &event) {
SetDisplayMode(0);
}
/////////////
// Kana game
void FrameMain::OnKanaGame(wxCommandEvent &event) {
wxMessageBox(_T("TODO"));
}

133
core/kana_table.cpp Normal file
View file

@ -0,0 +1,133 @@
// Copyright (c) 2006, 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.
//
// -----------------------------------------------------------------------------
//
// AEGISUB
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
///////////
// Headers
#include "kana_table.h"
///////////////
// Constructor
KanaTable::KanaTable() {
Insert(L"",L"",L"a");
Insert(L"",L"",L"i");
Insert(L"",L"",L"u");
Insert(L"",L"",L"e");
Insert(L"",L"",L"o");
Insert(L"",L"",L"sa");
Insert(L"",L"",L"shi");
Insert(L"",L"",L"su");
Insert(L"",L"",L"se");
Insert(L"",L"",L"so");
Insert(L"",L"",L"ta");
Insert(L"",L"",L"chi");
Insert(L"",L"",L"tsu");
Insert(L"",L"",L"te");
Insert(L"",L"",L"to");
Insert(L"",L"",L"na");
Insert(L"",L"",L"ni");
Insert(L"",L"",L"nu");
Insert(L"",L"",L"ne");
Insert(L"",L"",L"no");
Insert(L"",L"",L"ha");
Insert(L"",L"",L"hi");
Insert(L"",L"",L"fu");
Insert(L"",L"",L"he");
Insert(L"",L"",L"ho");
Insert(L"",L"",L"ma");
Insert(L"",L"",L"mi");
Insert(L"",L"",L"mu");
Insert(L"",L"",L"me");
Insert(L"",L"",L"mo");
Insert(L"",L"",L"ya");
Insert(L"",L"",L"yu");
Insert(L"",L"",L"yo");
Insert(L"",L"",L"ra");
Insert(L"",L"",L"ri");
Insert(L"",L"",L"ru");
Insert(L"",L"",L"re");
Insert(L"",L"",L"ro");
Insert(L"",L"",L"wa");
Insert(L"",L"",L"wo");
Insert(L"",L"",L"n");
Insert(L"",L"",L"ga");
Insert(L"",L"",L"gi");
Insert(L"",L"",L"gu");
Insert(L"",L"",L"ge");
Insert(L"",L"",L"go");
Insert(L"",L"",L"za");
Insert(L"",L"",L"ji");
Insert(L"",L"",L"zu");
Insert(L"",L"",L"ze");
Insert(L"",L"",L"zo");
Insert(L"",L"",L"da");
Insert(L"",L"",L"di");
Insert(L"",L"",L"du");
Insert(L"",L"",L"de");
Insert(L"",L"",L"do");
Insert(L"",L"",L"ba");
Insert(L"",L"",L"bi");
Insert(L"",L"",L"bu");
Insert(L"",L"",L"be");
Insert(L"",L"",L"bo");
Insert(L"",L"",L"pa");
Insert(L"",L"",L"pi");
Insert(L"",L"",L"pu");
Insert(L"",L"",L"pe");
Insert(L"",L"",L"po");
}
//////////
// Insert
void KanaTable::Insert(wchar_t *hira,wchar_t *kata,wchar_t *hep) {
#ifdef _UNICODE
entries.push_back(KanaEntry(hira,kata,hep));
#endif
}

69
core/kana_table.h Normal file
View file

@ -0,0 +1,69 @@
// Copyright (c) 2006, 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.
//
// -----------------------------------------------------------------------------
//
// AEGISUB
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
///////////
// Headers
#include <list>
#include <wx/wxprec.h>
///////////////////////////
// Hiragana/katakana entry
class KanaEntry {
public:
wxString hiragana;
wxString katakana;
wxString hepburn;
KanaEntry(wxString hira,wxString kata,wxString hep) {
hiragana = hira;
katakana = kata;
hepburn = hep;
}
};
///////////////////////////
// Hiragana/Katakana table
class KanaTable {
private:
std::list<KanaEntry> entries;
void Insert(wchar_t *hira,wchar_t *kata,wchar_t *hep);
public:
KanaTable();
~KanaTable();
};

View file

@ -1,4 +1,4 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro
// Copyright (c) 2005-2006, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without

View file

@ -78,7 +78,7 @@ VideoBox::VideoBox(wxPanel *parent) {
VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs."));
// Display
videoDisplay = new VideoDisplay(videoPage,-1,wxDefaultPosition,wxSize(20,20),wxSUNKEN_BORDER,_T("VideoBox"));
videoDisplay = new VideoDisplay(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER,_T("VideoBox"));
videoDisplay->ControlSlider = videoSlider;
videoDisplay->PositionDisplay = VideoPosition;
videoDisplay->SubsPosition = VideoSubsPos;
@ -101,7 +101,7 @@ VideoBox::VideoBox(wxPanel *parent) {
videoBottomSizer->Add(VideoPosition,1,wxLEFT|wxALIGN_CENTER,5);
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
VideoSizer = new wxBoxSizer(wxVERTICAL);
VideoSizer->Add(videoDisplay,0,wxEXPAND,0);
VideoSizer->Add(videoDisplay,1,wxEXPAND,0);
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);
VideoSizer->Add(videoBottomSizer,0,wxEXPAND,0);
}