changeset 1866:32b1bb50a0e8

some bug fix, and add decoration item to skin conffile. faszom(C)
author pontscho
date Fri, 07 Sep 2001 21:04:14 +0000
parents 538b993b3518
children 10b7d524e39b
files Gui/Makefile Gui/app.c Gui/app.h Gui/config.c Gui/config.h Gui/events.c Gui/events.h Gui/gui.mak Gui/mplayer/Makefile Gui/mplayer/mplayer.c Gui/mplayer/play.c Gui/mplayer/psignal.c Gui/skin/skin.c cfg-mplayer.h
diffstat 14 files changed, 136 insertions(+), 149 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/Makefile	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/Makefile	Fri Sep 07 21:04:14 2001 +0000
@@ -45,7 +45,7 @@
 
 depend: .depend
 
-.depend: Makefile config.mak config.h gui.mak bitmap/bitmap.mak
+.depend: Makefile config.mak gui.mak bitmap/bitmap.mak
 	$(MAKE) -C mplayer depend
 	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
 
--- a/Gui/app.c	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/app.c	Fri Sep 07 21:04:14 2001 +0000
@@ -5,20 +5,16 @@
 
 #include "app.h"
 #include "../config.h"
-#include "config.h"
 #include "error.h"
 #include "wm/wskeys.h"
 #include "skin/skin.h"
 #include "mplayer/mplayer.h"
 
 listItems   appMPlayer;
-listItems   appTV;
-listItems   appRadio;
 
-//char      * appMPlayerDirInHome=NULL;
-//char      * appMPlayerDir=NULL;
 char      * skinDirInHome=NULL;
 char      * skinMPlayerDir=NULL;
+char      * skinName = NULL;
 
 void appClearItem( wItem * item )
 {
@@ -71,6 +67,7 @@
  memset( item->MenuItems,0,32 * sizeof( wItem ) );
 
  appClearItem( &item->main );
+ item->mainDecoration=0;
  appClearItem( &item->sub );
  item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384;
  item->sub.width=384; item->sub.height=384;
@@ -104,12 +101,13 @@
  skinMPlayerDir=DATADIR "/Skin";
  printf("SKIN dir 1: '%s'\n",skinDirInHome);
  printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
-
+ if ( !skinName )
+  {
+   if ( ( skinName=(char *)calloc( 1,7 ) ) == NULL ) { dbprintf( 0,"[config] Not enough memory.\n" ); exit( 1 ); }
+   strcpy( skinName,"default" );
+  }
  initDebug(NULL); // write messages to stderr
-
- cfgDefaults(); // set skin to "default"
- cfgRead();     // empty function - NOP
- switch ( skinRead( cfgSkin ) )
+ switch ( skinRead( skinName ) )
   {
    case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 );
    case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 );
--- a/Gui/app.h	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/app.h	Fri Sep 07 21:04:14 2001 +0000
@@ -50,6 +50,7 @@
 {
  wItem           main;
  wsTWindow       mainWindow;
+ int		 mainDecoration;
 
  wItem           sub;
  wsTWindow       subWindow;
@@ -72,13 +73,10 @@
 } listItems;
 
 extern listItems   appMPlayer;
-extern listItems   appTV;
-extern listItems   appRadio;
 
-//extern char      * appMPlayerDirInHome;
-//extern char      * appMPlayerDir;
 extern char      * skinDirInHome;
 extern char      * skinMPlayerDir;
+extern char      * skinName;
 
 extern void appInit( int argc,char* argv[], char *envp[], void* disp );
 extern void appInitStruct( listItems * item );
--- a/Gui/config.c	Fri Sep 07 20:43:37 2001 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-
-unsigned char * cfgAppName = "movieplayer";
-unsigned char * cfgSkin = NULL;
-
-void cfgDefaults( void )
-{
- if ( ( cfgSkin=(char *)calloc( 1,256 ) ) == NULL )
-  {
-   fprintf( stderr,"[config] Not enough memory.\n" );
-   exit( 1 );
-  }
- strcpy( cfgSkin,"default" );
-// strcpy( cfgSkin,"blueHeart" );
-}
-
-int cfgRead( void )
-{
- return 0;
-}
--- a/Gui/config.h	Fri Sep 07 20:43:37 2001 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-#ifndef __MYCONFIG
-#define __MYCONFIG
-
-extern unsigned char * cfgAppName;
-extern unsigned char * cfgSkin;
-
-extern int cfgRead( void );
-extern void cfgDefaults( void );
-
-#endif
\ No newline at end of file
--- a/Gui/events.c	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/events.c	Fri Sep 07 21:04:14 2001 +0000
@@ -3,44 +3,44 @@
 
 evName evNames[] =
  {
-  { evNone,              "evNone"              }, // 1
-  { evPlay,              "evPlay"              }, // 2
-  { evStop,              "evStop"              }, // 3
-  { evPause,             "evPause"             }, // 4
-  { evPrev,              "evPrev"              }, // 7
-  { evNext,              "evNext"              }, // 8
-  { evLoad,              "evLoad"              }, // 9
-  { evEqualeaser,        "evEqualeaser"        }, // 10
-  { evPlayList,          "evPlaylist"          }, // 11
-  { evExit,              "evExit"              }, // 12
-  { evPlusVideo,         "evPlusVideo"         }, // 13
-  { evMinusVideo,        "evMinusVideo"        }, // 14
-  { evIconify,           "evIconify"           }, // 15
-  { evPlusBalance,       "evPlusBalance"       }, // 16
-  { evMinusBalance,      "evMinusBalance"      }, // 17
-  { evFullScreen,        "evFullScreen"        }, // 18
-  { evFName,             "evFName"             }, // 19
-  { evMovieTime,         "evMovieTime"         }, // 20
-  { evAbout,             "evAbout"             }, // 22
-  { evLoadPlay,          "evLoadPlay"          }, // 23
-  { evPreferences,       "evPreferences"       }, // 24
-  { evSkinBrowser,       "evSkinBrowser"       }, // 25
-  { evBackward10sec,     "evBackward10sec"     }, // 26
-  { evForward10sec,      "evForward10sec"      }, // 27
-  { evBackward1min,      "evBackward1min"      }, // 28
-  { evForward1min,       "evForward1min"       }, // 29
-  { evIncVolume,         "evIncVolume"         }, // 30
-  { evDecVolume,         "evDecVolume"         }, // 31
-  { evMute,              "evMute"              }, // 32
-  { evIncAudioBufDelay,  "evIncAudioBufDelay"  }, // 33
-  { evDecAudioBufDelay,  "evDecAudioBufDelay"  }, // 34
-  { evPlaySwitchToPause, "evPlaySwitchToPause" }, // 35
-  { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, // 36
-  { evNormalSize,        "evNormalSize"        }, // 37
-  { evDoubleSize,        "evDoubleSize"        }, // 38
-  { evSetMoviePosition,  "evSetMoviePosition"  }, // 39
-  { evSetVolume,         "evSetVolume"         }, // 40
-  { evSetBalance,        "evSetBalance"        }, // 41
+  { evNone,              "evNone"              },
+  { evPlay,              "evPlay"              },
+  { evStop,              "evStop"              },
+  { evPause,             "evPause"             },
+  { evPrev,              "evPrev"              },
+  { evNext,              "evNext"              },
+  { evLoad,              "evLoad"              },
+  { evEqualeaser,        "evEqualeaser"        },
+  { evPlayList,          "evPlaylist"          },
+  { evExit,              "evExit"              },
+  { evIconify,           "evIconify"           },
+  { evIncBalance,        "evIncBalance"        },
+  { evDecBalance,        "evDecBalance"        },
+  { evFullScreen,        "evFullScreen"        },
+  { evFName,             "evFName"             },
+  { evMovieTime,         "evMovieTime"         },
+  { evAbout,             "evAbout"             },
+  { evLoadPlay,          "evLoadPlay"          },
+  { evPreferences,       "evPreferences"       },
+  { evSkinBrowser,       "evSkinBrowser"       },
+  { evBackward10sec,     "evBackward10sec"     },
+  { evForward10sec,      "evForward10sec"      },
+  { evBackward1min,      "evBackward1min"      },
+  { evForward1min,       "evForward1min"       },
+  { evBackward10min,     "evBackward10min"     },
+  { evForward10min,      "evForward10min"      },
+  { evIncVolume,         "evIncVolume"         },
+  { evDecVolume,         "evDecVolume"         },
+  { evMute,              "evMute"              },
+  { evIncAudioBufDelay,  "evIncAudioBufDelay"  },
+  { evDecAudioBufDelay,  "evDecAudioBufDelay"  },
+  { evPlaySwitchToPause, "evPlaySwitchToPause" },
+  { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
+  { evNormalSize,        "evNormalSize"        },
+  { evDoubleSize,        "evDoubleSize"        },
+  { evSetMoviePosition,  "evSetMoviePosition"  },
+  { evSetVolume,         "evSetVolume"         },
+  { evSetBalance,        "evSetBalance"        },
   { evHelp,		 "evHelp"	       }	
  };
 
--- a/Gui/events.h	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/events.h	Fri Sep 07 21:04:14 2001 +0000
@@ -13,35 +13,38 @@
 #define evLoad              8
 #define evEqualeaser        9
 #define evPlayList          10
-#define evPlusVideo         11
-#define evMinusVideo        12
-#define evIconify           13
-#define evPlusBalance       14
-#define evMinusBalance      15
-#define evFullScreen        16
-#define evAbout             18
-#define evLoadPlay          19
-#define evPreferences       20
-#define evSkinBrowser       21
-#define evBackward10sec     22
-#define evForward10sec      23
-#define evBackward1min      24
-#define evForward1min       25
-#define evIncVolume         26
-#define evDecVolume         27
-#define evMute              28
-#define evIncAudioBufDelay  29
-#define evDecAudioBufDelay  30
-#define evPlaySwitchToPause 31
-#define evPauseSwitchToPlay 32
-#define evNormalSize        33
-#define evDoubleSize        34
+#define evIconify           11
+#define evAbout             12
+#define evLoadPlay          13
+#define evPreferences       14
+#define evSkinBrowser       15
+#define evPlaySwitchToPause 16
+#define evPauseSwitchToPlay 17
+
+#define evBackward10sec     18
+#define evForward10sec      19
+#define evBackward1min      20
+#define evForward1min       21
+#define evBackward10min     22
+#define evForward10min      23
 
-#define evSetMoviePosition  35
-#define evSetVolume         36
-#define evSetBalance        37
+#define evNormalSize        24
+#define evDoubleSize        25
+#define evFullScreen        26
+
+#define evSetMoviePosition  27
+#define evSetVolume         28
+#define evSetBalance        29
+#define evMute              30
 
-#define evHelp              38
+#define evIncVolume         31
+#define evDecVolume         32
+#define evIncAudioBufDelay  33
+#define evDecAudioBufDelay  34
+#define evIncBalance        35
+#define evDecBalance        36
+
+#define evHelp              37
 
 #define evExit              1000
 
--- a/Gui/gui.mak	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/gui.mak	Fri Sep 07 21:04:14 2001 +0000
@@ -6,6 +6,6 @@
 	     $(MPLAYERDIR)psignal.c
 MPLAYEROBJS = $(MPLAYERSRCS:.c=.o)
 
-SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c config.c events.c timer.c language.c error.c
+SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c events.c timer.c language.c error.c
 OBJS = $(SRCS:.c=.o)
 
--- a/Gui/mplayer/Makefile	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/mplayer/Makefile	Fri Sep 07 21:04:14 2001 +0000
@@ -34,7 +34,7 @@
 
 depend: .depend
 
-.depend: Makefile ../config.mak ../config.h ../gui.mak ../bitmap/bitmap.mak
+.depend: Makefile ../config.mak ../gui.mak ../bitmap/bitmap.mak
 	$(CC) -MM $(CFLAGS) $(MPLAYERSRCS) 1>.depend
 
 #
--- a/Gui/mplayer/mplayer.c	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/mplayer/mplayer.c	Fri Sep 07 21:04:14 2001 +0000
@@ -15,7 +15,6 @@
 #include "../timer.h"
 #include "../language.h"
 #include "../error.h"
-#include "../config.h"
 
 #include "../../config.h"
 #include "../../libvo/x11_common.h"
@@ -52,10 +51,11 @@
 
 void mplInit( int argc,char* argv[], char *envp[], void* disp )
 {
+ int i;
  // allocates shmem to gtkShMem
  // fork() a process which runs gtkThreadProc()  [gtkPID]
  gtkInit( argc,argv,envp );
- strcpy( gtkShMem->sb.name,cfgSkin ); 
+ strcpy( gtkShMem->sb.name,skinName ); 
 
  // allocates shmem to mplShMem
  // init fields of this struct to default values
@@ -79,9 +79,11 @@
  vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC);
  vo_setwindowsize( appMPlayer.sub.width,appMPlayer.sub.height );
  
+ i=wsHideFrame|wsMaxSize|wsShowWindow;
+ if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsShowWindow;
  wsCreateWindow( &appMPlayer.mainWindow,
   appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
-  wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsShowWindow,"MPlayer" ); //wsMinSize|
+  wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
 
  wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
 
--- a/Gui/mplayer/play.c	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/mplayer/play.c	Fri Sep 07 21:04:14 2001 +0000
@@ -24,7 +24,6 @@
 #include "play.h"
 
 #include "../skin/skin.h"
-#include "../config.h"
 #include "../error.h"
 #include "../language.h"
 
@@ -127,7 +126,7 @@
 
 void ChangeSkin( void )
 {
- if ( strcmp( cfgSkin,gtkShMem->sb.name ) )
+ if ( strcmp( skinName,gtkShMem->sb.name ) )
   {
    int ret;
 #ifdef DEBUG
@@ -145,8 +144,8 @@
    appInitStruct( &tmpList );
    skinAppMPlayer=&appMPlayer;
    appInitStruct( &appMPlayer );
-   if ( !ret ) strcpy( cfgSkin,gtkShMem->sb.name );
-   skinRead( cfgSkin );
+   if ( !ret ) strcpy( skinName,gtkShMem->sb.name );
+   skinRead( skinName );
 
    if ( ret )
     {
@@ -154,24 +153,6 @@
      return;
     }
 
-//          appCopy( &appMPlayer,&tmpList );
-//          appInitStruct( &tmpList );
-//          skinAppMPlayer=&appMPlayer;
-//          strcpy( cfgSkin,gtkShMem->sb.name );
-
-   if ( mplDrawBuffer ) free( mplDrawBuffer );
-   if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
-    { message( False,langNEMDB ); return; }
-   wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
-   wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y );
-   wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
-   wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
-   mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
-   
-   btnModify( evSetVolume,mplShMem->Volume );
-   btnModify( evSetBalance,mplShMem->Balance );
-   btnModify( evSetMoviePosition,mplShMem->Position );
-
    if ( appMPlayer.menuBase.Bitmap.Image )
     {
      if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
@@ -186,7 +167,6 @@
    if ( !mplShMem->Playing )
     {
      mplSkinChanged=0;
-//     if ( appMPlayer.subWindow.isFullScreen ) wsFullScreen( &appMPlayer.subWindow );
      if ( !appMPlayer.subWindow.isFullScreen ) 
       {
        wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
@@ -196,6 +176,22 @@
      wsClearWindow( appMPlayer.subWindow );
      mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow );
     }
+
+   if ( mplDrawBuffer ) free( mplDrawBuffer );
+   if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
+    { message( False,langNEMDB ); return; }
+   wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
+   wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
+   wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y );
+   wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
+   wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
+   mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
+   wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
+   wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
+   
+   btnModify( evSetVolume,mplShMem->Volume );
+   btnModify( evSetBalance,mplShMem->Balance );
+   btnModify( evSetMoviePosition,mplShMem->Position );
   }
  mplShMem->SkinChange=0; 
 }
--- a/Gui/mplayer/psignal.c	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/mplayer/psignal.c	Fri Sep 07 21:04:14 2001 +0000
@@ -12,12 +12,10 @@
 
 #include "../skin/skin.h"
 #include "../wm/ws.h"
-#include "../config.h"
 #include "../error.h"
 #include "../language.h"
 
 #include "../../config.h"
-
 #include "../../libvo/x11_common.h"
 //#include "../../libvo/sub.h"
 
@@ -69,7 +67,7 @@
         if ( !gtkFillSkinList( sbMPlayerPrefixDir ) ) break;
         if ( gtkFillSkinList( sbMPlayerDirInHome ) )
          {
-          gtkSetDefaultToCList( SkinList,cfgSkin );
+          gtkSetDefaultToCList( SkinList,skinName );
           gtk_widget_show( SkinBrowser );
           gtkVisibleSkinBrowser=1;
           gtkShow( evSkinBrowser );
--- a/Gui/skin/skin.c	Fri Sep 07 20:43:37 2001 +0000
+++ b/Gui/skin/skin.c	Fri Sep 07 21:04:14 2001 +0000
@@ -10,12 +10,7 @@
 #include "../language.h"
 #include "../../config.h"
 
-//char            SkinDir[] = "/.mplayer/Skin/";
-//char          * Skin;
-
 listItems     * skinAppMPlayer = &appMPlayer;
-//listItems     * skinAppTV      = &appTV;
-//listItems     * skinAppRadio   = &appRadio;
 
 int             linenumber;
 
@@ -549,6 +544,27 @@
  return 0;
 }
 
+int __decoration( char * in )
+{
+ char    tmp[512];
+
+ CHECKDEFLIST( "decoration" );
+ CHECKWINLIST( "decoration" );
+
+ #ifdef DEBUG
+  dbprintf( 0,"\n[skin] window decoration is %s\n",in );
+ #endif
+ cutItem( in,tmp,',',0 );
+ if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( "unknown parameter.\n" ); return 1; }
+ if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0;
+  else defList->mainDecoration=1;
+
+ #ifdef DEBUG
+  dbprintf( 3,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
+ #endif
+ return 0;
+}
+
 typedef struct
 {
  char * name;
@@ -569,6 +585,7 @@
   { "font",        __font        },
   { "slabel",      __slabel      },
   { "dlabel",      __dlabel      },
+  { "decoration",  __decoration  },
   { "menu",        __menu        }
  };
 
--- a/cfg-mplayer.h	Fri Sep 07 20:43:37 2001 +0000
+++ b/cfg-mplayer.h	Fri Sep 07 21:04:14 2001 +0000
@@ -60,6 +60,10 @@
 extern int dvd_angle;
 #endif
 
+#ifdef HAVE_NEW_GUI
+extern char * skinName;
+#endif
+
 /*
  * CONF_TYPE_FUNC_FULL :
  * allows own implemtations for passing the params
@@ -236,6 +240,10 @@
 	{"noidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 0},
 	{"idx", &index_mode, CONF_TYPE_FLAG, 0, -1, 1},
 	{"forceidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 2},
+	
+#ifdef HAVE_NEW_GUI
+	{"skin", &skinName, CONF_TYPE_STRING, 0, 0, 0},
+#endif
         
 	{"quiet", &quiet, CONF_TYPE_FLAG, 0, 0, 1},
 	{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE, 0, 100},