28 long idNB_TabBottom =
wxNewId();
30 long idCopyAllToClipboard =
wxNewId();
31 long idCopySelectedToClipboard =
wxNewId();
43 EVT_MENU_RANGE(idCopyAllToClipboard, idCopySelectedToClipboard,
InfoPane::OnCopy)
63 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
75 for (
size_t i = 0 ; i <
m_Pages.GetCount(); ++i)
77 layout <<
m_Pages.Item(i)->title;
79 layout <<
m_Pages.Item(i)->indexInNB;
82 layout <<
_T(
"|selection=");
101 for (
size_t j = 0; j <
m_Pages.GetCount();++j)
103 if (
m_Pages.Item(j)->title == title)
107 m_Pages.Item(j)->indexInNB = theIndex;
118 int index1 = ((*p1)->indexInNB >= 0?(*p1)->indexInNB:~(*p1)->indexInNB);
119 int index2 = ((*p2)->indexInNB >= 0?(*p2)->indexInNB:~(*p2)->indexInNB);
120 return index1 - index2;
129 cbAuiNotebook::Hide();
131 for (
size_t i = 0 ; i <
m_Pages.GetCount(); ++i)
134 if (
m_Pages.Item(i)->indexInNB < 0)
139 m_Pages.Item(i)->window->Hide();
145 if (index++ != pageIndex)
149 cbAuiNotebook::Show();
164 return InsertPage(index, p, title,
false, bmp);
169 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
172 if (
m_Pages.Item(i)->indexInNB >= 0)
181 if (
m_Pages.Item(i)->indexInNB < 0)
193 m_Pages.Item(i)->window->Hide();
201 for (
size_t i=0; i <
m_Pages.GetCount(); i++)
203 if (
m_Pages.Item(i)->window == win)
212 is_logger =
m_Pages.Item(i)->islogger;
213 return (is_logger ? i : -1);
218 if (index < 0 || (
size_t)index >
m_Pages.GetCount())
225 if (index < 0 || (
size_t)index >
m_Pages.GetCount())
232 if (
m_Pages.Item(i)->window ==
nullptr)
235 if (
m_Pages.Item(i)->indexInNB < 0)
243 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
245 if (
m_Pages.Item(i)->logger == logger)
247 if (
m_Pages.Item(i)->indexInNB >= 0)
256 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
258 if (
m_Pages.Item(i)->logger == logger)
260 if (
m_Pages.Item(i)->indexInNB < 0)
271 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
273 if (
m_Pages.Item(i)->window == p)
275 if (
m_Pages.Item(i)->indexInNB >= 0)
284 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
286 if (
m_Pages.Item(i)->window == p)
288 if (
m_Pages.Item(i)->indexInNB < 0)
303 if (event.GetId() == idCopyAllToClipboard)
304 m_Pages.Item(i)->logger->CopyContentsToClipboard(
false);
305 else if (event.GetId() == idCopySelectedToClipboard)
306 m_Pages.Item(i)->logger->CopyContentsToClipboard(
true);
324 m_Pages.Item(i)->logger->Clear();
329 int eventID =
event.GetId();
330 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
332 if (eventID ==
m_Pages.Item(i)->eventID)
376 if ( (selection >= 0)
384 menu.
Append(idCopyAllToClipboard,
_(
"Copy contents to clipboard"));
385 menu.
Append(idCopySelectedToClipboard,
_(
"Copy selection to clipboard"));
387 bool needSeparator =
true;
392 needSeparator =
false;
402 menu.
Append(idClear,
_(
"Clear contents"));
411 if (
Manager::Get()->GetConfigManager(
_T(
"app"))->ReadBool(
_T(
"/environment/infopane_tabs_bottom"),
false))
412 menu.
Append(idNB_TabTop,
_(
"Tabs at top"));
414 menu.
Append(idNB_TabBottom,
_(
"Tabs at bottom"));
418 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
437 long style = GetWindowStyleFlag();
438 style &= ~wxAUI_NB_BOTTOM;
440 if (event.GetId() == idNB_TabBottom)
441 style |= wxAUI_NB_BOTTOM;
442 SetWindowStyleFlag(style);
495 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
497 if (
m_Pages.Item(i)->logger == l)
503 if (
m_Pages.Item(i)->indexInNB >= 0)
517 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
519 if (
m_Pages.Item(i)->window == p)
522 cbThrow(
_T(
"Bad API usage. Shame on you."));
535 for (
size_t i = 0; i <
m_Pages.GetCount(); ++i)
537 if (
m_Pages.Item(i)->window == p)
540 cbThrow(
_T(
"Bad API usage. Shame on you."));
542 if (
m_Pages.Item(i)->indexInNB >= 0)
wxString AfterLast(wxUniChar ch) const
static const int infopane_flags
bool AddPage(wxWindow *page, const wxString &caption, bool select=false, const wxBitmap &bitmap=wxNullBitmap)
Add Page.
static int CompareIndexes(Page **p1, Page **p2)
virtual bool HasFeature(cb_optional Feature::Enum feature) const
void HideNonLogger(wxWindow *p)
ConfigManager * GetConfigManager(const wxString &name_space) const
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void OnTabPosition(wxCommandEvent &event)
bool RemovePage(size_t page)
Remove Page.
bool DeletePage(size_t page)
Delete Page.
void ShowNonLogger(wxWindow *p)
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
bool RemoveNonLogger(wxWindow *p)
size_t GetPageCount() const
size_t FindIndex(Logger *l)
virtual void ToggleWrapMode()
wxWindow * GetWindow(int index)
void OnClear(wxCommandEvent &event)
The base class for all kinds of loggers, see loggers.h for its derived classes.
wxWindow * GetCurrentPage() const
wxString & Remove(size_t pos)
int GetPageIndexByWindow(wxWindow *win)
wxString AfterFirst(wxUniChar ch) const
bool AddLogger(Logger *logger, wxWindow *p, const wxString &title, wxBitmap *icon=nullptr)
int AddPagePrivate(wxWindow *p, const wxString &title, wxBitmap *icon=nullptr)
void OnCloseClicked(wxAuiNotebookEvent &event)
wxString BeforeFirst(wxUniChar ch, wxString *rest=NULL) const
bool InsertPage(size_t page_idx, wxWindow *page, const wxString &caption, bool select=false, const wxBitmap &bitmap=wxNullBitmap)
Insert Page.
void LoadTabOrder(wxString layout)
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
size_t SetSelection(size_t new_page)
void OnWrapMode(wxCommandEvent &event)
int(* CompareFunction)(Page **, Page **)
bool DeleteLogger(Logger *l)
a logger which prints messages to a wxTextCtrl
LogManager * GetLogManager() const
void OnCopy(wxCommandEvent &event)
Logger * GetLogger(int index)
void UpdateEffectiveTabOrder()
const wxString & _(const wxString &string)
wxWindow * GetPage(size_t page_idx) const
static wxString GetDataFolder(bool global=true)
bool ToLong(long *val, int base=10) const
bool HasMoreTokens() const
int GetTabPositionFromIndex(int index)
Get the tab position.
int GetPageIndex(wxWindow *page_wnd) const
bool AddNonLogger(wxWindow *p, const wxString &title, wxBitmap *icon=nullptr)
A notebook class This class is derived from wxAuiNotebook, to enhance its abilities.
virtual bool GetWrapMode() const
void Toggle(size_t index)
void ReorderTabs(CompareFunction cmp_f)
int Find(wxUniChar ch, bool fromEnd=false) const
bool MovePage(wxWindow *page, size_t new_idx)
Move page.
bool InsertPagePrivate(wxWindow *p, const wxString &title, wxBitmap *icon=nullptr, int index=-1)
bool DeleteNonLogger(wxWindow *p)