diff --git a/frm/frmQuery.cpp b/frm/frmQuery.cpp index 2ce1325..538429d 100644 --- a/frm/frmQuery.cpp +++ b/frm/frmQuery.cpp @@ -81,6 +81,8 @@ #include "images/query_cancel.pngc" #include "images/query_commit.pngc" #include "images/query_rollback.pngc" +#include "images/mode_transaction.pngc" +#include "images/mode_autocommit.pngc" #include "images/help.pngc" #include "images/gqbJoin.pngc" #include @@ -144,6 +146,7 @@ BEGIN_EVENT_TABLE(frmQuery, pgFrame) EVT_MENU(MNU_AUTOSELECTQUERY, frmQuery::OnAutoSelectQuery) EVT_MENU(MNU_AUTOROLLBACK, frmQuery::OnAutoRollback) EVT_MENU(MNU_AUTOCOMMIT, frmQuery::OnAutoCommit) + EVT_MENU(MNU_MODE_TRANSACTION, frmQuery::OnModeTransaction) EVT_MENU(MNU_CONTENTS, frmQuery::OnContents) EVT_MENU(MNU_HELP, frmQuery::OnHelp) EVT_MENU(MNU_CLEARHISTORY, frmQuery::OnClearHistory) @@ -286,7 +289,7 @@ void frmQuery::seticon() wxBitmap bitmap = bb.GetBitmap(wxSize(32, 32)); //wxBitmap bitmap(f, wxBITMAP_TYPE_PNG); - + if (!bitmap.Ok()) { wxMessageBox(wxT("Sorry, could not load png file.\n")+f); @@ -298,7 +301,7 @@ void frmQuery::seticon() return; //f = wxFindNextFile(); } - + wxColor cl=GetServerColour(conn); int rgb = cl.GetRGB(); int b = (rgb >> 16) & 255; @@ -307,7 +310,7 @@ void frmQuery::seticon() if (r == 255 && g == 255 && b == 255) { //SetBitmapBundle() SetIcon(*sql_32_png_ico); - + } else { @@ -421,7 +424,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w editMenu->Append(MNU_AUTOREPLACE_MANAGE, _("Manage autoreplace..."), _("Edit and delete autoreplace strings")); editMenu->Append(MNU_AUTOEDITOBJECT, _("Open object\tF4"), _("Open object in brouser tree")); editMenu->Append(MNU_TRANSFORM, _("Text transform...\tCtrl+M"), _("Open dialog transform")); - + autoreplace = queryMacroFileProvider::LoadAutoReplace(true); menuBar->Append(editMenu, _("&Edit")); @@ -603,8 +606,8 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w SetStatusText(_("ready"), STATUSPOS_MSGS); toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER); - wxSize tbsz(32,32); - //toolBar->SetToolBitmapSize(wxSize(22, 22)); + wxSize tbsz((32), (32)); + toolBar->SetToolBitmapSize(FromDIP(wxSize(32, 32))); wxLogInfo(wxT("frmQuery::Create tool bar ..")); toolBar->AddTool(MNU_NEWSQLTAB, wxEmptyString, GetBundleSVG(file_new_png_bmp, "file_new.svg", tbsz), _("New SQL tab"), wxITEM_NORMAL); toolBar->AddTool(MNU_OPEN, wxEmptyString, GetBundleSVG(file_open_png_bmp, "file_open.svg", tbsz) , _("Open file"), wxITEM_NORMAL); @@ -630,9 +633,18 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w toolBar->AddTool(MNU_DOCOMMIT, wxEmptyString, GetBundleSVG(query_commit_png_bmp, "query_commit.svg", tbsz), _("Commit"), wxITEM_NORMAL); toolBar->AddTool(MNU_DOROLLBACK, wxEmptyString, GetBundleSVG(query_rollback_png_bmp, "query_rollback.svg", tbsz), _("Rollback"), wxITEM_NORMAL); + bool chk = settings->GetAutoCommit(); + mode_a = GetBundleSVG(mode_autocommit_png_bmp, "mode_autocommit.svg", tbsz); + mode_t = GetBundleSVG(mode_transaction_png_bmp, "mode_transaction.svg", tbsz); + if (chk) + toolBar->AddTool(MNU_MODE_TRANSACTION, wxEmptyString, mode_a, _("Mode transaction"), wxITEM_NORMAL); + else + toolBar->AddTool(MNU_MODE_TRANSACTION, wxEmptyString, mode_t, _("Mode transaction"), wxITEM_NORMAL); + toolBar->AddSeparator(); toolBar->AddTool(MNU_HELP, wxEmptyString, GetBundleSVG(help_png_bmp, "help.svg", tbsz), _("Display help on SQL commands."), wxITEM_NORMAL); + toolBar->Realize(); wxLogInfo(wxT("frmQuery::Create tool bar Ok")); wxSize toolw = toolBar->GetBestSize(); @@ -640,24 +652,6 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w cbConnection = new wxBitmapComboBox(this, CTRLID_CONNECTION, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxArrayString(), wxCB_READONLY | wxCB_DROPDOWN); cbConnection->Append(conn->GetName(), CreateBitmap(GetServerColour(conn)), (void *)conn); cbConnection->Append(_(""), wxNullBitmap, (void *) NULL); - //CTL_BUTTONTRANSACTION - btnModeTransaction = new wxButton(this, CTL_BUTTONTRANSACTION, "A",wxDefaultPosition,wxSize(-1, -1),wxMINIMIZE_BOX); - //btnModeTransaction->SetMaxSize(wxSize(24,24)); -// btnModeTransaction->Enable(true); - wxFont stdFont = settings->GetSystemFont(); - wxFont boldFont = stdFont; - boldFont.SetWeight(wxFONTWEIGHT_BOLD); - btnModeTransaction->SetFont(boldFont); - if (settings->GetAutoCommit()) - btnModeTransaction->SetLabel("A"); - else - btnModeTransaction->SetLabel("T"); - - -// btnModeTransaction->Fit(); - - - //Create SQL editor notebook sqlNotebook = new ctlAuiNotebook(this, CTL_NTBKCENTER, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON); @@ -715,7 +709,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w // Results pane outputPane = new ctlAuiNotebook(this, CTL_NTBKGQB, wxDefaultPosition, wxSize(500, 300), wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON); sqlResult = new ctlSQLResult(outputPane, conn, CTL_SQLRESULT, wxDefaultPosition, wxDefaultSize); - + int len = sizeof(ctlSQL) / sizeof(ctlSQL[0]); for (int i=0;iGetBestSize(); // Kickstart wxAUI manager.AddPane(toolBar, wxAuiPaneInfo().Name(wxT("toolBar")).Caption(_("Tool bar")).ToolbarPane().Top().LeftDockable(false).RightDockable(false)); - manager.AddPane(btnModeTransaction, wxAuiPaneInfo().Name(wxT("ModeTransaction")).Caption(_("Mode transaction")).ToolbarPane().Top().LeftDockable(false).RightDockable(false).Left().LeftDockable(false)); manager.AddPane(cbConnection, wxAuiPaneInfo().Name(wxT("databaseBar")).Caption(_("Connection bar")).ToolbarPane().Top().LeftDockable(false).RightDockable(false)); - + manager.AddPane(outputPane, wxAuiPaneInfo().Name(wxT("outputPane")).Caption(_("Output pane")).Bottom().MinSize(wxSize(200, 100)).BestSize(wxSize(550, 300))); manager.AddPane(scratchPad, wxAuiPaneInfo().Name(wxT("scratchPad")).Caption(_("Scratch pad")).Right().MinSize(wxSize(100, 100)).BestSize(wxSize(250, 200))); manager.AddPane(sqlNotebook, wxAuiPaneInfo().Name(wxT("sqlQuery")).Caption(_("SQL query")).Center().CaptionVisible(false).CloseButton(false).MinSize(wxSize(200, 100)).BestSize(wxSize(350, 200))); @@ -770,17 +763,6 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w manager.GetPane(wxT("databaseBar")).BestSize(w1); manager.GetPane(wxT("toolBar")).BestSize(toolw); manager.GetPane(wxT("databaseBar")).Caption(_("Connection bar")); - //manager.GetPane(wxT("ModeTransaction")).Caption(_("Mode transaction")); - if (!manager.GetPane(wxT("ModeTransaction")).IsShown()) { - //manager.GetPane(wxT("ModeTransaction")).MaxSize(wxSize(22, 22)); - //manager.GetPane(wxT("ModeTransaction")).BestSize(wxSize(22, 22)); - wxSize sz=btnModeTransaction->GetSize(); - int m= std::max(sz.GetWidth(), sz.GetHeight()); - manager.GetPane(wxT("ModeTransaction")).BestSize(wxSize(m, m)); - manager.GetPane(wxT("ModeTransaction")).MaxSize(wxSize(m, m)); - manager.GetPane(wxT("ModeTransaction")).Show(true); - - } manager.GetPane(wxT("sqlQuery")).Caption(_("SQL query")); manager.GetPane(wxT("outputPane")).Caption(_("Output pane")); manager.GetPane(wxT("scratchPad")).Caption(_("Scratch pad")); @@ -800,7 +782,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w bool bVal; - + // Auto-Select bVal = settings->GetAutoSelectQuery(); queryMenu->Check(MNU_AUTOSELECTQUERY, bVal); @@ -924,12 +906,12 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w sqlQuery->SetText(str); sqlQuery->Colourise(0, sqlQuery->GetLength()); sqlQuery->EmptyUndoBuffer(); - + sqlQuery->GotoPos(nl); //wxSafeYield(); // needed to process sqlQuery modify event sqlQuery->SetOrigin(ORIGIN_INITIAL); sqlQuery->SetChanged(false); - + setExtendedTitle(); SqlBookUpdatePageTitle(); SaveTempFile(); @@ -944,7 +926,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w if (!activePage.IsEmpty()) { //activePage //outputPane->GetPageText(curpage) == _("History"); - + int ii = -1; for (int i = 0; i < sqlQueryBook->GetPageCount(); i++) { wxString textpage = sqlQueryBook->GetPageText(i); @@ -962,7 +944,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w if (ii!=-1) sqlQueryBook->SetSelection(ii); //wxLogInfo(wxT("frmQuery::select tab: name=[%s] index=[%d]"), sqlQueryBook->GetPageText(ii), ii); } - //for (int i=1;i<15;i++) + //for (int i=1;i<15;i++) //{ //filename=wxString::Format(_("Query %i"), i); @@ -1228,9 +1210,10 @@ void frmQuery::OnAutoCommit(wxCommandEvent &event) bool chk=queryMenu->IsChecked(MNU_AUTOCOMMIT); queryMenu->Check(MNU_AUTOCOMMIT, chk); if (chk) - btnModeTransaction->SetLabel("A"); - else - btnModeTransaction->SetLabel("T"); + toolBar->SetToolNormalBitmap(MNU_MODE_TRANSACTION, mode_a.GetBitmap(wxDefaultSize)); + else + toolBar->SetToolNormalBitmap(MNU_MODE_TRANSACTION, mode_t.GetBitmap(wxDefaultSize)); + toolBar->Realize(); if(chk && conn->GetTxStatus() != PQTRANS_IDLE) wxMessageBox( @@ -1576,7 +1559,7 @@ void frmQuery::OnChangeNotebookOutpane(wxAuiNotebookEvent &event) size_t curpage = outputPane->GetSelection(); if (wxDynamicCast(outputPane->GetPage(curpage), wxTextCtrl)) { - + wxTextCtrl *hist = wxDynamicCast(outputPane->GetPage(curpage), wxTextCtrl); //hist->SetInsertionPointEnd(); //outputPane->Get @@ -1590,8 +1573,8 @@ void frmQuery::OnChangeNotebookOutpane(wxAuiNotebookEvent &event) { ctlSQLResult *c=wxDynamicCast(outputPane->GetPage(curpage), ctlSQLResult); int len = sizeof(ctlSQL) / sizeof(ctlSQL[0]); - for (int i=0;iAppend(MNU_COPY_WHERELIST, _("WHERE list format copy"), _("Copy where list format.")); xmenu->Append(MNU_COPY_TABLEHTML, _("Copy table html format"), _("Copy table html format.")); if (body_template.Count()>0) { -//MNU_GENERATE_TEMPLATE +//MNU_GENERATE_TEMPLATE wxMenu *submenu = NULL; //wxString t="begin @obj_id@ end"; int cnt=0; @@ -2243,7 +2226,7 @@ void frmQuery::OnLabelRightClick(wxGridEvent &event) if (submenu==NULL) submenu = new wxMenu(); cnt++; submenu->Append(MNU_GENERATESQL+cnt,title_template[i],body_template[i]); - } else + } else SetStatusText(s, STATUSPOS_MSGS); } @@ -2265,13 +2248,13 @@ void frmQuery::OnLabelRightClick(wxGridEvent &event) xmenu->Enable(MNU_COPY_INLIST, sqlResult->IsSelection()); xmenu->Enable(MNU_COPY_WHERELIST, sqlResult->IsSelection()); - + if ((rows.GetCount())) { xmenu->Enable(MNU_COPY, true); xmenu->Enable(MNU_DELETE, true); xmenu->Enable(MNU_PASTE, true); - + } else { @@ -2320,7 +2303,7 @@ void frmQuery::OnGenerateInvoke(wxCommandEvent& ev) { wxString templ = body_template[id]; s=sqlResult->GenerateTemplate(templ,0); - + SetStatusText(s.substr(0,200), STATUSPOS_MSGS); } } else @@ -2554,7 +2537,7 @@ void frmQuery::SaveTempFile() wxLogError(__("Could not write the file %s: Errcode=%d."), filename.c_str(), wxSysErrorCode()); } } - + } void frmQuery::OnSave(wxCommandEvent &event) @@ -2668,7 +2651,7 @@ void frmQuery::OnAutoEditObject(wxCommandEvent &event) } //int n=mainForm->GetBrowser()->GetChildrenCount(mainForm->GetBrowser()->GetSelection(),false); wxTreeItemId matchItem = mainForm->GetBrowser()->FindItem(obj->GetId(),selText,true); - + if (matchItem.IsOk()) { wxString findtext= mainForm->GetBrowser()->GetItemText(matchItem); pgObject *o=mainForm->GetBrowser()->GetObject(matchItem); @@ -2676,7 +2659,7 @@ void frmQuery::OnAutoEditObject(wxCommandEvent &event) //showMessage(o->GetName().Lower()); if (!o) return; if (o->GetName().Lower()==selText.Lower()) { - + //obj = mainForm->GetBrowser()->GetObject(mainForm->GetBrowser()->GetSelection()); mainForm->execSelChange(matchItem,false); //obj=o; @@ -3041,7 +3024,7 @@ void frmQuery::SelectQuery() { // группы серверов/Серверы/serverN/Datebases/dbname sqlQuery->SetSelection(s,e); } - + } void frmQuery::OnExecuteShift(wxCommandEvent &event) { @@ -3085,7 +3068,7 @@ void frmQuery::OnExecute(wxCommandEvent &event) int en=sqlQuery->GetSelectionEnd(); int st=-1; if (sqlQueryExecLast==sqlQuery) sqlQuery->MarkerDeleteAll(1); - + if (en>=0) { st=sqlQuery->GetSelectionStart(); int hline=sqlQuery->LineFromPosition(st); @@ -3344,7 +3327,7 @@ void frmQuery::execQuery(const wxString &query, int resultToRetrieve, bool singl sqlQuery->MarkerDeleteAll(0); //sqlQuery->StartStyling(0); //sqlQuery->SetStyling(sqlQuery->GetText().Length(), 0); - + int i=sqlQueryBook->GetSelection(); sqlQueryBook->SetPageBitmap(i,CreateBitmap(wxColour(255,0,0))); @@ -3357,7 +3340,7 @@ void frmQuery::execQuery(const wxString &query, int resultToRetrieve, bool singl sqlResult=ctlSQL[indexResult]; sqlResult->ClearFilter(); ctlSBox[indexResult]=sqlQuery; - // + // int idx=outputPane->GetPageIndex(sqlResult); outputPane->SetPageBitmap(idx,CreateBitmap(wxNullColour)); @@ -3627,7 +3610,7 @@ void frmQuery::OnQueryComplete(pgQueryResultEvent &ev) // msgHistory->AppendText(str + wxT("\n")); // wxRegEx multilf(wxT("(CONTEXT:.*$)")); // multilf.ReplaceAll(&str, wxT("")); - // + // //} msgResult->AppendText(str); @@ -3777,7 +3760,7 @@ void frmQuery::OnQueryComplete(pgQueryResultEvent &ev) outputPane->SetSelection(i); } } - + long rowsTotal = sqlResult->NumRows(); if (qi->toFileExportForm) @@ -4064,17 +4047,17 @@ void frmQuery::completeQuery(bool done, bool explain, bool verbose) // Change the output pane caption so the user knows which tab the result came from sqlQueryExecLast = sqlQueryExec; SetOutputPaneCaption(true); - for (int i=0;iGetPageCount();i++) + for (int i=0;iGetPageCount();i++) if ((sqlQueryBook->GetPageBitmap(i)).IsOk()) sqlQueryBook->SetPageBitmap(i,wxNullBitmap); //int i=sqlQueryBook->GetPageCount()-1; //sqlQueryBook->SetPageBitmap(i,CreateBitmap(wxNullColour)); //int i=sqlQueryBook->GetSelection() if (); - + sqlQueryExec = NULL; sqlQuery->SetFocus(); - + } @@ -4091,7 +4074,7 @@ void frmQuery::OnTimer(wxTimerEvent &event) // wxRegEx multilf(wxT("(CONTEXT:.*$)")); // multilf.ReplaceAll(&str, wxT("")); // msgResult->AppendText(str + wxT("\n")); - // + // msgHistory->AppendText(str + wxT("\n")); msgResult->AppendText(str + wxT("\n")); } @@ -4488,7 +4471,7 @@ void frmQuery::fileMarkerActive(bool addOrRemove, const wxString &sqlTabName) { wxString tabname = sqlTabName; if (sqlTabName.Find("*")>=0) tabname = sqlTabName.BeforeLast('*'); - + wxString fn = tempDir + wxT("_active.") + tabname + ".a"; //if (sqlTabName.Right(1)=='*' ) tabname= if (addOrRemove && autoSave) @@ -4541,11 +4524,11 @@ void frmQuery::OnSqlBookPageChanged(wxAuiNotebookEvent &event) int pos=-1; //if (r!=NULL) for (int i=0;iGetPageIndex(ctlSQL[i]); - + if (ctlSBox[i]==sqlQuery) { outputPane->SetPageBitmap(idx,CreateBitmap(wxNullColour)); pos=i; @@ -4559,7 +4542,7 @@ void frmQuery::OnSqlBookPageChanged(wxAuiNotebookEvent &event) sqlQuery->SetFocus(); if (sqlQueryBook->GetPageCount() > 1) fileMarkerActive(true, sqlQueryBook->GetPageText(sqlQueryBook->GetSelection())); //wxMessageBox(wxT("OnSqlBookPageChanged ")); - + CheckModificationFile(); updateMenu(false); @@ -4621,7 +4604,7 @@ void frmQuery::OnNotebookOutpaneTabRDown(wxAuiNotebookEvent &event) { if (sqlQuery!=NULL) { wxString sql=sqlResult->sqlquerytext; if (sql.StartsWith("EXPLAIN")) sql=sql.AfterFirst(')'); - if (sql.StartsWith("\nBEGIN;\nEXPLAIN")) { + if (sql.StartsWith("\nBEGIN;\nEXPLAIN")) { sql=sql.AfterFirst(')'); //"\n;\nROLLBACK;" sql=sql.Mid(0,sql.Length()-12); @@ -4650,7 +4633,7 @@ void frmQuery::OnNotebookOutpaneTabRDown(wxAuiNotebookEvent &event) { if (querypage >= 0) { sqlQueryBook->SetSelection(querypage); } - + break; } } @@ -4661,7 +4644,7 @@ void frmQuery::OnSqlBookTabRDown (wxAuiNotebookEvent &event) { size_t curpage = sqlQueryBook->GetSelection(); ctlSQLBox *sqlQuery = wxDynamicCast(sqlQueryBook->GetPage(curpage), ctlSQLBox); wxString pref=conn->GetDbname()+wxT(".nametab"); - + wxTextEntryDialog dialog(this, wxT("Please enter name string with prefix dbname\n") , @@ -4761,7 +4744,7 @@ void frmQuery::SqlBookAddPage(wxString& title) box->Connect(wxID_ANY, wxEVT_SET_FOCUS, wxFocusEventHandler(frmQuery::OnFocus)); box->Connect(wxID_ANY, wxEVT_KILL_FOCUS, wxFocusEventHandler(frmQuery::OnFocus)); - + if (title.BeforeFirst(' ')=="Query") { wxString np = title.AfterFirst(' '); long nl = 0; @@ -4773,7 +4756,7 @@ void frmQuery::SqlBookAddPage(wxString& title) if (title.IsEmpty()) sqlQueryCounter ++; int ll = sqlQueryCounter; caption = wxString::Format(_("Query %d"), ll); - + bool select = title.IsEmpty(); if (!select) caption = title; select = true; @@ -4818,7 +4801,7 @@ bool frmQuery::SqlBookRemovePage() ctlSQLBox *box; box = wxDynamicCast(sqlQueryBook->GetPage(pageidx), ctlSQLBox); wxString filename=box->GetTitle(false); - + wxRemoveFile(tempDir+filename+wxT(".a")); return sqlQueryBook->DeletePage(pageidx); } @@ -5152,7 +5135,7 @@ queryToolCreateCascadeFactory::queryToolCreateCascadeFactory(menuFactoryList *li // } // // return 0; -//} +//} wxWindow *queryToolCreateCascadeFactory::StartDialog(frmMain *form, pgObject *obj) { diff --git a/include/frm/frmQuery.h b/include/frm/frmQuery.h index 47df9a1..251ecf8 100644 --- a/include/frm/frmQuery.h +++ b/include/frm/frmQuery.h @@ -35,14 +35,14 @@ // // This number MUST be incremented if changing any of the default perspectives // -#define FRMQUERY_PERSPECTIVE_VER wxT("8322") +#define FRMQUERY_PERSPECTIVE_VER wxT("8323") #ifdef __WXMAC__ #define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=465;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|") #else #ifdef __WXGTK__ -#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=564;besth=39;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Connection bar;state=2108144;dir=1;layer=10;row=0;pos=671;prop=100000;bestw=232;besth=32;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=ModeTransaction;caption=Mode transaction;state=2108148;dir=1;layer=10;row=0;pos=575;prop=100000;bestw=32;besth=32;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=672;floaty=90;floatw=32;floath=32|name=outputPane;caption=Output pane;state=6293500;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=41|dock_size(3,0,0)=217|dock_size(2,0,0)=252|dock_size(5,0,0)=293|") +#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=564;besth=39;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Connection bar;state=2108144;dir=1;layer=10;row=0;pos=671;prop=100000;bestw=232;besth=32;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=6293500;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=41|dock_size(3,0,0)=217|dock_size(2,0,0)=252|dock_size(5,0,0)=293|") #else -#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=500;besth=28;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=ModeTransaction;caption=ModeTransaction;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=24;besth=24;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=430;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|") +#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=500;besth=28;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=430;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|") #endif #endif @@ -221,7 +221,7 @@ private: void OnCopy_InList(wxCommandEvent& event); void OnCopy_WhereList(wxCommandEvent& event); void OnCopy_TableToHtml(wxCommandEvent& ev); - void OnGenerateTemplate(wxCommandEvent& ev); + void OnGenerateTemplate(wxCommandEvent& ev); void OnClear_Filter(wxCommandEvent &event); void OnCopy_NameTypeCols(wxCommandEvent& ev); void OnCheck_Column_Date(wxCommandEvent& ev); @@ -325,7 +325,7 @@ private: void OnSqlBookPageChanging(wxAuiNotebookEvent &event); void OnSqlBookTabRDown(wxAuiNotebookEvent &event); void OnNotebookOutpaneTabRDown(wxAuiNotebookEvent &event); - + void BeginPerspectiveChange(); void EndPerspectiveChange(bool update = false); void SetOutputPaneCaption(bool update = false); @@ -348,7 +348,7 @@ private: bool aborted; bool lastFileFormat; bool m_loadingfile; - + wxBitmapBundle mode_a, mode_t; // A simple mutex-like flag to prevent concurrent script execution. // Required because the pgScript parser isn't currently thread-safe :-( static bool ms_pgScriptRunning; diff --git a/include/frm/menu.h b/include/frm/menu.h index 66b561e..14fbfe0 100644 --- a/include/frm/menu.h +++ b/include/frm/menu.h @@ -73,6 +73,7 @@ enum MNU_EXPLAINOPTIONS, MNU_DOCOMMIT, MNU_DOROLLBACK, + MNU_MODE_TRANSACTION, MNU_VERBOSE, MNU_COSTS, MNU_BUFFERS, diff --git a/include/images/mode_autocommit.png b/include/images/mode_autocommit.png new file mode 100644 index 0000000..e783bcc Binary files /dev/null and b/include/images/mode_autocommit.png differ diff --git a/include/images/mode_autocommit.pngc b/include/images/mode_autocommit.pngc new file mode 100644 index 0000000..64afc3b --- /dev/null +++ b/include/images/mode_autocommit.pngc @@ -0,0 +1,98 @@ +#ifndef MODE_AUTOCOMMIT_PNG_H +#define MODE_AUTOCOMMIT_PNG_H + +static const unsigned char mode_autocommit_png_data[] = { +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, +0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, +0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, +0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, +0x61, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, +0x73, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, +0x27, 0x01, 0x2a, 0x09, 0x91, 0x4f, 0x00, 0x00, +0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, +0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, +0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, +0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, +0xee, 0x3c, 0x1a, 0x00, 0x00, 0x01, 0x38, 0x49, +0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd3, 0xcf, +0x4a, 0x55, 0x61, 0x14, 0x05, 0xf0, 0xdf, 0xbe, +0xfd, 0x01, 0xa7, 0x41, 0x88, 0x38, 0x51, 0x1a, +0xf8, 0x26, 0xa1, 0xa1, 0x97, 0xfb, 0x08, 0x21, +0x98, 0x03, 0x1f, 0x43, 0x7a, 0x8a, 0x84, 0xe8, +0x05, 0x42, 0x12, 0x53, 0x1f, 0xc1, 0x6a, 0xe2, +0x20, 0x9a, 0x49, 0x83, 0xa2, 0x51, 0x36, 0x30, +0x9b, 0x24, 0xee, 0x06, 0xee, 0x7b, 0xf9, 0xee, +0xf1, 0x90, 0x03, 0x17, 0x6c, 0x0e, 0x67, 0xed, +0xfd, 0xad, 0xbd, 0xce, 0x3e, 0xdf, 0x8e, 0xcc, +0x74, 0x27, 0x64, 0xa6, 0x12, 0x19, 0xe1, 0x33, +0x2e, 0x91, 0x3d, 0x71, 0x81, 0x33, 0x9c, 0x60, +0x65, 0x7c, 0x2e, 0x32, 0x53, 0x44, 0x8c, 0xf0, +0x16, 0xef, 0xf1, 0xee, 0x96, 0x9e, 0x43, 0x2c, +0x63, 0x35, 0x33, 0x0f, 0xc7, 0xdd, 0xbf, 0x60, +0x6f, 0xac, 0xda, 0xb8, 0x9a, 0xc1, 0x4c, 0x0f, +0xbf, 0x87, 0xe3, 0xcc, 0x34, 0x28, 0xd5, 0x05, +0xec, 0xf7, 0x74, 0x7b, 0x53, 0xd1, 0xc5, 0x3e, +0x96, 0xe0, 0x7e, 0x11, 0x83, 0x6e, 0x45, 0x44, +0xcc, 0xd6, 0x5c, 0x44, 0xc4, 0x5c, 0x66, 0xfe, +0xe8, 0x94, 0xdc, 0xeb, 0x3d, 0xd8, 0x60, 0x1d, +0xbf, 0x2b, 0x9e, 0xf7, 0xe4, 0x07, 0xad, 0x40, +0x74, 0xba, 0x0f, 0xb0, 0x81, 0xd7, 0x15, 0x1b, +0xc5, 0x4d, 0x95, 0xb5, 0x02, 0x57, 0x9d, 0xe4, +0x53, 0x2c, 0xe2, 0x67, 0xc5, 0x62, 0x71, 0x37, +0x30, 0x9e, 0xc1, 0x65, 0x87, 0xdf, 0xac, 0xe7, +0xcb, 0x86, 0x7b, 0x81, 0xc3, 0xe6, 0x3d, 0x5b, +0x07, 0x7f, 0x1b, 0xfb, 0xf3, 0x58, 0xc5, 0x16, +0x9e, 0x54, 0x6c, 0x61, 0xad, 0x72, 0xff, 0x17, +0xc0, 0x33, 0x7c, 0xc3, 0x4e, 0x66, 0x9e, 0x66, +0xe6, 0x29, 0x5e, 0xe1, 0x2b, 0x56, 0x9a, 0xba, +0x6b, 0xd7, 0x75, 0x31, 0x3e, 0xe2, 0xa0, 0x04, +0x1f, 0xe2, 0x51, 0xcf, 0xe5, 0x79, 0x8c, 0x07, +0xcd, 0x45, 0xfa, 0x94, 0x99, 0x93, 0x19, 0x6c, +0x63, 0x17, 0x47, 0xf5, 0x9d, 0xe7, 0x11, 0x53, +0x3f, 0x66, 0x82, 0x88, 0x18, 0x96, 0xcb, 0xd1, +0xc4, 0x41, 0xa9, 0x0e, 0x71, 0x8c, 0xef, 0xae, +0x97, 0xe6, 0x97, 0x9b, 0x0b, 0xf5, 0x07, 0x1f, +0xb0, 0x36, 0xb5, 0x4c, 0x77, 0xc1, 0x3f, 0x16, +0xa2, 0x9e, 0x88, 0x56, 0x3b, 0x46, 0x2a, 0x00, +0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, +0x42, 0x60, 0x82, +}; + +#include "wx/mstream.h" + +static wxImage *mode_autocommit_png_img() +{ + if (!wxImage::FindHandler(wxT("PNG file"))) + wxImage::AddHandler(new wxPNGHandler()); + static wxImage *img_mode_autocommit_png = new wxImage(); + if (!img_mode_autocommit_png || !img_mode_autocommit_png->IsOk()) + { + wxMemoryInputStream img_mode_autocommit_pngIS(mode_autocommit_png_data, sizeof(mode_autocommit_png_data)); + img_mode_autocommit_png->LoadFile(img_mode_autocommit_pngIS, wxBITMAP_TYPE_PNG); + } + return img_mode_autocommit_png; +} +#define mode_autocommit_png_img mode_autocommit_png_img() + +static wxBitmap *mode_autocommit_png_bmp() +{ + static wxBitmap *bmp_mode_autocommit_png; + if (!bmp_mode_autocommit_png || !bmp_mode_autocommit_png->IsOk()) + bmp_mode_autocommit_png = new wxBitmap(*mode_autocommit_png_img); + return bmp_mode_autocommit_png; +} +#define mode_autocommit_png_bmp mode_autocommit_png_bmp() + +static wxIcon *mode_autocommit_png_ico() +{ + static wxIcon *ico_mode_autocommit_png; + if (!ico_mode_autocommit_png || !ico_mode_autocommit_png->IsOk()) + { + ico_mode_autocommit_png = new wxIcon(); + ico_mode_autocommit_png->CopyFromBitmap(*mode_autocommit_png_bmp); + } + return ico_mode_autocommit_png; +} +#define mode_autocommit_png_ico mode_autocommit_png_ico() + +#endif // MODE_AUTOCOMMIT_PNG_H diff --git a/include/images/mode_autocommit.svg b/include/images/mode_autocommit.svg new file mode 100644 index 0000000..8df4900 --- /dev/null +++ b/include/images/mode_autocommit.svg @@ -0,0 +1,47 @@ + + + + + + + + + + diff --git a/include/images/mode_transaction.png b/include/images/mode_transaction.png new file mode 100644 index 0000000..b2694fe Binary files /dev/null and b/include/images/mode_transaction.png differ diff --git a/include/images/mode_transaction.pngc b/include/images/mode_transaction.pngc new file mode 100644 index 0000000..dc2194f --- /dev/null +++ b/include/images/mode_transaction.pngc @@ -0,0 +1,82 @@ +#ifndef MODE_TRANSACTION_PNG_H +#define MODE_TRANSACTION_PNG_H + +static const unsigned char mode_transaction_png_data[] = { +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, +0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, +0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, +0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, +0x61, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, +0x73, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, +0x27, 0x01, 0x2a, 0x09, 0x91, 0x4f, 0x00, 0x00, +0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, +0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, +0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, +0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, +0xee, 0x3c, 0x1a, 0x00, 0x00, 0x00, 0xbd, 0x49, +0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, 0x3d, +0x0a, 0xc2, 0x40, 0x10, 0x85, 0xbf, 0x91, 0x80, +0x60, 0x6f, 0xa7, 0xb5, 0x58, 0xc4, 0xc6, 0x2b, +0x78, 0x86, 0xdc, 0xc3, 0x03, 0xa4, 0xf2, 0x36, +0x5a, 0x78, 0x02, 0xaf, 0x60, 0xa1, 0x9d, 0x8d, +0x87, 0x10, 0x04, 0xc1, 0xf8, 0x6c, 0x56, 0x59, +0x4d, 0x76, 0xcd, 0x9a, 0x81, 0x81, 0x9d, 0x9f, +0xf7, 0x78, 0xcb, 0xcc, 0x98, 0x24, 0xba, 0x58, +0x06, 0x60, 0x66, 0x2b, 0xe0, 0x90, 0x88, 0x9d, +0x49, 0x2a, 0x33, 0x17, 0x1c, 0x25, 0x6d, 0x52, +0xd0, 0x66, 0x66, 0x6f, 0x05, 0x5f, 0x85, 0x29, +0x30, 0x08, 0xe0, 0x2e, 0x92, 0x4e, 0x7e, 0xa2, +0x46, 0x00, 0x6c, 0x81, 0x49, 0x80, 0x60, 0x0f, +0xcc, 0x7f, 0x11, 0x2c, 0x81, 0x31, 0x30, 0x02, +0x4a, 0x2f, 0x77, 0x05, 0xce, 0xb5, 0x6e, 0x37, +0x85, 0x42, 0x12, 0xbe, 0x03, 0x43, 0x40, 0xce, +0xfb, 0x0d, 0xf5, 0x42, 0x12, 0xbd, 0x80, 0x54, +0x80, 0x47, 0xe0, 0xfd, 0x61, 0x31, 0x82, 0xca, +0x17, 0xda, 0x95, 0xa0, 0x0a, 0x35, 0xb5, 0xfa, +0x82, 0x22, 0xeb, 0xda, 0x46, 0x41, 0x74, 0xd7, +0x9b, 0xc6, 0xf8, 0xb2, 0x1b, 0xb0, 0x00, 0xee, +0x7f, 0x11, 0x38, 0xd9, 0xbb, 0x18, 0xd8, 0x27, +0xc8, 0xcd, 0x2c, 0xf5, 0x2c, 0x73, 0x60, 0x6d, +0x5d, 0xcf, 0xf9, 0x09, 0x3b, 0xa6, 0x50, 0x72, +0xaf, 0x4a, 0xf0, 0xda, 0x00, 0x00, 0x00, 0x00, +0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +#include "wx/mstream.h" + +static wxImage *mode_transaction_png_img() +{ + if (!wxImage::FindHandler(wxT("PNG file"))) + wxImage::AddHandler(new wxPNGHandler()); + static wxImage *img_mode_transaction_png = new wxImage(); + if (!img_mode_transaction_png || !img_mode_transaction_png->IsOk()) + { + wxMemoryInputStream img_mode_transaction_pngIS(mode_transaction_png_data, sizeof(mode_transaction_png_data)); + img_mode_transaction_png->LoadFile(img_mode_transaction_pngIS, wxBITMAP_TYPE_PNG); + } + return img_mode_transaction_png; +} +#define mode_transaction_png_img mode_transaction_png_img() + +static wxBitmap *mode_transaction_png_bmp() +{ + static wxBitmap *bmp_mode_transaction_png; + if (!bmp_mode_transaction_png || !bmp_mode_transaction_png->IsOk()) + bmp_mode_transaction_png = new wxBitmap(*mode_transaction_png_img); + return bmp_mode_transaction_png; +} +#define mode_transaction_png_bmp mode_transaction_png_bmp() + +static wxIcon *mode_transaction_png_ico() +{ + static wxIcon *ico_mode_transaction_png; + if (!ico_mode_transaction_png || !ico_mode_transaction_png->IsOk()) + { + ico_mode_transaction_png = new wxIcon(); + ico_mode_transaction_png->CopyFromBitmap(*mode_transaction_png_bmp); + } + return ico_mode_transaction_png; +} +#define mode_transaction_png_ico mode_transaction_png_ico() + +#endif // MODE_TRANSACTION_PNG_H diff --git a/include/images/mode_transaction.svg b/include/images/mode_transaction.svg new file mode 100644 index 0000000..66dab0d --- /dev/null +++ b/include/images/mode_transaction.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + diff --git a/pgAdmin3.vcxproj b/pgAdmin3.vcxproj index 148cf94..6a4a441 100644 --- a/pgAdmin3.vcxproj +++ b/pgAdmin3.vcxproj @@ -1636,6 +1636,8 @@ + + diff --git a/pgAdmin3.vcxproj.filters b/pgAdmin3.vcxproj.filters index 38e0f11..164b7af 100644 --- a/pgAdmin3.vcxproj.filters +++ b/pgAdmin3.vcxproj.filters @@ -4648,6 +4648,12 @@ include\images + + include\images + + + include\images +