Skip to content

Commit 84b9cdb

Browse files
show the document path in the document info dialog (#140)
1 parent 5830cb5 commit 84b9cdb

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/dialogs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,14 @@ void bookmark_dialog::on_edit_note(wxCommandEvent&) {
370370
bookmark_list->SetString(static_cast<unsigned int>(selection), display_text);
371371
}
372372

373-
document_info_dialog::document_info_dialog(wxWindow* parent, const document* doc) : dialog(parent, _("Document Info"), dialog_button_config::ok_only) {
373+
document_info_dialog::document_info_dialog(wxWindow* parent, const document* doc, const wxString& file_path) : dialog(parent, _("Document Info"), dialog_button_config::ok_only) {
374374
constexpr int info_width = 600;
375375
constexpr int info_height = 400;
376376
info_text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(info_width, info_height), wxTE_MULTILINE | wxTE_READONLY);
377377
wxString info_text;
378378
info_text << _("Title: ") << doc->title << "\n";
379379
info_text << _("Author: ") << doc->author << "\n";
380+
info_text << _("Path: ") << file_path << "\n";
380381
info_text << _("Total number of words: ") << doc->stats.word_count << ".\n";
381382
info_text << _("Total number of lines: ") << doc->stats.line_count << ".\n";
382383
info_text << _("Total number of characters: ") << doc->stats.char_count << ".\n";

src/dialogs.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class bookmark_dialog : public dialog {
113113

114114
class document_info_dialog : public dialog {
115115
public:
116-
document_info_dialog(wxWindow* parent, const document* doc);
116+
document_info_dialog(wxWindow* parent, const document* doc, const wxString& file_path);
117117
~document_info_dialog() = default;
118118
document_info_dialog(const document_info_dialog&) = delete;
119119
document_info_dialog& operator=(const document_info_dialog&) = delete;

src/document_manager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,11 +1002,15 @@ void document_manager::show_table_of_contents(wxWindow* parent) const {
10021002
}
10031003

10041004
void document_manager::show_document_info(wxWindow* parent) const {
1005-
const document* doc = get_active_document();
1005+
const document_tab* tab = get_active_tab();
1006+
if (tab == nullptr) {
1007+
return;
1008+
}
1009+
const document* doc = tab->doc.get();
10061010
if (doc == nullptr) {
10071011
return;
10081012
}
1009-
document_info_dialog dlg(parent, doc);
1013+
document_info_dialog dlg(parent, doc, tab->file_path);
10101014
dlg.ShowModal();
10111015
}
10121016

0 commit comments

Comments
 (0)