12#ifndef INKSCAPE_DIALOG_COMMAND_PALETTE_H
13#define INKSCAPE_DIALOG_COMMAND_PALETTE_H
15#include <gtkmm/enums.h>
20enum class ModifierType;
87 void add_action(
const std::string &full_action_name);
90 void add_open(
const std::string &uri);
149 bool on_key_pressed(
unsigned keyval,
unsigned keycode, Gdk::ModifierType state);
168 static bool fuzzy_search(
const Glib::ustring &subject,
const Glib::ustring &search);
169 static bool normal_search(
const Glib::ustring &subject,
const Glib::ustring &search);
171 static int fuzzy_points(
const Glib::ustring &subject,
const Glib::ustring &search);
173 static int fuzzy_points_compare(
int fuzzy_points_count_1,
int fuzzy_points_count_2,
int text_len_1,
int text_len_2);
176 int on_sort(Gtk::ListBoxRow *row1, Gtk::ListBoxRow *row2);
180 void add_color(Gtk::Label *
label,
const Glib::ustring &search,
const Glib::ustring &subject,
bool tooltip=
false);
181 void remove_color(Gtk::Label *
label,
const Glib::ustring &subject,
bool tooltip=
false);
Inkscape::XML::Document * _xml_doc
void add_import(const std::string &uri)
void add_open(const std::string &uri)
void add_action(const std::string &full_action_name)
Inkscape::XML::Node * _params
std::vector< History > get_operation_history() const
To construct _CPHistory.
std::vector< std::string > get_action_parameter_history(const std::string &full_action_name) const
To get parameter history when an action is selected, LIFO stack like so more recent first.
void add_action_parameter(const std::string &full_action_name, const std::string ¶m)
Remember parameter for action.
std::optional< History > get_last_operation()
static std::optional< HistoryType > _get_operation_type(Inkscape::XML::Node *operation)
void add_operation(const HistoryType history_type, const std::string &data)
Inkscape::XML::Node * _operations
const std::string _file_path
Gtk::ListBox & _CPSuggestions
void on_row_activated(Gtk::ListBoxRow *activated_row)
CPMode _mode
Remember the mode we are in helps in unnecessary signal disconnection and reconnection Used by set_mo...
static bool fuzzy_tolerance_search(const Glib::ustring &subject, const Glib::ustring &search)
The Searching algorithm consists of fuzzy search and fuzzy points.
bool operate_recent_file(Glib::ustring const &uri, bool const import)
bool on_filter_full_action_name(Gtk::ListBoxRow *child)
static bool fuzzy_search(const Glib::ustring &subject, const Glib::ustring &search)
Implements text matching logic.
bool _win_doc_actions_loaded
void add_color(Gtk::Label *label, const Glib::ustring &search, const Glib::ustring &subject, bool tooltip=false)
bool generate_action_operation(const ActionPtrName &action_ptr_name, const bool is_suggestion)
void load_win_doc_actions()
static TypeOfVariant get_action_variant_type(const ActionPtr &action_ptr)
int on_filter_general(Gtk::ListBoxRow *child)
static ActionPtrName get_action_ptr_name(Glib::ustring full_action_name)
Calls actions with parameters.
bool on_filter_recent_file(Gtk::ListBoxRow *child, bool const is_import)
Gtk::ScrolledWindow & _CPSuggestionsScroll
static int fuzzy_points(const Glib::ustring &subject, const Glib::ustring &search)
Calculates the fuzzy_point.
~CommandPalette()=default
Glib::RefPtr< Gio::Action > ActionPtr
void on_action_fullname_clicked(const Glib::ustring &action_fullname)
static std::pair< Gtk::Label *, Gtk::Label * > get_name_desc(Gtk::ListBoxRow *child)
Gtk::Box & get_base_widget()
sigc::connection _cpfilter_search_connection
Stores the search connection to deactivate when not needed.
const int _max_height_requestable
void append_recent_file_operation(const Glib::ustring &path, bool is_suggestion, bool is_import=true)
bool ask_action_parameter(const ActionPtrName &action)
Maybe replaced by: Temporary arrangement may be replaced by snippets This can help us provide paramet...
void remove_color(Gtk::Label *label, const Glib::ustring &subject, bool tooltip=false)
Color removal.
static int fuzzy_tolerance_points(const Glib::ustring &subject, const Glib::ustring &search)
Gtk::ScrolledWindow & _CPHistoryScroll
bool on_key_pressed(unsigned keyval, unsigned keycode, Gdk::ModifierType state)
Gtk::Label * get_full_action_name(Gtk::ListBoxRow *child)
Glib::ustring _search_text
static bool normal_search(const Glib::ustring &subject, const Glib::ustring &search)
Searching the full search_text in the subject string used for CPDescription text.
Gtk::SearchEntry2 & _CPFilter
std::pair< ActionPtr, Glib::ustring > ActionPtrName
Glib::RefPtr< Gtk::Builder > _builder
std::optional< ActionPtrName > _ask_action_ptr_name
Stores the most recent ask_action_name for when Entry::activate fires & we are in INPUT mode.
void on_activate_cpfilter()
void set_mode(CPMode mode)
CPHistoryXML _history_xml
History.
static void add_color_description(Gtk::Label *label, const Glib::ustring &search)
Color addition for description text Coloring complete consecutive search text in the description text...
int on_sort(Gtk::ListBoxRow *row1, Gtk::ListBoxRow *row2)
compare different rows for order of display priority of comparison 1) CPName->get_text() 2) CPName->g...
static int fuzzy_points_compare(int fuzzy_points_count_1, int fuzzy_points_count_2, int text_len_1, int text_len_2)
void on_window_focus(Gtk::Widget const *focus)
Gtk::ListBox & _CPHistory
void on_history_selection_changed(Gtk::ListBoxRow *lb)
CommandPalette & operator=(CommandPalette const &)=delete
CommandPalette(CommandPalette const &)=delete
bool on_entry_keypress(unsigned keyval, unsigned, Gdk::ModifierType)
bool execute_action(const ActionPtrName &action, const Glib::ustring &value)
Interface for refcounted XML nodes.
History(HistoryType ht, std::string &&data)
Interface for XML documents.
Interface for XML documents.