1 // 2 // "$Id: DiffWindow.h 407 2006-11-13 18:54:02Z mike $" 3 // 4 // DiffWindow widget definitions. 5 // 6 // Copyright 2005-2006 by Michael Sweet. 7 // 8 // This program is free software; you can redistribute it and/or modify 9 // it under the terms of the GNU General Public License v2 as published 10 // by the Free Software Foundation. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 18 #ifndef _DiffWindow_h_ 19 # define _DiffWindow_h_ 20 # include <FL/Fl.H> 21 # include <FL/Fl_Overlay_Window.H> 22 # include <FL/Fl_Menu_Bar.H> 23 # include <FL/Fl_Preferences.H> 24 # include "DiffView.h" 25 26 27 // 28 // DiffWindow widget to support multiple file diffs... 29 // 30 31 class DiffWindow : public Fl_Overlay_Window 32 { 33 Fl_Menu_Bar menubar_; // Menubar 34 DiffView view_; // Diff viewing widget 35 const char *file1_, // First file 36 *file2_; // Second file 37 DiffWindow *next_; // Next window 38 int search_line_; // Current line in search 39 bool search_right_; // Searched on the right side? 40 char search_[1024], // Search text 41 title_[1024]; // Window title 42 bool zoom_; // Show zoom overlay? 43 int zoom_pos_; // Zoom overlay position 44 45 static DiffWindow *first_; // First window 46 static const char *help_text_; // Help text 47 static Fl_Preferences prefs_; // Application preferences... 48 49 void draw_overlay(); 50 void load_prefs(); 51 void open(const char *f1, const char *f2); 52 void save_prefs(); 53 54 static void about_cb(Fl_Menu_Bar *m, DiffWindow *dw); 55 static void close_cb(Fl_Menu_Bar *m, DiffWindow *dw); 56 static void compare_selected_cb(Fl_Menu_Bar *m, DiffWindow *dw); 57 static void compare_cb(Fl_Menu_Bar *m, DiffWindow *dw); 58 static void copy_cb(Fl_Menu_Bar *m, DiffWindow *dw); 59 static void find_cb(Fl_Menu_Bar *m, DiffWindow *dw); 60 static void find_next_cb(Fl_Menu_Bar *m, DiffWindow *dw); 61 static DiffWindow *find_window(const char *f1, const char *f2); 62 static void next_change_cb(Fl_Menu_Bar *m, DiffWindow *dw); 63 static void prefs_cb(Fl_Menu_Bar *m, DiffWindow *dw); 64 static void prev_change_cb(Fl_Menu_Bar *m, DiffWindow *dw); 65 static void quit_cb(Fl_Menu_Bar *m, DiffWindow *dw); 66 static void rediff_cb(Fl_Menu_Bar *m, DiffWindow *dw); 67 static void select_cb(DiffView *dv, DiffWindow *dw); 68 static void select_left_cb(Fl_Menu_Bar *m, DiffWindow *dw); 69 static void select_none_cb(Fl_Menu_Bar *m, DiffWindow *dw); 70 static void select_right_cb(Fl_Menu_Bar *m, DiffWindow *dw); 71 static void using_cb(Fl_Menu_Bar *m, DiffWindow *dw); 72 73 public: 74 75 DiffWindow(const char *file1, const char *file2); 76 ~DiffWindow(); 77 color(Fl_Color c)78 void color(Fl_Color c) { view_.color(c); } color()79 Fl_Color color() const { return (view_.color()); } 80 int handle(int event); 81 bool load(const char *file1, const char *file2); 82 void resize(int X, int Y, int W, int H); selection_color(Fl_Color c)83 void selection_color(Fl_Color c) { view_.selection_color(c); } selection_color()84 Fl_Color selection_color() const { return (view_.selection_color()); } showlinenum(bool b)85 void showlinenum(bool b) { view_.showlinenum(b); } showlinenum()86 bool showlinenum() const { return (view_.showlinenum()); } ignoreblanks(bool b)87 void ignoreblanks(bool b) { view_.ignoreblanks(b); } ignoreblanks()88 bool ignoreblanks() const { return (view_.ignoreblanks()); } tabwidth(int t)89 void tabwidth(int t) { view_.tabwidth(t); } tabwidth()90 int tabwidth() const { return (view_.tabwidth()); } textcolor(Fl_Color c)91 void textcolor(Fl_Color c) { view_.textcolor(c); } textcolor()92 Fl_Color textcolor() const { return (view_.textcolor()); } textfont(uchar f)93 void textfont(uchar f) { view_.textfont(f); } textfont()94 uchar textfont() const { return (view_.textfont()); } textsize(uchar s)95 void textsize(uchar s) { view_.textsize(s); } textsize()96 uchar textsize() const { return (view_.textsize()); } zoom(bool b)97 void zoom(bool b) { zoom_ = b; } zoom()98 bool zoom() const { return (zoom_); } 99 }; 100 101 102 #endif // !_DiffWindow_h_ 103 104 // 105 // End of "$Id: DiffWindow.h 407 2006-11-13 18:54:02Z mike $". 106 // 107