Changeset a78113f8b06bcdc8bc7c7355d36814b7cc1145c7
- Timestamp:
- 01/06/07 23:53:26 (6 years ago)
- Author:
- Philipp Kern <phil@…>
- Parents:
- e6056f860d6b4e233fc2344816c066cc53e3d089
- Children:
- 0586368ef50fee5ed7de7b6e77e1118c58e6b267
- git-committer:
- Philipp Kern <phil@0x539.de> / 2007-01-06T22:53:26Z+0000
- Message:
-
[project @ Non-working FindDialog?]
Original author: Armin Burgmeier <armin@…>
Date: 2005-11-13 17:13:20+00:00
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5ca6548
|
ra78113f
|
|
| 22 | 22 | noinst_HEADERS += inc/encoding.hpp |
| 23 | 23 | noinst_HEADERS += inc/mimemap.hpp |
| | 24 | noinst_HEADERS += inc/regex.hpp |
| 24 | 25 | noinst_HEADERS += inc/defaultdialog.hpp |
| 25 | 26 | noinst_HEADERS += inc/historyentry.hpp |
| … |
… |
|
| 45 | 46 | noinst_HEADERS += inc/hostprogressdialog.hpp |
| 46 | 47 | noinst_HEADERS += inc/entrydialog.hpp |
| | 48 | noinst_HEADERS += inc/finddialog.hpp |
| 47 | 49 | noinst_HEADERS += inc/window.hpp |
| 48 | 50 | noinst_HEADERS += inc/sourceview/sourceview.hpp |
| … |
… |
|
| 72 | 74 | gobby_SOURCES += src/encoding.cpp |
| 73 | 75 | gobby_SOURCES += src/mimemap.cpp |
| | 76 | gobby_SOURCES += src/regex.cpp |
| 74 | 77 | gobby_SOURCES += src/defaultdialog.cpp |
| 75 | 78 | gobby_SOURCES += src/historyentry.cpp |
| … |
… |
|
| 95 | 98 | gobby_SOURCES += src/hostprogressdialog.cpp |
| 96 | 99 | gobby_SOURCES += src/entrydialog.cpp |
| | 100 | gobby_SOURCES += src/finddialog.cpp |
| 97 | 101 | gobby_SOURCES += src/window.cpp |
| 98 | 102 | gobby_SOURCES += src/main.cpp |
-
|
r02f4d24
|
ra78113f
|
|
| 101 | 101 | |
| 102 | 102 | const Glib::RefPtr<Gtk::Action> action_edit; |
| | 103 | const Glib::RefPtr<Gtk::Action> action_edit_search; |
| | 104 | const Glib::RefPtr<Gtk::Action> action_edit_search_replace; |
| 103 | 105 | const Glib::RefPtr<Gtk::Action> action_edit_preferences; |
| 104 | 106 | |
-
|
re6056f8
|
ra78113f
|
|
| 29 | 29 | #include "docwindow.hpp" |
| 30 | 30 | #include "folder.hpp" |
| | 31 | #include "finddialog.hpp" |
| 31 | 32 | #include "userlist.hpp" |
| 32 | 33 | #include "documentlist.hpp" |
| … |
… |
|
| 47 | 48 | ~Window(); |
| 48 | 49 | |
| 49 | | Document& get_current_document(); |
| | 50 | Document* get_current_document(); |
| 50 | 51 | protected: |
| 51 | 52 | // Gtk::Window overrides |
| … |
… |
|
| 68 | 69 | void on_document_close(); |
| 69 | 70 | |
| | 71 | void on_edit_search(); |
| | 72 | void on_edit_search_replace(); |
| 70 | 73 | void on_edit_preferences(); |
| 71 | 74 | |
| … |
… |
|
| 129 | 132 | |
| 130 | 133 | Header m_header; |
| | 134 | FindDialog m_finddialog; |
| 131 | 135 | UserList m_userlist; |
| 132 | 136 | DocumentList m_documentlist; |
-
|
r5ca6548
|
ra78113f
|
|
| 44 | 44 | " </menu>" |
| 45 | 45 | " <menu action=\"MenuEdit\">" |
| | 46 | " <menuitem action=\"EditSearch\" />" |
| | 47 | " <menuitem action=\"EditSearchReplace\" />" |
| | 48 | " <separator />" |
| 46 | 49 | " <menuitem action=\"EditPreferences\" />" |
| 47 | 50 | " </menu>" |
| … |
… |
|
| 260 | 263 | action_edit(Gtk::Action::create("MenuEdit", _("Edit")) ), |
| 261 | 264 | |
| | 265 | action_edit_search( |
| | 266 | Gtk::Action::create( |
| | 267 | "EditSearch", |
| | 268 | Gtk::Stock::FIND, |
| | 269 | _("Find..."), |
| | 270 | _("Search for text in the a document") |
| | 271 | ) |
| | 272 | ), |
| | 273 | |
| | 274 | action_edit_search_replace( |
| | 275 | Gtk::Action::create( |
| | 276 | "EditSearchReplace", |
| | 277 | Gtk::Stock::FIND_AND_REPLACE, |
| | 278 | _("Find and replace..."), |
| | 279 | _("Search for text and replace it with another one") |
| | 280 | ) |
| | 281 | ), |
| | 282 | |
| 262 | 283 | action_edit_preferences( |
| 263 | 284 | Gtk::Action::create( |
| … |
… |
|
| 356 | 377 | |
| 357 | 378 | group_edit->add(action_edit); |
| | 379 | group_edit->add(action_edit_search); |
| | 380 | group_edit->add(action_edit_search_replace); |
| 358 | 381 | group_edit->add(action_edit_preferences); |
| 359 | 382 | |
-
|
re6056f8
|
ra78113f
|
|
| 57 | 57 | #endif |
| 58 | 58 | m_header(), |
| | 59 | m_finddialog(*this), |
| 59 | 60 | m_userlist(*this, m_header), |
| 60 | 61 | m_documentlist(*this, m_header), |
| … |
… |
|
| 85 | 86 | sigc::mem_fun(*this, &Window::on_document_close) ); |
| 86 | 87 | |
| | 88 | m_header.action_edit_search->signal_activate().connect( |
| | 89 | sigc::mem_fun(*this, &Window::on_edit_search) ); |
| | 90 | m_header.action_edit_search_replace->signal_activate().connect( |
| | 91 | sigc::mem_fun(*this, &Window::on_edit_search_replace) ); |
| 87 | 92 | m_header.action_edit_preferences->signal_activate().connect( |
| 88 | 93 | sigc::mem_fun(*this, &Window::on_edit_preferences) ); |
| … |
… |
|
| 603 | 608 | { |
| 604 | 609 | // Get page |
| 605 | | Document& doc = get_current_document(); |
| | 610 | Document* doc = get_current_document(); |
| | 611 | if(doc == NULL) |
| | 612 | throw std::logic_error("Gobby::Window::on_document_save"); |
| 606 | 613 | |
| 607 | 614 | // Is there already a path for this document? |
| 608 | | if(!doc.get_path().empty() ) |
| | 615 | if(!doc->get_path().empty() ) |
| 609 | 616 | // Yes, so save the document there |
| 610 | | save_local_file(doc, doc.get_path() ); |
| | 617 | save_local_file(*doc, doc->get_path() ); |
| 611 | 618 | else |
| 612 | 619 | // Open save as dialog otherwise |
| … |
… |
|
| 617 | 624 | { |
| 618 | 625 | // Get page |
| 619 | | Document& doc = get_current_document(); |
| | 626 | Document* doc = get_current_document(); |
| | 627 | if(doc == NULL) |
| | 628 | throw std::logic_error("Gobby::Window::on_document_save_as"); |
| 620 | 629 | |
| 621 | 630 | // Setup dialog |
| … |
… |
|
| 628 | 637 | |
| 629 | 638 | // Does the document have already a path? |
| 630 | | if(!doc.get_path().empty() ) |
| | 639 | if(!doc->get_path().empty() ) |
| 631 | 640 | { |
| 632 | 641 | // Yes, so set it as filename |
| 633 | | dlg.set_filename(doc.get_path() ); |
| | 642 | dlg.set_filename(doc->get_path() ); |
| 634 | 643 | } |
| 635 | 644 | else |
| … |
… |
|
| 639 | 648 | dlg.set_current_folder(m_last_path); |
| 640 | 649 | // Set current title as proposed file name |
| 641 | | dlg.set_current_name(doc.get_title() ); |
| | 650 | dlg.set_current_name(doc->get_title() ); |
| 642 | 651 | } |
| 643 | 652 | |
| … |
… |
|
| 651 | 660 | m_last_path = dlg.get_current_folder(); |
| 652 | 661 | // Save document |
| 653 | | save_local_file(doc, dlg.get_filename() ); |
| | 662 | save_local_file(*doc, dlg.get_filename() ); |
| 654 | 663 | } |
| 655 | 664 | } |
| … |
… |
|
| 661 | 670 | // Close it |
| 662 | 671 | close_document(*static_cast<DocWindow*>(page) ); |
| | 672 | } |
| | 673 | |
| | 674 | void Gobby::Window::on_edit_search() |
| | 675 | { |
| | 676 | m_finddialog.set_search_only(true); |
| | 677 | m_finddialog.show(); |
| | 678 | m_finddialog.grab_focus(); |
| | 679 | } |
| | 680 | |
| | 681 | void Gobby::Window::on_edit_search_replace() |
| | 682 | { |
| | 683 | m_finddialog.set_search_only(false); |
| | 684 | m_finddialog.show(); |
| | 685 | m_finddialog.grab_focus(); |
| 663 | 686 | } |
| 664 | 687 | |
| … |
… |
|
| 754 | 777 | { |
| 755 | 778 | // Get current page |
| 756 | | Document& doc = get_current_document(); |
| | 779 | Document* doc = get_current_document(); |
| | 780 | if(doc == NULL) |
| | 781 | throw std::logic_error("Gobby::Window::on_view_preferences"); |
| 757 | 782 | |
| 758 | 783 | // Add preferences dialog |
| 759 | | PreferencesDialog dlg(*this, doc.get_preferences(), true); |
| | 784 | PreferencesDialog dlg(*this, doc->get_preferences(), true); |
| 760 | 785 | |
| 761 | 786 | // Label text |
| … |
… |
|
| 767 | 792 | |
| 768 | 793 | // Get title |
| 769 | | str << doc.get_title(); |
| | 794 | str << doc->get_title(); |
| 770 | 795 | |
| 771 | 796 | // Info label |
| … |
… |
|
| 782 | 807 | { |
| 783 | 808 | // Apply new preferences to the document |
| 784 | | doc.set_preferences(dlg.preferences() ); |
| | 809 | doc->set_preferences(dlg.preferences() ); |
| 785 | 810 | } |
| 786 | 811 | } |
| … |
… |
|
| 790 | 815 | { |
| 791 | 816 | // Set language of current document |
| 792 | | get_current_document().set_language(lang); |
| | 817 | Document* doc = get_current_document(); |
| | 818 | if(doc == NULL) |
| | 819 | throw std::logic_error("Gobby::Window::on_view_language"); |
| | 820 | |
| | 821 | doc->set_language(lang); |
| 793 | 822 | } |
| 794 | 823 | |
| … |
… |
|
| 900 | 929 | } |
| 901 | 930 | |
| 902 | | Gobby::Document& Gobby::Window::get_current_document() |
| 903 | | { |
| | 931 | Gobby::Document* Gobby::Window::get_current_document() |
| | 932 | { |
| | 933 | // No document open |
| | 934 | if(m_folder.get_n_pages() == 0) return NULL; |
| | 935 | |
| 904 | 936 | // Get currently selected page |
| 905 | 937 | Widget* page = m_folder.get_nth_page(m_folder.get_current_page() ); |
| 906 | 938 | // Convert to document |
| 907 | | return static_cast<DocWindow*>(page)->get_document(); |
| | 939 | return &static_cast<DocWindow*>(page)->get_document(); |
| 908 | 940 | } |
| 909 | 941 | |
| … |
… |
|
| 924 | 956 | |
| 925 | 957 | // Get currently active document |
| 926 | | const Document& document = get_current_document(); |
| | 958 | const Document& document = *get_current_document(); |
| 927 | 959 | // Get title of current document |
| 928 | 960 | const Glib::ustring& file = document.get_document().get_title(); |