Subject: UseMenuStyle patch

From: Pekka Marjola <[email-masked]>
Date: 16 Feb 2000 10:43:56 +0200

Here's a patch to implement UseMenuStyle command. This time it should
recreate all information, so DestroyMenuStyle does not dump core.
Might need some cleaning and more testing, though... 

(Please send copies of replies to me, I cannot read the list right
now.)

--- fvwm2.1.bak	Wed Feb 16 10:31:34 2000
+++ fvwm2.1	Wed Feb 16 10:33:40 2000
@@ -1542,7 +1542,8 @@
 ItemFormat,
 VerticalItemSpacing,
 VerticalTitleSpacing,
-AutomaticHotkeys / AutomaticHotkeysOff.
+AutomaticHotkeys / AutomaticHotkeysOff,
+UseMenuStyle.
 
 In the above list some options are listed as option pairs or triples
 with a '/' in between.  These options exclude each other.
@@ -1997,6 +1998,11 @@
 .B AddToMenu
 command.
 
+\fUseMenuStyle\fP copies all menustyle options from given style to
+current style deleting all existing style information. This can be
+used to base styles on other styles by further modifying the style
+copied from old style.
+
 Examples:
 .EX
 MenuStyle * Mwm
@@ -2014,6 +2020,9 @@
 MenuStyle red HilightBackOff, Hilight3DOff
 MenuStyle red Font lucidasanstypewriter-12
 MenuStyle red MenuFace DGradient 64 Red Black
+
+MenuStyle whitered UseMenuStyle red
+MenuStyle whitered Foreground white
 .EE
 Note that all style options could be placed on a single line for each
 style name.
--- menus.c.bak	Tue Feb 15 10:52:12 2000
+++ menus.c	Wed Feb 16 10:24:41 2000
@@ -5234,6 +5234,30 @@
     DestroyPicture(dpy, ST_SIDEPIC(ms));
   if (ST_HAS_SIDE_COLOR(ms) == 1)
     FreeColors(&ST_SIDE_COLOR(ms), 1);
+  if (ST_FACE_NAME(ms))
+    SAFEFREE(ST_FACE_NAME(ms));
+  if (ST_SIDEPIC_NAME(ms))
+    SAFEFREE(ST_SIDEPIC_NAME(ms));
+  if (ST_SIDE_COLOR_NAME(ms))
+    SAFEFREE(ST_SIDE_COLOR_NAME(ms));
+  if (ST_MENU_COLOR_NAMES(ms).fore)
+    SAFEFREE(ST_MENU_COLOR_NAMES(ms).fore);
+  if (ST_MENU_COLOR_NAMES(ms).back)
+    SAFEFREE(ST_MENU_COLOR_NAMES(ms).back);
+  if (ST_MENU_ACTIVE_COLOR_NAMES(ms).fore)
+    SAFEFREE(ST_MENU_ACTIVE_COLOR_NAMES(ms).fore);
+  if (ST_MENU_ACTIVE_COLOR_NAMES(ms).back)
+    SAFEFREE(ST_MENU_ACTIVE_COLOR_NAMES(ms).back);
+  if (ST_MENU_STIPPLE_COLOR_NAMES(ms).fore)
+    SAFEFREE(ST_MENU_STIPPLE_COLOR_NAMES(ms).fore);
+  if (ST_MENU_STIPPLE_COLOR_NAMES(ms).back)
+    SAFEFREE(ST_MENU_STIPPLE_COLOR_NAMES(ms).back);
+  if (ST_MENU_RELIEF_COLOR_NAMES(ms).fore)
+    SAFEFREE(ST_MENU_RELIEF_COLOR_NAMES(ms).fore);
+  if (ST_MENU_RELIEF_COLOR_NAMES(ms).back)
+    SAFEFREE(ST_MENU_RELIEF_COLOR_NAMES(ms).back);
+  if (ST_PSTDFONT_NAME(ms))
+    SAFEFREE(ST_PSTDFONT_NAME(ms));
 
   while(ST_NEXT_STYLE(before) != ms)
     /* Not too many checks, may segfaults in race conditions */
@@ -5528,6 +5552,7 @@
     "VerticalTitleSpacing",
     "MenuColorset", "ActiveColorset", "GreyedColorset",
     "SelectOnRelease",
+    "UseMenuStyle",
     NULL
   };
   return GetTokenIndex(option, optlist, 0, NULL);
@@ -5541,8 +5566,10 @@
   char *nextarg;
   char *args = NULL;
   char *arg1;
+  char *oldstyle;
   MenuStyle *ms;
   MenuStyle *tmpms;
+  MenuStyle *oldms;
   Bool is_initialised = True;
   Bool has_gc_changed = False;
   Bool is_default_style = False;
@@ -5595,7 +5622,21 @@
       ST_HAS_ACTIVE_FORE(tmpms) = 0;
       ST_HAS_ACTIVE_BACK(tmpms) = 0;
       ST_DO_POPUP_AS_ROOT_MENU(tmpms) = 0;
-      has_gc_changed = True;
+      ST_FACE_NAME(tmpms) = NULL;
+      ST_SIDEPIC(tmpms) = NULL;
+      ST_SIDEPIC_NAME(tmpms) = NULL;
+      ST_SIDE_COLOR_NAME(tmpms) = NULL;
+      ST_MENU_COLOR_NAMES(tmpms).fore = NULL;
+      ST_MENU_COLOR_NAMES(tmpms).back = NULL;
+      ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore = NULL;
+      ST_MENU_STIPPLE_COLOR_NAMES(tmpms).back = NULL;
+      ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore = NULL;
+      ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back = NULL;
+      ST_MENU_RELIEF_COLOR_NAMES(tmpms).fore = NULL;
+      ST_MENU_RELIEF_COLOR_NAMES(tmpms).back = NULL;
+      ST_PSTDFONT_NAME(tmpms) = NULL;
+      
+     has_gc_changed = True;
       option = "fvwm";
     }
     else
@@ -5700,8 +5741,13 @@
 
     case 3: /* Foreground */
       FreeColors(&ST_MENU_COLORS(tmpms).fore, 1);
+      SAFEFREE(ST_MENU_COLOR_NAMES(tmpms).fore);
+      ST_MENU_COLOR_NAMES(tmpms).fore = NULL;
       if (arg1)
+      {
+	ST_MENU_COLOR_NAMES(tmpms).fore = strdup(arg1);
 	ST_MENU_COLORS(tmpms).fore = GetColor(arg1);
+      }
       else
 	ST_MENU_COLORS(tmpms).fore = GetColor("black");
       has_gc_changed = True;
@@ -5709,22 +5755,32 @@
 
     case 4: /* Background */
       FreeColors(&ST_MENU_COLORS(tmpms).back, 1);
+      SAFEFREE(ST_MENU_COLOR_NAMES(tmpms).back);
+      ST_MENU_COLOR_NAMES(tmpms).back = NULL;
       if (arg1)
+      {
+	ST_MENU_COLOR_NAMES(tmpms).back = strdup(arg1);
 	ST_MENU_COLORS(tmpms).back = GetColor(arg1);
+      }
       else
-	ST_MENU_COLORS(tmpms).back = GetColor("grey");
+	ST_MENU_COLORS(tmpms).back = GetColor("gray");
       has_gc_changed = True;
       break;
 
     case 5: /* Greyed */
       if (ST_HAS_STIPPLE_FORE(tmpms))
+      {
 	FreeColors(&ST_MENU_STIPPLE_COLORS(tmpms).fore, 1);
+	SAFEFREE(ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore);
+	ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore = NULL;
+      }
       if (arg1 == NULL)
       {
 	ST_HAS_STIPPLE_FORE(tmpms) = 0;
       }
       else
       {
+	ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore = strdup(arg1);
 	ST_MENU_STIPPLE_COLORS(tmpms).fore = GetColor(arg1);
 	ST_HAS_STIPPLE_FORE(tmpms) = 1;
       }
@@ -5733,13 +5789,18 @@
 
     case 6: /* HilightBack */
       if (ST_HAS_ACTIVE_BACK(tmpms))
+      {
 	FreeColors(&ST_MENU_ACTIVE_COLORS(tmpms).back, 1);
+	SAFEFREE(ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back);
+	ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back = NULL;
+      }
       if (arg1 == NULL)
       {
 	ST_HAS_ACTIVE_BACK(tmpms) = 0;
       }
       else
       {
+	ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back = strdup(arg1);
 	ST_MENU_ACTIVE_COLORS(tmpms).back = GetColor(arg1);
 	ST_HAS_ACTIVE_BACK(tmpms) = 1;
       }
@@ -5754,13 +5815,18 @@
 
     case 8: /* ActiveFore */
       if (ST_HAS_ACTIVE_FORE(tmpms))
+      {
 	FreeColors(&ST_MENU_ACTIVE_COLORS(tmpms).fore, 1);
+	SAFEFREE(ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore);
+	ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore = NULL;
+      }
       if (arg1 == NULL)
       {
 	ST_HAS_ACTIVE_FORE(tmpms) = 0;
       }
       else
       {
+	ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore = strdup(arg1);
 	ST_MENU_ACTIVE_COLORS(tmpms).fore = GetColor(arg1);
 	ST_HAS_ACTIVE_FORE(tmpms) = 1;
       }
@@ -5793,6 +5859,8 @@
       break;
 
     case 15: /* Font */
+      SAFEFREE(ST_PSTDFONT_NAME(tmpms));
+      ST_PSTDFONT_NAME(tmpms) = strdup(arg1);
       if (arg1 && !LoadFvwmFont(dpy, arg1, &new_font))
       {
 	fvwm_msg(ERR, "NewMenuStyle",
@@ -5820,6 +5888,8 @@
     case 16: /* MenuFace */
       while (args && *args != '\0' && isspace((unsigned char)*args))
 	args++;
+      SAFEFREE(ST_FACE_NAME(tmpms));
+      ST_FACE_NAME(tmpms) = strdup(args);
       ReadMenuFace(args, &ST_FACE(tmpms), True);
       break;
 
@@ -5914,9 +5984,12 @@
       {
 	DestroyPicture(dpy, ST_SIDEPIC(tmpms));
 	ST_SIDEPIC(tmpms) = NULL;
+	SAFEFREE(ST_SIDEPIC_NAME(tmpms));
+	ST_SIDEPIC_NAME(tmpms) = NULL;
       }
       if (arg1)
       {
+	ST_SIDEPIC_NAME(tmpms) = strdup(arg1);
 	ST_SIDEPIC(tmpms) = CachePicture(dpy, Scr.NoFocusWin, NULL,
 					   arg1, Scr.ColorLimit);
 	if (!ST_SIDEPIC(tmpms))
@@ -5928,10 +6001,13 @@
       if (ST_HAS_SIDE_COLOR(tmpms) == 1)
       {
 	FreeColors(&ST_SIDE_COLOR(tmpms), 1);
+	SAFEFREE(ST_SIDE_COLOR_NAME(tmpms));
+	ST_SIDE_COLOR_NAME(tmpms) = NULL;
 	ST_HAS_SIDE_COLOR(tmpms) = 0;
       }
       if (arg1)
       {
+	ST_SIDE_COLOR_NAME(tmpms) = strdup(arg1);
 	ST_SIDE_COLOR(tmpms) = GetColor(arg1);
 	ST_HAS_SIDE_COLOR(tmpms) = 1;
       }
@@ -6059,7 +6135,192 @@
       }
       ST_SELECT_ON_RELEASE_KEY(tmpms) = keycode;
       break;
-
+    case 50: /* UseMenuStyle */
+      if (GetQuotedString(arg1, &oldstyle, ",", NULL, NULL, NULL) == 0)
+       fvwm_msg(ERR,"NewMenuStyle",
+                "UseMenuStyle requires one argument");
+      else
+      {
+       if (!(oldms = FindMenuStyle(oldstyle)))
+         fvwm_msg(WARN, "NewMenuStyle", "Couldn't find menustyle %s", oldstyle);
+       else
+       {
+         /* copy stuff */
+	 if (ST_MENU_COLOR_NAMES(oldms).fore)
+	 {
+	   SAFEFREE(ST_MENU_COLOR_NAMES(tmpms).fore);
+	   FreeColors(&ST_MENU_COLORS(tmpms).fore, 1);
+	   ST_MENU_COLOR_NAMES(tmpms).fore = strdup(ST_MENU_COLOR_NAMES(oldms).fore);
+	   ST_MENU_COLORS(tmpms).fore = GetColor(ST_MENU_COLOR_NAMES(tmpms).fore);
+	 }
+	 
+	 if (ST_MENU_COLOR_NAMES(oldms).back)
+	 {
+	   SAFEFREE(ST_MENU_COLOR_NAMES(tmpms).back);
+	   FreeColors(&ST_MENU_COLORS(tmpms).back, 1);
+	   ST_MENU_COLOR_NAMES(tmpms).back = strdup(ST_MENU_COLOR_NAMES(oldms).back);
+	   ST_MENU_COLORS(tmpms).back = GetColor(ST_MENU_COLOR_NAMES(tmpms).back);
+	 }
+	 
+         if (ST_HAS_STIPPLE_FORE(oldms) && ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore)
+	 {
+	   SAFEFREE(ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore);
+	   FreeColors(&ST_MENU_STIPPLE_COLORS(tmpms).fore, 1);
+	   ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore = strdup(ST_MENU_STIPPLE_COLOR_NAMES(oldms).fore);
+	   ST_MENU_STIPPLE_COLORS(tmpms).fore = GetColor(ST_MENU_STIPPLE_COLOR_NAMES(tmpms).fore);
+	   ST_HAS_STIPPLE_FORE(tmpms) = 1;
+	 }
+	 
+         if (ST_HAS_ACTIVE_BACK(oldms) && ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back)
+	 {
+	   SAFEFREE(ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back);
+	   FreeColors(&ST_MENU_ACTIVE_COLORS(tmpms).back, 1);
+	   ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back = strdup(ST_MENU_ACTIVE_COLOR_NAMES(oldms).back);
+	   ST_MENU_ACTIVE_COLORS(tmpms).back = GetColor(ST_MENU_ACTIVE_COLOR_NAMES(tmpms).back);
+	   ST_HAS_ACTIVE_BACK(tmpms) = 1;
+	 }
+	 
+	 ST_DO_HILIGHT(tmpms) = ST_DO_HILIGHT(oldms);
+
+         if (ST_HAS_ACTIVE_FORE(oldms) && ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore)
+	 {
+	   SAFEFREE(ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore);
+	   FreeColors(&ST_MENU_ACTIVE_COLORS(tmpms).fore, 1);
+	   ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore = strdup(ST_MENU_ACTIVE_COLOR_NAMES(oldms).fore);
+	   ST_MENU_ACTIVE_COLORS(tmpms).fore = GetColor(ST_MENU_ACTIVE_COLOR_NAMES(tmpms).fore);
+	   ST_HAS_ACTIVE_FORE(tmpms) = 1;
+	 }
+
+	 ST_HAS_ACTIVE_FORE(tmpms) = ST_HAS_ACTIVE_FORE(oldms);
+
+	 ST_RELIEF_THICKNESS(tmpms) = ST_RELIEF_THICKNESS(oldms);
+
+	 ST_IS_ANIMATED(tmpms) = ST_IS_ANIMATED(oldms);
+
+	 if (ST_PSTDFONT(tmpms) && ST_PSTDFONT(tmpms) != &Scr.DefaultFont)
+	 {
+	     printf("font=%s, deffont=%s\n", ST_PSTDFONT(tmpms), &Scr.DefaultFont);
+	   FreeFvwmFont(dpy, ST_PSTDFONT(tmpms));
+	   free(ST_PSTDFONT(tmpms));
+	 }
+	 SAFEFREE(ST_PSTDFONT_NAME(tmpms));
+	 ST_PSTDFONT_NAME(tmpms) = NULL;
+	 if (ST_PSTDFONT_NAME(oldms))
+	   ST_PSTDFONT_NAME(tmpms) = strdup(ST_PSTDFONT_NAME(oldms));
+	 if (ST_PSTDFONT_NAME(tmpms) && !LoadFvwmFont(dpy, ST_PSTDFONT_NAME(tmpms), &new_font))
+	 {
+	   fvwm_msg(ERR, "NewMenuStyle",
+		   "Couldn't load font '%s' or 'fixed'\n", arg1);
+	   break;
+	 }
+	 if (ST_PSTDFONT_NAME(tmpms) == NULL)
+	 {
+	     /* reset to screen font */
+	     ST_PSTDFONT(tmpms) = &Scr.DefaultFont;
+	 }
+	 else
+	 {
+	     ST_PSTDFONT(tmpms) = (FvwmFont *)safemalloc(sizeof(FvwmFont));
+	     *ST_PSTDFONT(tmpms) = new_font;
+	 }
+
+	 SAFEFREE(ST_FACE_NAME(tmpms));
+	 ST_FACE_NAME(tmpms) = NULL;
+
+	 if (ST_FACE_NAME(oldms))
+	   ST_FACE_NAME(tmpms) = strdup(ST_FACE_NAME(oldms));
+	 ReadMenuFace(ST_FACE_NAME(tmpms), &ST_FACE(tmpms), True);
+
+	 ST_POPUP_OFFSET_ADD(tmpms) = ST_POPUP_OFFSET_ADD(oldms);
+	 ST_POPUP_OFFSET_PERCENT(tmpms) = ST_POPUP_OFFSET_PERCENT(oldms);
+      
+	 ST_DO_WARP_TO_TITLE(tmpms) = ST_DO_WARP_TO_TITLE(oldms);
+ 
+	 ST_TITLE_UNDERLINES(tmpms) = ST_TITLE_UNDERLINES(oldms);
+
+	 ST_HAS_LONG_SEPARATORS(tmpms) = ST_HAS_LONG_SEPARATORS(oldms);
+
+	 ST_HAS_TRIANGLE_RELIEF(tmpms) = ST_HAS_TRIANGLE_RELIEF(oldms);
+
+	 ST_DO_POPUP_IMMEDIATELY(tmpms) = ST_DO_POPUP_IMMEDIATELY(oldms);
+
+	 if (ST_SIDEPIC(tmpms))
+	 {
+	     DestroyPicture(dpy, ST_SIDEPIC(tmpms));
+	     ST_SIDEPIC(tmpms) = NULL;
+	     if (ST_SIDEPIC_NAME(tmpms))
+	       SAFEFREE(ST_SIDEPIC_NAME(tmpms));
+	     ST_SIDEPIC_NAME(tmpms) = NULL;
+	 }
+	 
+	 if (ST_SIDEPIC_NAME(oldms))
+	 {
+	     ST_SIDEPIC_NAME(tmpms) = strdup(ST_SIDEPIC_NAME(oldms));
+	     ST_SIDEPIC(tmpms) = CachePicture(dpy, Scr.NoFocusWin, NULL,
+					      ST_SIDEPIC_NAME(oldms),
+					      Scr.ColorLimit);
+	     if (!ST_SIDEPIC(tmpms))
+		 fvwm_msg(WARN, "NewMenuStyle", "Couldn't find pixmap %s", arg1);
+	 }
+	 
+	 if (ST_HAS_SIDE_COLOR(tmpms) == 1)
+	 {
+	     FreeColors(&ST_SIDE_COLOR(tmpms), 1);
+	     if (ST_SIDE_COLOR_NAME(tmpms))
+	       SAFEFREE(ST_SIDE_COLOR_NAME(tmpms));
+	     ST_SIDE_COLOR_NAME(tmpms) = NULL;
+	     ST_HAS_SIDE_COLOR(tmpms) = 0;
+	 }
+	 if (ST_SIDE_COLOR_NAME(oldms))
+	 {
+	     ST_SIDE_COLOR_NAME(tmpms) = strdup(ST_SIDE_COLOR_NAME(oldms));
+	     ST_SIDE_COLOR(tmpms) = GetColor(ST_SIDE_COLOR_NAME(oldms));
+	     ST_HAS_SIDE_COLOR(tmpms) = 1;
+	 }
+
+	 ST_DO_POPUP_AS_ROOT_MENU(tmpms) = ST_DO_POPUP_AS_ROOT_MENU(oldms);
+
+	 ST_DO_UNMAP_SUBMENU_ON_POPDOWN(tmpms) = ST_DO_UNMAP_SUBMENU_ON_POPDOWN(oldms);
+
+	 ST_USE_LEFT_SUBMENUS(tmpms) = ST_USE_LEFT_SUBMENUS(oldms);
+
+	 ST_BORDER_WIDTH(tmpms) = ST_BORDER_WIDTH(oldms);
+
+	 ST_IS_ITEM_RELIEF_REVERSED(tmpms) = ST_IS_ITEM_RELIEF_REVERSED(oldms);
+	 ST_RELIEF_THICKNESS(tmpms) = ST_RELIEF_THICKNESS(oldms);
+
+	 SAFEFREE(ST_ITEM_FORMAT(tmpms));
+	 ST_ITEM_FORMAT(tmpms) = NULL;
+	 if (ST_ITEM_FORMAT(oldms))
+	   ST_ITEM_FORMAT(tmpms) = strdup(ST_ITEM_FORMAT(oldms));
+
+	 ST_USE_AUTOMATIC_HOTKEYS(tmpms) = ST_USE_AUTOMATIC_HOTKEYS(oldms);
+
+	 ST_TITLE_GAP_ABOVE(tmpms) = ST_TITLE_GAP_ABOVE(oldms);
+	 ST_TITLE_GAP_BELOW(tmpms) = ST_TITLE_GAP_BELOW(oldms);
+
+	 ST_HAS_MENU_CSET(tmpms) = ST_HAS_MENU_CSET(oldms);
+	 ST_CSET_MENU(tmpms) = ST_CSET_MENU(oldms);
+	 if (ST_HAS_MENU_CSET(tmpms))
+	     AllocColorset(ST_CSET_MENU(tmpms));
+
+	 ST_HAS_ACTIVE_CSET(tmpms) = ST_HAS_ACTIVE_CSET(oldms);
+	 ST_CSET_ACTIVE(tmpms) = ST_CSET_ACTIVE(oldms);
+	 if (ST_HAS_ACTIVE_CSET(tmpms))
+	     AllocColorset(ST_CSET_ACTIVE(tmpms));
+
+	 ST_HAS_GREYED_CSET(tmpms) = ST_HAS_GREYED_CSET(oldms);
+	 ST_CSET_GREYED(tmpms) = ST_CSET_GREYED(oldms);
+	 if (ST_HAS_GREYED_CSET(tmpms))
+	     AllocColorset(ST_CSET_GREYED(tmpms));
+
+	 ST_SELECT_ON_RELEASE_KEY(tmpms) = ST_SELECT_ON_RELEASE_KEY(oldms);
+	 has_gc_changed = True;
+       }
+       SAFEFREE(oldstyle);
+      }
+      
+      break;
 #if 0
     case 99: /* PositionHints */
       /* to be implemented */
--- menus.h.bak	Tue Feb 15 10:57:43 2000
+++ menus.h	Tue Feb 15 13:35:14 2000
@@ -66,6 +66,10 @@
 #define MAX_ITEM_LABELS  3
 #define MAX_MINI_ICONS   2
 
+#ifndef SAFEFREE
+#define SAFEFREE( p )  {if (p)  free(p);}
+#endif
+
 /*************************
  * MENU STYLE STRUCTURES *
  *************************/
@@ -120,6 +124,7 @@
 typedef struct MenuLook
 {
   MenuFace face;
+  char *face_name;
   struct
   {
     unsigned do_hilight : 1;
@@ -153,7 +158,9 @@
     int greyed;
   } cset;
   Picture *side_picture;
+  char *side_picture_name;
   Pixel side_color;
+  char *side_color_name;
   GC MenuGC;
   GC MenuActiveGC;
   GC MenuActiveBackGC;
@@ -166,7 +173,24 @@
   ColorPair MenuActiveColors;
   ColorPair MenuStippleColors;
   ColorPair MenuReliefColors;
+  struct {
+      char *fore;
+      char *back;
+  } menu_color_names;
+  struct {
+      char *fore;
+      char *back;
+  } menu_active_color_names;
+  struct {
+      char *fore;
+      char *back;
+  } menu_stipple_color_names;
+  struct {
+      char *fore;
+      char *back;
+  } menu_relief_color_names;
   FvwmFont *pStdFont;
+  char *pStdFont_name;
   int FontHeight;              /* menu font height */
 } MenuLook;
 
@@ -195,6 +219,8 @@
 /* look */
 #define ST_FACE(s)                    ((s)->look.face)
 #define MST_FACE(m)                   ((m)->s->ms->look.face)
+#define ST_FACE_NAME(s)               ((s)->look.face_name)
+#define MST_FACE_NAME(m)              ((m)->s->ms->look.face_name)
 #define ST_DO_HILIGHT(s)              ((s)->look.flags.do_hilight)
 #define MST_DO_HILIGHT(m)             ((m)->s->ms->look.flags.do_hilight)
 #define ST_HAS_ACTIVE_FORE(s)         ((s)->look.flags.has_active_fore)
@@ -244,8 +270,12 @@
 #define MST_CSET_GREYED(m)            ((m)->s->ms->look.cset.greyed)
 #define ST_SIDEPIC(s)                 ((s)->look.side_picture)
 #define MST_SIDEPIC(m)                ((m)->s->ms->look.side_picture)
+#define ST_SIDEPIC_NAME(s)            ((s)->look.side_picture_name)
+#define MST_SIDEPIC_NAME(m)           ((m)->s->ms->look.side_picture_name)
 #define ST_SIDE_COLOR(s)              ((s)->look.side_color)
 #define MST_SIDE_COLOR(m)             ((m)->s->ms->look.side_color)
+#define ST_SIDE_COLOR_NAME(s)         ((s)->look.side_color_name)
+#define MST_SIDE_COLOR_NAME(m)        ((m)->s->ms->look.side_color_name)
 #define ST_MENU_GC(s)                 ((s)->look.MenuGC)
 #define MST_MENU_GC(m)                ((m)->s->ms->look.MenuGC)
 #define ST_MENU_ACTIVE_GC(s)          ((s)->look.MenuActiveGC)
@@ -264,14 +294,24 @@
 #define MST_MENU_SHADOW_GC(m)         ((m)->s->ms->look.MenuShadowGC)
 #define ST_MENU_COLORS(s)             ((s)->look.MenuColors)
 #define MST_MENU_COLORS(m)            ((m)->s->ms->look.MenuColors)
+#define ST_MENU_COLOR_NAMES(s)        ((s)->look.menu_color_names)
+#define MST_MENU_COLOR_NAMES(m)       ((m)->s->ms->look.menu_color_names)
 #define ST_MENU_ACTIVE_COLORS(s)      ((s)->look.MenuActiveColors)
 #define MST_MENU_ACTIVE_COLORS(m)     ((m)->s->ms->look.MenuActiveColors)
+#define ST_MENU_ACTIVE_COLOR_NAMES(s) ((s)->look.menu_active_color_names)
+#define MST_MENU_ACTIVE_COLOR_NAMES(m) ((m)->s->ms->look.menu_active_color_names)
 #define ST_MENU_STIPPLE_COLORS(s)     ((s)->look.MenuStippleColors)
 #define MST_MENU_STIPPLE_COLORS(m)    ((m)->s->ms->look.MenuStippleColors)
+#define ST_MENU_STIPPLE_COLOR_NAMES(s)  ((s)->look.menu_stipple_color_names)
+#define MST_MENU_STIPPLE_COLOR_NAMES(m) ((m)->s->ms->look.menu_stipple_color_names)
 #define ST_MENU_RELIEF_COLORS(s)      ((s)->look.MenuReliefColors)
 #define MST_MENU_RELIEF_COLORS(m)     ((m)->s->ms->look.MenuReliefColors)
+#define ST_MENU_RELIEF_COLOR_NAMES(s) ((s)->look.menu_relief_color_names)
+#define MST_MENU_RELIEF_COLOR_NAMES(m) ((m)->s->ms->look.menu_relief_color_names)
 #define ST_PSTDFONT(s)                ((s)->look.pStdFont)
 #define MST_PSTDFONT(m)               ((m)->s->ms->look.pStdFont)
+#define ST_PSTDFONT_NAME(s)           ((s)->look.pStdFont_name)
+#define MST_PSTDFONT_NAME(m)          ((m)->s->ms->look.pStdFont_name)
 #define ST_FONT_HEIGHT(s)             ((s)->look.FontHeight)
 #define MST_FONT_HEIGHT(m)            ((m)->s->ms->look.FontHeight)
 /* feel */

-- 
[email-masked] * http://www.nixu.fi * +358-40-551 4842
pema-init-0.15 @ http://www.nixu.fi/~pema/emacs/
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 16 Feb 2000 09:55:02 +0100

> Might need some cleaning and more testing, though...  

Well, it's a bit late to include it in 2.4, but I'll definitely
apply this patch afterwards.  I suggest a change though: I'd
rather see a 'CopyMenuStyle' command instead (maybe a
'MergeMenuStyle' command too).  The 'Use...Style' way has been
a pain in the past.

Bye

Dominik ^_^

-- 
Dominik Vogt, Agilent Technologies, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/464-4596, fax: 07031/464-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Pekka Marjola <[email-masked]>
Date: 16 Feb 2000 13:07:12 +0200

>>>>> In <[email-masked]>,
>>>>> On Wed, 16 Feb 2000 09:55:02 +0100,
>>>>> "Dominik" == Dominik Vogt <[email-masked]> writes:

Dominik> On Wed, Feb 16, 2000 at 10:43:56AM +0200, [email-masked] wrote:
>> 
>> Here's a patch to implement UseMenuStyle command.

Dominik> Well, it's a bit late to include it in 2.4, but I'll definitely
Dominik> apply this patch afterwards.  I suggest a change though: I'd
Dominik> rather see a 'CopyMenuStyle' command instead (maybe a
Dominik> 'MergeMenuStyle' command too).  The 'Use...Style' way has been
Dominik> a pain in the past.

Actually it works like CopyMenuStyle should work; just change the name
in couple of places in menus.c in the manual page.

How MergeMenuStyle command should work? It's a bit hard to know if
some values have been set, or if the default value is just the same as
the values in copied style. I don't know when I have time to implement
it, but CopyDecor function would be nice to have, too.

(Please Cc replies to me.)

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 16 Feb 2000 12:05:12 +0100

> in couple of places in menus.c in the manual page.

I don't care too much about the name.  WHat I tried to point
out was that an implementation as a *command* is better than
as a menu style.

> the values in copied style.

Someday I'll write the same code as for 'Style's.

> I don't know when I have time to implement

Don't spend work on this.  The next stable release after
2.4 (probably 3.0) won't have decors anymore.  With a
few further enhancements of the Style command decors will
be dead wood.

Bye

Dominik ^_^

---

From: Pekka Marjola <[email-masked]>
Date: 16 Feb 2000 15:35:18 +0200

>>>>> In <[email-masked]>,
>>>>> On Wed, 16 Feb 2000 12:05:12 +0100,

Dominik> I don't care too much about the name.  WHat I tried to point
Dominik> out was that an implementation as a *command* is better than
Dominik> as a menu style.

Will do. It requires some larger changes or lots of duplicate code.
Maybe later today or later this week.

>> the values in copied style.

Dominik> Someday I'll write the same code as for 'Style's.

>> it, but CopyDecor function would be nice to have, too.

Dominik> Don't spend work on this.  The next stable release after
Dominik> 2.4 (probably 3.0) won't have decors anymore.  With a
Dominik> few further enhancements of the Style command decors will
Dominik> be dead wood.

Well, I did ask that ages ago, since I was too lazy to code it myself.
Back then not many of the developers wanted to change the syntax. 

(Still Cc.)