Change to the linux kernel coding style
[wmaker-crm.git] / WPrefs.app / Expert.c
Commit [+]AuthorDateLineData
9d2e6ef9 scottc1998-09-29 22:36:29 +00001/* Expert.c- expert user options
6830b057 dan2004-10-12 21:28:27 +00002 *
9af1c6c4 dan1998-10-21 14:43:47 +00003 * WPrefs - Window Maker Preferences Program
6830b057 dan2004-10-12 21:28:27 +00004 *
4153e2fd dan2003-01-16 23:30:45 +00005 * Copyright (c) 1998-2003 Alfredo K. Kojima
6830b057 dan2004-10-12 21:28:27 +00006 *
9d2e6ef9 scottc1998-09-29 22:36:29 +00007 * 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.
11 *
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.
16 *
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
6830b057 dan2004-10-12 21:28:27 +000019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
9d2e6ef9 scottc1998-09-29 22:36:29 +000020 * USA.
21 */
22
9d2e6ef9 scottc1998-09-29 22:36:29 +000023#include "WPrefs.h"
24
25typedef struct _Panel {
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020026 WMBox *box;
27 char *sectionName;
d3f29988 kojima1999-04-25 01:49:46 +000028
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020029 char *description;
9d2e6ef9 scottc1998-09-29 22:36:29 +000030
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020031 CallbackRec callbacks;
6830b057 dan2004-10-12 21:28:27 +000032
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020033 WMWidget *parent;
9d2e6ef9 scottc1998-09-29 22:36:29 +000034
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020035 WMButton *swi[8];
9d2e6ef9 scottc1998-09-29 22:36:29 +000036
37} _Panel;
38
9d2e6ef9 scottc1998-09-29 22:36:29 +000039#define ICON_FILE "expert"
40
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020041static void showData(_Panel * panel)
9d2e6ef9 scottc1998-09-29 22:36:29 +000042{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020043 WMUserDefaults *udb = WMGetStandardUserDefaults();
44
45 WMSetButtonSelected(panel->swi[0], GetBoolForKey("DisableMiniwindows"));
46 WMSetButtonSelected(panel->swi[1], WMGetUDBoolForKey(udb, "NoXSetStuff"));
47 WMSetButtonSelected(panel->swi[2], GetBoolForKey("SaveSessionOnExit"));
48 WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
49 WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
50 WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
51 WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
9d2e6ef9 scottc1998-09-29 22:36:29 +000052}
53
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020054static void createPanel(Panel * p)
9d2e6ef9 scottc1998-09-29 22:36:29 +000055{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020056 _Panel *panel = (_Panel *) p;
57 int i;
f91f2eb1 kojima2001-02-08 21:54:12 +000058
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020059 panel->box = WMCreateBox(panel->parent);
60 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
9d2e6ef9 scottc1998-09-29 22:36:29 +000061
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020062 for (i = 0; i < 7; i++) {
63 panel->swi[i] = WMCreateSwitchButton(panel->box);
64 WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
65 WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
66 }
6830b057 dan2004-10-12 21:28:27 +000067
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020068 WMSetButtonText(panel->swi[0],
69 _("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
70 WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
71 WMSetButtonText(panel->swi[2], _("Automatically save session when exiting Window Maker."));
72 WMSetButtonText(panel->swi[3], _("Use SaveUnder in window frames, icons, menus and other objects."));
73 WMSetButtonText(panel->swi[4], _("Disable confirmation panel for the Kill command."));
74 WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
75 WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
83d3625e dan2002-11-30 02:13:36 +000076
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020077 WMSetButtonEnabled(panel->swi[6], True);
9d2e6ef9 scottc1998-09-29 22:36:29 +000078
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020079 WMRealizeWidget(panel->box);
80 WMMapSubwidgets(panel->box);
6830b057 dan2004-10-12 21:28:27 +000081
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020082 showData(panel);
9d2e6ef9 scottc1998-09-29 22:36:29 +000083}
84
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020085static void storeDefaults(_Panel * panel)
9d2e6ef9 scottc1998-09-29 22:36:29 +000086{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020087 WMUserDefaults *udb = WMGetStandardUserDefaults();
9d2e6ef9 scottc1998-09-29 22:36:29 +000088
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020089 SetBoolForKey(WMGetButtonSelected(panel->swi[0]), "DisableMiniwindows");
ea55bc5e kojima1999-03-18 01:11:18 +000090
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020091 WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[1]), "NoXSetStuff");
9d2e6ef9 scottc1998-09-29 22:36:29 +000092
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020093 SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "SaveSessionOnExit");
94 SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "UseSaveUnders");
95 SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DontConfirmKill");
96 SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
97 SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
9d2e6ef9 scottc1998-09-29 22:36:29 +000098}
99
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200100Panel *InitExpert(WMScreen * scr, WMWidget * parent)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000101{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200102 _Panel *panel;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000103
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200104 panel = wmalloc(sizeof(_Panel));
105 memset(panel, 0, sizeof(_Panel));
9d2e6ef9 scottc1998-09-29 22:36:29 +0000106
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200107 panel->sectionName = _("Expert User Preferences");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000108
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200109 panel->description = _("Options for people who know what they're doing...\n"
110 "Also have some other misc. options.");
d3f29988 kojima1999-04-25 01:49:46 +0000111
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200112 panel->parent = parent;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000113
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200114 panel->callbacks.createWidgets = createPanel;
115 panel->callbacks.updateDomain = storeDefaults;
6830b057 dan2004-10-12 21:28:27 +0000116
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200117 AddSection(panel, ICON_FILE);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000118
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200119 return panel;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000120}