xref: /haiku/src/apps/stylededit/StyledEditWindow.h (revision 24159a0c7d6d6dcba9f2a0c1a7c08d2c8167f21b)
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, uint32 encoding = 0);
19 					StyledEditWindow(BRect frame, entry_ref *ref, uint32 encoding = 0);
20 					virtual ~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 = 0);
28 	status_t		SaveAs(BMessage *message = 0);
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(uint32 encoding = 0);
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		*fFindAgainItem;
64 	BMenuItem		*fReplaceSameItem;
65 
66 	BMenuItem		*fBlackItem;
67 	BMenuItem		*fRedItem;
68 	BMenuItem		*fGreenItem;
69 	BMenuItem		*fBlueItem;
70 	BMenuItem		*fCyanItem;
71 	BMenuItem		*fMagentaItem;
72 	BMenuItem		*fYellowItem;
73 
74 	BMenuItem		*fWrapItem;
75 	BMenuItem		*fAlignLeft;
76 	BMenuItem		*fAlignCenter;
77 	BMenuItem		*fAlignRight;
78 
79 	BString         fStringToFind;
80 	BString			fReplaceString;
81 
82 	// undo modes
83 	bool 			fUndoFlag;   // we just did an undo action
84 	bool			fCanUndo;    // we can do an undo action next
85 	bool 			fRedoFlag;   // we just did a redo action
86 	bool			fCanRedo;    // we can do a redo action next
87 
88 	// clean modes
89 	bool			fUndoCleans; // an undo action will put us in a clean state
90 	bool			fRedoCleans; // a redo action will put us in a clean state
91 	bool			fClean;      // we are in a clean state
92 
93 	bool			fCaseSens;
94 	bool			fWrapAround;
95 	bool			fBackSearch;
96 
97 	StyledEditView  *fTextView;
98 	BScrollView		*fScrollView;
99 
100 	BFilePanel		*fSavePanel;
101 	BMenu			*fSavePanelEncodingMenu;
102 
103 };
104 
105 #endif // STYLED_EDIT_WINDOW_H
106