[Gtab-cvs] src frame.cpp, 1.104, 1.105 playbackthrd.cpp, 1.15, 1.16 stdafx.h, 1.7, 1.8
Status: Alpha
Brought to you by:
m0ta
|
From: m0ta <m0...@us...> - 2006-08-03 15:35:00
|
Update of /cvsroot/gtab/src In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14599 Modified Files: frame.cpp playbackthrd.cpp stdafx.h Log Message: * changes to reduce warnings Index: stdafx.h =================================================================== RCS file: /cvsroot/gtab/src/stdafx.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** stdafx.h 28 Feb 2006 07:15:24 -0000 1.7 --- stdafx.h 3 Aug 2006 15:34:56 -0000 1.8 *************** *** 6,10 **** --- 6,12 ---- #include <fstream> #include "dataobjects/documentdata.h" + #ifdef _MSC_VER #pragma hdrstop + #endif #define DEBUG_NEW new Index: frame.cpp =================================================================== RCS file: /cvsroot/gtab/src/frame.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** frame.cpp 15 Apr 2006 22:06:04 -0000 1.104 --- frame.cpp 3 Aug 2006 15:34:56 -0000 1.105 *************** *** 104,108 **** // EVT_GTPS_CHANGE(ID_PAGE_SELECTOR, Frame::onFileOpen) ! EVT_TOOL(XRCID("ID_WHOLE_NOTE"), Frame::onDurationTools) EVT_TOOL(XRCID("ID_HALF_NOTE"), Frame::onDurationTools) --- 104,108 ---- // EVT_GTPS_CHANGE(ID_PAGE_SELECTOR, Frame::onFileOpen) ! EVT_TOOL(XRCID("ID_WHOLE_NOTE"), Frame::onDurationTools) EVT_TOOL(XRCID("ID_HALF_NOTE"), Frame::onDurationTools) *************** *** 117,125 **** Frame::Frame() : wxFrame((wxFrame*) 0, 0, wxT("gtab"), wxDefaultPosition, wxDefaultSize, ! wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN), isPlaying_(false), isPaused_(false) { wxConfigBase *config = wxConfigBase::Get(); ! xpos_ = config->Read(wxT("/xpos"), 50L); ypos_ = config->Read(wxT("/ypos"), 50L); --- 117,125 ---- Frame::Frame() : wxFrame((wxFrame*) 0, 0, wxT("gtab"), wxDefaultPosition, wxDefaultSize, ! wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN), isPlaying_(false), isPaused_(false) { wxConfigBase *config = wxConfigBase::Get(); ! xpos_ = config->Read(wxT("/xpos"), 50L); ypos_ = config->Read(wxT("/ypos"), 50L); *************** *** 128,137 **** int maximized = config->Read(wxT("/maximized"), 0L), device = config->Read(wxT("/mididevice"), -2); ! SetSize(xpos_, ypos_, width_, height_); if (maximized) { Maximize(true); } ! currentDirectory_ = config->Read(wxT("/currentdir"), wxT("")); --- 128,137 ---- int maximized = config->Read(wxT("/maximized"), 0L), device = config->Read(wxT("/mididevice"), -2); ! SetSize(xpos_, ypos_, width_, height_); if (maximized) { Maximize(true); } ! currentDirectory_ = config->Read(wxT("/currentdir"), wxT("")); *************** *** 147,151 **** } choices[devices] = _("None"); ! wxSingleChoiceDialog dialog(this, _("Please select a MIDI device:"), _("MIDI Settings"), devices+1, choices); --- 147,151 ---- } choices[devices] = _("None"); ! wxSingleChoiceDialog dialog(this, _("Please select a MIDI device:"), _("MIDI Settings"), devices+1, choices); *************** *** 166,186 **** wxImage::AddHandler(pngHandler); makeAccelerator(); ! SetMenuBar(wxXmlResource::Get()->LoadMenuBar(wxT("MainMenu"))); - //SetToolBar(wxXmlResource::Get()->LoadToolBar(this, wxT("TopToolBar"))); wxToolBar* topToolBar = wxXmlResource::Get()->LoadToolBar(this, wxT("TopToolBar")); SetIcon(wxIcon(wxT("icon.ico"), wxBITMAP_TYPE_ICO)); - - //enableItem(wxID_SAVE, false); - //enableItem(wxID_SAVEAS, false); - /**enableItem(wxID_CUT, false); - enableItem(wxID_COPY, false); - enableItem(wxID_PASTE, false); // FIXME: is useful data in clipboard? - enableItem(wxID_UNDO, false); - enableItem(wxID_REDO, false); **/ wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); Canvas* canvas = new Canvas(this, -1, wxPoint(10, 10), wxSize(50, 50)); ! gtPageSel* pageSelector = new gtPageSel(this, -1); controller_ = new Controller(canvas, this, pageSelector); --- 166,177 ---- wxImage::AddHandler(pngHandler); makeAccelerator(); ! SetMenuBar(wxXmlResource::Get()->LoadMenuBar(wxT("MainMenu"))); wxToolBar* topToolBar = wxXmlResource::Get()->LoadToolBar(this, wxT("TopToolBar")); SetIcon(wxIcon(wxT("icon.ico"), wxBITMAP_TYPE_ICO)); wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); Canvas* canvas = new Canvas(this, -1, wxPoint(10, 10), wxSize(50, 50)); ! gtPageSel* pageSelector = new gtPageSel(this, -1); controller_ = new Controller(canvas, this, pageSelector); *************** *** 214,218 **** else config->Write(wxT("/maximized"), static_cast<long>(0)); ! delete controller_; --- 205,209 ---- else config->Write(wxT("/maximized"), static_cast<long>(0)); ! delete controller_; *************** *** 275,279 **** _("compressed gtabFiles (*.gtz)|*.gtz|gtab Files (*.gt)|*.gt|PowerTab Files (*.ptb)|*.ptb|Guitar Pro Files (*.gp*)|*.gp*|MIDI Files (*.mid)|*.mid"), wxOPEN); ! if (fileDialog.ShowModal() == wxID_OK) { SetTitle(fileDialog.GetFilename() + _(" - gtab")); --- 266,270 ---- _("compressed gtabFiles (*.gtz)|*.gtz|gtab Files (*.gt)|*.gt|PowerTab Files (*.ptb)|*.ptb|Guitar Pro Files (*.gp*)|*.gp*|MIDI Files (*.mid)|*.mid"), wxOPEN); ! if (fileDialog.ShowModal() == wxID_OK) { SetTitle(fileDialog.GetFilename() + _(" - gtab")); *************** *** 281,288 **** case GTABZ_FILES: break; ! case GTAB_FILES: break; ! case POWER_TAB_FILES: { #ifndef __NOPTAB__ --- 272,279 ---- case GTABZ_FILES: break; ! case GTAB_FILES: break; ! case POWER_TAB_FILES: { #ifndef __NOPTAB__ *************** *** 294,298 **** break; } ! case GUITAR_PRO_FILES: { #ifndef __NOPTAB__ --- 285,289 ---- break; } ! case GUITAR_PRO_FILES: { #ifndef __NOPTAB__ *************** *** 305,309 **** break; } ! case MIDI_FILES: wxMessageBox(_("Unable to open file; MIDI import not yet supported"), _("Error"), wxOK | wxICON_ERROR); --- 296,300 ---- break; } ! case MIDI_FILES: wxMessageBox(_("Unable to open file; MIDI import not yet supported"), _("Error"), wxOK | wxICON_ERROR); *************** *** 317,321 **** { enum FilterIndices { GTABZ_FILES, GTAB_FILES, POWER_TAB_FILES }; ! wxFileDialog fileDialog(this, _("Choose a file"), currentDirectory_, wxT(""), wxT("compressed Gtab Files (*.gtz)|*.gtz|gtab Files (*.gt)|*.gt"), wxSAVE); --- 308,312 ---- { enum FilterIndices { GTABZ_FILES, GTAB_FILES, POWER_TAB_FILES }; ! wxFileDialog fileDialog(this, _("Choose a file"), currentDirectory_, wxT(""), wxT("compressed Gtab Files (*.gtz)|*.gtz|gtab Files (*.gt)|*.gt"), wxSAVE); *************** *** 328,332 **** break; } ! case GTAB_FILES: { GtabFile gtf(fileDialog.GetPath()); --- 319,323 ---- break; } ! case GTAB_FILES: { GtabFile gtf(fileDialog.GetPath()); *************** *** 360,364 **** ColumnDataObject* cda = new ColumnDataObject(); cda->setColumns(columns); ! if (!wxTheClipboard->SetData(cda)) wxLogMessage(_("Couldn't set data to clipboard.")); --- 351,355 ---- ColumnDataObject* cda = new ColumnDataObject(); cda->setColumns(columns); ! if (!wxTheClipboard->SetData(cda)) wxLogMessage(_("Couldn't set data to clipboard.")); *************** *** 402,406 **** { SettingsDialog dialog(this); ! if (dialog.ShowModal() == wxID_OK) { --- 393,397 ---- { SettingsDialog dialog(this); ! if (dialog.ShowModal() == wxID_OK) { *************** *** 423,433 **** return; } ! ! #ifdef __WIN32__ if (midiDevice_.getDevice() == MidiWinDevice::NO_MIDI_DEVICE) return; ! PlaybackThread* thread = new PlaybackThread(this, &midiDevice_); ! if (thread->Create() != wxTHREAD_NO_ERROR) { wxLogError(_("Couldn't create thread.")); --- 414,424 ---- return; } ! ! #ifdef __WIN32__ if (midiDevice_.getDevice() == MidiWinDevice::NO_MIDI_DEVICE) return; ! PlaybackThread* thread = new PlaybackThread(this, &midiDevice_); ! if (thread->Create() != wxTHREAD_NO_ERROR) { wxLogError(_("Couldn't create thread.")); *************** *** 442,446 **** enableItem(ID_LAST_PAGE, false); enableItem(ID_NEXT_PAGE, false); ! isPlaying_ = true; thread->Run(); --- 433,437 ---- enableItem(ID_LAST_PAGE, false); enableItem(ID_NEXT_PAGE, false); ! isPlaying_ = true; thread->Run(); *************** *** 458,465 **** } #endif ! wxCriticalSectionLocker lock(criticalSection_); isPlaying_ = false; ! enableItem(ID_TEMPO_MARKER, true); enableItem(ID_ADD_REST, true); --- 449,456 ---- } #endif ! wxCriticalSectionLocker lock(criticalSection_); isPlaying_ = false; ! enableItem(ID_TEMPO_MARKER, true); enableItem(ID_ADD_REST, true); *************** *** 476,485 **** if (!isPlaying_) return; ! if (isPaused_) { isPaused_ = false; return; } ! #ifdef __WIN32__ for (int i = 0; i < 16; i++) { --- 467,476 ---- if (!isPlaying_) return; ! if (isPaused_) { isPaused_ = false; return; } ! #ifdef __WIN32__ for (int i = 0; i < 16; i++) { *************** *** 488,492 **** } #endif ! wxCriticalSectionLocker lock(criticalSection_); isPaused_ = true; --- 479,483 ---- } #endif ! wxCriticalSectionLocker lock(criticalSection_); isPaused_ = true; *************** *** 546,554 **** { wxToolBar* toolBar = GetToolBar(); ! if (!toolBar->GetToolState(ID_TEMPO_MARKER)) return; // FIXXME: should remove the tempo marker! ! // FIXXXME: DO NOT INVOKE!!! TempoMarkerDialog dialog(this); --- 537,545 ---- { wxToolBar* toolBar = GetToolBar(); ! if (!toolBar->GetToolState(ID_TEMPO_MARKER)) return; // FIXXME: should remove the tempo marker! ! // FIXXXME: DO NOT INVOKE!!! TempoMarkerDialog dialog(this); *************** *** 572,585 **** // the translation of XRCIDs to durations sucks // any better idea? ! if (event.GetId() == XRCID("ID_WHOLE_NOTE")) controller_->setDuration(WHOLE); ! if (event.GetId() == XRCID("ID_HALF_NOTE")) controller_->setDuration(HALF); ! if (event.GetId() == XRCID("ID_QUARTER_NOTE")) controller_->setDuration(QUARTER); ! if (event.GetId() == XRCID("ID_EIGHTH_NOTE")) controller_->setDuration(EIGHTH); --- 563,576 ---- // the translation of XRCIDs to durations sucks // any better idea? ! if (event.GetId() == XRCID("ID_WHOLE_NOTE")) controller_->setDuration(WHOLE); ! if (event.GetId() == XRCID("ID_HALF_NOTE")) controller_->setDuration(HALF); ! if (event.GetId() == XRCID("ID_QUARTER_NOTE")) controller_->setDuration(QUARTER); ! if (event.GetId() == XRCID("ID_EIGHTH_NOTE")) controller_->setDuration(EIGHTH); *************** *** 587,591 **** if (event.GetId() == XRCID("ID_SIXTEENTH_NOTE")) controller_->setDuration(SIXTEENTH); ! if (event.GetId() == XRCID("ID_THIRTYSECOND_NOTE")) controller_->setDuration(THIRTYSECOND); --- 578,582 ---- if (event.GetId() == XRCID("ID_SIXTEENTH_NOTE")) controller_->setDuration(SIXTEENTH); ! if (event.GetId() == XRCID("ID_THIRTYSECOND_NOTE")) controller_->setDuration(THIRTYSECOND); *************** *** 605,609 **** entries[7].Set(wxACCEL_CTRL, static_cast<int>('V'), wxID_PASTE); entries[8].Set(wxACCEL_CTRL | wxACCEL_SHIFT, static_cast<int>('Z'), wxID_REDO); ! wxAcceleratorTable table(9, entries); SetAcceleratorTable(table); --- 596,600 ---- entries[7].Set(wxACCEL_CTRL, static_cast<int>('V'), wxID_PASTE); entries[8].Set(wxACCEL_CTRL | wxACCEL_SHIFT, static_cast<int>('Z'), wxID_REDO); ! wxAcceleratorTable table(9, entries); SetAcceleratorTable(table); *************** *** 613,624 **** void Frame::enableItem(int id, bool enable) { ! wxToolBar* toolBar = GetToolBar(); wxMenuBar* menuBar = GetMenuBar(); ! assert(menuBar); if(menuBar->FindItem(id)) menuBar->Enable(id, enable); - // if(toolBar->FindItem(id)) - // toolBar->EnableTool(id, enable); } --- 604,614 ---- void Frame::enableItem(int id, bool enable) { ! // still need to update toolbar too ! wxMenuBar* menuBar = GetMenuBar(); ! assert(menuBar); if(menuBar->FindItem(id)) menuBar->Enable(id, enable); } Index: playbackthrd.cpp =================================================================== RCS file: /cvsroot/gtab/src/playbackthrd.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** playbackthrd.cpp 10 Apr 2006 17:01:24 -0000 1.15 --- playbackthrd.cpp 3 Aug 2006 15:34:56 -0000 1.16 *************** *** 65,69 **** MidiStack* ms = frame_->getMidiStack(); ms->reset(); ! MidiEvent* event; int tempo = 120; --- 65,69 ---- MidiStack* ms = frame_->getMidiStack(); ms->reset(); ! MidiEvent* event; int tempo = 120; *************** *** 74,82 **** if (event->changeTempo()) timeMod = 60000.0F / event->getTempo() / QUARTER; ! const MidiMessageList& list = event->packMessage(); for (MidiMessageList::const_iterator i = list.begin(); i != list.end(); ++i) device_->sendPackedEvent((*i)->pack()); ! Sleep( timeMod * event->duration() ); ms->next(); } --- 74,82 ---- if (event->changeTempo()) timeMod = 60000.0F / event->getTempo() / QUARTER; ! const MidiMessageList& list = event->packMessage(); for (MidiMessageList::const_iterator i = list.begin(); i != list.end(); ++i) device_->sendPackedEvent((*i)->pack()); ! Sleep(static_cast<long>(timeMod * event->duration())); ms->next(); } *************** *** 88,97 **** if (frame_->isPlaying()) // tools need to get revitalized frame_->onStop(commandEvent); ! return NULL; } //------------------------------------------------------------------------------ ! // // void PlaybackThread::OnExit() --- 88,97 ---- if (frame_->isPlaying()) // tools need to get revitalized frame_->onStop(commandEvent); ! return NULL; } //------------------------------------------------------------------------------ ! // // void PlaybackThread::OnExit() |