mirror of https://gitlab.com/cppit/jucipp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.5 KiB
89 lines
2.5 KiB
|
8 years ago
|
#pragma once
|
||
|
11 years ago
|
#include <iostream>
|
||
|
|
#include "gtkmm.h"
|
||
|
|
#include "source.h"
|
||
|
11 years ago
|
#include <type_traits>
|
||
|
11 years ago
|
#include <map>
|
||
|
11 years ago
|
#include <sigc++/sigc++.h>
|
||
|
11 years ago
|
|
||
|
9 years ago
|
class Notebook : public Gtk::Paned {
|
||
|
10 years ago
|
class TabLabel : public Gtk::EventBox {
|
||
|
10 years ago
|
public:
|
||
|
8 years ago
|
TabLabel(const std::function<void()> &on_close);
|
||
|
10 years ago
|
Gtk::Label label;
|
||
|
|
};
|
||
|
10 years ago
|
|
||
|
9 years ago
|
class CursorLocation {
|
||
|
|
public:
|
||
|
8 years ago
|
CursorLocation(Source::View *view, Glib::RefPtr<Gtk::TextBuffer::Mark> mark_) : view(view), mark(std::move(mark_)) {}
|
||
|
9 years ago
|
Source::View *view;
|
||
|
|
Glib::RefPtr<Gtk::TextBuffer::Mark> mark;
|
||
|
|
};
|
||
|
|
|
||
|
10 years ago
|
private:
|
||
|
10 years ago
|
Notebook();
|
||
|
10 years ago
|
public:
|
||
|
|
static Notebook &get() {
|
||
|
|
static Notebook singleton;
|
||
|
|
return singleton;
|
||
|
|
}
|
||
|
|
|
||
|
10 years ago
|
size_t size();
|
||
|
|
Source::View* get_view(size_t index);
|
||
|
11 years ago
|
Source::View* get_current_view();
|
||
|
10 years ago
|
std::vector<Source::View*> &get_views();
|
||
|
|
|
||
|
|
void open(const boost::filesystem::path &file_path, size_t notebook_index=-1);
|
||
|
|
void configure(size_t index);
|
||
|
|
bool save(size_t index);
|
||
|
11 years ago
|
bool save_current();
|
||
|
10 years ago
|
bool close(size_t index);
|
||
|
|
bool close_current();
|
||
|
|
void next();
|
||
|
|
void previous();
|
||
|
|
void toggle_split();
|
||
|
9 years ago
|
/// Hide/Show tabs.
|
||
|
|
void toggle_tabs();
|
||
|
10 years ago
|
boost::filesystem::path get_current_folder();
|
||
|
8 years ago
|
std::vector<std::pair<size_t, Source::View*>> get_notebook_views();
|
||
|
10 years ago
|
|
||
|
9 years ago
|
Gtk::Label status_location;
|
||
|
|
Gtk::Label status_file_path;
|
||
|
|
Gtk::Label status_branch;
|
||
|
|
Gtk::Label status_diagnostics;
|
||
|
|
Gtk::Label status_state;
|
||
|
8 years ago
|
void update_status(Source::BaseView *view);
|
||
|
9 years ago
|
void clear_status();
|
||
|
10 years ago
|
|
||
|
10 years ago
|
std::function<void(Source::View*)> on_change_page;
|
||
|
|
std::function<void(Source::View*)> on_close_page;
|
||
|
9 years ago
|
|
||
|
|
/// Cursor history
|
||
|
|
std::vector<CursorLocation> cursor_locations;
|
||
|
|
size_t current_cursor_location=-1;
|
||
|
|
bool disable_next_update_cursor_locations=false;
|
||
|
9 years ago
|
void delete_cursor_locations(Source::View *view);
|
||
|
9 years ago
|
|
||
|
11 years ago
|
private:
|
||
|
10 years ago
|
size_t get_index(Source::View *view);
|
||
|
|
Source::View *get_view(size_t notebook_index, int page);
|
||
|
|
void focus_view(Source::View *view);
|
||
|
|
std::pair<size_t, int> get_notebook_page(size_t index);
|
||
|
|
|
||
|
|
std::vector<Gtk::Notebook> notebooks;
|
||
|
|
std::vector<Source::View*> source_views; //Is NOT freed in destructor, this is intended for quick program exit.
|
||
|
10 years ago
|
std::vector<std::unique_ptr<Gtk::Widget> > source_maps;
|
||
|
11 years ago
|
std::vector<std::unique_ptr<Gtk::ScrolledWindow> > scrolled_windows;
|
||
|
9 years ago
|
std::vector<std::unique_ptr<Gtk::Box> > hboxes;
|
||
|
10 years ago
|
std::vector<std::unique_ptr<TabLabel> > tab_labels;
|
||
|
10 years ago
|
|
||
|
10 years ago
|
bool split=false;
|
||
|
|
size_t last_index=-1;
|
||
|
10 years ago
|
|
||
|
|
void set_current_view(Source::View *view);
|
||
|
|
Source::View* current_view=nullptr;
|
||
|
|
Source::View* intermediate_view=nullptr;
|
||
|
10 years ago
|
|
||
|
|
bool save_modified_dialog(size_t index);
|
||
|
11 years ago
|
};
|