1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef ICON_EDITOR_APP_H 10 #define ICON_EDITOR_APP_H 11 12 #include <Application.h> 13 #include <String.h> 14 15 class BFilePanel; 16 class Document; 17 class DocumentSaver; 18 class MainWindow; 19 class SavePanel; 20 21 enum { 22 MSG_NEW = 'newi', 23 24 MSG_OPEN = 'open', 25 MSG_APPEND = 'apnd', 26 27 MSG_SAVE = 'save', 28 MSG_SAVE_AS = 'svas', 29 30 MSG_EXPORT = 'xprt', 31 MSG_EXPORT_AS = 'xpas', 32 }; 33 34 enum { 35 EXPORT_MODE_MESSAGE = 0, 36 EXPORT_MODE_FLAT_ICON, 37 EXPORT_MODE_SVG, 38 EXPORT_MODE_BITMAP, 39 EXPORT_MODE_BITMAP_SET, 40 EXPORT_MODE_ICON_ATTR, 41 EXPORT_MODE_ICON_MIME_ATTR, 42 EXPORT_MODE_ICON_RDEF, 43 }; 44 45 typedef enum { 46 LAST_PATH_OPEN = 0, 47 LAST_PATH_SAVE, 48 LAST_PATH_EXPORT, 49 } path_kind; 50 51 class IconEditorApp : public BApplication { 52 public: 53 IconEditorApp(); 54 virtual ~IconEditorApp(); 55 56 // BApplication interface 57 virtual bool QuitRequested(); 58 virtual void MessageReceived(BMessage* message); 59 virtual void ReadyToRun(); 60 virtual void RefsReceived(BMessage* message); 61 virtual void ArgvReceived(int32 argc, char** argv); 62 63 // IconEditorApp 64 65 private: 66 bool _CheckSaveIcon(const BMessage* currentMessage); 67 void _PickUpActionBeforeSave(); 68 69 void _MakeIconEmpty(); 70 void _Open(const entry_ref& ref, 71 bool append = false); 72 void _Open(const BMessenger& externalObserver, 73 const uint8* data, size_t size); 74 DocumentSaver* _CreateSaver(const entry_ref& ref, 75 uint32 exportMode); 76 77 void _SyncPanels(BFilePanel* from, 78 BFilePanel* to); 79 80 const char* _LastFilePath(path_kind which); 81 82 void _StoreSettings(); 83 void _RestoreSettings(BMessage& settings); 84 void _InstallDocumentMimeType(); 85 86 MainWindow* fMainWindow; 87 Document* fDocument; 88 89 BFilePanel* fOpenPanel; 90 SavePanel* fSavePanel; 91 92 BString fLastOpenPath; 93 BString fLastSavePath; 94 BString fLastExportPath; 95 96 BMessage* fMessageAfterSave; 97 }; 98 99 #endif // ICON_EDITOR_APP_H 100