From c8d77b16ef41af3a4068997a6d98bce4bb350d2c Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Fri, 5 May 2006 18:52:09 +0000 Subject: [PATCH] Added a hiragana/katakana table class Originally committed to SVN as r360. --- core/frame_main.cpp | 8 ++- core/frame_main.h | 4 ++ core/frame_main_events.cpp | 8 +++ core/kana_table.cpp | 133 +++++++++++++++++++++++++++++++++++++ core/kana_table.h | 69 +++++++++++++++++++ core/utils.cpp | 2 +- core/video_box.cpp | 4 +- 7 files changed, 223 insertions(+), 5 deletions(-) create mode 100644 core/kana_table.cpp create mode 100644 core/kana_table.h diff --git a/core/frame_main.cpp b/core/frame_main.cpp index d55ca01cb..af0107826 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -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); } diff --git a/core/frame_main.h b/core/frame_main.h index 9aea46b26..ce039d847 100644 --- a/core/frame_main.h +++ b/core/frame_main.h @@ -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 diff --git a/core/frame_main_events.cpp b/core/frame_main_events.cpp index 5816b47ad..052582643 100644 --- a/core/frame_main_events.cpp +++ b/core/frame_main_events.cpp @@ -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")); +} diff --git a/core/kana_table.cpp b/core/kana_table.cpp new file mode 100644 index 000000000..e64647b87 --- /dev/null +++ b/core/kana_table.cpp @@ -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 +} diff --git a/core/kana_table.h b/core/kana_table.h new file mode 100644 index 000000000..d2be47e82 --- /dev/null +++ b/core/kana_table.h @@ -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 +#include + + +/////////////////////////// +// 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 entries; + void Insert(wchar_t *hira,wchar_t *kata,wchar_t *hep); + +public: + KanaTable(); + ~KanaTable(); +}; diff --git a/core/utils.cpp b/core/utils.cpp index 52608cade..311084331 100644 --- a/core/utils.cpp +++ b/core/utils.cpp @@ -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 diff --git a/core/video_box.cpp b/core/video_box.cpp index aaf7e380e..93466663e 100644 --- a/core/video_box.cpp +++ b/core/video_box.cpp @@ -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); }