changeset 35525:e27855a45128

Rebuild GUI directory structure. Create new directory app/ and move app.*, cfg.* and gui.h to app/.
author ib
date Thu, 06 Dec 2012 13:47:47 +0000
parents dd7de6052739
children 3c901704a27c
files Makefile gui/app.c gui/app.h gui/app/app.c gui/app/app.h gui/app/cfg.c gui/app/cfg.h gui/app/gui.h gui/cfg.c gui/cfg.h gui/gui.h gui/interface.c gui/interface.h gui/skin/font.h gui/skin/skin.c gui/ui/actions.c gui/ui/gtk/about.c gui/ui/gtk/equalizer.c gui/ui/gtk/fileselect.c gui/ui/gtk/menu.c gui/ui/gtk/msgbox.c gui/ui/gtk/playlist.c gui/ui/gtk/preferences.c gui/ui/gtk/skinbrowser.c gui/ui/gtk/url.c gui/ui/main.c gui/ui/menu.c gui/ui/playbar.c gui/ui/render.h gui/ui/video.c gui/ui/widgets.c gui/util/bitmap.c gui/util/list.c gui/util/string.c
diffstat 34 files changed, 1060 insertions(+), 1059 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Dec 06 02:30:19 2012 +0000
+++ b/Makefile	Thu Dec 06 13:47:47 2012 +0000
@@ -497,8 +497,8 @@
 SRCS_MPLAYER-$(GUI)          += gui/util/bitmap.c \
                                 gui/util/list.c \
                                 gui/util/string.c
-SRCS_MPLAYER-$(GUI_GTK)      += gui/app.c \
-                                gui/cfg.c \
+SRCS_MPLAYER-$(GUI_GTK)      += gui/app/app.c \
+                                gui/app/cfg.c \
                                 gui/interface.c \
                                 gui/skin/font.c \
                                 gui/skin/skin.c \
@@ -689,6 +689,7 @@
 
 DIRS =  . \
         gui \
+        gui/app \
         gui/skin \
         gui/ui \
         gui/ui/gtk \
--- a/gui/app.c	Thu Dec 06 02:30:19 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- * @file
- * @brief GUI application helpers
- */
-
-#include "app.h"
-#include "gui.h"
-#include "skin/font.h"
-
-#include "libavutil/common.h"
-
-/**
- * @brief Initialize item counters.
- */
-guiItems guiApp = {
-    .IndexOfMainItems    = -1,
-    .IndexOfPlaybarItems = -1,
-    .IndexOfMenuItems    = -1
-};
-
-/**
- * @brief Event messages belonging to event names.
- */
-static const evName evNames[] = {
-    { evNone,              "evNone"              },
-    { evPlay,              "evPlay"              },
-    { evStop,              "evStop"              },
-    { evPause,             "evPause"             },
-    { evPrev,              "evPrev"              },
-    { evNext,              "evNext"              },
-    { evLoad,              "evLoad"              },
-    { evLoadPlay,          "evLoadPlay"          },
-    { evLoadAudioFile,     "evLoadAudioFile"     },
-    { evLoadSubtitle,      "evLoadSubtitle"      },
-    { evDropSubtitle,      "evDropSubtitle"      },
-    { evPlaylist,          "evPlaylist"          },
-    { evPlayCD,            "evPlayCD"            },
-    { evPlayVCD,           "evPlayVCD"           },
-    { evPlayDVD,           "evPlayDVD"           },
-    { evLoadURL,           "evSetURL"            }, // legacy
-    { evLoadURL,           "evLoadURL"           },
-    { evPlaySwitchToPause, "evPlaySwitchToPause" },
-    { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
-    { evBackward10sec,     "evBackward10sec"     },
-    { evForward10sec,      "evForward10sec"      },
-    { evBackward1min,      "evBackward1min"      },
-    { evForward1min,       "evForward1min"       },
-    { evBackward10min,     "evBackward10min"     },
-    { evForward10min,      "evForward10min"      },
-    { evSetMoviePosition,  "evSetMoviePosition"  },
-    { evHalfSize,          "evHalfSize"          },
-    { evDoubleSize,        "evDoubleSize"        },
-    { evFullScreen,        "evFullScreen"        },
-    { evNormalSize,        "evNormalSize"        },
-    { evSetAspect,         "evSetAspect"         },
-    { evIncVolume,         "evIncVolume"         },
-    { evDecVolume,         "evDecVolume"         },
-    { evSetVolume,         "evSetVolume"         },
-    { evMute,              "evMute"              },
-    { evSetBalance,        "evSetBalance"        },
-    { evEqualizer,         "evEqualizer"         },
-    { evAbout,             "evAbout"             },
-    { evPreferences,       "evPreferences"       },
-    { evSkinBrowser,       "evSkinBrowser"       },
-    { evMenu,              "evMenu"              },
-    { evIconify,           "evIconify"           },
-    { evExit,              "evExit"              }
-};
-
-/**
- * @brief Free all memory allocated to an item and set all its pointers to NULL.
- *
- * @param item item to be freed
- */
-static void appClearItem(wItem *item)
-{
-    bpFree(&item->Bitmap);
-    bpFree(&item->Mask);
-    free(item->label);
-    free(item->text);
-    memset(item, 0, sizeof(*item));
-}
-
-/**
- * @brief Free all memory allocated to all GUI items and reset all item counters.
- */
-void appFreeStruct(void)
-{
-    int i;
-
-    appClearItem(&guiApp.main);
-    guiApp.mainDecoration = False;
-
-    appClearItem(&guiApp.video);
-
-    appClearItem(&guiApp.playbar);
-    guiApp.playbarIsPresent = False;
-
-    appClearItem(&guiApp.menu);
-    appClearItem(&guiApp.menuSelected);
-    guiApp.menuIsPresent = False;
-
-    for (i = 0; i <= guiApp.IndexOfMainItems; i++)
-        appClearItem(&guiApp.mainItems[i]);
-    for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
-        appClearItem(&guiApp.playbarItems[i]);
-    for (i = 0; i <= guiApp.IndexOfMenuItems; i++)
-        appClearItem(&guiApp.menuItems[i]);
-
-    guiApp.IndexOfMainItems    = -1;
-    guiApp.IndexOfPlaybarItems = -1;
-    guiApp.IndexOfMenuItems    = -1;
-
-    fntFreeFont();
-}
-
-/**
- * @brief Find the event belonging to an event name.
- *
- * @param name event name
- *
- * @return event >= 0 (ok) or -1 (not found)
- */
-int appFindMessage(const char *name)
-{
-    unsigned int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++)
-        if (!strcmp(evNames[i].name, name))
-            return evNames[i].message;
-
-    return -1;
-}
-
-/**
- * @brief Find the item belonging to an event.
- *
- * @param event event
- *
- * @return pointer to the item (ok) or NULL (not found)
- */
-wItem *appFindItem(int event)
-{
-    wItem *item;
-    int i, n;
-
-    if (guiApp.videoWindow.isFullScreen && guiApp.playbarIsPresent) {
-        item = guiApp.playbarItems;
-        n    = guiApp.IndexOfPlaybarItems;
-    } else {
-        item = guiApp.mainItems;
-        n    = guiApp.IndexOfMainItems;
-    }
-
-    for (i = 0; i <= n; i++)
-        if (item[i].message == event)
-            return &item[i];
-
-    return NULL;
-}
-
-/**
- * @brief Modify the state (i.e. set a new value) to the item belonging to an event.
- *
- * @param event event
- * @param state new value
- */
-void btnModify(int event, float state)
-{
-    int i;
-
-    for (i = 0; i <= guiApp.IndexOfMainItems; i++) {
-        if (guiApp.mainItems[i].message == event) {
-            switch (guiApp.mainItems[i].type) {
-            case itButton:
-                guiApp.mainItems[i].pressed = (int)state;
-                break;
-
-            case itPotmeter:
-            case itVPotmeter:
-            case itHPotmeter:
-                if (state < 0.0f)
-                    state = 0.0f;
-                if (state > 100.0f)
-                    state = 100.0f;
-                guiApp.mainItems[i].value = state;
-                break;
-            }
-        }
-    }
-
-    for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) {
-        if (guiApp.playbarItems[i].message == event) {
-            switch (guiApp.playbarItems[i].type) {
-            case itButton:
-                guiApp.playbarItems[i].pressed = (int)state;
-                break;
-
-            case itPotmeter:
-            case itVPotmeter:
-            case itHPotmeter:
-                if (state < 0.0f)
-                    state = 0.0f;
-                if (state > 100.0f)
-                    state = 100.0f;
-                guiApp.playbarItems[i].value = state;
-                break;
-            }
-        }
-    }
-}
-
-/**
- * @brief Set the @a pressed state (i.e. a new value) to the item belonging to an event.
- *
- * @param event event
- * @param set new value
- */
-void btnSet(int event, int set)
-{
-    int i;
-
-    for (i = 0; i <= guiApp.IndexOfMainItems; i++)
-        if (guiApp.mainItems[i].message == event)
-            guiApp.mainItems[i].pressed = set;
-
-    for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
-        if (guiApp.playbarItems[i].message == event)
-            guiApp.playbarItems[i].pressed = set;
-}
--- a/gui/app.h	Thu Dec 06 02:30:19 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_GUI_APP_H
-#define MPLAYER_GUI_APP_H
-
-#include "util/bitmap.h"
-#include "wm/ws.h"
-
-/// GUI messages (user events)
-enum {
-    evNone,
-    evPlay,
-    evStop,
-    evPause,
-    evPrev,
-    evNext,
-    evLoad,
-    evLoadPlay,
-    evLoadAudioFile,
-    evLoadSubtitle,
-    evDropSubtitle,
-    evPlaylist,
-    evPlayCD,
-    evPlayVCD,
-    evPlayDVD,
-    evLoadURL,
-    evPlaySwitchToPause,
-    evPauseSwitchToPlay,
-    evBackward10sec,
-    evForward10sec,
-    evBackward1min,
-    evForward1min,
-    evBackward10min,
-    evForward10min,
-    evSetMoviePosition,
-    evHalfSize,
-    evDoubleSize,
-    evFullScreen,
-    evNormalSize,
-    evSetAspect,
-    evIncVolume,
-    evDecVolume,
-    evSetVolume,
-    evMute,
-    evSetBalance,
-    evEqualizer,
-    evAbout,
-    evPreferences,
-    evSkinBrowser,
-    evMenu,
-    evIconify,
-    evExit = 100
-};
-
-/// Internal messages (events)
-enum {
-    ivSetVideo = 1000,
-    ivSetAudio,
-    ivSetSubtitle,
-    ivSetCDTrack,
-    ivSetVCDTrack,
-    ivSetDVDTitle,
-    ivSetDVDChapter,
-    ivSetDVDAudio,
-    ivSetDVDSubtitle,
-    ivPlayDVD,
-    ivShowPopUpMenu,
-    ivHidePopUpMenu,
-    ivRedraw
-};
-
-typedef struct {
-    int message;
-    const char *name;
-} evName;
-
-/// Skin items
-enum {
-    itNone,
-    itBase,
-    itButton,
-    itSLabel,
-    itDLabel,
-    itHPotmeter,
-    itVPotmeter,
-    itPotmeter,
-    itMenu,
-    itPLMButton = 100,
-    itPRMButton
-};
-
-//@{
-/// Button state
-#define btnDisabled 0
-#define btnReleased 1
-#define btnPressed  2
-//@}
-
-/// Item definition
-typedef struct {
-    int type;
-
-    int x, y;
-    int width, height;
-
-    guiImage Bitmap;
-    guiImage Mask;
-
-    int fontid;
-    int align;
-    char *label;
-
-    int pwidth, pheight;
-    int numphases;
-    float value;
-
-    int message;
-
-    int R, G, B;
-
-    char *text;
-    int textwidth;
-    unsigned int starttime;
-    int last_x;
-
-    int pressed;
-} wItem;
-
-/// Maximum GUI items
-#define MAX_ITEMS 64
-
-typedef struct {
-    wItem main;
-    wsTWindow mainWindow;
-    int mainDecoration;
-
-    wItem video;
-    wsTWindow videoWindow;
-
-    wItem playbar;
-    wsTWindow playbarWindow;
-    int playbarIsPresent;
-
-    wItem menu;
-    wItem menuSelected;
-    wsTWindow menuWindow;
-    int menuIsPresent;
-
-    int IndexOfMainItems;
-    wItem mainItems[MAX_ITEMS];
-
-    int IndexOfPlaybarItems;
-    wItem playbarItems[MAX_ITEMS];
-
-    int IndexOfMenuItems;
-    wItem menuItems[MAX_ITEMS];
-} guiItems;
-
-extern guiItems guiApp;
-
-wItem *appFindItem(int event);
-int appFindMessage(const char *name);
-void appFreeStruct(void);
-void btnModify(int event, float state);
-void btnSet(int event, int set);
-
-#endif /* MPLAYER_GUI_APP_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/app/app.c	Thu Dec 06 13:47:47 2012 +0000
@@ -0,0 +1,248 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * @file
+ * @brief GUI application helpers
+ */
+
+#include "app.h"
+#include "gui.h"
+#include "gui/skin/font.h"
+
+#include "libavutil/common.h"
+
+/**
+ * @brief Initialize item counters.
+ */
+guiItems guiApp = {
+    .IndexOfMainItems    = -1,
+    .IndexOfPlaybarItems = -1,
+    .IndexOfMenuItems    = -1
+};
+
+/**
+ * @brief Event messages belonging to event names.
+ */
+static const evName evNames[] = {
+    { evNone,              "evNone"              },
+    { evPlay,              "evPlay"              },
+    { evStop,              "evStop"              },
+    { evPause,             "evPause"             },
+    { evPrev,              "evPrev"              },
+    { evNext,              "evNext"              },
+    { evLoad,              "evLoad"              },
+    { evLoadPlay,          "evLoadPlay"          },
+    { evLoadAudioFile,     "evLoadAudioFile"     },
+    { evLoadSubtitle,      "evLoadSubtitle"      },
+    { evDropSubtitle,      "evDropSubtitle"      },
+    { evPlaylist,          "evPlaylist"          },
+    { evPlayCD,            "evPlayCD"            },
+    { evPlayVCD,           "evPlayVCD"           },
+    { evPlayDVD,           "evPlayDVD"           },
+    { evLoadURL,           "evSetURL"            }, // legacy
+    { evLoadURL,           "evLoadURL"           },
+    { evPlaySwitchToPause, "evPlaySwitchToPause" },
+    { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
+    { evBackward10sec,     "evBackward10sec"     },
+    { evForward10sec,      "evForward10sec"      },
+    { evBackward1min,      "evBackward1min"      },
+    { evForward1min,       "evForward1min"       },
+    { evBackward10min,     "evBackward10min"     },
+    { evForward10min,      "evForward10min"      },
+    { evSetMoviePosition,  "evSetMoviePosition"  },
+    { evHalfSize,          "evHalfSize"          },
+    { evDoubleSize,        "evDoubleSize"        },
+    { evFullScreen,        "evFullScreen"        },
+    { evNormalSize,        "evNormalSize"        },
+    { evSetAspect,         "evSetAspect"         },
+    { evIncVolume,         "evIncVolume"         },
+    { evDecVolume,         "evDecVolume"         },
+    { evSetVolume,         "evSetVolume"         },
+    { evMute,              "evMute"              },
+    { evSetBalance,        "evSetBalance"        },
+    { evEqualizer,         "evEqualizer"         },
+    { evAbout,             "evAbout"             },
+    { evPreferences,       "evPreferences"       },
+    { evSkinBrowser,       "evSkinBrowser"       },
+    { evMenu,              "evMenu"              },
+    { evIconify,           "evIconify"           },
+    { evExit,              "evExit"              }
+};
+
+/**
+ * @brief Free all memory allocated to an item and set all its pointers to NULL.
+ *
+ * @param item item to be freed
+ */
+static void appClearItem(wItem *item)
+{
+    bpFree(&item->Bitmap);
+    bpFree(&item->Mask);
+    free(item->label);
+    free(item->text);
+    memset(item, 0, sizeof(*item));
+}
+
+/**
+ * @brief Free all memory allocated to all GUI items and reset all item counters.
+ */
+void appFreeStruct(void)
+{
+    int i;
+
+    appClearItem(&guiApp.main);
+    guiApp.mainDecoration = False;
+
+    appClearItem(&guiApp.video);
+
+    appClearItem(&guiApp.playbar);
+    guiApp.playbarIsPresent = False;
+
+    appClearItem(&guiApp.menu);
+    appClearItem(&guiApp.menuSelected);
+    guiApp.menuIsPresent = False;
+
+    for (i = 0; i <= guiApp.IndexOfMainItems; i++)
+        appClearItem(&guiApp.mainItems[i]);
+    for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
+        appClearItem(&guiApp.playbarItems[i]);
+    for (i = 0; i <= guiApp.IndexOfMenuItems; i++)
+        appClearItem(&guiApp.menuItems[i]);
+
+    guiApp.IndexOfMainItems    = -1;
+    guiApp.IndexOfPlaybarItems = -1;
+    guiApp.IndexOfMenuItems    = -1;
+
+    fntFreeFont();
+}
+
+/**
+ * @brief Find the event belonging to an event name.
+ *
+ * @param name event name
+ *
+ * @return event >= 0 (ok) or -1 (not found)
+ */
+int appFindMessage(const char *name)
+{
+    unsigned int i;
+
+    for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++)
+        if (!strcmp(evNames[i].name, name))
+            return evNames[i].message;
+
+    return -1;
+}
+
+/**
+ * @brief Find the item belonging to an event.
+ *
+ * @param event event
+ *
+ * @return pointer to the item (ok) or NULL (not found)
+ */
+wItem *appFindItem(int event)
+{
+    wItem *item;
+    int i, n;
+
+    if (guiApp.videoWindow.isFullScreen && guiApp.playbarIsPresent) {
+        item = guiApp.playbarItems;
+        n    = guiApp.IndexOfPlaybarItems;
+    } else {
+        item = guiApp.mainItems;
+        n    = guiApp.IndexOfMainItems;
+    }
+
+    for (i = 0; i <= n; i++)
+        if (item[i].message == event)
+            return &item[i];
+
+    return NULL;
+}
+
+/**
+ * @brief Modify the state (i.e. set a new value) to the item belonging to an event.
+ *
+ * @param event event
+ * @param state new value
+ */
+void btnModify(int event, float state)
+{
+    int i;
+
+    for (i = 0; i <= guiApp.IndexOfMainItems; i++) {
+        if (guiApp.mainItems[i].message == event) {
+            switch (guiApp.mainItems[i].type) {
+            case itButton:
+                guiApp.mainItems[i].pressed = (int)state;
+                break;
+
+            case itPotmeter:
+            case itVPotmeter:
+            case itHPotmeter:
+                if (state < 0.0f)
+                    state = 0.0f;
+                if (state > 100.0f)
+                    state = 100.0f;
+                guiApp.mainItems[i].value = state;
+                break;
+            }
+        }
+    }
+
+    for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) {
+        if (guiApp.playbarItems[i].message == event) {
+            switch (guiApp.playbarItems[i].type) {
+            case itButton:
+                guiApp.playbarItems[i].pressed = (int)state;
+                break;
+
+            case itPotmeter:
+            case itVPotmeter:
+            case itHPotmeter:
+                if (state < 0.0f)
+                    state = 0.0f;
+                if (state > 100.0f)
+                    state = 100.0f;
+                guiApp.playbarItems[i].value = state;
+                break;
+            }
+        }
+    }
+}
+
+/**
+ * @brief Set the @a pressed state (i.e. a new value) to the item belonging to an event.
+ *
+ * @param event event
+ * @param set new value
+ */
+void btnSet(int event, int set)
+{
+    int i;
+
+    for (i = 0; i <= guiApp.IndexOfMainItems; i++)
+        if (guiApp.mainItems[i].message == event)
+            guiApp.mainItems[i].pressed = set;
+
+    for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
+        if (guiApp.playbarItems[i].message == event)
+            guiApp.playbarItems[i].pressed = set;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/app/app.h	Thu Dec 06 13:47:47 2012 +0000
@@ -0,0 +1,183 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_GUI_APP_H
+#define MPLAYER_GUI_APP_H
+
+#include "gui/util/bitmap.h"
+#include "gui/wm/ws.h"
+
+/// GUI messages (user events)
+enum {
+    evNone,
+    evPlay,
+    evStop,
+    evPause,
+    evPrev,
+    evNext,
+    evLoad,
+    evLoadPlay,
+    evLoadAudioFile,
+    evLoadSubtitle,
+    evDropSubtitle,
+    evPlaylist,
+    evPlayCD,
+    evPlayVCD,
+    evPlayDVD,
+    evLoadURL,
+    evPlaySwitchToPause,
+    evPauseSwitchToPlay,
+    evBackward10sec,
+    evForward10sec,
+    evBackward1min,
+    evForward1min,
+    evBackward10min,
+    evForward10min,
+    evSetMoviePosition,
+    evHalfSize,
+    evDoubleSize,
+    evFullScreen,
+    evNormalSize,
+    evSetAspect,
+    evIncVolume,
+    evDecVolume,
+    evSetVolume,
+    evMute,
+    evSetBalance,
+    evEqualizer,
+    evAbout,
+    evPreferences,
+    evSkinBrowser,
+    evMenu,
+    evIconify,
+    evExit = 100
+};
+
+/// Internal messages (events)
+enum {
+    ivSetVideo = 1000,
+    ivSetAudio,
+    ivSetSubtitle,
+    ivSetCDTrack,
+    ivSetVCDTrack,
+    ivSetDVDTitle,
+    ivSetDVDChapter,
+    ivSetDVDAudio,
+    ivSetDVDSubtitle,
+    ivPlayDVD,
+    ivShowPopUpMenu,
+    ivHidePopUpMenu,
+    ivRedraw
+};
+
+typedef struct {
+    int message;
+    const char *name;
+} evName;
+
+/// Skin items
+enum {
+    itNone,
+    itBase,
+    itButton,
+    itSLabel,
+    itDLabel,
+    itHPotmeter,
+    itVPotmeter,
+    itPotmeter,
+    itMenu,
+    itPLMButton = 100,
+    itPRMButton
+};
+
+//@{
+/// Button state
+#define btnDisabled 0
+#define btnReleased 1
+#define btnPressed  2
+//@}
+
+/// Item definition
+typedef struct {
+    int type;
+
+    int x, y;
+    int width, height;
+
+    guiImage Bitmap;
+    guiImage Mask;
+
+    int fontid;
+    int align;
+    char *label;
+
+    int pwidth, pheight;
+    int numphases;
+    float value;
+
+    int message;
+
+    int R, G, B;
+
+    char *text;
+    int textwidth;
+    unsigned int starttime;
+    int last_x;
+
+    int pressed;
+} wItem;
+
+/// Maximum GUI items
+#define MAX_ITEMS 64
+
+typedef struct {
+    wItem main;
+    wsTWindow mainWindow;
+    int mainDecoration;
+
+    wItem video;
+    wsTWindow videoWindow;
+
+    wItem playbar;
+    wsTWindow playbarWindow;
+    int playbarIsPresent;
+
+    wItem menu;
+    wItem menuSelected;
+    wsTWindow menuWindow;
+    int menuIsPresent;
+
+    int IndexOfMainItems;
+    wItem mainItems[MAX_ITEMS];
+
+    int IndexOfPlaybarItems;
+    wItem playbarItems[MAX_ITEMS];
+
+    int IndexOfMenuItems;
+    wItem menuItems[MAX_ITEMS];
+} guiItems;
+
+extern guiItems guiApp;
+
+wItem *appFindItem(int event);
+int appFindMessage(const char *name);
+void appFreeStruct(void);
+void btnModify(int event, float state);
+void btnSet(int event, int set);
+
+#endif /* MPLAYER_GUI_APP_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/app/cfg.c	Thu Dec 06 13:47:47 2012 +0000
@@ -0,0 +1,450 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cfg.h"
+#include "gui.h"
+#include "gui/interface.h"
+#include "gui/util/list.h"
+#include "gui/util/string.h"
+
+#include "config.h"
+#include "help_mp.h"
+#include "libavutil/common.h"
+#include "libmpcodecs/vd.h"
+#include "libmpdemux/demuxer.h"
+#include "libvo/video_out.h"
+#include "libvo/x11_common.h"
+#include "mixer.h"
+#include "mp_core.h"
+#include "mp_msg.h"
+#include "mpcommon.h"
+#include "mplayer.h"
+#include "parser-cfg.h"
+#include "path.h"
+#include "stream/stream.h"
+#include "sub/ass_mp.h"
+#include "sub/font_load.h"
+#include "sub/sub.h"
+
+m_config_t *gui_conf;
+
+int gtkCacheOn;
+int gtkCacheSize = 2048;
+
+int gtkVfPP;
+
+int gtkVfLAVC;
+char *gtkDXR3Device;
+
+int gtkAutoSyncOn;
+int gtkAutoSync;
+
+int gtkAONorm;
+int gtkAOSurround;
+int gtkAOExtraStereo;
+float gtkAOExtraStereoMul = 1.0f;
+
+char *gtkAOALSAMixer;
+char *gtkAOALSAMixerChannel;
+char *gtkAOALSADevice;
+
+char *gtkAOOSSMixer;
+char *gtkAOOSSMixerChannel;
+char *gtkAOOSSDevice;
+
+char *gtkAOESDDevice;
+
+char *gtkAOSDLDriver;
+
+int gtkEnableAudioEqualizer;
+float gtkEquChannels[6][10];
+
+int gtkSubDumpMPSub;
+int gtkSubDumpSrt;
+
+gtkASS_t gtkASS;
+
+int gtkEnablePlayBar = True;
+int gtkLoadFullscreen;
+int gtkShowVideoWindow = True;
+
+int gui_save_pos    = True;
+int gui_main_pos_x  = -3;
+int gui_main_pos_y  = -3;
+int gui_video_pos_x = -3;
+int gui_video_pos_y = -3;
+
+int guiWinID = -1;
+
+char *skinName;
+
+char *fsHistory[5];
+
+static const char gui_configuration[] = "gui.conf";
+static const char gui_history[]       = "gui.history";
+static const char gui_playlist[]      = "gui.pl";
+static const char gui_urllist[]       = "gui.url";
+
+static const m_option_t gui_opts[] = {
+    { "cache",                       &gtkCacheOn,              CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "cache_size",                  &gtkCacheSize,            CONF_TYPE_INT,         CONF_RANGE,  32,    0x7fffffff, NULL },
+
+    { "vf_pp",                       &gtkVfPP,                 CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+#ifdef CONFIG_DXR3
+    { "vf_lavc",                     &gtkVfLAVC,               CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "vo_dxr3_device",              &gtkDXR3Device,           CONF_TYPE_STRING,      0,           0,     0,          NULL },
+#endif
+
+    { "autosync",                    &gtkAutoSyncOn,           CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "autosync_size",               &gtkAutoSync,             CONF_TYPE_INT,         CONF_RANGE,  0,     10000,      NULL },
+
+    { "ao_volnorm",                  &gtkAONorm,               CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "ao_surround",                 &gtkAOSurround,           CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "ao_extra_stereo",             &gtkAOExtraStereo,        CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "ao_extra_stereo_coefficient", &gtkAOExtraStereoMul,     CONF_TYPE_FLOAT,       CONF_RANGE,  -10.0, 10.0,       NULL },
+
+#ifdef CONFIG_ALSA
+    { "ao_alsa_mixer",               &gtkAOALSAMixer,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "ao_alsa_mixer_channel",       &gtkAOALSAMixerChannel,   CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "ao_alsa_device",              &gtkAOALSADevice,         CONF_TYPE_STRING,      0,           0,     0,          NULL },
+#endif
+
+#ifdef CONFIG_OSS_AUDIO
+    { "ao_oss_mixer",                &gtkAOOSSMixer,           CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "ao_oss_mixer_channel",        &gtkAOOSSMixerChannel,    CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "ao_oss_device",               &gtkAOOSSDevice,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+#endif
+
+#ifdef CONFIG_ESD
+    { "ao_esd_device",               &gtkAOESDDevice,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+#endif
+
+#ifdef CONFIG_SDL
+    { "ao_sdl_subdriver",            &gtkAOSDLDriver,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+#endif
+
+    { "enable_audio_equ",            &gtkEnableAudioEqualizer, CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+    { "equ_channel_1",               &gtkEquChannel1,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "equ_channel_2",               &gtkEquChannel2,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "equ_channel_3",               &gtkEquChannel3,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "equ_channel_4",               &gtkEquChannel4,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "equ_channel_5",               &gtkEquChannel5,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "equ_channel_6",               &gtkEquChannel6,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
+
+#define audio_equ_row(i, j) \
+    { "equ_band_" # i # j,           &gtkEquChannels[i][j],    CONF_TYPE_FLOAT,       CONF_RANGE,  -15.0, 15.0,       NULL }
+    audio_equ_row(0, 0), audio_equ_row(0, 1), audio_equ_row(0, 2), audio_equ_row(0, 3), audio_equ_row(0, 4), audio_equ_row(0, 5), audio_equ_row(0, 6), audio_equ_row(0, 7), audio_equ_row(0, 8), audio_equ_row(0, 9),
+    audio_equ_row(1, 0), audio_equ_row(1, 1), audio_equ_row(1, 2), audio_equ_row(1, 3), audio_equ_row(1, 4), audio_equ_row(1, 5), audio_equ_row(1, 6), audio_equ_row(1, 7), audio_equ_row(1, 8), audio_equ_row(1, 9),
+    audio_equ_row(2, 0), audio_equ_row(2, 1), audio_equ_row(2, 2), audio_equ_row(2, 3), audio_equ_row(2, 4), audio_equ_row(2, 5), audio_equ_row(2, 6), audio_equ_row(2, 7), audio_equ_row(2, 8), audio_equ_row(2, 9),
+    audio_equ_row(3, 0), audio_equ_row(3, 1), audio_equ_row(3, 2), audio_equ_row(3, 3), audio_equ_row(3, 4), audio_equ_row(3, 5), audio_equ_row(3, 6), audio_equ_row(3, 7), audio_equ_row(3, 8), audio_equ_row(3, 9),
+    audio_equ_row(4, 0), audio_equ_row(4, 1), audio_equ_row(4, 2), audio_equ_row(4, 3), audio_equ_row(4, 4), audio_equ_row(4, 5), audio_equ_row(4, 6), audio_equ_row(4, 7), audio_equ_row(4, 8), audio_equ_row(4, 9),
+    audio_equ_row(5, 0), audio_equ_row(5, 1), audio_equ_row(5, 2), audio_equ_row(5, 3), audio_equ_row(5, 4), audio_equ_row(5, 5), audio_equ_row(5, 6), audio_equ_row(5, 7), audio_equ_row(5, 8), audio_equ_row(5, 9),
+#undef audio_equ_row
+
+    { "playbar",                     &gtkEnablePlayBar,        CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "load_fullscreen",             &gtkLoadFullscreen,       CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "show_videowin",               &gtkShowVideoWindow,      CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+    { "gui_save_pos",                &gui_save_pos,            CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "gui_main_pos_x",              &gui_main_pos_x,          CONF_TYPE_INT,         0,           0,     0,          NULL },
+    { "gui_main_pos_y",              &gui_main_pos_y,          CONF_TYPE_INT,         0,           0,     0,          NULL },
+    { "gui_video_out_pos_x",         &gui_video_pos_x,         CONF_TYPE_INT,         0,           0,     0,          NULL },
+    { "gui_video_out_pos_y",         &gui_video_pos_y,         CONF_TYPE_INT,         0,           0,     0,          NULL },
+
+    { "idle",                        &player_idle_mode,        CONF_TYPE_FLAG,        CONF_GLOBAL, 0,     1,          NULL },
+
+    // NOTE TO MYSELF: Do we really need all/any non-gtkOptions, i.e. override mplayer options?
+
+    { "gui_skin",                    &skinName,                CONF_TYPE_STRING,      0,           0,     0,          NULL },
+
+    { "stopxscreensaver",            &stop_xscreensaver,       CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+    { "cdrom_device",                &cdrom_device,            CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "dvd_device",                  &dvd_device,              CONF_TYPE_STRING,      0,           0,     0,          NULL },
+
+    { "osd_level",                   &osd_level,               CONF_TYPE_INT,         CONF_RANGE,  0,     3,          NULL },
+
+    { "vo_driver",                   &video_driver_list,       CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
+    { "v_vfm",                       &video_fm_list,           CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
+
+    { "vf_autoq",                    &auto_quality,            CONF_TYPE_INT,         CONF_RANGE,  0,     100,        NULL },
+    { "vo_direct_render",            &vo_directrendering,      CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "vo_doublebuffering",          &vo_doublebuffering,      CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "vo_panscan",                  &vo_panscan,              CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   1.0,        NULL },
+
+    { "v_flip",                      &flip,                    CONF_TYPE_INT,         CONF_RANGE,  -1,    1,          NULL },
+    { "v_framedrop",                 &frame_dropping,          CONF_TYPE_INT,         CONF_RANGE,  0,     2,          NULL },
+    { "v_idx",                       &index_mode,              CONF_TYPE_INT,         CONF_RANGE,  -1,    2,          NULL },
+    { "v_ni",                        &force_ni,                CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+    { "ao_driver",                   &audio_driver_list,       CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
+    { "a_afm",                       &audio_fm_list,           CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
+
+    { "softvol",                     &soft_vol,                CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+    { "sub_auto_load",               &sub_auto,                CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+#ifdef CONFIG_ICONV
+    { "sub_cp",                      &sub_cp,                  CONF_TYPE_STRING,      0,           0,     0,          NULL },
+#endif
+    { "sub_overlap",                 &suboverlap_enabled,      CONF_TYPE_FLAG,        0,           0,     0,          NULL },
+    { "sub_pos",                     &sub_pos,                 CONF_TYPE_INT,         CONF_RANGE,  0,     200,        NULL },
+    { "sub_unicode",                 &sub_unicode,             CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+
+    { "font_factor",                 &font_factor,             CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   10.0,       NULL },
+    { "font_name",                   &font_name,               CONF_TYPE_STRING,      0,           0,     0,          NULL },
+
+#ifdef CONFIG_FREETYPE
+    { "font_encoding",               &subtitle_font_encoding,  CONF_TYPE_STRING,      0,           0,     0,          NULL },
+    { "font_text_scale",             &text_font_scale_factor,  CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   100.0,      NULL },
+    { "font_osd_scale",              &osd_font_scale_factor,   CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   100.0,      NULL },
+    { "font_blur",                   &subtitle_font_radius,    CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   8.0,        NULL },
+    { "font_outline",                &subtitle_font_thickness, CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   8.0,        NULL },
+    { "font_autoscale",              &subtitle_autoscale,      CONF_TYPE_INT,         CONF_RANGE,  0,     3,          NULL },
+#endif
+
+#ifdef CONFIG_ASS
+    { "ass_enabled",                 &ass_enabled,             CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "ass_use_margins",             &ass_use_margins,         CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+    { "ass_top_margin",              &ass_top_margin,          CONF_TYPE_INT,         CONF_RANGE,  0,     512,        NULL },
+    { "ass_bottom_margin",           &ass_bottom_margin,       CONF_TYPE_INT,         CONF_RANGE,  0,     512,        NULL },
+#endif
+
+    { NULL,                          NULL,                     0,                     0,           0,     0,          NULL }
+};
+
+int cfg_gui_include(m_option_t *conf, const char *file)
+{
+    (void)conf;
+
+    return m_config_parse_config_file(gui_conf, file, 0);
+}
+
+void cfg_read(void)
+{
+    char *fname, line[512];
+    FILE *file;
+
+    player_idle_mode = True;   // GUI is in idle mode by default
+
+    /* configuration */
+
+    fname = get_path(gui_configuration);
+
+    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[cfg] file: %s\n", fname);
+
+    gui_conf = m_config_new();
+
+    if (!gui_conf) {
+        gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
+        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+    }
+
+    m_config_register_options(gui_conf, gui_opts);
+
+    if (!disable_gui_conf && (m_config_parse_config_file(gui_conf, fname, 1) < 0)) {
+        gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_ConfigFileError "\n");
+        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+    }
+
+    free(fname);
+
+    /* playlist */
+
+    fname = get_path(gui_playlist);
+    file  = fopen(fname, "rt");
+
+    if (file) {
+        while (fgetstr(line, sizeof(line), file)) {
+            plItem *item;
+
+            if (!*line)
+                continue;
+
+            item = calloc(1, sizeof(plItem));
+
+            if (!item) {
+                gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
+                mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+            }
+
+            item->path = strdup(line);
+
+            if (fgetstr(line, sizeof(line), file) && *line) {
+                item->name = strdup(line);
+                listMgr(PLAYLIST_ITEM_APPEND, item);
+            } else {
+                free(item->path);
+                free(item);
+            }
+        }
+
+        fclose(file);
+    }
+
+    free(fname);
+
+    /* URL list */
+
+    fname = get_path(gui_urllist);
+    file  = fopen(fname, "rt");
+
+    if (file) {
+        while (fgetstr(line, sizeof(line), file)) {
+            urlItem *item;
+
+            if (!*line)
+                continue;
+
+            item = calloc(1, sizeof(urlItem));
+
+            if (!item) {
+                gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
+                mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+            }
+
+            item->url = strdup(line);
+            listMgr(URLLIST_ITEM_ADD, item);
+        }
+
+        fclose(file);
+    }
+
+    free(fname);
+
+    /* directory history */
+
+    fname = get_path(gui_history);
+    file  = fopen(fname, "rt");
+
+    if (file) {
+        unsigned int i = 0;
+
+        while (fgetstr(line, sizeof(line), file))
+            if (*line && (i < FF_ARRAY_ELEMS(fsHistory)))
+                fsHistory[i++] = strdup(line);
+
+        fclose(file);
+    }
+
+    free(fname);
+}
+
+void cfg_write(void)
+{
+    char *fname;
+    FILE *file;
+
+    /* configuration */
+
+    fname = get_path(gui_configuration);
+    file  = fopen(fname, "wt+");
+
+    if (file) {
+        const m_option_t *opts = gui_opts;
+
+        while (opts->name) {
+            char *val = m_option_print(opts, opts->p);
+
+            if (val == (char *)-1) {
+                gmp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, opts->name);
+                val = NULL;
+            }
+
+            if (val) {
+                char delim[] = "\"";
+
+                if (!strchr(val, ' '))
+                    *delim = 0;
+
+                fprintf(file, "%s=%s%s%s\n", opts->name, delim, val, delim);
+                free(val);
+            }
+
+            opts++;
+        }
+
+        fclose(file);
+    }
+
+    free(fname);
+
+    /* playlist */
+
+    fname = get_path(gui_playlist);
+    file  = fopen(fname, "wt+");
+
+    if (file) {
+        plItem *item = listMgr(PLAYLIST_GET, 0);
+
+        while (item) {
+            if (item->path && item->name) {
+                fprintf(file, "%s\n", item->path);
+                fprintf(file, "%s\n", item->name);
+            }
+
+            item = item->next;
+        }
+
+        fclose(file);
+    }
+
+    free(fname);
+
+    /* URL list */
+
+    fname = get_path(gui_urllist);
+    file  = fopen(fname, "wt+");
+
+    if (file) {
+        urlItem *item = listMgr(URLLIST_GET, 0);
+
+        while (item) {
+            if (item->url)
+                fprintf(file, "%s\n", item->url);
+
+            item = item->next;
+        }
+
+        fclose(file);
+    }
+
+    free(fname);
+
+    /* directory history */
+
+    fname = get_path(gui_history);
+    file  = fopen(fname, "wt+");
+
+    if (file) {
+        unsigned int i;
+
+        for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
+            if (fsHistory[i])
+                fprintf(file, "%s\n", fsHistory[i]);
+
+        fclose(file);
+    }
+
+    free(fname);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/app/cfg.h	Thu Dec 06 13:47:47 2012 +0000
@@ -0,0 +1,96 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_GUI_CFG_H
+#define MPLAYER_GUI_CFG_H
+
+#include "m_config.h"
+#include "m_option.h"
+
+extern m_config_t *gui_conf;
+
+extern int gtkCacheOn;
+extern int gtkCacheSize;
+
+extern int gtkVfPP;
+extern int gtkVfLAVC;
+
+extern char *gtkDXR3Device;
+
+extern int gtkAutoSyncOn;
+extern int gtkAutoSync;
+
+extern int gtkAONorm;
+extern int gtkAOSurround;
+extern int gtkAOExtraStereo;
+extern float gtkAOExtraStereoMul;
+
+extern char *gtkAOALSAMixer;
+extern char *gtkAOALSAMixerChannel;
+extern char *gtkAOALSADevice;
+
+extern char *gtkAOOSSMixer;
+extern char *gtkAOOSSMixerChannel;
+extern char *gtkAOOSSDevice;
+
+extern char *gtkAOESDDevice;
+
+extern char *gtkAOSDLDriver;
+
+extern int gtkEnableAudioEqualizer;
+extern char *gtkEquChannel1;
+extern char *gtkEquChannel2;
+extern char *gtkEquChannel3;
+extern char *gtkEquChannel4;
+extern char *gtkEquChannel5;
+extern char *gtkEquChannel6;
+extern float gtkEquChannels[6][10];
+
+extern int gtkSubDumpMPSub;
+extern int gtkSubDumpSrt;
+
+typedef struct {
+    int enabled;
+    int use_margins;
+    int top_margin;
+    int bottom_margin;
+} gtkASS_t;
+
+extern gtkASS_t gtkASS;
+
+extern int gtkEnablePlayBar;
+extern int gtkLoadFullscreen;
+extern int gtkShowVideoWindow;
+
+extern int gui_save_pos;
+extern int gui_main_pos_x;
+extern int gui_main_pos_y;
+extern int gui_video_pos_x;
+extern int gui_video_pos_y;
+
+extern int guiWinID;
+
+extern char *skinName;
+
+extern char *fsHistory[5];
+
+int cfg_gui_include(m_option_t *conf, const char *file);
+void cfg_read(void);
+void cfg_write(void);
+
+#endif /* MPLAYER_GUI_CFG_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/app/gui.h	Thu Dec 06 13:47:47 2012 +0000
@@ -0,0 +1,41 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * @file
+ * @brief Internal declarations and definitions
+ */
+
+#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)
+
+/// StreamTypes that are permitted in a playlist
+#define isPlaylistStreamtype (guiInfo.StreamType == STREAMTYPE_FILE || guiInfo.StreamType == STREAMTYPE_STREAM)
+
+#endif /* MPLAYER_GUI_GUI_H */
--- a/gui/cfg.c	Thu Dec 06 02:30:19 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "cfg.h"
-#include "gui.h"
-#include "interface.h"
-#include "util/list.h"
-#include "util/string.h"
-
-#include "config.h"
-#include "help_mp.h"
-#include "libavutil/common.h"
-#include "libmpcodecs/vd.h"
-#include "libmpdemux/demuxer.h"
-#include "libvo/video_out.h"
-#include "libvo/x11_common.h"
-#include "mixer.h"
-#include "mp_core.h"
-#include "mp_msg.h"
-#include "mpcommon.h"
-#include "mplayer.h"
-#include "parser-cfg.h"
-#include "path.h"
-#include "stream/stream.h"
-#include "sub/ass_mp.h"
-#include "sub/font_load.h"
-#include "sub/sub.h"
-
-m_config_t *gui_conf;
-
-int gtkCacheOn;
-int gtkCacheSize = 2048;
-
-int gtkVfPP;
-
-int gtkVfLAVC;
-char *gtkDXR3Device;
-
-int gtkAutoSyncOn;
-int gtkAutoSync;
-
-int gtkAONorm;
-int gtkAOSurround;
-int gtkAOExtraStereo;
-float gtkAOExtraStereoMul = 1.0f;
-
-char *gtkAOALSAMixer;
-char *gtkAOALSAMixerChannel;
-char *gtkAOALSADevice;
-
-char *gtkAOOSSMixer;
-char *gtkAOOSSMixerChannel;
-char *gtkAOOSSDevice;
-
-char *gtkAOESDDevice;
-
-char *gtkAOSDLDriver;
-
-int gtkEnableAudioEqualizer;
-float gtkEquChannels[6][10];
-
-int gtkSubDumpMPSub;
-int gtkSubDumpSrt;
-
-gtkASS_t gtkASS;
-
-int gtkEnablePlayBar = True;
-int gtkLoadFullscreen;
-int gtkShowVideoWindow = True;
-
-int gui_save_pos    = True;
-int gui_main_pos_x  = -3;
-int gui_main_pos_y  = -3;
-int gui_video_pos_x = -3;
-int gui_video_pos_y = -3;
-
-int guiWinID = -1;
-
-char *skinName;
-
-char *fsHistory[5];
-
-static const char gui_configuration[] = "gui.conf";
-static const char gui_history[]       = "gui.history";
-static const char gui_playlist[]      = "gui.pl";
-static const char gui_urllist[]       = "gui.url";
-
-static const m_option_t gui_opts[] = {
-    { "cache",                       &gtkCacheOn,              CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "cache_size",                  &gtkCacheSize,            CONF_TYPE_INT,         CONF_RANGE,  32,    0x7fffffff, NULL },
-
-    { "vf_pp",                       &gtkVfPP,                 CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-#ifdef CONFIG_DXR3
-    { "vf_lavc",                     &gtkVfLAVC,               CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "vo_dxr3_device",              &gtkDXR3Device,           CONF_TYPE_STRING,      0,           0,     0,          NULL },
-#endif
-
-    { "autosync",                    &gtkAutoSyncOn,           CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "autosync_size",               &gtkAutoSync,             CONF_TYPE_INT,         CONF_RANGE,  0,     10000,      NULL },
-
-    { "ao_volnorm",                  &gtkAONorm,               CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "ao_surround",                 &gtkAOSurround,           CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "ao_extra_stereo",             &gtkAOExtraStereo,        CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "ao_extra_stereo_coefficient", &gtkAOExtraStereoMul,     CONF_TYPE_FLOAT,       CONF_RANGE,  -10.0, 10.0,       NULL },
-
-#ifdef CONFIG_ALSA
-    { "ao_alsa_mixer",               &gtkAOALSAMixer,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "ao_alsa_mixer_channel",       &gtkAOALSAMixerChannel,   CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "ao_alsa_device",              &gtkAOALSADevice,         CONF_TYPE_STRING,      0,           0,     0,          NULL },
-#endif
-
-#ifdef CONFIG_OSS_AUDIO
-    { "ao_oss_mixer",                &gtkAOOSSMixer,           CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "ao_oss_mixer_channel",        &gtkAOOSSMixerChannel,    CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "ao_oss_device",               &gtkAOOSSDevice,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-#endif
-
-#ifdef CONFIG_ESD
-    { "ao_esd_device",               &gtkAOESDDevice,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-#endif
-
-#ifdef CONFIG_SDL
-    { "ao_sdl_subdriver",            &gtkAOSDLDriver,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-#endif
-
-    { "enable_audio_equ",            &gtkEnableAudioEqualizer, CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-    { "equ_channel_1",               &gtkEquChannel1,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "equ_channel_2",               &gtkEquChannel2,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "equ_channel_3",               &gtkEquChannel3,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "equ_channel_4",               &gtkEquChannel4,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "equ_channel_5",               &gtkEquChannel5,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "equ_channel_6",               &gtkEquChannel6,          CONF_TYPE_STRING,      0,           0,     0,          NULL },
-
-#define audio_equ_row(i, j) \
-    { "equ_band_" # i # j,           &gtkEquChannels[i][j],    CONF_TYPE_FLOAT,       CONF_RANGE,  -15.0, 15.0,       NULL }
-    audio_equ_row(0, 0), audio_equ_row(0, 1), audio_equ_row(0, 2), audio_equ_row(0, 3), audio_equ_row(0, 4), audio_equ_row(0, 5), audio_equ_row(0, 6), audio_equ_row(0, 7), audio_equ_row(0, 8), audio_equ_row(0, 9),
-    audio_equ_row(1, 0), audio_equ_row(1, 1), audio_equ_row(1, 2), audio_equ_row(1, 3), audio_equ_row(1, 4), audio_equ_row(1, 5), audio_equ_row(1, 6), audio_equ_row(1, 7), audio_equ_row(1, 8), audio_equ_row(1, 9),
-    audio_equ_row(2, 0), audio_equ_row(2, 1), audio_equ_row(2, 2), audio_equ_row(2, 3), audio_equ_row(2, 4), audio_equ_row(2, 5), audio_equ_row(2, 6), audio_equ_row(2, 7), audio_equ_row(2, 8), audio_equ_row(2, 9),
-    audio_equ_row(3, 0), audio_equ_row(3, 1), audio_equ_row(3, 2), audio_equ_row(3, 3), audio_equ_row(3, 4), audio_equ_row(3, 5), audio_equ_row(3, 6), audio_equ_row(3, 7), audio_equ_row(3, 8), audio_equ_row(3, 9),
-    audio_equ_row(4, 0), audio_equ_row(4, 1), audio_equ_row(4, 2), audio_equ_row(4, 3), audio_equ_row(4, 4), audio_equ_row(4, 5), audio_equ_row(4, 6), audio_equ_row(4, 7), audio_equ_row(4, 8), audio_equ_row(4, 9),
-    audio_equ_row(5, 0), audio_equ_row(5, 1), audio_equ_row(5, 2), audio_equ_row(5, 3), audio_equ_row(5, 4), audio_equ_row(5, 5), audio_equ_row(5, 6), audio_equ_row(5, 7), audio_equ_row(5, 8), audio_equ_row(5, 9),
-#undef audio_equ_row
-
-    { "playbar",                     &gtkEnablePlayBar,        CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "load_fullscreen",             &gtkLoadFullscreen,       CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "show_videowin",               &gtkShowVideoWindow,      CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-    { "gui_save_pos",                &gui_save_pos,            CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "gui_main_pos_x",              &gui_main_pos_x,          CONF_TYPE_INT,         0,           0,     0,          NULL },
-    { "gui_main_pos_y",              &gui_main_pos_y,          CONF_TYPE_INT,         0,           0,     0,          NULL },
-    { "gui_video_out_pos_x",         &gui_video_pos_x,         CONF_TYPE_INT,         0,           0,     0,          NULL },
-    { "gui_video_out_pos_y",         &gui_video_pos_y,         CONF_TYPE_INT,         0,           0,     0,          NULL },
-
-    { "idle",                        &player_idle_mode,        CONF_TYPE_FLAG,        CONF_GLOBAL, 0,     1,          NULL },
-
-    // NOTE TO MYSELF: Do we really need all/any non-gtkOptions, i.e. override mplayer options?
-
-    { "gui_skin",                    &skinName,                CONF_TYPE_STRING,      0,           0,     0,          NULL },
-
-    { "stopxscreensaver",            &stop_xscreensaver,       CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-    { "cdrom_device",                &cdrom_device,            CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "dvd_device",                  &dvd_device,              CONF_TYPE_STRING,      0,           0,     0,          NULL },
-
-    { "osd_level",                   &osd_level,               CONF_TYPE_INT,         CONF_RANGE,  0,     3,          NULL },
-
-    { "vo_driver",                   &video_driver_list,       CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
-    { "v_vfm",                       &video_fm_list,           CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
-
-    { "vf_autoq",                    &auto_quality,            CONF_TYPE_INT,         CONF_RANGE,  0,     100,        NULL },
-    { "vo_direct_render",            &vo_directrendering,      CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "vo_doublebuffering",          &vo_doublebuffering,      CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "vo_panscan",                  &vo_panscan,              CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   1.0,        NULL },
-
-    { "v_flip",                      &flip,                    CONF_TYPE_INT,         CONF_RANGE,  -1,    1,          NULL },
-    { "v_framedrop",                 &frame_dropping,          CONF_TYPE_INT,         CONF_RANGE,  0,     2,          NULL },
-    { "v_idx",                       &index_mode,              CONF_TYPE_INT,         CONF_RANGE,  -1,    2,          NULL },
-    { "v_ni",                        &force_ni,                CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-    { "ao_driver",                   &audio_driver_list,       CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
-    { "a_afm",                       &audio_fm_list,           CONF_TYPE_STRING_LIST, 0,           0,     0,          NULL },
-
-    { "softvol",                     &soft_vol,                CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-    { "sub_auto_load",               &sub_auto,                CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-#ifdef CONFIG_ICONV
-    { "sub_cp",                      &sub_cp,                  CONF_TYPE_STRING,      0,           0,     0,          NULL },
-#endif
-    { "sub_overlap",                 &suboverlap_enabled,      CONF_TYPE_FLAG,        0,           0,     0,          NULL },
-    { "sub_pos",                     &sub_pos,                 CONF_TYPE_INT,         CONF_RANGE,  0,     200,        NULL },
-    { "sub_unicode",                 &sub_unicode,             CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-
-    { "font_factor",                 &font_factor,             CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   10.0,       NULL },
-    { "font_name",                   &font_name,               CONF_TYPE_STRING,      0,           0,     0,          NULL },
-
-#ifdef CONFIG_FREETYPE
-    { "font_encoding",               &subtitle_font_encoding,  CONF_TYPE_STRING,      0,           0,     0,          NULL },
-    { "font_text_scale",             &text_font_scale_factor,  CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   100.0,      NULL },
-    { "font_osd_scale",              &osd_font_scale_factor,   CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   100.0,      NULL },
-    { "font_blur",                   &subtitle_font_radius,    CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   8.0,        NULL },
-    { "font_outline",                &subtitle_font_thickness, CONF_TYPE_FLOAT,       CONF_RANGE,  0.0,   8.0,        NULL },
-    { "font_autoscale",              &subtitle_autoscale,      CONF_TYPE_INT,         CONF_RANGE,  0,     3,          NULL },
-#endif
-
-#ifdef CONFIG_ASS
-    { "ass_enabled",                 &ass_enabled,             CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "ass_use_margins",             &ass_use_margins,         CONF_TYPE_FLAG,        0,           0,     1,          NULL },
-    { "ass_top_margin",              &ass_top_margin,          CONF_TYPE_INT,         CONF_RANGE,  0,     512,        NULL },
-    { "ass_bottom_margin",           &ass_bottom_margin,       CONF_TYPE_INT,         CONF_RANGE,  0,     512,        NULL },
-#endif
-
-    { NULL,                          NULL,                     0,                     0,           0,     0,          NULL }
-};
-
-int cfg_gui_include(m_option_t *conf, const char *file)
-{
-    (void)conf;
-
-    return m_config_parse_config_file(gui_conf, file, 0);
-}
-
-void cfg_read(void)
-{
-    char *fname, line[512];
-    FILE *file;
-
-    player_idle_mode = True;   // GUI is in idle mode by default
-
-    /* configuration */
-
-    fname = get_path(gui_configuration);
-
-    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[cfg] file: %s\n", fname);
-
-    gui_conf = m_config_new();
-
-    if (!gui_conf) {
-        gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
-        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
-    }
-
-    m_config_register_options(gui_conf, gui_opts);
-
-    if (!disable_gui_conf && (m_config_parse_config_file(gui_conf, fname, 1) < 0)) {
-        gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_ConfigFileError "\n");
-        mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
-    }
-
-    free(fname);
-
-    /* playlist */
-
-    fname = get_path(gui_playlist);
-    file  = fopen(fname, "rt");
-
-    if (file) {
-        while (fgetstr(line, sizeof(line), file)) {
-            plItem *item;
-
-            if (!*line)
-                continue;
-
-            item = calloc(1, sizeof(plItem));
-
-            if (!item) {
-                gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
-                mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
-            }
-
-            item->path = strdup(line);
-
-            if (fgetstr(line, sizeof(line), file) && *line) {
-                item->name = strdup(line);
-                listMgr(PLAYLIST_ITEM_APPEND, item);
-            } else {
-                free(item->path);
-                free(item);
-            }
-        }
-
-        fclose(file);
-    }
-
-    free(fname);
-
-    /* URL list */
-
-    fname = get_path(gui_urllist);
-    file  = fopen(fname, "rt");
-
-    if (file) {
-        while (fgetstr(line, sizeof(line), file)) {
-            urlItem *item;
-
-            if (!*line)
-                continue;
-
-            item = calloc(1, sizeof(urlItem));
-
-            if (!item) {
-                gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
-                mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
-            }
-
-            item->url = strdup(line);
-            listMgr(URLLIST_ITEM_ADD, item);
-        }
-
-        fclose(file);
-    }
-
-    free(fname);
-
-    /* directory history */
-
-    fname = get_path(gui_history);
-    file  = fopen(fname, "rt");
-
-    if (file) {
-        unsigned int i = 0;
-
-        while (fgetstr(line, sizeof(line), file))
-            if (*line && (i < FF_ARRAY_ELEMS(fsHistory)))
-                fsHistory[i++] = strdup(line);
-
-        fclose(file);
-    }
-
-    free(fname);
-}
-
-void cfg_write(void)
-{
-    char *fname;
-    FILE *file;
-
-    /* configuration */
-
-    fname = get_path(gui_configuration);
-    file  = fopen(fname, "wt+");
-
-    if (file) {
-        const m_option_t *opts = gui_opts;
-
-        while (opts->name) {
-            char *val = m_option_print(opts, opts->p);
-
-            if (val == (char *)-1) {
-                gmp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, opts->name);
-                val = NULL;
-            }
-
-            if (val) {
-                char delim[] = "\"";
-
-                if (!strchr(val, ' '))
-                    *delim = 0;
-
-                fprintf(file, "%s=%s%s%s\n", opts->name, delim, val, delim);
-                free(val);
-            }
-
-            opts++;
-        }
-
-        fclose(file);
-    }
-
-    free(fname);
-
-    /* playlist */
-
-    fname = get_path(gui_playlist);
-    file  = fopen(fname, "wt+");
-
-    if (file) {
-        plItem *item = listMgr(PLAYLIST_GET, 0);
-
-        while (item) {
-            if (item->path && item->name) {
-                fprintf(file, "%s\n", item->path);
-                fprintf(file, "%s\n", item->name);
-            }
-
-            item = item->next;
-        }
-
-        fclose(file);
-    }
-
-    free(fname);
-
-    /* URL list */
-
-    fname = get_path(gui_urllist);
-    file  = fopen(fname, "wt+");
-
-    if (file) {
-        urlItem *item = listMgr(URLLIST_GET, 0);
-
-        while (item) {
-            if (item->url)
-                fprintf(file, "%s\n", item->url);
-
-            item = item->next;
-        }
-
-        fclose(file);
-    }
-
-    free(fname);
-
-    /* directory history */
-
-    fname = get_path(gui_history);
-    file  = fopen(fname, "wt+");
-
-    if (file) {
-        unsigned int i;
-
-        for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
-            if (fsHistory[i])
-                fprintf(file, "%s\n", fsHistory[i]);
-
-        fclose(file);
-    }
-
-    free(fname);
-}
--- a/gui/cfg.h	Thu Dec 06 02:30:19 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_GUI_CFG_H
-#define MPLAYER_GUI_CFG_H
-
-#include "m_config.h"
-#include "m_option.h"
-
-extern m_config_t *gui_conf;
-
-extern int gtkCacheOn;
-extern int gtkCacheSize;
-
-extern int gtkVfPP;
-extern int gtkVfLAVC;
-
-extern char *gtkDXR3Device;
-
-extern int gtkAutoSyncOn;
-extern int gtkAutoSync;
-
-extern int gtkAONorm;
-extern int gtkAOSurround;
-extern int gtkAOExtraStereo;
-extern float gtkAOExtraStereoMul;
-
-extern char *gtkAOALSAMixer;
-extern char *gtkAOALSAMixerChannel;
-extern char *gtkAOALSADevice;
-
-extern char *gtkAOOSSMixer;
-extern char *gtkAOOSSMixerChannel;
-extern char *gtkAOOSSDevice;
-
-extern char *gtkAOESDDevice;
-
-extern char *gtkAOSDLDriver;
-
-extern int gtkEnableAudioEqualizer;
-extern char *gtkEquChannel1;
-extern char *gtkEquChannel2;
-extern char *gtkEquChannel3;
-extern char *gtkEquChannel4;
-extern char *gtkEquChannel5;
-extern char *gtkEquChannel6;
-extern float gtkEquChannels[6][10];
-
-extern int gtkSubDumpMPSub;
-extern int gtkSubDumpSrt;
-
-typedef struct {
-    int enabled;
-    int use_margins;
-    int top_margin;
-    int bottom_margin;
-} gtkASS_t;
-
-extern gtkASS_t gtkASS;
-
-extern int gtkEnablePlayBar;
-extern int gtkLoadFullscreen;
-extern int gtkShowVideoWindow;
-
-extern int gui_save_pos;
-extern int gui_main_pos_x;
-extern int gui_main_pos_y;
-extern int gui_video_pos_x;
-extern int gui_video_pos_y;
-
-extern int guiWinID;
-
-extern char *skinName;
-
-extern char *fsHistory[5];
-
-int cfg_gui_include(m_option_t *conf, const char *file);
-void cfg_read(void);
-void cfg_write(void);
-
-#endif /* MPLAYER_GUI_CFG_H */
--- a/gui/gui.h	Thu Dec 06 02:30:19 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- * @file
- * @brief Internal declarations and definitions
- */
-
-#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)
-
-/// StreamTypes that are permitted in a playlist
-#define isPlaylistStreamtype (guiInfo.StreamType == STREAMTYPE_FILE || guiInfo.StreamType == STREAMTYPE_STREAM)
-
-#endif /* MPLAYER_GUI_GUI_H */
--- a/gui/interface.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/interface.c	Thu Dec 06 13:47:47 2012 +0000
@@ -22,8 +22,8 @@
 #include <string.h>
 
 #include "interface.h"
-#include "app.h"
-#include "gui.h"
+#include "app/app.h"
+#include "app/gui.h"
 #include "skin/skin.h"
 #include "ui/gmplayer.h"
 #include "ui/widgets.h"
--- a/gui/interface.h	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/interface.h	Thu Dec 06 13:47:47 2012 +0000
@@ -29,7 +29,7 @@
 // These are in support of the non-GUI files that interact with
 // the GUI and that only need to include interface.h for this.
 // ------------------------------------------------------------
-#include "cfg.h"
+#include "app/cfg.h"
 
 extern int use_gui;             // this is defined in mplayer.c
 // ------------------------------------------------------------
--- a/gui/skin/font.h	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/skin/font.h	Thu Dec 06 13:47:47 2012 +0000
@@ -19,7 +19,7 @@
 #ifndef MPLAYER_GUI_FONT_H
 #define MPLAYER_GUI_FONT_H
 
-#include "gui/app.h"
+#include "gui/app/app.h"
 #include "gui/util/bitmap.h"
 
 #define ASCII_CHRS 128   // number of ASCII characters
--- a/gui/skin/skin.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/skin/skin.c	Thu Dec 06 13:47:47 2012 +0000
@@ -26,8 +26,8 @@
 
 #include "skin.h"
 #include "font.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/ui/widgets.h"
 #include "gui/util/cut.h"
--- a/gui/ui/actions.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/actions.c	Thu Dec 06 13:47:47 2012 +0000
@@ -26,8 +26,8 @@
 
 #include "actions.h"
 #include "gmplayer.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/skin/skin.h"
 #include "gui/util/list.h"
--- a/gui/ui/gtk/about.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/about.c	Thu Dec 06 13:47:47 2012 +0000
@@ -17,7 +17,7 @@
  */
 
 #include "config.h"
-#include "gui/app.h"
+#include "gui/app/app.h"
 #include "help_mp.h"
 #include "version.h"
 
--- a/gui/ui/gtk/equalizer.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/equalizer.c	Thu Dec 06 13:47:47 2012 +0000
@@ -26,8 +26,8 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#include "gui/app.h"
-#include "gui/cfg.h"
+#include "gui/app/app.h"
+#include "gui/app/cfg.h"
 #include "gui/interface.h"
 #include "help_mp.h"
 #include "libaf/equalizer.h"
--- a/gui/ui/gtk/fileselect.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/fileselect.c	Thu Dec 06 13:47:47 2012 +0000
@@ -30,8 +30,8 @@
 #include "gui/ui/pixmaps/dir.xpm"
 #include "gui/ui/pixmaps/file.xpm"
 
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/util/list.h"
 #include "gui/util/mem.h"
--- a/gui/ui/gtk/menu.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/menu.c	Thu Dec 06 13:47:47 2012 +0000
@@ -29,8 +29,8 @@
 #include "menu.h"
 #include "gui/ui/widgets.h"
 #include "gui/ui/gmplayer.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 
 #include "stream/stream.h"
--- a/gui/ui/gtk/msgbox.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/msgbox.c	Thu Dec 06 13:47:47 2012 +0000
@@ -18,7 +18,7 @@
 
 #include <string.h>
 
-#include "gui/app.h"
+#include "gui/app/app.h"
 #include "help_mp.h"
 
 #include "gui/ui/pixmaps/error.xpm"
--- a/gui/ui/gtk/playlist.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/playlist.c	Thu Dec 06 13:47:47 2012 +0000
@@ -30,8 +30,8 @@
 #include "help_mp.h"
 #include "stream/stream.h"
 
-#include "gui/cfg.h"
-#include "gui/gui.h"
+#include "gui/app/cfg.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/ui/widgets.h"
 #include "gui/util/list.h"
--- a/gui/ui/gtk/preferences.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/preferences.c	Thu Dec 06 13:47:47 2012 +0000
@@ -39,9 +39,9 @@
 #include "libmpcodecs/dec_video.h"
 #include "sub/font_load.h"
 
-#include "gui/app.h"
-#include "gui/cfg.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/cfg.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/ui/gmplayer.h"
 #include "gui/ui/widgets.h"
--- a/gui/ui/gtk/skinbrowser.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/skinbrowser.c	Thu Dec 06 13:47:47 2012 +0000
@@ -26,9 +26,9 @@
 #include "skinbrowser.h"
 #include "tools.h"
 
-#include "gui/app.h"
-#include "gui/cfg.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/cfg.h"
+#include "gui/app/gui.h"
 #include "gui/skin/skin.h"
 #include "help_mp.h"
 
--- a/gui/ui/gtk/url.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/gtk/url.c	Thu Dec 06 13:47:47 2012 +0000
@@ -29,7 +29,7 @@
 #include "url.h"
 #include "tools.h"
 #include "gui/interface.h"
-#include "gui/app.h"
+#include "gui/app/app.h"
 #include "gui/ui/gmplayer.h"
 #include "gui/ui/widgets.h"
 #include "gui/util/list.h"
--- a/gui/ui/main.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/main.c	Thu Dec 06 13:47:47 2012 +0000
@@ -26,8 +26,8 @@
 
 #include "config.h"
 #include "gmplayer.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/skin/font.h"
 #include "gui/skin/skin.h"
--- a/gui/ui/menu.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/menu.c	Thu Dec 06 13:47:47 2012 +0000
@@ -25,8 +25,8 @@
 
 #include "help_mp.h"
 #include "mp_msg.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gmplayer.h"
 
 #include "widgets.h"
--- a/gui/ui/playbar.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/playbar.c	Thu Dec 06 13:47:47 2012 +0000
@@ -24,8 +24,8 @@
 #include <unistd.h>
 #include <string.h>
 
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/skin/font.h"
 #include "gui/skin/skin.h"
--- a/gui/ui/render.h	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/render.h	Thu Dec 06 13:47:47 2012 +0000
@@ -19,7 +19,7 @@
 #ifndef MPLAYER_GUI_RENDER_H
 #define MPLAYER_GUI_RENDER_H
 
-#include "gui/app.h"
+#include "gui/app/app.h"
 
 void RenderAll(wsTWindow *window, wItem *Items, int nrItems, char *db);
 
--- a/gui/ui/video.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/video.c	Thu Dec 06 13:47:47 2012 +0000
@@ -25,8 +25,8 @@
 #include "mp_core.h"
 
 #include "gmplayer.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "widgets.h"
 
--- a/gui/ui/widgets.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/ui/widgets.c	Thu Dec 06 13:47:47 2012 +0000
@@ -40,8 +40,8 @@
 #include "libvo/x11_common.h"
 
 #include "widgets.h"
-#include "gui/app.h"
-#include "gui/gui.h"
+#include "gui/app/app.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 #include "gui/wm/ws.h"
 
--- a/gui/util/bitmap.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/util/bitmap.c	Thu Dec 06 13:47:47 2012 +0000
@@ -27,7 +27,7 @@
 #include <unistd.h>
 
 #include "bitmap.h"
-#include "gui/gui.h"
+#include "gui/app/gui.h"
 
 #include "help_mp.h"
 #include "libavcodec/avcodec.h"
--- a/gui/util/list.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/util/list.c	Thu Dec 06 13:47:47 2012 +0000
@@ -25,7 +25,7 @@
 #include <string.h>
 
 #include "list.h"
-#include "gui/gui.h"
+#include "gui/app/gui.h"
 #include "string.h"
 
 #include "mp_msg.h"
--- a/gui/util/string.c	Thu Dec 06 02:30:19 2012 +0000
+++ b/gui/util/string.c	Thu Dec 06 13:47:47 2012 +0000
@@ -25,7 +25,7 @@
 #include <string.h>
 
 #include "string.h"
-#include "gui/gui.h"
+#include "gui/app/gui.h"
 #include "gui/interface.h"
 
 #include "config.h"