public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* configtool output save patch
@ 2008-12-10 10:33 Spencer Oliver
  0 siblings, 0 replies; 4+ messages in thread
From: Spencer Oliver @ 2008-12-10 10:33 UTC (permalink / raw)
  To: ecos-patches

[-- Attachment #1: Type: text/plain, Size: 147 bytes --]

Hi,

Attached is a minor configtool patch that fixes the output window save
function - currently disabled and does nothing.

Cheers
Spencer Oliver

[-- Attachment #2: output-window.patch --]
[-- Type: application/octet-stream, Size: 1996 bytes --]

Index: outputwin.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/outputwin.cpp,v
retrieving revision 1.2
diff -u -r1.2 outputwin.cpp
--- outputwin.cpp	9 Dec 2008 19:05:35 -0000	1.2
+++ outputwin.cpp	10 Dec 2008 10:22:07 -0000
@@ -77,6 +77,7 @@
     EVT_MENU(wxID_SELECTALL, ecOutputWindow::OnSelectAll)
     EVT_MENU(wxID_SAVE, ecOutputWindow::OnSave)
     EVT_UPDATE_UI(wxID_CLEAR, ecOutputWindow::OnUpdateClear)
+    EVT_UPDATE_UI(wxID_SAVE, ecOutputWindow::OnUpdateSave)
 END_EVENT_TABLE()
 
 ecOutputWindow::ecOutputWindow(wxWindow* parent, wxWindowID id, const wxPoint& pt,
@@ -129,6 +130,16 @@
 
 void ecOutputWindow::OnSave(wxCommandEvent& event)
 {
+    wxFileDialog dialog(this, _("Choose a file for saving the output window contents"),
+        wxT(""), wxT("output.txt"), wxT("*.txt"), wxSAVE|wxOVERWRITE_PROMPT);
+    if (dialog.ShowModal() == wxID_OK)
+    {
+        if (!SaveFile(dialog.GetPath()))
+        {
+            wxMessageBox(_("Sorry, there was a problem saving the file."), wxGetApp().GetSettings().GetAppName(),
+                wxICON_EXCLAMATION|wxID_OK);
+        }
+    }
 }
 
 void ecOutputWindow::OnUpdateClear(wxUpdateUIEvent& event)
@@ -136,3 +147,8 @@
     event.Enable(!IsEmpty());
 }
 
+void ecOutputWindow::OnUpdateSave(wxUpdateUIEvent& event)
+{
+    event.Enable(!IsEmpty());
+}
+
Index: outputwin.h
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/outputwin.h,v
retrieving revision 1.2
diff -u -r1.2 outputwin.h
--- outputwin.h	9 Dec 2008 19:05:35 -0000	1.2
+++ outputwin.h	10 Dec 2008 10:19:23 -0000
@@ -66,6 +66,7 @@
     void OnSelectAll(wxCommandEvent& event);
     void OnSave(wxCommandEvent& event);
     void OnUpdateClear(wxUpdateUIEvent& event);
+    void OnUpdateSave(wxUpdateUIEvent& event);
 
 //// Operations
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: configtool output save patch
       [not found] ` <49160.0849004046$1229427834@news.gmane.org>
@ 2008-12-31 16:18   ` John Dallaway
  0 siblings, 0 replies; 4+ messages in thread
From: John Dallaway @ 2008-12-31 16:18 UTC (permalink / raw)
  To: Spencer Oliver; +Cc: ecos-patches

Spencer Oliver wrote:

>>> Attached is a minor configtool patch that fixes the output 
>>> window save function - currently disabled and does nothing.
>>
>> Thank you for the patch. Could you adapt your patch to call
>> ecOutputWindow::OnSave() from ecMainFrame::OnSaveOutput() and 
>> avoid the code duplication?
> 
> Is this a bit better?

Thank you for the updated patch. Now checked in with minor changes and
updated file dialog text.

John Dallaway

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: configtool output save patch
  2008-12-15  9:31 John Dallaway
@ 2008-12-16 11:42 ` Spencer Oliver
       [not found] ` <49160.0849004046$1229427834@news.gmane.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Spencer Oliver @ 2008-12-16 11:42 UTC (permalink / raw)
  To: 'John Dallaway'; +Cc: ecos-patches

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

> > Attached is a minor configtool patch that fixes the output 
> window save 
> > function - currently disabled and does nothing.
> 
> Thank you for the patch. Could you adapt your patch to call
> ecOutputWindow::OnSave() from ecMainFrame::OnSaveOutput() and 
> avoid the code duplication?
> 

Is this a bit better?

Cheers
Spencer Oliver

[-- Attachment #2: save_output.patch --]
[-- Type: application/octet-stream, Size: 3734 bytes --]

Index: mainwin.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/mainwin.cpp,v
retrieving revision 1.22
diff -u -r1.22 mainwin.cpp
--- mainwin.cpp	8 Dec 2008 21:28:55 -0000	1.22
+++ mainwin.cpp	16 Dec 2008 11:31:49 -0000
@@ -1548,17 +1548,7 @@
     ecOutputWindow* win = GetOutputWindow();
     if (!win)
         return;
-
-    wxFileDialog dialog(this, _("Choose a file for saving the output window contents"),
-        wxT(""), wxT("output.txt"), wxT("*.txt"), wxSAVE|wxOVERWRITE_PROMPT);
-    if (dialog.ShowModal() == wxID_OK)
-    {
-        if (!win->SaveFile(dialog.GetPath()))
-        {
-            wxMessageBox(_("Sorry, there was a problem saving the file."), wxGetApp().GetSettings().GetAppName(),
-                wxICON_EXCLAMATION|wxID_OK);
-        }
-    }
+    win->OnSaveOutput(event);
 }
 
 void ecMainFrame::OnUpdateSelectAll(wxUpdateUIEvent& event)
Index: outputwin.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/outputwin.cpp,v
retrieving revision 1.2
diff -u -r1.2 outputwin.cpp
--- outputwin.cpp	9 Dec 2008 19:05:35 -0000	1.2
+++ outputwin.cpp	16 Dec 2008 11:37:08 -0000
@@ -75,8 +75,9 @@
     EVT_MOUSE_EVENTS(ecOutputWindow::OnMouseEvent)
     EVT_MENU(wxID_CLEAR, ecOutputWindow::OnClear)
     EVT_MENU(wxID_SELECTALL, ecOutputWindow::OnSelectAll)
-    EVT_MENU(wxID_SAVE, ecOutputWindow::OnSave)
+    EVT_MENU(wxID_SAVE, ecOutputWindow::OnSaveOutput)
     EVT_UPDATE_UI(wxID_CLEAR, ecOutputWindow::OnUpdateClear)
+    EVT_UPDATE_UI(wxID_SAVE, ecOutputWindow::OnUpdateSave)
 END_EVENT_TABLE()
 
 ecOutputWindow::ecOutputWindow(wxWindow* parent, wxWindowID id, const wxPoint& pt,
@@ -97,7 +98,7 @@
     m_propertiesMenu->Append(wxID_CLEAR, _("C&lear"));
     m_propertiesMenu->Append(wxID_SELECTALL, _("Select &All"));
     m_propertiesMenu->AppendSeparator();
-    m_propertiesMenu->Append(wxID_SAVE, _("&Save..."));
+    m_propertiesMenu->Append(wxID_SAVE, _("&Save Output..."));
 }
 
 ecOutputWindow::~ecOutputWindow()
@@ -127,8 +128,18 @@
     SetSelection(0, GetLastPosition());
 }
 
-void ecOutputWindow::OnSave(wxCommandEvent& event)
+void ecOutputWindow::OnSaveOutput(wxCommandEvent& event)
 {
+    wxFileDialog dialog(this, _("Choose a file for saving the output window contents"),
+        wxT(""), wxT("output.txt"), wxT("*.txt"), wxSAVE|wxOVERWRITE_PROMPT);
+    if (dialog.ShowModal() == wxID_OK)
+    {
+        if (!SaveFile(dialog.GetPath()))
+        {
+            wxMessageBox(_("Sorry, there was a problem saving the file."), wxGetApp().GetSettings().GetAppName(),
+                wxICON_EXCLAMATION|wxID_OK);
+        }
+    }
 }
 
 void ecOutputWindow::OnUpdateClear(wxUpdateUIEvent& event)
@@ -136,3 +147,7 @@
     event.Enable(!IsEmpty());
 }
 
+void ecOutputWindow::OnUpdateSave(wxUpdateUIEvent& event)
+{
+    event.Enable(!IsEmpty());
+}
Index: outputwin.h
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/outputwin.h,v
retrieving revision 1.2
diff -u -r1.2 outputwin.h
--- outputwin.h	9 Dec 2008 19:05:35 -0000	1.2
+++ outputwin.h	16 Dec 2008 11:28:13 -0000
@@ -64,8 +64,9 @@
     void OnMouseEvent(wxMouseEvent& event);
     void OnClear(wxCommandEvent& event);
     void OnSelectAll(wxCommandEvent& event);
-    void OnSave(wxCommandEvent& event);
+    void OnSaveOutput(wxCommandEvent& event);
     void OnUpdateClear(wxUpdateUIEvent& event);
+    void OnUpdateSave(wxUpdateUIEvent& event);
 
 //// Operations
 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: configtool output save patch
@ 2008-12-15  9:31 John Dallaway
  2008-12-16 11:42 ` Spencer Oliver
       [not found] ` <49160.0849004046$1229427834@news.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: John Dallaway @ 2008-12-15  9:31 UTC (permalink / raw)
  To: Spencer Oliver; +Cc: ecos-patches


Hi Spen

Spencer Oliver wrote:

> Attached is a minor configtool patch that fixes the output window save
> function - currently disabled and does nothing.

Thank you for the patch. Could you adapt your patch to call
ecOutputWindow::OnSave() from ecMainFrame::OnSaveOutput() and avoid the
code duplication?

John
Dallawayhttps://gw.dallaway.org.uk/roundcubemail/?_task=mail&_action=compose#

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-31 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-10 10:33 configtool output save patch Spencer Oliver
2008-12-15  9:31 John Dallaway
2008-12-16 11:42 ` Spencer Oliver
     [not found] ` <49160.0849004046$1229427834@news.gmane.org>
2008-12-31 16:18   ` John Dallaway

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).