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 EXPORT_MODE_ICON_SOURCE, 44 }; 45 46 typedef enum { 47 LAST_PATH_OPEN = 0, 48 LAST_PATH_SAVE, 49 LAST_PATH_EXPORT, 50 } path_kind; 51 52 class IconEditorApp : public BApplication { 53 public: 54 IconEditorApp(); 55 virtual ~IconEditorApp(); 56 57 // BApplication interface 58 virtual bool QuitRequested(); 59 virtual void MessageReceived(BMessage* message); 60 virtual void ReadyToRun(); 61 virtual void RefsReceived(BMessage* message); 62 virtual void ArgvReceived(int32 argc, char** argv); 63 64 // IconEditorApp 65 66 private: 67 bool _CheckSaveIcon(const BMessage* currentMessage); 68 void _PickUpActionBeforeSave(); 69 70 void _MakeIconEmpty(); 71 void _Open(const entry_ref& ref, 72 bool append = false); 73 void _Open(const BMessenger& externalObserver, 74 const uint8* data, size_t size); 75 DocumentSaver* _CreateSaver(const entry_ref& ref, 76 uint32 exportMode); 77 78 void _SyncPanels(BFilePanel* from, 79 BFilePanel* to); 80 81 const char* _LastFilePath(path_kind which); 82 83 void _StoreSettings(); 84 void _RestoreSettings(BMessage& settings); 85 void _InstallDocumentMimeType(); 86 87 MainWindow* fMainWindow; 88 Document* fDocument; 89 90 BFilePanel* fOpenPanel; 91 SavePanel* fSavePanel; 92 93 BString fLastOpenPath; 94 BString fLastSavePath; 95 BString fLastExportPath; 96 97 BMessage* fMessageAfterSave; 98 }; 99 100 #endif // ICON_EDITOR_APP_H 101