File: DiffWindow.h

package info (click to toggle)
fldiff 1.1-1.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 536 kB
  • ctags: 224
  • sloc: cpp: 2,977; makefile: 124
file content (106 lines) | stat: -rw-r--r-- 3,935 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//
// "$Id: DiffWindow.h 407 2006-11-13 18:54:02Z mike $"
//
// DiffWindow widget definitions.
//
// Copyright 2005-2006 by Michael Sweet.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License v2 as published
// by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//

#ifndef _DiffWindow_h_
#  define _DiffWindow_h_
#  include <FL/Fl.H>
#  include <FL/Fl_Overlay_Window.H>
#  include <FL/Fl_Menu_Bar.H>
#  include <FL/Fl_Preferences.H>
#  include "DiffView.h"


//
// DiffWindow widget to support multiple file diffs...
//

class DiffWindow : public Fl_Overlay_Window
{
  Fl_Menu_Bar	menubar_;		// Menubar
  DiffView	view_;			// Diff viewing widget
  const char	*file1_,		// First file
		*file2_;		// Second file
  DiffWindow	*next_;			// Next window
  int		search_line_;		// Current line in search
  bool		search_right_;		// Searched on the right side?
  char		search_[1024],		// Search text
		title_[1024];		// Window title
  bool		zoom_;			// Show zoom overlay?
  int		zoom_pos_;		// Zoom overlay position

  static DiffWindow	*first_;	// First window
  static const char	*help_text_;	// Help text
  static Fl_Preferences	prefs_;		// Application preferences...

  void		draw_overlay();
  void		load_prefs();
  void		open(const char *f1, const char *f2);
  void		save_prefs();

  static void	about_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	close_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	compare_selected_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	compare_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	copy_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	find_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	find_next_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static DiffWindow *find_window(const char *f1, const char *f2);
  static void	next_change_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	prefs_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	prev_change_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	quit_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	rediff_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	select_cb(DiffView *dv, DiffWindow *dw);
  static void	select_left_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	select_none_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	select_right_cb(Fl_Menu_Bar *m, DiffWindow *dw);
  static void	using_cb(Fl_Menu_Bar *m, DiffWindow *dw);

  public:

		DiffWindow(const char *file1, const char *file2);
		~DiffWindow();

  void		color(Fl_Color c) { view_.color(c); }
  Fl_Color	color() const { return (view_.color()); }
  int		handle(int event);
  bool		load(const char *file1, const char *file2);
  void		resize(int X, int Y, int W, int H);
  void		selection_color(Fl_Color c) { view_.selection_color(c); }
  Fl_Color	selection_color() const { return (view_.selection_color()); }
  void		showlinenum(bool b) { view_.showlinenum(b); }
  bool		showlinenum() const { return (view_.showlinenum()); }
  void		ignoreblanks(bool b) { view_.ignoreblanks(b); }
  bool		ignoreblanks() const { return (view_.ignoreblanks()); }
  void		tabwidth(int t) { view_.tabwidth(t); }
  int		tabwidth() const { return (view_.tabwidth()); }
  void		textcolor(Fl_Color c) { view_.textcolor(c); }
  Fl_Color	textcolor() const { return (view_.textcolor()); }
  void		textfont(uchar f) { view_.textfont(f); }
  uchar		textfont() const { return (view_.textfont()); }
  void		textsize(uchar s) { view_.textsize(s); }
  uchar		textsize() const { return (view_.textsize()); }
  void		zoom(bool b) { zoom_ = b; }
  bool		zoom() const { return (zoom_); }
};


#endif // !_DiffWindow_h_

//
// End of "$Id: DiffWindow.h 407 2006-11-13 18:54:02Z mike $".
//