#include <wx/xrc/xmlres.h>
#include <wx/image.h>
#include <wx/textbuf.h>
+#include <wx/clipbrd.h>
// wxAUI
#include <wx/aui/aui.h>
#include "ctl/ctlMenuToolbar.h"
// Icons
+#include "images/clip_copy.xpm"
#include "images/readdata.xpm"
#include "images/query_cancel.xpm"
#include "images/terminate_backend.xpm"
BEGIN_EVENT_TABLE(frmStatus, pgFrame)
EVT_MENU(MNU_EXIT, frmStatus::OnExit)
-/* We will uncomment this when we will have a need for these actions
- EVT_MENU(MNU_CUT, frmStatus::OnCut)
EVT_MENU(MNU_COPY, frmStatus::OnCopy)
- EVT_MENU(MNU_PASTE, frmStatus::OnPaste)
- EVT_MENU(MNU_CLEAR, frmStatus::OnClear)
- EVT_MENU(MNU_UNDO, frmStatus::OnUndo)
- EVT_MENU(MNU_REDO, frmStatus::OnRedo)
-*/
EVT_MENU(MNU_HELP, frmStatus::OnHelp)
EVT_MENU(MNU_STATUSPAGE, frmStatus::OnToggleStatusPane)
menuBar->Append(fileMenu, _("&File"));
editMenu = new wxMenu();
- editMenu->Append(MNU_UNDO, _("&Undo\tCtrl-Z"), _("Undo last action"), wxITEM_NORMAL);
- editMenu->Append(MNU_REDO, _("&Redo\tCtrl-Y"), _("Redo last action"), wxITEM_NORMAL);
- editMenu->AppendSeparator();
- editMenu->Append(MNU_CUT, _("Cu&t\tCtrl-X"), _("Cut selected text to clipboard"), wxITEM_NORMAL);
editMenu->Append(MNU_COPY, _("&Copy\tCtrl-C"), _("Copy selected text to clipboard"), wxITEM_NORMAL);
- editMenu->Append(MNU_PASTE, _("&Paste\tCtrl-V"), _("Paste selected text from clipboard"), wxITEM_NORMAL);
- editMenu->Append(MNU_CLEAR, _("C&lear window"), _("Clear edit window"), wxITEM_NORMAL);
menuBar->Append(editMenu, _("&Edit"));
menuBar->Append(helpMenu, _("&Help"));
- // Fix edit menu
- // Currently all disabled because we don't really need edit items
- // They are only there because they are sort-of standards
- editMenu->Enable(MNU_UNDO, false);
- editMenu->Enable(MNU_REDO, false);
- editMenu->Enable(MNU_CUT, false);
+ // Setup edit menu
editMenu->Enable(MNU_COPY, false);
- editMenu->Enable(MNU_PASTE, false);
- editMenu->Enable(MNU_CLEAR, false);
// Finish menu bar
SetMenuBar(menuBar);
toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER);
toolBar->SetToolBitmapSize(wxSize(16, 16));
toolBar->AddTool(MNU_REFRESH, _("Refresh"), wxBitmap(readdata_xpm), _("Refresh"), wxITEM_NORMAL);
+ toolBar->AddSeparator();
+ toolBar->AddTool(MNU_COPY, _("Copy"), wxBitmap(clip_copy_xpm), _("Copy selected text to clipboard"), wxITEM_NORMAL);
+ toolBar->AddSeparator();
toolBar->AddTool(MNU_CANCEL, _("Cancel"), wxBitmap(query_cancel_xpm), _("Cancel query"), wxITEM_NORMAL);
toolBar->AddTool(MNU_TERMINATE, _("Terminate"), wxBitmap(terminate_backend_xpm), _("Terminate backend"), wxITEM_NORMAL);
toolBar->AddTool(MNU_COMMIT, _("Commit"), wxBitmap(storedata_xpm), _("Commit transaction"), wxITEM_NORMAL);
// Get our PID
backend_pid = connection->GetBackendPID();
- // Create the refresh timer (half a second)
+ // Create the refresh timer (quarter of a second)
+ // This is a horrible hack to get around the lack of a
+ // PANE_ACTIVATED event in wxAUI.
refreshUITimer = new wxTimer(this, TIMER_REFRESHUI_ID);
refreshUITimer->Start(250);
}
+void frmStatus::OnCopy(wxCommandEvent& ev)
+{
+ ctlListView *list;
+ int row, col;
+ wxString text;
+
+ switch(currentPane)
+ {
+ case PANE_STATUS:
+ list = statusList;
+ break;
+ case PANE_LOCKS:
+ list = lockList;
+ break;
+ case PANE_XACT:
+ list = xactList;
+ break;
+ case PANE_LOG:
+ list = logList;
+ break;
+ default:
+ // This shouldn't happen.
+ // If it does, it's no big deal, we just need to get out.
+ return;
+ break;
+ }
+
+ row = list->GetFirstSelected();
+
+ while (row >= 0)
+ {
+ for (col = 0; col < list->GetColumnCount(); col++)
+ {
+ text.Append(list->GetText(row, col) + wxT("\t"));
+ }
+#ifdef __WXMSW__
+ text.Append(wxT("\r\n"));
+#else
+ text.Append(wxT("\n"));
+#endif
+ row = list->GetNextSelected(row);
+ }
+
+ if (text.Length() > 0 && wxTheClipboard->Open())
+ {
+ wxTheClipboard->SetData(new wxTextDataObject(text));
+ wxTheClipboard->Close();
+ }
+}
+
+
void frmStatus::OnPaneClose(wxAuiManagerEvent& evt)
{
if (evt.pane->name == statusTitle)
continue;
}
if (tk.HasMoreTokens() || hasCr)
- addLogLine(str);
+ addLogLine(str.Trim());
else
line = str;
}
logList->Thaw();
}
if (!line.IsEmpty())
- addLogLine(line);
+ addLogLine(line.Trim());
}
{
int count=cbLogfiles->GetCount();
if (!count)
- cbLogfiles->Append(_(" current"));
+ cbLogfiles->Append(_("Current log"));
else
count--;
toolBar->EnableTool(MNU_ROLLBACK, false);
cbLogfiles->Enable(false);
btnRotateLog->Enable(false);
+
+ editMenu->Enable(MNU_COPY, statusList->GetFirstSelected()>=0);
}
toolBar->EnableTool(MNU_ROLLBACK, false);
cbLogfiles->Enable(false);
btnRotateLog->Enable(false);
+
+ editMenu->Enable(MNU_COPY, lockList->GetFirstSelected()>=0);
}
toolBar->EnableTool(MNU_TERMINATE, false);
cbLogfiles->Enable(false);
btnRotateLog->Enable(false);
+
+ editMenu->Enable(MNU_COPY, xactList->GetFirstSelected()>=0);
}
toolBar->EnableTool(MNU_TERMINATE, false);
toolBar->EnableTool(MNU_COMMIT, false);
toolBar->EnableTool(MNU_ROLLBACK, false);
+
+ editMenu->Enable(MNU_COPY, logList->GetFirstSelected()>=0);
}
#define FRMSTATUS_PERSPECTIVE_VER wxT("$Rev$")
#ifdef __WXMAC__
-#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6293500;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=321;besth=244;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=462;floaty=165;floatw=595;floath=282|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=321;besth=244;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-231;floaty=235;floatw=595;floath=282|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=0;pos=2;prop=100000;bestw=0;besth=0;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=461;floaty=527;floatw=595;floath=282|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=0;besth=0;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-103;floaty=351;floatw=595;floath=282|name=toolBar;caption=Tool bar;state=2124528;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=558;besth=33;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=888;floaty=829;floatw=558;floath=49|dock_size(4,0,0)=583|dock_size(5,0,0)=10|dock_size(1,10,0)=35|")
+#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6293500;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=321;besth=244;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=462;floaty=165;floatw=595;floath=282|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=321;besth=244;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-231;floaty=235;floatw=595;floath=282|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=0;pos=2;prop=100000;bestw=0;besth=0;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=461;floaty=527;floatw=595;floath=282|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=0;besth=0;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-103;floaty=351;floatw=595;floath=282|name=toolBar;caption=Tool bar;state=2124528;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=608;besth=33;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=888;floaty=829;floatw=558;floath=49|dock_size(4,0,0)=583|dock_size(5,0,0)=10|dock_size(1,10,0)=35|")
#else
#ifdef __WXGTK__
-#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6293500;dir=4;layer=0;row=0;pos=2;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=609;besth=31;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(4,0,0)=549|dock_size(5,0,0)=22|dock_size(1,10,0)=33|")
+#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6293500;dir=4;layer=0;row=0;pos=2;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=659;besth=31;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(4,0,0)=549|dock_size(5,0,0)=22|dock_size(1,10,0)=33|")
#else
-#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6309884;dir=4;layer=0;row=1;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=174;floaty=216;floatw=578;floath=282|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=1;pos=1;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=136;floaty=339;floatw=576;floath=283|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=1;pos=2;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=133;floaty=645;floatw=577;floath=283|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=466;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=586;floaty=525;floatw=483;floath=49|dock_size(5,0,0)=22|dock_size(1,10,0)=25|dock_size(4,0,1)=627|")
+#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6309884;dir=4;layer=0;row=1;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=174;floaty=216;floatw=578;floath=282|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=1;pos=1;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=136;floaty=339;floatw=576;floath=283|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=1;pos=2;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=133;floaty=645;floatw=577;floath=283|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=516;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=586;floaty=525;floatw=483;floath=49|dock_size(5,0,0)=22|dock_size(1,10,0)=25|dock_size(4,0,1)=627|")
#endif
#endif
void OnHelp(wxCommandEvent& ev);
void OnExit(wxCommandEvent& event);
+
+ void OnCopy(wxCommandEvent& ev);
void OnToggleStatusPane(wxCommandEvent& event);
void OnToggleLockPane(wxCommandEvent& event);