xref: /haiku/src/apps/stylededit/StyledEditWindow.h (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 #ifndef STYLED_EDIT_WINDOW_H
2 #define STYLED_EDIT_WINDOW_H
3 
4 #include <FilePanel.h>
5 #include <MenuBar.h>
6 #include <Message.h>
7 #include <Rect.h>
8 #include <String.h>
9 #include <TextView.h>
10 #include <Window.h>
11 
12 class StyledEditView;
13 
14 class StyledEditWindow
15 	: public BWindow
16 {
17 public:
18 					StyledEditWindow(BRect frame, int32 id);
19 					StyledEditWindow(BRect frame, entry_ref *ref);
20 					~StyledEditWindow();
21 
22 	virtual void	Quit();
23 	virtual bool 	QuitRequested();
24 	virtual void 	MessageReceived(BMessage *message);
25 	virtual void	MenusBeginning();
26 
27 	status_t 		Save(BMessage *message);
28 	status_t		SaveAs();
29 	void			OpenFile(entry_ref *ref);
30 	status_t		PageSetup(const char *documentname);
31 	void			Print(const char *documentname);
32 	void			SearchAllWindows(BString find, BString replace, bool casesens);
33 
34 private:
35 	void			InitWindow();
36 	bool			Search(BString searchfor, bool casesens, bool wrap, bool backsearch);
37 	void			FindSelection();
38 	bool			Replace(BString findthis, BString replacewith, bool casesens, bool wrap, bool backsearch);
39 	void			ReplaceAll(BString find, BString replace, bool casesens);
40 	void			SetFontSize(float fontSize);
41 	void			SetFontColor(const rgb_color *color);
42 	void			SetFontStyle(const char *fontFamily, const char *fontStyle);
43 	void			RevertToSaved();
44 
45 	BMenuBar		*fMenuBar;
46 	BMessage		*fPrintSettings;
47 	BMessage		*fSaveMessage;
48 	BMenu			*fRecentMenu;
49 
50 	BMenu			*fFontMenu;
51 	BMenu			*fFontSizeMenu;
52 	BMenu			*fFontColorMenu;
53 	BMenuItem		*fCurrentFontItem;
54 
55 	BMenuItem		*fSaveItem;
56 	BMenuItem		*fRevertItem;
57 
58 	BMenuItem		*fUndoItem;
59 	BMenuItem		*fCutItem;
60 	BMenuItem		*fCopyItem;
61 	BMenuItem		*fClearItem;
62 
63 	BMenuItem		*fBlackItem;
64 	BMenuItem		*fRedItem;
65 	BMenuItem		*fGreenItem;
66 	BMenuItem		*fBlueItem;
67 	BMenuItem		*fCyanItem;
68 	BMenuItem		*fMagentaItem;
69 	BMenuItem		*fYellowItem;
70 
71 	BMenuItem		*fWrapItem;
72 	BMenuItem		*fAlignLeft;
73 	BMenuItem		*fAlignCenter;
74 	BMenuItem		*fAlignRight;
75 
76 	BString         fStringToFind;
77 	BString			fReplaceString;
78 
79 	// undo modes
80 	bool 			fUndoFlag;   // we just did an undo action
81 	bool			fCanUndo;    // we can do an undo action next
82 	bool 			fRedoFlag;   // we just did a redo action
83 	bool			fCanRedo;    // we can do a redo action next
84 
85 	// clean modes
86 	bool			fUndoCleans; // an undo action will put us in a clean state
87 	bool			fRedoCleans; // a redo action will put us in a clean state
88 	bool			fClean;      // we are in a clean state
89 
90 	bool			fCaseSens;
91 	bool			fWrapAround;
92 	bool			fBackSearch;
93 
94 	StyledEditView  *fTextView;
95 	BScrollView		*fScrollView;
96 
97 	BFilePanel		*fSavePanel;
98 	BTextControl	*fSavePanelTextView;
99 	BMenu			*fSavePanelEncodingMenu;
100 
101 };
102 
103 #endif // STYLED_EDIT_WINDOW_H
104