мелкие правки: более правильное сохранение активной закладки.
Учтено использование ctltree не только в браузере объектов.
This commit is contained in:
lsv 2021-06-03 13:55:58 +05:00
parent 055b561af0
commit 9f11446e5d
2 changed files with 14 additions and 11 deletions

View file

@ -198,13 +198,14 @@ void ctlTree::OnMouse(wxMouseEvent& event)
else {
if ((flags & wxTREE_HITTEST_ONITEMINDENT) == wxTREE_HITTEST_ONITEMINDENT && (item==GetSelection())) {
wxRect r;
wxClientDC dc(this);
GetBoundingRect(item, r, true);
r.width = r.x-19;
r.x = r.x - 19;
if (r.x < 10) return;
wxTreeItemId prev;
wxTreeItemId itemParent = item;
wxImageList *list=this->GetImageList();
wxClientDC dc(this);
bool ex = false;
while (!ex) {
//ex = true;
@ -214,17 +215,17 @@ void ctlTree::OnMouse(wxMouseEvent& event)
if (!itemParent.IsOk()) break;
r.x = r.x - 19;
//if (r.x >= pt.x) ex = false;
dc.SetClippingRegion(r.x + 1-19, r.y + 1,
int image = this->GetItemImage(itemParent);
if (image >= 0) {
dc.SetClippingRegion(r.x + 1 - 19, r.y + 1,
16, 16);
int image = this->GetItemImage(itemParent);
list->Draw(image, dc,
r.x + 1-19,
r.x + 1 - 19,
r.y + 1,
wxIMAGELIST_DRAW_TRANSPARENT
);
dc.DestroyClippingRegion();
}
}
// dc.SetBrush(*wxRED);
// dc.SetPen(*wxTRANSPARENT_PEN);

View file

@ -777,13 +777,13 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w
wxString pref=_conn->GetDbname();
bool modeUnicode = settings->GetUnicodeFile();
wxString activePage;
wxArrayString activePage;
wxString f = wxFindFirstFile(tempDir+wxT("*.a"));
while ( !f.empty() )
{
filename=f.AfterLast('\\').BeforeLast('.');
if (filename.BeforeFirst('.') == "_active") {
activePage = filename.AfterFirst('.');
activePage.Add(filename.AfterFirst('.'));
}
if ((f.AfterLast('\\').StartsWith(pref+wxT("."))||(filename.BeforeLast('.').IsEmpty()))) {
wxUtfFile file(f, wxFile::read, modeUnicode ? wxFONTENCODING_UTF8 : wxFONTENCODING_DEFAULT);
@ -830,8 +830,9 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w
//outputPane->GetPageText(curpage) == _("History");
for (int i = 0; i < sqlQueryBook->GetPageCount(); i++) {
wxString textpage = sqlQueryBook->GetPageText(i);
if (textpage ==activePage) {
if (wxNOT_FOUND !=activePage.Index(textpage)) {
sqlQueryBook->SetSelection(i);
break;
//sqlQueryBook->ChangeSelection(i);
//if (sqlQueryBook->GetSelection()!=i) sqlQueryBook->SetSelection(i);
}
@ -4160,8 +4161,9 @@ void frmQuery::fileMarkerActive(bool addOrRemove, wxString &sqlTabName) {
wxString fn = tempDir + wxT("_active.") + tabname + ".a";
//if (sqlTabName.Right(1)=='*' ) tabname=
if (addOrRemove)
wxUtfFile file(fn, wxFile::write, wxFONTENCODING_UTF8);
if (addOrRemove)
//wxUtfFile file(fn, wxFile::write, wxFONTENCODING_UTF8);
wxFile file(fn, wxFile::write);
else
if (wxFileName::FileExists(fn)) wxRemoveFile(fn);