Commit 2945b574 authored by Anton van Wezenbeek's avatar Anton van Wezenbeek

added files

parent c844a6f3
Pipeline #195051 failed with stages
in 0 seconds
......@@ -5,19 +5,9 @@
// Copyright: (c) 2020 Anton van Wezenbeek
////////////////////////////////////////////////////////////////////////////////
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "app.h"
#include "frame.h"
#include <wex/cmdline.h>
#include <wex/ctags.h>
#include <wex/lexers.h>
#include <wex/stc-data.h>
#include <wex/tostring.h>
#include <wex/util.h>
#include <wex/version.h>
#include <wex/wex.h>
wxIMPLEMENT_APP(app);
......
......@@ -16,6 +16,7 @@
#include "app.h"
#include "decorated-frame.h"
#include "defs.h"
#include "editors.h"
const long pane_flag = wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_CLOSE_ON_ALL_TABS |
wxAUI_NB_CLOSE_BUTTON | wxAUI_NB_WINDOWLIST_BUTTON |
......@@ -736,66 +737,3 @@ void decorated_frame::on_notebook(wxWindowID id, wxWindow* page)
assert(0);
}
}
editors::editors(const wex::data::window& data)
: wex::notebook(data)
{
Bind(
wxEVT_MENU,
[=](wxCommandEvent& event) {
wxPostEvent(wxAuiNotebook::GetCurrentPage(), event);
},
wex::ID_EDIT_VCS_LOWEST,
wex::ID_EDIT_VCS_HIGHEST);
Bind(wxEVT_AUINOTEBOOK_END_DRAG, [=](wxAuiNotebookEvent& event) {
event.Skip();
m_split = true;
});
Bind(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, [=](wxAuiNotebookEvent& event) {
wex::menu menu(wex::menu::menu_t().set(wex::menu::IS_POPUP));
auto* split = new wex::menu(
{{ID_SPLIT_VERTICALLY, _("Split Vertically")},
{ID_SPLIT_HORIZONTALLY, _("Split Horizontally")},
{},
{ID_SPLIT, _("Split")}});
if (GetPageCount() > 1)
{
split->append(
{{},
{wxWindow::NewControlId(),
_("Rearrange Vertically"),
wex::data::menu().action([=](wxCommandEvent&) {
rearrange(wxLEFT);
})},
{wxWindow::NewControlId(),
_("Rearrange Horizontally"),
wex::data::menu().action([=](wxCommandEvent&) {
rearrange(wxTOP);
})}});
}
menu.append(
{{split, _("Split"), wxWindow::NewControlId()},
{},
{wxID_CLOSE},
{wex::ID_ALL_CLOSE, _("Close A&ll")}});
if (GetPageCount() > 2)
{
menu.append({{wex::ID_ALL_CLOSE_OTHERS, _("Close Others")}});
}
if (auto* stc = dynamic_cast<wex::stc*>(wxAuiNotebook::GetCurrentPage());
stc->get_file().get_filename().file_exists() &&
wex::vcs::dir_exists(stc->get_file().get_filename()))
{
menu.append({{}, {stc->get_file().get_filename()}});
}
PopupMenu(&menu);
});
}
......@@ -5,7 +5,7 @@
// Copyright: (c) 2020 Anton van Wezenbeek
////////////////////////////////////////////////////////////////////////////////
#pragma
#pragma once
#include <wex/notebook.h>
#include <wex/process.h>
......@@ -14,18 +14,7 @@
#include <wex/report/listview.h>
class app;
class editors : public wex::notebook
{
public:
editors(const wex::data::window& data);
bool is_split() const { return m_split; };
void reset() { m_split = false; };
private:
bool m_split{false};
};
class editors;
class decorated_frame : public wex::report::frame
{
......
////////////////////////////////////////////////////////////////////////////////
// Name: editors.cpp
// Purpose: Implementation of editors class
// Author: Anton van Wezenbeek
// Copyright: (c) 2020 Anton van Wezenbeek
////////////////////////////////////////////////////////////////////////////////
#include <wex/wex.h>
#include "defs.h"
#include "editors.h"
editors::editors(const wex::data::window& data)
: wex::notebook(data)
{
Bind(
wxEVT_MENU,
[=](wxCommandEvent& event) {
wxPostEvent(wxAuiNotebook::GetCurrentPage(), event);
},
wex::ID_EDIT_VCS_LOWEST,
wex::ID_EDIT_VCS_HIGHEST);
Bind(wxEVT_AUINOTEBOOK_END_DRAG, [=](wxAuiNotebookEvent& event) {
event.Skip();
m_split = true;
});
Bind(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, [=](wxAuiNotebookEvent& event) {
wex::menu menu(wex::menu::menu_t().set(wex::menu::IS_POPUP));
auto* split = new wex::menu(
{{ID_SPLIT_VERTICALLY, _("Split Vertically")},
{ID_SPLIT_HORIZONTALLY, _("Split Horizontally")},
{},
{ID_SPLIT, _("Split")}});
if (GetPageCount() > 1)
{
split->append(
{{},
{wxWindow::NewControlId(),
_("Rearrange Vertically"),
wex::data::menu().action([=](wxCommandEvent&) {
rearrange(wxLEFT);
})},
{wxWindow::NewControlId(),
_("Rearrange Horizontally"),
wex::data::menu().action([=](wxCommandEvent&) {
rearrange(wxTOP);
})}});
}
menu.append(
{{split, _("Split"), wxWindow::NewControlId()},
{},
{wxID_CLOSE},
{wex::ID_ALL_CLOSE, _("Close A&ll")}});
if (GetPageCount() > 2)
{
menu.append({{wex::ID_ALL_CLOSE_OTHERS, _("Close Others")}});
}
if (auto* stc = dynamic_cast<wex::stc*>(wxAuiNotebook::GetCurrentPage());
stc->get_file().get_filename().file_exists() &&
wex::vcs::dir_exists(stc->get_file().get_filename()))
{
menu.append({{}, {stc->get_file().get_filename()}});
}
PopupMenu(&menu);
});
}
////////////////////////////////////////////////////////////////////////////////
// Name: editors.h
// Purpose: Declaration of editors class
// Author: Anton van Wezenbeek
// Copyright: (c) 2020 Anton van Wezenbeek
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <wex/notebook.h>
class editors : public wex::notebook
{
public:
editors(const wex::data::window& data);
bool is_split() const { return m_split; };
void reset() { m_split = false; };
private:
bool m_split{false};
};
......@@ -8,6 +8,7 @@
#include <thread>
#include "app.h"
#include "defs.h"
#include "editors.h"
#include "frame.h"
#include <wex/wex.h>
#include <wx/imaglist.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment