move code responsible for screen resize to SIGWINCH handler
[ncmpcpp.git] / src / settings.h
blob74ca029d64a444add33e8e218ac8272dca44c0cc
1 /***************************************************************************
2 * Copyright (C) 2008-2009 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef _SETTINGS_H
22 #define _SETTINGS_H
24 #include <limits>
25 #include <vector>
27 #include <mpd/client.h>
29 #include "home.h"
30 #include "ncmpcpp.h"
32 #ifdef WIN32
33 # define HOME_FOLDER "\\ncmpcpp\\"
34 #else
35 # define HOME_FOLDER "/.ncmpcpp/"
36 #endif // WIN32
38 const std::string config_dir = home_path + HOME_FOLDER;
39 const int null_key = std::numeric_limits<int>::max();
41 struct Column
43 Column() : right_alignment(0), display_empty_tag(1) { }
45 unsigned width;
46 Color color;
47 char type;
48 bool fixed;
49 bool right_alignment;
50 bool display_empty_tag;
53 struct ncmpcpp_keys
55 int Up[2];
56 int Down[2];
57 int PageUp[2];
58 int PageDown[2];
59 int Home[2];
60 int End[2];
61 int Space[2];
62 int Enter[2];
63 int Delete[2];
64 int VolumeUp[2];
65 int VolumeDown[2];
66 int ScreenSwitcher[2];
67 int Help[2];
68 int Playlist[2];
69 int Browser[2];
70 int SearchEngine[2];
71 int MediaLibrary[2];
72 int PlaylistEditor[2];
73 int TagEditor[2];
74 int Outputs[2];
75 int Visualizer[2];
76 int Clock[2];
77 int ServerInfo[2];
78 int Stop[2];
79 int Pause[2];
80 int Next[2];
81 int Prev[2];
82 int SeekForward[2];
83 int SeekBackward[2];
84 int ToggleRepeat[2];
85 int ToggleRandom[2];
86 int ToggleSingle[2];
87 int ToggleConsume[2];
88 int ToggleReplayGainMode[2];
89 int ToggleSpaceMode[2];
90 int ToggleAddMode[2];
91 int ToggleMouse[2];
92 int Shuffle[2];
93 int ToggleCrossfade[2];
94 int SetCrossfade[2];
95 int UpdateDB[2];
96 int SortPlaylist[2];
97 int ApplyFilter[2];
98 int FindForward[2];
99 int FindBackward[2];
100 int NextFoundPosition[2];
101 int PrevFoundPosition[2];
102 int ToggleFindMode[2];
103 int EditTags[2];
104 int SongInfo[2];
105 int ArtistInfo[2];
106 int GoToPosition[2];
107 int Lyrics[2];
108 int ReverseSelection[2];
109 int DeselectAll[2];
110 int AddSelected[2];
111 int Clear[2];
112 int Crop[2];
113 int MvSongUp[2];
114 int MvSongDown[2];
115 int MoveTo[2];
116 int Add[2];
117 int SavePlaylist[2];
118 int GoToNowPlaying[2];
119 int GoToContainingDir[2];
120 int ToggleAutoCenter[2];
121 int ToggleDisplayMode[2];
122 int ToggleInterface[2];
123 int ToggleLyricsDB[2];
124 int GoToParentDir[2];
125 int SwitchTagTypeList[2];
126 int Quit[2];
129 struct ncmpcpp_config
131 std::string mpd_host;
132 std::string mpd_music_dir;
133 std::string visualizer_fifo_path;
134 std::string empty_tag;
135 std::string song_list_columns_format;
136 std::string song_list_format;
137 std::string song_status_format;
138 std::string song_status_format_no_colors;
139 std::string song_window_title_format;
140 std::string song_library_format;
141 std::string tag_editor_album_format;
142 std::string external_editor;
143 std::string system_encoding;
144 std::string execute_on_song_change;
145 std::string new_header_first_line;
146 std::string new_header_second_line;
147 std::basic_string<my_char_t> progressbar;
149 std::string pattern;
151 std::vector<Column> columns;
153 Buffer browser_playlist_prefix;
154 Buffer selected_item_prefix;
155 Buffer selected_item_suffix;
156 Buffer now_playing_prefix;
157 basic_buffer<my_char_t> now_playing_suffix;
159 Color color1;
160 Color color2;
161 Color empty_tags_color;
162 Color header_color;
163 Color volume_color;
164 Color state_line_color;
165 Color state_flags_color;
166 Color main_color;
167 Color main_highlight_color;
168 Color progressbar_color;
169 Color statusbar_color;
170 Color alternative_ui_separator_color;
171 Color active_column_color;
173 Border window_border;
174 Border active_window_border;
176 mpd_tag_type media_lib_primary_tag;
178 bool colors_enabled;
179 bool fancy_scrolling;
180 bool playlist_show_remaining_time;
181 bool columns_in_playlist;
182 bool columns_in_browser;
183 bool columns_in_search_engine;
184 bool set_window_title;
185 bool header_visibility;
186 bool header_text_scrolling;
187 bool statusbar_visibility;
188 bool autocenter_mode;
189 bool wrapped_search;
190 bool space_selects;
191 bool ncmpc_like_songs_adding;
192 bool albums_in_tag_editor;
193 bool incremental_seeking;
194 bool now_playing_lyrics;
195 bool local_browser_show_hidden_files;
196 bool search_in_db;
197 bool display_screens_numbers_on_start;
198 bool jump_to_now_playing_song_at_start;
199 bool clock_display_seconds;
200 bool display_bitrate;
201 bool display_remaining_time;
202 bool ignore_leading_the;
203 bool block_search_constraints_change;
204 bool use_console_editor;
205 bool use_cyclic_scrolling;
206 bool allow_physical_files_deletion;
207 bool allow_physical_directories_deletion;
208 bool ask_before_clearing_main_playlist;
209 bool mouse_support;
210 bool new_design;
211 bool visualizer_use_wave;
212 bool browser_sort_by_mtime;
214 int mpd_port;
215 int mpd_connection_timeout;
216 int crossfade_time;
217 int seek_time;
218 int playlist_disable_highlight_delay;
219 int message_delay_time;
220 int lyrics_db;
221 int regex_type;
223 unsigned lines_scrolled;
226 extern ncmpcpp_config Config;
227 extern ncmpcpp_keys Key;
229 void CreateConfigDir();
230 void SetWindowsDimensions(size_t &header_height, size_t &footer_start_y, size_t &footer_height);
231 void DefaultKeys(ncmpcpp_keys &);
232 void DefaultConfiguration(ncmpcpp_config &);
233 void ReadKeys(ncmpcpp_keys &);
234 void ReadConfiguration(ncmpcpp_config &);
236 #endif