From: <sag...@us...> - 2010-09-26 23:47:41
|
Revision: 720 http://modplug.svn.sourceforge.net/modplug/?rev=720&view=rev Author: saga-games Date: 2010-09-26 23:47:33 +0000 (Sun, 26 Sep 2010) Log Message: ----------- [New] The edit history can now also be viewed through a dialog. There's also a new shortcut for this dialog. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -601,6 +601,7 @@ DefineKeyCommand(kcPanic, 1852, kcVisible, kcNoDummy, _T("Panic")); DefineKeyCommand(kcOrderlistPatIgnore, 1853, kcVisible, kcNoDummy, _T("Ignore (+++) Index")); DefineKeyCommand(kcOrderlistPatInvalid, 1854, kcVisible, kcNoDummy, _T("Invalid (---) Index")); + DefineKeyCommand(kcViewEditHistory, 1855, kcVisible, kcNoDummy, _T("View Edit History")); // Add new key commands here. #ifdef _DEBUG Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-09-26 23:47:33 UTC (rev 720) @@ -114,6 +114,7 @@ kcViewAddPlugin, kcViewSongProperties, kcViewMIDImapping, + kcViewEditHistory, kcHelp, kcEndView=kcHelp, Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -463,7 +463,8 @@ case ID_PLUGIN_SETUP: s="Pl&ugin Manager...\t"; c=kcViewAddPlugin; break; case ID_CHANNEL_MANAGER: s="Ch&annel Manager...\t"; c=kcViewChannelManager; break; case ID_VIEW_SONGPROPERTIES:s="Song P&roperties...\t"; c=kcViewSongProperties; break; //rewbs.graph - case ID_VIEW_MIDIMAPPING: s="&MIDI mapping...\t"; c = kcViewMIDImapping; break; + case ID_VIEW_MIDIMAPPING: s="&MIDI Mapping...\t"; c = kcViewMIDImapping; break; + case ID_VIEW_EDITHISTORY: s="Edit &History...\t"; c = kcViewEditHistory; break; /* case ID_WINDOW_NEW: s="&New Window\t"; c=kcWindowNew; break; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -2832,6 +2832,7 @@ case kcViewAddPlugin: OnPluginManager(); break; case kcViewChannelManager: OnChannelManager(); break; case kcViewMIDImapping: OnViewMIDIMapping(); break; + case kcViewEditHistory: OnViewEditHistory(); break; case kcNextDocument: MDINext(); break; case kcPrevDocument: MDIPrev(); break; @@ -3002,7 +3003,7 @@ //---------------------------------- { CModDoc* pModDoc = GetActiveDoc(); - CSoundFile* pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : 0; + CSoundFile* pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; if(!pSndFile) return; const HWND oldMIDIRecondWnd = GetMidiRecordWnd(); @@ -3012,7 +3013,17 @@ } +void CMainFrame::OnViewEditHistory() +//---------------------------------- +{ + CModDoc* pModDoc = GetActiveDoc(); + if(pModDoc != nullptr) + { + pModDoc->OnViewEditHistory(); + } +} + ///////////////////////////////////////////// //Misc helper functions ///////////////////////////////////////////// Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-09-26 23:47:33 UTC (rev 720) @@ -692,6 +692,7 @@ afx_msg LRESULT OnSpecialKey(WPARAM, LPARAM); afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); afx_msg void OnViewMIDIMapping(); + afx_msg void OnViewEditHistory(); //}}AFX_MSG DECLARE_MESSAGE_MAP() public: Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -52,6 +52,7 @@ ON_COMMAND(ID_VIEW_INSTRUMENTS, OnEditInstruments) ON_COMMAND(ID_VIEW_COMMENTS, OnEditComments) ON_COMMAND(ID_VIEW_GRAPH, OnEditGraph) //rewbs.graph + ON_COMMAND(ID_VIEW_EDITHISTORY, OnViewEditHistory) ON_COMMAND(ID_INSERT_PATTERN, OnInsertPattern) ON_COMMAND(ID_INSERT_SAMPLE, OnInsertSample) ON_COMMAND(ID_INSERT_INSTRUMENT, OnInsertInstrument) @@ -67,6 +68,7 @@ ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS, OnUpdateXMITMPTOnly) ON_UPDATE_COMMAND_UI(ID_VIEW_MIDIMAPPING, OnUpdateHasMIDIMappings) ON_UPDATE_COMMAND_UI(ID_FILE_SAVEASMP3, OnUpdateMP3Encode) + ON_UPDATE_COMMAND_UI(ID_VIEW_EDITHISTORY, OnUpdateITMPTOnly) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -107,6 +109,8 @@ m_SplitKeyboardSettings.octaveModifier = 0; m_SplitKeyboardSettings.octaveLink = false; + m_FileHistory.clear(); + #ifdef _DEBUG MODCHANNEL *p = m_SndFile.Chn; if (((DWORD)p) & 7) Log("MODCHANNEL is not aligned (0x%08X)\n", p); @@ -1986,6 +1990,14 @@ } +void CModDoc::OnUpdateITMPTOnly(CCmdUI *p) +//--------------------------------------- +{ + if (p) + p->Enable((m_SndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? TRUE : FALSE); +} + + void CModDoc::OnUpdateMP3Encode(CCmdUI *p) //---------------------------------------- { @@ -3419,15 +3431,25 @@ // set playback timer in the status bar SetElapsedTime(nOrd, nRow, true); - if (pModPlaying != this) { + if (pModPlaying != this) + { pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977 } } //SwitchToView(); } + +void CModDoc::OnViewEditHistory() +//------------------------------- +{ + CEditHistoryDlg dlg(CMainFrame::GetMainFrame(), this); + dlg.DoModal(); +} + + LRESULT CModDoc::OnCustomKeyMsg(WPARAM wParam, LPARAM /*lParam*/) -//------------------------------------------------------------ +//--------------------------------------------------------------- { if (wParam == kcNull) return NULL; Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-09-26 23:47:33 UTC (rev 720) @@ -124,7 +124,7 @@ // Time the file was open in the editor (in seconds). // For previous editing sessions, this stores the absolute time in seconds the editor was open. // For the current editing session, this stores the time when editing was started (using the result of time()). - // To get the desired value in this case, use time(nullptr) - open_time. + // To get the desired value in this case, use difftime(time(nullptr), open_time). time_t open_time; }; @@ -385,11 +385,13 @@ afx_msg void OnEstimateSongLength(); afx_msg void OnApproximateBPM(); afx_msg void OnUpdateXMITMPTOnly(CCmdUI *p); + afx_msg void OnUpdateITMPTOnly(CCmdUI *p); afx_msg void OnUpdateHasMIDIMappings(CCmdUI *p); afx_msg void OnUpdateMP3Encode(CCmdUI *pCmdUI); afx_msg void OnPatternRestart(); //rewbs.customKeys afx_msg void OnPatternPlay(); //rewbs.customKeys afx_msg void OnPatternPlayNoLoop(); //rewbs.customKeys + afx_msg void OnViewEditHistory(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -3096,6 +3096,86 @@ CDialog::OnCancel(); } + +//////////////////////////////////////////////////////////////////////////////////////////// +// Edit history dialog + +BEGIN_MESSAGE_MAP(CEditHistoryDlg, CDialog) + ON_COMMAND(IDC_BTN_CLEAR, OnClearHistory) +END_MESSAGE_MAP() + + +BOOL CEditHistoryDlg::OnInitDialog() +//---------------------------------- +{ + CDialog::OnInitDialog(); + + if(m_pModDoc == nullptr) + return TRUE; + + CString s; + time_t total_time = 0; + const size_t num = m_pModDoc->GetFileHistory()->size(); + for(size_t n = 0; n < num; n++) + { + CString temp; + FileHistory *hist = &(m_pModDoc->GetFileHistory()->at(n)); + time_t duration = hist->open_time; + // Current item + if(n == num - 1) + { + duration = difftime(time(nullptr), duration); + } + total_time += duration; + TCHAR szDate[32]; + _tcsftime(szDate, sizeof(szDate), _T("%d %b %Y, %H:%M:%S"), &hist->load_date); + + temp.Format(_T("Loaded %s, open in the editor for %lluh %02llum %02llus\r\n"), + szDate, duration / 3600, (duration / 60) % 60, duration % 60); + s += temp; + } + SetDlgItemText(IDC_EDIT_HISTORY, s); + + s.Format(_T("Total edit time: %lluh %02llum %02llus"), total_time / 3600, (total_time / 60) % 60, total_time % 60); + SetDlgItemText(IDC_TOTAL_EDIT_TIME, s); + + s.Format(_T("Edit history for %s"), m_pModDoc->GetTitle()); + SetWindowText(s); + + GetDlgItem(IDC_BTN_CLEAR)->EnableWindow((m_pModDoc->GetFileHistory()->size() > 1) ? TRUE : FALSE); + + return TRUE; + +} + + +void CEditHistoryDlg::OnClearHistory() +//------------------------------------ +{ + if(m_pModDoc == nullptr) + return; + + if(m_pModDoc->GetFileHistory()->size() > 1) + { + while(m_pModDoc->GetFileHistory()->size() > 1) + { + m_pModDoc->GetFileHistory()->erase(m_pModDoc->GetFileHistory()->begin()); + } + m_pModDoc->SetModified(); + } + + OnInitDialog(); +} + + +void CEditHistoryDlg::OnOK() +//-------------------------- +{ + CDialog::OnOK(); +} + + + /////////////////////////////////////////////////////////////////////////////////////// // Messagebox with 'don't show again'-option. Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2010-09-26 23:47:33 UTC (rev 720) @@ -624,6 +624,29 @@ ///////////////////////////////////////////////////////////////////////// +// Edit history dialog + +//=================================== +class CEditHistoryDlg: public CDialog +//=================================== +{ + +protected: + CModDoc *m_pModDoc; + +public: + CEditHistoryDlg(CWnd *parent, CModDoc *pModDoc) : CDialog(IDD_EDITHISTORY, parent) { m_pModDoc = pModDoc; } + UINT ShowLog(LPCSTR pszLog, LPCSTR lpszTitle=NULL); + +protected: + virtual BOOL OnInitDialog(); + virtual VOID OnOK(); + afx_msg void OnClearHistory(); + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////// // Messagebox with 'don't show again'-option. // Enums for message entries. See dlg_misc.cpp for the array of entries. Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/mptrack.rc 2010-09-26 23:47:33 UTC (rev 720) @@ -149,6 +149,18 @@ END +IDD_EDITHISTORY DIALOGEX 0, 0, 316, 185 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Module edit history" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,258,162,50,14 + PUSHBUTTON "Clear",IDC_BTN_CLEAR,6,162,50,14 + EDITTEXT IDC_EDIT_HISTORY,6,6,300,150,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL + LTEXT "",IDC_TOTAL_EDIT_TIME,60,165,192,15 +END + + ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO @@ -204,6 +216,14 @@ TOPMARGIN, 7 BOTTOMMARGIN, 94 END + + IDD_EDITHISTORY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 309 + TOPMARGIN, 7 + BOTTOMMARGIN, 178 + END END #endif // APSTUDIO_INVOKED @@ -1947,7 +1967,8 @@ MENUITEM "Add &Plugin...", ID_PLUGIN_SETUP MENUITEM "Channel &Manager...", ID_CHANNEL_MANAGER MENUITEM "Song Properties...", ID_VIEW_SONGPROPERTIES - MENUITEM "MIDI mapping...", ID_VIEW_MIDIMAPPING + MENUITEM "&MIDI Mapping...", ID_VIEW_MIDIMAPPING + MENUITEM "Edit &History...", ID_VIEW_EDITHISTORY END POPUP "&Window" BEGIN @@ -2391,8 +2412,25 @@ STRINGTABLE BEGIN ID_PANIC "Kill all VSTi and sample voices\nStop all hanging VSTi and sample voices" + ID_VIEW_EDITHISTORY "View the edit history of this module" END +STRINGTABLE +BEGIN + ID_VIEW_MIDIMAPPING "Configure the MIDI Mapping" +END + +STRINGTABLE +BEGIN + ID_CHANNEL_MANAGER "Add, remove, mute and manage channels" + ID_PLUGIN_SETUP "Register plugins and add them to the current module" +END + +STRINGTABLE +BEGIN + ID_VIEW_SONGPROPERTIES "Edit global song properties or convert the module to another format" +END + #endif // Englisch (USA) resources ///////////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/resource.h 2010-09-26 23:47:33 UTC (rev 720) @@ -135,6 +135,7 @@ #define IDD_KEYBOARD_SPLIT 523 #define IDD_SAMPLE_GENERATOR 524 #define IDD_SAMPLE_GENERATOR_PRESETS 525 +#define IDD_EDITHISTORY 526 #define IDC_BUTTON1 1001 #define IDC_BUTTON2 1002 #define IDC_BUTTON3 1003 @@ -953,6 +954,9 @@ #define IDC_CHK_REMEMBERSETTINGS 2427 #define IDC_EDIT_ROWSPERBEAT 2428 #define IDC_EDIT_ROWSPERMEASURE 2429 +#define IDC_BTN_CLEAR 2430 +#define IDC_TOTAL_EDIT_TIME 2431 +#define IDC_EDIT_HISTORY 2432 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -1211,15 +1215,16 @@ #define ID_ENVELOPE_ZOOM_IN 60449 #define ID_ENVELOPE_ZOOM_OUT 60450 #define ID_PANIC 60451 +#define ID_VIEW_EDITHISTORY 60452 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 526 -#define _APS_NEXT_COMMAND_VALUE 60452 -#define _APS_NEXT_CONTROL_VALUE 2430 +#define _APS_NEXT_RESOURCE_VALUE 527 +#define _APS_NEXT_COMMAND_VALUE 60453 +#define _APS_NEXT_CONTROL_VALUE 2433 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/mptrack/version.h 2010-09-26 23:47:33 UTC (rev 720) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 04 +#define VER_MINORMINOR 05 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -686,13 +686,14 @@ it_history.runtime = LittleEndian(it_history.runtime); FileHistory mpt_history; + MemsetZero(mpt_history); mpt_history.load_date.tm_year = ((it_history.fatdate >> 9) & 0x7F) + 80; mpt_history.load_date.tm_mon = ((it_history.fatdate >> 5) & 0x0F) - 1; mpt_history.load_date.tm_mday = it_history.fatdate & 0x1F; mpt_history.load_date.tm_hour = (it_history.fattime >> 11) & 0x1F; mpt_history.load_date.tm_min = (it_history.fattime >> 5) & 0x3F; mpt_history.load_date.tm_sec = (it_history.fattime & 0x1F) * 2; - mpt_history.open_time = (uint64)((float)(it_history.runtime) / 18.2f); + mpt_history.open_time = (time_t)((float)(it_history.runtime) / 18.2f); GetpModDoc()->GetFileHistory()->push_back(mpt_history); #ifdef DEBUG @@ -1187,15 +1188,15 @@ if(n == num - 1) { // The current timestamp has to be converted first. - it_history.runtime = time(nullptr) - mpt_history->open_time; + it_history.runtime = difftime(time(nullptr), mpt_history->open_time) * 18; } else { // Previous timestamps are left alone - it_history.runtime = mpt_history->open_time; + it_history.runtime = mpt_history->open_time * 18; } it_history.fatdate = LittleEndianW(it_history.fatdate); it_history.fattime = LittleEndianW(it_history.fattime); - it_history.runtime = LittleEndian(it_history.runtime * 18); + it_history.runtime = LittleEndian(it_history.runtime); fwrite(&it_history, 1, sizeof(it_history), f); } } @@ -1351,7 +1352,7 @@ if (header.insnum) fwrite(inspos, 4, header.insnum, f); if (header.smpnum) fwrite(smppos, 4, header.smpnum, f); if (header.patnum) fwrite(&patpos[0], 4, header.patnum, f); - // Writing editor history information + // Writing edit history information SaveITEditHistory(this, f); // Writing midi cfg if (header.flags & 0x80) @@ -1964,7 +1965,7 @@ if (header.insnum) fwrite(inspos, 4, header.insnum, f); if (header.smpnum) fwrite(smppos, 4, header.smpnum, f); if (header.patnum) fwrite(patpos, 4, header.patnum, f); - // Writing editor history information + // Writing edit history information SaveITEditHistory(this, f); // Writing midi cfg if (header.flags & 0x80) Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-09-26 22:16:07 UTC (rev 719) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-09-26 23:47:33 UTC (rev 720) @@ -770,6 +770,7 @@ // Set the creation date of this file (or the load time if we're loading an existing file) { FileHistory history; + MemsetZero(history); time_t systime; time(&systime); localtime_s(&history.load_date, &systime); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |