"Fossies" - the Fresh Open Source Software Archive

Member "regexxer-0.10/src/mainwindow.h" (6 Oct 2011, 5244 Bytes) of package /linux/privat/old/regexxer-0.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "mainwindow.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (c) 2002-2007  Daniel Elstner  <daniel.kitta@gmail.com>
    3  *
    4  * This file is part of regexxer.
    5  *
    6  * regexxer is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * regexxer is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License
   17  * along with regexxer; if not, write to the Free Software Foundation,
   18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   19  */
   20 
   21 #ifndef REGEXXER_MAINWINDOW_H_INCLUDED
   22 #define REGEXXER_MAINWINDOW_H_INCLUDED
   23 
   24 #include "controller.h"
   25 #include "filebuffer.h"
   26 #include "sharedptr.h"
   27 #include "completionstack.h"
   28 
   29 #include <sigc++/sigc++.h>
   30 #include <glibmm/refptr.h>
   31 #include <glibmm/ustring.h>
   32 #include <list>
   33 #include <memory>
   34 #include <vector>
   35 
   36 namespace Gtk
   37 {
   38 class Button;
   39 class CheckButton;
   40 class Dialog;
   41 class Entry;
   42 class FileChooser;
   43 class Toolbar;
   44 class Window;
   45 class ComboBox;
   46 class ComboBoxText;
   47 class VBox;
   48 class ScrolledWindow;
   49 class Table;
   50 class EntryCompletion;
   51 }
   52 
   53 namespace Gsv
   54 {
   55 class View;
   56 }
   57 
   58 namespace Regexxer
   59 {
   60 
   61 class FileTree;
   62 class PrefDialog;
   63 class StatusLine;
   64 struct FileInfo;
   65 
   66 struct InitState
   67 {
   68   std::vector<std::string>  folder;
   69   Glib::ustring             pattern;
   70   Glib::ustring             regex;
   71   Glib::ustring             substitution;
   72   bool                      no_recursive;
   73   bool                      hidden;
   74   bool                      no_global;
   75   bool                      ignorecase;
   76   bool                      feedback;
   77   bool                      no_autorun;
   78 
   79   InitState();
   80   ~InitState();
   81 };
   82 
   83 class MainWindow : public sigc::trackable
   84 {
   85 public:
   86   MainWindow();
   87   virtual ~MainWindow();
   88 
   89   void initialize(const InitState& init);
   90   Gtk::Window* get_window() { return window_.get(); }
   91 
   92 private:
   93   class BusyAction;
   94 
   95   std::auto_ptr<Gtk::Window>  window_;
   96   Controller                  controller_;
   97 
   98   Gtk::VBox*                  vbox_main_;
   99 
  100   Gtk::Toolbar*               toolbar_;
  101 
  102   Gtk::Table*                 table_file_;
  103   Gtk::FileChooser*           button_folder_;
  104 
  105   Gtk::ComboBoxText*          combo_entry_pattern_;
  106 
  107   Gtk::CheckButton*           button_recursive_;
  108   Gtk::CheckButton*           button_hidden_;
  109 
  110   Gtk::ComboBoxText*          comboboxentry_regex_;
  111   Gtk::Entry*                 entry_regex_;
  112   CompletionStack             entry_regex_completion_stack_;
  113   Glib::RefPtr<Gtk::EntryCompletion> entry_regex_completion_;
  114 
  115   Gtk::ComboBoxText*          comboboxentry_substitution_;
  116   Gtk::Entry*                 entry_substitution_;
  117   CompletionStack             entry_substitution_completion_stack_;
  118   Glib::RefPtr<Gtk::EntryCompletion> entry_substitution_completion_;
  119 
  120   Gtk::CheckButton*           button_multiple_;
  121   Gtk::CheckButton*           button_caseless_;
  122 
  123   FileTree*                   filetree_;
  124   Gtk::ScrolledWindow*        scrollwin_filetree_;
  125   Gtk::ScrolledWindow*        scrollwin_textview_;
  126   Gsv::View*            textview_;
  127   Gtk::Entry*                 entry_preview_;
  128 
  129   StatusLine*                 statusline_;
  130 
  131   bool                        busy_action_running_;
  132   bool                        busy_action_cancel_;
  133   unsigned int                busy_action_iteration_;
  134 
  135   UndoStackPtr                undo_stack_;
  136 
  137   std::list<sigc::connection> buffer_connections_;
  138 
  139   std::auto_ptr<Gtk::Dialog>  about_dialog_;
  140   std::auto_ptr<PrefDialog>   pref_dialog_;
  141 
  142   void load_xml();
  143   void connect_signals();
  144   bool autorun_idle();
  145   void save_window_state();
  146 
  147   void on_hide();
  148   void on_style_updated();
  149   bool on_delete_event(GdkEventAny* event);
  150 
  151   void on_cut();
  152   void on_copy();
  153   void on_paste();
  154   void on_erase();
  155 
  156   void on_quit();
  157   bool confirm_quit_request();
  158 
  159   void on_find_files();
  160   void on_exec_search();
  161   bool after_exec_search();
  162 
  163   void on_filetree_switch_buffer(Util::SharedPtr<FileInfo> fileinfo, int file_index);
  164   void on_filetree_file_count_changed();
  165   void on_filetree_match_count_changed();
  166   void on_filetree_modified_count_changed();
  167 
  168   void on_bound_state_changed();
  169   void on_buffer_modified_changed();
  170 
  171   bool do_scroll(const Glib::RefPtr<Gtk::TextMark> mark);
  172 
  173   void on_go_next_file(bool move_forward);
  174   void on_go_next(bool move_forward);
  175   void on_replace();
  176   void on_replace_file();
  177   void on_replace_all();
  178 
  179   void on_save_file();
  180   void on_save_all();
  181 
  182   void on_undo_stack_push(UndoActionPtr action);
  183   void on_undo();
  184   void undo_stack_clear();
  185 
  186   void on_entry_pattern_changed();
  187   void update_preview();
  188   void set_title_filename(const std::string& filename);
  189 
  190   void busy_action_enter();
  191   void busy_action_leave();
  192   bool on_busy_action_pulse();
  193   void on_busy_action_cancel();
  194 
  195   void on_about();
  196   void on_about_dialog_response(int);
  197 
  198   void on_preferences();
  199   void on_pref_dialog_hide();
  200 
  201   void on_conf_value_changed(const Glib::ustring& key);
  202 };
  203 
  204 } // namespace Regexxer
  205 
  206 #endif /* REGEXXER_MAINWINDOW_H_INCLUDED */