wex v24.10.0
|
Adds file and project history support to frame. More...
#include <wex/del/frame.h>
Public Member Functions | |
frame (size_t maxFiles=9, size_t maxProjects=0, const data::window &data=data::window().style(wxDEFAULT_FRAME_STYLE)) | |
Default constructor. | |
~frame () override | |
Destructor. | |
virtual listview * | activate (wex::data::listview::type_t, const lexer *lexer=nullptr) |
This method is called to activate a certain listview. | |
virtual file * | get_project () |
If there is a project somewhere, your implementation should return that one. | |
config::strings_t | default_extensions () const |
Returns a list with default file extensions. | |
bool | find_in_files (const std::vector< path > &files, const tool &tool, bool show_dialog=true, listview *report=nullptr) |
Finds (or replaces) in specified files. | |
int | find_in_files_dialog (const tool &tool, bool add_in_files=false) |
Shows a modal find (or replace) in files dialog. | |
const std::string | find_in_files_title (wex::window_id id) const |
Returns caption for find_in_files_dialog. | |
auto * | get_debug () |
Debugging interface. | |
auto & | get_project_history () |
Returns project history. | |
bool | grep (const std::string &line, bool sed=false) |
greps for text. | |
bool | open_from_action (const std::string &file, const std::string &move_ext) |
Opens file from action with a possible extension to move. | |
bool | sed (const std::string &line) |
Sed (replace in files). | |
void | set_recent_project (const path &path) |
Updates project history. | |
void | statustext_vcs (factory::stc *stc) |
Shows vcs info on statusbar. | |
void | sync (bool start=true) |
Starts or stops syncing. | |
void | use_file_history_list (listview *list) |
Uses specified history list, and adds all elements from file history to the list. | |
wex::vcs * | vcs () |
Returns the vcs. | |
bool | vcs_blame_show (vcs_entry *vcs, syntax::stc *) |
Shows blame info for vcs in the text margin. | |
void | vcs_destroy_dialog () |
If vcs dialog was open, destroy it;. | |
void | bind_accelerators (wxWindow *parent, const std::vector< wxAcceleratorEntry > &v, bool debug=false) override |
Binds accelerators. | |
void | debug_add_menu (menu &m, bool b) override |
Adds debug menu. | |
void | debug_exe (int id, syntax::stc *stc) override |
Runs debug action. | |
void | debug_exe (const std::string &exe, syntax::stc *stc) override |
Runs debug command. | |
wxEvtHandler * | debug_handler () override |
Sets a debug handler. | |
bool | debug_is_active () const override |
Runs true if we are debugging. | |
bool | debug_print (const std::string &text) override |
Prints a debug variable. | |
bool | debug_toggle_breakpoint (int line, syntax::stc *stc) override |
Toggles a breakpoint on line. | |
void | on_command_item_dialog (wxWindowID dialogid, const wxCommandEvent &event) override |
Called when an item dialog command event is triggered. | |
void | on_notebook (wxWindowID id, wxWindow *page) override |
Called if the notebook changed page. | |
bool | process_async_system (const process_data &data) override |
Runs async process. | |
void | set_recent_file (const path &path) override |
Allows derived class to update file history. | |
void | show_ex_bar (int action=HIDE_BAR_FOCUS_STC, syntax::stc *stc=nullptr) override |
Shows or hides the ex bar. | |
void | show_ex_message (const std::string &text) override |
Shows text in ex bar. | |
void | statusbar_clicked (const std::string &) override |
When (left) clicked, uses the get_stc() for some dialogs. | |
void | statusbar_clicked_right (const std::string &) override |
Do something when statusbar is (right) clicked. | |
syntax::stc * | stc_entry_dialog_component () override |
Returns stc component for stc entry dialog. | |
int | stc_entry_dialog_show (bool modal=false) override |
Shows or updates stc entry dialog. | |
std::string | stc_entry_dialog_title () const override |
Returns stc entry dialog title. | |
void | stc_entry_dialog_title (const std::string &title) override |
Sets stc entry dialog title. | |
void | stc_entry_dialog_validator (const std::string ®ex) override |
Sets stc entry dialog validator. | |
void | vcs_add_path (factory::link *) override |
Adds vcs path. | |
bool | vcs_annotate_commit (syntax::stc *, int line, const std::string &commit_id) override |
Annotates commit. | |
void | vcs_append (menu *, const menu_item *i) const override |
Appends vcs menu. | |
bool | vcs_blame (syntax::stc *) override |
Blames the specified stc. | |
bool | vcs_blame_revision (syntax::stc *, const std::string &renamed, const std::string &offset) override |
Blames revision. | |
bool | vcs_dir_exists (const path &p) const override |
Returns true if dir exists. | |
bool | vcs_execute (int event_id, const std::vector< wex::path > &paths, const data::window &arg=data::window()) override |
Executes vcs. | |
bool | vi_is_address (syntax::stc *stc, const std::string &text) const override |
Allows you to override vi_is_address, it is overridden in del frame, returning true if text specifies a one or two address based ex address (including command). | |
![]() | |
frame (size_t maxFiles=9, const data::window &data=data::window().style(wxDEFAULT_FRAME_STYLE)) | |
Default constructor, registers the aui manager, and creates the bars. | |
~frame () override | |
Destructor, uninits the aui manager. | |
virtual bool | allow_close (wxWindowID id, wxWindow *page) |
Returns true if the page can be closed. | |
virtual void | debug_exe (const path &p) |
Invoked when a debug exe path is opened. | |
virtual bool | next_page () |
Moves to next page. If none or only one page present, returns false. | |
virtual void | open_file_same_page (const wex::path &p) |
Called on browse forward, backward. | |
virtual bool | print_ex (syntax::stc *stc, const std::string &text) |
Allows you to override print ex. | |
virtual void | record (const std::string &command) |
Allows you to perform action for a (vi) command. | |
virtual syntax::stc * | restore_page (const std::string &key) |
Restores a previous saved current page. | |
virtual bool | save_current_page (const std::string &key) |
Saves the current page, to restore later on. | |
virtual void | shift_double_click () |
Act on a double shift click. | |
virtual void | sync_all () |
Called after you checked the Sync checkbox on the options toolbar. | |
virtual void | sync_close_all (wxWindowID id) |
Called after all pages from the notebooks are deleted. | |
virtual bool | vi_exec_command (ex_command &command) |
Executes a ex command. | |
bool | allow_browse_backward () const |
Can we browse backward? | |
bool | allow_browse_forward () const |
Can we browse forward? | |
bool | browse (const wxCommandEvent &event) |
Handles forward and backward click. | |
const auto * | debug_entry () const |
Returns current debugger. | |
auto & | file_history () |
Returns file history. | |
auto * | get_find_toolbar () |
Returns the find toolbar. | |
auto * | get_options_toolbar () |
Returns the options toolbar. | |
auto * | get_statusbar () |
Returns statusbar. | |
auto * | get_toolbar () |
Returns the toolbar. | |
const std::string | pane_add (wxWindow *pane) |
Adds a window as a pane, generating a unique name. | |
bool | pane_add (const panes_t &panes, const std::string &perspective="managed frame") |
Add panes to the manager. | |
wxWindow * | pane_get (const std::string &pane) |
Returns window related to window, or nullptr if pane is not present. | |
bool | pane_is_maximized (const std::string &pane) |
Returns true if the managed pane is maximized. | |
bool | pane_is_shown (const std::string &pane) |
Returns true if pane is shown. | |
bool | pane_maximize (const std::string &pane) |
Maximizes the managed pane. | |
bool | pane_restore (const std::string &pane) |
Restores the managed pane. | |
bool | pane_set (const std::string &pane, const wxAuiPaneInfo &info) |
Updates pane info for managed pane. | |
bool | pane_show (const std::string &pane, bool show=true) |
Shows or hides the managed pane. | |
bool | pane_toggle (const std::string &pane) |
Toggles the managed pane: if shown hides it, otherwise shows it. | |
size_t | panes () const |
Returns number of panes. | |
void | set_debug_entry (wex::debug_entry *de) |
Sets debug entry. | |
statusbar * | setup_statusbar (const std::vector< statusbar_pane > &panes, long style=wxST_SIZEGRIP, const std::string &name="statusBar") |
Sets up the status bar if you want to use statustext. | |
bool | show_ex_command (syntax::stc *stc, const std::string &label) |
Returns a command line ex command. | |
bool | show_ex_input (syntax::stc *stc, char command) |
Shows ex bar, and enters input mode. | |
void | show_process (bool show) |
Shows or hide process pane. | |
const auto & | toggled_panes () const |
Returns the toggled panes. | |
std::string | get_statustext (const std::string &pane) const override |
overridden methods | |
factory::stc * | open_file (const path &filename, const data::stc &data=data::stc()) override |
Default opens the file using get_stc. | |
bool | output (const std::string &text) const override |
Allows you to handle output text, .e.g. from a process. | |
void | set_recent_file (const path &path) override |
Allows derived class to update file history. | |
void | statusbar_clicked_right (const std::string &) override |
Do something when statusbar is (right) clicked. | |
bool | statustext (const std::string &text, const std::string &pane) const override |
Sets text on specified pane. | |
![]() | |
frame () | |
Default constructor. | |
frame (wxWindow *parent, wxWindowID winid, const std::string &title) | |
Constructor for wxFrame. | |
~frame () | |
Destructor. | |
virtual factory::grid * | get_grid () |
Returns a grid. | |
virtual factory::listview * | get_listview () |
Returns a listview. | |
virtual factory::process * | get_process (const std::string &command) |
Allows you to e.g. | |
virtual factory::stc * | get_stc () |
Returns an stc. | |
virtual bool | is_open (const path &filename) |
Returns true if file is opened in a window. | |
virtual factory::stc * | open_file (const path &filename, const std::string &text, const data::stc &data) |
Allows you to open a filename with specified contents. | |
virtual factory::stc * | open_file_vcs (const path &filename, vcs_entry &vcs, const data::stc &data) |
Allows you to open a filename with info from vcs. | |
wxWindow * | get_find_focus () |
Returns the find focus. | |
bool | is_closing () const |
Are we closing? | |
void | set_find_focus (wxWindow *focus) |
Sets the find focus to specified window. | |
bool | update_statusbar (const wxListView *lv) |
Updates statusbar pane items pane with values from specified listview. | |
bool | update_statusbar (factory::stc *stc, const std::string &pane) |
Updates the specified statusbar pane with values from specified stc. | |
void | SetMenuBar (wxMenuBar *bar) override |
Override from base class. | |
Static Public Attributes | |
static const int | id_find_in_files = ID_FREE_LOWEST |
Overridden methods. | |
Protected Member Functions | |
auto * | file_history_list () |
Access to file history list, if you use this as a page in a notebook, you might want prevent closing it. | |
Additional Inherited Members | |
![]() | |
enum | { HIDE_BAR , HIDE_BAR_FOCUS_STC , HIDE_BAR_FORCE , HIDE_BAR_FORCE_FOCUS_STC , SHOW_BAR , SHOW_BAR_SYNC_CLOSE_ALL } |
Enums for show_ex_bar. More... | |
typedef std::vector< std::pair< wxWindow *, wxAuiPaneInfo > > | panes_t |
Panes vector with a pair of panes. | |
typedef std::vector< std::pair< std::pair< std::string, std::string >, int > > | toggled_panes_t |
Toggled panes type. | |
Adds file and project history support to frame.
It also sets a change indicator in the title of the frame if applicable. Finally it adds find in files and selection dialogs.
wex::del::frame::frame | ( | size_t | maxFiles = 9, |
size_t | maxProjects = 0, | ||
const data::window & | data = data::window().style(wxDEFAULT_FRAME_STYLE) ) |
Default constructor.
Default it gives file history support to be used from the file menu. So you should call use_file_history_list somewhere to set it up. Default it does not use a recent project file.
|
inlinevirtual |
This method is called to activate a certain listview.
Default it returns nullptr.
bool wex::del::frame::find_in_files | ( | const std::vector< path > & | files, |
const tool & | tool, | ||
bool | show_dialog = true, | ||
listview * | report = nullptr ) |
Finds (or replaces) in specified files.
Returns true if process started.
files | the files |
tool | ID_TOOL_REPORT_FIND or ID_TOOL_REPLACE |
show_dialog | Default shows a dialog. |
report | report for output |
int wex::del::frame::find_in_files_dialog | ( | const tool & | tool, |
bool | add_in_files = false ) |
Shows a modal find (or replace) in files dialog.
Returns result from ShowModal.
tool | ID_TOOL_REPORT_FIND or ID_TOOL_REPLACE |
add_in_files | add file types selection as well |
|
inlinevirtual |
If there is a project somewhere, your implementation should return that one.
Default it returns nullptr.
bool wex::del::frame::grep | ( | const std::string & | line, |
bool | sed = false ) |
greps for text.
The base directory is the directory for the current stc component, if available. Returns true if process started.
line | text [extension] [folder] |
sed | normally grep does not replace, by setting sed, it can |
bool wex::del::frame::open_from_action | ( | const std::string & | file, |
const std::string & | move_ext ) |
Opens file from action with a possible extension to move.
If file not empty returns false if an error occurred or no files opened, and true if at least one file was opened (does not need to exist). Otherwise always returns true.
file | the file, might contain wildcards (* or ?), if empty a dialog is shown |
move_ext | possible extension |
|
inline |
Sed (replace in files).
The base directory is the directory for the current stc component, if available. Returns true if process started.
line | text replacement [extension] [folder] |
|
overridevirtual |
Shows or hides the ex bar.
Default it hides the ex bar and sets focus back to stc component associated with current ex. If current ex has ex mode enabled, the ex bar is always shown.
action | action |
stc | stc component to use for showing ex bar (for SHOW_ actions) |
Reimplemented from wex::frame.
|
inline |
Starts or stops syncing.
Default syncing is started during construction.
bool wex::del::frame::vcs_blame_show | ( | vcs_entry * | vcs, |
syntax::stc * | ) |
Shows blame info for vcs in the text margin.
Returns true if info was added.
|
overridevirtual |
Executes vcs.
event_id | the vcs id |
paths | the paths |
arg | window data |
Reimplemented from wex::frame.
|
overridevirtual |
Allows you to override vi_is_address, it is overridden in del frame, returning true if text specifies a one or two address based ex address (including command).
e.g. 1,5y, y, etc.
Reimplemented from wex::frame.