# HG changeset patch # User ib # Date 1354646174 0 # Node ID 411875efca3f0804a4cd3ea56e65daa4aeb940fc # Parent 5cbbd9ca401061acc424520ac059f029623597d6 Introduce boolean symbolic constants. Use them wherever suitable and useful to make code easier to read. diff -r 5cbbd9ca4010 -r 411875efca3f gui/app.c --- a/gui/app.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/app.c Tue Dec 04 18:36:14 2012 +0000 @@ -22,6 +22,7 @@ */ #include "app.h" +#include "gui.h" #include "skin/font.h" #include "libavutil/common.h" @@ -106,16 +107,16 @@ int i; appClearItem(&guiApp.main); - guiApp.mainDecoration = 0; + guiApp.mainDecoration = False; appClearItem(&guiApp.video); appClearItem(&guiApp.playbar); - guiApp.playbarIsPresent = 0; + guiApp.playbarIsPresent = False; appClearItem(&guiApp.menu); appClearItem(&guiApp.menuSelected); - guiApp.menuIsPresent = 0; + guiApp.menuIsPresent = False; for (i = 0; i <= guiApp.IndexOfMainItems; i++) appClearItem(&guiApp.mainItems[i]); diff -r 5cbbd9ca4010 -r 411875efca3f gui/cfg.c --- a/gui/cfg.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/cfg.c Tue Dec 04 18:36:14 2012 +0000 @@ -21,6 +21,7 @@ #include #include "cfg.h" +#include "gui.h" #include "interface.h" #include "util/list.h" #include "util/string.h" @@ -82,11 +83,11 @@ gtkASS_t gtkASS; -int gtkEnablePlayBar = 1; +int gtkEnablePlayBar = True; int gtkLoadFullscreen; -int gtkShowVideoWindow = 1; +int gtkShowVideoWindow = True; -int gui_save_pos = 1; +int gui_save_pos = True; int gui_main_pos_x = -3; int gui_main_pos_y = -3; int gui_video_pos_x = -3; @@ -244,7 +245,7 @@ char *fname, line[512]; FILE *file; - player_idle_mode = 1; // GUI is in idle mode by default + player_idle_mode = True; // GUI is in idle mode by default /* configuration */ diff -r 5cbbd9ca4010 -r 411875efca3f gui/gui.h --- a/gui/gui.h Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/gui.h Tue Dec 04 18:36:14 2012 +0000 @@ -24,6 +24,14 @@ #ifndef MPLAYER_GUI_GUI_H #define MPLAYER_GUI_GUI_H +//@{ +/// boolean symbolic constant +#if !defined(True) && !defined(False) +#define True 1 +#define False 0 +#endif +//@} + /// a pseudo stream type indicating not to change the current one #define SAME_STREAMTYPE (STREAMTYPE_DUMMY - 1) diff -r 5cbbd9ca4010 -r 411875efca3f gui/interface.c --- a/gui/interface.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/interface.c Tue Dec 04 18:36:14 2012 +0000 @@ -61,7 +61,7 @@ guiInterface_t guiInfo = { .StreamType = STREAMTYPE_DUMMY, .Balance = 50.0f, - .PlaylistNext = 1 + .PlaylistNext = True }; static int initialized; @@ -83,13 +83,13 @@ gtkDXR3Device = strdup("/dev/em8300-0"); if (stream_cache_size > 0) { - gtkCacheOn = 1; + gtkCacheOn = True; gtkCacheSize = stream_cache_size; } else if (stream_cache_size == 0) - gtkCacheOn = 0; + gtkCacheOn = False; if (autosync && (autosync != gtkAutoSync)) { - gtkAutoSyncOn = 1; + gtkAutoSyncOn = True; gtkAutoSync = autosync; } @@ -235,7 +235,7 @@ guiInfo.Playing = GUI_STOP; - uiVideoRender = 1; + uiVideoRender = True; playlist = listMgr(PLAYLIST_ITEM_GET_CURR, 0); @@ -251,13 +251,13 @@ mplayerLoadFont(); - initialized = 1; + initialized = True; } void guiDone(void) { if (initialized) { - uiMainRender = 0; + uiMainRender = False; if (gui_save_pos) { gui_main_pos_x = guiApp.mainWindow.X; @@ -571,7 +571,7 @@ if (gtkSubDumpSrt) stream_dump_type = 6; - gtkSubDumpMPSub = gtkSubDumpSrt = 0; + gtkSubDumpMPSub = gtkSubDumpSrt = False; mplayerLoadFont(); /* misc */ @@ -781,7 +781,7 @@ uiEventHandling(ivRedraw, 1); if (!guiInfo.PlaylistNext && guiInfo.Playing) { - guiInfo.PlaylistNext = 1; + guiInfo.PlaylistNext = True; break; } @@ -840,7 +840,7 @@ gui(GUI_SET_STATE, (void *)GUI_STOP); wsHandleEvents(); - uiVideoRender = 1; + uiVideoRender = True; wsSetBackgroundRGB(&guiApp.videoWindow, guiApp.video.R, guiApp.video.G, guiApp.video.B); wsClearWindow(&guiApp.videoWindow); wsPostRedisplay(&guiApp.videoWindow); @@ -860,7 +860,7 @@ 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 (!enqueue) listMgr(PLAYLIST_DELETE, 0); // delete playlist before "appending" @@ -869,11 +869,11 @@ while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) /* add it to end of list */ if (add_to_gui_playlist(filename, PLAYLIST_ITEM_APPEND)) - result = 1; + result = True; } uiCurr(); // update filename - guiInfo.PlaylistNext = 1; + guiInfo.PlaylistNext = True; if (enqueue) filename = NULL; // don't start playing @@ -892,7 +892,7 @@ 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; plItem *save; save = (plItem *)listMgr(PLAYLIST_ITEM_GET_CURR, 0); // save current item @@ -901,7 +901,7 @@ while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) /* insert it into the list and set plCurrent=new item */ if (add_to_gui_playlist(filename, PLAYLIST_ITEM_INSERT)) - result = 1; + result = True; pt_iter_destroy(&my_pt_iter); } diff -r 5cbbd9ca4010 -r 411875efca3f gui/skin/skin.c --- a/gui/skin/skin.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/skin/skin.c Tue Dec 04 18:36:14 2012 +0000 @@ -27,6 +27,7 @@ #include "skin.h" #include "font.h" #include "gui/app.h" +#include "gui/gui.h" #include "gui/interface.h" #include "gui/ui/widgets.h" #include "gui/util/cut.h" @@ -78,16 +79,16 @@ * * @param item name of the item to be put in a message in case of an error * - * @return 1 (ok) or 0 (error) + * @return #True (ok) or #False (error) */ static int section_item(char *item) { if (!skin) { skin_error(MSGTR_SKIN_ERROR_SECTION, item); - return 0; + return False; } - return 1; + return True; } /** @@ -95,16 +96,16 @@ * * @param item name of the item to be put in a message in case of an error * - * @return 1 (ok) or 0 (error) + * @return #True (ok) or #False (error) */ static int window_item(char *item) { if (!currWinName[0]) { skin_error(MSGTR_SKIN_ERROR_WINDOW, item); - return 0; + return False; } - return 1; + return True; } /** @@ -364,9 +365,9 @@ } if (is_bar) - skin->playbarIsPresent = 1; + skin->playbarIsPresent = True; if (is_menu) - skin->menuIsPresent = 1; + skin->menuIsPresent = True; return 0; } diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/actions.c --- a/gui/ui/actions.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/actions.c Tue Dec 04 18:36:14 2012 +0000 @@ -89,7 +89,7 @@ } gui(GUI_SET_STATE, (void *)GUI_PLAY); - uiVideoRender = 0; + uiVideoRender = False; wsSetBackgroundRGB(&guiApp.videoWindow, 0, 0, 0); wsClearWindow(&guiApp.videoWindow); } @@ -166,11 +166,11 @@ prev = guiApp.menuIsPresent; bprev = guiApp.playbarIsPresent; - mainVisible = 0; + mainVisible = False; if (skinRead(name) != 0) { if (skinRead(skinName) != 0) { - mainVisible = 1; + mainVisible = True; return; } } @@ -207,7 +207,7 @@ wsConvert(&guiApp.videoWindow, guiApp.video.Bitmap.Image); if (!guiInfo.Playing) { - uiVideoRender = 1; + uiVideoRender = True; wsSetBackgroundRGB(&guiApp.videoWindow, guiApp.video.R, guiApp.video.G, guiApp.video.B); wsClearWindow(&guiApp.videoWindow); wsPostRedisplay(&guiApp.videoWindow); @@ -248,7 +248,7 @@ wsWindowDecoration(&guiApp.mainWindow, 0); wsVisibleWindow(&guiApp.mainWindow, wsShowWindow); - mainVisible = 1; + mainVisible = True; btnModify(evSetVolume, guiInfo.Volume); btnModify(evSetBalance, guiInfo.Balance); @@ -325,7 +325,7 @@ if (curr) { uiSetFile(curr->path, curr->name, STREAMTYPE_FILE); - guiInfo.PlaylistNext = 0; + guiInfo.PlaylistNext = False; guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, curr); break; } @@ -342,7 +342,7 @@ */ void uiPrev(void) { - int stop = 0; + int stop = False; plItem *prev; if (guiInfo.Playing == GUI_PAUSE) @@ -353,7 +353,7 @@ if (--guiInfo.Track == 0) { guiInfo.Track = 1; - stop = 1; + stop = True; } break; @@ -362,7 +362,7 @@ if (--guiInfo.Track == 1) { guiInfo.Track = 2; - stop = 1; + stop = True; } break; @@ -374,7 +374,7 @@ if (--guiInfo.Track == 0) { guiInfo.Track = 1; - stop = 1; + stop = True; } } @@ -386,7 +386,7 @@ if (prev) { uiSetFile(prev->path, prev->name, STREAMTYPE_FILE); - guiInfo.PlaylistNext = (guiInfo.Playing ? 0 : 1); + guiInfo.PlaylistNext = (guiInfo.Playing ? False : True); guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev); break; } @@ -406,7 +406,7 @@ */ void uiNext(void) { - int stop = 0; + int stop = False; plItem *next; if (guiInfo.Playing == GUI_PAUSE) @@ -418,7 +418,7 @@ if (++guiInfo.Track > guiInfo.Tracks) { guiInfo.Track = guiInfo.Tracks; - stop = 1; + stop = True; } break; @@ -430,7 +430,7 @@ if (++guiInfo.Track > guiInfo.Tracks) { guiInfo.Track = guiInfo.Tracks; - stop = 1; + stop = True; } } @@ -442,7 +442,7 @@ if (next) { uiSetFile(next->path, next->name, STREAMTYPE_FILE); - guiInfo.PlaylistNext = (guiInfo.Playing ? 0 : 1); + guiInfo.PlaylistNext = (guiInfo.Playing ? False : True); guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next); break; } diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/gtk/fileselect.c --- a/gui/ui/gtk/fileselect.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/gtk/fileselect.c Tue Dec 04 18:36:14 2012 +0000 @@ -31,6 +31,7 @@ #include "gui/ui/pixmaps/file.xpm" #include "gui/app.h" +#include "gui/gui.h" #include "gui/interface.h" #include "gui/util/list.h" #include "gui/util/mem.h" @@ -540,7 +541,7 @@ item=item->next; } if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name_utf8() ); - if ( uiMainAutoPlay ) { uiMainAutoPlay=0; uiEventHandling( evPlay,0 ); } + if ( uiMainAutoPlay ) { uiMainAutoPlay=False; uiEventHandling( evPlay,0 ); } else gui( GUI_SET_STATE,(void *) GUI_STOP ); } diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/gtk/menu.c --- a/gui/ui/gtk/menu.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/gtk/menu.c Tue Dec 04 18:36:14 2012 +0000 @@ -30,6 +30,7 @@ #include "gui/ui/widgets.h" #include "gui/ui/gmplayer.h" #include "gui/app.h" +#include "gui/gui.h" #include "gui/interface.h" #include "stream/stream.h" @@ -645,15 +646,15 @@ if ( guiInfo.VideoWindow ) { - int b1 = 0, b2 = 0, b_half = 0; + int b1 = False, b2 = False, b_half = False; AddSeparator( Menu ); if ( !guiApp.videoWindow.isFullScreen && guiInfo.Playing ) { if ( ( guiApp.videoWindow.Width == guiInfo.VideoWidth * 2 )&& - ( guiApp.videoWindow.Height == guiInfo.VideoHeight * 2 ) ) b2=1; + ( guiApp.videoWindow.Height == guiInfo.VideoHeight * 2 ) ) b2=True; else if ( ( guiApp.videoWindow.Width == guiInfo.VideoWidth / 2 ) && - ( guiApp.videoWindow.Height == guiInfo.VideoHeight / 2 ) ) b_half=1; - else b1=1; + ( guiApp.videoWindow.Height == guiInfo.VideoHeight / 2 ) ) b_half=True; + else b1=True; } else b1=!guiApp.videoWindow.isFullScreen; H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize ); N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize ); diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/gtk/playlist.c --- a/gui/ui/gtk/playlist.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/gtk/playlist.c Tue Dec 04 18:36:14 2012 +0000 @@ -174,8 +174,8 @@ { switch ( (int) user_data ) { - case 0: CLFileSelected[row]=1; break; - case 1: CLListSelected[row]=1; break; + case 0: CLFileSelected[row]=True; break; + case 1: CLListSelected[row]=True; break; } } @@ -183,8 +183,8 @@ { switch ( (int) user_data ) { - case 0: CLFileSelected[row]=0; break; - case 1: CLListSelected[row]=0; break; + case 0: CLFileSelected[row]=False; break; + case 1: CLListSelected[row]=False; break; } } @@ -233,7 +233,7 @@ { uiSetFile( item->path,item->name,STREAMTYPE_FILE ); guiInfo.NewPlay = GUI_FILE_NEW; - guiInfo.PlaylistNext = (curr.name ? 0 : 1); + guiInfo.PlaylistNext = (curr.name ? False : True); guiInfo.Track = 1; } guiInfo.Tracks = (int) listMgr( PLAYLIST_ITEM_GET_POS,NULL ); @@ -289,7 +289,7 @@ else { CLListSelected=p; - CLListSelected[NrOfSelected - 1]=0; + CLListSelected[NrOfSelected - 1]=False; gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext ); cpath=g_filename_to_utf8( current_path, -1, NULL, NULL, NULL ); text[0][0]=itext[0][0]; text[0][1]=cpath ? cpath : current_path; @@ -343,13 +343,13 @@ switch ( (int) user_data ) { case 0: - CLFileSelected[row] = 1; + CLFileSelected[row] = True; plButtonReleased( NULL, (void *) 3 ); - CLFileSelected[row] = 0; + CLFileSelected[row] = False; return TRUE; case 1: - CLListSelected[row] = 1; + CLListSelected[row] = True; plButtonReleased( NULL, (void *) 2 ); return TRUE; } @@ -375,13 +375,13 @@ npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( npath,"%s/%s",path,dirent->d_name ); if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) ) - { free( npath ); closedir( dir ); return 1; } + { free( npath ); closedir( dir ); return True; } free( npath ); } } closedir( dir ); } - return 0; + return False; } static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data ) @@ -390,7 +390,7 @@ DirNodeType * DirNode; gchar * text, * name = NULL; gchar * dummy = "dummy"; - int subdir = 1; + int subdir = True; DIR * dir = NULL; struct dirent * dirent; gchar * path; @@ -399,7 +399,7 @@ DirNode=gtk_ctree_node_get_row_data( ctree,parent_node ); if ( !DirNode->scaned ) { - DirNode->scaned=1; current_path=DirNode->path; + DirNode->scaned=True; current_path=DirNode->path; gtk_clist_freeze( GTK_CLIST( ctree ) ); node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL ); gtk_ctree_remove_node( ctree,node ); @@ -417,7 +417,7 @@ if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' ) { - DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path ); + DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=False; DirNode->path=strdup( path ); subdir=check_for_subdir( path ); node=gtk_ctree_insert_node( ctree,parent_node,NULL,(name ? &name : &text ),4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE ); gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL ); @@ -533,7 +533,7 @@ parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE ); DirNode=malloc( sizeof( DirNodeType ) ); - DirNode->scaned=0; DirNode->path=strdup( root ); + DirNode->scaned=False; DirNode->path=strdup( root ); gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL ); sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE ); gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent ); diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/gtk/preferences.c --- a/gui/ui/gtk/preferences.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/gtk/preferences.c Tue Dec 04 18:36:14 2012 +0000 @@ -41,6 +41,7 @@ #include "gui/app.h" #include "gui/cfg.h" +#include "gui/gui.h" #include "gui/interface.h" #include "gui/ui/gmplayer.h" #include "gui/ui/widgets.h" @@ -467,11 +468,11 @@ gtk_widget_show( Preferences ); gtkSetLayer( Preferences ); { - static int visible = 1; + static int visible = True; if ( visible ) { gtkMessageBox( GTK_MB_WARNING,MSGTR_PREFERENCES_Message ); - visible=0; + visible=False; } } } @@ -620,11 +621,11 @@ player_idle_mode=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoIdle ) ); mplayer( MPLAYER_SET_AUTO_QUALITY,HSPPQualityadj->value,0 ); - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) { gtkCacheSize=(int)SBCacheadj->value; gtkCacheOn=1; } - else gtkCacheOn=0; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) { gtkCacheSize=(int)SBCacheadj->value; gtkCacheOn=True; } + else gtkCacheOn=False; - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) { gtkAutoSync=(int)SBAutoSyncadj->value; gtkAutoSyncOn=1; } - else gtkAutoSyncOn=0; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) { gtkAutoSync=(int)SBAutoSyncadj->value; gtkAutoSyncOn=True; } + else gtkAutoSyncOn=False; setdup( &dvd_device,gtk_entry_get_text( GTK_ENTRY( prEDVDDevice ) ) ); setdup( &cdrom_device,gtk_entry_get_text( GTK_ENTRY( prECDRomDevice ) ) ); diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/gtk/skinbrowser.c --- a/gui/ui/gtk/skinbrowser.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/gtk/skinbrowser.c Tue Dec 04 18:36:14 2012 +0000 @@ -28,6 +28,7 @@ #include "gui/app.h" #include "gui/cfg.h" +#include "gui/gui.h" #include "gui/skin/skin.h" #include "help_mp.h" @@ -87,7 +88,7 @@ } } globfree( &gg ); - return 1; + return True; } static void prButton( GtkButton * button,gpointer user_data ) diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/main.c --- a/gui/ui/main.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/main.c Tue Dec 04 18:36:14 2012 +0000 @@ -65,14 +65,14 @@ unsigned int GetTimerMS( void ); unsigned char * mainDrawBuffer = NULL; -int uiMainRender = 1; +int uiMainRender = True; -int uiMainAutoPlay = 0; +int uiMainAutoPlay = False; int uiMiddleMenu = 0; -int mainVisible = 1; +int mainVisible = True; -int boxMoved = 0; +int boxMoved = False; int sx = 0,sy = 0; int i,pot = 0; @@ -94,7 +94,7 @@ fast_memcpy( mainDrawBuffer,guiApp.main.Bitmap.Image,guiApp.main.Bitmap.ImageSize ); RenderAll( &guiApp.mainWindow,guiApp.mainItems,guiApp.IndexOfMainItems,mainDrawBuffer ); - uiMainRender=0; + uiMainRender=False; } wsPutImage( &guiApp.mainWindow ); // XFlush( wsDisplay ); @@ -254,7 +254,7 @@ break; case evLoadPlay: - uiMainAutoPlay=1; + uiMainAutoPlay=True; // guiInfo.StreamType=STREAMTYPE_FILE; case evLoad: gtkShow( evLoad,NULL ); @@ -402,7 +402,7 @@ break; last_redraw_time = now; } - uiMainRender=1; + uiMainRender=True; wsPostRedisplay( &guiApp.mainWindow ); wsPostRedisplay( &guiApp.playbarWindow ); break; @@ -444,10 +444,10 @@ case wsPLMouseButton: gtkShow( ivHidePopUpMenu,NULL ); - sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; + sx=X; sy=Y; boxMoved=True; itemtype=itPLMButton; SelectedItem=currentselected; if ( SelectedItem == -1 ) break; - boxMoved=0; + boxMoved=False; item=&guiApp.mainItems[SelectedItem]; itemtype=item->type; item->pressed=btnPressed; @@ -462,7 +462,7 @@ } break; case wsRLMouseButton: - boxMoved=0; + boxMoved=False; if ( SelectedItem != -1 ) // NOTE TO MYSELF: only if itButton, itHPotmeter or itVPotmeter { item=&guiApp.mainItems[SelectedItem]; @@ -516,7 +516,7 @@ { case itPLMButton: wsMoveWindow( &guiApp.mainWindow,True,RX - abs( sx ),RY - abs( sy ) ); - uiMainRender=0; + uiMainRender=False; break; case itPRMButton: uiMenuMouseHandle( RX,RY ); diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/menu.c --- a/gui/ui/menu.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/menu.c Tue Dec 04 18:36:14 2012 +0000 @@ -26,16 +26,17 @@ #include "help_mp.h" #include "mp_msg.h" #include "gui/app.h" +#include "gui/gui.h" #include "gmplayer.h" #include "widgets.h" unsigned char * menuDrawBuffer = NULL; -int menuRender = 1; +int menuRender = True; int menuItem = -1; int oldMenuItem = -1; int menuX,menuY; -static int menuIsInitialized = 0; +static int menuIsInitialized = False; static void uiMenuDraw( void ) { @@ -64,7 +65,7 @@ oldMenuItem=menuItem; /* --- */ wsConvert( &guiApp.menuWindow,menuDrawBuffer ); - menuRender=0; + menuRender=False; } wsPutImage( &guiApp.menuWindow ); } @@ -111,7 +112,7 @@ wsMoveWindow( &guiApp.menuWindow,True,x,y ); wsRaiseWindowTop( wsDisplay,guiApp.menuWindow.WindowID ); wsSetLayer( wsDisplay,guiApp.menuWindow.WindowID,1 ); - menuRender=1; + menuRender=True; wsVisibleWindow( &guiApp.menuWindow,wsShowWindow ); wsPostRedisplay( &guiApp.menuWindow ); } @@ -165,9 +166,9 @@ mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu] menuWindow ID: 0x%x\n",(int)guiApp.menuWindow.WindowID ); - menuIsInitialized=1; + menuIsInitialized=True; guiApp.menuWindow.ReDraw=uiMenuDraw; // guiApp.menuWindow.MouseHandler=uiMenuMouseHandle; // guiApp.menuWindow.KeyHandler=uiMainKeyHandle; - menuRender=1; wsPostRedisplay( &guiApp.menuWindow ); + menuRender=True; wsPostRedisplay( &guiApp.menuWindow ); } diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/playbar.c --- a/gui/ui/playbar.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/playbar.c Tue Dec 04 18:36:14 2012 +0000 @@ -25,6 +25,7 @@ #include #include "gui/app.h" +#include "gui/gui.h" #include "gui/interface.h" #include "gui/skin/font.h" #include "gui/skin/skin.h" @@ -53,7 +54,7 @@ unsigned int GetTimer( void ); unsigned char * playbarDrawBuffer = NULL; -int playbarVisible = 0; +int playbarVisible = False; int playbarLength = 0; int uiPlaybarFade = 0; @@ -80,7 +81,7 @@ { playbarLength=guiApp.videoWindow.Height - guiApp.playbar.height; uiPlaybarFade=0; - vo_mouse_autohide=0; + vo_mouse_autohide=False; } wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength ); break; @@ -89,8 +90,9 @@ if ( playbarLength > guiApp.videoWindow.Height ) { playbarLength=guiApp.videoWindow.Height; - uiPlaybarFade=playbarVisible=0; - vo_mouse_autohide=1; + uiPlaybarFade=0; + playbarVisible=False; + vo_mouse_autohide=True; wsVisibleWindow( &guiApp.playbarWindow,wsHideWindow ); return; } @@ -104,7 +106,7 @@ btnModify( evSetMoviePosition,guiInfo.Position ); btnModify( evSetVolume,guiInfo.Volume ); - vo_mouse_autohide=0; + vo_mouse_autohide=False; fast_memcpy( playbarDrawBuffer,guiApp.playbar.Bitmap.Image,guiApp.playbar.Bitmap.ImageSize ); RenderAll( &guiApp.playbarWindow,guiApp.playbarItems,guiApp.IndexOfPlaybarItems,playbarDrawBuffer ); @@ -237,7 +239,7 @@ if ( y > guiApp.videoWindow.Height - guiApp.playbar.height ) { if ( !uiPlaybarFade ) wsVisibleWindow( &guiApp.playbarWindow,wsShowWindow ); - uiPlaybarFade=1; playbarVisible=1; wsPostRedisplay( &guiApp.playbarWindow ); + uiPlaybarFade=1; playbarVisible=True; wsPostRedisplay( &guiApp.playbarWindow ); } else if ( !uiPlaybarFade ) uiPlaybarFade=2; } diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/video.c --- a/gui/ui/video.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/video.c Tue Dec 04 18:36:14 2012 +0000 @@ -26,10 +26,11 @@ #include "gmplayer.h" #include "gui/app.h" +#include "gui/gui.h" #include "gui/interface.h" #include "widgets.h" -int uiVideoRender = 0; +int uiVideoRender = False; int videoVisible = 0; void uiVideoDraw( void ) @@ -42,7 +43,7 @@ if ( !guiApp.videoWindow.Mapped || guiApp.videoWindow.Visible == wsWindowNotVisible ) return; - if ( guiInfo.Playing ) uiVideoRender=0; + if ( guiInfo.Playing ) uiVideoRender=False; if ( uiVideoRender && guiApp.videoWindow.State == wsWindowExpose ) { diff -r 5cbbd9ca4010 -r 411875efca3f gui/ui/widgets.c --- a/gui/ui/widgets.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/ui/widgets.c Tue Dec 04 18:36:14 2012 +0000 @@ -41,6 +41,7 @@ #include "widgets.h" #include "gui/app.h" +#include "gui/gui.h" #include "gui/interface.h" #include "gui/wm/ws.h" @@ -54,7 +55,7 @@ int gtkPopupMenu = 0; int gtkPopupMenuParam = 0; -int gtkInitialized = 0; +int gtkInitialized = False; #include "gtk/skinbrowser.h" #include "gtk/playlist.h" @@ -151,7 +152,7 @@ gtkLoadIcon(theme, 48, &gdkIcon, &gdkIconMask); - gtkInitialized = 1; + gtkInitialized = True; } void gtkAddIcon(GtkWidget *window) diff -r 5cbbd9ca4010 -r 411875efca3f gui/util/bitmap.c --- a/gui/util/bitmap.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/util/bitmap.c Tue Dec 04 18:36:14 2012 +0000 @@ -27,6 +27,7 @@ #include #include "bitmap.h" +#include "gui/gui.h" #include "help_mp.h" #include "libavcodec/avcodec.h" @@ -143,7 +144,7 @@ if (img->Image) memcpy_pic(img->Image, frame->data[0], bpl, img->Height, bpl, frame->linesize[0]); else - decode_ok = 0; + decode_ok = False; } avcodec_close(avctx); @@ -159,7 +160,7 @@ * * @param img image to be converted * - * @return 1 (ok) or 0 (error) + * @return #True (ok) or #False (error) * * @note This is an in-place conversion, * new memory will be allocated for @a img if necessary. @@ -179,7 +180,7 @@ if (!img->Image) { free(orgImage); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", img->ImageSize); - return 0; + return False; } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] 32 bpp conversion size: %lu\n", img->ImageSize); @@ -194,9 +195,9 @@ for (i = 0; i < img->ImageSize; i += 4) *(uint32_t *)&img->Image[i] = (img->Image[i + 3] << 24) | AV_RB24(&img->Image[i]); } else - return 0; + return False; - return 1; + return True; } /** @@ -278,7 +279,7 @@ * @param in image to render a bitmap mask from * @param out bitmap mask * - * @return 1 (ok) or 0 (error) + * @return #True (ok) or #False (error) * * @note As a side effect, transparent pixels of @a in will be rendered black. */ @@ -298,7 +299,7 @@ if (!out->Image) { mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", out->ImageSize); - return 0; + return False; } buf = (uint32_t *)in->Image; @@ -334,5 +335,5 @@ mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] 1 bpp conversion size: %lu\n", out->ImageSize); - return 1; + return True; } diff -r 5cbbd9ca4010 -r 411875efca3f gui/util/list.c --- a/gui/util/list.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/util/list.c Tue Dec 04 18:36:14 2012 +0000 @@ -25,6 +25,7 @@ #include #include "list.h" +#include "gui/gui.h" #include "string.h" #include "mp_msg.h" @@ -329,7 +330,7 @@ * @param what file to be added * @param how command (#PLAYLIST_ITEM_APPEND or #PLAYLIST_ITEM_INSERT) to be performed * - * @return 1 (ok) or 0 (error) + * @return #True (ok) or #False (error) */ int add_to_gui_playlist(const char *what, int how) { @@ -338,7 +339,7 @@ plItem *item; if (!what || !*what || (how != PLAYLIST_ITEM_APPEND && how != PLAYLIST_ITEM_INSERT)) - return 0; + return False; file = mp_basename(what); path = strdup(what); @@ -351,7 +352,7 @@ item = calloc(1, sizeof(plItem)); if (!item) - return 0; + return False; mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[list] adding %s/%s\n", path, file); @@ -360,5 +361,5 @@ listMgr(how, item); - return 1; + return True; } diff -r 5cbbd9ca4010 -r 411875efca3f gui/util/string.c --- a/gui/util/string.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/util/string.c Tue Dec 04 18:36:14 2012 +0000 @@ -25,6 +25,7 @@ #include #include "string.h" +#include "gui/gui.h" #include "gui/interface.h" #include "config.h" @@ -93,7 +94,7 @@ char *trim(char *in) { char *src, *dest; - int freeze = 0; + int freeze = False; src = dest = in; @@ -128,7 +129,7 @@ char *decomment(char *in) { char *p; - int nap = 0; + int nap = False; p = in; diff -r 5cbbd9ca4010 -r 411875efca3f gui/wm/ws.c --- a/gui/wm/ws.c Tue Dec 04 16:08:18 2012 +0000 +++ b/gui/wm/ws.c Tue Dec 04 18:36:14 2012 +0000 @@ -107,8 +107,8 @@ unsigned long wsKeyTable[512]; -int wsUseXShm = 1; -int wsUseXShape = 1; +int wsUseXShm = True; +int wsUseXShape = True; static int wsSearch(Window win) { @@ -259,7 +259,7 @@ if (dispname && *dispname != ':') { localdisp = 0; - wsUseXShm = 0; + wsUseXShm = False; } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] display name: %s => %s display.\n", dispname, localdisp ? "local" : "REMOTE"); @@ -271,7 +271,7 @@ #ifdef HAVE_SHM if (!XShmQueryExtension(wsDisplay)) #endif - wsUseXShm = 0; + wsUseXShm = False; if (!wsUseXShm) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_WS_NoXshm); @@ -279,7 +279,7 @@ #ifdef CONFIG_XSHAPE if (!XShapeQueryExtension(wsDisplay, &eventbase, &errorbase)) #endif - wsUseXShape = 0; + wsUseXShape = False; if (!wsUseXShape) mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_WS_NoXshape); @@ -439,7 +439,7 @@ win->Property = D; if (D & wsShowFrame) - win->Decorations = 1; + win->Decorations = True; wsHGC = DefaultGC(wsDisplay, wsScreen); @@ -788,26 +788,26 @@ case KeyRelease: i = wsKeyReleased; keypressed: - wsWindowList[l]->Alt = 0; - wsWindowList[l]->Shift = 0; - wsWindowList[l]->NumLock = 0; - wsWindowList[l]->Control = 0; - wsWindowList[l]->CapsLock = 0; + wsWindowList[l]->Alt = False; + wsWindowList[l]->Shift = False; + wsWindowList[l]->NumLock = False; + wsWindowList[l]->Control = False; + wsWindowList[l]->CapsLock = False; if (Event->xkey.state & Mod1Mask) - wsWindowList[l]->Alt = 1; + wsWindowList[l]->Alt = True; if (Event->xkey.state & Mod2Mask) - wsWindowList[l]->NumLock = 1; + wsWindowList[l]->NumLock = True; if (Event->xkey.state & ControlMask) - wsWindowList[l]->Control = 1; + wsWindowList[l]->Control = True; if (Event->xkey.state & ShiftMask) - wsWindowList[l]->Shift = 1; + wsWindowList[l]->Shift = True; if (Event->xkey.state & LockMask) - wsWindowList[l]->CapsLock = 1; + wsWindowList[l]->CapsLock = True; #if 0 { @@ -1436,7 +1436,7 @@ } win->xImage->data = win->Shminfo.shmaddr; - win->Shminfo.readOnly = 0; + win->Shminfo.readOnly = False; XShmAttach(wsDisplay, &win->Shminfo); XSync(wsDisplay, False); shmctl(win->Shminfo.shmid, IPC_RMID, 0);