[MPlayer-cvslog] r35595 - in trunk/gui/win32: dialogs.c gui.c interface.c playlist.c preferences.c skinload.c wincfg.c
ib
subversion at mplayerhq.hu
Tue Dec 4 21:06:43 CET 2012
Author: ib
Date: Tue Dec 4 21:06:43 2012
New Revision: 35595
Log:
Use boolean symbolic constants in Win32 GUI.
Use them wherever suitable and useful to make code easier to read.
Modified:
trunk/gui/win32/dialogs.c
trunk/gui/win32/gui.c
trunk/gui/win32/interface.c
trunk/gui/win32/playlist.c
trunk/gui/win32/preferences.c
trunk/gui/win32/skinload.c
trunk/gui/win32/wincfg.c
Modified: trunk/gui/win32/dialogs.c
==============================================================================
--- trunk/gui/win32/dialogs.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/dialogs.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -43,7 +43,7 @@ int set_video_colors(sh_video_t *sh_vide
int get_video_colors(sh_video_t *sh_video, const char *item, int *value);
guiInterface_t guiInfo;
-int addurl = 0;
+int addurl = FALSE;
void mplayerLoadSubtitle(const char *name)
{
@@ -332,7 +332,7 @@ static LRESULT CALLBACK OpenUrlWndProc(H
fprintf(f, file);
fclose(f);
}
- if(!parse_filename(file, playtree, mconfig, addurl? 0 : 1))
+ if(!parse_filename(file, playtree, mconfig, addurl? FALSE : TRUE))
gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
if(!addurl)
gui->startplay(gui);
@@ -345,7 +345,7 @@ static LRESULT CALLBACK OpenUrlWndProc(H
return 0;
case WM_DESTROY:
{
- addurl = 0;
+ addurl = FALSE;
return 0;
}
}
@@ -374,7 +374,7 @@ void display_openurlwindow(gui_t *gui, i
WNDCLASS wc;
int x, y;
- if(add) addurl = 1;
+ if(add) addurl = TRUE;
if(FindWindow(NULL, acp(MSGTR_Network))) return;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = OpenUrlWndProc;
Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/gui.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -64,7 +64,7 @@ float video_aspect;
DWORD oldtime;
NOTIFYICONDATA nid;
-int console_state = 0;
+int console_state = FALSE;
play_tree_t *playtree = NULL;
static HBRUSH colorbrush = NULL; //Handle to colorkey brush
@@ -122,8 +122,8 @@ static void console_toggle(gui_t *gui)
if (console_state)
{
FreeConsole();
- console = 0;
- console_state = 0;
+ console = FALSE;
+ console_state = FALSE;
}
else
{
@@ -131,7 +131,7 @@ static void console_toggle(gui_t *gui)
CONSOLE_SCREEN_BUFFER_INFO coninfo;
FILE *fp;
HWND hwnd = NULL;
- console = 1;
+ console = TRUE;
AllocConsole();
SetConsoleTitle(mplayer_version);
@@ -156,7 +156,7 @@ static void console_toggle(gui_t *gui)
*stderr = *fp;
setvbuf(stderr, NULL, _IONBF, 0);
print_version("MPlayer");
- console_state = 1;
+ console_state = TRUE;
}
if (gui)
@@ -867,20 +867,20 @@ static LRESULT CALLBACK EventProc(HWND h
{
char volname[MAX_PATH];
char menuitem[MAX_PATH];
- int flags = MF_STRING, enable = 0;
+ int flags = MF_STRING, enable = FALSE;
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
#ifdef CONFIG_DVDREAD
sprintf(searchpath, "%sVIDEO_TS", device + pos);
if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- enable = 1;
+ enable = TRUE;
#endif
sprintf(searchpath, "%sMpegav", device + pos);
if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- enable = 1;
+ enable = TRUE;
#ifdef CONFIG_CDDA
sprintf(searchpath, "%sTrack01.cda", device + pos);
if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- enable = 1;
+ enable = TRUE;
#endif
flags |= (enable ? MF_ENABLED : MF_GRAYED);
volname[0] = 0;
Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/interface.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -483,10 +483,10 @@ void uiFullScreen( void )
if(fullscreen)
{
- fullscreen = 0;
+ fullscreen = FALSE;
style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
} else {
- fullscreen = 1;
+ fullscreen = TRUE;
style = WS_VISIBLE | WS_POPUP;
}
SetWindowLong(mygui->videowindow, GWL_STYLE, style);
@@ -506,7 +506,7 @@ static unsigned __stdcall GuiThread(void
if(autosync && autosync != gtkAutoSync)
{
- gtkAutoSyncOn = 1;
+ gtkAutoSyncOn = TRUE;
gtkAutoSync = autosync;
}
@@ -559,7 +559,7 @@ int gui(int what, void *data)
#ifdef CONFIG_DVDREAD
dvd_priv_t *dvdp;
#endif
- if(!mygui || !mygui->skin) return 0;
+ if(!mygui || !mygui->skin) return FALSE;
if(guiInfo.mpcontext)
{
@@ -580,7 +580,7 @@ int gui(int what, void *data)
stream_cache_size = -1;
autosync = 0;
force_fps = 0;
- if(!mygui->playlist->tracks) return 0;
+ if(!mygui->playlist->tracks) return FALSE;
switch(guiInfo.StreamType)
{
case STREAMTYPE_FILE:
@@ -600,7 +600,7 @@ int gui(int what, void *data)
break;
}
}
- guiInfo.VideoWindow = 1;
+ guiInfo.VideoWindow = TRUE;
if(gtkAONorm) listRepl(&af_cfg.list, "volnorm", "volnorm");
if(gtkAOExtraStereo)
{
@@ -617,7 +617,7 @@ int gui(int what, void *data)
}
case GUI_SET_AUDIO:
{
- if (data && !guiInfo.sh_video) guiInfo.VideoWindow = 0;
+ if (data && !guiInfo.sh_video) guiInfo.VideoWindow = FALSE;
if(IsWindowVisible(mygui->videowindow) && !guiInfo.VideoWindow)
ShowWindow(mygui->videowindow, SW_HIDE);
break;
@@ -725,7 +725,7 @@ int gui(int what, void *data)
mygui->uninit(mygui);
nfree(mygui);
exit_player(EXIT_QUIT);
- return 1;
+ return TRUE;
}
case MP_CMD_PLAY_TREE_STEP:
guiSetEvent(evNext);
@@ -767,7 +767,7 @@ int gui(int what, void *data)
if(!guiInfo.PlaylistNext && guiInfo.Playing)
{
- guiInfo.PlaylistNext = 1;
+ guiInfo.PlaylistNext = TRUE;
break;
}
@@ -780,7 +780,7 @@ int gui(int what, void *data)
if(movie_aspect >= 0)
movie_aspect = -1;
- guiInfo.PlaylistNext = 1;
+ guiInfo.PlaylistNext = TRUE;
guiInfo.NewPlay = GUI_FILE_NEW;
uiSetFile(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_FILE);
//sprintf(guiInfo.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
@@ -800,7 +800,7 @@ int gui(int what, void *data)
if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
mygui->playlist->current = 0;
- fullscreen = 0;
+ fullscreen = FALSE;
if(style == (WS_VISIBLE | WS_POPUP))
{
style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
@@ -812,7 +812,7 @@ int gui(int what, void *data)
default:
mp_msg(MSGT_GPLAYER, MSGL_ERR, "[GUI] GOT UNHANDLED EVENT %i\n", what);
}
- return 1;
+ return TRUE;
}
/* This function adds/inserts one file into the gui playlist */
@@ -849,7 +849,7 @@ static int import_file_into_gui(char *pa
int guiPlaylistInitialize(play_tree_t *my_playtree, m_config_t *config, int enqueue)
{
play_tree_iter_t *my_pt_iter = NULL;
- int result = 0;
+ int result = FALSE;
if(!mygui) guiInit();
@@ -858,12 +858,12 @@ int guiPlaylistInitialize(play_tree_t *m
while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
{
if (parse_filename(filename, my_playtree, config, 0))
- result = 1;
+ result = TRUE;
else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
- result = 1;
+ result = TRUE;
}
}
- guiInfo.PlaylistNext = 1;
+ guiInfo.PlaylistNext = TRUE;
if (result)
{
@@ -883,13 +883,13 @@ int guiPlaylistInitialize(play_tree_t *m
int guiPlaylistAdd(play_tree_t *my_playtree, m_config_t *config)
{
play_tree_iter_t *my_pt_iter = NULL;
- int result = 0;
+ int result = FALSE;
if((my_pt_iter = pt_iter_create(&my_playtree, config)))
{
while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
if (import_file_into_gui(filename, 1)) /* insert it into the list and set plCurrent = new item */
- result = 1;
+ result = TRUE;
pt_iter_destroy(&my_pt_iter);
}
return result;
Modified: trunk/gui/win32/playlist.c
==============================================================================
--- trunk/gui/win32/playlist.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/playlist.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -40,7 +40,7 @@ int adddirtoplaylist(playlist_t *playlis
findHandle = FindFirstFile(findpath, &finddata);
- if (findHandle == INVALID_HANDLE_VALUE) return 0;
+ if (findHandle == INVALID_HANDLE_VALUE) return FALSE;
do
{
if (finddata.cFileName[0] == '.' || strstr(finddata.cFileName, "Thumbs.db")) continue;
@@ -58,7 +58,7 @@ int adddirtoplaylist(playlist_t *playlis
}
} while (FindNextFile(findHandle, &finddata));
FindClose(findHandle);
- return 1;
+ return TRUE;
}
static void add_track(playlist_t *playlist, const char *filename, const char *artist, const char *title, int duration)
Modified: trunk/gui/win32/preferences.c
==============================================================================
--- trunk/gui/win32/preferences.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/preferences.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -43,20 +43,20 @@
static void set_defaults(void)
{
proc_priority = "normal";
- vo_doublebuffering = 1;
- vo_directrendering = 0;
+ vo_doublebuffering = TRUE;
+ vo_directrendering = FALSE;
frame_dropping = 0;
- soft_vol = 0;
- gtkAONorm = 0;
- gtkAOExtraStereo = 0;
+ soft_vol = FALSE;
+ gtkAONorm = FALSE;
+ gtkAOExtraStereo = FALSE;
gtkAOExtraStereoMul = 1.0;
audio_delay = 0.0;
- video_window = 1;
- gtkCacheOn = 0;
+ video_window = TRUE;
+ gtkCacheOn = FALSE;
gtkCacheSize = 2048;
- gtkAutoSyncOn = 0;
+ gtkAutoSyncOn = FALSE;
gtkAutoSync = 0;
- player_idle_mode = 1;
+ player_idle_mode = TRUE;
}
static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
@@ -565,18 +565,18 @@ static LRESULT CALLBACK PrefsWndProc(HWN
/* double buffering */
if(SendDlgItemMessage(hwnd, ID_DOUBLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- vo_doublebuffering = 1;
- else vo_doublebuffering = 0;
+ vo_doublebuffering = TRUE;
+ else vo_doublebuffering = FALSE;
/* direct rendering */
if(SendDlgItemMessage(hwnd, ID_DIRECT, BM_GETCHECK, 0, 0) == BST_CHECKED)
- vo_directrendering = 1;
- else vo_directrendering = 0;
+ vo_directrendering = TRUE;
+ else vo_directrendering = FALSE;
/* quit after playing */
if(SendDlgItemMessage(hwnd, ID_IDLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- player_idle_mode = 0;
- else player_idle_mode = 1;
+ player_idle_mode = FALSE;
+ else player_idle_mode = TRUE;
/* frame dropping */
if(SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_GETCHECK, 0, 0) == BST_CHECKED)
@@ -585,19 +585,19 @@ static LRESULT CALLBACK PrefsWndProc(HWN
/* normalize */
if(SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkAONorm = 1;
- else gtkAONorm = 0;
+ gtkAONorm = TRUE;
+ else gtkAONorm = FALSE;
/* software mixer */
if(SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_GETCHECK, 0, 0) == BST_CHECKED)
- soft_vol = 1;
- else soft_vol = 0;
+ soft_vol = TRUE;
+ else soft_vol = FALSE;
/* extra stereo */
if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkAOExtraStereo = 1;
+ gtkAOExtraStereo = TRUE;
else {
- gtkAOExtraStereo = 0;
+ gtkAOExtraStereo = FALSE;
gtkAOExtraStereoMul = 10.0;
}
gtkAOExtraStereoMul = SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_GETPOS, 0, 0) / 10.0;
@@ -607,20 +607,20 @@ static LRESULT CALLBACK PrefsWndProc(HWN
/* cache */
if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkCacheOn = 1;
- else gtkCacheOn = 0;
+ gtkCacheOn = TRUE;
+ else gtkCacheOn = FALSE;
gtkCacheSize = SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_GETPOS32, 0, 0);
/* autosync */
if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkAutoSyncOn = 1;
- else gtkAutoSyncOn = 0;
+ gtkAutoSyncOn = TRUE;
+ else gtkAutoSyncOn = FALSE;
gtkAutoSync = SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_GETPOS32, 0, 0);
/* video window */
if(SendDlgItemMessage(hwnd, ID_VIDEOWINDOW, BM_GETCHECK, 0, 0) == BST_CHECKED)
- video_window = 1;
- else video_window = 0;
+ video_window = TRUE;
+ else video_window = FALSE;
/* osd level */
if(SendDlgItemMessage(hwnd, ID_NONE, BM_GETCHECK, 0, 0) == BST_CHECKED)
Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/skinload.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -549,7 +549,7 @@ static void loadfonts(skin_t* skin)
skin_t* loadskin(char* skindir, int desktopbpp)
{
FILE *fp;
- int reachedendofwindow = 0;
+ int reachedendofwindow = FALSE;
int linenumber = 0;
skin_t *skin = calloc(1, sizeof(skin_t));
char *filename;
@@ -582,14 +582,14 @@ skin_t* loadskin(char* skindir, int desk
{
int pos = 0;
unsigned int i;
- int insidequote = 0;
+ int insidequote = FALSE;
fgets(tmp, MAX_LINESIZE, fp);
linenumber++;
memset(desc, 0, MAX_LINESIZE);
for (i=0; i<strlen(tmp); i++)
{
- if((tmp[i] == '"') && !insidequote) { insidequote=1; continue; }
- else if((tmp[i] == '"') && insidequote) { insidequote=0 ; continue; }
+ if((tmp[i] == '"') && !insidequote) { insidequote=TRUE; continue; }
+ else if((tmp[i] == '"') && insidequote) { insidequote=FALSE ; continue; }
/* remove spaces and linebreaks */
if((!insidequote && (tmp[i] == ' ')) || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
/* remove comments */
@@ -612,7 +612,7 @@ skin_t* loadskin(char* skindir, int desk
else if(!strncmp(desc, "window", 6))
{
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [WINDOW] \"%s\"\n", desc + 7);
- reachedendofwindow = 0;
+ reachedendofwindow = FALSE;
(skin->windowcount)++;
skin->windows = realloc(skin->windows, sizeof(window *) * skin->windowcount);
mywindow = skin->windows[(skin->windowcount) - 1] = calloc(1, sizeof(window));
@@ -621,7 +621,7 @@ skin_t* loadskin(char* skindir, int desk
else if(!strncmp(desc+7, "video", 5) || !strncmp(desc+7, "sub", 3)) // legacy
{
mywindow->type = wiVideo;
- mywindow->decoration = 1;
+ mywindow->decoration = TRUE;
}
else if(!strncmp(desc + 7, "menu", 4)) mywindow->type = wiMenu;
else if(!strncmp(desc + 7, "playbar", 7)) mywindow->type = wiPlaybar;
@@ -629,7 +629,7 @@ skin_t* loadskin(char* skindir, int desk
}
else if(!strncmp(desc, "decoration", 10) && !strncmp(desc + 11, "enable", 6))
{
- mywindow->decoration = 1;
+ mywindow->decoration = TRUE;
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [DECORATION] enabled decoration for window \"%s\"\n", mywindow->name);
}
else if(!strncmp(desc, "background", 10))
@@ -652,7 +652,7 @@ skin_t* loadskin(char* skindir, int desk
}
else
{
- reachedendofwindow = 1;
+ reachedendofwindow = TRUE;
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [END] of window \"%s\"\n", mywindow->name);
}
}
Modified: trunk/gui/win32/wincfg.c
==============================================================================
--- trunk/gui/win32/wincfg.c Tue Dec 4 20:26:03 2012 (r35594)
+++ trunk/gui/win32/wincfg.c Tue Dec 4 21:06:43 2012 (r35595)
@@ -41,18 +41,18 @@
static const char gui_configuration[] = "gui.conf";
/* params */
-int gtkAONorm = 0;
-int gtkAOExtraStereo = 0;
+int gtkAONorm = FALSE;
+int gtkAOExtraStereo = FALSE;
float gtkAOExtraStereoMul = 1.0;
-int gtkCacheOn = 0;
+int gtkCacheOn = FALSE;
int gtkCacheSize = 2048;
-int gtkAutoSyncOn = 0;
+int gtkAutoSyncOn = FALSE;
int gtkAutoSync = 0;
-int video_window = 1;
-int console = 0;
+int video_window = TRUE;
+int console = FALSE;
-int gui_save_pos = 1;
+int gui_save_pos = TRUE;
int gui_main_pos_x = -2;
int gui_main_pos_y = -2;
int gui_video_pos_x = -1;
@@ -99,7 +99,7 @@ void cfg_read(void)
{
char *cfg = get_path(gui_configuration);
- player_idle_mode = 1; // GUI is in idle mode by default
+ player_idle_mode = TRUE; // GUI is in idle mode by default
/* read configuration */
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] [cfg] reading config file: %s\n", cfg);
More information about the MPlayer-cvslog
mailing list