espeakedit: Change from wxMDI to wxNotebook for prosody and vowel pages. espeakedit: (linux) change to wxWidgets 2.8. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@292 d46cf337-b52f-0410-862d-fd96e6ae7743master
@@ -376,7 +376,7 @@ S s; S; t t; tS ts tS; | |||
ts; v w x z Z Z; | |||
Dictionary pt_dict 2012-09-14 | |||
Dictionary pt_dict 2012-09-17 | |||
& &/ &U~ &~ @ @- a A | |||
aI aU e E eI EI eU EU | |||
@@ -825,11 +825,11 @@ R s S S; t w x z | |||
Z Z; | |||
Dictionary ko_dict 2012-09-15 | |||
Dictionary ko_dict 2012-09-17 | |||
@ a e E i o u u- | |||
* - ; b d dZ; g h | |||
j k k- kh l m n N | |||
p p- ph q r s t t- | |||
tS tS; w | |||
p p- ph q r R s t | |||
t- tS tS; w |
@@ -417,7 +417,7 @@ l/l_ [l] base | |||
[l/] fr | |||
l/l_@ [l/3] base | |||
[l/] fr | |||
l/l@ [hÖ{] base | |||
l/l@ [h6r] base | |||
[l#] base | |||
[l] fr | |||
[l/2] fr | |||
@@ -451,7 +451,7 @@ l/L2_oL [l/2] base | |||
l/L2_uL [l/2] base | |||
l/l_3 [l/] de | |||
l/l_4 [ll] sq | |||
l/la [hÖ{] base | |||
l/la [h6r] base | |||
[l#] base | |||
[l] fr | |||
[l/2] fr | |||
@@ -459,7 +459,7 @@ l/la [h | |||
[K] tn | |||
l/l_a [l/3] base | |||
[l/] fr | |||
l/le [hÖ{] base | |||
l/le [h6r] base | |||
[l#] base | |||
[l] fr | |||
[l/2] fr | |||
@@ -471,7 +471,7 @@ l/L_eL_af [&] af | |||
[&:] af | |||
l/l_front [L] sq | |||
l/l_front_ [l/4] sq | |||
l/li [hÖ{] base | |||
l/li [h6r] base | |||
[l#] base | |||
[l] fr | |||
[l/2] fr | |||
@@ -485,7 +485,7 @@ ll/ll [L] base | |||
ll/_ll [L] base | |||
l/l_long [l] base | |||
[l] fr | |||
l/lo [hÖ{] base | |||
l/lo [h6r] base | |||
[l#] base | |||
[l/2] fr | |||
[K] nso | |||
@@ -496,7 +496,7 @@ l^/l_rfx [l.] base | |||
[l;] lt | |||
[l] ru | |||
[l^] ru | |||
l/lu [hÖ{] base | |||
l/lu [h6r] base | |||
[l#] base | |||
[l] fr | |||
[l/2] fr |
@@ -10,17 +10,17 @@ SRCS= compiledata.cpp compiledict.cpp debug.cpp dictionary.cpp espeak_command.cp | |||
OBJS=$(patsubst %.cpp,%.o,$(SRCS)) | |||
WX_LIBS = -pthread -lwx_gtk2u_xrc-2.6 -lwx_gtk2u_qa-2.6 -lwx_gtk2u_html-2.6 \ | |||
-lwx_gtk2u_adv-2.6 -lwx_gtk2u_core-2.6 -lwx_baseu_xml-2.6 -lwx_baseu_net-2.6 -lwx_baseu-2.6 | |||
WX_LIBS = -pthread -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 \ | |||
-lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 | |||
LIBS=-lstdc++ -lportaudio | |||
CPPFLAGS = -Wall -g -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6 | |||
-I/usr/include/wx-2.6 \ | |||
CPPFLAGS = -Wall -g -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.8 | |||
-I/usr/include/wx-2.8 \ | |||
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES | |||
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT | |||
CXXFLAGS = -O2 -Wall -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 \ | |||
CXXFLAGS = -O2 -Wall -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 \ | |||
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT | |||
all: espeakedit |
@@ -21,7 +21,6 @@ | |||
#include "wx/wfstream.h" | |||
#include "wx/notebook.h" | |||
#include "wx/image.h" | |||
#include "wx/filename.h" | |||
#include "wx/numdlg.h" | |||
@@ -74,8 +73,6 @@ extern void VowelChart(int control, char *fname); | |||
extern void MakeVowelLists(void); | |||
extern void MakeWordFreqList(); | |||
extern const char *dict_name; | |||
extern wxMenu *speak_menu; | |||
extern wxMenu *data_menu; | |||
@@ -83,15 +80,16 @@ extern wxMenu *data_menu; | |||
MyFrame *myframe = NULL; | |||
SpectDisplay *currentcanvas = NULL; | |||
ChildFrProsody *prosodyframe = NULL; | |||
ProsodyDisplay *prosodycanvas = NULL; | |||
wxNotebook *notebook = NULL; | |||
wxNotebook *screenpages = NULL; | |||
wxProgressDialog *progress; | |||
int progress_max; | |||
int gui_flag = 0; | |||
int frame_x, frame_y, frame_w, frame_h; | |||
wxList my_children; | |||
int adding_page = 0; // fix for wxWidgets (2,8,7) bug, adding first page to a wxNotebook gives emptystring for GetPageTex() in Notebook_Page_Changed event. | |||
wxFont FONT_SMALL(8,wxSWISS,wxNORMAL,wxNORMAL); | |||
wxFont FONT_MEDIUM(9,wxSWISS,wxNORMAL,wxNORMAL); | |||
@@ -166,7 +164,7 @@ if(argc > 1) | |||
if((frame_w == 0) || (frame_h == 0)) | |||
{ | |||
frame_w = 1024; | |||
frame_w = 800; | |||
frame_h = 768; | |||
} | |||
@@ -191,7 +189,7 @@ if(argc > 1) | |||
return TRUE; | |||
} | |||
BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame) | |||
BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |||
EVT_CHAR(MyFrame::OnKey) | |||
EVT_MENU(MENU_ABOUT, MyFrame::OnAbout) | |||
EVT_MENU(MENU_DOCS, MyFrame::OnAbout) | |||
@@ -213,7 +211,6 @@ BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame) | |||
EVT_MENU(MENU_SORT_DICTIONARY, MyFrame::OnTools) | |||
EVT_MENU(MENU_COMPILE_MBROLA, MyFrame::OnTools) | |||
EVT_MENU(MENU_COMPILE_INTONATION, MyFrame::OnTools) | |||
EVT_MENU(MENU_CLOSE_ALL, MyFrame::OnQuit) | |||
EVT_MENU(MENU_QUIT, MyFrame::OnQuit) | |||
EVT_MENU(MENU_SPEAK_TRANSLATE, MyFrame::OnSpeak) | |||
EVT_MENU(MENU_SPEAK_RULES, MyFrame::OnSpeak) | |||
@@ -238,14 +235,22 @@ BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame) | |||
EVT_MENU(MENU_TEST, MyFrame::OnTools) | |||
EVT_MENU(MENU_TEST2, MyFrame::OnTools) | |||
EVT_MENU(SPECTSEQ_SAVE, MyFrame::PageCmd) | |||
EVT_MENU(SPECTSEQ_SAVEAS, MyFrame::PageCmd) | |||
EVT_MENU(SPECTSEQ_SAVESELECT, MyFrame::PageCmd) | |||
EVT_MENU(SPECTSEQ_CLOSE, MyFrame::PageCmd) | |||
EVT_MENU(SPECTSEQ_SAVEPITCH, MyFrame::PageCmd) | |||
EVT_MENU(MENU_CLOSE_ALL, MyFrame::PageCmd) | |||
EVT_NOTEBOOK_PAGE_CHANGED(ID_SCREENPAGES, MyFrame::OnPageChanged) | |||
EVT_TIMER(1, MyFrame::OnTimer) | |||
EVT_SIZE(MyFrame::OnSize) | |||
EVT_SASH_DRAGGED(ID_WINDOW_LEFT, MyFrame::OnSashDrag) | |||
END_EVENT_TABLE() | |||
MyFrame::~MyFrame(void) | |||
{//==================== | |||
myframe->Maximize(false); | |||
myframe->Show(false); | |||
myframe->Iconize(false); // os=Windows, get the non-iconsized size | |||
myframe->GetPosition(&frame_x, &frame_y); | |||
@@ -254,7 +259,7 @@ MyFrame::~MyFrame(void) | |||
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, | |||
const long style): | |||
wxMDIParentFrame(parent, id, title, pos, size, style) | |||
wxFrame(parent, id, title, pos, size, style) | |||
{//=================================================================================================================== | |||
// Main Frame constructor | |||
@@ -262,16 +267,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c | |||
int result; | |||
int param; | |||
// Another window to the left of the client window | |||
m_leftWindow = new wxSashLayoutWindow(this, ID_WINDOW_LEFT, | |||
wxDefaultPosition, wxSize(298, 30), | |||
wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN); | |||
m_leftWindow->SetDefaultSize(wxSize(310, 1000)); | |||
m_leftWindow->SetOrientation(wxLAYOUT_VERTICAL); | |||
m_leftWindow->SetAlignment(wxLAYOUT_LEFT); | |||
m_leftWindow->SetSashVisible(wxSASH_RIGHT, TRUE); | |||
notebook = new wxNotebook(m_leftWindow,-1); | |||
notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxSize(312,760)); | |||
// notebook->AddPage(voicedlg,_T("Voice"),FALSE); | |||
formantdlg = new FormantDlg(notebook); | |||
notebook->AddPage(formantdlg,_T(" Spect"),FALSE); | |||
@@ -281,6 +277,29 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c | |||
notebook->AddPage(transldlg,_T("Text"),TRUE); | |||
screenpages = new wxNotebook(this, ID_SCREENPAGES, wxDefaultPosition, wxSize(554,702)); | |||
wxBoxSizer *framesizer = new wxBoxSizer( wxHORIZONTAL ); | |||
framesizer->Add( | |||
notebook, | |||
0, // make horizontally stretchable | |||
wxEXPAND | // make vertically stretchable | |||
wxALL, // and make border all around | |||
4 ); // set border width | |||
framesizer->Add( | |||
screenpages, | |||
1, // make horizontally stretchable | |||
wxEXPAND | // make vertically stretchable | |||
wxALL, // and make border all around | |||
4 ); // set border width | |||
SetSizer( framesizer ); // use the sizer for layout | |||
framesizer->SetSizeHints( this ); // set size hints to honour minimum size | |||
SetSize(pos.x, pos.y, size.GetWidth(), size.GetHeight()); | |||
LoadConfig(); | |||
WavegenInitSound(); | |||
@@ -310,7 +329,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c | |||
for(param=0; param<N_SPEECH_PARAM; param++) | |||
param_stack[0].parameter[param] = param_defaults[param]; | |||
SetParameter(espeakRATE,option_speed,0); | |||
SetSpeed(3); | |||
@@ -345,6 +364,110 @@ void MyFrame::SetVoiceTitle(char *voice_name) | |||
void MyFrame::PageCmd(wxCommandEvent& event) | |||
{//========================================= | |||
int pagenum; | |||
int ix; | |||
int n_pages; | |||
SpectDisplay *page; | |||
// if(currentcanvas != NULL) | |||
{ | |||
pagenum = screenpages->GetSelection(); | |||
switch(event.GetId()) | |||
{ | |||
case SPECTSEQ_SAVE: | |||
currentcanvas->Save(currentcanvas->savepath); | |||
break; | |||
case SPECTSEQ_SAVEAS: | |||
currentcanvas->Save(); | |||
break; | |||
case SPECTSEQ_SAVESELECT: | |||
currentcanvas->Save(_T(""), 1); | |||
break; | |||
case SPECTSEQ_CLOSE: | |||
if(screenpages->GetPageText(pagenum) != _T("Prosody")) | |||
{ | |||
currentcanvas->OnActivate(0); | |||
} | |||
screenpages->DeletePage(pagenum); | |||
if((n_pages = screenpages->GetPageCount()) > 0) | |||
{ | |||
if(pagenum >= n_pages) | |||
pagenum--; | |||
page = (SpectDisplay *)screenpages->GetPage(pagenum); | |||
if(screenpages->GetPageText(pagenum) == _T("Prosody")) | |||
{ | |||
MakeMenu(3, NULL); | |||
} | |||
else | |||
{ | |||
page->OnActivate(1); | |||
MakeMenu(2, NULL); | |||
} | |||
} | |||
else | |||
{ | |||
MakeMenu(1, NULL); | |||
} | |||
break; | |||
case MENU_CLOSE_ALL: | |||
n_pages = screenpages->GetPageCount(); | |||
for(ix=n_pages-1; ix>=0; ix--) | |||
{ | |||
screenpages->DeletePage(ix); | |||
} | |||
currentcanvas = NULL; | |||
MakeMenu(1, NULL); | |||
break; | |||
case SPECTSEQ_SAVEPITCH: | |||
currentcanvas->SavePitchenv(currentcanvas->spectseq->pitchenv); | |||
break; | |||
} | |||
} | |||
} | |||
void MyFrame::OnPageChanged(wxNotebookEvent& event) | |||
{//================================================= | |||
int pagenum; | |||
wxString title; | |||
SpectDisplay *page; | |||
pagenum = event.GetSelection(); | |||
if(event.GetId() == ID_SCREENPAGES) | |||
{ | |||
title = screenpages->GetPageText(pagenum); | |||
if((title != _T("Prosody")) && (adding_page != 2)) | |||
{ | |||
page = (SpectDisplay *)screenpages->GetPage(pagenum); | |||
if(page != currentcanvas) | |||
{ | |||
if(currentcanvas != NULL) | |||
{ | |||
currentcanvas->OnActivate(0); | |||
} | |||
page->OnActivate(1); | |||
} | |||
MakeMenu(2, NULL); | |||
} | |||
else | |||
{ | |||
MakeMenu(3, NULL); | |||
} | |||
} | |||
adding_page = 0; // work around for wxNotebook bug (version 2.8.7) | |||
} | |||
void MyFrame::OnKey(wxKeyEvent& event) | |||
{ | |||
int key; | |||
@@ -624,7 +747,7 @@ void MyFrame::OnTools(wxCommandEvent& event) | |||
case MENU_COMPILE_INTONATION: | |||
CompileIntonation(); | |||
break; | |||
case MENU_COMPILE_DICT_DEBUG: | |||
debug_flag =1; // and drop through to next case | |||
case MENU_COMPILE_DICT: | |||
@@ -729,105 +852,4 @@ void MyFrame::OnSpeak(wxCommandEvent& event) | |||
} | |||
void MyFrame::OnSashDrag(wxSashEvent& event) | |||
{ | |||
int w, h; | |||
if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE) | |||
return; | |||
GetClientSize(&w, &h); | |||
switch (event.GetId()) | |||
{ | |||
case ID_WINDOW_LEFT: | |||
{ | |||
m_leftWindow->SetDefaultSize(wxSize(event.GetDragRect().width, h)); | |||
break; | |||
} | |||
} | |||
wxLayoutAlgorithm layout; | |||
layout.LayoutMDIFrame(this); | |||
// Leaves bits of itself behind sometimes | |||
GetClientWindow()->Refresh(); | |||
} | |||
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) | |||
{ | |||
wxLayoutAlgorithm layout; | |||
layout.LayoutMDIFrame(this); | |||
} | |||
// Note that SASHTEST_NEW_WINDOW and SASHTEST_ABOUT commands get passed | |||
// to the parent window for processing, so no need to | |||
// duplicate event handlers here. | |||
BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame) | |||
EVT_MENU(SPECTSEQ_CLOSE, MyChild::OnQuit) | |||
EVT_MENU(SPECTSEQ_SAVE, MyChild::OnSave) | |||
EVT_MENU(SPECTSEQ_SAVEAS, MyChild::OnSaveAs) | |||
EVT_MENU(SPECTSEQ_SAVESELECT, MyChild::OnSaveSelect) | |||
EVT_MENU(SPECTSEQ_SAVEPITCH, MyChild::OnSavePitchenv) | |||
EVT_ACTIVATE(MyChild::OnActivate) | |||
END_EVENT_TABLE() | |||
MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, | |||
const long style): | |||
wxMDIChildFrame(parent, -1, title, pos, size, style) | |||
{ | |||
canvas = NULL; | |||
my_children.Append(this); | |||
} | |||
MyChild::~MyChild(void) | |||
{ | |||
canvas = NULL; | |||
#ifndef PLATFORM_WINDOWS | |||
wxWindow *w; | |||
// bug in wxMDIChildFrame, we need to explicitly remove the ChildFrame from the ClientWindow | |||
w = myframe->GetClientWindow(); | |||
w->RemoveChild(this); | |||
#endif | |||
my_children.DeleteObject(this); | |||
} | |||
//extern void CloseCanvas(); | |||
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event)) | |||
{ | |||
Destroy(); | |||
} | |||
void MyChild::OnSave(wxCommandEvent& WXUNUSED(event)) | |||
{ | |||
canvas->Save(canvas->savepath); | |||
} | |||
void MyChild::OnSaveAs(wxCommandEvent& WXUNUSED(event)) | |||
{ | |||
canvas->Save(); | |||
} | |||
void MyChild::OnSaveSelect(wxCommandEvent& WXUNUSED(event)) | |||
{ | |||
canvas->Save(_T(""),1); | |||
} | |||
void MyChild::OnSavePitchenv(wxCommandEvent& WXUNUSED(event)) | |||
{ | |||
canvas->SavePitchenv(canvas->spectseq->pitchenv); | |||
} | |||
void MyChild::OnActivate(wxActivateEvent& event) | |||
{ | |||
if(canvas) | |||
canvas->OnActivate(event.GetActive()); | |||
} | |||
@@ -97,7 +97,7 @@ void FormantDlg::OnSpin(wxSpinEvent& event) | |||
currentcanvas->SetFocus(); | |||
} | |||
FormantDlg::FormantDlg(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxSize(400,1000)) | |||
FormantDlg::FormantDlg(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxSize(400,800)) | |||
{//============================================================================================= | |||
int ix; | |||
int y; | |||
@@ -395,7 +395,7 @@ void FormantDlg::ShowFrame(SpectSeq *spectseq, int frame, int pk, int field) | |||
{ | |||
value.Printf(_T("%3d"),peak->klt_bp); | |||
t_klt_bp[ix]->SetValue(value); | |||
} | |||
} | |||
} | |||
} | |||
@@ -469,12 +469,12 @@ void ByteGraph::DrawSpectrum(wxDC& dc) | |||
numframes = seq->numframes; | |||
if(numframes == 0) return; | |||
GetClientSize(&width,&height); | |||
if(((length = seq->frames[numframes-1]->time)==0) && (numframes>1)) | |||
length = seq->frames[numframes-2]->time; | |||
length = length - seq->frames[0]->time; | |||
yscale = height/3000.0; | |||
@@ -518,7 +518,7 @@ void ByteGraph::OnDraw(wxDC &dc) | |||
double xscale, yscale; | |||
if(show_spectrum) DrawSpectrum(dc); | |||
if(npoints==0) return; | |||
GetClientSize(&width,&height); | |||
@@ -559,7 +559,7 @@ void ByteGraph::OnMouse(wxMouseEvent& event) | |||
wxPoint pt(event.GetLogicalPosition(dc)); | |||
t0 = t2 = seq->frames[0]->time; | |||
time = (double(pt.x) / spectrum_scale) + t0; | |||
for(ix=1; ix<seq->numframes; ix++) | |||
{ | |||
t1=t2; |
@@ -2,6 +2,7 @@ | |||
#include "wx/toolbar.h" | |||
#include "wx/laywin.h" | |||
#include "wx/progdlg.h" | |||
#include "wx/notebook.h" | |||
typedef unsigned short USHORT; | |||
typedef unsigned char UCHAR; | |||
@@ -32,44 +33,45 @@ class MyApp: public wxApp | |||
}; | |||
// Define a new frame | |||
class MyFrame: public wxMDIParentFrame | |||
class MyFrame: public wxFrame | |||
{ | |||
public: | |||
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | |||
~MyFrame(void); | |||
void OnSize(wxSizeEvent& event); | |||
void OnAbout(wxCommandEvent& event); | |||
void OnQuit(wxCommandEvent& event); | |||
void OnOptions(wxCommandEvent& event); | |||
void OnSpeak(wxCommandEvent& event); | |||
void OnSpeak(wxCommandEvent& event); | |||
void OnTools(wxCommandEvent& event); | |||
void OnSashDrag(wxSashEvent& event); | |||
void OnKey(wxKeyEvent& event); | |||
void OnTimer(wxTimerEvent& event); | |||
void LoadWavFile(void); | |||
void OnNewWindow(wxCommandEvent& event); | |||
void OnProsody(wxCommandEvent& event); | |||
void PageCmd(wxCommandEvent& event); | |||
void SetVoiceTitle(char *voice_name); | |||
void OnPageChanged(wxNotebookEvent& event); | |||
protected: | |||
wxSashLayoutWindow* m_leftWindow; | |||
wxTimer m_timer; | |||
DECLARE_EVENT_TABLE() | |||
}; | |||
class MyChild: public wxMDIChildFrame | |||
#ifdef deleted | |||
class MyChild: public wxPanel | |||
{ | |||
public: | |||
SpectDisplay *canvas; | |||
MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | |||
MyChild(wxNotebook *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | |||
~MyChild(void); | |||
void OnActivate(wxActivateEvent& event); | |||
void OnQuit(wxCommandEvent& event); | |||
void OnSave(wxCommandEvent& event); | |||
void OnSaveAs(wxCommandEvent& event); | |||
@@ -79,7 +81,7 @@ class MyChild: public wxMDIChildFrame | |||
DECLARE_EVENT_TABLE() | |||
}; | |||
#endif | |||
class TranslDlg : public wxPanel | |||
@@ -103,6 +105,7 @@ private: | |||
}; | |||
extern MyFrame *myframe; | |||
extern wxNotebook* screenpages; | |||
extern TranslDlg *transldlg; | |||
extern wchar_t ipa1[256]; | |||
@@ -171,10 +174,12 @@ enum { | |||
SPECTSEQ_SAVEAS, | |||
SPECTSEQ_SAVESELECT, | |||
SPECTSEQ_SAVEPITCH, | |||
SPECTSEQ_VOICEDLG | |||
SPECTSEQ_VOICEDLG, | |||
ID_SCREENPAGES, | |||
ID_NOTEBOOK | |||
}; | |||
#define ID_WINDOW_LEFT 101 | |||
@@ -24,10 +24,13 @@ | |||
wxMenu *speak_menu; | |||
wxMenu *data_menu = NULL; | |||
wxMenuBar *menu_bar = NULL; | |||
wxMenuBar *MakeMenu(int type, const char *dict_name) | |||
{//================================================= | |||
{//=================================================== | |||
char buf[100]; | |||
wxMenu *old_menu; | |||
wxMenu *file_menu; | |||
wxMenu *help_menu; | |||
wxMenu *option_menu = NULL; | |||
@@ -42,118 +45,126 @@ wxMenuBar *MakeMenu(int type, const char *dict_name) | |||
file_menu->Append(MENU_SPECTRUM, _("&Open...")); | |||
file_menu->Append(MENU_SPECTRUM2, _("O&pen2...")); | |||
// file_menu->Append(MENU_PROSODY, _T("&Prosody window")); | |||
if(type==0) | |||
if(type<=1) | |||
{ | |||
} | |||
else | |||
if(type==1) | |||
if(type==2) | |||
{ | |||
file_menu->Append(SPECTSEQ_SAVE, _("&Save")); | |||
file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As...")); | |||
file_menu->Append(SPECTSEQ_SAVESELECT, _("Save Selection")); | |||
file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope")); | |||
file_menu->Append(SPECTSEQ_CLOSE, _("&Close")); | |||
// file_menu->Append(MENU_CLOSE_ALL, _T("Close &All")); | |||
file_menu->Append(MENU_CLOSE_ALL, _T("Close &All")); | |||
} | |||
else | |||
if(type==2) | |||
if(type==3) | |||
{ | |||
file_menu->Append(SPECTSEQ_SAVE, _("&Save")); | |||
file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As...")); | |||
// file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope")); | |||
// file_menu->Append(SPECTSEQ_SAVE, _("&Save")); | |||
// file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As...")); | |||
file_menu->Append(SPECTSEQ_CLOSE, _("&Close")); | |||
// file_menu->Append(MENU_CLOSE_ALL, _T("Close &All")); | |||
file_menu->Append(MENU_CLOSE_ALL, _T("Close &All")); | |||
} | |||
file_menu->Append(MENU_QUIT, _("&Quit")); | |||
// SPEAK_MENU | |||
speak_menu = new wxMenu; | |||
speak_menu->Append(MENU_SPEAK_TRANSLATE, _("&Translate")); | |||
speak_menu->Append(MENU_SPEAK_RULES, _("Show &Rules")); | |||
speak_menu->Append(MENU_SPEAK_IPA, _("Show &IPA")); | |||
speak_menu->Append(MENU_SPEAK_TEXT, _("&Speak")); | |||
speak_menu->AppendSeparator(); | |||
speak_menu->Append(MENU_SPEAK_FILE, _("Speak &file...")); | |||
speak_menu->Append(MENU_SPEAK_PAUSE, _("&Pause")); | |||
speak_menu->Append(MENU_SPEAK_STOP, _("St&op")); | |||
// VOICE MENU | |||
voice_menu = new wxMenu; | |||
voice_menu->Append(MENU_SPEAK_VOICE, _("Select &Voice..")); | |||
voice_menu->Append(MENU_SPEAK_VOICE_VARIANT, _("Select Voice Va&riant...")); | |||
// DATA MENU | |||
data_menu = new wxMenu; | |||
data_menu->Append(MENU_COMPILE_PH, _("Compile &phoneme data")); | |||
data_menu->Append(MENU_COMPILE_DICT, _("Compile &dictionary")); | |||
data_menu->Append(MENU_COMPILE_DICT_DEBUG, _("Compile dictionary (debu&g)")); | |||
data_menu->AppendSeparator(); | |||
data_menu->Append(MENU_COMPILE_MBROLA, _("Compile &mbrola phonemes list...")); | |||
data_menu->Append(MENU_COMPILE_INTONATION, _("Compile &intonation data")); | |||
data_menu->AppendSeparator(); | |||
data_menu->Append(MENU_FORMAT_DICTIONARY, _("&Layout *_rules file")); | |||
data_menu->Append(MENU_SORT_DICTIONARY, _("&Sort *_rules file")); | |||
sprintf(buf,"Compile &dictionary '%s'",dict_name); | |||
data_menu->SetLabel(MENU_COMPILE_DICT, wxString(buf,wxConvLocal)); | |||
sprintf(buf,"&Layout '%s_rules' file",dict_name); | |||
data_menu->SetLabel(MENU_FORMAT_DICTIONARY, wxString(buf,wxConvLocal)); | |||
sprintf(buf,"&Sort '%s_rules' file",dict_name); | |||
data_menu->SetLabel(MENU_SORT_DICTIONARY, wxString(buf,wxConvLocal)); | |||
// OPTIONS MENU | |||
paths_menu = new wxMenu; | |||
paths_menu->Append(MENU_PATH0, _("Master phonemes file...")); | |||
paths_menu->Append(MENU_PATH1, _("Phoneme data source...")); | |||
paths_menu->Append(MENU_PATH2, _("Dictionary data source...")); | |||
paths_menu->Append(MENU_PATH3, _("Synthesized sound WAV file...")); | |||
paths_menu->AppendSeparator(); | |||
paths_menu->Append(MENU_PATH4, _("Voice file to modify formant peaks...")); | |||
option_menu = new wxMenu; | |||
option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu); | |||
option_menu->Append(MENU_OPT_SPEED, _("Speed...")); | |||
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctiation")); | |||
option_menu->Append(MENU_OPT_SPELL, _("Speak character names")); | |||
// TOOLS | |||
vowelchart_menu = new wxMenu; | |||
vowelchart_menu->Append(MENU_VOWELCHART1, _("From compiled phoneme data")); | |||
// vowelchart_menu->Append(MENU_VOWELCHART2, _("From list of formants...")); | |||
vowelchart_menu->Append(MENU_VOWELCHART3, _("From directory of vowel files...")); | |||
lexicon_menu = new wxMenu; | |||
lexicon_menu->Append(MENU_LEXICON_RU, _("Russian")); | |||
lexicon_menu->Append(MENU_LEXICON_BG, _("Bulgarian")); | |||
lexicon_menu->Append(MENU_LEXICON_DE, _("German")); | |||
lexicon_menu->Append(MENU_LEXICON_IT, _("Italian")); | |||
// lexicon_menu->Append(MENU_LEXICON_TEST, _("Test")); | |||
tools_menu = new wxMenu; | |||
tools_menu->Append(MENU_VOWELCHART, _("Make &Vowels Chart"), vowelchart_menu); | |||
// tools_menu->Append(MENU_LOAD_WAV, _T("Analyse WAV file")); | |||
tools_menu->Append(MENU_LEXICON, _("Process &Lexicon"), lexicon_menu); | |||
tools_menu->Append(MENU_TO_UTF8, _("Convert file to &UTF8...")); | |||
tools_menu->Append(MENU_COUNT_WORDS, _("Count word &frequencies...")); | |||
tools_menu->Append(MENU_TEST , _("Test (temporary)")); | |||
// tools_menu->Append(MENU_TEST2 , _T("Test2")); | |||
// HELP MENU | |||
help_menu = new wxMenu; | |||
help_menu->Append(MENU_DOCS, _("eSpeak &Documentation")); | |||
help_menu->Append(MENU_ABOUT, _("&About")); | |||
wxMenuBar *menu_bar = new wxMenuBar; | |||
menu_bar->Append(file_menu, _("&File")); | |||
menu_bar->Append(speak_menu, _("&Speak")); | |||
menu_bar->Append(voice_menu, _("&Voice")); | |||
menu_bar->Append(option_menu, _("&Options")); | |||
menu_bar->Append(tools_menu, _("&Tools")); | |||
menu_bar->Append(data_menu, _("&Compile")); | |||
menu_bar->Append(help_menu, _("&Help")); | |||
if(type==0) | |||
{ | |||
// Initialization, make all the menus | |||
// SPEAK_MENU | |||
speak_menu = new wxMenu; | |||
speak_menu->Append(MENU_SPEAK_TRANSLATE, _("&Translate")); | |||
speak_menu->Append(MENU_SPEAK_RULES, _("Show &Rules")); | |||
speak_menu->Append(MENU_SPEAK_IPA, _("Show &IPA")); | |||
speak_menu->Append(MENU_SPEAK_TEXT, _("&Speak")); | |||
speak_menu->AppendSeparator(); | |||
speak_menu->Append(MENU_SPEAK_FILE, _("Speak &file...")); | |||
speak_menu->Append(MENU_SPEAK_PAUSE, _("&Pause")); | |||
speak_menu->Append(MENU_SPEAK_STOP, _("St&op")); | |||
// VOICE MENU | |||
voice_menu = new wxMenu; | |||
voice_menu->Append(MENU_SPEAK_VOICE, _("Select &Voice..")); | |||
voice_menu->Append(MENU_SPEAK_VOICE_VARIANT, _("Select Voice Va&riant...")); | |||
// DATA MENU | |||
data_menu = new wxMenu; | |||
data_menu->Append(MENU_COMPILE_PH, _("Compile &phoneme data")); | |||
data_menu->Append(MENU_COMPILE_DICT, _("Compile &dictionary")); | |||
data_menu->Append(MENU_COMPILE_DICT_DEBUG, _("Compile dictionary (debu&g)")); | |||
data_menu->AppendSeparator(); | |||
data_menu->Append(MENU_COMPILE_MBROLA, _("Compile &mbrola phonemes list...")); | |||
data_menu->Append(MENU_COMPILE_INTONATION, _("Compile &intonation data")); | |||
data_menu->AppendSeparator(); | |||
data_menu->Append(MENU_FORMAT_DICTIONARY, _("&Layout *_rules file")); | |||
data_menu->Append(MENU_SORT_DICTIONARY, _("&Sort *_rules file")); | |||
sprintf(buf,"Compile &dictionary '%s'",dict_name); | |||
data_menu->SetLabel(MENU_COMPILE_DICT, wxString(buf,wxConvLocal)); | |||
sprintf(buf,"&Layout '%s_rules' file",dict_name); | |||
data_menu->SetLabel(MENU_FORMAT_DICTIONARY, wxString(buf,wxConvLocal)); | |||
sprintf(buf,"&Sort '%s_rules' file",dict_name); | |||
data_menu->SetLabel(MENU_SORT_DICTIONARY, wxString(buf,wxConvLocal)); | |||
// OPTIONS MENU | |||
paths_menu = new wxMenu; | |||
paths_menu->Append(MENU_PATH0, _("Master phonemes file...")); | |||
paths_menu->Append(MENU_PATH1, _("Phoneme data source...")); | |||
paths_menu->Append(MENU_PATH2, _("Dictionary data source...")); | |||
paths_menu->Append(MENU_PATH3, _("Synthesized sound WAV file...")); | |||
paths_menu->AppendSeparator(); | |||
paths_menu->Append(MENU_PATH4, _("Voice file to modify formant peaks...")); | |||
option_menu = new wxMenu; | |||
option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu); | |||
option_menu->Append(MENU_OPT_SPEED, _("Speed...")); | |||
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctiation")); | |||
option_menu->Append(MENU_OPT_SPELL, _("Speak character names")); | |||
// TOOLS | |||
vowelchart_menu = new wxMenu; | |||
vowelchart_menu->Append(MENU_VOWELCHART1, _("From compiled phoneme data")); | |||
// vowelchart_menu->Append(MENU_VOWELCHART2, _("From list of formants...")); | |||
vowelchart_menu->Append(MENU_VOWELCHART3, _("From directory of vowel files...")); | |||
lexicon_menu = new wxMenu; | |||
lexicon_menu->Append(MENU_LEXICON_RU, _("Russian")); | |||
lexicon_menu->Append(MENU_LEXICON_BG, _("Bulgarian")); | |||
lexicon_menu->Append(MENU_LEXICON_DE, _("German")); | |||
lexicon_menu->Append(MENU_LEXICON_IT, _("Italian")); | |||
// lexicon_menu->Append(MENU_LEXICON_TEST, _("Test")); | |||
tools_menu = new wxMenu; | |||
tools_menu->Append(MENU_VOWELCHART, _("Make &Vowels Chart"), vowelchart_menu); | |||
// tools_menu->Append(MENU_LOAD_WAV, _T("Analyse WAV file")); | |||
tools_menu->Append(MENU_LEXICON, _("Process &Lexicon"), lexicon_menu); | |||
tools_menu->Append(MENU_TO_UTF8, _("Convert file to &UTF8...")); | |||
tools_menu->Append(MENU_COUNT_WORDS, _("Count word &frequencies...")); | |||
tools_menu->Append(MENU_TEST , _("Test (temporary)")); | |||
// tools_menu->Append(MENU_TEST2 , _T("Test2")); | |||
// HELP MENU | |||
help_menu = new wxMenu; | |||
help_menu->Append(MENU_DOCS, _("eSpeak &Documentation")); | |||
help_menu->Append(MENU_ABOUT, _("&About")); | |||
menu_bar = new wxMenuBar; | |||
menu_bar->Append(file_menu, _("&File")); | |||
menu_bar->Append(speak_menu, _("&Speak")); | |||
menu_bar->Append(voice_menu, _("&Voice")); | |||
menu_bar->Append(option_menu, _("&Options")); | |||
menu_bar->Append(tools_menu, _("&Tools")); | |||
menu_bar->Append(data_menu, _("&Compile")); | |||
menu_bar->Append(help_menu, _("&Help")); | |||
} | |||
else | |||
{ | |||
// Just replace the File menu | |||
old_menu = menu_bar->Replace(0, file_menu, _("&File")); | |||
delete old_menu; | |||
} | |||
return(menu_bar); | |||
} // end of MakeMenu | |||
@@ -31,7 +31,6 @@ | |||
#include "translate.h" | |||
extern MyFrame *myframe; | |||
extern ChildFrProsody *prosodyframe; | |||
extern ProsodyDisplay *prosodycanvas; | |||
wxMenu *menu_prosody; | |||
@@ -60,6 +59,7 @@ ProsodyDisplay::ProsodyDisplay(wxWindow *parent, const wxPoint& pos, const wxSiz | |||
scalex = 0.5; | |||
scaley = double(LINESEP*6)/150.0; | |||
selected_ph = -1; | |||
SetBackgroundColour(wxColour(245,245,245)); | |||
} // end of ProsodyDisplay::ProsodyDisplay | |||
@@ -119,7 +119,7 @@ void ProsodyDisplay::RefreshLine(int line) | |||
int ProsodyDisplay::GetWidth(PHONEME_LIST *p) | |||
{//======================================== | |||
int w; | |||
if(p->ph == NULL) | |||
return(0); | |||
@@ -279,7 +279,7 @@ void ProsodyDisplay::OnKey(wxKeyEvent& event) | |||
{//======================================== | |||
PHONEME_LIST *p; | |||
int display=1; | |||
if(selected_ph < 0) | |||
selected_ph = 0; | |||
@@ -301,7 +301,7 @@ void ProsodyDisplay::OnKey(wxKeyEvent& event) | |||
if(selected_ph < (numph-2)) | |||
selected_ph++; | |||
break; | |||
case WXK_UP: | |||
if(event.ControlDown()) | |||
ChangePh(-1,2); | |||
@@ -360,7 +360,7 @@ void ProsodyDisplay::DrawEnv(wxDC& dc, int x1, int y1, int width, PHONEME_LIST * | |||
PHONEME_DATA phdata_tone; | |||
if(width <= 0) return; | |||
if((pitchr = ph->pitch2 - ph->pitch1) < 0) | |||
{ | |||
pitchr = -pitchr; | |||
@@ -425,6 +425,7 @@ void ProsodyDisplay::DrawPitchline(wxDC& dc, int line, int x1, int x2) | |||
y = LINEBASE+LINESEP; | |||
dc.SetPen(*wxLIGHT_GREY_PEN); | |||
// dc.SetPen(*wxCYAN_PEN); | |||
for(ix=0; ix<5; ix++) | |||
{ | |||
dc.DrawLine(0,offy-y,linewidth,offy-y); | |||
@@ -520,6 +521,12 @@ void ProsodyDisplay::OnDraw(wxDC& dc) | |||
int line, start, end; | |||
GetClientSize(&x1, &y1); | |||
if(x1 != linewidth) | |||
{ | |||
LayoutData(NULL, 0); | |||
} | |||
wxRegionIterator upd(GetUpdateRegion()); // get the update rect list | |||
while (upd) | |||
@@ -549,15 +556,18 @@ void ProsodyDisplay::LayoutData(PHONEME_LIST *ph_list, int n_ph) | |||
int xpos; | |||
int w; | |||
int ix; | |||
int height; | |||
PHONEME_LIST *p; | |||
numph = n_ph; | |||
phlist = ph_list; | |||
if(ph_list != NULL) | |||
{ | |||
numph = n_ph; | |||
phlist = ph_list; | |||
} | |||
num_lines = 0; | |||
linetab[0] = 1; | |||
GetClientSize(&linewidth, &height); | |||
xpos = linewidth; | |||
// could improve this to do 'wordwrap' - only split on word boundary | |||
@@ -584,86 +594,35 @@ void ProsodyDisplay::LayoutData(PHONEME_LIST *ph_list, int n_ph) | |||
} // end of ProsodyDisplay::LayoutData | |||
extern int adding_page; | |||
void MyFrame::OnProsody(wxCommandEvent& WXUNUSED(event)) | |||
{//===================================================== | |||
// Open the Prosody display window | |||
// Make another frame, containing a canvas | |||
int h, w, w2; | |||
int width, height; | |||
int ix, npages; | |||
if(prosodyframe != NULL) | |||
if(prosodycanvas != NULL) | |||
{ | |||
// The Prosody window is already open | |||
prosodyframe->Activate(); | |||
// ?? select the prosody page ?? | |||
npages = screenpages->GetPageCount(); | |||
for(ix=0; ix<npages; ix++) | |||
{ | |||
if(screenpages->GetPage(ix) == (wxWindow*)prosodycanvas) | |||
{ | |||
screenpages->ChangeSelection(ix); | |||
break; | |||
} | |||
} | |||
return; | |||
} | |||
m_leftWindow->GetSize(&w2, &h); | |||
GetClientSize(&w, &h); | |||
prosodyframe = new ChildFrProsody(myframe, _T(""), | |||
wxPoint(0, 100), wxSize(w-w2, 420), | |||
wxDEFAULT_FRAME_STYLE | | |||
wxNO_FULL_REPAINT_ON_RESIZE); | |||
prosodyframe->SetTitle(_T("Prosody")); | |||
// Give it a status line | |||
prosodyframe->CreateStatusBar(); | |||
int width, height; | |||
wxMDIClientWindow *clientwin = (wxMDIClientWindow *)this->GetClientWindow(); | |||
clientwin->GetClientSize(&width, &height); | |||
#ifdef deleted | |||
wxPanel *panel = new wxPanel(prosodyframe,-1,wxPoint(0,0), wxSize(width,50)); | |||
ProsodyDisplay *canvas = new ProsodyDisplay(prosodyframe, wxPoint(0, 50), wxSize(width-2, height-50)); | |||
#else | |||
ProsodyDisplay *canvas = new ProsodyDisplay(prosodyframe, wxPoint(0, 50), wxSize(width-10, height)); | |||
#endif | |||
prosodycanvas = canvas; | |||
// Associate the menu bar with the frame | |||
prosodyframe->SetMenuBar(MakeMenu(2,translator->dictionary_name)); | |||
prosodyframe->prosodycanvas = canvas; | |||
prosodyframe->Show(TRUE); | |||
} | |||
BEGIN_EVENT_TABLE(ChildFrProsody, wxMDIChildFrame) | |||
EVT_MENU(SPECTSEQ_CLOSE, ChildFrProsody::OnQuit) | |||
// EVT_ACTIVATE(ChildFrProsody::OnActivate) | |||
END_EVENT_TABLE() | |||
extern wxList my_children; | |||
ChildFrProsody::ChildFrProsody(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, | |||
const long style): | |||
wxMDIChildFrame(parent, -1, title, pos, size, style) | |||
{ | |||
my_children.Append(this); | |||
screenpages->GetClientSize(&width, &height); | |||
prosodycanvas = new ProsodyDisplay(screenpages, wxPoint(0, 50), wxSize(width-10, height)); | |||
adding_page = 2; // work around for wxNotebook bug (version 2.8.7) | |||
screenpages->AddPage(prosodycanvas, _T("Prosody"), true); | |||
} | |||
ChildFrProsody::~ChildFrProsody(void) | |||
{ | |||
wxWindow *w; | |||
my_children.DeleteObject(this); | |||
prosodycanvas = NULL; | |||
prosodyframe = NULL; | |||
#ifndef PLATFORM_WINDOWS | |||
// bug in wxMDIChildFrame, we need to explicitly remove the ChildFrame from the ClientWindow | |||
w = myframe->GetClientWindow(); | |||
w->RemoveChild(this); | |||
#endif | |||
} | |||
void ChildFrProsody::OnQuit(wxCommandEvent& WXUNUSED(event)) | |||
{ | |||
Close(TRUE); | |||
} | |||
@@ -15,7 +15,7 @@ class ProsodyDisplay: public wxScrolledWindow | |||
public: | |||
ProsodyDisplay(wxWindow *parent, const wxPoint& pos, const wxSize& size); | |||
~ProsodyDisplay(); | |||
virtual void OnDraw(wxDC& dc); | |||
void OnMouse(wxMouseEvent& event); | |||
void OnKey(wxKeyEvent& event); | |||
@@ -32,7 +32,7 @@ class ProsodyDisplay: public wxScrolledWindow | |||
int GetWidth(PHONEME_LIST *p); | |||
void ChangePh(int pitch1, int pitch2); | |||
void SelectPh(int index); | |||
int linewidth; // height for drawing pitch | |||
double scalex; // scale length values | |||
double scaley; // scale pitch values | |||
@@ -47,18 +47,4 @@ class ProsodyDisplay: public wxScrolledWindow | |||
}; // end class ProsodyDisplay | |||
class ChildFrProsody: public wxMDIChildFrame | |||
{ | |||
public: | |||
ProsodyDisplay *prosodycanvas; | |||
ChildFrProsody(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | |||
~ChildFrProsody(void); | |||
void OnActivate(wxActivateEvent& event); | |||
void OnQuit(wxCommandEvent& event); | |||
void OnSave(wxCommandEvent& event); | |||
void OnSaveAs(wxCommandEvent& event); | |||
DECLARE_EVENT_TABLE() | |||
}; | |||
@@ -121,7 +121,7 @@ typedef struct { | |||
PEAKS7 peak_data[7]; | |||
unsigned char data[1]; /* firstly harmonic data, then f3,f4,f5 data */ | |||
} CYCLE; /* VARIABLE LENGTH Structure */ | |||
extern int SPC2_size_cycle(CYCLE *cy); | |||
//============================================================================================== | |||
@@ -142,7 +142,7 @@ public: | |||
void CopyPeaks(SpectFrame *sf); | |||
void ToggleMarker(int n); | |||
void ApplyVoiceMods(); | |||
void MakeWaveF(int peaks, PitchEnvelope &pitch, int amplitude, int duration); | |||
void MakeHtab(int numh, int *htab, int pitch); | |||
double GetRms(int amp); |
@@ -42,9 +42,6 @@ | |||
extern MyFrame *frame ; | |||
#define SCROLLUNITS 20 | |||
#define N_CANVASLIST 50 | |||
static int canvaslistix=0; | |||
static SpectDisplay *canvaslist[N_CANVASLIST]; | |||
SpectSeq *clipboard_spect=NULL; | |||
wxMenu *menu_spectdisplay=NULL; | |||
@@ -77,37 +74,14 @@ SpectDisplay::SpectDisplay(wxWindow *parent, const wxPoint& pos, const wxSize& s | |||
pk_num = 1; | |||
SetExtent(); | |||
if(canvaslistix < N_CANVASLIST-1) | |||
canvaslist[canvaslistix++] = this; | |||
// WavegenInitPkData(0); | |||
} // end of SpectDisplay::SpectDisplay | |||
SpectDisplay::~SpectDisplay() | |||
{//========================== | |||
// delete this from the canvaslist | |||
int ix; | |||
for(ix=0; ix<canvaslistix; ix++) | |||
{ | |||
if(canvaslist[ix] == this) | |||
{ | |||
for(ix=ix+1; ix<canvaslistix; ix++) | |||
canvaslist[ix-1] = canvaslist[ix]; | |||
canvaslistix--; | |||
break; | |||
} | |||
} | |||
if(currentcanvas==this) | |||
{ | |||
if(canvaslistix > 0) | |||
currentcanvas = canvaslist[0]; | |||
else | |||
currentcanvas = NULL; | |||
} | |||
// ?? change currentcanvas | |||
} | |||
@@ -174,6 +148,7 @@ void SpectDisplay::OnActivate(int active) | |||
{ | |||
formantdlg->GetValues(spectseq, sframe); | |||
ReadDialogValues(); | |||
currentcanvas = NULL; | |||
} | |||
} | |||
@@ -209,7 +184,7 @@ int GetNumeric(wxTextCtrl *t) | |||
void SpectDisplay::WriteDialogLength() | |||
{//=================================== | |||
wxString string; | |||
string.Printf(_T("%d mS"),int(spectseq->GetKeyedLength()+0.5)); | |||
formantdlg->t_orig_seq->SetLabel(string); | |||
} | |||
@@ -220,7 +195,7 @@ void SpectDisplay::WriteDialogValues() | |||
//{=============================== | |||
{ | |||
wxString string; | |||
SetSpinCtrl(formantdlg->t_amplitude,spectseq->amplitude); | |||
string.Printf(_T("%d - %d Hz %d mS"), | |||
@@ -229,7 +204,7 @@ void SpectDisplay::WriteDialogValues() | |||
pitchgraph->SetData(128,spectseq->pitchenv.env); | |||
voicedlg->SetFromSpect(spectseq); | |||
WriteDialogLength(); | |||
} | |||
@@ -456,15 +431,13 @@ void SpectDisplay::SavePitchenv(PitchEnvelope &pitch) | |||
} // end of SpectDisplay::SavePitchenv | |||
// WX_DECLARE_LIST(MyChild,ChildList); | |||
// WX_DEFINE_LIST(ChildList); | |||
void SpectDisplay::PlayChild(int number, PitchEnvelope pitchenv) | |||
{//========================================================= | |||
#ifdef deleted | |||
SpectSeq *seq; | |||
if(number >= canvaslistix) return; | |||
if((seq = canvaslist[number]->spectseq) == NULL) | |||
@@ -472,6 +445,7 @@ void SpectDisplay::PlayChild(int number, PitchEnvelope pitchenv) | |||
ReadDialogValues(); | |||
seq->MakeWave(0,seq->numframes-1,pitchenv); | |||
#endif | |||
} // end of PlayChild | |||
@@ -481,7 +455,7 @@ void SpectDisplay::SetKeyframe(SpectFrame *sf, int yes) | |||
sf->keyframe = yes; | |||
pitchgraph->Refresh(); | |||
WriteDialogLength(); | |||
} | |||
@@ -731,7 +705,7 @@ void SpectDisplay::OnKey(wxKeyEvent& event) | |||
spectseq->bass_reduction ^= 1; | |||
Refresh(); | |||
break; | |||
case 0x1043: // CTRL-C | |||
spectseq->ClipboardCopy(); | |||
break; | |||
@@ -923,6 +897,7 @@ void SpectDisplay::OnMouse(wxMouseEvent& event) | |||
int frame; | |||
int ix; | |||
SetFocus(); | |||
if(event.RightDown()) | |||
{ | |||
PopupMenu(menu_spectdisplay); | |||
@@ -935,7 +910,7 @@ void SpectDisplay::OnMouse(wxMouseEvent& event) | |||
wxPoint pt(event.GetLogicalPosition(dc)); | |||
if(spectseq->numframes==0) return; | |||
frame = (int)(pt.y/(FRAME_HEIGHT*zoomy)); | |||
if(!event.ControlDown()) | |||
@@ -1018,30 +993,16 @@ void MyFrame::OnNewWindow(wxCommandEvent& event) | |||
else | |||
path_spectload2 = path.GetPath(); | |||
// Make another frame, containing a canvas | |||
GetClientSize(&width, &height); | |||
MyChild *subframe = new MyChild(myframe, _T("Spectrum"), | |||
wxPoint(10, 0), wxSize(500, height), | |||
wxDEFAULT_FRAME_STYLE | | |||
wxNO_FULL_REPAINT_ON_RESIZE); | |||
subframe->SetTitle(leaf); | |||
// Give it a status line | |||
subframe->CreateStatusBar(); | |||
subframe->GetClientSize(&width, &height); | |||
SpectDisplay *canvas = new SpectDisplay(subframe, wxPoint(0, 0), wxSize(width, height), spectseq); | |||
GetClientSize(&width, &height); | |||
SpectDisplay *canvas = new SpectDisplay(screenpages, wxDefaultPosition, wxSize(width, height), spectseq); | |||
screenpages->AddPage(canvas, leaf, true); | |||
canvas->savepath = filename; | |||
currentcanvas = canvas; | |||
// Associate the menu bar with the frame | |||
subframe->SetMenuBar(MakeMenu(1,translator->dictionary_name)); | |||
subframe->canvas = canvas; | |||
subframe->Show(TRUE); | |||
currentcanvas = canvas; | |||
} | |||
void InitSpectrumDisplay() | |||
{//======================= | |||
wxMenu *menu_markers = new wxMenu; |
@@ -35,7 +35,7 @@ | |||
#include "translate.h" | |||
#include "wave.h" | |||
const char *version_string = "1.46.25 14.Sep.12"; | |||
const char *version_string = "1.46.26 17.Sep.12"; | |||
const int version_phdata = 0x014624; | |||
int option_device_number = -1; |
@@ -325,12 +325,12 @@ void TranslDlg::SpeakFile(void) | |||
wxFileName fname; | |||
FILE *f_text; | |||
char buf[200]; | |||
fname = wxFileName(path_speaktext); | |||
file = wxFileSelector(_T("Text file to speak"),fname.GetPath(),fname.GetName(),_T(""),_T("*"),wxOPEN); | |||
if(file == wxEmptyString) return; | |||
strcpy(buf,file.mb_str(wxConvLocal)); | |||
f_text = fopen(buf,"r"); | |||
if(f_text == NULL) | |||
@@ -338,9 +338,9 @@ void TranslDlg::SpeakFile(void) | |||
wxLogError(_T("Failed to read: ")+file); | |||
return; | |||
} | |||
path_speaktext = file; | |||
InitText(0); | |||
SpeakNextClause(f_text,NULL,0); | |||
return; | |||
@@ -465,11 +465,9 @@ void TranslDlg::OnCommand(wxCommandEvent& event) | |||
case T_PROCESS: | |||
case MENU_SPEAK_TEXT: | |||
if(prosodycanvas == NULL) | |||
{ | |||
myframe->OnProsody(event); | |||
} | |||
myframe->OnProsody(event); | |||
prosodycanvas->LayoutData(ph_list,n_ph_list); | |||
myframe->Refresh(); | |||
option_phoneme_events = espeakINITIALIZE_PHONEME_EVENTS; | |||
option_log_frames = 1; | |||
MakeWave2(ph_list,n_ph_list); |