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