1 //////////////////////////////////////////////////////////////////////////////////////// 2 // 3 // Nestopia - NES/Famicom emulator written in C++ 4 // 5 // Copyright (C) 2003-2008 Martin Freij 6 // 7 // This file is part of Nestopia. 8 // 9 // Nestopia is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 13 // 14 // Nestopia is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with Nestopia; if not, write to the Free Software 21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 // 23 //////////////////////////////////////////////////////////////////////////////////////// 24 25 #ifndef NST_DIALOG_PATHS_H 26 #define NST_DIALOG_PATHS_H 27 28 #pragma once 29 30 #include "NstCollectionBitSet.hpp" 31 #include "NstWindowDialog.hpp" 32 33 namespace Nestopia 34 { 35 namespace Window 36 { 37 class Paths 38 { 39 public: 40 41 enum Type 42 { 43 DIR_IMAGE, 44 DIR_SAVE, 45 DIR_STATE, 46 DIR_SAMPLES, 47 DIR_CHEATS, 48 DIR_PATCHES, 49 DIR_SCREENSHOT 50 }; 51 52 enum ScreenShotFormat 53 { 54 SCREENSHOT_PNG, 55 SCREENSHOT_JPEG, 56 SCREENSHOT_BMP 57 }; 58 59 enum 60 { 61 NUM_DIRS = DIR_SCREENSHOT + 1, 62 NUM_SCREENSHOTS = SCREENSHOT_BMP + 1 63 }; 64 65 enum 66 { 67 USE_LAST_IMAGE_DIR, 68 READONLY_CARTRIDGE, 69 AUTO_IMPORT_STATE_SLOTS, 70 AUTO_EXPORT_STATE_SLOTS, 71 CHEATS_AUTO_LOAD, 72 CHEATS_AUTO_SAVE, 73 PATCH_AUTO_APPLY, 74 PATCH_BYPASS_VALIDATION, 75 COMPRESS_STATES, 76 NUM_FLAGS 77 }; 78 79 explicit Paths(const Configuration&); 80 ~Paths(); 81 82 void Save(Configuration&) const; 83 const GenericString GetScreenShotExtension() const; 84 const Path GetDirectory(Type) const; 85 86 private: 87 88 struct Handlers; 89 90 struct Settings 91 { 92 Settings(); 93 94 struct Flags : Collection::BitSet 95 { 96 inline Flags(); 97 }; 98 99 Flags flags; 100 Path dirs[NUM_DIRS]; 101 ScreenShotFormat screenShotFormat; 102 }; 103 104 void Update(bool) const; 105 void UpdateDirectory(uint); 106 void UpdateLastVisited() const; 107 108 ibool OnInitDialog (Param&); 109 ibool OnCmdBrowse (Param&); 110 ibool OnCmdLastVisited (Param&); 111 ibool OnCmdDefault (Param&); 112 ibool OnCmdOk (Param&); 113 114 Settings settings; 115 Dialog dialog; 116 117 struct Lut; 118 119 public: 120 Open()121 void Open() 122 { 123 dialog.Open(); 124 } 125 GetSetting(uint flag) const126 bool GetSetting(uint flag) const 127 { 128 return settings.flags[flag]; 129 } 130 GetScreenShotFormat() const131 ScreenShotFormat GetScreenShotFormat() const 132 { 133 return settings.screenShotFormat; 134 } 135 }; 136 } 137 } 138 139 #endif 140