Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Tab Save/SaveAll fix maybe??
Pecan:
I've never sumitted a fix before, nor have I ever modified
the core code. But I wanted to try and fix the notebook tab Save/SaveAll
entries.
So... Is the following acceptable. If not, please comment.
If so, I'll submit it to sf
thanks
pecan
--- Code: ---C:\Usr\Proj\cbBeta\trunk\src\sdk>PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\usr\bin;c:\usr\bin\subversion\bin
C:\Usr\Proj\cbBeta\trunk\src\sdk>SET APR_ICONV_PATH=C:\usr\bin\Subversion\iconv
C:\Usr\Proj\cbBeta\trunk\src\sdk>svn diff
Index: editormanager.cpp
===================================================================
--- editormanager.cpp (revision 1563)
+++ editormanager.cpp (working copy)
@@ -227,7 +227,20 @@
pop->AppendSeparator();
pop->Append(idNBTabSave, _("Save"));
if (GetPageCount() > 1)
- pop->Append(idNBTabSaveAll, _("Save all"));
+ { pop->Append(idNBTabSaveAll, _("Save all"));
+ // --begin pecan 12/19/2005 1:40 PM-------------------------
+ EditorBase* ed = Manager::Get()->GetEditorManager()->GetEditor(m_RightClickSelected);
+ int editorsModified = 0;
+ for (int i = 0; i < Manager::Get()->GetEditorManager()->GetEditorsCount(); ++i)
+ {
+ EditorBase* other = Manager::Get()->GetEditorManager()->GetEditor(i);
+ if (other == ed) continue;
+ if (other && other->GetModified() ) editorsModified++;
+ }
+ pop->Enable(idNBTabSaveAll, editorsModified>0 );
+ // --end pecan 12/19/2005 1:40 PM ---------------------------
+ }//if(getPage....
+
EditorBase* ed = Manager::Get()->GetEditorManager()->GetEditor(m_RightClickSelected);
if (ed)
pop->Enable(idNBTabSave, ed->GetModified());
@@ -269,6 +282,8 @@
EVT_MENU(idNBTabClose, EditorNotebook::OnClose)
EVT_MENU(idNBTabCloseAll, EditorNotebook::OnCloseAll)
EVT_MENU(idNBTabCloseAllOthers, EditorNotebook::OnCloseAllOthers)
+ EVT_MENU(idNBTabSave, EditorNotebook::OnSave) //pecan 12/19/2005 1:11 PM
+ EVT_MENU(idNBTabSaveAll, EditorNotebook::OnSaveAll) //pecan 12/19/2005 1:11 PM
EVT_MIDDLE_DOWN(EditorNotebook::OnMiddleDown)
EVT_RIGHT_DOWN(EditorNotebook::OnRightDown)
END_EVENT_TABLE()
--- End code ---
280Z28:
What was the bug? (link?)
Edit: You are making it only enable "SaveAll" when there is at least one modified file open, correct?
thomas:
Looks ok (though the calls to Manager are not needed, and I'd have used a bool).
Have a bit of patience please, we're lagging a bit behind with applying non-vital patches.
Pecan:
--- Quote from: 280Z28 on December 20, 2005, 08:33:53 am ---What was the bug? (link?)
Edit: You are making it only enable "SaveAll" when there is at least one modified file open, correct?
--- End quote ---
There was no bug report on SF. I was going to do that if what I
modified was proper.
It enables "save" when the focused editor has been modified.
It enables "saveAll" when any other (not focused) file is modified.
thanks
pecan
Pecan:
--- Quote from: thomas on December 20, 2005, 11:24:10 am ---Looks ok (though the calls to Manager are not needed, and I'd have used a bool).
Have a bit of patience please, we're lagging a bit behind with applying non-vital patches.
--- End quote ---
OK, I'll re-work it. Could you give me a one-liner example of
NOT using the Manager here.
I figure, if I can get this right, I can get others right.
EDIT: 12/20/2005 9:59 AM
Ohh, I get it. Since the code is in editorManager I dont need
"Manager::Get()->GetEditorManager()->"
thanks
pecan
Navigation
[0] Message Index
[#] Next page
Go to full version