1 /* Menu.c- menu definition
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 2000 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
28 #include <X11/keysym.h>
29 #include <X11/cursorfont.h>
47 #define MAX_SECTION_SIZE 4
49 typedef struct _Panel
{
55 CallbackRec callbacks
;
65 WMPixmap
*markerPix
[LastInfo
];
78 WMTextField
*commandT
; /* command to run */
79 WMButton
*xtermC
; /* inside xterm? */
91 WMTextField
*dcommandT
;
107 Bool dontAsk
; /* whether to comfirm submenu remove */
113 /* about the currently selected item */
114 WEditMenuItem
*currentItem
;
115 InfoType currentType
;
116 WMWidget
*sections
[LastInfo
][MAX_SECTION_SIZE
];
148 static char *commandNames
[] = {
165 #define NEW(type) memset(wmalloc(sizeof(type)), 0, sizeof(type))
168 #define ICON_FILE "menus"
172 static void showData(_Panel
*panel
);
175 static void updateMenuItem(_Panel
*panel
, WEditMenuItem
*item
,
176 WMWidget
*changedWidget
);
178 static void menuItemSelected(struct WEditMenuDelegate
*delegate
,
179 WEditMenu
*menu
, WEditMenuItem
*item
);
181 static void menuItemDeselected(struct WEditMenuDelegate
*delegate
,
182 WEditMenu
*menu
, WEditMenuItem
*item
);
184 static void menuItemCloned(struct WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
185 WEditMenuItem
*origItem
, WEditMenuItem
*newItem
);
187 static void menuItemEdited(struct WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
188 WEditMenuItem
*item
);
190 static Bool
shouldRemoveItem(struct WEditMenuDelegate
*delegate
,
191 WEditMenu
*menu
, WEditMenuItem
*item
);
194 static void freeItemData(ItemData
*data
);
198 static WEditMenuDelegate menuDelegate
= {
209 dataChanged(void *self
, WMNotification
*notif
)
211 _Panel
*panel
= (_Panel
*)self
;
212 WEditMenuItem
*item
= panel
->currentItem
;
213 WMWidget
*w
= (WMWidget
*)WMGetNotificationObject(notif
);
215 updateMenuItem(panel
, item
, w
);
220 buttonClicked(WMWidget
*w
, void *data
)
222 _Panel
*panel
= (_Panel
*)data
;
223 WEditMenuItem
*item
= panel
->currentItem
;
225 updateMenuItem(panel
, item
, w
);
230 icommandLClicked(WMWidget
*w
, void *data
)
232 _Panel
*panel
= (_Panel
*)data
;
235 cmd
= WMGetListSelectedItemRow(w
);
236 if (cmd
== 3 || cmd
== 4) {
237 WMMapWidget(panel
->quickB
);
239 WMUnmapWidget(panel
->quickB
);
242 WMMapWidget(panel
->paramF
);
244 WMUnmapWidget(panel
->paramF
);
257 captureShortcut(Display
*dpy
, _Panel
*panel
)
264 while (panel
->capturing
) {
265 XAllowEvents(dpy
, AsyncKeyboard
, CurrentTime
);
266 WMNextEvent(dpy
, &ev
);
267 if (ev
.type
==KeyPress
&& ev
.xkey
.keycode
!=0) {
268 ksym
= XKeycodeToKeysym(dpy
, ev
.xkey
.keycode
, 0);
269 if (!IsModifierKey(ksym
)) {
270 key
=XKeysymToString(ksym
);
271 panel
->capturing
= 0;
283 if (ev
.xkey
.state
& ControlMask
) {
284 strcat(buffer
, "Control+");
286 if (ev
.xkey
.state
& ShiftMask
) {
287 strcat(buffer
, "Shift+");
289 if (ev
.xkey
.state
& Mod1Mask
) {
290 strcat(buffer
, "Mod1+");
292 if (ev
.xkey
.state
& Mod2Mask
) {
293 strcat(buffer
, "Mod2+");
295 if (ev
.xkey
.state
& Mod3Mask
) {
296 strcat(buffer
, "Mod3+");
298 if (ev
.xkey
.state
& Mod4Mask
) {
299 strcat(buffer
, "Mod4+");
301 if (ev
.xkey
.state
& Mod5Mask
) {
302 strcat(buffer
, "Mod5+");
306 return wstrdup(buffer
);
312 sgrabClicked(WMWidget
*w
, void *data
)
314 _Panel
*panel
= (_Panel
*)data
;
315 Display
*dpy
= WMScreenDisplay(WMWidgetScreen(panel
->parent
));
319 if (w
== panel
->sclearB
) {
320 WMSetTextFieldText(panel
->shortT
, "");
321 updateMenuItem(panel
, panel
->currentItem
, panel
->shortT
);
325 if (!panel
->capturing
) {
326 panel
->capturing
= 1;
327 WMSetButtonText(w
, _("Cancel"));
328 XGrabKeyboard(dpy
, WMWidgetXID(panel
->parent
), True
, GrabModeAsync
,
329 GrabModeAsync
, CurrentTime
);
330 shortcut
= captureShortcut(dpy
, panel
);
332 WMSetTextFieldText(panel
->shortT
, shortcut
);
333 updateMenuItem(panel
, panel
->currentItem
, panel
->shortT
);
337 panel
->capturing
= 0;
338 WMSetButtonText(w
, _("Capture"));
339 XUngrabKeyboard(dpy
, CurrentTime
);
344 changedItemPad(WMWidget
*w
, void *data
)
346 _Panel
*panel
= (_Panel
*)data
;
347 int padn
= WMGetPopUpButtonSelectedItem(w
);
349 WMUnmapWidget(panel
->itemPad
[panel
->currentPad
]);
350 WMMapWidget(panel
->itemPad
[padn
]);
352 panel
->currentPad
= padn
;
357 putNewSubmenu(WEditMenu
*menu
, char *title
)
362 item
= WAddMenuItemWithTitle(menu
, title
);
364 tmp
= WCreateEditMenu(WMWidgetScreen(menu
), title
);
365 WSetEditMenuAcceptsDrop(tmp
, True
);
366 WSetEditMenuDelegate(tmp
, &menuDelegate
);
367 WSetEditMenuSubmenu(menu
, item
, tmp
);
374 putNewItem(_Panel
*panel
, WEditMenu
*menu
, int type
, char *title
)
379 item
= WAddMenuItemWithTitle(menu
, title
);
381 data
= NEW(ItemData
);
383 WSetEditMenuItemData(item
, data
, (WMCallback
*)freeItemData
);
384 WSetEditMenuItemImage(item
, panel
->markerPix
[type
]);
391 makeFactoryMenu(WMWidget
*parent
, int width
)
395 pad
= WCreateEditMenuPad(parent
);
396 WMResizeWidget(pad
, width
, 10);
397 WSetEditMenuMinSize(pad
, wmksize(width
, 0));
398 WSetEditMenuMaxSize(pad
, wmksize(width
, 0));
399 WSetEditMenuSelectable(pad
, False
);
400 WSetEditMenuEditable(pad
, False
);
401 WSetEditMenuIsFactory(pad
, True
);
402 WSetEditMenuDelegate(pad
, &menuDelegate
);
409 createPanel(_Panel
*p
)
411 _Panel
*panel
= (_Panel
*)p
;
412 WMScreen
*scr
= WMWidgetScreen(panel
->parent
);
413 WMColor
*black
= WMBlackColor(scr
);
414 WMColor
*white
= WMWhiteColor(scr
);
415 WMColor
*gray
= WMGrayColor(scr
);
416 WMFont
*bold
= WMBoldSystemFontOfSize(scr
, 12);
417 WMFont
*font
= WMSystemFontOfSize(scr
, 12);
422 menuDelegate
.data
= panel
;
425 panel
->boldFont
= bold
;
426 panel
->normalFont
= font
;
428 panel
->black
= black
;
429 panel
->white
= white
;
434 Display
*dpy
= WMScreenDisplay(scr
);
438 pixm
= WMCreatePixmap(scr
, 7, 7, WMScreenDepth(scr
), True
);
440 pix
= WMGetPixmapXID(pixm
);
442 XDrawLine(dpy
, pix
, WMColorGC(black
), 0, 3, 6, 3);
443 XDrawLine(dpy
, pix
, WMColorGC(black
), 3, 0, 3, 6);
445 XDrawLine(dpy, pix, WMColorGC(black), 1, 0, 3, 3);
446 XDrawLine(dpy, pix, WMColorGC(black), 1, 6, 3, 3);
447 XDrawLine(dpy, pix, WMColorGC(black), 0, 0, 0, 6);
450 pix
= WMGetPixmapMaskXID(pixm
);
452 gc
= XCreateGC(dpy
, pix
, 0, NULL
);
454 XSetForeground(dpy
, gc
, 0);
455 XFillRectangle(dpy
, pix
, gc
, 0, 0, 7, 7);
457 XSetForeground(dpy
, gc
, 1);
458 XDrawLine(dpy
, pix
, gc
, 0, 3, 6, 3);
459 XDrawLine(dpy
, pix
, gc
, 3, 0, 3, 6);
461 panel
->markerPix
[ExternalInfo
] = pixm
;
462 panel
->markerPix
[PipeInfo
] = pixm
;
463 panel
->markerPix
[DirectoryInfo
] = pixm
;
464 panel
->markerPix
[WSMenuInfo
] = pixm
;
465 panel
->markerPix
[WWindowListInfo
] = pixm
;
470 panel
->box
= WMCreateBox(panel
->parent
);
471 WMSetViewExpandsToParent(WMWidgetView(panel
->box
), 2, 2, 2, 2);
473 panel
->typeP
= WMCreatePopUpButton(panel
->box
);
474 WMResizeWidget(panel
->typeP
, 150, 20);
475 WMMoveWidget(panel
->typeP
, 10, 10);
477 WMAddPopUpButtonItem(panel
->typeP
, _("New Items"));
478 WMAddPopUpButtonItem(panel
->typeP
, _("Sample Commands"));
479 WMAddPopUpButtonItem(panel
->typeP
, _("Sample Submenus"));
481 WMSetPopUpButtonAction(panel
->typeP
, changedItemPad
, panel
);
483 WMSetPopUpButtonSelectedItem(panel
->typeP
, 0);
490 pad
= makeFactoryMenu(panel
->box
, 150);
491 WMMoveWidget(pad
, 10, 40);
493 data
= putNewItem(panel
, pad
, ExecInfo
, _("Run Program"));
494 data
= putNewItem(panel
, pad
, CommandInfo
, _("Internal Command"));
495 smenu
= putNewSubmenu(pad
, _("Submenu"));
496 data
= putNewItem(panel
, pad
, ExternalInfo
, _("External Submenu"));
497 data
= putNewItem(panel
, pad
, PipeInfo
, _("Generated Submenu"));
498 data
= putNewItem(panel
, pad
, DirectoryInfo
, _("Directory Contents"));
499 data
= putNewItem(panel
, pad
, WSMenuInfo
, _("Workspace Menu"));
500 data
= putNewItem(panel
, pad
, WWindowListInfo
, _("Window List Menu"));
502 panel
->itemPad
[0] = pad
;
510 sview
= WMCreateScrollView(panel
->box
);
511 WMResizeWidget(sview
, 150, 180);
512 WMMoveWidget(sview
, 10, 40);
513 WMSetScrollViewHasVerticalScroller(sview
, True
);
515 pad
= makeFactoryMenu(panel
->box
, 130);
517 WMSetScrollViewContentView(sview
, WMWidgetView(pad
));
519 data
= putNewItem(panel
, pad
, ExecInfo
, _("XTerm"));
520 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg black -fg white";
522 data
= putNewItem(panel
, pad
, ExecInfo
, _("rxvt"));
523 data
->param
.exec
.command
= "rxvt";
525 data
= putNewItem(panel
, pad
, ExecInfo
, _("ETerm"));
526 data
->param
.exec
.command
= "eterm";
528 data
= putNewItem(panel
, pad
, ExecInfo
, _("Run..."));
529 data
->param
.exec
.command
= _("%a(Run,Type command to run)");
531 data
= putNewItem(panel
, pad
, ExecInfo
, _("Netscape"));
532 data
->param
.exec
.command
= "netscape";
534 data
= putNewItem(panel
, pad
, ExecInfo
, _("gimp"));
535 data
->param
.exec
.command
= "gimp";
537 data
= putNewItem(panel
, pad
, ExecInfo
, _("epic"));
538 data
->param
.exec
.command
= "xterm -e epic";
540 data
= putNewItem(panel
, pad
, ExecInfo
, _("ee"));
541 data
->param
.exec
.command
= "ee";
543 data
= putNewItem(panel
, pad
, ExecInfo
, _("xv"));
544 data
->param
.exec
.command
= "xv";
546 data
= putNewItem(panel
, pad
, ExecInfo
, _("Acrobat Reader"));
547 data
->param
.exec
.command
= "acroread || /usr/local/Acrobat4/bin/acroread";
549 data
= putNewItem(panel
, pad
, ExecInfo
, _("ghostview"));
550 data
->param
.exec
.command
= "gv";
552 data
= putNewItem(panel
, pad
, CommandInfo
, _("Exit Window Maker"));
553 data
->param
.command
.command
= 3;
557 panel
->itemPad
[1] = sview
;
562 WEditMenu
*pad
, *smenu
;
566 sview
= WMCreateScrollView(panel
->box
);
567 WMResizeWidget(sview
, 150, 180);
568 WMMoveWidget(sview
, 10, 40);
569 WMSetScrollViewHasVerticalScroller(sview
, True
);
571 pad
= makeFactoryMenu(panel
->box
, 130);
573 WMSetScrollViewContentView(sview
, WMWidgetView(pad
));
575 data
= putNewItem(panel
, pad
, ExternalInfo
, _("Debian Menu"));
576 data
->param
.pipe
.command
= "/etc/X11/WindowMaker/menu.hook";
578 data
= putNewItem(panel
, pad
, PipeInfo
, _("RedHat Menu"));
579 data
->param
.pipe
.command
= "wmconfig --output wmaker";
581 data
= putNewItem(panel
, pad
, PipeInfo
, _("Menu Conectiva"));
582 data
->param
.pipe
.command
= "wmconfig --output wmaker";
584 data
= putNewItem(panel
, pad
, DirectoryInfo
, _("Themes"));
585 data
->param
.directory
.command
= "setstyle";
586 data
->param
.directory
.directory
= "/usr/share/WindowMaker/Themes /usr/local/share/WindowMaker/Themes $HOME/GNUstep/Library/WindowMaker/Themes";
587 data
->param
.directory
.stripExt
= 1;
589 data
= putNewItem(panel
, pad
, DirectoryInfo
, _("Bg Images (scale)"));
590 data
->param
.directory
.command
= "wmsetbg -u -s";
591 data
->param
.directory
.directory
= "/opt/kde2/share/wallpapers /usr/share/WindowMaker/Backgrounds $HOME/GNUstep/Library/WindowMaker/Backgrounds";
592 data
->param
.directory
.stripExt
= 1;
594 data
= putNewItem(panel
, pad
, DirectoryInfo
, _("Bg Images (tile)"));
595 data
->param
.directory
.command
= "wmsetbg -u -t";
596 data
->param
.directory
.directory
= "/opt/kde2/share/wallpapers /usr/share/WindowMaker/Backgrounds $HOME/GNUstep/Library/WindowMaker/Backgrounds";
597 data
->param
.directory
.stripExt
= 1;
599 smenu
= putNewSubmenu(pad
, _("Assorted XTerms"));
601 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm Yellow on Blue"));
602 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg midnightblue -fg yellow";
604 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm White on Black"));
605 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg black -fg white";
607 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm Black on White"));
608 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg white -fg black";
610 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm Black on Beige"));
611 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg '#bbbb99' -fg black";
613 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm White on Green"));
614 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg '#228822' -fg white";
616 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm White on Olive"));
617 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg '#335533' -fg white";
619 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm Blue on Blue"));
620 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg '#112244' -fg '#88aabb'";
622 data
= putNewItem(panel
, smenu
, ExecInfo
, _("XTerm BIG FONTS"));
623 data
->param
.exec
.command
= "xterm -sb -sl 2000 -bg black -fg white -fn 10x20";
627 panel
->itemPad
[2] = sview
;
631 width
= FRAME_WIDTH
- 20 - 150 - 10 - 2;
633 panel
->optionsF
= WMCreateFrame(panel
->box
);
634 WMResizeWidget(panel
->optionsF
, width
, FRAME_HEIGHT
- 15);
635 WMMoveWidget(panel
->optionsF
, 10 + 150 + 10, 5);
641 panel
->commandF
= WMCreateFrame(panel
->optionsF
);
642 WMResizeWidget(panel
->commandF
, width
, 50);
643 WMMoveWidget(panel
->commandF
, 10, 20);
644 WMSetFrameTitle(panel
->commandF
, _("Program to Run"));
646 panel
->commandT
= WMCreateTextField(panel
->commandF
);
647 WMResizeWidget(panel
->commandT
, width
- 20, 20);
648 WMMoveWidget(panel
->commandT
, 10, 20);
650 WMAddNotificationObserver(dataChanged
, panel
,
651 WMTextDidChangeNotification
,
655 panel
->xtermC
= WMCreateSwitchButton(panel
->commandF
);
656 WMResizeWidget(panel
->xtermC
, width
- 20, 20);
657 WMMoveWidget(panel
->xtermC
, 10, 50);
658 WMSetButtonText(panel
->xtermC
, _("Run the program inside a Xterm"));
660 WMMapSubwidgets(panel
->commandF
);
665 panel
->pathF
= WMCreateFrame(panel
->optionsF
);
666 WMResizeWidget(panel
->pathF
, width
, 150);
667 WMMoveWidget(panel
->pathF
, 10, 40);
668 WMSetFrameTitle(panel
->pathF
, _("Path for Menu"));
670 panel
->pathT
= WMCreateTextField(panel
->pathF
);
671 WMResizeWidget(panel
->pathT
, width
- 20, 20);
672 WMMoveWidget(panel
->pathT
, 10, 20);
674 WMAddNotificationObserver(dataChanged
, panel
,
675 WMTextDidChangeNotification
,
678 label
= WMCreateLabel(panel
->pathF
);
679 WMResizeWidget(label
, width
- 20, 80);
680 WMMoveWidget(label
, 10, 50);
681 WMSetLabelText(label
, _("Enter the path for a file containing a menu\n"
682 "or a list of directories with the programs you\n"
683 "want to have listed in the menu. Ex:\n"
684 "~/GNUstep/Library/WindowMaker/menu\n"
686 "/usr/X11R6/bin ~/xbin"));
688 WMMapSubwidgets(panel
->pathF
);
693 panel
->pipeF
= WMCreateFrame(panel
->optionsF
);
694 WMResizeWidget(panel
->pipeF
, width
, 100);
695 WMMoveWidget(panel
->pipeF
, 10, 50);
696 WMSetFrameTitle(panel
->pipeF
, _("Command"));
698 panel
->pipeT
= WMCreateTextField(panel
->pipeF
);
699 WMResizeWidget(panel
->pipeT
, width
- 20, 20);
700 WMMoveWidget(panel
->pipeT
, 10, 20);
702 WMAddNotificationObserver(dataChanged
, panel
,
703 WMTextDidChangeNotification
,
707 label
= WMCreateLabel(panel
->pipeF
);
708 WMResizeWidget(label
, width
- 20, 40);
709 WMMoveWidget(label
, 10, 50);
710 WMSetLabelText(label
, _("Enter a command that outputs a menu\n"
711 "definition to stdout when invoked."));
713 WMMapSubwidgets(panel
->pipeF
);
718 panel
->dcommandF
= WMCreateFrame(panel
->optionsF
);
719 WMResizeWidget(panel
->dcommandF
, width
, 90);
720 WMMoveWidget(panel
->dcommandF
, 10, 25);
721 WMSetFrameTitle(panel
->dcommandF
, _("Command to Open Files"));
723 panel
->dcommandT
= WMCreateTextField(panel
->dcommandF
);
724 WMResizeWidget(panel
->dcommandT
, width
- 20, 20);
725 WMMoveWidget(panel
->dcommandT
, 10, 20);
727 WMAddNotificationObserver(dataChanged
, panel
,
728 WMTextDidChangeNotification
,
732 label
= WMCreateLabel(panel
->dcommandF
);
733 WMResizeWidget(label
, width
- 20, 45);
734 WMMoveWidget(label
, 10, 40);
735 WMSetLabelText(label
, _("Enter the command you want to use to open the\n"
736 "files in the directories listed below."));
738 WMMapSubwidgets(panel
->dcommandF
);
741 panel
->dpathF
= WMCreateFrame(panel
->optionsF
);
742 WMResizeWidget(panel
->dpathF
, width
, 80);
743 WMMoveWidget(panel
->dpathF
, 10, 125);
744 WMSetFrameTitle(panel
->dpathF
, _("Directories with Files"));
746 panel
->dpathT
= WMCreateTextField(panel
->dpathF
);
747 WMResizeWidget(panel
->dpathT
, width
- 20, 20);
748 WMMoveWidget(panel
->dpathT
, 10, 20);
750 WMAddNotificationObserver(dataChanged
, panel
,
751 WMTextDidChangeNotification
,
754 panel
->dstripB
= WMCreateSwitchButton(panel
->dpathF
);
755 WMResizeWidget(panel
->dstripB
, width
- 20, 20);
756 WMMoveWidget(panel
->dstripB
, 10, 50);
757 WMSetButtonText(panel
->dstripB
, _("Strip extensions from file names"));
759 WMSetButtonAction(panel
->dstripB
, buttonClicked
, panel
);
761 WMMapSubwidgets(panel
->dpathF
);
766 panel
->shortF
= WMCreateFrame(panel
->optionsF
);
767 WMResizeWidget(panel
->shortF
, width
, 50);
768 WMMoveWidget(panel
->shortF
, 10, 160);
769 WMSetFrameTitle(panel
->shortF
, _("Keyboard Shortcut"));
771 panel
->shortT
= WMCreateTextField(panel
->shortF
);
772 WMResizeWidget(panel
->shortT
, width
- 20 - 170, 20);
773 WMMoveWidget(panel
->shortT
, 10, 20);
775 WMAddNotificationObserver(dataChanged
, panel
,
776 WMTextDidChangeNotification
,
779 panel
->sgrabB
= WMCreateCommandButton(panel
->shortF
);
780 WMResizeWidget(panel
->sgrabB
, 80, 24);
781 WMMoveWidget(panel
->sgrabB
, width
- 90, 18);
782 WMSetButtonText(panel
->sgrabB
, _("Capture"));
783 WMSetButtonAction(panel
->sgrabB
, sgrabClicked
, panel
);
785 panel
->sclearB
= WMCreateCommandButton(panel
->shortF
);
786 WMResizeWidget(panel
->sclearB
, 80, 24);
787 WMMoveWidget(panel
->sclearB
, width
- 175, 18);
788 WMSetButtonText(panel
->sclearB
, _("Clear"));
789 WMSetButtonAction(panel
->sclearB
, sgrabClicked
, panel
);
791 WMMapSubwidgets(panel
->shortF
);
793 /* internal command */
795 panel
->icommandL
= WMCreateList(panel
->optionsF
);
796 WMResizeWidget(panel
->icommandL
, width
, 80);
797 WMMoveWidget(panel
->icommandL
, 10, 20);
799 WMSetListAction(panel
->icommandL
, icommandLClicked
, panel
);
801 WMAddNotificationObserver(dataChanged
, panel
,
802 WMListSelectionDidChangeNotification
,
805 WMInsertListItem(panel
->icommandL
, 0, _("Arrange Icons"));
806 WMInsertListItem(panel
->icommandL
, 1, _("Hide All Windows Except For The Focused One"));
807 WMInsertListItem(panel
->icommandL
, 2, _("Show All Windows"));
809 WMInsertListItem(panel
->icommandL
, 3, _("Exit Window Maker"));
810 WMInsertListItem(panel
->icommandL
, 4, _("Exit X Session"));
811 WMInsertListItem(panel
->icommandL
, 5, _("Restart Window Maker"));
812 WMInsertListItem(panel
->icommandL
, 6, _("Start Another Window Manager : ("));
814 WMInsertListItem(panel
->icommandL
, 7, _("Save Current Session"));
815 WMInsertListItem(panel
->icommandL
, 8, _("Clear Saved Session"));
816 WMInsertListItem(panel
->icommandL
, 9, _("Refresh Screen"));
817 WMInsertListItem(panel
->icommandL
, 10, _("Open Info Panel"));
818 WMInsertListItem(panel
->icommandL
, 11, _("Open Copyright Panel"));
821 panel
->paramF
= WMCreateFrame(panel
->optionsF
);
822 WMResizeWidget(panel
->paramF
, width
, 50);
823 WMMoveWidget(panel
->paramF
, 10, 105);
824 WMSetFrameTitle(panel
->paramF
, _("Window Manager to Start"));
826 panel
->paramT
= WMCreateTextField(panel
->paramF
);
827 WMResizeWidget(panel
->paramT
, width
- 20, 20);
828 WMMoveWidget(panel
->paramT
, 10, 20);
830 WMAddNotificationObserver(dataChanged
, panel
,
831 WMTextDidChangeNotification
,
834 WMMapSubwidgets(panel
->paramF
);
837 panel
->quickB
= WMCreateSwitchButton(panel
->optionsF
);
838 WMResizeWidget(panel
->quickB
, width
, 20);
839 WMMoveWidget(panel
->quickB
, 10, 120);
840 WMSetButtonText(panel
->quickB
, _("Do not confirm action."));
841 WMSetButtonAction(panel
->quickB
, buttonClicked
, panel
);
846 label
= WMCreateLabel(panel
->optionsF
);
847 WMResizeWidget(label
, width
- 10, FRAME_HEIGHT
- 50);
848 WMMoveWidget(label
, 10, 20);
849 WMSetLabelText(label
,
850 _("Instructions:\n\n"
851 " - drag items from the left to the menu to add new items\n"
852 " - drag items out of the menu to remove items\n"
853 " - drag items in menu to change their position\n"
854 " - drag items with Control pressed to copy them\n"
855 " - double click in a menu item to change the label\n"
856 " - click on a menu item to change related information"));
859 WMRealizeWidget(panel
->box
);
860 WMMapSubwidgets(panel
->box
);
861 WMMapWidget(panel
->box
);
866 for (i
= 0; i
< 3; i
++)
867 WMUnmapWidget(panel
->itemPad
[i
]);
869 changedItemPad(panel
->typeP
, panel
);
871 panel
->sections
[NoInfo
][0] = label
;
873 panel
->sections
[ExecInfo
][0] = panel
->commandF
;
874 panel
->sections
[ExecInfo
][1] = panel
->shortF
;
876 panel
->sections
[CommandInfo
][0] = panel
->icommandL
;
877 panel
->sections
[CommandInfo
][1] = panel
->shortF
;
879 panel
->sections
[ExternalInfo
][0] = panel
->pathF
;
881 panel
->sections
[PipeInfo
][0] = panel
->pipeF
;
883 panel
->sections
[DirectoryInfo
][0] = panel
->dpathF
;
884 panel
->sections
[DirectoryInfo
][1] = panel
->dcommandF
;
886 panel
->currentType
= NoInfo
;
893 pos
= WMGetViewScreenPosition(WMWidgetView(panel
->box
));
896 pos
.x
+= FRAME_WIDTH
+ 20;
901 pos
.y
= WMAX(pos
.y
- 100, 0);
903 WEditMenuShowAt(panel
->menu
, pos
.x
, pos
.y
);
911 freeItemData(ItemData
*data
)
913 #define CFREE(d) if (d) wfree(d)
916 switch (data
->type
) {
918 CFREE(data
->param
.command
.parameter
);
919 CFREE(data
->param
.command
.shortcut
);
923 CFREE(data
->param
.exec
.command
);
924 CFREE(data
->param
.exec
.shortcut
);
928 CFREE(data
->param
.pipe
.command
);
932 CFREE(data
->param
.external
.path
);
936 CFREE(data
->param
.directory
.command
);
937 CFREE(data
->param
.directory
.directory
);
950 parseCommand(WMPropList
*item
)
952 ItemData
*data
= NEW(ItemData
);
954 char *command
= NULL
;
955 char *parameter
= NULL
;
956 char *shortcut
= NULL
;
960 p
= WMGetFromPLArray(item
, i
++);
961 command
= WMGetFromPLString(p
);
962 if (strcmp(command
, "SHORTCUT") == 0) {
963 p
= WMGetFromPLArray(item
, i
++);
964 shortcut
= WMGetFromPLString(p
);
965 p
= WMGetFromPLArray(item
, i
++);
966 command
= WMGetFromPLString(p
);
968 p
= WMGetFromPLArray(item
, i
++);
970 parameter
= WMGetFromPLString(p
);
972 if (strcmp(command
, "EXEC") == 0 || strcmp(command
, "SHEXEC") == 0) {
974 data
->type
= ExecInfo
;
976 data
->param
.exec
.command
= wstrdup(parameter
);
978 data
->param
.exec
.shortcut
= wstrdup(shortcut
);
980 } else if (strcmp(command
, "OPEN_MENU") == 0) {
983 * dir menu, menu file
985 * |pipe (TODO: ||pipe)
988 while (isspace(*p
) && *p
) p
++;
990 data
->type
= PipeInfo
;
991 data
->param
.pipe
.command
= wtrimspace(p
+1);
997 s
= strstr(p
, "WITH");
1004 data
->type
= DirectoryInfo
;
1008 while (*s
&& isspace(*s
)) s
++;
1009 data
->param
.directory
.command
= wstrdup(s
);
1011 wtokensplit(p
, &tokens
, &tokn
);
1014 ctokens
= wmalloc(sizeof(char*)*tokn
);
1016 for (i
= 0, j
= 0; i
< tokn
; i
++) {
1017 if (strcmp(tokens
[i
], "-noext") == 0) {
1019 data
->param
.directory
.stripExt
= 1;
1021 ctokens
[j
++] = tokens
[i
];
1024 data
->param
.directory
.directory
= wtokenjoin(ctokens
, j
);
1027 wtokenfree(tokens
, tokn
);
1029 data
->type
= ExternalInfo
;
1030 data
->param
.external
.path
= p
;
1033 } else if (strcmp(command
, "WORKSPACE_MENU") == 0) {
1034 data
->type
= WSMenuInfo
;
1035 } else if (strcmp(command
, "WINDOWS_MENU") == 0) {
1036 data
->type
= WWindowListInfo
;
1040 if (strcmp(command
, "ARRANGE_ICONS") == 0) {
1042 } else if (strcmp(command
, "HIDE_OTHERS") == 0) {
1044 } else if (strcmp(command
, "SHOW_ALL") == 0) {
1046 } else if (strcmp(command
, "EXIT") == 0) {
1048 } else if (strcmp(command
, "SHUTDOWN") == 0) {
1050 } else if (strcmp(command
, "RESTART") == 0) {
1056 } else if (strcmp(command
, "SAVE_SESSION") == 0) {
1058 } else if (strcmp(command
, "CLEAR_SESSION") == 0) {
1060 } else if (strcmp(command
, "REFRESH") == 0) {
1062 } else if (strcmp(command
, "INFO_PANEL") == 0) {
1064 } else if (strcmp(command
, "LEGAL_PANEL") == 0) {
1067 wwarning(_("unknown command '%s' in menu"), command
);
1071 data
->type
= CommandInfo
;
1073 data
->param
.command
.command
= cmd
;
1075 data
->param
.command
.shortcut
= wstrdup(shortcut
);
1077 data
->param
.command
.parameter
= wstrdup(parameter
);
1092 updateFrameTitle(_Panel
*panel
, char *title
, InfoType type
)
1094 if (type
!= NoInfo
) {
1099 tmp
= wstrconcat(title
, _(": Execute Program"));
1103 tmp
= wstrconcat(title
, _(": Perform Internal Command"));
1107 tmp
= wstrconcat(title
, _(": Open a Submenu"));
1111 tmp
= wstrconcat(title
, _(": Program Generated Submenu"));
1115 tmp
= wstrconcat(title
, _(": Directory Contents Menu"));
1119 tmp
= wstrconcat(title
, _(": Open Workspaces Submenu"));
1122 case WWindowListInfo
:
1123 tmp
= wstrconcat(title
, _(": Open Window List Submenu"));
1130 WMSetFrameTitle(panel
->optionsF
, tmp
);
1133 WMSetFrameTitle(panel
->optionsF
, NULL
);
1140 changeInfoType(_Panel
*panel
, char *title
, InfoType type
)
1144 if (panel
->currentType
!= type
) {
1146 w
= panel
->sections
[panel
->currentType
];
1152 WMUnmapWidget(panel
->paramF
);
1153 WMUnmapWidget(panel
->quickB
);
1156 w
= panel
->sections
[type
];
1164 updateFrameTitle(panel
, title
, type
);
1166 panel
->currentType
= type
;
1173 updateMenuItem(_Panel
*panel
, WEditMenuItem
*item
, WMWidget
*changedWidget
)
1175 ItemData
*data
= WGetEditMenuItemData(item
);
1177 assert(data
!= NULL
);
1179 #define REPLACE(v, d) if (v) wfree(v); v = d
1181 switch (data
->type
) {
1183 if (changedWidget
== panel
->commandT
) {
1184 REPLACE(data
->param
.exec
.command
,
1185 WMGetTextFieldText(panel
->commandT
));
1187 if (changedWidget
== panel
->shortT
) {
1188 REPLACE(data
->param
.exec
.shortcut
,
1189 WMGetTextFieldText(panel
->shortT
));
1194 if (changedWidget
== panel
->icommandL
) {
1195 data
->param
.command
.command
=
1196 WMGetListSelectedItemRow(panel
->icommandL
);
1198 switch (data
->param
.command
.command
) {
1201 if (changedWidget
== panel
->quickB
) {
1202 REPLACE(data
->param
.command
.parameter
,
1203 WMGetButtonSelected(panel
->quickB
)
1204 ? wstrdup("QUICK") : NULL
);
1209 if (changedWidget
== panel
->paramT
) {
1210 REPLACE(data
->param
.command
.parameter
,
1211 WMGetTextFieldText(panel
->paramT
));
1215 if (changedWidget
== panel
->shortT
) {
1216 REPLACE(data
->param
.command
.shortcut
,
1217 WMGetTextFieldText(panel
->shortT
));
1224 if (changedWidget
== panel
->pipeT
) {
1225 REPLACE(data
->param
.pipe
.command
,
1226 WMGetTextFieldText(panel
->pipeT
));
1231 if (changedWidget
== panel
->pathT
) {
1232 REPLACE(data
->param
.external
.path
,
1233 WMGetTextFieldText(panel
->pathT
));
1238 if (changedWidget
== panel
->dpathT
) {
1239 REPLACE(data
->param
.directory
.directory
,
1240 WMGetTextFieldText(panel
->dpathT
));
1242 if (changedWidget
== panel
->dcommandT
) {
1243 REPLACE(data
->param
.directory
.command
,
1244 WMGetTextFieldText(panel
->dcommandT
));
1246 if (changedWidget
== panel
->dstripB
) {
1247 data
->param
.directory
.stripExt
=
1248 WMGetButtonSelected(panel
->dstripB
);
1263 menuItemCloned(WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
1264 WEditMenuItem
*origItem
, WEditMenuItem
*newItem
)
1266 ItemData
*data
= WGetEditMenuItemData(origItem
);
1272 #define DUP(s) (s) ? wstrdup(s) : NULL
1274 newData
= NEW(ItemData
);
1276 newData
->type
= data
->type
;
1278 switch (data
->type
) {
1280 newData
->param
.exec
.command
= DUP(data
->param
.exec
.command
);
1281 newData
->param
.exec
.shortcut
= DUP(data
->param
.exec
.shortcut
);
1285 newData
->param
.command
.command
= data
->param
.command
.command
;
1286 newData
->param
.command
.parameter
= DUP(data
->param
.command
.parameter
);
1287 newData
->param
.command
.shortcut
= DUP(data
->param
.command
.shortcut
);
1291 newData
->param
.pipe
.command
= DUP(data
->param
.pipe
.command
);
1295 newData
->param
.external
.path
= DUP(data
->param
.external
.path
);
1299 newData
->param
.directory
.directory
= DUP(data
->param
.directory
.directory
);
1300 newData
->param
.directory
.command
= DUP(data
->param
.directory
.command
);
1301 newData
->param
.directory
.stripExt
= data
->param
.directory
.stripExt
;
1310 WSetEditMenuItemData(newItem
, newData
, (WMCallback
*)freeItemData
);
1315 menuItemEdited(struct WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
1316 WEditMenuItem
*item
)
1318 _Panel
*panel
= (_Panel
*)delegate
->data
;
1321 updateFrameTitle(panel
, WGetEditMenuItemTitle(item
), panel
->currentType
);
1323 submenu
= WGetEditMenuSubmenu(menu
, item
);
1325 WSetEditMenuTitle(submenu
, WGetEditMenuItemTitle(item
));
1331 shouldRemoveItem(struct WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
1332 WEditMenuItem
*item
)
1334 _Panel
*panel
= (_Panel
*)delegate
->data
;
1339 if (WGetEditMenuSubmenu(menu
, item
)) {
1342 res
= WMRunAlertPanel(WMWidgetScreen(menu
), NULL
,
1343 _("Remove Submenu"),
1344 _("Removing this item will destroy all items inside\n"
1345 "the submenu. Do you really want to do that?"),
1347 _("Yes, don't ask again."));
1354 panel
->dontAsk
= True
;
1363 menuItemDeselected(WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
1364 WEditMenuItem
*item
)
1366 _Panel
*panel
= (_Panel
*)delegate
->data
;
1368 changeInfoType(panel
, NULL
, NoInfo
);
1373 menuItemSelected(WEditMenuDelegate
*delegate
, WEditMenu
*menu
,
1374 WEditMenuItem
*item
)
1376 ItemData
*data
= WGetEditMenuItemData(item
);
1377 _Panel
*panel
= (_Panel
*)delegate
->data
;
1379 panel
->currentItem
= item
;
1382 changeInfoType(panel
, WGetEditMenuItemTitle(item
), data
->type
);
1384 switch (data
->type
) {
1389 WMSetTextFieldText(panel
->commandT
, data
->param
.exec
.command
);
1390 WMSetTextFieldText(panel
->shortT
, data
->param
.exec
.shortcut
);
1394 WMSelectListItem(panel
->icommandL
,
1395 data
->param
.command
.command
);
1396 WMSetListPosition(panel
->icommandL
,
1397 data
->param
.command
.command
- 2);
1398 WMSetTextFieldText(panel
->shortT
, data
->param
.command
.shortcut
);
1400 switch (data
->param
.command
.command
) {
1403 WMSetButtonSelected(panel
->quickB
,
1404 data
->param
.command
.parameter
!=NULL
);
1407 WMSetTextFieldText(panel
->paramT
,
1408 data
->param
.command
.parameter
);
1412 icommandLClicked(panel
->icommandL
, panel
);
1416 WMSetTextFieldText(panel
->pipeT
, data
->param
.pipe
.command
);
1420 WMSetTextFieldText(panel
->pathT
, data
->param
.external
.path
);
1424 WMSetTextFieldText(panel
->dpathT
, data
->param
.directory
.directory
);
1425 WMSetTextFieldText(panel
->dcommandT
, data
->param
.directory
.command
);
1426 WMSetButtonSelected(panel
->dstripB
, data
->param
.directory
.stripExt
);
1441 buildSubmenu(_Panel
*panel
, WMPropList
*pl
)
1443 WMScreen
*scr
= WMWidgetScreen(panel
->parent
);
1445 WEditMenuItem
*item
;
1447 WMPropList
*tp
, *bp
;
1450 tp
= WMGetFromPLArray(pl
, 0);
1451 title
= WMGetFromPLString(tp
);
1453 menu
= WCreateEditMenu(scr
, title
);
1455 for (i
= 1; i
< WMGetPropListItemCount(pl
); i
++) {
1458 pi
= WMGetFromPLArray(pl
, i
);
1460 tp
= WMGetFromPLArray(pi
, 0);
1461 bp
= WMGetFromPLArray(pi
, 1);
1463 title
= WMGetFromPLString(tp
);
1465 if (!bp
|| WMIsPLArray(bp
)) { /* it's a submenu */
1468 submenu
= buildSubmenu(panel
, pi
);
1470 item
= WAddMenuItemWithTitle(menu
, title
);
1472 WSetEditMenuSubmenu(menu
, item
, submenu
);
1476 item
= WAddMenuItemWithTitle(menu
, title
);
1478 data
= parseCommand(pi
);
1480 if (panel
->markerPix
[data
->type
])
1481 WSetEditMenuItemImage(item
, panel
->markerPix
[data
->type
]);
1482 WSetEditMenuItemData(item
, data
, (WMCallback
*)freeItemData
);
1486 WSetEditMenuAcceptsDrop(menu
, True
);
1487 WSetEditMenuDelegate(menu
, &menuDelegate
);
1489 WMRealizeWidget(menu
);
1497 buildMenuFromPL(_Panel
*panel
, WMPropList
*pl
)
1499 panel
->menu
= buildSubmenu(panel
, pl
);
1505 getDefaultMenu(_Panel
*panel
)
1507 WMPropList
*menu
, *pmenu
;
1508 char *menuPath
, *gspath
;
1510 gspath
= wusergnusteppath();
1512 menuPath
= wmalloc(strlen(gspath
)+128);
1513 /* if there is a localized plmenu for the tongue put it's filename here */
1514 sprintf(menuPath
, _("%s/Library/WindowMaker/plmenu"), gspath
);
1516 menu
= WMReadPropListFromFile(menuPath
);
1518 wwarning("%s:could not read property list menu", menuPath
);
1520 if (strcmp("%s/Library/WindowMaker/plmenu",
1521 _("%s/Library/WindowMaker/plmenu"))!=0) {
1523 sprintf(menuPath
, "%s/Library/WindowMaker/plmenu", gspath
);
1524 menu
= WMReadPropListFromFile(menuPath
);
1525 wwarning("%s:could not read property list menu", menuPath
);
1530 sprintf(buffer
, _("Could not open default menu from '%s'"),
1532 WMRunAlertPanel(WMWidgetScreen(panel
->parent
), panel
->parent
,
1533 _("Error"), buffer
, _("OK"), NULL
, NULL
);
1550 showData(_Panel
*panel
)
1556 gspath
= wusergnusteppath();
1558 menuPath
= wmalloc(strlen(gspath
)+32);
1559 strcpy(menuPath
, gspath
);
1560 strcat(menuPath
, "/Defaults/WMRootMenu");
1562 pmenu
= WMReadPropListFromFile(menuPath
);
1564 if (!pmenu
|| !WMIsPLArray(pmenu
)) {
1567 res
= WMRunAlertPanel(WMWidgetScreen(panel
->parent
), panel
->parent
,
1569 _("The menu file format currently in use is not supported\n"
1570 "by this tool. Do you want to discard the current menu\n"
1571 "to use this tool?"),
1572 _("Yes, Discard and Update"),
1573 _("No, Keep Current Menu"), NULL
);
1575 if (res
== WAPRDefault
) {
1576 pmenu
= getDefaultMenu(panel
);
1579 pmenu
= WMCreatePLArray(WMCreatePLString("Applications"),
1583 panel
->dontSave
= True
;
1588 panel
->menuPath
= menuPath
;
1590 buildMenuFromPL(panel
, pmenu
);
1592 WMReleasePropList(pmenu
);
1610 processData(char *title
, ItemData
*data
)
1614 static WMPropList
*pscut
= NULL
;
1615 static WMPropList
*pomenu
= NULL
;
1619 pscut
= WMCreatePLString("SHORTCUT");
1620 pomenu
= WMCreatePLString("OPEN_MENU");
1623 item
= WMCreatePLArray(WMCreatePLString(title
), NULL
);
1626 switch (data
->type
) {
1628 if (data
->param
.exec
.command
== NULL
)
1631 if (strpbrk(data
->param
.exec
.command
, "&$*|><?`=;")) {
1640 if (notblank(data
->param
.exec
.shortcut
)) {
1641 WMAddToPLArray(item
, pscut
);
1642 WMAddToPLArray(item
,
1643 WMCreatePLString(data
->param
.exec
.shortcut
));
1646 WMAddToPLArray(item
, WMCreatePLString(s1
));
1647 WMAddToPLArray(item
, WMCreatePLString(data
->param
.exec
.command
));
1651 if (notblank(data
->param
.command
.shortcut
)) {
1652 WMAddToPLArray(item
, pscut
);
1653 WMAddToPLArray(item
,
1654 WMCreatePLString(data
->param
.command
.shortcut
));
1657 i
= data
->param
.command
.command
;
1659 WMAddToPLArray(item
, WMCreatePLString(commandNames
[i
]));
1664 if (data
->param
.command
.parameter
) {
1665 WMAddToPLArray(item
,
1666 WMCreatePLString(data
->param
.command
.parameter
));
1670 case 6: /* restart */
1671 if (data
->param
.command
.parameter
) {
1672 WMAddToPLArray(item
,
1673 WMCreatePLString(data
->param
.command
.parameter
));
1681 if (!data
->param
.pipe
.command
)
1683 WMAddToPLArray(item
, pomenu
);
1684 s1
= wstrconcat("| ", data
->param
.pipe
.command
);
1685 WMAddToPLArray(item
, WMCreatePLString(s1
));
1690 if (!data
->param
.external
.path
)
1692 WMAddToPLArray(item
, pomenu
);
1693 WMAddToPLArray(item
, WMCreatePLString(data
->param
.external
.path
));
1697 if (!data
->param
.directory
.directory
1698 || !data
->param
.directory
.command
)
1704 l
= strlen(data
->param
.directory
.directory
);
1705 l
+= strlen(data
->param
.directory
.command
);
1708 WMAddToPLArray(item
, pomenu
);
1711 sprintf(tmp
, "%s%s WITH %s",
1712 data
->param
.directory
.stripExt
? "-noext " : "",
1713 data
->param
.directory
.directory
,
1714 data
->param
.directory
.command
);
1716 WMAddToPLArray(item
, WMCreatePLString(tmp
));
1722 WMAddToPLArray(item
, WMCreatePLString("WORKSPACE_MENU"));
1725 case WWindowListInfo
:
1726 WMAddToPLArray(item
, WMCreatePLString("WINDOWS_MENU"));
1739 processSubmenu(WEditMenu
*menu
)
1741 WEditMenuItem
*item
;
1748 s
= WGetEditMenuTitle(menu
);
1749 pl
= WMCreatePLString(s
);
1751 pmenu
= WMCreatePLArray(pl
, NULL
);
1754 while ((item
= WGetEditMenuItem(menu
, i
++))) {
1757 s
= WGetEditMenuItemTitle(item
);
1759 submenu
= WGetEditMenuSubmenu(menu
, item
);
1761 pl
= processSubmenu(submenu
);
1763 pl
= processData(s
, WGetEditMenuItemData(item
));
1769 WMAddToPLArray(pmenu
, pl
);
1778 buildPLFromMenu(_Panel
*panel
)
1782 menu
= processSubmenu(panel
->menu
);
1791 storeData(_Panel
*panel
)
1795 if (panel
->dontSave
)
1798 menu
= buildPLFromMenu(panel
);
1800 WMWritePropListToFile(menu
, panel
->menuPath
, True
);
1802 WMReleasePropList(menu
);
1808 showMenus(_Panel
*panel
)
1810 WEditMenuUnhide(panel
->menu
);
1815 hideMenus(_Panel
*panel
)
1817 WEditMenuHide(panel
->menu
);
1824 InitMenu(WMScreen
*scr
, WMWidget
*parent
)
1828 panel
= wmalloc(sizeof(_Panel
));
1829 memset(panel
, 0, sizeof(_Panel
));
1831 panel
->sectionName
= _("Applications Menu Definition");
1833 panel
->description
= _("Edit the menu for launching applications.");
1835 panel
->parent
= parent
;
1837 panel
->callbacks
.createWidgets
= createPanel
;
1838 panel
->callbacks
.updateDomain
= storeData
;
1839 panel
->callbacks
.showPanel
= showMenus
;
1840 panel
->callbacks
.hidePanel
= hideMenus
;
1843 AddSection(panel
, ICON_FILE
);