Skip to content

Commit

Permalink
added option in config.cfg to disable tree tooltips 'tree_tooltips' (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
giuspen committed Dec 8, 2023
1 parent 36a25cd commit 9c19341
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/ct/ct_actions_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ void CtActions::preferences_import()
_pCtConfig->cherryWrapWidth = ctConfigImported.cherryWrapWidth;
_pCtConfig->treeClickFocusText = ctConfigImported.treeClickFocusText;
_pCtConfig->treeClickExpand = ctConfigImported.treeClickExpand;
_pCtConfig->treeTooltips = ctConfigImported.treeTooltips;
_pCtConfig->syntaxHighlighting = ctConfigImported.syntaxHighlighting;
_pCtConfig->autoSynHighl = ctConfigImported.autoSynHighl;
_pCtConfig->rtStyleScheme = ctConfigImported.rtStyleScheme;
Expand Down
2 changes: 2 additions & 0 deletions src/ct/ct_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ void CtConfig::_populate_keyfile_from_data()
_uKeyFile->set_integer(_currentGroup, "cherry_wrap_width", cherryWrapWidth);
_uKeyFile->set_boolean(_currentGroup, "tree_click_focus_text", treeClickFocusText);
_uKeyFile->set_boolean(_currentGroup, "tree_click_expand", treeClickExpand);
_uKeyFile->set_boolean(_currentGroup, "tree_tooltips", treeTooltips);

// [editor]
_currentGroup = "editor";
Expand Down Expand Up @@ -535,6 +536,7 @@ void CtConfig::_populate_data_from_keyfile()
_populate_int_from_keyfile("cherry_wrap_width", &cherryWrapWidth);
_populate_bool_from_keyfile("tree_click_focus_text", &treeClickFocusText);
_populate_bool_from_keyfile("tree_click_expand", &treeClickExpand);
_populate_bool_from_keyfile("tree_tooltips", &treeTooltips);

// [editor]
_currentGroup = "editor";
Expand Down
1 change: 1 addition & 0 deletions src/ct/ct_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class CtConfig
int cherryWrapWidth{130};
bool treeClickFocusText{false};
bool treeClickExpand{false};
bool treeTooltips{true};

// [editor]
std::string syntaxHighlighting{CtConst::RICH_TEXT_ID};
Expand Down
2 changes: 1 addition & 1 deletion src/ct/ct_main_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void CtMainWin::_reset_CtTreestore_CtTreeview()
_nodesVScrollPos.clear();

_scrolledwindowTree.remove();
_uCtTreeview.reset(new CtTreeView);
_uCtTreeview.reset(new CtTreeView{_pCtConfig});
_scrolledwindowTree.add(*_uCtTreeview);
_uCtTreeview->show();

Expand Down
7 changes: 5 additions & 2 deletions src/ct/ct_widgets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ void CtAnchoredWidget::_on_frame_size_allocate(Gtk::Allocation& allocation)
});
}

CtTreeView::CtTreeView()
CtTreeView::CtTreeView(CtConfig* pCtConfig)
: _pCtConfig{pCtConfig}
{
set_headers_visible(false);
set_tooltip_column(1); // node name
if (_pCtConfig->treeTooltips) {
set_tooltip_column(1); // node name
}
}

void CtTreeView::set_cursor_safe(const Gtk::TreeIter& treeIter)
Expand Down
6 changes: 4 additions & 2 deletions src/ct/ct_widgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ class CtTreeView : public Gtk::TreeView
const inline static int TITLE_COL_NUM = 0;
const inline static int AUX_ICON_COL_NUM = 1;

public:
CtTreeView();
CtTreeView(CtConfig* pCtConfig);
virtual ~CtTreeView() {}

void set_cursor_safe(const Gtk::TreeIter& iter);
void set_tree_node_name_wrap_width(const bool wrap_enabled, const int wrap_width);

private:
CtConfig* const _pCtConfig;
};

class CtApp;
Expand Down

0 comments on commit 9c19341

Please sign in to comment.