14#include <glibmm/i18n.h>
15#include <gtkmm/accelerator.h>
16#include <gtkmm/adjustment.h>
17#include <gtkmm/eventcontrollerfocus.h>
18#include <gtkmm/eventcontrollerkey.h>
19#include <gtkmm/listbox.h>
20#include <gtkmm/recentmanager.h>
21#include <gtkmm/scrolledwindow.h>
22#include <gtkmm/searchentry2.h>
45 , _CPFilter (
get_widget<
Gtk::SearchEntry2>(_builder,
"CPFilter"))
46 , _CPSuggestions (
get_widget<
Gtk::ListBox>(_builder,
"CPSuggestions"))
47 , _CPHistory (
get_widget<
Gtk::ListBox>(_builder,
"CPHistory"))
48 , _CPSuggestionsScroll (
get_widget<
Gtk::ScrolledWindow>(_builder,
"CPSuggestionsScroll"))
49 , _CPHistoryScroll (
get_widget<
Gtk::ScrolledWindow>(_builder,
"CPHistoryScroll"))
55 _CPBase.set_halign(Gtk::Align::CENTER);
56 _CPBase.set_valign(Gtk::Align::START);
60 auto const key = Gtk::EventControllerKey::create();
61 key->set_propagation_phase(Gtk::PropagationPhase::CAPTURE);
65 auto focus = Gtk::EventControllerFocus::create();
66 focus->property_contains_focus().signal_changed().connect([
this, &focus = *focus] {
67 if (!focus.contains_focus()) {
74 g_signal_connect(
_CPFilter.gobj(),
"activate", G_CALLBACK(+[] (GtkSearchEntry *self,
void *
data) {
79 auto const entry_key = Gtk::EventControllerKey::create();
80 entry_key->signal_key_pressed().connect([
this](
auto &&...args) {
return on_entry_keypress(args...); },
true);
94 auto recent_manager = Gtk::RecentManager::get_default();
95 auto recent_files = recent_manager->get_items();
97 Glib::ustring
const prgname = g_get_prgname();
99 for (
auto const &recent_file : recent_files) {
101 bool valid_file = recent_file->has_application(prgname) or
102 recent_file->has_application(
"org.inkscape.Inkscape") or
103 recent_file->has_application(
"inkscape") or
104 recent_file->has_application(
"inkscape.exe");
112 if (max_files-- <= 0) {
129 for (
const auto &
page : history) {
131 switch (
page.history_type) {
187 auto operation_builder =
create_builder(
"command-palette-operation.glade");
188 auto &CPOperation (get_widget<Gtk::Box> (operation_builder,
"CPOperation"));
189 auto &CPGroup (get_widget<Gtk::Label> (operation_builder,
"CPGroup"));
190 auto &CPName (get_widget<Gtk::Label> (operation_builder,
"CPName"));
191 auto &CPActionFullButton (get_widget<Gtk::Button>(operation_builder,
"CPActionFullButton"));
192 auto &CPActionFullLabel (get_widget<Gtk::Label> (operation_builder,
"CPActionFullLabel"));
193 auto &CPDescription (get_widget<Gtk::Label> (operation_builder,
"CPDescription"));
195 const auto file = Gio::File::create_for_path(path);
196 const Glib::ustring
file_name = file->get_basename();
200 CPGroup.set_text(
"import");
201 CPActionFullLabel.set_text(
"import");
204 CPGroup.set_text(
"open");
205 CPActionFullLabel.set_text(
"open");
209 CPActionFullButton.set_visible(
false);
211 CPName.set_text((is_import ? _(
"Import") : _(
"Open")) + (
": " +
file_name));
212 CPName.set_tooltip_text((is_import ? (
"Import") : (
"Open")) + (
": " +
file_name));
213 CPDescription.set_text(path);
214 CPDescription.set_tooltip_text(path);
228 static const bool show_full_action_name =
231 auto operation_builder =
create_builder(
"command-palette-operation.glade");
232 auto &CPOperation (get_widget<Gtk::Box> (operation_builder,
"CPOperation"));
233 auto &CPGroup (get_widget<Gtk::Label> (operation_builder,
"CPGroup"));
234 auto &CPName (get_widget<Gtk::Label> (operation_builder,
"CPName"));
235 auto &CPShortcut (get_widget<Gtk::Label> (operation_builder,
"CPShortcut"));
236 auto &CPActionFullButton (get_widget<Gtk::Button>(operation_builder,
"CPActionFullButton"));
237 auto &CPActionFullLabel (get_widget<Gtk::Label> (operation_builder,
"CPActionFullLabel"));
238 auto &CPDescription (get_widget<Gtk::Label> (operation_builder,
"CPDescription"));
248 name = action_ptr_name.second;
249 untranslated_name = action_ptr_name.second;
252 CPName.set_text(
name);
253 CPName.set_tooltip_text(untranslated_name);
256 CPActionFullLabel.set_text(action_ptr_name.second);
258 if (not show_full_action_name) {
259 CPActionFullButton.set_visible(
false);
261 CPActionFullButton.signal_clicked().connect(
263 action_ptr_name.second),
269 std::string accel_label;
270 for (
const auto &accel : accels) {
272 Gdk::ModifierType mods;
273 Gtk::Accelerator::parse(accel,
key, mods);
274 Glib::ustring
label = Gtk::Accelerator::get_label(
key, mods);
275 accel_label.append(
label.raw()).append(1,
' ');
278 if (not accel_label.empty()) {
279 accel_label.pop_back();
280 CPShortcut.set_text(accel_label);
282 CPShortcut.set_visible(
false);
321 return CPActionFullLabel &&
_search_text == CPActionFullLabel->get_text();
328 if (CPActionFullLabel && CPActionFullLabel->get_text() ==
"import") {
330 if (CPDescription && CPDescription->get_text() ==
_search_text) {
336 if (CPActionFullLabel && CPActionFullLabel->get_text() ==
"open") {
338 if (CPDescription && CPDescription->get_text() ==
_search_text) {
347 g_return_val_if_fail(
_is_open,
false);
349 if (keyval == GDK_KEY_Escape || keyval == GDK_KEY_question) {
361 selected_row->activate();
374 if (keyval == GDK_KEY_Up) {
377 }
else if (keyval == GDK_KEY_Down) {
391 _CPBase.set_size_request(-1, 10);
403 auto clipboard = Gdk::Display::get_default()->get_clipboard();
404 clipboard->set_text(action_fullname);
411 if (full_action_name ==
"import" or full_action_name ==
"open") {
423 if (
const auto name_label =
get_name_desc(lb).first; name_label) {
424 _CPFilter.set_text(name_label->get_text());
430 bool write_to_history =
true;
435 if (uri.raw() == last_operation->data) {
443 if (not(
import xor last_operation_was_import)) {
444 write_to_history =
false;
453 if (write_to_history) {
464 if (write_to_history) {
475 entry.set_placeholder_text(text);
476 entry.set_tooltip_text (text);
492 const auto last_full_action_name = last_of_history->data;
493 if (last_full_action_name != action_ptr_name.second.raw()) {
507 std::cerr <<
"CommandPalette::ask_action_parameter: unhandled action value type (Unknown Type) "
508 << action_ptr_name.second.raw() << std::endl;
516 Glib::ustring type_string;
517 switch (action_param_type) {
519 type_string = _(
"boolean");
522 type_string = _(
"whole number");
525 type_string = _(
"decimal number");
528 type_string = _(
"text string");
531 type_string = _(
"pair of decimal numbers");
542 if (action_hint.empty()) {
545 action_hint = Glib::ustring::compose(_(
"Enter a %1..."), type_string);
576 return "<span weight=\"bold\">" + search +
"</span>";
671 Glib::ustring subject_string = subject.lowercase();
672 Glib::ustring search_string = search.lowercase();
673 std::map<gunichar, int> subject_string_character, search_string_character;
674 for (
const auto &character : subject_string) {
675 subject_string_character[character]++;
677 for (
const auto &character : search_string) {
678 search_string_character[character]++;
680 for (
const auto &character : search_string_character) {
681 const auto &[alphabet, occurrence] = character;
682 if (subject_string_character[alphabet] < occurrence) {
691 Glib::ustring subject_string = subject.lowercase();
692 Glib::ustring search_string = search.lowercase();
694 for (
int j = 0, i = 0; i < search_string.length(); i++) {
695 bool alphabet_present =
false;
697 while (j < subject_string.length()) {
698 if (search_string[i] == subject_string[j]) {
699 alphabet_present =
true;
706 if (!alphabet_present) {
720 if (subject.lowercase().find(search.lowercase()) != -1) {
731 int fuzzy_cost = 100;
733 constexpr int SEQUENTIAL_BONUS = -15;
734 constexpr int SEPARATOR_BONUS = -30;
735 constexpr int CAMEL_BONUS = -30;
736 constexpr int FIRST_LETTER_BONUS = -15;
737 constexpr int LEADING_LETTER_PENALTY = +5;
738 constexpr int MAX_LEADING_LETTER_PENALTY = +15;
739 constexpr int UNMATCHED_LETTER_PENALTY = +1;
741 Glib::ustring subject_string = subject.lowercase();
742 Glib::ustring search_string = search.lowercase();
744 bool sequential_compare =
false;
745 bool leading_letter =
true;
746 int total_leading_letter_penalty = 0;
749 while (i < search_string.length() && j < subject_string.length()) {
750 if (search_string[i] != subject_string[j]) {
752 sequential_compare =
false;
753 fuzzy_cost += UNMATCHED_LETTER_PENALTY;
755 if (leading_letter) {
756 if (total_leading_letter_penalty < MAX_LEADING_LETTER_PENALTY) {
757 fuzzy_cost += LEADING_LETTER_PENALTY;
758 total_leading_letter_penalty += LEADING_LETTER_PENALTY;
765 if (search_string[i] == subject_string[j]) {
766 leading_letter =
false;
768 if (j > 0 && subject_string[j - 1] ==
' ') {
769 fuzzy_cost += SEPARATOR_BONUS;
772 if (i == 0 && j == 0) {
773 fuzzy_cost += FIRST_LETTER_BONUS;
776 if (search[i] == subject_string[j]) {
777 fuzzy_cost += CAMEL_BONUS;
780 if (sequential_compare) {
781 fuzzy_cost += SEQUENTIAL_BONUS;
784 sequential_compare =
true;
794 int fuzzy_cost = 200;
795 constexpr int FIRST_LETTER_BONUS = -15;
797 Glib::ustring subject_string = subject.lowercase();
798 Glib::ustring search_string = search.lowercase();
799 std::map<gunichar, int> search_string_character;
801 for (
const auto &character : search_string) {
802 search_string_character[character]++;
805 for (
auto [alphabet, occurrence] : search_string_character) {
806 for (
int i = 0; i < subject_string.length() && occurrence; i++) {
807 if (subject_string[i] == alphabet) {
809 fuzzy_cost += FIRST_LETTER_BONUS;
838 auto const &name_text = CPName->get_text();
845 auto const &name_tooltip = CPName->get_tooltip_text();
864 auto const &description_text = CPDescription->get_text();
877 if (fuzzy_points_count_1 && fuzzy_points_count_2) {
878 if (fuzzy_points_count_1 < fuzzy_points_count_2) {
880 }
else if (fuzzy_points_count_1 == fuzzy_points_count_2) {
881 if (text_len_1 > text_len_2) {
891 if (fuzzy_points_count_1 == 0 && fuzzy_points_count_2) {
894 if (fuzzy_points_count_2 == 0 && fuzzy_points_count_1) {
905 assert(
fuzzy_search(
"Export background",
"ebo") ==
true);
910 assert(
fuzzy_points(
"Export background",
"ebo") == -22);
941 int fuzzy_points_count_1 = 0, fuzzy_points_count_2 = 0;
942 int text_len_1 = 0, text_len_2 = 0;
943 int points_compare = 0;
945 constexpr int TOOLTIP_PENALTY = 100;
946 constexpr int DESCRIPTION_PENALTY = 500;
948 if (cp_name_1 && cp_name_2) {
949 auto const &name_1_text = cp_name_1->get_text();
950 auto const &name_2_text = cp_name_2->get_text();
953 text_len_1 = name_1_text.length();
957 text_len_2 = name_2_text.length();
961 points_compare =
fuzzy_points_compare(fuzzy_points_count_1, fuzzy_points_count_2, text_len_1, text_len_2);
962 if (points_compare != 0) {
963 return points_compare;
967 text_len_1 = name_1_text.length();
971 text_len_2 = name_2_text.length();
975 points_compare =
fuzzy_points_compare(fuzzy_points_count_1, fuzzy_points_count_2, text_len_1, text_len_2);
976 if (points_compare != 0) {
977 return points_compare;
980 auto const &name_1_tooltip = cp_name_1->get_tooltip_text();
981 auto const &name_2_tooltip = cp_name_2->get_tooltip_text();
984 text_len_1 = name_1_tooltip.length();
988 text_len_2 = name_2_tooltip.length();
992 points_compare =
fuzzy_points_compare(fuzzy_points_count_1, fuzzy_points_count_2, text_len_1, text_len_2);
993 if (points_compare != 0) {
994 return points_compare;
998 text_len_1 = name_1_tooltip.length();
1003 text_len_2 = name_2_tooltip.length();
1007 points_compare =
fuzzy_points_compare(fuzzy_points_count_1, fuzzy_points_count_2, text_len_1, text_len_2);
1008 if (points_compare != 0) {
1009 return points_compare;
1013 auto const &description_1_text = cp_description_1->get_text();
1014 auto const &description_2_text = cp_description_2->get_text();
1017 text_len_1 = description_1_text.length();
1019 DESCRIPTION_PENALTY;
1022 text_len_2 = description_2_text.length();
1024 DESCRIPTION_PENALTY;
1027 points_compare =
fuzzy_points_compare(fuzzy_points_count_1, fuzzy_points_count_2, text_len_1, text_len_2);
1028 if (points_compare != 0) {
1029 return points_compare;
1037 entry.set_editable(sensitive);
1097 if (children.empty()) {
1117 auto const last_row =
_CPHistory.get_row_at_index(children.size() - 1);
1119 last_row->grab_focus();
1122 Glib::signal_idle().connect_once([
this]
1125 adjustment->set_value(adjustment->get_upper());
1142 const auto dot = full_action_name.find(
'.');
1143 const auto action_domain = std::string_view{full_action_name.c_str(),
dot};
1147 if (action_domain ==
"app") {
1149 }
else if (win && action_domain ==
"win") {
1151 }
else if (doc && action_domain ==
"doc") {
1152 if (
const auto map = doc->getActionGroup();
map) {
1157 return {std::move(action_ptr), std::move(full_action_name)};
1162 if (!value.empty()) {
1166 const auto &[action_ptr,
action_name] = action_ptr_name;
1170 if (value ==
"1" || value ==
"t" || value ==
"true" || value.empty()) {
1171 action_ptr->activate(Glib::Variant<bool>::create(
true));
1172 }
else if (value ==
"0" || value ==
"f" || value ==
"false") {
1173 action_ptr->activate(Glib::Variant<bool>::create(
false));
1175 std::cerr <<
"CommandPalette::execute_action: Invalid boolean value: " <<
action_name.raw() <<
":" << value
1182 action_ptr->activate(Glib::Variant<int>::create(std::stoi(value)));
1184 if (
SPDesktop *dt = SP_ACTIVE_DESKTOP; dt) {
1185 dt->messageStack()->flash(
ERROR_MESSAGE, _(
"Invalid input! Enter an integer number."));
1192 action_ptr->activate(Glib::Variant<double>::create(std::stod(value)));
1194 if (
SPDesktop *dt = SP_ACTIVE_DESKTOP; dt) {
1195 dt->messageStack()->flash(
ERROR_MESSAGE, _(
"Invalid input! Enter a decimal number."));
1201 action_ptr->activate(Glib::Variant<Glib::ustring>::create(value));
1208 std::vector<Glib::ustring> tokens = Glib::Regex::split_simple(
"\\s*,\\s*", value);
1211 if (tokens.size() != 2) {
1212 throw std::invalid_argument(
"requires two numbers");
1219 d0 = std::stod(tokens[0]);
1220 d1 = std::stod(tokens[1]);
1225 auto variant = Glib::Variant<std::tuple<double, double>>
::create(std::tuple<double, double>(d0, d1));
1226 action_ptr->activate(variant);
1228 if (
SPDesktop *dt = SP_ACTIVE_DESKTOP; dt) {
1229 dt->messageStack()->flash(
ERROR_MESSAGE, _(
"Invalid input! Enter two comma separated numbers."));
1235 std::cerr <<
"CommandPalette::execute_action: unhandled action value type (Unknown Type) " <<
action_name.raw()
1241 action_ptr->activate();
1248 const GVariantType *gtype = g_action_get_parameter_type(action_ptr->gobj());
1250 Glib::VariantType type = action_ptr->get_parameter_type();
1251 if (type.get_string() ==
"b") {
1253 }
else if (type.get_string() ==
"i") {
1255 }
else if (type.get_string() ==
"d") {
1257 }
else if (type.get_string() ==
"s") {
1259 }
else if (type.get_string() ==
"(dd)") {
1262 std::cerr <<
"CommandPalette::get_action_variant_type: unknown variant type: " << type.get_string() << std::endl;
1272 auto box =
dynamic_cast<Gtk::Box *
>(
child->get_child());
1273 if (box && (box->get_name() ==
"CPOperation")) {
1277 auto CPNameBox =
dynamic_cast<Gtk::Box *
>(box_children.at(0));
1280 auto CPName =
dynamic_cast<Gtk::Label *
>(name_children.at(0));
1281 auto CPDescription =
dynamic_cast<Gtk::Label *
>(name_children.at(1));
1282 return std::pair(CPName, CPDescription);
1285 return std::pair(
nullptr,
nullptr);
1290 auto box =
dynamic_cast<Gtk::Box *
>(
child->get_child());
1291 if (box && (box->get_name() ==
"CPOperation")) {
1293 auto CPActionFullButton =
dynamic_cast<Gtk::Button *
>(box_children.at(1));
1294 if (CPActionFullButton) {
1296 auto CPSynapseButtonBox =
dynamic_cast<Gtk::Box *
>(synapse_button.at(0));
1297 if (CPSynapseButtonBox) {
1299 return dynamic_cast<Gtk::Label *
>(synapse_button_content.at(1));
1309 for (
auto &&action : gapp->list_actions()) {
1317 for (
auto &&action : window->list_actions()) {
1321 if (
auto document = window->get_document(); document) {
1322 auto map = document->getActionGroup();
1324 for (
auto &&action :
map->list_actions()) {
1328 std::cerr <<
"CommandPalette::load_win_doc_actions: No document map!" << std::endl;
1336 : _file_path(IO::Resource::profile_path(
"cphistory.xml"))
1422 for (
auto action_iter =
_params->
firstChild(); action_iter; action_iter = action_iter->next()) {
1424 if (full_action_name == action_iter->attribute(
"name")) {
1427 if (action_iter->lastChild()->lastChild() && action_iter->lastChild()->lastChild()->content() == param) {
1433 action_iter->appendChild(parameter_node);
1443 action_node->
setAttribute(
"name", full_action_name.c_str());
1444 action_node->appendChild(parameter_node);
1457 if (
const auto operation_type =
_get_operation_type(last_child); operation_type.has_value()) {
1459 return History{*operation_type, last_child->lastChild()->content()};
1462 return std::nullopt;
1467 std::vector<History> history;
1468 for (
auto operation_iter =
_operations->
firstChild(); operation_iter; operation_iter = operation_iter->next()) {
1469 if (
const auto operation_type =
_get_operation_type(operation_iter); operation_type.has_value()) {
1470 history.emplace_back(*operation_type, operation_iter->firstChild()->content());
1478 std::vector<std::string> params;
1479 for (
auto action_iter =
_params->
firstChild(); action_iter; action_iter = action_iter->prev()) {
1481 if (full_action_name == action_iter->attribute(
"name")) {
1484 params.emplace_back(param_iter->content());
1500 std::string operation_type_name;
1501 switch (history_type) {
1504 operation_type_name =
"action";
1507 operation_type_name =
"import";
1510 operation_type_name =
"open";
1519 operation_to_add->appendChild(operation_data);
1530 const std::string operation_type_name = operation->
name();
1532 if (operation_type_name ==
"action") {
1534 }
else if (operation_type_name ==
"import") {
1536 }
else if (operation_type_name ==
"open") {
1539 return std::nullopt;
Glib::ustring get_tooltip_hint_for_action(Glib::ustring const &action_name, bool translated=true)
InkscapeWindow * get_active_window()
SPDocument * get_active_document()
static InkscapeApplication * instance()
Singleton instance.
Gtk::Application * gtk_app()
The Gtk application instance, or NULL if running headless without display.
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
int getInt(Glib::ustring const &pref_path, int def=0)
Retrieve an integer.
static Shortcuts & getInstance(bool init=true)
std::vector< Glib::ustring > get_triggers(Glib::ustring const &action_name) const
Returns a vector of triggers for a given detailed_action_name.
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.
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)
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
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)
Gtk::ListBox & _CPHistory
void on_history_selection_changed(Gtk::ListBoxRow *lb)
bool on_entry_keypress(unsigned keyval, unsigned, Gdk::ModifierType)
bool execute_action(const ActionPtrName &action, const Glib::ustring &value)
Interface for refcounted XML nodes.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
virtual char const * name() const =0
Get the name of the element node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
virtual Node * firstChild()=0
Get the first child of this node.
virtual void setContent(char const *value)=0
Set the content of a text or comment node.
virtual Node * lastChild()=0
Get the last child of this node.
virtual Node * root()=0
Get the root node of this node's document.
To do: update description of desktop.
CommandPalette: Class providing Command Palette feature.
std::unordered_map< std::string, std::unique_ptr< SPDocument > > map
Editable view implementation.
SPObject * file_import(SPDocument *in_doc, const std::string &path, Inkscape::Extension::Extension *key)
Import a resource.
Inkscape - An SVG editor.
static R & release(R &r)
Decrements the reference count of a anchored object.
static void set_hint_texts(Gtk::SearchEntry2 &entry, Glib::ustring const &text)
static void set_sensitive(Gtk::SearchEntry2 &entry, bool const sensitive)
Glib::ustring make_bold(const Glib::ustring &search)
Color addition.
std::vector< Gtk::Widget * > get_children(Gtk::Widget &widget)
Get a vector of the widgetʼs children, from get_first_child() through each get_next_sibling().
W & get_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id)
Glib::RefPtr< Gtk::Builder > create_builder(const char *filename)
static cairo_user_data_key_t key
Singleton class to access the preferences file in a convenient way.
Document * sp_repr_read_file(const gchar *filename, const gchar *default_ns, bool xinclude)
Reads XML from a file, and returns the Document.
bool sp_repr_save_file(Document *doc, gchar const *const filename, gchar const *default_ns)
Returns true iff file successfully saved.
Inkscape::XML::Document * sp_repr_document_new(char const *rootname)
Returns new document having as first child a node named rootname.
Inkscape::IO::Resource - simple resource API.
virtual Node * createTextNode(char const *content)=0
virtual Node * createElement(char const *name)=0
void dot(Cairo::RefPtr< Cairo::Context > &cr, double x, double y)