From: Markus R. <rol...@us...> - 2007-06-21 19:18:53
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24402 Modified Files: Tag: RSGEDIT_SCINTILLA mainframe.cpp mainframe.h Log Message: - added file save icon to toolbar - added OnFileSave and OnUpdateFileSave handler Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -C2 -d -r1.15.2.2 -r1.15.2.3 *** mainframe.h 21 Jun 2007 18:42:41 -0000 1.15.2.2 --- mainframe.h 21 Jun 2007 19:18:48 -0000 1.15.2.3 *************** *** 101,104 **** --- 101,107 ---- void OnUpdateFileOpen(wxUpdateUIEvent& event); + void OnFileSave(wxCommandEvent& event); + void OnUpdateFileSave(wxUpdateUIEvent& event); + void OnFileReload(wxCommandEvent& event); void OnUpdateFileReload(wxUpdateUIEvent& event); Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.21.2.3 retrieving revision 1.21.2.4 diff -C2 -d -r1.21.2.3 -r1.21.2.4 *** mainframe.cpp 21 Jun 2007 18:42:41 -0000 1.21.2.3 --- mainframe.cpp 21 Jun 2007 19:18:48 -0000 1.21.2.4 *************** *** 35,38 **** --- 35,39 ---- #include <rsgedit/res/xpm_pause.xpm> #include <rsgedit/res/xpm_open.xpm> + #include <rsgedit/res/xpm_save.xpm> #include <rsgedit/res/xpm_reload.xpm> #include <rsgedit/res/xpm_agent.xpm> *************** *** 76,79 **** --- 77,83 ---- EVT_UPDATE_UI(ID_FILE_OPEN, mainframe::OnUpdateFileOpen) + EVT_MENU(ID_FILE_SAVE, mainframe::OnFileSave) + EVT_UPDATE_UI(ID_FILE_SAVE, mainframe::OnUpdateFileSave) + EVT_MENU(ID_AGENT_OPEN, mainframe::OnAgentOpen) *************** *** 135,141 **** SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(ID_AGENT_OPEN, wxT("Start &Agent"), wxEmptyString, wxITEM_NORMAL); - wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxEmptyString, wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); --- 139,147 ---- SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open\tctrl+o"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_FILE_SAVE, wxT("&Save\tctrl+s"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload\tctrl+r"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->AppendSeparator(); wxglade_tmp_menu_1->Append(ID_AGENT_OPEN, wxT("Start &Agent"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxEmptyString, wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); *************** *** 188,191 **** --- 194,198 ---- mToolBar->AddTool(ID_FILE_OPEN, wxT("Open"), wxBitmap(xpm_open)); mToolBar->AddTool(ID_FILE_RELOAD, wxT("Reload"), wxBitmap(xpm_reload)); + mToolBar->AddTool(ID_FILE_SAVE, wxT("Save"), wxBitmap(xpm_save)); mToolBar->AddSeparator(); mToolBar->AddTool(ID_AGENT_OPEN, wxT("Start Agent"), wxBitmap(xpm_agent)); *************** *** 920,923 **** --- 927,947 ---- } + void mainframe::OnUpdateFileSave(wxUpdateUIEvent& event) + { + wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); + event.Enable(edit != 0); + } + + void mainframe::OnFileSave(wxCommandEvent& event) + { + wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); + if (edit == 0) + { + return; + } + + SparkEdit::SaveFile(edit); + } + void mainframe::OnFileOpen(wxCommandEvent& event) { |