mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-01 11:32:34 +01:00
Change to the linux kernel coding style
for arq in `git ls-files *.c`; do
echo $arq;
indent -linux -l115 $arq;
done
The different line break at 115 columns is because
I use a widescreen monitor :-)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -20,50 +20,47 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
char *sectionName;
|
||||
WMBox *box;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *icoF;
|
||||
WMButton *icoB[5];
|
||||
WMFrame *icoF;
|
||||
WMButton *icoB[5];
|
||||
|
||||
WMFrame *shaF;
|
||||
WMButton *shaB[5];
|
||||
WMFrame *shaF;
|
||||
WMButton *shaB[5];
|
||||
|
||||
WMFrame *titlF;
|
||||
WMButton *oldsB;
|
||||
WMButton *newsB;
|
||||
WMFrame *titlF;
|
||||
WMButton *oldsB;
|
||||
WMButton *newsB;
|
||||
|
||||
WMFrame *animF;
|
||||
WMButton *animB;
|
||||
WMButton *supB;
|
||||
WMButton *sfxB;
|
||||
WMLabel *noteL;
|
||||
WMFrame *animF;
|
||||
WMButton *animB;
|
||||
WMButton *supB;
|
||||
WMButton *sfxB;
|
||||
WMLabel *noteL;
|
||||
|
||||
WMFrame *smoF;
|
||||
WMButton *smoB;
|
||||
WMFrame *smoF;
|
||||
WMButton *smoB;
|
||||
|
||||
WMFrame *dithF;
|
||||
WMButton *dithB;
|
||||
WMSlider *dithS;
|
||||
WMLabel *dithL;
|
||||
WMLabel *dith1L;
|
||||
WMLabel *dith2L;
|
||||
WMFrame *dithF;
|
||||
WMButton *dithB;
|
||||
WMSlider *dithS;
|
||||
WMLabel *dithL;
|
||||
WMLabel *dith1L;
|
||||
WMLabel *dith2L;
|
||||
|
||||
int cmapSize;
|
||||
int cmapSize;
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "configs"
|
||||
|
||||
#define OLDS_IMAGE "oldstyle"
|
||||
@@ -79,458 +76,433 @@ typedef struct _Panel {
|
||||
|
||||
#define ARQUIVO_XIS "xis"
|
||||
|
||||
static void updateLabel(WMWidget * self, void *data);
|
||||
|
||||
static void updateLabel(WMWidget *self, void *data);
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
WMPerformButtonClick(panel->icoB[GetSpeedForKey("IconSlideSpeed")]);
|
||||
WMPerformButtonClick(panel->icoB[GetSpeedForKey("IconSlideSpeed")]);
|
||||
|
||||
WMPerformButtonClick(panel->shaB[GetSpeedForKey("ShadeSpeed")]);
|
||||
WMPerformButtonClick(panel->shaB[GetSpeedForKey("ShadeSpeed")]);
|
||||
|
||||
if (GetBoolForKey("NewStyle")) {
|
||||
WMPerformButtonClick(panel->newsB);
|
||||
} else {
|
||||
WMPerformButtonClick(panel->oldsB);
|
||||
}
|
||||
if (GetBoolForKey("NewStyle")) {
|
||||
WMPerformButtonClick(panel->newsB);
|
||||
} else {
|
||||
WMPerformButtonClick(panel->oldsB);
|
||||
}
|
||||
|
||||
WMSetButtonSelected(panel->animB, !GetBoolForKey("DisableAnimations"));
|
||||
WMSetButtonSelected(panel->animB, !GetBoolForKey("DisableAnimations"));
|
||||
|
||||
WMSetButtonSelected(panel->supB, GetBoolForKey("Superfluous"));
|
||||
WMSetButtonSelected(panel->supB, GetBoolForKey("Superfluous"));
|
||||
|
||||
WMSetButtonSelected(panel->sfxB, !GetBoolForKey("DisableSound"));
|
||||
WMSetButtonSelected(panel->sfxB, !GetBoolForKey("DisableSound"));
|
||||
|
||||
WMSetButtonSelected(panel->smoB, GetBoolForKey("SmoothWorkspaceBack"));
|
||||
WMSetButtonSelected(panel->smoB, GetBoolForKey("SmoothWorkspaceBack"));
|
||||
|
||||
WMSetButtonSelected(panel->dithB, GetBoolForKey("DisableDithering"));
|
||||
WMSetButtonSelected(panel->dithB, GetBoolForKey("DisableDithering"));
|
||||
|
||||
WMSetSliderValue(panel->dithS, GetIntegerForKey("ColormapSize"));
|
||||
WMSetSliderValue(panel->dithS, GetIntegerForKey("ColormapSize"));
|
||||
|
||||
updateLabel(panel->dithS, panel);
|
||||
updateLabel(panel->dithS, panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
updateLabel(WMWidget *self, void *data)
|
||||
static void updateLabel(WMWidget * self, void *data)
|
||||
{
|
||||
WMSlider *sPtr = (WMSlider*)self;
|
||||
_Panel *panel = (_Panel*)data;
|
||||
char buffer[64];
|
||||
float fl;
|
||||
WMSlider *sPtr = (WMSlider *) self;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
char buffer[64];
|
||||
float fl;
|
||||
|
||||
fl = WMGetSliderValue(sPtr);
|
||||
fl = WMGetSliderValue(sPtr);
|
||||
|
||||
panel->cmapSize = (int)fl;
|
||||
panel->cmapSize = (int)fl;
|
||||
|
||||
sprintf(buffer, "%i", panel->cmapSize*panel->cmapSize*panel->cmapSize);
|
||||
WMSetLabelText(panel->dithL, buffer);
|
||||
sprintf(buffer, "%i", panel->cmapSize * panel->cmapSize * panel->cmapSize);
|
||||
WMSetLabelText(panel->dithL, buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
|
||||
WMPixmap **icon1, WMPixmap **icon2)
|
||||
createImages(WMScreen * scr, RContext * rc, RImage * xis, char *file, WMPixmap ** icon1, WMPixmap ** icon2)
|
||||
{
|
||||
RImage *icon;
|
||||
char *path;
|
||||
RColor gray = {0xae,0xaa,0xae};
|
||||
RImage *icon;
|
||||
char *path;
|
||||
RColor gray = { 0xae, 0xaa, 0xae };
|
||||
|
||||
*icon1 = NULL;
|
||||
*icon2 = NULL;
|
||||
*icon1 = NULL;
|
||||
*icon2 = NULL;
|
||||
|
||||
path = LocateImage(file);
|
||||
if (!path) {
|
||||
return;
|
||||
}
|
||||
path = LocateImage(file);
|
||||
if (!path) {
|
||||
return;
|
||||
}
|
||||
|
||||
*icon1 = WMCreatePixmapFromFile(scr, path);
|
||||
if (!*icon1) {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
wfree(path);
|
||||
return;
|
||||
}
|
||||
icon = RLoadImage(rc, path, 0);
|
||||
if (!icon) {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
wfree(path);
|
||||
return;
|
||||
}
|
||||
RCombineImageWithColor(icon, &gray);
|
||||
if (xis) {
|
||||
RCombineImagesWithOpaqueness(icon, xis, 180);
|
||||
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
|
||||
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
|
||||
}
|
||||
RReleaseImage(icon);
|
||||
wfree(path);
|
||||
*icon1 = WMCreatePixmapFromFile(scr, path);
|
||||
if (!*icon1) {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
wfree(path);
|
||||
return;
|
||||
}
|
||||
icon = RLoadImage(rc, path, 0);
|
||||
if (!icon) {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
wfree(path);
|
||||
return;
|
||||
}
|
||||
RCombineImageWithColor(icon, &gray);
|
||||
if (xis) {
|
||||
RCombineImagesWithOpaqueness(icon, xis, 180);
|
||||
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
|
||||
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
|
||||
}
|
||||
RReleaseImage(icon);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
char *buf1, *buf2;
|
||||
WMPixmap *icon, *altIcon;
|
||||
RImage *xis = NULL;
|
||||
int i;
|
||||
RContext *rc = WMScreenRContext(scr);
|
||||
WMFont *font = WMSystemFontOfSize(scr, 10);
|
||||
char *path;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
char *buf1, *buf2;
|
||||
WMPixmap *icon, *altIcon;
|
||||
RImage *xis = NULL;
|
||||
int i;
|
||||
RContext *rc = WMScreenRContext(scr);
|
||||
WMFont *font = WMSystemFontOfSize(scr, 10);
|
||||
char *path;
|
||||
|
||||
path = LocateImage(ARQUIVO_XIS);
|
||||
if (path) {
|
||||
xis = RLoadImage(rc, path, 0);
|
||||
if (!xis) {
|
||||
wwarning(_("could not load image file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(ARQUIVO_XIS);
|
||||
if (path) {
|
||||
xis = RLoadImage(rc, path, 0);
|
||||
if (!xis) {
|
||||
wwarning(_("could not load image file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/*********** Icon Slide Speed **********/
|
||||
|
||||
panel->icoF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->icoF, 230, 45);
|
||||
WMMoveWidget(panel->icoF, 15, 10);
|
||||
WMSetFrameTitle(panel->icoF, _("Icon Slide Speed"));
|
||||
panel->icoF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->icoF, 230, 45);
|
||||
WMMoveWidget(panel->icoF, 15, 10);
|
||||
WMSetFrameTitle(panel->icoF, _("Icon Slide Speed"));
|
||||
|
||||
/*********** Shade Animation Speed **********/
|
||||
panel->shaF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->shaF, 230, 45);
|
||||
WMMoveWidget(panel->shaF, 15, 60);
|
||||
WMSetFrameTitle(panel->shaF, _("Shade Animation Speed"));
|
||||
panel->shaF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->shaF, 230, 45);
|
||||
WMMoveWidget(panel->shaF, 15, 60);
|
||||
WMSetFrameTitle(panel->shaF, _("Shade Animation Speed"));
|
||||
|
||||
buf1 = wmalloc(strlen(SPEED_IMAGE) + 1);
|
||||
buf2 = wmalloc(strlen(SPEED_IMAGE_S) + 1);
|
||||
|
||||
buf1 = wmalloc(strlen(SPEED_IMAGE)+1);
|
||||
buf2 = wmalloc(strlen(SPEED_IMAGE_S)+1);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
panel->icoB[i] = WMCreateCustomButton(panel->icoF, WBBStateChangeMask);
|
||||
panel->shaB[i] = WMCreateCustomButton(panel->shaF, WBBStateChangeMask);
|
||||
WMResizeWidget(panel->icoB[i], 40, 24);
|
||||
WMMoveWidget(panel->icoB[i], 10+(40*i), 15);
|
||||
WMResizeWidget(panel->shaB[i], 40, 24);
|
||||
WMMoveWidget(panel->shaB[i], 10+(40*i), 15);
|
||||
WMSetButtonBordered(panel->icoB[i], False);
|
||||
WMSetButtonImagePosition(panel->icoB[i], WIPImageOnly);
|
||||
if (i > 0) {
|
||||
WMGroupButtons(panel->icoB[0], panel->icoB[i]);
|
||||
}
|
||||
WMSetButtonBordered(panel->shaB[i], False);
|
||||
WMSetButtonImagePosition(panel->shaB[i], WIPImageOnly);
|
||||
if (i > 0) {
|
||||
WMGroupButtons(panel->shaB[0], panel->shaB[i]);
|
||||
}
|
||||
sprintf(buf1, SPEED_IMAGE, i);
|
||||
sprintf(buf2, SPEED_IMAGE_S, i);
|
||||
path = LocateImage(buf1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->icoB[i], icon);
|
||||
WMSetButtonImage(panel->shaB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->icoB[i], icon);
|
||||
WMSetButtonAltImage(panel->shaB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
|
||||
WMMapSubwidgets(panel->icoF);
|
||||
WMMapSubwidgets(panel->shaF);
|
||||
for (i = 0; i < 5; i++) {
|
||||
panel->icoB[i] = WMCreateCustomButton(panel->icoF, WBBStateChangeMask);
|
||||
panel->shaB[i] = WMCreateCustomButton(panel->shaF, WBBStateChangeMask);
|
||||
WMResizeWidget(panel->icoB[i], 40, 24);
|
||||
WMMoveWidget(panel->icoB[i], 10 + (40 * i), 15);
|
||||
WMResizeWidget(panel->shaB[i], 40, 24);
|
||||
WMMoveWidget(panel->shaB[i], 10 + (40 * i), 15);
|
||||
WMSetButtonBordered(panel->icoB[i], False);
|
||||
WMSetButtonImagePosition(panel->icoB[i], WIPImageOnly);
|
||||
if (i > 0) {
|
||||
WMGroupButtons(panel->icoB[0], panel->icoB[i]);
|
||||
}
|
||||
WMSetButtonBordered(panel->shaB[i], False);
|
||||
WMSetButtonImagePosition(panel->shaB[i], WIPImageOnly);
|
||||
if (i > 0) {
|
||||
WMGroupButtons(panel->shaB[0], panel->shaB[i]);
|
||||
}
|
||||
sprintf(buf1, SPEED_IMAGE, i);
|
||||
sprintf(buf2, SPEED_IMAGE_S, i);
|
||||
path = LocateImage(buf1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->icoB[i], icon);
|
||||
WMSetButtonImage(panel->shaB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->icoB[i], icon);
|
||||
WMSetButtonAltImage(panel->shaB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
WMMapSubwidgets(panel->icoF);
|
||||
WMMapSubwidgets(panel->shaF);
|
||||
|
||||
/***************** Smoothed Scaling *****************/
|
||||
panel->smoF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->smoF, 115, 110);
|
||||
WMMoveWidget(panel->smoF, 18, 115);
|
||||
WMSetFrameTitle(panel->smoF, _("Smooth Scaling"));
|
||||
WMSetBalloonTextForView(_("Smooth scaled background images, neutralizing\n"
|
||||
"the `pixelization' effect. This will slow\n"
|
||||
"down loading of background images considerably."),
|
||||
WMWidgetView(panel->smoF));
|
||||
panel->smoF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->smoF, 115, 110);
|
||||
WMMoveWidget(panel->smoF, 18, 115);
|
||||
WMSetFrameTitle(panel->smoF, _("Smooth Scaling"));
|
||||
WMSetBalloonTextForView(_("Smooth scaled background images, neutralizing\n"
|
||||
"the `pixelization' effect. This will slow\n"
|
||||
"down loading of background images considerably."), WMWidgetView(panel->smoF));
|
||||
|
||||
panel->smoB = WMCreateButton(panel->smoF, WBTToggle);
|
||||
WMResizeWidget(panel->smoB, 64, 64);
|
||||
WMMoveWidget(panel->smoB, 25, 25);
|
||||
WMSetButtonImagePosition(panel->smoB, WIPImageOnly);
|
||||
path = LocateImage(SMOOTH_IMAGE);
|
||||
if (path) {
|
||||
RImage *image, *scaled;
|
||||
panel->smoB = WMCreateButton(panel->smoF, WBTToggle);
|
||||
WMResizeWidget(panel->smoB, 64, 64);
|
||||
WMMoveWidget(panel->smoB, 25, 25);
|
||||
WMSetButtonImagePosition(panel->smoB, WIPImageOnly);
|
||||
path = LocateImage(SMOOTH_IMAGE);
|
||||
if (path) {
|
||||
RImage *image, *scaled;
|
||||
|
||||
image = RLoadImage(WMScreenRContext(scr), path, 0);
|
||||
wfree(path);
|
||||
image = RLoadImage(WMScreenRContext(scr), path, 0);
|
||||
wfree(path);
|
||||
|
||||
scaled = RScaleImage(image, 61, 61);
|
||||
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
|
||||
RReleaseImage(scaled);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->smoB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
scaled = RScaleImage(image, 61, 61);
|
||||
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
|
||||
RReleaseImage(scaled);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->smoB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
|
||||
scaled = RSmoothScaleImage(image, 61, 61);
|
||||
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
|
||||
RReleaseImage(scaled);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->smoB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
scaled = RSmoothScaleImage(image, 61, 61);
|
||||
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
|
||||
RReleaseImage(scaled);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->smoB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
|
||||
RReleaseImage(image);
|
||||
}
|
||||
RReleaseImage(image);
|
||||
}
|
||||
|
||||
WMMapSubwidgets(panel->smoF);
|
||||
WMMapSubwidgets(panel->smoF);
|
||||
|
||||
/***************** Titlebar Style Size ****************/
|
||||
panel->titlF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->titlF, 105, 110);
|
||||
WMMoveWidget(panel->titlF, 140, 115);
|
||||
WMSetFrameTitle(panel->titlF, _("Titlebar Style"));
|
||||
panel->titlF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->titlF, 105, 110);
|
||||
WMMoveWidget(panel->titlF, 140, 115);
|
||||
WMSetFrameTitle(panel->titlF, _("Titlebar Style"));
|
||||
|
||||
panel->newsB = WMCreateButton(panel->titlF, WBTOnOff);
|
||||
WMResizeWidget(panel->newsB, 74, 40);
|
||||
WMMoveWidget(panel->newsB, 15, 20);
|
||||
WMSetButtonImagePosition(panel->newsB, WIPImageOnly);
|
||||
path = LocateImage(NEWS_IMAGE);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->newsB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
}
|
||||
panel->newsB = WMCreateButton(panel->titlF, WBTOnOff);
|
||||
WMResizeWidget(panel->newsB, 74, 40);
|
||||
WMMoveWidget(panel->newsB, 15, 20);
|
||||
WMSetButtonImagePosition(panel->newsB, WIPImageOnly);
|
||||
path = LocateImage(NEWS_IMAGE);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->newsB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
}
|
||||
|
||||
panel->oldsB = WMCreateButton(panel->titlF, WBTOnOff);
|
||||
WMResizeWidget(panel->oldsB, 74, 40);
|
||||
WMMoveWidget(panel->oldsB, 15, 60);
|
||||
WMSetButtonImagePosition(panel->oldsB, WIPImageOnly);
|
||||
path = LocateImage(OLDS_IMAGE);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->oldsB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
panel->oldsB = WMCreateButton(panel->titlF, WBTOnOff);
|
||||
WMResizeWidget(panel->oldsB, 74, 40);
|
||||
WMMoveWidget(panel->oldsB, 15, 60);
|
||||
WMSetButtonImagePosition(panel->oldsB, WIPImageOnly);
|
||||
path = LocateImage(OLDS_IMAGE);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->oldsB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
WMGroupButtons(panel->newsB, panel->oldsB);
|
||||
WMGroupButtons(panel->newsB, panel->oldsB);
|
||||
|
||||
WMMapSubwidgets(panel->titlF);
|
||||
WMMapSubwidgets(panel->titlF);
|
||||
|
||||
/**************** Features ******************/
|
||||
|
||||
panel->animF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->animF, 255, 115);
|
||||
WMMoveWidget(panel->animF, 255, 10);
|
||||
WMSetFrameTitle(panel->animF, _("Animations and Sound"));
|
||||
panel->animF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->animF, 255, 115);
|
||||
WMMoveWidget(panel->animF, 255, 10);
|
||||
WMSetFrameTitle(panel->animF, _("Animations and Sound"));
|
||||
|
||||
panel->animB = WMCreateButton(panel->animF, WBTToggle);
|
||||
WMResizeWidget(panel->animB, 64, 64);
|
||||
WMMoveWidget(panel->animB, 15, 20);
|
||||
WMSetButtonFont(panel->animB, font);
|
||||
WMSetButtonText(panel->animB, _("Animations"));
|
||||
WMSetButtonImagePosition(panel->animB, WIPAbove);
|
||||
createImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->animB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
if (altIcon) {
|
||||
WMSetButtonAltImage(panel->animB, altIcon);
|
||||
WMReleasePixmap(altIcon);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable animations such as those shown\n"
|
||||
"for window miniaturization, shading etc."),
|
||||
WMWidgetView(panel->animB));
|
||||
panel->animB = WMCreateButton(panel->animF, WBTToggle);
|
||||
WMResizeWidget(panel->animB, 64, 64);
|
||||
WMMoveWidget(panel->animB, 15, 20);
|
||||
WMSetButtonFont(panel->animB, font);
|
||||
WMSetButtonText(panel->animB, _("Animations"));
|
||||
WMSetButtonImagePosition(panel->animB, WIPAbove);
|
||||
createImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->animB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
if (altIcon) {
|
||||
WMSetButtonAltImage(panel->animB, altIcon);
|
||||
WMReleasePixmap(altIcon);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable animations such as those shown\n"
|
||||
"for window miniaturization, shading etc."), WMWidgetView(panel->animB));
|
||||
|
||||
panel->supB = WMCreateButton(panel->animF, WBTToggle);
|
||||
WMResizeWidget(panel->supB, 64, 64);
|
||||
WMMoveWidget(panel->supB, 95, 20);
|
||||
WMSetButtonFont(panel->supB, font);
|
||||
WMSetButtonText(panel->supB, _("Superfluous"));
|
||||
WMSetButtonImagePosition(panel->supB, WIPAbove);
|
||||
createImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->supB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
if (altIcon) {
|
||||
WMSetButtonAltImage(panel->supB, altIcon);
|
||||
WMReleasePixmap(altIcon);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable `superfluous' features and\n"
|
||||
"animations. These include the `ghosting' of the\n"
|
||||
"dock when it's being moved to another side and\n"
|
||||
"the explosion animation when undocking icons."),
|
||||
WMWidgetView(panel->supB));
|
||||
panel->supB = WMCreateButton(panel->animF, WBTToggle);
|
||||
WMResizeWidget(panel->supB, 64, 64);
|
||||
WMMoveWidget(panel->supB, 95, 20);
|
||||
WMSetButtonFont(panel->supB, font);
|
||||
WMSetButtonText(panel->supB, _("Superfluous"));
|
||||
WMSetButtonImagePosition(panel->supB, WIPAbove);
|
||||
createImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->supB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
if (altIcon) {
|
||||
WMSetButtonAltImage(panel->supB, altIcon);
|
||||
WMReleasePixmap(altIcon);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable `superfluous' features and\n"
|
||||
"animations. These include the `ghosting' of the\n"
|
||||
"dock when it's being moved to another side and\n"
|
||||
"the explosion animation when undocking icons."), WMWidgetView(panel->supB));
|
||||
|
||||
panel->sfxB = WMCreateButton(panel->animF, WBTToggle);
|
||||
WMResizeWidget(panel->sfxB, 64, 64);
|
||||
WMMoveWidget(panel->sfxB, 175, 20);
|
||||
WMSetButtonFont(panel->sfxB, font);
|
||||
WMSetButtonText(panel->sfxB, _("Sounds"));
|
||||
WMSetButtonImagePosition(panel->sfxB, WIPAbove);
|
||||
createImages(scr, rc, xis, SOUND_IMAGE, &altIcon, &icon);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->sfxB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
if (altIcon) {
|
||||
WMSetButtonAltImage(panel->sfxB, altIcon);
|
||||
WMReleasePixmap(altIcon);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable support for sound effects played\n"
|
||||
"for actions like shading and closing a window.\n"
|
||||
"You will need a module distributed separately\n"
|
||||
"for this. You can get it at:\n"
|
||||
"http://largo.windowmaker.info/files.php#WSoundServer"),
|
||||
WMWidgetView(panel->sfxB));
|
||||
panel->sfxB = WMCreateButton(panel->animF, WBTToggle);
|
||||
WMResizeWidget(panel->sfxB, 64, 64);
|
||||
WMMoveWidget(panel->sfxB, 175, 20);
|
||||
WMSetButtonFont(panel->sfxB, font);
|
||||
WMSetButtonText(panel->sfxB, _("Sounds"));
|
||||
WMSetButtonImagePosition(panel->sfxB, WIPAbove);
|
||||
createImages(scr, rc, xis, SOUND_IMAGE, &altIcon, &icon);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->sfxB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
if (altIcon) {
|
||||
WMSetButtonAltImage(panel->sfxB, altIcon);
|
||||
WMReleasePixmap(altIcon);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable support for sound effects played\n"
|
||||
"for actions like shading and closing a window.\n"
|
||||
"You will need a module distributed separately\n"
|
||||
"for this. You can get it at:\n"
|
||||
"http://largo.windowmaker.info/files.php#WSoundServer"),
|
||||
WMWidgetView(panel->sfxB));
|
||||
|
||||
panel->noteL = WMCreateLabel(panel->animF);
|
||||
WMResizeWidget(panel->noteL, 235, 28);
|
||||
WMMoveWidget(panel->noteL, 10, 85);
|
||||
WMSetLabelFont(panel->noteL, font);
|
||||
WMSetLabelText(panel->noteL, _("Note: sound requires a module distributed\nseparately"));
|
||||
panel->noteL = WMCreateLabel(panel->animF);
|
||||
WMResizeWidget(panel->noteL, 235, 28);
|
||||
WMMoveWidget(panel->noteL, 10, 85);
|
||||
WMSetLabelFont(panel->noteL, font);
|
||||
WMSetLabelText(panel->noteL, _("Note: sound requires a module distributed\nseparately"));
|
||||
|
||||
WMMapSubwidgets(panel->animF);
|
||||
WMMapSubwidgets(panel->animF);
|
||||
|
||||
/*********** Dithering **********/
|
||||
panel->cmapSize = 4;
|
||||
panel->cmapSize = 4;
|
||||
|
||||
panel->dithF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->dithF, 255, 95);
|
||||
WMMoveWidget(panel->dithF, 255, 130);
|
||||
WMSetFrameTitle(panel->dithF, _("Dithering colormap for 8bpp"));
|
||||
panel->dithF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->dithF, 255, 95);
|
||||
WMMoveWidget(panel->dithF, 255, 130);
|
||||
WMSetFrameTitle(panel->dithF, _("Dithering colormap for 8bpp"));
|
||||
|
||||
WMSetBalloonTextForView(_("Number of colors to reserve for Window Maker\n"
|
||||
"on displays that support only 8bpp (PseudoColor)."),
|
||||
WMWidgetView(panel->dithF));
|
||||
WMSetBalloonTextForView(_("Number of colors to reserve for Window Maker\n"
|
||||
"on displays that support only 8bpp (PseudoColor)."),
|
||||
WMWidgetView(panel->dithF));
|
||||
|
||||
panel->dithB = WMCreateSwitchButton(panel->dithF);
|
||||
WMResizeWidget(panel->dithB, 235, 32);
|
||||
WMMoveWidget(panel->dithB, 15, 15);
|
||||
WMSetButtonText(panel->dithB, _("Disable dithering in any visual/depth"));
|
||||
panel->dithB = WMCreateSwitchButton(panel->dithF);
|
||||
WMResizeWidget(panel->dithB, 235, 32);
|
||||
WMMoveWidget(panel->dithB, 15, 15);
|
||||
WMSetButtonText(panel->dithB, _("Disable dithering in any visual/depth"));
|
||||
|
||||
panel->dithL = WMCreateLabel(panel->dithF);
|
||||
WMResizeWidget(panel->dithL, 75, 16);
|
||||
WMMoveWidget(panel->dithL, 90, 50);
|
||||
WMSetLabelTextAlignment(panel->dithL, WACenter);
|
||||
WMSetLabelText(panel->dithL, "64");
|
||||
panel->dithL = WMCreateLabel(panel->dithF);
|
||||
WMResizeWidget(panel->dithL, 75, 16);
|
||||
WMMoveWidget(panel->dithL, 90, 50);
|
||||
WMSetLabelTextAlignment(panel->dithL, WACenter);
|
||||
WMSetLabelText(panel->dithL, "64");
|
||||
|
||||
panel->dithS = WMCreateSlider(panel->dithF);
|
||||
WMResizeWidget(panel->dithS, 95, 16);
|
||||
WMMoveWidget(panel->dithS, 80, 65);
|
||||
WMSetSliderMinValue(panel->dithS, 2);
|
||||
WMSetSliderMaxValue(panel->dithS, 6);
|
||||
WMSetSliderContinuous(panel->dithS, True);
|
||||
WMSetSliderAction(panel->dithS, updateLabel, panel);
|
||||
panel->dithS = WMCreateSlider(panel->dithF);
|
||||
WMResizeWidget(panel->dithS, 95, 16);
|
||||
WMMoveWidget(panel->dithS, 80, 65);
|
||||
WMSetSliderMinValue(panel->dithS, 2);
|
||||
WMSetSliderMaxValue(panel->dithS, 6);
|
||||
WMSetSliderContinuous(panel->dithS, True);
|
||||
WMSetSliderAction(panel->dithS, updateLabel, panel);
|
||||
|
||||
panel->dith1L = WMCreateLabel(panel->dithF);
|
||||
WMResizeWidget(panel->dith1L, 70, 35);
|
||||
WMMoveWidget(panel->dith1L, 5, 50);
|
||||
WMSetLabelTextAlignment(panel->dith1L, WACenter);
|
||||
WMSetLabelFont(panel->dith1L, font);
|
||||
WMSetLabelText(panel->dith1L, _("More colors for\napplications"));
|
||||
panel->dith1L = WMCreateLabel(panel->dithF);
|
||||
WMResizeWidget(panel->dith1L, 70, 35);
|
||||
WMMoveWidget(panel->dith1L, 5, 50);
|
||||
WMSetLabelTextAlignment(panel->dith1L, WACenter);
|
||||
WMSetLabelFont(panel->dith1L, font);
|
||||
WMSetLabelText(panel->dith1L, _("More colors for\napplications"));
|
||||
|
||||
panel->dith2L = WMCreateLabel(panel->dithF);
|
||||
WMResizeWidget(panel->dith2L, 70, 35);
|
||||
WMMoveWidget(panel->dith2L, 180, 50);
|
||||
WMSetLabelTextAlignment(panel->dith2L, WACenter);
|
||||
WMSetLabelFont(panel->dith2L, font);
|
||||
WMSetLabelText(panel->dith2L, _("More colors for\nWindow Maker"));
|
||||
panel->dith2L = WMCreateLabel(panel->dithF);
|
||||
WMResizeWidget(panel->dith2L, 70, 35);
|
||||
WMMoveWidget(panel->dith2L, 180, 50);
|
||||
WMSetLabelTextAlignment(panel->dith2L, WACenter);
|
||||
WMSetLabelFont(panel->dith2L, font);
|
||||
WMSetLabelText(panel->dith2L, _("More colors for\nWindow Maker"));
|
||||
|
||||
WMMapSubwidgets(panel->dithF);
|
||||
WMMapSubwidgets(panel->dithF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
if (xis)
|
||||
RReleaseImage(xis);
|
||||
WMReleaseFont(font);
|
||||
if (xis)
|
||||
RReleaseImage(xis);
|
||||
WMReleaseFont(font);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (WMGetButtonSelected(panel->icoB[i]))
|
||||
break;
|
||||
}
|
||||
SetSpeedForKey(i, "IconSlideSpeed");
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (WMGetButtonSelected(panel->icoB[i]))
|
||||
break;
|
||||
}
|
||||
SetSpeedForKey(i, "IconSlideSpeed");
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (WMGetButtonSelected(panel->shaB[i]))
|
||||
break;
|
||||
}
|
||||
SetSpeedForKey(i, "ShadeSpeed");
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (WMGetButtonSelected(panel->shaB[i]))
|
||||
break;
|
||||
}
|
||||
SetSpeedForKey(i, "ShadeSpeed");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->newsB), "NewStyle");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->newsB), "NewStyle");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->animB), "DisableAnimations");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->supB), "Superfluous");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->sfxB), "DisableSound");
|
||||
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->animB), "DisableAnimations");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->supB), "Superfluous");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->sfxB), "DisableSound");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->smoB), "SmoothWorkspaceBack");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->smoB), "SmoothWorkspaceBack");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->dithB), "DisableDithering");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->dithS), "ColormapSize");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->dithB), "DisableDithering");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->dithS), "ColormapSize");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitConfigurations(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitConfigurations(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Other Configurations");
|
||||
panel->sectionName = _("Other Configurations");
|
||||
|
||||
panel->description = _("Animation speeds, titlebar styles, various option\n"
|
||||
"toggling and number of colors to reserve for\n"
|
||||
"Window Maker on 8bit displays.");
|
||||
panel->description = _("Animation speeds, titlebar styles, various option\n"
|
||||
"toggling and number of colors to reserve for\n" "Window Maker on 8bit displays.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,112 +20,101 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
char *sectionName;
|
||||
WMBox *box;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMButton *swi[8];
|
||||
WMButton *swi[8];
|
||||
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "expert"
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
|
||||
WMSetButtonSelected(panel->swi[0], GetBoolForKey("DisableMiniwindows"));
|
||||
WMSetButtonSelected(panel->swi[1], WMGetUDBoolForKey(udb, "NoXSetStuff"));
|
||||
WMSetButtonSelected(panel->swi[2], GetBoolForKey("SaveSessionOnExit"));
|
||||
WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
|
||||
WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
|
||||
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
|
||||
WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
|
||||
WMSetButtonSelected(panel->swi[0], GetBoolForKey("DisableMiniwindows"));
|
||||
WMSetButtonSelected(panel->swi[1], WMGetUDBoolForKey(udb, "NoXSetStuff"));
|
||||
WMSetButtonSelected(panel->swi[2], GetBoolForKey("SaveSessionOnExit"));
|
||||
WMSetButtonSelected(panel->swi[3], GetBoolForKey("UseSaveUnders"));
|
||||
WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
|
||||
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
|
||||
WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
int i;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
int i;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
for (i=0; i<7; i++) {
|
||||
panel->swi[i] = WMCreateSwitchButton(panel->box);
|
||||
WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
|
||||
WMMoveWidget(panel->swi[i], 20, 20+i*25);
|
||||
}
|
||||
for (i = 0; i < 7; i++) {
|
||||
panel->swi[i] = WMCreateSwitchButton(panel->box);
|
||||
WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
|
||||
WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
|
||||
}
|
||||
|
||||
WMSetButtonText(panel->swi[0], _("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
|
||||
WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
|
||||
WMSetButtonText(panel->swi[2], _("Automatically save session when exiting Window Maker."));
|
||||
WMSetButtonText(panel->swi[3], _("Use SaveUnder in window frames, icons, menus and other objects."));
|
||||
WMSetButtonText(panel->swi[4], _("Disable confirmation panel for the Kill command."));
|
||||
WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
|
||||
WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
|
||||
WMSetButtonText(panel->swi[0],
|
||||
_("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
|
||||
WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
|
||||
WMSetButtonText(panel->swi[2], _("Automatically save session when exiting Window Maker."));
|
||||
WMSetButtonText(panel->swi[3], _("Use SaveUnder in window frames, icons, menus and other objects."));
|
||||
WMSetButtonText(panel->swi[4], _("Disable confirmation panel for the Kill command."));
|
||||
WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
|
||||
WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
|
||||
|
||||
WMSetButtonEnabled(panel->swi[6], True);
|
||||
WMSetButtonEnabled(panel->swi[6], True);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeDefaults(_Panel *panel)
|
||||
static void storeDefaults(_Panel * panel)
|
||||
{
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[0]), "DisableMiniwindows");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[0]), "DisableMiniwindows");
|
||||
|
||||
WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[1]), "NoXSetStuff");
|
||||
WMSetUDBoolForKey(udb, WMGetButtonSelected(panel->swi[1]), "NoXSetStuff");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "SaveSessionOnExit");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "UseSaveUnders");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DontConfirmKill");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[2]), "SaveSessionOnExit");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[3]), "UseSaveUnders");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DontConfirmKill");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
|
||||
}
|
||||
|
||||
|
||||
Panel*
|
||||
InitExpert(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitExpert(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Expert User Preferences");
|
||||
panel->sectionName = _("Expert User Preferences");
|
||||
|
||||
panel->description = _("Options for people who know what they're doing...\n"
|
||||
"Also have some other misc. options.");
|
||||
panel->description = _("Options for people who know what they're doing...\n"
|
||||
"Also have some other misc. options.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeDefaults;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeDefaults;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,358 +20,327 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *kfocF;
|
||||
WMButton *kfocB[2];
|
||||
WMFrame *kfocF;
|
||||
WMButton *kfocB[2];
|
||||
|
||||
WMFrame *cfocF;
|
||||
WMButton *autB;
|
||||
WMButton *manB;
|
||||
WMFrame *cfocF;
|
||||
WMButton *autB;
|
||||
WMButton *manB;
|
||||
|
||||
WMFrame *raisF;
|
||||
WMButton *raisB[5];
|
||||
WMTextField *raisT;
|
||||
WMLabel *raisL;
|
||||
WMFrame *raisF;
|
||||
WMButton *raisB[5];
|
||||
WMTextField *raisT;
|
||||
WMLabel *raisL;
|
||||
|
||||
WMFrame *optF;
|
||||
WMButton *ignB;
|
||||
WMButton *newB;
|
||||
WMFrame *optF;
|
||||
WMButton *ignB;
|
||||
WMButton *newB;
|
||||
|
||||
char raiseDelaySelected;
|
||||
char raiseDelaySelected;
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "windowfocus"
|
||||
|
||||
#define DELAY_ICON "timer%i"
|
||||
#define DELAY_ICON_S "timer%is"
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
char *str;
|
||||
int i;
|
||||
char buffer[32];
|
||||
char *str;
|
||||
int i;
|
||||
char buffer[32];
|
||||
|
||||
str = GetStringForKey("FocusMode");
|
||||
if (!str)
|
||||
str = "manual";
|
||||
if (strcasecmp(str, "manual")==0 || strcasecmp(str, "clicktofocus")==0)
|
||||
WMSetButtonSelected(panel->kfocB[0], 1);
|
||||
else if (strcasecmp(str, "auto")==0 || strcasecmp(str, "semiauto")==0
|
||||
|| strcasecmp(str, "sloppy")==0)
|
||||
WMSetButtonSelected(panel->kfocB[1], 1);
|
||||
else {
|
||||
wwarning(_("bad option value %s for option FocusMode. Using default Manual"),
|
||||
str);
|
||||
WMSetButtonSelected(panel->kfocB[0], 1);
|
||||
}
|
||||
str = GetStringForKey("FocusMode");
|
||||
if (!str)
|
||||
str = "manual";
|
||||
if (strcasecmp(str, "manual") == 0 || strcasecmp(str, "clicktofocus") == 0)
|
||||
WMSetButtonSelected(panel->kfocB[0], 1);
|
||||
else if (strcasecmp(str, "auto") == 0 || strcasecmp(str, "semiauto") == 0
|
||||
|| strcasecmp(str, "sloppy") == 0)
|
||||
WMSetButtonSelected(panel->kfocB[1], 1);
|
||||
else {
|
||||
wwarning(_("bad option value %s for option FocusMode. Using default Manual"), str);
|
||||
WMSetButtonSelected(panel->kfocB[0], 1);
|
||||
}
|
||||
|
||||
/**/
|
||||
str = GetStringForKey("ColormapMode");
|
||||
if (!str)
|
||||
str = "auto";
|
||||
if (strcasecmp(str, "manual")==0 || strcasecmp(str, "clicktofocus")==0) {
|
||||
WMPerformButtonClick(panel->manB);
|
||||
} else if (strcasecmp(str, "auto")==0 || strcasecmp(str, "focusfollowsmouse")==0) {
|
||||
WMPerformButtonClick(panel->autB);
|
||||
} else {
|
||||
wwarning(_("bad option value %s for option ColormapMode. Using default Auto"),
|
||||
str);
|
||||
WMPerformButtonClick(panel->manB);
|
||||
}
|
||||
/**/ str = GetStringForKey("ColormapMode");
|
||||
if (!str)
|
||||
str = "auto";
|
||||
if (strcasecmp(str, "manual") == 0 || strcasecmp(str, "clicktofocus") == 0) {
|
||||
WMPerformButtonClick(panel->manB);
|
||||
} else if (strcasecmp(str, "auto") == 0 || strcasecmp(str, "focusfollowsmouse") == 0) {
|
||||
WMPerformButtonClick(panel->autB);
|
||||
} else {
|
||||
wwarning(_("bad option value %s for option ColormapMode. Using default Auto"), str);
|
||||
WMPerformButtonClick(panel->manB);
|
||||
}
|
||||
|
||||
/**/
|
||||
i = GetIntegerForKey("RaiseDelay");
|
||||
sprintf(buffer, "%i", i);
|
||||
WMSetTextFieldText(panel->raisT, buffer);
|
||||
/**/ i = GetIntegerForKey("RaiseDelay");
|
||||
sprintf(buffer, "%i", i);
|
||||
WMSetTextFieldText(panel->raisT, buffer);
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
WMPerformButtonClick(panel->raisB[0]);
|
||||
break;
|
||||
case 10:
|
||||
WMPerformButtonClick(panel->raisB[1]);
|
||||
break;
|
||||
case 100:
|
||||
WMPerformButtonClick(panel->raisB[2]);
|
||||
break;
|
||||
case 350:
|
||||
WMPerformButtonClick(panel->raisB[3]);
|
||||
break;
|
||||
case 800:
|
||||
WMPerformButtonClick(panel->raisB[4]);
|
||||
break;
|
||||
}
|
||||
switch (i) {
|
||||
case 0:
|
||||
WMPerformButtonClick(panel->raisB[0]);
|
||||
break;
|
||||
case 10:
|
||||
WMPerformButtonClick(panel->raisB[1]);
|
||||
break;
|
||||
case 100:
|
||||
WMPerformButtonClick(panel->raisB[2]);
|
||||
break;
|
||||
case 350:
|
||||
WMPerformButtonClick(panel->raisB[3]);
|
||||
break;
|
||||
case 800:
|
||||
WMPerformButtonClick(panel->raisB[4]);
|
||||
break;
|
||||
}
|
||||
|
||||
/**/
|
||||
WMSetButtonSelected(panel->ignB, GetBoolForKey("IgnoreFocusClick"));
|
||||
/**/ WMSetButtonSelected(panel->ignB, GetBoolForKey("IgnoreFocusClick"));
|
||||
|
||||
WMSetButtonSelected(panel->newB, GetBoolForKey("AutoFocus"));
|
||||
WMSetButtonSelected(panel->newB, GetBoolForKey("AutoFocus"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
char *str;
|
||||
int i;
|
||||
char *str;
|
||||
int i;
|
||||
|
||||
if (WMGetButtonSelected(panel->kfocB[1]))
|
||||
str = "sloppy";
|
||||
else
|
||||
str = "manual";
|
||||
if (WMGetButtonSelected(panel->kfocB[1]))
|
||||
str = "sloppy";
|
||||
else
|
||||
str = "manual";
|
||||
|
||||
SetStringForKey(str, "FocusMode");
|
||||
SetStringForKey(str, "FocusMode");
|
||||
|
||||
if (WMGetButtonSelected(panel->manB)) {
|
||||
SetStringForKey("manual", "ColormapMode");
|
||||
} else {
|
||||
SetStringForKey("auto", "ColormapMode");
|
||||
}
|
||||
if (WMGetButtonSelected(panel->manB)) {
|
||||
SetStringForKey("manual", "ColormapMode");
|
||||
} else {
|
||||
SetStringForKey("auto", "ColormapMode");
|
||||
}
|
||||
|
||||
str = WMGetTextFieldText(panel->raisT);
|
||||
if (sscanf(str, "%i", &i)!=1)
|
||||
i = 0;
|
||||
SetIntegerForKey(i, "RaiseDelay");
|
||||
str = WMGetTextFieldText(panel->raisT);
|
||||
if (sscanf(str, "%i", &i) != 1)
|
||||
i = 0;
|
||||
SetIntegerForKey(i, "RaiseDelay");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ignB), "IgnoreFocusClick");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->newB), "AutoFocus");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ignB), "IgnoreFocusClick");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->newB), "AutoFocus");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pushDelayButton(WMWidget *w, void *data)
|
||||
static void pushDelayButton(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
|
||||
panel->raiseDelaySelected = 1;
|
||||
if (w == panel->raisB[0]) {
|
||||
WMSetTextFieldText(panel->raisT, "OFF");
|
||||
} else if (w == panel->raisB[1]) {
|
||||
WMSetTextFieldText(panel->raisT, "10");
|
||||
} else if (w == panel->raisB[2]) {
|
||||
WMSetTextFieldText(panel->raisT, "100");
|
||||
} else if (w == panel->raisB[3]) {
|
||||
WMSetTextFieldText(panel->raisT, "350");
|
||||
} else if (w == panel->raisB[4]) {
|
||||
WMSetTextFieldText(panel->raisT, "800");
|
||||
}
|
||||
panel->raiseDelaySelected = 1;
|
||||
if (w == panel->raisB[0]) {
|
||||
WMSetTextFieldText(panel->raisT, "OFF");
|
||||
} else if (w == panel->raisB[1]) {
|
||||
WMSetTextFieldText(panel->raisT, "10");
|
||||
} else if (w == panel->raisB[2]) {
|
||||
WMSetTextFieldText(panel->raisT, "100");
|
||||
} else if (w == panel->raisB[3]) {
|
||||
WMSetTextFieldText(panel->raisT, "350");
|
||||
} else if (w == panel->raisB[4]) {
|
||||
WMSetTextFieldText(panel->raisT, "800");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
raiseTextChanged(void *observerData, WMNotification *notification)
|
||||
static void raiseTextChanged(void *observerData, WMNotification * notification)
|
||||
{
|
||||
_Panel *panel = (_Panel*)observerData;
|
||||
int i;
|
||||
_Panel *panel = (_Panel *) observerData;
|
||||
int i;
|
||||
|
||||
if (panel->raiseDelaySelected) {
|
||||
for (i=0; i<5; i++) {
|
||||
WMSetButtonSelected(panel->raisB[i], False);
|
||||
}
|
||||
panel->raiseDelaySelected = 0;
|
||||
}
|
||||
if (panel->raiseDelaySelected) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
WMSetButtonSelected(panel->raisB[i], False);
|
||||
}
|
||||
panel->raiseDelaySelected = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
int i;
|
||||
char *buf1, *buf2;
|
||||
WMPixmap *icon;
|
||||
WMColor *color;
|
||||
WMFont *font;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
int i;
|
||||
char *buf1, *buf2;
|
||||
WMPixmap *icon;
|
||||
WMColor *color;
|
||||
WMFont *font;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/***************** Input Focus Mode *****************/
|
||||
panel->kfocF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->kfocF, 240, 130);
|
||||
WMMoveWidget(panel->kfocF, 15, 15);
|
||||
WMSetFrameTitle(panel->kfocF, _("Input Focus Mode"));
|
||||
panel->kfocF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->kfocF, 240, 130);
|
||||
WMMoveWidget(panel->kfocF, 15, 15);
|
||||
WMSetFrameTitle(panel->kfocF, _("Input Focus Mode"));
|
||||
|
||||
{
|
||||
WMBox *box = WMCreateBox(panel->kfocF);
|
||||
WMSetViewExpandsToParent(WMWidgetView(box), 10, 15, 10, 10);
|
||||
WMSetBoxHorizontal(box, False);
|
||||
{
|
||||
WMBox *box = WMCreateBox(panel->kfocF);
|
||||
WMSetViewExpandsToParent(WMWidgetView(box), 10, 15, 10, 10);
|
||||
WMSetBoxHorizontal(box, False);
|
||||
|
||||
panel->kfocB[0] = WMCreateRadioButton(box);
|
||||
WMSetButtonText(panel->kfocB[0], _("Manual: Click on the window to set "\
|
||||
"keyboard input focus."));
|
||||
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[0]), True, True,
|
||||
20, 0, 0);
|
||||
panel->kfocB[0] = WMCreateRadioButton(box);
|
||||
WMSetButtonText(panel->kfocB[0], _("Manual: Click on the window to set "
|
||||
"keyboard input focus."));
|
||||
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[0]), True, True, 20, 0, 0);
|
||||
|
||||
panel->kfocB[1] = WMCreateRadioButton(box);
|
||||
WMGroupButtons(panel->kfocB[0], panel->kfocB[1]);
|
||||
WMSetButtonText(panel->kfocB[1], _("Auto: Set keyboard input focus to "\
|
||||
"the window under the mouse pointer."));
|
||||
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[1]), True, True,
|
||||
20, 0, 0);
|
||||
panel->kfocB[1] = WMCreateRadioButton(box);
|
||||
WMGroupButtons(panel->kfocB[0], panel->kfocB[1]);
|
||||
WMSetButtonText(panel->kfocB[1], _("Auto: Set keyboard input focus to "
|
||||
"the window under the mouse pointer."));
|
||||
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[1]), True, True, 20, 0, 0);
|
||||
|
||||
WMMapSubwidgets(box);
|
||||
WMMapWidget(box);
|
||||
}
|
||||
WMMapSubwidgets(box);
|
||||
WMMapWidget(box);
|
||||
}
|
||||
|
||||
/***************** Colormap Installation Mode ****************/
|
||||
|
||||
panel->cfocF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->cfocF, 240, 70);
|
||||
WMMoveWidget(panel->cfocF, 15, 150);
|
||||
WMSetFrameTitle(panel->cfocF, _("Install colormap in the window..."));
|
||||
panel->cfocF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->cfocF, 240, 70);
|
||||
WMMoveWidget(panel->cfocF, 15, 150);
|
||||
WMSetFrameTitle(panel->cfocF, _("Install colormap in the window..."));
|
||||
|
||||
panel->manB = WMCreateRadioButton(panel->cfocF);
|
||||
WMResizeWidget(panel->manB, 225, 20);
|
||||
WMMoveWidget(panel->manB, 10, 18);
|
||||
WMSetButtonText(panel->manB, _("...that has the input focus."));
|
||||
panel->manB = WMCreateRadioButton(panel->cfocF);
|
||||
WMResizeWidget(panel->manB, 225, 20);
|
||||
WMMoveWidget(panel->manB, 10, 18);
|
||||
WMSetButtonText(panel->manB, _("...that has the input focus."));
|
||||
|
||||
panel->autB = WMCreateRadioButton(panel->cfocF);
|
||||
WMResizeWidget(panel->autB, 225, 20);
|
||||
WMMoveWidget(panel->autB, 10, 43);
|
||||
WMSetButtonText(panel->autB, _("...that's under the mouse pointer."));
|
||||
WMGroupButtons(panel->manB, panel->autB);
|
||||
panel->autB = WMCreateRadioButton(panel->cfocF);
|
||||
WMResizeWidget(panel->autB, 225, 20);
|
||||
WMMoveWidget(panel->autB, 10, 43);
|
||||
WMSetButtonText(panel->autB, _("...that's under the mouse pointer."));
|
||||
WMGroupButtons(panel->manB, panel->autB);
|
||||
|
||||
WMMapSubwidgets(panel->cfocF);
|
||||
WMMapSubwidgets(panel->cfocF);
|
||||
|
||||
/***************** Automatic window raise delay *****************/
|
||||
panel->raisF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->raisF, 245, 70);
|
||||
WMMoveWidget(panel->raisF, 265, 15);
|
||||
WMSetFrameTitle(panel->raisF, _("Automatic Window Raise Delay"));
|
||||
panel->raisF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->raisF, 245, 70);
|
||||
WMMoveWidget(panel->raisF, 265, 15);
|
||||
WMSetFrameTitle(panel->raisF, _("Automatic Window Raise Delay"));
|
||||
|
||||
buf1 = wmalloc(strlen(DELAY_ICON)+1);
|
||||
buf2 = wmalloc(strlen(DELAY_ICON_S)+1);
|
||||
buf1 = wmalloc(strlen(DELAY_ICON) + 1);
|
||||
buf2 = wmalloc(strlen(DELAY_ICON_S) + 1);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
char *path;
|
||||
for (i = 0; i < 5; i++) {
|
||||
char *path;
|
||||
|
||||
panel->raisB[i] = WMCreateCustomButton(panel->raisF,
|
||||
WBBStateChangeMask);
|
||||
WMResizeWidget(panel->raisB[i], 25, 25);
|
||||
WMMoveWidget(panel->raisB[i], 10+(30*i), 25);
|
||||
WMSetButtonBordered(panel->raisB[i], False);
|
||||
WMSetButtonImagePosition(panel->raisB[i], WIPImageOnly);
|
||||
WMSetButtonAction(panel->raisB[i], pushDelayButton, panel);
|
||||
if (i>0)
|
||||
WMGroupButtons(panel->raisB[0], panel->raisB[i]);
|
||||
sprintf(buf1, DELAY_ICON, i);
|
||||
sprintf(buf2, DELAY_ICON_S, i);
|
||||
path = LocateImage(buf1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->raisB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->raisB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
panel->raisB[i] = WMCreateCustomButton(panel->raisF, WBBStateChangeMask);
|
||||
WMResizeWidget(panel->raisB[i], 25, 25);
|
||||
WMMoveWidget(panel->raisB[i], 10 + (30 * i), 25);
|
||||
WMSetButtonBordered(panel->raisB[i], False);
|
||||
WMSetButtonImagePosition(panel->raisB[i], WIPImageOnly);
|
||||
WMSetButtonAction(panel->raisB[i], pushDelayButton, panel);
|
||||
if (i > 0)
|
||||
WMGroupButtons(panel->raisB[0], panel->raisB[i]);
|
||||
sprintf(buf1, DELAY_ICON, i);
|
||||
sprintf(buf2, DELAY_ICON_S, i);
|
||||
path = LocateImage(buf1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->raisB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->raisB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
panel->raisT = WMCreateTextField(panel->raisF);
|
||||
WMResizeWidget(panel->raisT, 36, 20);
|
||||
WMMoveWidget(panel->raisT, 165, 30);
|
||||
WMAddNotificationObserver(raiseTextChanged, panel,
|
||||
WMTextDidChangeNotification, panel->raisT);
|
||||
panel->raisT = WMCreateTextField(panel->raisF);
|
||||
WMResizeWidget(panel->raisT, 36, 20);
|
||||
WMMoveWidget(panel->raisT, 165, 30);
|
||||
WMAddNotificationObserver(raiseTextChanged, panel, WMTextDidChangeNotification, panel->raisT);
|
||||
|
||||
color = WMDarkGrayColor(scr);
|
||||
font = WMSystemFontOfSize(scr, 10);
|
||||
color = WMDarkGrayColor(scr);
|
||||
font = WMSystemFontOfSize(scr, 10);
|
||||
|
||||
panel->raisL = WMCreateLabel(panel->raisF);
|
||||
WMResizeWidget(panel->raisL, 36, 16);
|
||||
WMMoveWidget(panel->raisL, 205, 35);
|
||||
WMSetLabelText(panel->raisL, _("msec"));
|
||||
WMSetLabelTextColor(panel->raisL, color);
|
||||
WMSetLabelFont(panel->raisL, font);
|
||||
panel->raisL = WMCreateLabel(panel->raisF);
|
||||
WMResizeWidget(panel->raisL, 36, 16);
|
||||
WMMoveWidget(panel->raisL, 205, 35);
|
||||
WMSetLabelText(panel->raisL, _("msec"));
|
||||
WMSetLabelTextColor(panel->raisL, color);
|
||||
WMSetLabelFont(panel->raisL, font);
|
||||
|
||||
WMReleaseColor(color);
|
||||
WMReleaseFont(font);
|
||||
WMReleaseColor(color);
|
||||
WMReleaseFont(font);
|
||||
|
||||
WMMapSubwidgets(panel->raisF);
|
||||
WMMapSubwidgets(panel->raisF);
|
||||
|
||||
/***************** Options ****************/
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 245, 125);
|
||||
WMMoveWidget(panel->optF, 265, 95);
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 245, 125);
|
||||
WMMoveWidget(panel->optF, 265, 95);
|
||||
|
||||
panel->ignB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->ignB, 225, 50);
|
||||
WMMoveWidget(panel->ignB, 10, 10);
|
||||
WMSetButtonText(panel->ignB, _("Do not let applications receive "
|
||||
"the click used to focus windows."));
|
||||
panel->ignB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->ignB, 225, 50);
|
||||
WMMoveWidget(panel->ignB, 10, 10);
|
||||
WMSetButtonText(panel->ignB, _("Do not let applications receive " "the click used to focus windows."));
|
||||
|
||||
panel->newB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->newB, 225, 35);
|
||||
WMMoveWidget(panel->newB, 10, 70);
|
||||
WMSetButtonText(panel->newB, _("Automatically focus new windows."));
|
||||
panel->newB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->newB, 225, 35);
|
||||
WMMoveWidget(panel->newB, 10, 70);
|
||||
WMSetButtonText(panel->newB, _("Automatically focus new windows."));
|
||||
|
||||
WMMapSubwidgets(panel->optF);
|
||||
WMMapSubwidgets(panel->optF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitFocus(WMScreen *scr, WMWindow *win)
|
||||
Panel *InitFocus(WMScreen * scr, WMWindow * win)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Window Focus Preferences");
|
||||
panel->sectionName = _("Window Focus Preferences");
|
||||
|
||||
panel->description = _("Keyboard focus switching policy, colormap switching\n"
|
||||
"policy for 8bpp displays and other related options.");
|
||||
panel->description = _("Keyboard focus switching policy, colormap switching\n"
|
||||
"policy for 8bpp displays and other related options.");
|
||||
|
||||
panel->parent = win;
|
||||
panel->parent = win;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
3161
WPrefs.app/Font.c
3161
WPrefs.app/Font.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -20,340 +20,316 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *posF;
|
||||
WMFrame *posVF;
|
||||
WMFrame *posV;
|
||||
WMFrame *posF;
|
||||
WMFrame *posVF;
|
||||
WMFrame *posV;
|
||||
|
||||
WMButton *posB[8];
|
||||
WMButton *posB[8];
|
||||
|
||||
WMFrame *animF;
|
||||
WMButton *animB[4];
|
||||
WMFrame *animF;
|
||||
WMButton *animB[4];
|
||||
|
||||
WMFrame *optF;
|
||||
WMButton *arrB;
|
||||
WMButton *omnB;
|
||||
WMFrame *optF;
|
||||
WMButton *arrB;
|
||||
WMButton *omnB;
|
||||
|
||||
WMFrame *sizeF;
|
||||
WMPopUpButton *sizeP;
|
||||
WMFrame *sizeF;
|
||||
WMPopUpButton *sizeP;
|
||||
|
||||
int iconPos;
|
||||
int iconPos;
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "iconprefs"
|
||||
|
||||
|
||||
static void
|
||||
showIconLayout(WMWidget *widget, void *data)
|
||||
static void showIconLayout(WMWidget * widget, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
int w, h;
|
||||
int i;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
int w, h;
|
||||
int i;
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
if (panel->posB[i] == widget) {
|
||||
panel->iconPos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (panel->posB[i] == widget) {
|
||||
panel->iconPos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (panel->iconPos & 1) {
|
||||
w = 32;
|
||||
h = 8;
|
||||
} else {
|
||||
w = 8;
|
||||
h = 32;
|
||||
}
|
||||
WMResizeWidget(panel->posV, w, h);
|
||||
if (panel->iconPos & 1) {
|
||||
w = 32;
|
||||
h = 8;
|
||||
} else {
|
||||
w = 8;
|
||||
h = 32;
|
||||
}
|
||||
WMResizeWidget(panel->posV, w, h);
|
||||
|
||||
switch (panel->iconPos & ~1) {
|
||||
case 0:
|
||||
WMMoveWidget(panel->posV, 2, 2);
|
||||
break;
|
||||
case 2:
|
||||
WMMoveWidget(panel->posV, 95-2-w, 2);
|
||||
break;
|
||||
case 4:
|
||||
WMMoveWidget(panel->posV, 2, 70-2-h);
|
||||
break;
|
||||
default:
|
||||
WMMoveWidget(panel->posV, 95-2-w, 70-2-h);
|
||||
break;
|
||||
}
|
||||
switch (panel->iconPos & ~1) {
|
||||
case 0:
|
||||
WMMoveWidget(panel->posV, 2, 2);
|
||||
break;
|
||||
case 2:
|
||||
WMMoveWidget(panel->posV, 95 - 2 - w, 2);
|
||||
break;
|
||||
case 4:
|
||||
WMMoveWidget(panel->posV, 2, 70 - 2 - h);
|
||||
break;
|
||||
default:
|
||||
WMMoveWidget(panel->posV, 95 - 2 - w, 70 - 2 - h);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
int i;
|
||||
char *str;
|
||||
char *def = "blh";
|
||||
int i;
|
||||
char *str;
|
||||
char *def = "blh";
|
||||
|
||||
WMSetButtonSelected(panel->arrB, GetBoolForKey("AutoArrangeIcons"));
|
||||
WMSetButtonSelected(panel->arrB, GetBoolForKey("AutoArrangeIcons"));
|
||||
|
||||
WMSetButtonSelected(panel->omnB, GetBoolForKey("StickyIcons"));
|
||||
WMSetButtonSelected(panel->omnB, GetBoolForKey("StickyIcons"));
|
||||
|
||||
str = GetStringForKey("IconPosition");
|
||||
if (!str)
|
||||
str = def;
|
||||
if (strlen(str)!=3) {
|
||||
wwarning("bad value %s for option IconPosition. Using default blh",
|
||||
str);
|
||||
str = def;
|
||||
}
|
||||
str = GetStringForKey("IconPosition");
|
||||
if (!str)
|
||||
str = def;
|
||||
if (strlen(str) != 3) {
|
||||
wwarning("bad value %s for option IconPosition. Using default blh", str);
|
||||
str = def;
|
||||
}
|
||||
|
||||
if (str[0]=='t' || str[0]=='T') {
|
||||
i = 0;
|
||||
} else {
|
||||
i = 4;
|
||||
}
|
||||
if (str[1]=='r' || str[1]=='R') {
|
||||
i += 2;
|
||||
}
|
||||
if (str[2]=='v' || str[2]=='V') {
|
||||
i += 0;
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
panel->iconPos = i;
|
||||
WMPerformButtonClick(panel->posB[i]);
|
||||
if (str[0] == 't' || str[0] == 'T') {
|
||||
i = 0;
|
||||
} else {
|
||||
i = 4;
|
||||
}
|
||||
if (str[1] == 'r' || str[1] == 'R') {
|
||||
i += 2;
|
||||
}
|
||||
if (str[2] == 'v' || str[2] == 'V') {
|
||||
i += 0;
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
panel->iconPos = i;
|
||||
WMPerformButtonClick(panel->posB[i]);
|
||||
|
||||
i = GetIntegerForKey("IconSize");
|
||||
i = (i-24)/8;
|
||||
i = GetIntegerForKey("IconSize");
|
||||
i = (i - 24) / 8;
|
||||
|
||||
if (i<0)
|
||||
i = 0;
|
||||
else if (i>9)
|
||||
i = 9;
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, i);
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
else if (i > 9)
|
||||
i = 9;
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, i);
|
||||
|
||||
str = GetStringForKey("IconificationStyle");
|
||||
if (!str)
|
||||
str = "zoom";
|
||||
if (strcasecmp(str, "none")==0)
|
||||
WMPerformButtonClick(panel->animB[3]);
|
||||
else if (strcasecmp(str, "twist")==0)
|
||||
WMPerformButtonClick(panel->animB[1]);
|
||||
else if (strcasecmp(str, "flip")==0)
|
||||
WMPerformButtonClick(panel->animB[2]);
|
||||
else {
|
||||
WMPerformButtonClick(panel->animB[0]);
|
||||
}
|
||||
str = GetStringForKey("IconificationStyle");
|
||||
if (!str)
|
||||
str = "zoom";
|
||||
if (strcasecmp(str, "none") == 0)
|
||||
WMPerformButtonClick(panel->animB[3]);
|
||||
else if (strcasecmp(str, "twist") == 0)
|
||||
WMPerformButtonClick(panel->animB[1]);
|
||||
else if (strcasecmp(str, "flip") == 0)
|
||||
WMPerformButtonClick(panel->animB[2]);
|
||||
else {
|
||||
WMPerformButtonClick(panel->animB[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMColor *color;
|
||||
int i;
|
||||
char buf[16];
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMColor *color;
|
||||
int i;
|
||||
char buf[16];
|
||||
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/***************** Positioning of Icons *****************/
|
||||
panel->posF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->posF, 260, 135);
|
||||
WMMoveWidget(panel->posF, 25, 10);
|
||||
WMSetFrameTitle(panel->posF, _("Icon Positioning"));
|
||||
panel->posF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->posF, 260, 135);
|
||||
WMMoveWidget(panel->posF, 25, 10);
|
||||
WMSetFrameTitle(panel->posF, _("Icon Positioning"));
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
panel->posB[i] = WMCreateButton(panel->posF, WBTOnOff);
|
||||
WMSetButtonAction(panel->posB[i], showIconLayout, panel);
|
||||
for (i = 0; i < 8; i++) {
|
||||
panel->posB[i] = WMCreateButton(panel->posF, WBTOnOff);
|
||||
WMSetButtonAction(panel->posB[i], showIconLayout, panel);
|
||||
|
||||
if (i>0)
|
||||
WMGroupButtons(panel->posB[0], panel->posB[i]);
|
||||
}
|
||||
WMMoveWidget(panel->posB[1], 70, 23);
|
||||
WMResizeWidget(panel->posB[1], 47, 15);
|
||||
WMMoveWidget(panel->posB[3], 70+47, 23);
|
||||
WMResizeWidget(panel->posB[3], 47, 15);
|
||||
if (i > 0)
|
||||
WMGroupButtons(panel->posB[0], panel->posB[i]);
|
||||
}
|
||||
WMMoveWidget(panel->posB[1], 70, 23);
|
||||
WMResizeWidget(panel->posB[1], 47, 15);
|
||||
WMMoveWidget(panel->posB[3], 70 + 47, 23);
|
||||
WMResizeWidget(panel->posB[3], 47, 15);
|
||||
|
||||
WMMoveWidget(panel->posB[0], 55, 38);
|
||||
WMResizeWidget(panel->posB[0], 15, 35);
|
||||
WMMoveWidget(panel->posB[4], 55, 38+35);
|
||||
WMResizeWidget(panel->posB[4], 15, 35);
|
||||
WMMoveWidget(panel->posB[0], 55, 38);
|
||||
WMResizeWidget(panel->posB[0], 15, 35);
|
||||
WMMoveWidget(panel->posB[4], 55, 38 + 35);
|
||||
WMResizeWidget(panel->posB[4], 15, 35);
|
||||
|
||||
WMMoveWidget(panel->posB[5], 70, 38+70);
|
||||
WMResizeWidget(panel->posB[5], 47, 15);
|
||||
WMMoveWidget(panel->posB[7], 70+47, 38+70);
|
||||
WMResizeWidget(panel->posB[7], 47, 15);
|
||||
WMMoveWidget(panel->posB[5], 70, 38 + 70);
|
||||
WMResizeWidget(panel->posB[5], 47, 15);
|
||||
WMMoveWidget(panel->posB[7], 70 + 47, 38 + 70);
|
||||
WMResizeWidget(panel->posB[7], 47, 15);
|
||||
|
||||
WMMoveWidget(panel->posB[2], 70+95, 38);
|
||||
WMResizeWidget(panel->posB[2], 15, 35);
|
||||
WMMoveWidget(panel->posB[6], 70+95, 38+35);
|
||||
WMResizeWidget(panel->posB[6], 15, 35);
|
||||
WMMoveWidget(panel->posB[2], 70 + 95, 38);
|
||||
WMResizeWidget(panel->posB[2], 15, 35);
|
||||
WMMoveWidget(panel->posB[6], 70 + 95, 38 + 35);
|
||||
WMResizeWidget(panel->posB[6], 15, 35);
|
||||
|
||||
color = WMCreateRGBColor(WMWidgetScreen(panel->parent), 0x5100, 0x5100,
|
||||
0x7100, True);
|
||||
panel->posVF = WMCreateFrame(panel->posF);
|
||||
WMResizeWidget(panel->posVF, 95, 70);
|
||||
WMMoveWidget(panel->posVF, 70, 38);
|
||||
WMSetFrameRelief(panel->posVF, WRSunken);
|
||||
WMSetWidgetBackgroundColor(panel->posVF, color);
|
||||
WMReleaseColor(color);
|
||||
color = WMCreateRGBColor(WMWidgetScreen(panel->parent), 0x5100, 0x5100, 0x7100, True);
|
||||
panel->posVF = WMCreateFrame(panel->posF);
|
||||
WMResizeWidget(panel->posVF, 95, 70);
|
||||
WMMoveWidget(panel->posVF, 70, 38);
|
||||
WMSetFrameRelief(panel->posVF, WRSunken);
|
||||
WMSetWidgetBackgroundColor(panel->posVF, color);
|
||||
WMReleaseColor(color);
|
||||
|
||||
panel->posV = WMCreateFrame(panel->posVF);
|
||||
WMSetFrameRelief(panel->posV, WRSimple);
|
||||
panel->posV = WMCreateFrame(panel->posVF);
|
||||
WMSetFrameRelief(panel->posV, WRSimple);
|
||||
|
||||
WMMapSubwidgets(panel->posF);
|
||||
WMMapSubwidgets(panel->posF);
|
||||
|
||||
/***************** Animation ****************/
|
||||
panel->animF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->animF, 205, 135);
|
||||
WMMoveWidget(panel->animF, 295, 10);
|
||||
WMSetFrameTitle(panel->animF, _("Iconification Animation"));
|
||||
panel->animF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->animF, 205, 135);
|
||||
WMMoveWidget(panel->animF, 295, 10);
|
||||
WMSetFrameTitle(panel->animF, _("Iconification Animation"));
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
panel->animB[i] = WMCreateRadioButton(panel->animF);
|
||||
WMResizeWidget(panel->animB[i], 170, 20);
|
||||
WMMoveWidget(panel->animB[i], 20, 24+i*25);
|
||||
}
|
||||
WMGroupButtons(panel->animB[0], panel->animB[1]);
|
||||
WMGroupButtons(panel->animB[0], panel->animB[2]);
|
||||
WMGroupButtons(panel->animB[0], panel->animB[3]);
|
||||
for (i = 0; i < 4; i++) {
|
||||
panel->animB[i] = WMCreateRadioButton(panel->animF);
|
||||
WMResizeWidget(panel->animB[i], 170, 20);
|
||||
WMMoveWidget(panel->animB[i], 20, 24 + i * 25);
|
||||
}
|
||||
WMGroupButtons(panel->animB[0], panel->animB[1]);
|
||||
WMGroupButtons(panel->animB[0], panel->animB[2]);
|
||||
WMGroupButtons(panel->animB[0], panel->animB[3]);
|
||||
|
||||
WMSetButtonText(panel->animB[0], _("Shrinking/Zooming"));
|
||||
WMSetButtonText(panel->animB[1], _("Spinning/Twisting"));
|
||||
WMSetButtonText(panel->animB[2], _("3D-flipping"));
|
||||
WMSetButtonText(panel->animB[3], _("None"));
|
||||
WMSetButtonText(panel->animB[0], _("Shrinking/Zooming"));
|
||||
WMSetButtonText(panel->animB[1], _("Spinning/Twisting"));
|
||||
WMSetButtonText(panel->animB[2], _("3D-flipping"));
|
||||
WMSetButtonText(panel->animB[3], _("None"));
|
||||
|
||||
WMMapSubwidgets(panel->animF);
|
||||
WMMapSubwidgets(panel->animF);
|
||||
|
||||
/***************** Options ****************/
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 260, 70);
|
||||
WMMoveWidget(panel->optF, 25, 150);
|
||||
/* WMSetFrameTitle(panel->optF, _("Icon Display"));*/
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 260, 70);
|
||||
WMMoveWidget(panel->optF, 25, 150);
|
||||
/* WMSetFrameTitle(panel->optF, _("Icon Display")); */
|
||||
|
||||
panel->arrB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->arrB, 235, 20);
|
||||
WMMoveWidget(panel->arrB, 15, 15);
|
||||
WMSetButtonText(panel->arrB, _("Auto-arrange icons"));
|
||||
panel->arrB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->arrB, 235, 20);
|
||||
WMMoveWidget(panel->arrB, 15, 15);
|
||||
WMSetButtonText(panel->arrB, _("Auto-arrange icons"));
|
||||
|
||||
WMSetBalloonTextForView(_("Keep icons and miniwindows arranged all the time."),
|
||||
WMWidgetView(panel->arrB));
|
||||
WMSetBalloonTextForView(_("Keep icons and miniwindows arranged all the time."), WMWidgetView(panel->arrB));
|
||||
|
||||
panel->omnB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->omnB, 235, 20);
|
||||
WMMoveWidget(panel->omnB, 15, 40);
|
||||
WMSetButtonText(panel->omnB, _("Omnipresent miniwindows"));
|
||||
panel->omnB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->omnB, 235, 20);
|
||||
WMMoveWidget(panel->omnB, 15, 40);
|
||||
WMSetButtonText(panel->omnB, _("Omnipresent miniwindows"));
|
||||
|
||||
WMSetBalloonTextForView(_("Make miniwindows be present in all workspaces."),
|
||||
WMWidgetView(panel->omnB));
|
||||
WMSetBalloonTextForView(_("Make miniwindows be present in all workspaces."), WMWidgetView(panel->omnB));
|
||||
|
||||
WMMapSubwidgets(panel->optF);
|
||||
WMMapSubwidgets(panel->optF);
|
||||
|
||||
/***************** Icon Size ****************/
|
||||
panel->sizeF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->sizeF, 205, 70);
|
||||
WMMoveWidget(panel->sizeF, 295, 150);
|
||||
WMSetFrameTitle(panel->sizeF, _("Icon Size"));
|
||||
panel->sizeF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->sizeF, 205, 70);
|
||||
WMMoveWidget(panel->sizeF, 295, 150);
|
||||
WMSetFrameTitle(panel->sizeF, _("Icon Size"));
|
||||
|
||||
WMSetBalloonTextForView(_("The size of the dock/application icon and miniwindows"),
|
||||
WMWidgetView(panel->sizeF));
|
||||
WMSetBalloonTextForView(_("The size of the dock/application icon and miniwindows"),
|
||||
WMWidgetView(panel->sizeF));
|
||||
|
||||
panel->sizeP = WMCreatePopUpButton(panel->sizeF);
|
||||
WMResizeWidget(panel->sizeP, 156, 20);
|
||||
WMMoveWidget(panel->sizeP, 25, 30);
|
||||
for (i=24; i<=96; i+=8) {
|
||||
sprintf(buf, "%ix%i", i, i);
|
||||
WMAddPopUpButtonItem(panel->sizeP, buf);
|
||||
}
|
||||
panel->sizeP = WMCreatePopUpButton(panel->sizeF);
|
||||
WMResizeWidget(panel->sizeP, 156, 20);
|
||||
WMMoveWidget(panel->sizeP, 25, 30);
|
||||
for (i = 24; i <= 96; i += 8) {
|
||||
sprintf(buf, "%ix%i", i, i);
|
||||
WMAddPopUpButtonItem(panel->sizeP, buf);
|
||||
}
|
||||
|
||||
WMMapSubwidgets(panel->sizeF);
|
||||
WMMapSubwidgets(panel->sizeF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
char buf[8];
|
||||
char buf[8];
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->arrB), "AutoArrangeIcons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->omnB), "StickyIcons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->arrB), "AutoArrangeIcons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->omnB), "StickyIcons");
|
||||
|
||||
SetIntegerForKey(WMGetPopUpButtonSelectedItem(panel->sizeP)*8+24,
|
||||
"IconSize");
|
||||
SetIntegerForKey(WMGetPopUpButtonSelectedItem(panel->sizeP) * 8 + 24, "IconSize");
|
||||
|
||||
buf[3] = 0;
|
||||
buf[3] = 0;
|
||||
|
||||
if (panel->iconPos < 4) {
|
||||
buf[0] = 't';
|
||||
} else {
|
||||
buf[0] = 'b';
|
||||
}
|
||||
if (panel->iconPos & 2) {
|
||||
buf[1] = 'r';
|
||||
} else {
|
||||
buf[1] = 'l';
|
||||
}
|
||||
if (panel->iconPos & 1) {
|
||||
buf[2] = 'h';
|
||||
} else {
|
||||
buf[2] = 'v';
|
||||
}
|
||||
SetStringForKey(buf, "IconPosition");
|
||||
if (panel->iconPos < 4) {
|
||||
buf[0] = 't';
|
||||
} else {
|
||||
buf[0] = 'b';
|
||||
}
|
||||
if (panel->iconPos & 2) {
|
||||
buf[1] = 'r';
|
||||
} else {
|
||||
buf[1] = 'l';
|
||||
}
|
||||
if (panel->iconPos & 1) {
|
||||
buf[2] = 'h';
|
||||
} else {
|
||||
buf[2] = 'v';
|
||||
}
|
||||
SetStringForKey(buf, "IconPosition");
|
||||
|
||||
if (WMGetButtonSelected(panel->animB[0]))
|
||||
SetStringForKey("zoom", "IconificationStyle");
|
||||
else if (WMGetButtonSelected(panel->animB[1]))
|
||||
SetStringForKey("twist", "IconificationStyle");
|
||||
else if (WMGetButtonSelected(panel->animB[2]))
|
||||
SetStringForKey("flip", "IconificationStyle");
|
||||
else
|
||||
SetStringForKey("none", "IconificationStyle");
|
||||
if (WMGetButtonSelected(panel->animB[0]))
|
||||
SetStringForKey("zoom", "IconificationStyle");
|
||||
else if (WMGetButtonSelected(panel->animB[1]))
|
||||
SetStringForKey("twist", "IconificationStyle");
|
||||
else if (WMGetButtonSelected(panel->animB[2]))
|
||||
SetStringForKey("flip", "IconificationStyle");
|
||||
else
|
||||
SetStringForKey("none", "IconificationStyle");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitIcons(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitIcons(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Icon Preferences");
|
||||
panel->sectionName = _("Icon Preferences");
|
||||
|
||||
panel->description = _("Icon/Miniwindow handling options. Icon positioning\n"
|
||||
"area, sizes of icons, miniaturization animation style.");
|
||||
panel->description = _("Icon/Miniwindow handling options. Icon positioning\n"
|
||||
"area, sizes of icons, miniaturization animation style.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,166 +20,158 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *delaF;
|
||||
WMButton *delaB[4];
|
||||
WMLabel *dmsL;
|
||||
WMTextField *dmsT;
|
||||
WMFrame *delaF;
|
||||
WMButton *delaB[4];
|
||||
WMLabel *dmsL;
|
||||
WMTextField *dmsT;
|
||||
|
||||
WMFrame *rateF;
|
||||
WMButton *rateB[4];
|
||||
WMLabel *rmsL;
|
||||
WMTextField *rmsT;
|
||||
WMFrame *rateF;
|
||||
WMButton *rateB[4];
|
||||
WMLabel *rmsL;
|
||||
WMTextField *rmsT;
|
||||
|
||||
WMTextField *testT;
|
||||
WMTextField *testT;
|
||||
} _Panel;
|
||||
|
||||
|
||||
#define ICON_FILE "keyboard"
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
int i;
|
||||
WMColor *color;
|
||||
WMFont *font;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
int i;
|
||||
WMColor *color;
|
||||
WMFont *font;
|
||||
|
||||
color = WMDarkGrayColor(scr);
|
||||
font = WMSystemFontOfSize(scr, 10);
|
||||
color = WMDarkGrayColor(scr);
|
||||
font = WMSystemFontOfSize(scr, 10);
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/**************** Initial Key Repeat ***************/
|
||||
panel->delaF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->delaF, 495, 60);
|
||||
WMMoveWidget(panel->delaF, 15, 10);
|
||||
WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
|
||||
panel->delaF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->delaF, 495, 60);
|
||||
WMMoveWidget(panel->delaF, 15, 10);
|
||||
WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
|
||||
WMResizeWidget(panel->delaB[i], 60, 20);
|
||||
WMMoveWidget(panel->delaB[i], 70+i*60, 25);
|
||||
if (i>0)
|
||||
WMGroupButtons(panel->delaB[0], panel->delaB[i]);
|
||||
switch (i) {
|
||||
case 0:
|
||||
WMSetButtonText(panel->delaB[i], "....a");
|
||||
break;
|
||||
case 1:
|
||||
WMSetButtonText(panel->delaB[i], "...a");
|
||||
break;
|
||||
case 2:
|
||||
WMSetButtonText(panel->delaB[i], "..a");
|
||||
break;
|
||||
case 3:
|
||||
WMSetButtonText(panel->delaB[i], ".a");
|
||||
break;
|
||||
}
|
||||
}
|
||||
panel->dmsT = WMCreateTextField(panel->delaF);
|
||||
WMResizeWidget(panel->dmsT, 50, 20);
|
||||
WMMoveWidget(panel->dmsT, 345, 25);
|
||||
/* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
|
||||
for (i = 0; i < 4; i++) {
|
||||
panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
|
||||
WMResizeWidget(panel->delaB[i], 60, 20);
|
||||
WMMoveWidget(panel->delaB[i], 70 + i * 60, 25);
|
||||
if (i > 0)
|
||||
WMGroupButtons(panel->delaB[0], panel->delaB[i]);
|
||||
switch (i) {
|
||||
case 0:
|
||||
WMSetButtonText(panel->delaB[i], "....a");
|
||||
break;
|
||||
case 1:
|
||||
WMSetButtonText(panel->delaB[i], "...a");
|
||||
break;
|
||||
case 2:
|
||||
WMSetButtonText(panel->delaB[i], "..a");
|
||||
break;
|
||||
case 3:
|
||||
WMSetButtonText(panel->delaB[i], ".a");
|
||||
break;
|
||||
}
|
||||
}
|
||||
panel->dmsT = WMCreateTextField(panel->delaF);
|
||||
WMResizeWidget(panel->dmsT, 50, 20);
|
||||
WMMoveWidget(panel->dmsT, 345, 25);
|
||||
/* WMSetTextFieldAlignment(panel->dmsT, WARight); */
|
||||
|
||||
panel->dmsL = WMCreateLabel(panel->delaF);
|
||||
WMResizeWidget(panel->dmsL, 30, 16);
|
||||
WMMoveWidget(panel->dmsL, 400, 30);
|
||||
WMSetLabelTextColor(panel->dmsL, color);
|
||||
WMSetLabelFont(panel->dmsL, font);
|
||||
WMSetLabelText(panel->dmsL, "msec");
|
||||
panel->dmsL = WMCreateLabel(panel->delaF);
|
||||
WMResizeWidget(panel->dmsL, 30, 16);
|
||||
WMMoveWidget(panel->dmsL, 400, 30);
|
||||
WMSetLabelTextColor(panel->dmsL, color);
|
||||
WMSetLabelFont(panel->dmsL, font);
|
||||
WMSetLabelText(panel->dmsL, "msec");
|
||||
|
||||
WMMapSubwidgets(panel->delaF);
|
||||
WMMapSubwidgets(panel->delaF);
|
||||
|
||||
/**************** Key Repeat Rate ***************/
|
||||
panel->rateF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->rateF, 495, 60);
|
||||
WMMoveWidget(panel->rateF, 15, 95);
|
||||
WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
|
||||
panel->rateF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->rateF, 495, 60);
|
||||
WMMoveWidget(panel->rateF, 15, 95);
|
||||
WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
|
||||
WMResizeWidget(panel->rateB[i], 60, 20);
|
||||
WMMoveWidget(panel->rateB[i], 70+i*60, 25);
|
||||
if (i>0)
|
||||
WMGroupButtons(panel->rateB[0], panel->rateB[i]);
|
||||
switch (i) {
|
||||
case 0:
|
||||
WMSetButtonText(panel->rateB[i], "a....a");
|
||||
break;
|
||||
case 1:
|
||||
WMSetButtonText(panel->rateB[i], "a...a");
|
||||
break;
|
||||
case 2:
|
||||
WMSetButtonText(panel->rateB[i], "a..a");
|
||||
break;
|
||||
case 3:
|
||||
WMSetButtonText(panel->rateB[i], "a.a");
|
||||
break;
|
||||
}
|
||||
}
|
||||
panel->rmsT = WMCreateTextField(panel->rateF);
|
||||
WMResizeWidget(panel->rmsT, 50, 20);
|
||||
WMMoveWidget(panel->rmsT, 345, 25);
|
||||
/* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
|
||||
for (i = 0; i < 4; i++) {
|
||||
panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
|
||||
WMResizeWidget(panel->rateB[i], 60, 20);
|
||||
WMMoveWidget(panel->rateB[i], 70 + i * 60, 25);
|
||||
if (i > 0)
|
||||
WMGroupButtons(panel->rateB[0], panel->rateB[i]);
|
||||
switch (i) {
|
||||
case 0:
|
||||
WMSetButtonText(panel->rateB[i], "a....a");
|
||||
break;
|
||||
case 1:
|
||||
WMSetButtonText(panel->rateB[i], "a...a");
|
||||
break;
|
||||
case 2:
|
||||
WMSetButtonText(panel->rateB[i], "a..a");
|
||||
break;
|
||||
case 3:
|
||||
WMSetButtonText(panel->rateB[i], "a.a");
|
||||
break;
|
||||
}
|
||||
}
|
||||
panel->rmsT = WMCreateTextField(panel->rateF);
|
||||
WMResizeWidget(panel->rmsT, 50, 20);
|
||||
WMMoveWidget(panel->rmsT, 345, 25);
|
||||
/* WMSetTextFieldAlignment(panel->rmsT, WARight); */
|
||||
|
||||
panel->rmsL = WMCreateLabel(panel->rateF);
|
||||
WMResizeWidget(panel->rmsL, 30, 16);
|
||||
WMMoveWidget(panel->rmsL, 400, 30);
|
||||
WMSetLabelTextColor(panel->rmsL, color);
|
||||
WMSetLabelFont(panel->rmsL, font);
|
||||
WMSetLabelText(panel->rmsL, "msec");
|
||||
panel->rmsL = WMCreateLabel(panel->rateF);
|
||||
WMResizeWidget(panel->rmsL, 30, 16);
|
||||
WMMoveWidget(panel->rmsL, 400, 30);
|
||||
WMSetLabelTextColor(panel->rmsL, color);
|
||||
WMSetLabelFont(panel->rmsL, font);
|
||||
WMSetLabelText(panel->rmsL, "msec");
|
||||
|
||||
WMMapSubwidgets(panel->rateF);
|
||||
WMMapSubwidgets(panel->rateF);
|
||||
|
||||
panel->testT = WMCreateTextField(panel->box);
|
||||
WMResizeWidget(panel->testT, 480, 20);
|
||||
WMMoveWidget(panel->testT, 20, 180);
|
||||
WMSetTextFieldText(panel->testT, _("Type here to test"));
|
||||
panel->testT = WMCreateTextField(panel->box);
|
||||
WMResizeWidget(panel->testT, 480, 20);
|
||||
WMMoveWidget(panel->testT, 20, 180);
|
||||
WMSetTextFieldText(panel->testT, _("Type here to test"));
|
||||
|
||||
WMReleaseColor(color);
|
||||
WMReleaseFont(font);
|
||||
WMReleaseColor(color);
|
||||
WMReleaseFont(font);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitKeyboardSettings(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitKeyboardSettings(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Keyboard Preferences");
|
||||
panel->sectionName = _("Keyboard Preferences");
|
||||
|
||||
panel->description = _("Not done");
|
||||
panel->description = _("Not done");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2605
WPrefs.app/Menu.c
2605
WPrefs.app/Menu.c
File diff suppressed because it is too large
Load Diff
@@ -20,35 +20,32 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *scrF;
|
||||
WMButton *scrB[5];
|
||||
WMFrame *scrF;
|
||||
WMButton *scrB[5];
|
||||
|
||||
WMFrame *aliF;
|
||||
WMButton *aliyB;
|
||||
WMButton *alinB;
|
||||
WMFrame *aliF;
|
||||
WMButton *aliyB;
|
||||
WMButton *alinB;
|
||||
|
||||
WMFrame *optF;
|
||||
WMButton *autoB;
|
||||
WMButton *wrapB;
|
||||
WMFrame *optF;
|
||||
WMButton *autoB;
|
||||
WMButton *wrapB;
|
||||
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "menuprefs"
|
||||
#define SPEED_IMAGE "speed%i"
|
||||
#define SPEED_IMAGE_S "speed%is"
|
||||
@@ -56,188 +53,178 @@ typedef struct _Panel {
|
||||
#define MENU_ALIGN1 "menualign1"
|
||||
#define MENU_ALIGN2 "menualign2"
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
WMPerformButtonClick(panel->scrB[GetSpeedForKey("MenuScrollSpeed")]);
|
||||
WMPerformButtonClick(panel->scrB[GetSpeedForKey("MenuScrollSpeed")]);
|
||||
|
||||
if (GetBoolForKey("AlignSubmenus"))
|
||||
WMPerformButtonClick(panel->aliyB);
|
||||
else
|
||||
WMPerformButtonClick(panel->alinB);
|
||||
if (GetBoolForKey("AlignSubmenus"))
|
||||
WMPerformButtonClick(panel->aliyB);
|
||||
else
|
||||
WMPerformButtonClick(panel->alinB);
|
||||
|
||||
WMSetButtonSelected(panel->wrapB, GetBoolForKey("WrapMenus"));
|
||||
WMSetButtonSelected(panel->wrapB, GetBoolForKey("WrapMenus"));
|
||||
|
||||
WMSetButtonSelected(panel->autoB, GetBoolForKey("ScrollableMenus"));
|
||||
WMSetButtonSelected(panel->autoB, GetBoolForKey("ScrollableMenus"));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (WMGetButtonSelected(panel->scrB[i]))
|
||||
break;
|
||||
}
|
||||
SetSpeedForKey(i, "MenuScrollSpeed");
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (WMGetButtonSelected(panel->scrB[i]))
|
||||
break;
|
||||
}
|
||||
SetSpeedForKey(i, "MenuScrollSpeed");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->aliyB), "AlignSubmenus");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->aliyB), "AlignSubmenus");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->wrapB), "WrapMenus");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->autoB), "ScrollableMenus");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->wrapB), "WrapMenus");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->autoB), "ScrollableMenus");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMPixmap *icon;
|
||||
int i;
|
||||
char *buf1, *buf2;
|
||||
char *path;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMPixmap *icon;
|
||||
int i;
|
||||
char *buf1, *buf2;
|
||||
char *path;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/***************** Menu Scroll Speed ****************/
|
||||
panel->scrF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->scrF, 235, 90);
|
||||
WMMoveWidget(panel->scrF, 25, 20);
|
||||
WMSetFrameTitle(panel->scrF, _("Menu Scrolling Speed"));
|
||||
panel->scrF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->scrF, 235, 90);
|
||||
WMMoveWidget(panel->scrF, 25, 20);
|
||||
WMSetFrameTitle(panel->scrF, _("Menu Scrolling Speed"));
|
||||
|
||||
buf1 = wmalloc(strlen(SPEED_IMAGE) + 1);
|
||||
buf2 = wmalloc(strlen(SPEED_IMAGE_S) + 1);
|
||||
for (i = 0; i < 5; i++) {
|
||||
panel->scrB[i] = WMCreateCustomButton(panel->scrF, WBBStateChangeMask);
|
||||
WMResizeWidget(panel->scrB[i], 40, 40);
|
||||
WMMoveWidget(panel->scrB[i], 15 + (40 * i), 30);
|
||||
WMSetButtonBordered(panel->scrB[i], False);
|
||||
WMSetButtonImagePosition(panel->scrB[i], WIPImageOnly);
|
||||
if (i > 0) {
|
||||
WMGroupButtons(panel->scrB[0], panel->scrB[i]);
|
||||
}
|
||||
sprintf(buf1, SPEED_IMAGE, i);
|
||||
sprintf(buf2, SPEED_IMAGE_S, i);
|
||||
path = LocateImage(buf1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->scrB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->scrB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
buf1 = wmalloc(strlen(SPEED_IMAGE)+1);
|
||||
buf2 = wmalloc(strlen(SPEED_IMAGE_S)+1);
|
||||
for (i = 0; i < 5; i++) {
|
||||
panel->scrB[i] = WMCreateCustomButton(panel->scrF, WBBStateChangeMask);
|
||||
WMResizeWidget(panel->scrB[i], 40, 40);
|
||||
WMMoveWidget(panel->scrB[i], 15+(40*i), 30);
|
||||
WMSetButtonBordered(panel->scrB[i], False);
|
||||
WMSetButtonImagePosition(panel->scrB[i], WIPImageOnly);
|
||||
if (i > 0) {
|
||||
WMGroupButtons(panel->scrB[0], panel->scrB[i]);
|
||||
}
|
||||
sprintf(buf1, SPEED_IMAGE, i);
|
||||
sprintf(buf2, SPEED_IMAGE_S, i);
|
||||
path = LocateImage(buf1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->scrB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(buf2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonAltImage(panel->scrB[i], icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
wfree(buf1);
|
||||
wfree(buf2);
|
||||
|
||||
WMMapSubwidgets(panel->scrF);
|
||||
WMMapSubwidgets(panel->scrF);
|
||||
|
||||
/***************** Submenu Alignment ****************/
|
||||
|
||||
panel->aliF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->aliF, 220, 90);
|
||||
WMMoveWidget(panel->aliF, 280, 20);
|
||||
WMSetFrameTitle(panel->aliF, _("Submenu Alignment"));
|
||||
panel->aliF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->aliF, 220, 90);
|
||||
WMMoveWidget(panel->aliF, 280, 20);
|
||||
WMSetFrameTitle(panel->aliF, _("Submenu Alignment"));
|
||||
|
||||
panel->alinB = WMCreateButton(panel->aliF, WBTOnOff);
|
||||
WMResizeWidget(panel->alinB, 48, 48);
|
||||
WMMoveWidget(panel->alinB, 56, 25);
|
||||
WMSetButtonImagePosition(panel->alinB, WIPImageOnly);
|
||||
path = LocateImage(MENU_ALIGN1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->alinB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
panel->aliyB = WMCreateButton(panel->aliF, WBTOnOff);
|
||||
WMResizeWidget(panel->aliyB, 48, 48);
|
||||
WMMoveWidget(panel->aliyB, 120, 25);
|
||||
WMSetButtonImagePosition(panel->aliyB, WIPImageOnly);
|
||||
path = LocateImage(MENU_ALIGN2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->aliyB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMGroupButtons(panel->alinB, panel->aliyB);
|
||||
panel->alinB = WMCreateButton(panel->aliF, WBTOnOff);
|
||||
WMResizeWidget(panel->alinB, 48, 48);
|
||||
WMMoveWidget(panel->alinB, 56, 25);
|
||||
WMSetButtonImagePosition(panel->alinB, WIPImageOnly);
|
||||
path = LocateImage(MENU_ALIGN1);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->alinB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
panel->aliyB = WMCreateButton(panel->aliF, WBTOnOff);
|
||||
WMResizeWidget(panel->aliyB, 48, 48);
|
||||
WMMoveWidget(panel->aliyB, 120, 25);
|
||||
WMSetButtonImagePosition(panel->aliyB, WIPImageOnly);
|
||||
path = LocateImage(MENU_ALIGN2);
|
||||
if (path) {
|
||||
icon = WMCreatePixmapFromFile(scr, path);
|
||||
if (icon) {
|
||||
WMSetButtonImage(panel->aliyB, icon);
|
||||
WMReleasePixmap(icon);
|
||||
} else {
|
||||
wwarning(_("could not load icon file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMGroupButtons(panel->alinB, panel->aliyB);
|
||||
|
||||
WMMapSubwidgets(panel->aliF);
|
||||
WMMapSubwidgets(panel->aliF);
|
||||
|
||||
/***************** Options ****************/
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 475, 80);
|
||||
WMMoveWidget(panel->optF, 25, 130);
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 475, 80);
|
||||
WMMoveWidget(panel->optF, 25, 130);
|
||||
|
||||
panel->wrapB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->wrapB, 440, 32);
|
||||
WMMoveWidget(panel->wrapB, 25, 8);
|
||||
WMSetButtonText(panel->wrapB, _("Always open submenus inside the screen, instead of scrolling.\nNote: this is annoying."));
|
||||
panel->wrapB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->wrapB, 440, 32);
|
||||
WMMoveWidget(panel->wrapB, 25, 8);
|
||||
WMSetButtonText(panel->wrapB,
|
||||
_
|
||||
("Always open submenus inside the screen, instead of scrolling.\nNote: this is annoying."));
|
||||
|
||||
panel->autoB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->autoB, 440, 32);
|
||||
WMMoveWidget(panel->autoB, 25, 45);
|
||||
WMSetButtonText(panel->autoB, _("Scroll off-screen menus when pointer is moved over them."));
|
||||
panel->autoB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->autoB, 440, 32);
|
||||
WMMoveWidget(panel->autoB, 25, 45);
|
||||
WMSetButtonText(panel->autoB, _("Scroll off-screen menus when pointer is moved over them."));
|
||||
|
||||
WMMapSubwidgets(panel->optF);
|
||||
WMMapSubwidgets(panel->optF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitMenuPreferences(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitMenuPreferences(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Menu Preferences");
|
||||
panel->sectionName = _("Menu Preferences");
|
||||
|
||||
panel->description = _("Menu usability related options. Scrolling speed,\n"
|
||||
"alignment of submenus etc.");
|
||||
panel->description = _("Menu usability related options. Scrolling speed,\n" "alignment of submenus etc.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,332 +20,303 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
#include <unistd.h>
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
char *sectionName;
|
||||
WMBox *box;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMTabView *tabv;
|
||||
WMTabView *tabv;
|
||||
|
||||
WMFrame *pixF;
|
||||
WMList *pixL;
|
||||
WMButton *pixaB;
|
||||
WMButton *pixrB;
|
||||
WMFrame *pixF;
|
||||
WMList *pixL;
|
||||
WMButton *pixaB;
|
||||
WMButton *pixrB;
|
||||
|
||||
WMFrame *icoF;
|
||||
WMList *icoL;
|
||||
WMButton *icoaB;
|
||||
WMButton *icorB;
|
||||
WMFrame *icoF;
|
||||
WMList *icoL;
|
||||
WMButton *icoaB;
|
||||
WMButton *icorB;
|
||||
|
||||
WMColor *red;
|
||||
WMColor *black;
|
||||
WMColor *white;
|
||||
WMColor *gray;
|
||||
WMFont *font;
|
||||
WMColor *red;
|
||||
WMColor *black;
|
||||
WMColor *white;
|
||||
WMColor *gray;
|
||||
WMFont *font;
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "paths"
|
||||
|
||||
|
||||
static void
|
||||
addPathToList(WMList *list, int index, char *path)
|
||||
static void addPathToList(WMList * list, int index, char *path)
|
||||
{
|
||||
char *fpath = wexpandpath(path);
|
||||
WMListItem *item;
|
||||
char *fpath = wexpandpath(path);
|
||||
WMListItem *item;
|
||||
|
||||
item = WMInsertListItem(list, index, path);
|
||||
item = WMInsertListItem(list, index, path);
|
||||
|
||||
if (access(fpath, X_OK)!=0) {
|
||||
item->uflags = 1;
|
||||
}
|
||||
wfree(fpath);
|
||||
if (access(fpath, X_OK) != 0) {
|
||||
item->uflags = 1;
|
||||
}
|
||||
wfree(fpath);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
WMPropList *array, *val;
|
||||
int i;
|
||||
WMPropList *array, *val;
|
||||
int i;
|
||||
|
||||
array = GetObjectForKey("IconPath");
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
if (array)
|
||||
wwarning(_("bad value in option IconPath. Using default path list"));
|
||||
addPathToList(panel->icoL, -1, "~/pixmaps");
|
||||
addPathToList(panel->icoL, -1, "~/GNUstep/Library/Icons");
|
||||
addPathToList(panel->icoL, -1, "/usr/include/X11/pixmaps");
|
||||
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Icons");
|
||||
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
|
||||
} else {
|
||||
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||
val = WMGetFromPLArray(array, i);
|
||||
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
|
||||
}
|
||||
}
|
||||
array = GetObjectForKey("IconPath");
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
if (array)
|
||||
wwarning(_("bad value in option IconPath. Using default path list"));
|
||||
addPathToList(panel->icoL, -1, "~/pixmaps");
|
||||
addPathToList(panel->icoL, -1, "~/GNUstep/Library/Icons");
|
||||
addPathToList(panel->icoL, -1, "/usr/include/X11/pixmaps");
|
||||
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Icons");
|
||||
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
|
||||
} else {
|
||||
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
||||
val = WMGetFromPLArray(array, i);
|
||||
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
|
||||
}
|
||||
}
|
||||
|
||||
array = GetObjectForKey("PixmapPath");
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
if (array)
|
||||
wwarning(_("bad value in option PixmapPath. Using default path list"));
|
||||
addPathToList(panel->pixL, -1, "~/pixmaps");
|
||||
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
|
||||
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||
} else {
|
||||
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||
val = WMGetFromPLArray(array, i);
|
||||
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
|
||||
}
|
||||
}
|
||||
array = GetObjectForKey("PixmapPath");
|
||||
if (!array || !WMIsPLArray(array)) {
|
||||
if (array)
|
||||
wwarning(_("bad value in option PixmapPath. Using default path list"));
|
||||
addPathToList(panel->pixL, -1, "~/pixmaps");
|
||||
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
|
||||
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||
} else {
|
||||
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
||||
val = WMGetFromPLArray(array, i);
|
||||
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pushButton(WMWidget *w, void *data)
|
||||
static void pushButton(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
int i;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
int i;
|
||||
|
||||
/* icon paths */
|
||||
if (w == panel->icorB) {
|
||||
i = WMGetListSelectedItemRow(panel->icoL);
|
||||
/* icon paths */
|
||||
if (w == panel->icorB) {
|
||||
i = WMGetListSelectedItemRow(panel->icoL);
|
||||
|
||||
if (i>=0)
|
||||
WMRemoveListItem(panel->icoL, i);
|
||||
}
|
||||
if (i >= 0)
|
||||
WMRemoveListItem(panel->icoL, i);
|
||||
}
|
||||
|
||||
/* pixmap paths */
|
||||
if (w == panel->pixrB) {
|
||||
i = WMGetListSelectedItemRow(panel->pixL);
|
||||
/* pixmap paths */
|
||||
if (w == panel->pixrB) {
|
||||
i = WMGetListSelectedItemRow(panel->pixL);
|
||||
|
||||
if (i>=0)
|
||||
WMRemoveListItem(panel->pixL, i);
|
||||
}
|
||||
if (i >= 0)
|
||||
WMRemoveListItem(panel->pixL, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
browseForFile(WMWidget *w, void *data)
|
||||
static void browseForFile(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
WMFilePanel *filePanel;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
WMFilePanel *filePanel;
|
||||
|
||||
filePanel = WMGetOpenPanel(WMWidgetScreen(w));
|
||||
filePanel = WMGetOpenPanel(WMWidgetScreen(w));
|
||||
|
||||
WMSetFilePanelCanChooseFiles(filePanel, False);
|
||||
WMSetFilePanelCanChooseFiles(filePanel, False);
|
||||
|
||||
if (WMRunModalFilePanelForDirectory(filePanel, panel->parent, "/",
|
||||
_("Select directory"), NULL) == True) {
|
||||
char *str = WMGetFilePanelFileName(filePanel);
|
||||
if (WMRunModalFilePanelForDirectory(filePanel, panel->parent, "/", _("Select directory"), NULL) == True) {
|
||||
char *str = WMGetFilePanelFileName(filePanel);
|
||||
|
||||
if (str) {
|
||||
int len = strlen(str);
|
||||
if (str) {
|
||||
int len = strlen(str);
|
||||
|
||||
/* Remove the trailing '/' except if the path is exactly / */
|
||||
if (len > 1 && str[len-1] == '/') {
|
||||
str[len-1] = '\0';
|
||||
len--;
|
||||
}
|
||||
if (len > 0) {
|
||||
WMList *lPtr;
|
||||
int i;
|
||||
/* Remove the trailing '/' except if the path is exactly / */
|
||||
if (len > 1 && str[len - 1] == '/') {
|
||||
str[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
if (len > 0) {
|
||||
WMList *lPtr;
|
||||
int i;
|
||||
|
||||
if (w == panel->icoaB)
|
||||
lPtr = panel->icoL;
|
||||
else if (w == panel->pixaB)
|
||||
lPtr = panel->pixL;
|
||||
if (w == panel->icoaB)
|
||||
lPtr = panel->icoL;
|
||||
else if (w == panel->pixaB)
|
||||
lPtr = panel->pixL;
|
||||
|
||||
i = WMGetListSelectedItemRow(lPtr);
|
||||
if (i >= 0) i++;
|
||||
addPathToList(lPtr, i, str);
|
||||
WMSetListBottomPosition(lPtr, WMGetListNumberOfRows(lPtr));
|
||||
i = WMGetListSelectedItemRow(lPtr);
|
||||
if (i >= 0)
|
||||
i++;
|
||||
addPathToList(lPtr, i, str);
|
||||
WMSetListBottomPosition(lPtr, WMGetListNumberOfRows(lPtr));
|
||||
|
||||
wfree(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
wfree(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect)
|
||||
static void paintItem(WMList * lPtr, int index, Drawable d, char *text, int state, WMRect * rect)
|
||||
{
|
||||
int width, height, x, y;
|
||||
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
|
||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
WMColor *backColor = (state & WLDSSelected) ? panel->white : panel->gray;
|
||||
int width, height, x, y;
|
||||
_Panel *panel = (_Panel *) WMGetHangedData(lPtr);
|
||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
WMColor *backColor = (state & WLDSSelected) ? panel->white : panel->gray;
|
||||
|
||||
width = rect->size.width;
|
||||
height = rect->size.height;
|
||||
x = rect->pos.x;
|
||||
y = rect->pos.y;
|
||||
width = rect->size.width;
|
||||
height = rect->size.height;
|
||||
x = rect->pos.x;
|
||||
y = rect->pos.y;
|
||||
|
||||
XFillRectangle(dpy, d, WMColorGC(backColor), x, y, width, height);
|
||||
XFillRectangle(dpy, d, WMColorGC(backColor), x, y, width, height);
|
||||
|
||||
if (state & 1) {
|
||||
WMDrawString(scr, d, panel->red, panel->font, x+4, y, text, strlen(text));
|
||||
} else {
|
||||
WMDrawString(scr, d, panel->black, panel->font, x+4, y, text, strlen(text));
|
||||
}
|
||||
if (state & 1) {
|
||||
WMDrawString(scr, d, panel->red, panel->font, x + 4, y, text, strlen(text));
|
||||
} else {
|
||||
WMDrawString(scr, d, panel->black, panel->font, x + 4, y, text, strlen(text));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
WMPropList *list;
|
||||
WMPropList *tmp;
|
||||
int i;
|
||||
char *p;
|
||||
WMPropList *list;
|
||||
WMPropList *tmp;
|
||||
int i;
|
||||
char *p;
|
||||
|
||||
list = WMCreatePLArray(NULL, NULL);
|
||||
for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
|
||||
p = WMGetListItem(panel->icoL, i)->text;
|
||||
tmp = WMCreatePLString(p);
|
||||
WMAddToPLArray(list, tmp);
|
||||
}
|
||||
SetObjectForKey(list, "IconPath");
|
||||
list = WMCreatePLArray(NULL, NULL);
|
||||
for (i = 0; i < WMGetListNumberOfRows(panel->icoL); i++) {
|
||||
p = WMGetListItem(panel->icoL, i)->text;
|
||||
tmp = WMCreatePLString(p);
|
||||
WMAddToPLArray(list, tmp);
|
||||
}
|
||||
SetObjectForKey(list, "IconPath");
|
||||
|
||||
list = WMCreatePLArray(NULL, NULL);
|
||||
for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
|
||||
p = WMGetListItem(panel->pixL, i)->text;
|
||||
tmp = WMCreatePLString(p);
|
||||
WMAddToPLArray(list, tmp);
|
||||
}
|
||||
SetObjectForKey(list, "PixmapPath");
|
||||
list = WMCreatePLArray(NULL, NULL);
|
||||
for (i = 0; i < WMGetListNumberOfRows(panel->pixL); i++) {
|
||||
p = WMGetListItem(panel->pixL, i)->text;
|
||||
tmp = WMCreatePLString(p);
|
||||
WMAddToPLArray(list, tmp);
|
||||
}
|
||||
SetObjectForKey(list, "PixmapPath");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMTabViewItem *tab;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMTabViewItem *tab;
|
||||
|
||||
panel->white = WMWhiteColor(scr);
|
||||
panel->black = WMBlackColor(scr);
|
||||
panel->gray = WMGrayColor(scr);
|
||||
panel->red = WMCreateRGBColor(scr, 0xffff, 0, 0, True);
|
||||
panel->font = WMSystemFontOfSize(scr, 12);
|
||||
panel->white = WMWhiteColor(scr);
|
||||
panel->black = WMBlackColor(scr);
|
||||
panel->gray = WMGrayColor(scr);
|
||||
panel->red = WMCreateRGBColor(scr, 0xffff, 0, 0, True);
|
||||
panel->font = WMSystemFontOfSize(scr, 12);
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
panel->tabv = WMCreateTabView(panel->box);
|
||||
WMMoveWidget(panel->tabv, 12, 10);
|
||||
WMResizeWidget(panel->tabv, 500, 215);
|
||||
|
||||
panel->tabv = WMCreateTabView(panel->box);
|
||||
WMMoveWidget(panel->tabv, 12, 10);
|
||||
WMResizeWidget(panel->tabv, 500, 215);
|
||||
/* icon path */
|
||||
panel->icoF = WMCreateFrame(panel->box);
|
||||
WMSetFrameRelief(panel->icoF, WRFlat);
|
||||
WMResizeWidget(panel->icoF, 230, 210);
|
||||
|
||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||
WMSetTabViewItemView(tab, WMWidgetView(panel->icoF));
|
||||
WMAddItemInTabView(panel->tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, _("Icon Search Paths"));
|
||||
|
||||
panel->icoL = WMCreateList(panel->icoF);
|
||||
WMResizeWidget(panel->icoL, 480, 147);
|
||||
WMMoveWidget(panel->icoL, 10, 10);
|
||||
WMSetListUserDrawProc(panel->icoL, paintItem);
|
||||
WMHangData(panel->icoL, panel);
|
||||
|
||||
/* icon path */
|
||||
panel->icoF = WMCreateFrame(panel->box);
|
||||
WMSetFrameRelief(panel->icoF, WRFlat);
|
||||
WMResizeWidget(panel->icoF, 230, 210);
|
||||
panel->icoaB = WMCreateCommandButton(panel->icoF);
|
||||
WMResizeWidget(panel->icoaB, 95, 24);
|
||||
WMMoveWidget(panel->icoaB, 293, 165);
|
||||
WMSetButtonText(panel->icoaB, _("Add"));
|
||||
WMSetButtonAction(panel->icoaB, browseForFile, panel);
|
||||
WMSetButtonImagePosition(panel->icoaB, WIPRight);
|
||||
|
||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||
WMSetTabViewItemView(tab, WMWidgetView(panel->icoF));
|
||||
WMAddItemInTabView(panel->tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, _("Icon Search Paths"));
|
||||
panel->icorB = WMCreateCommandButton(panel->icoF);
|
||||
WMResizeWidget(panel->icorB, 95, 24);
|
||||
WMMoveWidget(panel->icorB, 395, 165);
|
||||
WMSetButtonText(panel->icorB, _("Remove"));
|
||||
WMSetButtonAction(panel->icorB, pushButton, panel);
|
||||
|
||||
panel->icoL = WMCreateList(panel->icoF);
|
||||
WMResizeWidget(panel->icoL, 480, 147);
|
||||
WMMoveWidget(panel->icoL, 10, 10);
|
||||
WMSetListUserDrawProc(panel->icoL, paintItem);
|
||||
WMHangData(panel->icoL, panel);
|
||||
WMMapSubwidgets(panel->icoF);
|
||||
|
||||
panel->icoaB = WMCreateCommandButton(panel->icoF);
|
||||
WMResizeWidget(panel->icoaB, 95, 24);
|
||||
WMMoveWidget(panel->icoaB, 293, 165);
|
||||
WMSetButtonText(panel->icoaB, _("Add"));
|
||||
WMSetButtonAction(panel->icoaB, browseForFile, panel);
|
||||
WMSetButtonImagePosition(panel->icoaB, WIPRight);
|
||||
/* pixmap path */
|
||||
panel->pixF = WMCreateFrame(panel->box);
|
||||
WMSetFrameRelief(panel->pixF, WRFlat);
|
||||
WMResizeWidget(panel->pixF, 230, 210);
|
||||
|
||||
panel->icorB = WMCreateCommandButton(panel->icoF);
|
||||
WMResizeWidget(panel->icorB, 95, 24);
|
||||
WMMoveWidget(panel->icorB, 395, 165);
|
||||
WMSetButtonText(panel->icorB, _("Remove"));
|
||||
WMSetButtonAction(panel->icorB, pushButton, panel);
|
||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||
WMSetTabViewItemView(tab, WMWidgetView(panel->pixF));
|
||||
WMAddItemInTabView(panel->tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, _("Pixmap Search Paths"));
|
||||
|
||||
WMMapSubwidgets(panel->icoF);
|
||||
panel->pixL = WMCreateList(panel->pixF);
|
||||
WMResizeWidget(panel->pixL, 480, 147);
|
||||
WMMoveWidget(panel->pixL, 10, 10);
|
||||
WMSetListUserDrawProc(panel->pixL, paintItem);
|
||||
WMHangData(panel->pixL, panel);
|
||||
|
||||
/* pixmap path */
|
||||
panel->pixF = WMCreateFrame(panel->box);
|
||||
WMSetFrameRelief(panel->pixF, WRFlat);
|
||||
WMResizeWidget(panel->pixF, 230, 210);
|
||||
panel->pixaB = WMCreateCommandButton(panel->pixF);
|
||||
WMResizeWidget(panel->pixaB, 95, 24);
|
||||
WMMoveWidget(panel->pixaB, 293, 165);
|
||||
WMSetButtonText(panel->pixaB, _("Add"));
|
||||
WMSetButtonAction(panel->pixaB, browseForFile, panel);
|
||||
WMSetButtonImagePosition(panel->pixaB, WIPRight);
|
||||
|
||||
tab = WMCreateTabViewItemWithIdentifier(0);
|
||||
WMSetTabViewItemView(tab, WMWidgetView(panel->pixF));
|
||||
WMAddItemInTabView(panel->tabv, tab);
|
||||
WMSetTabViewItemLabel(tab, _("Pixmap Search Paths"));
|
||||
panel->pixrB = WMCreateCommandButton(panel->pixF);
|
||||
WMResizeWidget(panel->pixrB, 95, 24);
|
||||
WMMoveWidget(panel->pixrB, 395, 165);
|
||||
WMSetButtonText(panel->pixrB, _("Remove"));
|
||||
WMSetButtonAction(panel->pixrB, pushButton, panel);
|
||||
|
||||
panel->pixL = WMCreateList(panel->pixF);
|
||||
WMResizeWidget(panel->pixL, 480, 147);
|
||||
WMMoveWidget(panel->pixL, 10, 10);
|
||||
WMSetListUserDrawProc(panel->pixL, paintItem);
|
||||
WMHangData(panel->pixL, panel);
|
||||
WMMapSubwidgets(panel->pixF);
|
||||
|
||||
panel->pixaB = WMCreateCommandButton(panel->pixF);
|
||||
WMResizeWidget(panel->pixaB, 95, 24);
|
||||
WMMoveWidget(panel->pixaB, 293, 165);
|
||||
WMSetButtonText(panel->pixaB, _("Add"));
|
||||
WMSetButtonAction(panel->pixaB, browseForFile, panel);
|
||||
WMSetButtonImagePosition(panel->pixaB, WIPRight);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
panel->pixrB = WMCreateCommandButton(panel->pixF);
|
||||
WMResizeWidget(panel->pixrB, 95, 24);
|
||||
WMMoveWidget(panel->pixrB, 395, 165);
|
||||
WMSetButtonText(panel->pixrB, _("Remove"));
|
||||
WMSetButtonAction(panel->pixrB, pushButton, panel);
|
||||
|
||||
|
||||
WMMapSubwidgets(panel->pixF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitPaths(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitPaths(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Search Path Configuration");
|
||||
panel->sectionName = _("Search Path Configuration");
|
||||
|
||||
panel->description = _("Search paths to use when looking for pixmaps\n"
|
||||
"and icons.");
|
||||
panel->description = _("Search paths to use when looking for pixmaps\n" "and icons.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,343 +20,323 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *sizeF;
|
||||
WMPopUpButton *sizeP;
|
||||
WMFrame *sizeF;
|
||||
WMPopUpButton *sizeP;
|
||||
|
||||
WMFrame *posiF;
|
||||
WMPopUpButton *posiP;
|
||||
WMFrame *posiF;
|
||||
WMPopUpButton *posiP;
|
||||
|
||||
WMFrame *ballF;
|
||||
WMButton *ballB[4];
|
||||
WMFrame *ballF;
|
||||
WMButton *ballB[4];
|
||||
|
||||
WMFrame *optF;
|
||||
WMButton *raisB;
|
||||
WMFrame *optF;
|
||||
WMButton *raisB;
|
||||
#ifdef XKB_MODELOCK
|
||||
WMButton *modeB;
|
||||
#endif /* XKB_MODELOCK */
|
||||
WMButton *modeB;
|
||||
#endif /* XKB_MODELOCK */
|
||||
|
||||
WMFrame *borderF;
|
||||
WMSlider *borderS;
|
||||
WMLabel *borderL;
|
||||
WMButton *lrB;
|
||||
WMButton *tbB;
|
||||
WMFrame *borderF;
|
||||
WMSlider *borderS;
|
||||
WMLabel *borderL;
|
||||
WMButton *lrB;
|
||||
WMButton *tbB;
|
||||
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "ergonomic"
|
||||
|
||||
|
||||
static void
|
||||
borderCallback(WMWidget *w, void *data)
|
||||
static void borderCallback(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
char buffer[64];
|
||||
int i;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
char buffer[64];
|
||||
int i;
|
||||
|
||||
i = WMGetSliderValue(panel->borderS);
|
||||
i = WMGetSliderValue(panel->borderS);
|
||||
|
||||
if (i == 0)
|
||||
sprintf(buffer, _("OFF"));
|
||||
else if (i == 1)
|
||||
sprintf(buffer, _("1 pixel"));
|
||||
else if (i <= 4)
|
||||
/* 2-4 */
|
||||
sprintf(buffer, _("%i pixels"), i);
|
||||
else
|
||||
/* >4 */
|
||||
sprintf(buffer, _("%i pixels "), i); /* note space! */
|
||||
WMSetLabelText(panel->borderL, buffer);
|
||||
if (i == 0)
|
||||
sprintf(buffer, _("OFF"));
|
||||
else if (i == 1)
|
||||
sprintf(buffer, _("1 pixel"));
|
||||
else if (i <= 4)
|
||||
/* 2-4 */
|
||||
sprintf(buffer, _("%i pixels"), i);
|
||||
else
|
||||
/* >4 */
|
||||
sprintf(buffer, _("%i pixels "), i); /* note space! */
|
||||
WMSetLabelText(panel->borderL, buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
char *str;
|
||||
int x;
|
||||
char *str;
|
||||
int x;
|
||||
|
||||
str = GetStringForKey("ResizeDisplay");
|
||||
if (!str)
|
||||
str = "corner";
|
||||
if (strcasecmp(str, "corner")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 0);
|
||||
else if (strcasecmp(str, "center")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 1);
|
||||
else if (strcasecmp(str, "floating")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 2);
|
||||
else if (strcasecmp(str, "line")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 3);
|
||||
else if (strcasecmp(str, "none")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 4);
|
||||
str = GetStringForKey("ResizeDisplay");
|
||||
if (!str)
|
||||
str = "corner";
|
||||
if (strcasecmp(str, "corner") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 0);
|
||||
else if (strcasecmp(str, "center") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 1);
|
||||
else if (strcasecmp(str, "floating") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 2);
|
||||
else if (strcasecmp(str, "line") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 3);
|
||||
else if (strcasecmp(str, "none") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->sizeP, 4);
|
||||
|
||||
str = GetStringForKey("MoveDisplay");
|
||||
if (!str)
|
||||
str = "corner";
|
||||
if (strcasecmp(str, "corner")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 0);
|
||||
else if (strcasecmp(str, "center")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 1);
|
||||
else if (strcasecmp(str, "floating")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 2);
|
||||
else if (strcasecmp(str, "none")==0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 3);
|
||||
str = GetStringForKey("MoveDisplay");
|
||||
if (!str)
|
||||
str = "corner";
|
||||
if (strcasecmp(str, "corner") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 0);
|
||||
else if (strcasecmp(str, "center") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 1);
|
||||
else if (strcasecmp(str, "floating") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 2);
|
||||
else if (strcasecmp(str, "none") == 0)
|
||||
WMSetPopUpButtonSelectedItem(panel->posiP, 3);
|
||||
|
||||
x = GetIntegerForKey("WorkspaceBorderSize");
|
||||
x = x<0 ? 0 : x;
|
||||
x = x>5 ? 5 : x;
|
||||
WMSetSliderValue(panel->borderS, x);
|
||||
borderCallback(NULL, panel);
|
||||
x = GetIntegerForKey("WorkspaceBorderSize");
|
||||
x = x < 0 ? 0 : x;
|
||||
x = x > 5 ? 5 : x;
|
||||
WMSetSliderValue(panel->borderS, x);
|
||||
borderCallback(NULL, panel);
|
||||
|
||||
str = GetStringForKey("WorkspaceBorder");
|
||||
if (!str)
|
||||
str = "none";
|
||||
if (strcasecmp(str, "LeftRight")==0) {
|
||||
WMSetButtonSelected(panel->lrB, True);
|
||||
} else if (strcasecmp(str, "TopBottom")==0) {
|
||||
WMSetButtonSelected(panel->tbB, True);
|
||||
} else if (strcasecmp(str, "AllDirections")==0) {
|
||||
WMSetButtonSelected(panel->tbB, True);
|
||||
WMSetButtonSelected(panel->lrB, True);
|
||||
}
|
||||
str = GetStringForKey("WorkspaceBorder");
|
||||
if (!str)
|
||||
str = "none";
|
||||
if (strcasecmp(str, "LeftRight") == 0) {
|
||||
WMSetButtonSelected(panel->lrB, True);
|
||||
} else if (strcasecmp(str, "TopBottom") == 0) {
|
||||
WMSetButtonSelected(panel->tbB, True);
|
||||
} else if (strcasecmp(str, "AllDirections") == 0) {
|
||||
WMSetButtonSelected(panel->tbB, True);
|
||||
WMSetButtonSelected(panel->lrB, True);
|
||||
}
|
||||
|
||||
WMSetButtonSelected(panel->raisB, GetBoolForKey("CirculateRaise"));
|
||||
WMSetButtonSelected(panel->raisB, GetBoolForKey("CirculateRaise"));
|
||||
#ifdef XKB_MODELOCK
|
||||
WMSetButtonSelected(panel->modeB, GetBoolForKey("KbdModeLock"));
|
||||
#endif /* XKB_MODELOCK */
|
||||
WMSetButtonSelected(panel->modeB, GetBoolForKey("KbdModeLock"));
|
||||
#endif /* XKB_MODELOCK */
|
||||
|
||||
WMSetButtonSelected(panel->ballB[0], GetBoolForKey("WindowTitleBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[1], GetBoolForKey("MiniwindowTitleBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[2], GetBoolForKey("AppIconBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[3], GetBoolForKey("HelpBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[0], GetBoolForKey("WindowTitleBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[1], GetBoolForKey("MiniwindowTitleBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[2], GetBoolForKey("AppIconBalloons"));
|
||||
WMSetButtonSelected(panel->ballB[3], GetBoolForKey("HelpBalloons"));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
char *str;
|
||||
Bool lr, tb;
|
||||
char *str;
|
||||
Bool lr, tb;
|
||||
|
||||
switch (WMGetPopUpButtonSelectedItem(panel->sizeP)) {
|
||||
case 0:
|
||||
str = "corner";
|
||||
break;
|
||||
case 1:
|
||||
str = "center";
|
||||
break;
|
||||
case 2:
|
||||
str = "floating";
|
||||
break;
|
||||
case 4:
|
||||
str = "none";
|
||||
break;
|
||||
default:
|
||||
str = "line";
|
||||
break;
|
||||
}
|
||||
SetStringForKey(str, "ResizeDisplay");
|
||||
switch (WMGetPopUpButtonSelectedItem(panel->sizeP)) {
|
||||
case 0:
|
||||
str = "corner";
|
||||
break;
|
||||
case 1:
|
||||
str = "center";
|
||||
break;
|
||||
case 2:
|
||||
str = "floating";
|
||||
break;
|
||||
case 4:
|
||||
str = "none";
|
||||
break;
|
||||
default:
|
||||
str = "line";
|
||||
break;
|
||||
}
|
||||
SetStringForKey(str, "ResizeDisplay");
|
||||
|
||||
switch (WMGetPopUpButtonSelectedItem(panel->posiP)) {
|
||||
case 0:
|
||||
str = "corner";
|
||||
break;
|
||||
case 1:
|
||||
str = "center";
|
||||
break;
|
||||
case 3:
|
||||
str = "none";
|
||||
break;
|
||||
default:
|
||||
str = "floating";
|
||||
break;
|
||||
}
|
||||
SetStringForKey(str, "MoveDisplay");
|
||||
switch (WMGetPopUpButtonSelectedItem(panel->posiP)) {
|
||||
case 0:
|
||||
str = "corner";
|
||||
break;
|
||||
case 1:
|
||||
str = "center";
|
||||
break;
|
||||
case 3:
|
||||
str = "none";
|
||||
break;
|
||||
default:
|
||||
str = "floating";
|
||||
break;
|
||||
}
|
||||
SetStringForKey(str, "MoveDisplay");
|
||||
|
||||
lr = WMGetButtonSelected(panel->lrB);
|
||||
tb = WMGetButtonSelected(panel->tbB);
|
||||
if (lr && tb)
|
||||
str = "AllDirections";
|
||||
else if (lr)
|
||||
str = "LeftRight";
|
||||
else if (tb)
|
||||
str = "TopBottom";
|
||||
else
|
||||
str = "None";
|
||||
SetStringForKey(str, "WorkspaceBorder");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->borderS), "WorkspaceBorderSize");
|
||||
lr = WMGetButtonSelected(panel->lrB);
|
||||
tb = WMGetButtonSelected(panel->tbB);
|
||||
if (lr && tb)
|
||||
str = "AllDirections";
|
||||
else if (lr)
|
||||
str = "LeftRight";
|
||||
else if (tb)
|
||||
str = "TopBottom";
|
||||
else
|
||||
str = "None";
|
||||
SetStringForKey(str, "WorkspaceBorder");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->borderS), "WorkspaceBorderSize");
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->raisB), "CirculateRaise");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->raisB), "CirculateRaise");
|
||||
#ifdef XKB_MODELOCK
|
||||
SetBoolForKey(WMGetButtonSelected(panel->modeB), "KbdModeLock");
|
||||
#endif /* XKB_MODELOCK */
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[0]), "WindowTitleBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[1]), "MiniwindowTitleBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[2]), "AppIconBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[3]), "HelpBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->modeB), "KbdModeLock");
|
||||
#endif /* XKB_MODELOCK */
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[0]), "WindowTitleBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[1]), "MiniwindowTitleBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[2]), "AppIconBalloons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->ballB[3]), "HelpBalloons");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
int i;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
_Panel *panel = (_Panel *) p;
|
||||
int i;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/***************** Size Display ****************/
|
||||
panel->sizeF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->sizeF, 240, 60);
|
||||
WMMoveWidget(panel->sizeF, 20, 10);
|
||||
WMSetFrameTitle(panel->sizeF, _("Size Display"));
|
||||
panel->sizeF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->sizeF, 240, 60);
|
||||
WMMoveWidget(panel->sizeF, 20, 10);
|
||||
WMSetFrameTitle(panel->sizeF, _("Size Display"));
|
||||
|
||||
WMSetBalloonTextForView(_("The position or style of the window size\n"
|
||||
"display that's shown when a window is resized."),
|
||||
WMWidgetView(panel->sizeF));
|
||||
WMSetBalloonTextForView(_("The position or style of the window size\n"
|
||||
"display that's shown when a window is resized."), WMWidgetView(panel->sizeF));
|
||||
|
||||
panel->sizeP = WMCreatePopUpButton(panel->sizeF);
|
||||
WMResizeWidget(panel->sizeP, 200, 20);
|
||||
WMMoveWidget(panel->sizeP, 22, 24);
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Corner of screen"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Center of screen"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Center of resized window"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Technical drawing-like"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Disabled"));
|
||||
panel->sizeP = WMCreatePopUpButton(panel->sizeF);
|
||||
WMResizeWidget(panel->sizeP, 200, 20);
|
||||
WMMoveWidget(panel->sizeP, 22, 24);
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Corner of screen"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Center of screen"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Center of resized window"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Technical drawing-like"));
|
||||
WMAddPopUpButtonItem(panel->sizeP, _("Disabled"));
|
||||
|
||||
WMMapSubwidgets(panel->sizeF);
|
||||
WMMapSubwidgets(panel->sizeF);
|
||||
|
||||
/***************** Position Display ****************/
|
||||
panel->posiF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->posiF, 240, 60);
|
||||
WMMoveWidget(panel->posiF, 20, 75);
|
||||
WMSetFrameTitle(panel->posiF, _("Position Display"));
|
||||
panel->posiF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->posiF, 240, 60);
|
||||
WMMoveWidget(panel->posiF, 20, 75);
|
||||
WMSetFrameTitle(panel->posiF, _("Position Display"));
|
||||
|
||||
WMSetBalloonTextForView(_("The position or style of the window position\n"
|
||||
"display that's shown when a window is moved."),
|
||||
WMWidgetView(panel->posiF));
|
||||
WMSetBalloonTextForView(_("The position or style of the window position\n"
|
||||
"display that's shown when a window is moved."), WMWidgetView(panel->posiF));
|
||||
|
||||
panel->posiP = WMCreatePopUpButton(panel->posiF);
|
||||
WMResizeWidget(panel->posiP, 200, 20);
|
||||
WMMoveWidget(panel->posiP, 22, 24);
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Corner of screen"));
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Center of screen"));
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Center of resized window"));
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Disabled"));
|
||||
panel->posiP = WMCreatePopUpButton(panel->posiF);
|
||||
WMResizeWidget(panel->posiP, 200, 20);
|
||||
WMMoveWidget(panel->posiP, 22, 24);
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Corner of screen"));
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Center of screen"));
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Center of resized window"));
|
||||
WMAddPopUpButtonItem(panel->posiP, _("Disabled"));
|
||||
|
||||
WMMapSubwidgets(panel->posiF);
|
||||
WMMapSubwidgets(panel->posiF);
|
||||
|
||||
/***************** Balloon Text ****************/
|
||||
panel->ballF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->ballF, 235, 125);
|
||||
WMMoveWidget(panel->ballF, 270, 10);
|
||||
WMSetFrameTitle(panel->ballF, _("Show balloon text for..."));
|
||||
panel->ballF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->ballF, 235, 125);
|
||||
WMMoveWidget(panel->ballF, 270, 10);
|
||||
WMSetFrameTitle(panel->ballF, _("Show balloon text for..."));
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
panel->ballB[i] = WMCreateSwitchButton(panel->ballF);
|
||||
WMResizeWidget(panel->ballB[i], 205, 20);
|
||||
WMMoveWidget(panel->ballB[i], 15, 20+i*25);
|
||||
}
|
||||
WMSetButtonText(panel->ballB[0], _("incomplete window titles"));
|
||||
WMSetButtonText(panel->ballB[1], _("miniwindow titles"));
|
||||
WMSetButtonText(panel->ballB[2], _("application/dock icons"));
|
||||
WMSetButtonText(panel->ballB[3], _("internal help"));
|
||||
for (i = 0; i < 4; i++) {
|
||||
panel->ballB[i] = WMCreateSwitchButton(panel->ballF);
|
||||
WMResizeWidget(panel->ballB[i], 205, 20);
|
||||
WMMoveWidget(panel->ballB[i], 15, 20 + i * 25);
|
||||
}
|
||||
WMSetButtonText(panel->ballB[0], _("incomplete window titles"));
|
||||
WMSetButtonText(panel->ballB[1], _("miniwindow titles"));
|
||||
WMSetButtonText(panel->ballB[2], _("application/dock icons"));
|
||||
WMSetButtonText(panel->ballB[3], _("internal help"));
|
||||
|
||||
WMMapSubwidgets(panel->ballF);
|
||||
WMMapSubwidgets(panel->ballF);
|
||||
|
||||
/***************** Options ****************/
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 235, 75);
|
||||
WMMoveWidget(panel->optF, 270, 145);
|
||||
panel->optF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->optF, 235, 75);
|
||||
WMMoveWidget(panel->optF, 270, 145);
|
||||
|
||||
panel->raisB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->raisB, 210, 30);
|
||||
WMMoveWidget(panel->raisB, 15, 7);
|
||||
WMSetButtonText(panel->raisB, _("Raise window when switching\nfocus with keyboard."));
|
||||
panel->raisB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->raisB, 210, 30);
|
||||
WMMoveWidget(panel->raisB, 15, 7);
|
||||
WMSetButtonText(panel->raisB, _("Raise window when switching\nfocus with keyboard."));
|
||||
|
||||
#ifdef XKB_MODELOCK
|
||||
panel->modeB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->modeB, 210, 30);
|
||||
WMMoveWidget(panel->modeB, 15, 40);
|
||||
WMSetButtonText(panel->modeB, _("Enable keyboard language\nswitch button in window titlebars."));
|
||||
panel->modeB = WMCreateSwitchButton(panel->optF);
|
||||
WMResizeWidget(panel->modeB, 210, 30);
|
||||
WMMoveWidget(panel->modeB, 15, 40);
|
||||
WMSetButtonText(panel->modeB, _("Enable keyboard language\nswitch button in window titlebars."));
|
||||
#endif
|
||||
|
||||
WMMapSubwidgets(panel->optF);
|
||||
WMMapSubwidgets(panel->optF);
|
||||
|
||||
/***************** Workspace border ****************/
|
||||
panel->borderF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->borderF, 240, 75);
|
||||
WMMoveWidget(panel->borderF, 20, 145);
|
||||
WMSetFrameTitle(panel->borderF, _("Workspace border"));
|
||||
panel->borderF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->borderF, 240, 75);
|
||||
WMMoveWidget(panel->borderF, 20, 145);
|
||||
WMSetFrameTitle(panel->borderF, _("Workspace border"));
|
||||
|
||||
panel->borderS = WMCreateSlider(panel->borderF);
|
||||
WMResizeWidget(panel->borderS, 80, 15);
|
||||
WMMoveWidget(panel->borderS, 20, 20);
|
||||
WMSetSliderMinValue(panel->borderS, 0);
|
||||
WMSetSliderMaxValue(panel->borderS, 5);
|
||||
WMSetSliderAction(panel->borderS, borderCallback, panel);
|
||||
panel->borderS = WMCreateSlider(panel->borderF);
|
||||
WMResizeWidget(panel->borderS, 80, 15);
|
||||
WMMoveWidget(panel->borderS, 20, 20);
|
||||
WMSetSliderMinValue(panel->borderS, 0);
|
||||
WMSetSliderMaxValue(panel->borderS, 5);
|
||||
WMSetSliderAction(panel->borderS, borderCallback, panel);
|
||||
|
||||
panel->borderL = WMCreateLabel(panel->borderF);
|
||||
WMResizeWidget(panel->borderL, 100, 15);
|
||||
WMMoveWidget(panel->borderL, 105, 20);
|
||||
panel->borderL = WMCreateLabel(panel->borderF);
|
||||
WMResizeWidget(panel->borderL, 100, 15);
|
||||
WMMoveWidget(panel->borderL, 105, 20);
|
||||
|
||||
panel->lrB = WMCreateSwitchButton(panel->borderF);
|
||||
WMMoveWidget(panel->lrB, 20, 40);
|
||||
WMResizeWidget(panel->lrB, 100, 30);
|
||||
WMSetButtonText(panel->lrB, _("Left/Right"));
|
||||
panel->lrB = WMCreateSwitchButton(panel->borderF);
|
||||
WMMoveWidget(panel->lrB, 20, 40);
|
||||
WMResizeWidget(panel->lrB, 100, 30);
|
||||
WMSetButtonText(panel->lrB, _("Left/Right"));
|
||||
|
||||
panel->tbB = WMCreateSwitchButton(panel->borderF);
|
||||
WMMoveWidget(panel->tbB, 120, 40);
|
||||
WMResizeWidget(panel->tbB, 100, 30);
|
||||
WMSetButtonText(panel->tbB, _("Top/Bottom"));
|
||||
panel->tbB = WMCreateSwitchButton(panel->borderF);
|
||||
WMMoveWidget(panel->tbB, 120, 40);
|
||||
WMResizeWidget(panel->tbB, 100, 30);
|
||||
WMSetButtonText(panel->tbB, _("Top/Bottom"));
|
||||
|
||||
WMMapSubwidgets(panel->borderF);
|
||||
|
||||
WMMapSubwidgets(panel->borderF);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitPreferences(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitPreferences(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Miscellaneous Ergonomic Preferences");
|
||||
panel->description = _("Various settings like balloon text, geometry\n"
|
||||
"displays etc.");
|
||||
panel->sectionName = _("Miscellaneous Ergonomic Preferences");
|
||||
panel->description = _("Various settings like balloon text, geometry\n" "displays etc.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,230 +20,204 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMButton *saveB;
|
||||
WMList *list;
|
||||
WMButton *loadB;
|
||||
WMButton *instB;
|
||||
WMButton *saveB;
|
||||
WMList *list;
|
||||
WMButton *loadB;
|
||||
WMButton *instB;
|
||||
|
||||
WMFrame *totF;
|
||||
WMButton *totB;
|
||||
WMLabel *totL;
|
||||
WMFrame *totF;
|
||||
WMButton *totB;
|
||||
WMLabel *totL;
|
||||
|
||||
WMFrame *botF;
|
||||
WMButton *botB;
|
||||
WMLabel *botL;
|
||||
WMFrame *botF;
|
||||
WMButton *botB;
|
||||
WMLabel *botL;
|
||||
|
||||
pid_t tilePID;
|
||||
pid_t barPID;
|
||||
pid_t tilePID;
|
||||
pid_t barPID;
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "theme"
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
finishedTileDownload(void *data)
|
||||
static void finishedTileDownload(void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
|
||||
WMSetButtonText(panel->totB, _("Set"));
|
||||
panel->tilePID = 0;
|
||||
WMSetButtonText(panel->totB, _("Set"));
|
||||
panel->tilePID = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
finishedBarDownload(void *data)
|
||||
static void finishedBarDownload(void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
|
||||
WMSetButtonText(panel->botB, _("Set"));
|
||||
panel->barPID = 0;
|
||||
WMSetButtonText(panel->botB, _("Set"));
|
||||
panel->barPID = 0;
|
||||
}
|
||||
|
||||
|
||||
static pid_t
|
||||
downloadFile(WMScreen *scr, _Panel *panel, char *file)
|
||||
static pid_t downloadFile(WMScreen * scr, _Panel * panel, char *file)
|
||||
{
|
||||
pid_t pid;
|
||||
pid_t pid;
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
wsyserror("could not fork() process");
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
wsyserror("could not fork() process");
|
||||
|
||||
WMRunAlertPanel(scr, GetWindow(panel), _("Error"),
|
||||
"Could not start download. fork() failed",
|
||||
_("OK"), NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
if (pid != 0) {
|
||||
return pid;
|
||||
}
|
||||
WMRunAlertPanel(scr, GetWindow(panel), _("Error"),
|
||||
"Could not start download. fork() failed", _("OK"), NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
if (pid != 0) {
|
||||
return pid;
|
||||
}
|
||||
|
||||
close(ConnectionNumber(WMScreenDisplay(scr)));
|
||||
close(ConnectionNumber(WMScreenDisplay(scr)));
|
||||
|
||||
|
||||
|
||||
exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
downloadCallback(WMWidget *w, void *data)
|
||||
static void downloadCallback(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
pid_t newPid;
|
||||
WMButton *button = (WMButton*)w;
|
||||
pid_t *pid;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
pid_t newPid;
|
||||
WMButton *button = (WMButton *) w;
|
||||
pid_t *pid;
|
||||
|
||||
if (button == panel->totB) {
|
||||
pid = &panel->tilePID;
|
||||
} else {
|
||||
pid = &panel->barPID;
|
||||
}
|
||||
if (button == panel->totB) {
|
||||
pid = &panel->tilePID;
|
||||
} else {
|
||||
pid = &panel->barPID;
|
||||
}
|
||||
|
||||
if (*pid == 0) {
|
||||
newPid = downloadFile(WMWidgetScreen(w), panel, NULL);
|
||||
if (newPid < 0) {
|
||||
return;
|
||||
}
|
||||
WMSetButtonText(button, _("Stop"));
|
||||
if (*pid == 0) {
|
||||
newPid = downloadFile(WMWidgetScreen(w), panel, NULL);
|
||||
if (newPid < 0) {
|
||||
return;
|
||||
}
|
||||
WMSetButtonText(button, _("Stop"));
|
||||
|
||||
if (button == panel->totB) {
|
||||
AddDeadChildHandler(newPid, finishedTileDownload, data);
|
||||
} else {
|
||||
AddDeadChildHandler(newPid, finishedBarDownload, data);
|
||||
}
|
||||
*pid = newPid;
|
||||
} else {
|
||||
*pid = 0;
|
||||
if (button == panel->totB) {
|
||||
AddDeadChildHandler(newPid, finishedTileDownload, data);
|
||||
} else {
|
||||
AddDeadChildHandler(newPid, finishedBarDownload, data);
|
||||
}
|
||||
*pid = newPid;
|
||||
} else {
|
||||
*pid = 0;
|
||||
|
||||
WMSetButtonText(button, _("Download"));
|
||||
}
|
||||
WMSetButtonText(button, _("Download"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
panel->saveB = WMCreateCommandButton(panel->box);
|
||||
WMResizeWidget(panel->saveB, 154, 24);
|
||||
WMMoveWidget(panel->saveB, 15, 10);
|
||||
WMSetButtonText(panel->saveB, _("Save Current Theme"));
|
||||
panel->saveB = WMCreateCommandButton(panel->box);
|
||||
WMResizeWidget(panel->saveB, 154, 24);
|
||||
WMMoveWidget(panel->saveB, 15, 10);
|
||||
WMSetButtonText(panel->saveB, _("Save Current Theme"));
|
||||
|
||||
panel->list = WMCreateList(panel->box);
|
||||
WMResizeWidget(panel->list, 154, 150);
|
||||
WMMoveWidget(panel->list, 15, 40);
|
||||
panel->list = WMCreateList(panel->box);
|
||||
WMResizeWidget(panel->list, 154, 150);
|
||||
WMMoveWidget(panel->list, 15, 40);
|
||||
|
||||
panel->loadB = WMCreateCommandButton(panel->box);
|
||||
WMResizeWidget(panel->loadB, 74, 24);
|
||||
WMMoveWidget(panel->loadB, 15, 200);
|
||||
WMSetButtonText(panel->loadB, _("Load"));
|
||||
|
||||
panel->instB = WMCreateCommandButton(panel->box);
|
||||
WMResizeWidget(panel->instB, 74, 24);
|
||||
WMMoveWidget(panel->instB, 95, 200);
|
||||
WMSetButtonText(panel->instB, _("Install"));
|
||||
panel->loadB = WMCreateCommandButton(panel->box);
|
||||
WMResizeWidget(panel->loadB, 74, 24);
|
||||
WMMoveWidget(panel->loadB, 15, 200);
|
||||
WMSetButtonText(panel->loadB, _("Load"));
|
||||
|
||||
panel->instB = WMCreateCommandButton(panel->box);
|
||||
WMResizeWidget(panel->instB, 74, 24);
|
||||
WMMoveWidget(panel->instB, 95, 200);
|
||||
WMSetButtonText(panel->instB, _("Install"));
|
||||
|
||||
/**************** Tile of the day ****************/
|
||||
|
||||
panel->totF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->totF, 210, 105);
|
||||
WMMoveWidget(panel->totF, 240, 10);
|
||||
WMSetFrameTitle(panel->totF, _("Tile of The Day"));
|
||||
panel->totF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->totF, 210, 105);
|
||||
WMMoveWidget(panel->totF, 240, 10);
|
||||
WMSetFrameTitle(panel->totF, _("Tile of The Day"));
|
||||
|
||||
panel->totL = WMCreateLabel(panel->totF);
|
||||
WMResizeWidget(panel->totL, 67, 67);
|
||||
WMMoveWidget(panel->totL, 25, 25);
|
||||
WMSetLabelRelief(panel->totL, WRSunken);
|
||||
panel->totL = WMCreateLabel(panel->totF);
|
||||
WMResizeWidget(panel->totL, 67, 67);
|
||||
WMMoveWidget(panel->totL, 25, 25);
|
||||
WMSetLabelRelief(panel->totL, WRSunken);
|
||||
|
||||
panel->totB = WMCreateCommandButton(panel->totF);
|
||||
WMResizeWidget(panel->totB, 86, 24);
|
||||
WMMoveWidget(panel->totB, 105, 45);
|
||||
WMSetButtonText(panel->totB, _("Download"));
|
||||
WMSetButtonAction(panel->totB, downloadCallback, panel);
|
||||
panel->totB = WMCreateCommandButton(panel->totF);
|
||||
WMResizeWidget(panel->totB, 86, 24);
|
||||
WMMoveWidget(panel->totB, 105, 45);
|
||||
WMSetButtonText(panel->totB, _("Download"));
|
||||
WMSetButtonAction(panel->totB, downloadCallback, panel);
|
||||
|
||||
WMMapSubwidgets(panel->totF);
|
||||
WMMapSubwidgets(panel->totF);
|
||||
|
||||
/**************** Bar of the day ****************/
|
||||
|
||||
panel->botF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->botF, 315, 95);
|
||||
WMMoveWidget(panel->botF, 190, 125);
|
||||
WMSetFrameTitle(panel->botF, _("Bar of The Day"));
|
||||
panel->botF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->botF, 315, 95);
|
||||
WMMoveWidget(panel->botF, 190, 125);
|
||||
WMSetFrameTitle(panel->botF, _("Bar of The Day"));
|
||||
|
||||
panel->botL = WMCreateLabel(panel->botF);
|
||||
WMResizeWidget(panel->botL, 285, 32);
|
||||
WMMoveWidget(panel->botL, 15, 20);
|
||||
WMSetLabelRelief(panel->botL, WRSunken);
|
||||
panel->botL = WMCreateLabel(panel->botF);
|
||||
WMResizeWidget(panel->botL, 285, 32);
|
||||
WMMoveWidget(panel->botL, 15, 20);
|
||||
WMSetLabelRelief(panel->botL, WRSunken);
|
||||
|
||||
panel->botB = WMCreateCommandButton(panel->botF);
|
||||
WMResizeWidget(panel->botB, 86, 24);
|
||||
WMMoveWidget(panel->botB, 110, 60);
|
||||
WMSetButtonText(panel->botB, _("Download"));
|
||||
WMSetButtonAction(panel->botB, downloadCallback, panel);
|
||||
panel->botB = WMCreateCommandButton(panel->botF);
|
||||
WMResizeWidget(panel->botB, 86, 24);
|
||||
WMMoveWidget(panel->botB, 110, 60);
|
||||
WMSetButtonText(panel->botB, _("Download"));
|
||||
WMSetButtonAction(panel->botB, downloadCallback, panel);
|
||||
|
||||
WMMapSubwidgets(panel->botF);
|
||||
WMMapSubwidgets(panel->botF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitThemes(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitThemes(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Themes");
|
||||
panel->sectionName = _("Themes");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
1407
WPrefs.app/WPrefs.c
1407
WPrefs.app/WPrefs.c
File diff suppressed because it is too large
Load Diff
@@ -20,444 +20,418 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *placF;
|
||||
WMPopUpButton *placP;
|
||||
WMLabel *porigL;
|
||||
WMLabel *porigvL;
|
||||
WMFrame *porigF;
|
||||
WMLabel *porigW;
|
||||
WMFrame *placF;
|
||||
WMPopUpButton *placP;
|
||||
WMLabel *porigL;
|
||||
WMLabel *porigvL;
|
||||
WMFrame *porigF;
|
||||
WMLabel *porigW;
|
||||
|
||||
WMSlider *vsli;
|
||||
WMSlider *hsli;
|
||||
WMSlider *vsli;
|
||||
WMSlider *hsli;
|
||||
|
||||
WMFrame *resF;
|
||||
WMSlider *resS;
|
||||
WMLabel *resL;
|
||||
WMButton *resaB;
|
||||
WMButton *resrB;
|
||||
WMFrame *resF;
|
||||
WMSlider *resS;
|
||||
WMLabel *resL;
|
||||
WMButton *resaB;
|
||||
WMButton *resrB;
|
||||
|
||||
WMFrame *maxiF;
|
||||
WMButton *miconB;
|
||||
WMButton *mdockB;
|
||||
WMFrame *maxiF;
|
||||
WMButton *miconB;
|
||||
WMButton *mdockB;
|
||||
|
||||
WMFrame *opaqF;
|
||||
WMButton *opaqB;
|
||||
WMFrame *opaqF;
|
||||
WMButton *opaqB;
|
||||
|
||||
WMFrame *tranF;
|
||||
WMButton *tranB;
|
||||
WMFrame *tranF;
|
||||
WMButton *tranB;
|
||||
} _Panel;
|
||||
|
||||
|
||||
#define ICON_FILE "whandling"
|
||||
|
||||
#define OPAQUE_MOVE_PIXMAP "opaque"
|
||||
|
||||
#define NON_OPAQUE_MOVE_PIXMAP "nonopaque"
|
||||
|
||||
|
||||
#define THUMB_SIZE 16
|
||||
|
||||
|
||||
static char *placements[] = {
|
||||
"auto",
|
||||
"random",
|
||||
"manual",
|
||||
"cascade",
|
||||
"smart"
|
||||
"auto",
|
||||
"random",
|
||||
"manual",
|
||||
"cascade",
|
||||
"smart"
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
sliderCallback(WMWidget *w, void *data)
|
||||
static void sliderCallback(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
int x, y, rx, ry;
|
||||
char buffer[64];
|
||||
int swidth = WMGetSliderMaxValue(panel->hsli);
|
||||
int sheight = WMGetSliderMaxValue(panel->vsli);
|
||||
_Panel *panel = (_Panel *) data;
|
||||
int x, y, rx, ry;
|
||||
char buffer[64];
|
||||
int swidth = WMGetSliderMaxValue(panel->hsli);
|
||||
int sheight = WMGetSliderMaxValue(panel->vsli);
|
||||
|
||||
x = WMGetSliderValue(panel->hsli);
|
||||
y = WMGetSliderValue(panel->vsli);
|
||||
x = WMGetSliderValue(panel->hsli);
|
||||
y = WMGetSliderValue(panel->vsli);
|
||||
|
||||
rx = x*(WMWidgetWidth(panel->porigF)-3)/swidth+2;
|
||||
ry = y*(WMWidgetHeight(panel->porigF)-3)/sheight+2;
|
||||
WMMoveWidget(panel->porigW, rx, ry);
|
||||
rx = x * (WMWidgetWidth(panel->porigF) - 3) / swidth + 2;
|
||||
ry = y * (WMWidgetHeight(panel->porigF) - 3) / sheight + 2;
|
||||
WMMoveWidget(panel->porigW, rx, ry);
|
||||
|
||||
sprintf(buffer, "(%i,%i)", x, y);
|
||||
WMSetLabelText(panel->porigvL, buffer);
|
||||
sprintf(buffer, "(%i,%i)", x, y);
|
||||
WMSetLabelText(panel->porigvL, buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
resistanceCallback(WMWidget *w, void *data)
|
||||
static void resistanceCallback(WMWidget * w, void *data)
|
||||
{
|
||||
_Panel *panel = (_Panel*)data;
|
||||
char buffer[64];
|
||||
int i;
|
||||
_Panel *panel = (_Panel *) data;
|
||||
char buffer[64];
|
||||
int i;
|
||||
|
||||
i = WMGetSliderValue(panel->resS);
|
||||
i = WMGetSliderValue(panel->resS);
|
||||
|
||||
if (i == 0)
|
||||
WMSetLabelText(panel->resL, "OFF");
|
||||
else {
|
||||
sprintf(buffer, "%i", i);
|
||||
WMSetLabelText(panel->resL, buffer);
|
||||
}
|
||||
if (i == 0)
|
||||
WMSetLabelText(panel->resL, "OFF");
|
||||
else {
|
||||
sprintf(buffer, "%i", i);
|
||||
WMSetLabelText(panel->resL, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getPlacement(char *str)
|
||||
static int getPlacement(char *str)
|
||||
{
|
||||
if (!str)
|
||||
return 0;
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
if (strcasecmp(str, "auto")==0)
|
||||
return 0;
|
||||
else if (strcasecmp(str, "random")==0)
|
||||
return 1;
|
||||
else if (strcasecmp(str, "manual")==0)
|
||||
return 2;
|
||||
else if (strcasecmp(str, "cascade")==0)
|
||||
return 3;
|
||||
else if (strcasecmp(str, "smart")==0)
|
||||
return 4;
|
||||
else
|
||||
wwarning(_("bad option value %s in WindowPlacement. Using default value"),
|
||||
str);
|
||||
return 0;
|
||||
if (strcasecmp(str, "auto") == 0)
|
||||
return 0;
|
||||
else if (strcasecmp(str, "random") == 0)
|
||||
return 1;
|
||||
else if (strcasecmp(str, "manual") == 0)
|
||||
return 2;
|
||||
else if (strcasecmp(str, "cascade") == 0)
|
||||
return 3;
|
||||
else if (strcasecmp(str, "smart") == 0)
|
||||
return 4;
|
||||
else
|
||||
wwarning(_("bad option value %s in WindowPlacement. Using default value"), str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
char *str;
|
||||
WMPropList *arr;
|
||||
int x, y;
|
||||
char *str;
|
||||
WMPropList *arr;
|
||||
int x, y;
|
||||
|
||||
str = GetStringForKey("WindowPlacement");
|
||||
str = GetStringForKey("WindowPlacement");
|
||||
|
||||
WMSetPopUpButtonSelectedItem(panel->placP, getPlacement(str));
|
||||
WMSetPopUpButtonSelectedItem(panel->placP, getPlacement(str));
|
||||
|
||||
arr = GetObjectForKey("WindowPlaceOrigin");
|
||||
arr = GetObjectForKey("WindowPlaceOrigin");
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
if (arr && (!WMIsPLArray(arr) || WMGetPropListItemCount(arr)!=2)) {
|
||||
wwarning(_("invalid data in option WindowPlaceOrigin. Using default (0,0)"));
|
||||
} else {
|
||||
if (arr) {
|
||||
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
|
||||
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
|
||||
}
|
||||
}
|
||||
x = 0;
|
||||
y = 0;
|
||||
if (arr && (!WMIsPLArray(arr) || WMGetPropListItemCount(arr) != 2)) {
|
||||
wwarning(_("invalid data in option WindowPlaceOrigin. Using default (0,0)"));
|
||||
} else {
|
||||
if (arr) {
|
||||
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
|
||||
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
WMSetSliderValue(panel->hsli, x);
|
||||
WMSetSliderValue(panel->vsli, y);
|
||||
WMSetSliderValue(panel->hsli, x);
|
||||
WMSetSliderValue(panel->vsli, y);
|
||||
|
||||
sliderCallback(NULL, panel);
|
||||
sliderCallback(NULL, panel);
|
||||
|
||||
x = GetIntegerForKey("EdgeResistance");
|
||||
WMSetSliderValue(panel->resS, x);
|
||||
resistanceCallback(NULL, panel);
|
||||
x = GetIntegerForKey("EdgeResistance");
|
||||
WMSetSliderValue(panel->resS, x);
|
||||
resistanceCallback(NULL, panel);
|
||||
|
||||
WMSetButtonSelected(panel->tranB, GetBoolForKey("OpenTransientOnOwnerWorkspace"));
|
||||
WMSetButtonSelected(panel->tranB, GetBoolForKey("OpenTransientOnOwnerWorkspace"));
|
||||
|
||||
WMSetButtonSelected(panel->opaqB, GetBoolForKey("OpaqueMove"));
|
||||
WMSetButtonSelected(panel->opaqB, GetBoolForKey("OpaqueMove"));
|
||||
|
||||
WMSetButtonSelected(panel->miconB, GetBoolForKey("NoWindowOverIcons"));
|
||||
WMSetButtonSelected(panel->miconB, GetBoolForKey("NoWindowOverIcons"));
|
||||
|
||||
WMSetButtonSelected(panel->mdockB, GetBoolForKey("NoWindowOverDock"));
|
||||
WMSetButtonSelected(panel->mdockB, GetBoolForKey("NoWindowOverDock"));
|
||||
|
||||
if (GetBoolForKey("Attraction"))
|
||||
WMPerformButtonClick(panel->resrB);
|
||||
else
|
||||
WMPerformButtonClick(panel->resaB);
|
||||
if (GetBoolForKey("Attraction"))
|
||||
WMPerformButtonClick(panel->resrB);
|
||||
else
|
||||
WMPerformButtonClick(panel->resaB);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
WMPropList *arr;
|
||||
char x[16], y[16];
|
||||
WMPropList *arr;
|
||||
char x[16], y[16];
|
||||
|
||||
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->mdockB), "NoWindowOverDock");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->opaqB), "OpaqueMove");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->tranB), "OpenTransientOnOwnerWorkspace");
|
||||
SetStringForKey(placements[WMGetPopUpButtonSelectedItem(panel->placP)],
|
||||
"WindowPlacement");
|
||||
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
|
||||
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
|
||||
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
|
||||
SetObjectForKey(arr, "WindowPlaceOrigin");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
|
||||
WMReleasePropList(arr);
|
||||
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->mdockB), "NoWindowOverDock");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->opaqB), "OpaqueMove");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->tranB), "OpenTransientOnOwnerWorkspace");
|
||||
SetStringForKey(placements[WMGetPopUpButtonSelectedItem(panel->placP)], "WindowPlacement");
|
||||
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
|
||||
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
|
||||
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
|
||||
SetObjectForKey(arr, "WindowPlaceOrigin");
|
||||
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
|
||||
WMReleasePropList(arr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMColor *color;
|
||||
WMPixmap *pixmap;
|
||||
int width, height;
|
||||
int swidth, sheight;
|
||||
char *path;
|
||||
WMBox *hbox;
|
||||
_Panel *panel = (Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMColor *color;
|
||||
WMPixmap *pixmap;
|
||||
int width, height;
|
||||
int swidth, sheight;
|
||||
char *path;
|
||||
WMBox *hbox;
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
WMSetBoxHorizontal(panel->box, False);
|
||||
WMSetBoxBorderWidth(panel->box, 8);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
WMSetBoxHorizontal(panel->box, False);
|
||||
WMSetBoxBorderWidth(panel->box, 8);
|
||||
|
||||
hbox = WMCreateBox(panel->box);
|
||||
WMSetBoxHorizontal(hbox, True);
|
||||
WMAddBoxSubview(panel->box, WMWidgetView(hbox), False, True, 110, 0, 10);
|
||||
hbox = WMCreateBox(panel->box);
|
||||
WMSetBoxHorizontal(hbox, True);
|
||||
WMAddBoxSubview(panel->box, WMWidgetView(hbox), False, True, 110, 0, 10);
|
||||
|
||||
/************** Window Placement ***************/
|
||||
panel->placF = WMCreateFrame(hbox);
|
||||
WMMapWidget(panel->placF);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->placF), True, True, 100, 0, 10);
|
||||
panel->placF = WMCreateFrame(hbox);
|
||||
WMMapWidget(panel->placF);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->placF), True, True, 100, 0, 10);
|
||||
|
||||
WMSetFrameTitle(panel->placF, _("Window Placement"));
|
||||
WMSetBalloonTextForView(_("How to place windows when they are first put\n"
|
||||
"on screen."), WMWidgetView(panel->placF));
|
||||
WMSetFrameTitle(panel->placF, _("Window Placement"));
|
||||
WMSetBalloonTextForView(_("How to place windows when they are first put\n"
|
||||
"on screen."), WMWidgetView(panel->placF));
|
||||
|
||||
panel->placP = WMCreatePopUpButton(panel->placF);
|
||||
WMResizeWidget(panel->placP, 105, 20);
|
||||
WMMoveWidget(panel->placP, 15, 20);
|
||||
WMAddPopUpButtonItem(panel->placP, _("Automatic"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Random"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Manual"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Cascade"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Smart"));
|
||||
panel->placP = WMCreatePopUpButton(panel->placF);
|
||||
WMResizeWidget(panel->placP, 105, 20);
|
||||
WMMoveWidget(panel->placP, 15, 20);
|
||||
WMAddPopUpButtonItem(panel->placP, _("Automatic"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Random"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Manual"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Cascade"));
|
||||
WMAddPopUpButtonItem(panel->placP, _("Smart"));
|
||||
|
||||
panel->porigL = WMCreateLabel(panel->placF);
|
||||
WMResizeWidget(panel->porigL, 120, 32);
|
||||
WMMoveWidget(panel->porigL, 5, 45);
|
||||
WMSetLabelTextAlignment(panel->porigL, WACenter);
|
||||
WMSetLabelText(panel->porigL, _("Placement Origin"));
|
||||
panel->porigL = WMCreateLabel(panel->placF);
|
||||
WMResizeWidget(panel->porigL, 120, 32);
|
||||
WMMoveWidget(panel->porigL, 5, 45);
|
||||
WMSetLabelTextAlignment(panel->porigL, WACenter);
|
||||
WMSetLabelText(panel->porigL, _("Placement Origin"));
|
||||
|
||||
panel->porigvL = WMCreateLabel(panel->placF);
|
||||
WMResizeWidget(panel->porigvL, 80, 20);
|
||||
WMMoveWidget(panel->porigvL, 30, 75);
|
||||
WMSetLabelTextAlignment(panel->porigvL, WACenter);
|
||||
panel->porigvL = WMCreateLabel(panel->placF);
|
||||
WMResizeWidget(panel->porigvL, 80, 20);
|
||||
WMMoveWidget(panel->porigvL, 30, 75);
|
||||
WMSetLabelTextAlignment(panel->porigvL, WACenter);
|
||||
|
||||
color = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
|
||||
panel->porigF = WMCreateFrame(panel->placF);
|
||||
WMSetWidgetBackgroundColor(panel->porigF, color);
|
||||
WMReleaseColor(color);
|
||||
WMSetFrameRelief(panel->porigF, WRSunken);
|
||||
color = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
|
||||
panel->porigF = WMCreateFrame(panel->placF);
|
||||
WMSetWidgetBackgroundColor(panel->porigF, color);
|
||||
WMReleaseColor(color);
|
||||
WMSetFrameRelief(panel->porigF, WRSunken);
|
||||
|
||||
swidth = WidthOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr)));
|
||||
sheight = HeightOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr)));
|
||||
swidth = WidthOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr)));
|
||||
sheight = HeightOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr)));
|
||||
|
||||
if (sheight > swidth) {
|
||||
height = 70;
|
||||
width = 70*swidth/sheight;
|
||||
if (width > 240)
|
||||
width = 240;
|
||||
height = 240*sheight/swidth;
|
||||
} else {
|
||||
width = 240;
|
||||
height = 240*sheight/swidth;
|
||||
if (height > 70)
|
||||
height = 70;
|
||||
width = 70*swidth/sheight;
|
||||
}
|
||||
WMResizeWidget(panel->porigF, width, height);
|
||||
WMMoveWidget(panel->porigF, 130+(240-width)/2, 20+(70-height)/2);
|
||||
if (sheight > swidth) {
|
||||
height = 70;
|
||||
width = 70 * swidth / sheight;
|
||||
if (width > 240)
|
||||
width = 240;
|
||||
height = 240 * sheight / swidth;
|
||||
} else {
|
||||
width = 240;
|
||||
height = 240 * sheight / swidth;
|
||||
if (height > 70)
|
||||
height = 70;
|
||||
width = 70 * swidth / sheight;
|
||||
}
|
||||
WMResizeWidget(panel->porigF, width, height);
|
||||
WMMoveWidget(panel->porigF, 130 + (240 - width) / 2, 20 + (70 - height) / 2);
|
||||
|
||||
panel->porigW = WMCreateLabel(panel->porigF);
|
||||
WMResizeWidget(panel->porigW, THUMB_SIZE, THUMB_SIZE);
|
||||
WMMoveWidget(panel->porigW, 2, 2);
|
||||
WMSetLabelRelief(panel->porigW, WRRaised);
|
||||
panel->porigW = WMCreateLabel(panel->porigF);
|
||||
WMResizeWidget(panel->porigW, THUMB_SIZE, THUMB_SIZE);
|
||||
WMMoveWidget(panel->porigW, 2, 2);
|
||||
WMSetLabelRelief(panel->porigW, WRRaised);
|
||||
|
||||
panel->hsli = WMCreateSlider(panel->placF);
|
||||
WMResizeWidget(panel->hsli, width, 12);
|
||||
WMMoveWidget(panel->hsli, 130 + (240 - width) / 2, 20 + (70 - height) / 2 + height + 2);
|
||||
WMSetSliderAction(panel->hsli, sliderCallback, panel);
|
||||
WMSetSliderMinValue(panel->hsli, 0);
|
||||
WMSetSliderMaxValue(panel->hsli, swidth);
|
||||
|
||||
panel->hsli = WMCreateSlider(panel->placF);
|
||||
WMResizeWidget(panel->hsli, width, 12);
|
||||
WMMoveWidget(panel->hsli, 130+(240-width)/2, 20+(70-height)/2+height+2);
|
||||
WMSetSliderAction(panel->hsli, sliderCallback, panel);
|
||||
WMSetSliderMinValue(panel->hsli, 0);
|
||||
WMSetSliderMaxValue(panel->hsli, swidth);
|
||||
panel->vsli = WMCreateSlider(panel->placF);
|
||||
WMResizeWidget(panel->vsli, 12, height);
|
||||
WMMoveWidget(panel->vsli, 130 + (240 - width) / 2 + width + 2, 20 + (70 - height) / 2);
|
||||
WMSetSliderAction(panel->vsli, sliderCallback, panel);
|
||||
WMSetSliderMinValue(panel->vsli, 0);
|
||||
WMSetSliderMaxValue(panel->vsli, sheight);
|
||||
|
||||
panel->vsli = WMCreateSlider(panel->placF);
|
||||
WMResizeWidget(panel->vsli, 12, height);
|
||||
WMMoveWidget(panel->vsli, 130+(240-width)/2+width+2, 20+(70-height)/2);
|
||||
WMSetSliderAction(panel->vsli, sliderCallback, panel);
|
||||
WMSetSliderMinValue(panel->vsli, 0);
|
||||
WMSetSliderMaxValue(panel->vsli, sheight);
|
||||
WMMapSubwidgets(panel->porigF);
|
||||
|
||||
WMMapSubwidgets(panel->porigF);
|
||||
|
||||
WMMapSubwidgets(panel->placF);
|
||||
WMMapSubwidgets(panel->placF);
|
||||
|
||||
/************** Opaque Move ***************/
|
||||
panel->opaqF = WMCreateFrame(hbox);
|
||||
WMMapWidget(panel->opaqF);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->opaqF), False, True, 110, 0, 0);
|
||||
panel->opaqF = WMCreateFrame(hbox);
|
||||
WMMapWidget(panel->opaqF);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->opaqF), False, True, 110, 0, 0);
|
||||
|
||||
WMSetFrameTitle(panel->opaqF, _("Opaque Move"));
|
||||
WMSetBalloonTextForView(_("Whether the window contents should be moved\n"
|
||||
"when dragging windows aroung or if only a\n"
|
||||
"frame should be displayed.\n"),
|
||||
WMWidgetView(panel->opaqF));
|
||||
WMSetFrameTitle(panel->opaqF, _("Opaque Move"));
|
||||
WMSetBalloonTextForView(_("Whether the window contents should be moved\n"
|
||||
"when dragging windows aroung or if only a\n"
|
||||
"frame should be displayed.\n"), WMWidgetView(panel->opaqF));
|
||||
|
||||
panel->opaqB = WMCreateButton(panel->opaqF, WBTToggle);
|
||||
WMResizeWidget(panel->opaqB, 64, 64);
|
||||
WMMoveWidget(panel->opaqB, 24, 25);
|
||||
WMSetButtonImagePosition(panel->opaqB, WIPImageOnly);
|
||||
panel->opaqB = WMCreateButton(panel->opaqF, WBTToggle);
|
||||
WMResizeWidget(panel->opaqB, 64, 64);
|
||||
WMMoveWidget(panel->opaqB, 24, 25);
|
||||
WMSetButtonImagePosition(panel->opaqB, WIPImageOnly);
|
||||
|
||||
path = LocateImage(NON_OPAQUE_MOVE_PIXMAP);
|
||||
if (path) {
|
||||
pixmap = WMCreatePixmapFromFile(scr, path);
|
||||
if (pixmap) {
|
||||
WMSetButtonImage(panel->opaqB, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(NON_OPAQUE_MOVE_PIXMAP);
|
||||
if (path) {
|
||||
pixmap = WMCreatePixmapFromFile(scr, path);
|
||||
if (pixmap) {
|
||||
WMSetButtonImage(panel->opaqB, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
path = LocateImage(OPAQUE_MOVE_PIXMAP);
|
||||
if (path) {
|
||||
pixmap = WMCreatePixmapFromFile(scr, path);
|
||||
if (pixmap) {
|
||||
WMSetButtonAltImage(panel->opaqB, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMMapSubwidgets(panel->opaqF);
|
||||
path = LocateImage(OPAQUE_MOVE_PIXMAP);
|
||||
if (path) {
|
||||
pixmap = WMCreatePixmapFromFile(scr, path);
|
||||
if (pixmap) {
|
||||
WMSetButtonAltImage(panel->opaqB, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
} else {
|
||||
wwarning(_("could not load icon %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMMapSubwidgets(panel->opaqF);
|
||||
|
||||
/**************** Account for Icon/Dock ***************/
|
||||
panel->maxiF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->maxiF, 205, 95);
|
||||
WMMoveWidget(panel->maxiF, 305, 125);
|
||||
WMSetFrameTitle(panel->maxiF, _("When maximizing..."));
|
||||
panel->maxiF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->maxiF, 205, 95);
|
||||
WMMoveWidget(panel->maxiF, 305, 125);
|
||||
WMSetFrameTitle(panel->maxiF, _("When maximizing..."));
|
||||
|
||||
panel->miconB = WMCreateSwitchButton(panel->maxiF);
|
||||
WMResizeWidget(panel->miconB, 190, 30);
|
||||
WMMoveWidget(panel->miconB, 10, 18);
|
||||
WMSetButtonText(panel->miconB, _("...do not cover icons"));
|
||||
panel->miconB = WMCreateSwitchButton(panel->maxiF);
|
||||
WMResizeWidget(panel->miconB, 190, 30);
|
||||
WMMoveWidget(panel->miconB, 10, 18);
|
||||
WMSetButtonText(panel->miconB, _("...do not cover icons"));
|
||||
|
||||
panel->mdockB = WMCreateSwitchButton(panel->maxiF);
|
||||
WMResizeWidget(panel->mdockB, 190, 30);
|
||||
WMMoveWidget(panel->mdockB, 10, 53);
|
||||
panel->mdockB = WMCreateSwitchButton(panel->maxiF);
|
||||
WMResizeWidget(panel->mdockB, 190, 30);
|
||||
WMMoveWidget(panel->mdockB, 10, 53);
|
||||
|
||||
WMSetButtonText(panel->mdockB, _("...do not cover dock"));
|
||||
WMSetButtonText(panel->mdockB, _("...do not cover dock"));
|
||||
|
||||
WMMapSubwidgets(panel->maxiF);
|
||||
WMMapSubwidgets(panel->maxiF);
|
||||
|
||||
/**************** Edge Resistance ****************/
|
||||
|
||||
panel->resF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->resF, 285, 45);
|
||||
WMMoveWidget(panel->resF, 8, 125);
|
||||
WMSetFrameTitle(panel->resF, _("Edge Resistance"));
|
||||
panel->resF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->resF, 285, 45);
|
||||
WMMoveWidget(panel->resF, 8, 125);
|
||||
WMSetFrameTitle(panel->resF, _("Edge Resistance"));
|
||||
|
||||
WMSetBalloonTextForView(_("Edge resistance will make windows `resist'\n"
|
||||
"being moved further for the defined threshold\n"
|
||||
"when moved against other windows or the edges\n"
|
||||
"of the screen."), WMWidgetView(panel->resF));
|
||||
WMSetBalloonTextForView(_("Edge resistance will make windows `resist'\n"
|
||||
"being moved further for the defined threshold\n"
|
||||
"when moved against other windows or the edges\n"
|
||||
"of the screen."), WMWidgetView(panel->resF));
|
||||
|
||||
panel->resS = WMCreateSlider(panel->resF);
|
||||
WMResizeWidget(panel->resS, 80, 15);
|
||||
WMMoveWidget(panel->resS, 10, 20);
|
||||
WMSetSliderMinValue(panel->resS, 0);
|
||||
WMSetSliderMaxValue(panel->resS, 80);
|
||||
WMSetSliderAction(panel->resS, resistanceCallback, panel);
|
||||
panel->resS = WMCreateSlider(panel->resF);
|
||||
WMResizeWidget(panel->resS, 80, 15);
|
||||
WMMoveWidget(panel->resS, 10, 20);
|
||||
WMSetSliderMinValue(panel->resS, 0);
|
||||
WMSetSliderMaxValue(panel->resS, 80);
|
||||
WMSetSliderAction(panel->resS, resistanceCallback, panel);
|
||||
|
||||
panel->resL = WMCreateLabel(panel->resF);
|
||||
WMResizeWidget(panel->resL, 30, 15);
|
||||
WMMoveWidget(panel->resL, 95, 20);
|
||||
panel->resL = WMCreateLabel(panel->resF);
|
||||
WMResizeWidget(panel->resL, 30, 15);
|
||||
WMMoveWidget(panel->resL, 95, 20);
|
||||
|
||||
panel->resaB = WMCreateRadioButton(panel->resF);
|
||||
WMMoveWidget(panel->resaB, 130, 15);
|
||||
WMResizeWidget(panel->resaB, 70, 25);
|
||||
WMSetButtonText(panel->resaB, _("Resist"));
|
||||
panel->resaB = WMCreateRadioButton(panel->resF);
|
||||
WMMoveWidget(panel->resaB, 130, 15);
|
||||
WMResizeWidget(panel->resaB, 70, 25);
|
||||
WMSetButtonText(panel->resaB, _("Resist"));
|
||||
|
||||
panel->resrB = WMCreateRadioButton(panel->resF);
|
||||
WMMoveWidget(panel->resrB, 200, 15);
|
||||
WMResizeWidget(panel->resrB, 70, 25);
|
||||
WMSetButtonText(panel->resrB, _("Attract"));
|
||||
WMGroupButtons(panel->resrB, panel->resaB);
|
||||
panel->resrB = WMCreateRadioButton(panel->resF);
|
||||
WMMoveWidget(panel->resrB, 200, 15);
|
||||
WMResizeWidget(panel->resrB, 70, 25);
|
||||
WMSetButtonText(panel->resrB, _("Attract"));
|
||||
WMGroupButtons(panel->resrB, panel->resaB);
|
||||
|
||||
WMMapSubwidgets(panel->resF);
|
||||
WMMapSubwidgets(panel->resF);
|
||||
|
||||
/**************** Transients on Parent Workspace ****************/
|
||||
|
||||
panel->tranF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->tranF, 285, 40);
|
||||
WMMoveWidget(panel->tranF, 8, 180);
|
||||
panel->tranF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->tranF, 285, 40);
|
||||
WMMoveWidget(panel->tranF, 8, 180);
|
||||
|
||||
panel->tranB = WMCreateSwitchButton(panel->tranF);
|
||||
WMMoveWidget(panel->tranB, 10, 5);
|
||||
WMResizeWidget(panel->tranB, 250, 30);
|
||||
WMSetButtonText(panel->tranB, _("Open dialogs in the same workspace\nas their owners"));
|
||||
panel->tranB = WMCreateSwitchButton(panel->tranF);
|
||||
WMMoveWidget(panel->tranB, 10, 5);
|
||||
WMResizeWidget(panel->tranB, 250, 30);
|
||||
WMSetButtonText(panel->tranB, _("Open dialogs in the same workspace\nas their owners"));
|
||||
|
||||
WMMapSubwidgets(panel->tranF);
|
||||
WMMapSubwidgets(panel->tranF);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
/* show the config data */
|
||||
showData(panel);
|
||||
/* show the config data */
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
undo(_Panel *panel)
|
||||
static void undo(_Panel * panel)
|
||||
{
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
Panel*
|
||||
InitWindowHandling(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitWindowHandling(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Window Handling Preferences");
|
||||
panel->sectionName = _("Window Handling Preferences");
|
||||
|
||||
panel->description = _("Window handling options. Initial placement style\n"
|
||||
"edge resistance, opaque move etc.");
|
||||
panel->description = _("Window handling options. Initial placement style\n"
|
||||
"edge resistance, opaque move etc.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.undoChanges = undo;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.undoChanges = undo;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,41 +20,37 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
|
||||
typedef struct _Panel {
|
||||
WMBox *box;
|
||||
WMBox *box;
|
||||
|
||||
char *sectionName;
|
||||
char *sectionName;
|
||||
|
||||
char *description;
|
||||
char *description;
|
||||
|
||||
CallbackRec callbacks;
|
||||
CallbackRec callbacks;
|
||||
|
||||
WMWidget *parent;
|
||||
WMWidget *parent;
|
||||
|
||||
WMFrame *navF;
|
||||
WMFrame *navF;
|
||||
|
||||
WMButton *linkB;
|
||||
WMButton *cyclB;
|
||||
WMButton *newB;
|
||||
WMLabel *linkL;
|
||||
WMLabel *cyclL;
|
||||
WMLabel *newL;
|
||||
WMButton *linkB;
|
||||
WMButton *cyclB;
|
||||
WMButton *newB;
|
||||
WMLabel *linkL;
|
||||
WMLabel *cyclL;
|
||||
WMLabel *newL;
|
||||
|
||||
WMLabel *posiL;
|
||||
WMLabel *posL;
|
||||
WMPopUpButton *posP;
|
||||
WMLabel *posiL;
|
||||
WMLabel *posL;
|
||||
WMPopUpButton *posP;
|
||||
|
||||
WMFrame *dockF;
|
||||
WMButton *dockB;
|
||||
WMButton *clipB;
|
||||
WMFrame *dockF;
|
||||
WMButton *dockB;
|
||||
WMButton *clipB;
|
||||
} _Panel;
|
||||
|
||||
|
||||
|
||||
#define ICON_FILE "workspace"
|
||||
|
||||
#define ARQUIVO_XIS "xis"
|
||||
@@ -65,314 +61,286 @@ typedef struct _Panel {
|
||||
#define DOCK_FILE "dock"
|
||||
#define CLIP_FILE "clip"
|
||||
|
||||
|
||||
static char *WSNamePositions[] = {
|
||||
"none",
|
||||
"center",
|
||||
"top",
|
||||
"bottom",
|
||||
"topleft",
|
||||
"topright",
|
||||
"bottomleft",
|
||||
"bottomright"
|
||||
"none",
|
||||
"center",
|
||||
"top",
|
||||
"bottom",
|
||||
"topleft",
|
||||
"topright",
|
||||
"bottomleft",
|
||||
"bottomright"
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
|
||||
WMPixmap **icon1, WMPixmap **icon2)
|
||||
createImages(WMScreen * scr, RContext * rc, RImage * xis, char *file, WMPixmap ** icon1, WMPixmap ** icon2)
|
||||
{
|
||||
RImage *icon;
|
||||
RColor gray = {0xae,0xaa,0xae};
|
||||
RImage *icon;
|
||||
RColor gray = { 0xae, 0xaa, 0xae };
|
||||
|
||||
*icon1 = WMCreatePixmapFromFile(scr, file);
|
||||
if (!*icon1) {
|
||||
wwarning(_("could not load icon %s"), file);
|
||||
if (icon2)
|
||||
*icon2 = NULL;
|
||||
return;
|
||||
}
|
||||
*icon1 = WMCreatePixmapFromFile(scr, file);
|
||||
if (!*icon1) {
|
||||
wwarning(_("could not load icon %s"), file);
|
||||
if (icon2)
|
||||
*icon2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!icon2)
|
||||
return;
|
||||
if (!icon2)
|
||||
return;
|
||||
|
||||
icon = RLoadImage(rc, file, 0);
|
||||
if (!icon) {
|
||||
wwarning(_("could not load icon %s"), file);
|
||||
*icon2 = NULL;
|
||||
return;
|
||||
}
|
||||
RCombineImageWithColor(icon, &gray);
|
||||
if (xis) {
|
||||
RCombineImagesWithOpaqueness(icon, xis, 180);
|
||||
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127))) {
|
||||
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
|
||||
*icon2 = NULL;
|
||||
}
|
||||
}
|
||||
RReleaseImage(icon);
|
||||
icon = RLoadImage(rc, file, 0);
|
||||
if (!icon) {
|
||||
wwarning(_("could not load icon %s"), file);
|
||||
*icon2 = NULL;
|
||||
return;
|
||||
}
|
||||
RCombineImageWithColor(icon, &gray);
|
||||
if (xis) {
|
||||
RCombineImagesWithOpaqueness(icon, xis, 180);
|
||||
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127))) {
|
||||
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
|
||||
*icon2 = NULL;
|
||||
}
|
||||
}
|
||||
RReleaseImage(icon);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
static void showData(_Panel * panel)
|
||||
{
|
||||
int i, idx;
|
||||
char *str;
|
||||
int i, idx;
|
||||
char *str;
|
||||
|
||||
WMSetButtonSelected(panel->linkB, !GetBoolForKey("DontLinkWorkspaces"));
|
||||
WMSetButtonSelected(panel->linkB, !GetBoolForKey("DontLinkWorkspaces"));
|
||||
|
||||
WMSetButtonSelected(panel->cyclB, GetBoolForKey("CycleWorkspaces"));
|
||||
WMSetButtonSelected(panel->cyclB, GetBoolForKey("CycleWorkspaces"));
|
||||
|
||||
WMSetButtonSelected(panel->newB, GetBoolForKey("AdvanceToNewWorkspace"));
|
||||
WMSetButtonSelected(panel->newB, GetBoolForKey("AdvanceToNewWorkspace"));
|
||||
|
||||
WMSetButtonSelected(panel->dockB, !GetBoolForKey("DisableDock"));
|
||||
WMSetButtonSelected(panel->dockB, !GetBoolForKey("DisableDock"));
|
||||
|
||||
WMSetButtonSelected(panel->clipB, !GetBoolForKey("DisableClip"));
|
||||
WMSetButtonSelected(panel->clipB, !GetBoolForKey("DisableClip"));
|
||||
|
||||
str = GetStringForKey("WorkspaceNameDisplayPosition");
|
||||
if (!str)
|
||||
str = "center";
|
||||
str = GetStringForKey("WorkspaceNameDisplayPosition");
|
||||
if (!str)
|
||||
str = "center";
|
||||
|
||||
idx = 1; /* center */
|
||||
for (i = 0; i < sizeof(WSNamePositions)/sizeof(char*); i++) {
|
||||
if (strcasecmp(WSNamePositions[i], str) == 0) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
WMSetPopUpButtonSelectedItem(panel->posP, idx);
|
||||
idx = 1; /* center */
|
||||
for (i = 0; i < sizeof(WSNamePositions) / sizeof(char *); i++) {
|
||||
if (strcasecmp(WSNamePositions[i], str) == 0) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
WMSetPopUpButtonSelectedItem(panel->posP, idx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
createPanel(Panel *p)
|
||||
static void createPanel(Panel * p)
|
||||
{
|
||||
_Panel *panel = (_Panel*)p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMPixmap *icon1, *icon2;
|
||||
RImage *xis = NULL;
|
||||
RContext *rc = WMScreenRContext(scr);
|
||||
char *path;
|
||||
_Panel *panel = (_Panel *) p;
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
WMPixmap *icon1, *icon2;
|
||||
RImage *xis = NULL;
|
||||
RContext *rc = WMScreenRContext(scr);
|
||||
char *path;
|
||||
|
||||
path = LocateImage(ARQUIVO_XIS);
|
||||
if (path) {
|
||||
xis = RLoadImage(rc, path, 0);
|
||||
if (!xis) {
|
||||
wwarning(_("could not load image file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
path = LocateImage(ARQUIVO_XIS);
|
||||
if (path) {
|
||||
xis = RLoadImage(rc, path, 0);
|
||||
if (!xis) {
|
||||
wwarning(_("could not load image file %s"), path);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
panel->box = WMCreateBox(panel->parent);
|
||||
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
|
||||
|
||||
/***************** Workspace Navigation *****************/
|
||||
panel->navF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->navF, 365, 210);
|
||||
WMMoveWidget(panel->navF, 15, 10);
|
||||
WMSetFrameTitle(panel->navF, _("Workspace Navigation"));
|
||||
panel->navF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->navF, 365, 210);
|
||||
WMMoveWidget(panel->navF, 15, 10);
|
||||
WMSetFrameTitle(panel->navF, _("Workspace Navigation"));
|
||||
|
||||
panel->cyclB = WMCreateSwitchButton(panel->navF);
|
||||
WMResizeWidget(panel->cyclB, 280, 34);
|
||||
WMMoveWidget(panel->cyclB, 75, 30);
|
||||
WMSetButtonText(panel->cyclB, _("Wrap to the first workspace from the last workspace."));
|
||||
|
||||
panel->cyclB = WMCreateSwitchButton(panel->navF);
|
||||
WMResizeWidget(panel->cyclB, 280, 34);
|
||||
WMMoveWidget(panel->cyclB, 75, 30);
|
||||
WMSetButtonText(panel->cyclB,
|
||||
_("Wrap to the first workspace from the last workspace."));
|
||||
panel->cyclL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->cyclL, 60, 60);
|
||||
WMMoveWidget(panel->cyclL, 10, 15);
|
||||
WMSetLabelImagePosition(panel->cyclL, WIPImageOnly);
|
||||
path = LocateImage(CYCLE_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->cyclL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->cyclL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->cyclL, 60, 60);
|
||||
WMMoveWidget(panel->cyclL, 10, 15);
|
||||
WMSetLabelImagePosition(panel->cyclL, WIPImageOnly);
|
||||
path = LocateImage(CYCLE_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->cyclL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
/**/ panel->linkB = WMCreateSwitchButton(panel->navF);
|
||||
WMResizeWidget(panel->linkB, 280, 34);
|
||||
WMMoveWidget(panel->linkB, 75, 75);
|
||||
WMSetButtonText(panel->linkB, _("Switch workspaces while dragging windows."));
|
||||
|
||||
/**/
|
||||
panel->linkL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->linkL, 60, 40);
|
||||
WMMoveWidget(panel->linkL, 10, 80);
|
||||
WMSetLabelImagePosition(panel->linkL, WIPImageOnly);
|
||||
path = LocateImage(DONT_LINK_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->linkL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->linkB = WMCreateSwitchButton(panel->navF);
|
||||
WMResizeWidget(panel->linkB, 280, 34);
|
||||
WMMoveWidget(panel->linkB, 75, 75);
|
||||
WMSetButtonText(panel->linkB,
|
||||
_("Switch workspaces while dragging windows."));
|
||||
/**/ panel->newB = WMCreateSwitchButton(panel->navF);
|
||||
WMResizeWidget(panel->newB, 280, 34);
|
||||
WMMoveWidget(panel->newB, 75, 120);
|
||||
WMSetButtonText(panel->newB, _("Automatically create new workspaces."));
|
||||
|
||||
panel->linkL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->linkL, 60, 40);
|
||||
WMMoveWidget(panel->linkL, 10, 80);
|
||||
WMSetLabelImagePosition(panel->linkL, WIPImageOnly);
|
||||
path = LocateImage(DONT_LINK_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->linkL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
panel->newL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->newL, 60, 20);
|
||||
WMMoveWidget(panel->newL, 10, 130);
|
||||
WMSetLabelImagePosition(panel->newL, WIPImageOnly);
|
||||
path = LocateImage(ADVANCE_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->newL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
/**/
|
||||
/**/ panel->posL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->posL, 140, 30);
|
||||
WMMoveWidget(panel->posL, 75, 165);
|
||||
WMSetLabelTextAlignment(panel->posL, WARight);
|
||||
WMSetLabelText(panel->posL, _("Position of workspace\nname display"));
|
||||
|
||||
panel->newB = WMCreateSwitchButton(panel->navF);
|
||||
WMResizeWidget(panel->newB, 280, 34);
|
||||
WMMoveWidget(panel->newB, 75, 120);
|
||||
WMSetButtonText(panel->newB,
|
||||
_("Automatically create new workspaces."));
|
||||
panel->posiL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->posiL, 60, 40);
|
||||
WMMoveWidget(panel->posiL, 10, 160);
|
||||
WMSetLabelImagePosition(panel->posiL, WIPImageOnly);
|
||||
path = LocateImage(WSNAME_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->posiL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->newL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->newL, 60, 20);
|
||||
WMMoveWidget(panel->newL, 10, 130);
|
||||
WMSetLabelImagePosition(panel->newL, WIPImageOnly);
|
||||
path = LocateImage(ADVANCE_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->newL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
panel->posP = WMCreatePopUpButton(panel->navF);
|
||||
WMResizeWidget(panel->posP, 125, 20);
|
||||
WMMoveWidget(panel->posP, 225, 175);
|
||||
WMAddPopUpButtonItem(panel->posP, _("Disable"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Center"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Top"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Bottom"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Top/Left"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Top/Right"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Bottom/Left"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Bottom/Right"));
|
||||
|
||||
/**/
|
||||
|
||||
panel->posL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->posL, 140, 30);
|
||||
WMMoveWidget(panel->posL, 75, 165);
|
||||
WMSetLabelTextAlignment(panel->posL, WARight);
|
||||
WMSetLabelText(panel->posL,
|
||||
_("Position of workspace\nname display"));
|
||||
|
||||
panel->posiL = WMCreateLabel(panel->navF);
|
||||
WMResizeWidget(panel->posiL, 60, 40);
|
||||
WMMoveWidget(panel->posiL, 10, 160);
|
||||
WMSetLabelImagePosition(panel->posiL, WIPImageOnly);
|
||||
path = LocateImage(WSNAME_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, NULL);
|
||||
if (icon1) {
|
||||
WMSetLabelImage(panel->posiL, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
panel->posP = WMCreatePopUpButton(panel->navF);
|
||||
WMResizeWidget(panel->posP, 125, 20);
|
||||
WMMoveWidget(panel->posP, 225, 175);
|
||||
WMAddPopUpButtonItem(panel->posP, _("Disable"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Center"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Top"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Bottom"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Top/Left"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Top/Right"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Bottom/Left"));
|
||||
WMAddPopUpButtonItem(panel->posP, _("Bottom/Right"));
|
||||
|
||||
WMMapSubwidgets(panel->navF);
|
||||
WMMapSubwidgets(panel->navF);
|
||||
|
||||
/***************** Dock/Clip *****************/
|
||||
panel->dockF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->dockF, 115, 210);
|
||||
WMMoveWidget(panel->dockF, 390, 10);
|
||||
WMSetFrameTitle(panel->dockF, _("Dock/Clip"));
|
||||
panel->dockF = WMCreateFrame(panel->box);
|
||||
WMResizeWidget(panel->dockF, 115, 210);
|
||||
WMMoveWidget(panel->dockF, 390, 10);
|
||||
WMSetFrameTitle(panel->dockF, _("Dock/Clip"));
|
||||
|
||||
panel->dockB = WMCreateButton(panel->dockF, WBTToggle);
|
||||
WMResizeWidget(panel->dockB, 64, 64);
|
||||
WMMoveWidget(panel->dockB, 25, 35);
|
||||
WMSetButtonImagePosition(panel->dockB, WIPImageOnly);
|
||||
path = LocateImage(DOCK_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, &icon2);
|
||||
if (icon2) {
|
||||
WMSetButtonImage(panel->dockB, icon2);
|
||||
WMReleasePixmap(icon2);
|
||||
}
|
||||
if (icon1) {
|
||||
WMSetButtonAltImage(panel->dockB, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable the application Dock (the\n"
|
||||
"vertical icon bar in the side of the screen)."),
|
||||
WMWidgetView(panel->dockB));
|
||||
panel->dockB = WMCreateButton(panel->dockF, WBTToggle);
|
||||
WMResizeWidget(panel->dockB, 64, 64);
|
||||
WMMoveWidget(panel->dockB, 25, 35);
|
||||
WMSetButtonImagePosition(panel->dockB, WIPImageOnly);
|
||||
path = LocateImage(DOCK_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, &icon2);
|
||||
if (icon2) {
|
||||
WMSetButtonImage(panel->dockB, icon2);
|
||||
WMReleasePixmap(icon2);
|
||||
}
|
||||
if (icon1) {
|
||||
WMSetButtonAltImage(panel->dockB, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable the application Dock (the\n"
|
||||
"vertical icon bar in the side of the screen)."), WMWidgetView(panel->dockB));
|
||||
|
||||
panel->clipB = WMCreateButton(panel->dockF, WBTToggle);
|
||||
WMResizeWidget(panel->clipB, 64, 64);
|
||||
WMMoveWidget(panel->clipB, 25, 120);
|
||||
WMSetButtonImagePosition(panel->clipB, WIPImageOnly);
|
||||
path = LocateImage(CLIP_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, &icon2);
|
||||
if (icon2) {
|
||||
WMSetButtonImage(panel->clipB, icon2);
|
||||
WMReleasePixmap(icon2);
|
||||
}
|
||||
if (icon1) {
|
||||
WMSetButtonAltImage(panel->clipB, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable the Clip (that thing with\n"
|
||||
"a paper clip icon)."),
|
||||
WMWidgetView(panel->clipB));
|
||||
panel->clipB = WMCreateButton(panel->dockF, WBTToggle);
|
||||
WMResizeWidget(panel->clipB, 64, 64);
|
||||
WMMoveWidget(panel->clipB, 25, 120);
|
||||
WMSetButtonImagePosition(panel->clipB, WIPImageOnly);
|
||||
path = LocateImage(CLIP_FILE);
|
||||
if (path) {
|
||||
createImages(scr, rc, xis, path, &icon1, &icon2);
|
||||
if (icon2) {
|
||||
WMSetButtonImage(panel->clipB, icon2);
|
||||
WMReleasePixmap(icon2);
|
||||
}
|
||||
if (icon1) {
|
||||
WMSetButtonAltImage(panel->clipB, icon1);
|
||||
WMReleasePixmap(icon1);
|
||||
}
|
||||
wfree(path);
|
||||
}
|
||||
WMSetBalloonTextForView(_("Disable/enable the Clip (that thing with\n"
|
||||
"a paper clip icon)."), WMWidgetView(panel->clipB));
|
||||
|
||||
WMMapSubwidgets(panel->dockF);
|
||||
WMMapSubwidgets(panel->dockF);
|
||||
|
||||
if (xis)
|
||||
RReleaseImage(xis);
|
||||
if (xis)
|
||||
RReleaseImage(xis);
|
||||
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
WMRealizeWidget(panel->box);
|
||||
WMMapSubwidgets(panel->box);
|
||||
|
||||
showData(panel);
|
||||
showData(panel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeData(_Panel *panel)
|
||||
static void storeData(_Panel * panel)
|
||||
{
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
|
||||
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
|
||||
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->dockB), "DisableDock");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->clipB), "DisableClip");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->dockB), "DisableDock");
|
||||
SetBoolForKey(!WMGetButtonSelected(panel->clipB), "DisableClip");
|
||||
|
||||
SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
|
||||
"WorkspaceNameDisplayPosition");
|
||||
SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
|
||||
"WorkspaceNameDisplayPosition");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Panel*
|
||||
InitWorkspace(WMScreen *scr, WMWidget *parent)
|
||||
Panel *InitWorkspace(WMScreen * scr, WMWidget * parent)
|
||||
{
|
||||
_Panel *panel;
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Workspace Preferences");
|
||||
panel->sectionName = _("Workspace Preferences");
|
||||
|
||||
panel->description = _("Workspace navigation features.\n"
|
||||
"You can also enable/disable the Dock and Clip here.");
|
||||
panel->description = _("Workspace navigation features.\n"
|
||||
"You can also enable/disable the Dock and Clip here.");
|
||||
|
||||
panel->parent = parent;
|
||||
panel->parent = parent;
|
||||
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
panel->callbacks.createWidgets = createPanel;
|
||||
panel->callbacks.updateDomain = storeData;
|
||||
|
||||
AddSection(panel, ICON_FILE);
|
||||
AddSection(panel, ICON_FILE);
|
||||
|
||||
return panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,187 +8,159 @@
|
||||
|
||||
#include "double.h"
|
||||
|
||||
|
||||
typedef struct W_DoubleTest {
|
||||
W_Class widgetClass;
|
||||
WMView *view;
|
||||
W_Class widgetClass;
|
||||
WMView *view;
|
||||
|
||||
WMHandlerID timer;
|
||||
char on;
|
||||
char active;
|
||||
char *text;
|
||||
WMHandlerID timer;
|
||||
char on;
|
||||
char active;
|
||||
char *text;
|
||||
} _DoubleTest;
|
||||
|
||||
|
||||
|
||||
|
||||
/* some forward declarations */
|
||||
|
||||
static void destroyDoubleTest(_DoubleTest *dPtr);
|
||||
static void paintDoubleTest(_DoubleTest *dPtr);
|
||||
|
||||
|
||||
static void handleEvents(XEvent *event, void *data);
|
||||
static void handleActionEvents(XEvent *event, void *data);
|
||||
|
||||
static void destroyDoubleTest(_DoubleTest * dPtr);
|
||||
static void paintDoubleTest(_DoubleTest * dPtr);
|
||||
|
||||
static void handleEvents(XEvent * event, void *data);
|
||||
static void handleActionEvents(XEvent * event, void *data);
|
||||
|
||||
/* our widget class ID */
|
||||
static W_Class DoubleTestClass = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Initializer for our widget. Must be called before creating any
|
||||
* instances of the widget.
|
||||
*/
|
||||
W_Class
|
||||
InitDoubleTest(WMScreen *scr)
|
||||
W_Class InitDoubleTest(WMScreen * scr)
|
||||
{
|
||||
/* register our widget with WINGs and get our widget class ID */
|
||||
if (!DoubleTestClass) {
|
||||
DoubleTestClass = W_RegisterUserWidget();
|
||||
}
|
||||
/* register our widget with WINGs and get our widget class ID */
|
||||
if (!DoubleTestClass) {
|
||||
DoubleTestClass = W_RegisterUserWidget();
|
||||
}
|
||||
|
||||
return DoubleTestClass;
|
||||
return DoubleTestClass;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Our widget fabrication plant.
|
||||
*/
|
||||
DoubleTest*
|
||||
CreateDoubleTest(WMWidget *parent, char *text)
|
||||
DoubleTest *CreateDoubleTest(WMWidget * parent, char *text)
|
||||
{
|
||||
DoubleTest *dPtr;
|
||||
DoubleTest *dPtr;
|
||||
|
||||
if (!DoubleTestClass)
|
||||
InitDoubleTest(WMWidgetScreen(parent));
|
||||
if (!DoubleTestClass)
|
||||
InitDoubleTest(WMWidgetScreen(parent));
|
||||
|
||||
/* allocate some storage for our new widget instance */
|
||||
dPtr = wmalloc(sizeof(DoubleTest));
|
||||
/* initialize it */
|
||||
memset(dPtr, 0, sizeof(DoubleTest));
|
||||
/* allocate some storage for our new widget instance */
|
||||
dPtr = wmalloc(sizeof(DoubleTest));
|
||||
/* initialize it */
|
||||
memset(dPtr, 0, sizeof(DoubleTest));
|
||||
|
||||
/* set the class ID */
|
||||
dPtr->widgetClass = DoubleTestClass;
|
||||
/* set the class ID */
|
||||
dPtr->widgetClass = DoubleTestClass;
|
||||
|
||||
dPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!dPtr->view) {
|
||||
wfree(dPtr);
|
||||
return NULL;
|
||||
}
|
||||
/* always do this */
|
||||
dPtr->view->self = dPtr;
|
||||
dPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!dPtr->view) {
|
||||
wfree(dPtr);
|
||||
return NULL;
|
||||
}
|
||||
/* always do this */
|
||||
dPtr->view->self = dPtr;
|
||||
|
||||
dPtr->text = wstrdup(text);
|
||||
dPtr->text = wstrdup(text);
|
||||
|
||||
WMCreateEventHandler(dPtr->view, ExposureMask /* this allows us to know when we should paint */
|
||||
|StructureNotifyMask, /* this allows us to know things like when we are destroyed */
|
||||
handleEvents, dPtr);
|
||||
WMCreateEventHandler(dPtr->view, ExposureMask /* this allows us to know when we should paint */
|
||||
| StructureNotifyMask, /* this allows us to know things like when we are destroyed */
|
||||
handleEvents, dPtr);
|
||||
|
||||
WMCreateEventHandler(dPtr->view, ButtonPressMask,handleActionEvents, dPtr);
|
||||
WMCreateEventHandler(dPtr->view, ButtonPressMask, handleActionEvents, dPtr);
|
||||
|
||||
return dPtr;
|
||||
return dPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
paintDoubleTest(_DoubleTest *dPtr)
|
||||
static void paintDoubleTest(_DoubleTest * dPtr)
|
||||
{
|
||||
W_Screen *scr = dPtr->view->screen;
|
||||
W_Screen *scr = dPtr->view->screen;
|
||||
|
||||
if (dPtr->active) {
|
||||
XFillRectangle(scr->display, dPtr->view->window, WMColorGC(scr->white),
|
||||
0, 0, dPtr->view->size.width, dPtr->view->size.height);
|
||||
} else {
|
||||
XClearWindow(scr->display, dPtr->view->window);
|
||||
}
|
||||
if (dPtr->active) {
|
||||
XFillRectangle(scr->display, dPtr->view->window, WMColorGC(scr->white),
|
||||
0, 0, dPtr->view->size.width, dPtr->view->size.height);
|
||||
} else {
|
||||
XClearWindow(scr->display, dPtr->view->window);
|
||||
}
|
||||
|
||||
W_DrawRelief(scr, dPtr->view->window, 0, 0, dPtr->view->size.width,
|
||||
dPtr->view->size.height, dPtr->on ? WRSunken : WRRaised);
|
||||
W_DrawRelief(scr, dPtr->view->window, 0, 0, dPtr->view->size.width,
|
||||
dPtr->view->size.height, dPtr->on ? WRSunken : WRRaised);
|
||||
|
||||
if (dPtr->text) {
|
||||
int y;
|
||||
y = (dPtr->view->size.height-scr->normalFont->height)/2;
|
||||
W_PaintText(dPtr->view, dPtr->view->window, scr->normalFont,
|
||||
dPtr->on, dPtr->on+y, dPtr->view->size.width, WACenter,
|
||||
scr->black, False, dPtr->text, strlen(dPtr->text));
|
||||
}
|
||||
if (dPtr->text) {
|
||||
int y;
|
||||
y = (dPtr->view->size.height - scr->normalFont->height) / 2;
|
||||
W_PaintText(dPtr->view, dPtr->view->window, scr->normalFont,
|
||||
dPtr->on, dPtr->on + y, dPtr->view->size.width, WACenter,
|
||||
scr->black, False, dPtr->text, strlen(dPtr->text));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
handleEvents(XEvent *event, void *data)
|
||||
static void handleEvents(XEvent * event, void *data)
|
||||
{
|
||||
_DoubleTest *dPtr = (_DoubleTest*)data;
|
||||
_DoubleTest *dPtr = (_DoubleTest *) data;
|
||||
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
if (event->xexpose.count != 0)
|
||||
break;
|
||||
paintDoubleTest(dPtr);
|
||||
break;
|
||||
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
if (event->xexpose.count!=0)
|
||||
break;
|
||||
paintDoubleTest(dPtr);
|
||||
break;
|
||||
case DestroyNotify:
|
||||
destroyDoubleTest(dPtr);
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
destroyDoubleTest(dPtr);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
deactivate(void *data)
|
||||
static void deactivate(void *data)
|
||||
{
|
||||
_DoubleTest *dPtr = (_DoubleTest*)data;
|
||||
_DoubleTest *dPtr = (_DoubleTest *) data;
|
||||
|
||||
if (dPtr->active)
|
||||
dPtr->active = 0;
|
||||
paintDoubleTest(dPtr);
|
||||
if (dPtr->active)
|
||||
dPtr->active = 0;
|
||||
paintDoubleTest(dPtr);
|
||||
|
||||
dPtr->timer = NULL;
|
||||
dPtr->timer = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleActionEvents(XEvent *event, void *data)
|
||||
static void handleActionEvents(XEvent * event, void *data)
|
||||
{
|
||||
_DoubleTest *dPtr = (_DoubleTest*)data;
|
||||
extern _WINGsConfiguration WINGsConfiguration;
|
||||
_DoubleTest *dPtr = (_DoubleTest *) data;
|
||||
extern _WINGsConfiguration WINGsConfiguration;
|
||||
|
||||
switch (event->type) {
|
||||
case ButtonPress:
|
||||
if (WMIsDoubleClick(event)) {
|
||||
if (dPtr->timer)
|
||||
WMDeleteTimerHandler(dPtr->timer);
|
||||
dPtr->timer = NULL;
|
||||
dPtr->on = !dPtr->on;
|
||||
dPtr->active = 0;
|
||||
paintDoubleTest(dPtr);
|
||||
} else {
|
||||
dPtr->timer=WMAddTimerHandler(WINGsConfiguration.doubleClickDelay,
|
||||
deactivate, dPtr);
|
||||
dPtr->active = 1;
|
||||
paintDoubleTest(dPtr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (event->type) {
|
||||
case ButtonPress:
|
||||
if (WMIsDoubleClick(event)) {
|
||||
if (dPtr->timer)
|
||||
WMDeleteTimerHandler(dPtr->timer);
|
||||
dPtr->timer = NULL;
|
||||
dPtr->on = !dPtr->on;
|
||||
dPtr->active = 0;
|
||||
paintDoubleTest(dPtr);
|
||||
} else {
|
||||
dPtr->timer = WMAddTimerHandler(WINGsConfiguration.doubleClickDelay, deactivate, dPtr);
|
||||
dPtr->active = 1;
|
||||
paintDoubleTest(dPtr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
destroyDoubleTest(_DoubleTest *dPtr)
|
||||
static void destroyDoubleTest(_DoubleTest * dPtr)
|
||||
{
|
||||
if (dPtr->timer)
|
||||
WMDeleteTimerHandler(dPtr->timer);
|
||||
if (dPtr->text)
|
||||
wfree(dPtr->text);
|
||||
if (dPtr->timer)
|
||||
WMDeleteTimerHandler(dPtr->timer);
|
||||
if (dPtr->text)
|
||||
wfree(dPtr->text);
|
||||
|
||||
wfree(dPtr);
|
||||
wfree(dPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@
|
||||
#define FOR_WPREFS
|
||||
|
||||
#ifdef FOR_WPREFS
|
||||
# include "WPrefs.h" /* only for _() */
|
||||
# include "WPrefs.h" /* only for _() */
|
||||
#else
|
||||
# define _(a) a
|
||||
#endif
|
||||
@@ -36,145 +36,108 @@
|
||||
|
||||
#include "imagebrowser.h"
|
||||
|
||||
|
||||
|
||||
struct _ImageBrowser {
|
||||
WMWindow *win;
|
||||
WMWindow *win;
|
||||
|
||||
WMPopUpButton *pathP;
|
||||
WMPopUpButton *pathP;
|
||||
|
||||
WMScrollView *sview;
|
||||
WMFrame *frame;
|
||||
WMScrollView *sview;
|
||||
WMFrame *frame;
|
||||
|
||||
WMWidget *auxWidget;
|
||||
|
||||
WMWidget *auxWidget;
|
||||
WMButton *viewBtn;
|
||||
WMButton *okBtn;
|
||||
WMButton *cancelBtn;
|
||||
|
||||
WMSize maxPreviewSize;
|
||||
|
||||
WMButton *viewBtn;
|
||||
WMButton *okBtn;
|
||||
WMButton *cancelBtn;
|
||||
ImageBrowserDelegate *delegate;
|
||||
|
||||
WMSize maxPreviewSize;
|
||||
|
||||
ImageBrowserDelegate *delegate;
|
||||
|
||||
WMArray *previews;
|
||||
WMArray *previews;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 300
|
||||
#define DEFAULT_HEIGHT 200
|
||||
|
||||
|
||||
ImageBrowser*
|
||||
CreateImageBrowser(WMScreen *scr, char *title, char **paths, int pathN,
|
||||
WMSize *maxSize, WMWidget *auxWidget)
|
||||
ImageBrowser *CreateImageBrowser(WMScreen * scr, char *title, char **paths, int pathN,
|
||||
WMSize * maxSize, WMWidget * auxWidget)
|
||||
{
|
||||
ImageBrowser *br;
|
||||
int i;
|
||||
int h;
|
||||
ImageBrowser *br;
|
||||
int i;
|
||||
int h;
|
||||
|
||||
br = wmalloc(sizeof(ImageBrowser));
|
||||
br = wmalloc(sizeof(ImageBrowser));
|
||||
|
||||
br->win = WMCreateWindow(scr, "imageBrowser");
|
||||
WMResizeWidget(br->win, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
br->win = WMCreateWindow(scr, "imageBrowser");
|
||||
WMResizeWidget(br->win, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
|
||||
br->pathP = WMCreatePopUpButton(br->win);
|
||||
WMMoveWidget(br->pathP, (DEFAULT_WIDTH - 80)/2, 10);
|
||||
WMResizeWidget(br->pathP, DEFAULT_WIDTH - 80, 20);
|
||||
br->pathP = WMCreatePopUpButton(br->win);
|
||||
WMMoveWidget(br->pathP, (DEFAULT_WIDTH - 80) / 2, 10);
|
||||
WMResizeWidget(br->pathP, DEFAULT_WIDTH - 80, 20);
|
||||
|
||||
for (i = 0; i < pathN; i++) {
|
||||
WMAddPopUpButtonItem(br->pathP, paths[i]);
|
||||
}
|
||||
for (i = 0; i < pathN; i++) {
|
||||
WMAddPopUpButtonItem(br->pathP, paths[i]);
|
||||
}
|
||||
|
||||
br->viewBtn = WMCreateCommandButton(br->win);
|
||||
WMSetButtonText(br->viewBtn, _("View"));
|
||||
WMResizeWidget(br->viewBtn, 80, 24);
|
||||
WMMoveWidget(br->viewBtn, 10, DEFAULT_HEIGHT - 29);
|
||||
|
||||
br->viewBtn = WMCreateCommandButton(br->win);
|
||||
WMSetButtonText(br->viewBtn, _("View"));
|
||||
WMResizeWidget(br->viewBtn, 80, 24);
|
||||
WMMoveWidget(br->viewBtn, 10, DEFAULT_HEIGHT - 29);
|
||||
br->cancelBtn = WMCreateCommandButton(br->win);
|
||||
WMSetButtonText(br->cancelBtn, _("Cancel"));
|
||||
WMResizeWidget(br->cancelBtn, 80, 24);
|
||||
WMMoveWidget(br->cancelBtn, DEFAULT_WIDTH - 10 - 80, DEFAULT_HEIGHT - 29);
|
||||
|
||||
br->cancelBtn = WMCreateCommandButton(br->win);
|
||||
WMSetButtonText(br->cancelBtn, _("Cancel"));
|
||||
WMResizeWidget(br->cancelBtn, 80, 24);
|
||||
WMMoveWidget(br->cancelBtn, DEFAULT_WIDTH - 10 - 80, DEFAULT_HEIGHT - 29);
|
||||
br->okBtn = WMCreateCommandButton(br->win);
|
||||
WMSetButtonText(br->okBtn, _("OK"));
|
||||
WMResizeWidget(br->okBtn, 80, 24);
|
||||
WMMoveWidget(br->okBtn, DEFAULT_WIDTH - 10 - 160 - 5, DEFAULT_HEIGHT - 29);
|
||||
|
||||
br->okBtn = WMCreateCommandButton(br->win);
|
||||
WMSetButtonText(br->okBtn, _("OK"));
|
||||
WMResizeWidget(br->okBtn, 80, 24);
|
||||
WMMoveWidget(br->okBtn, DEFAULT_WIDTH - 10 - 160 - 5, DEFAULT_HEIGHT - 29);
|
||||
br->auxWidget = auxWidget;
|
||||
|
||||
h = DEFAULT_HEIGHT - 20 /* top and bottom spacing */
|
||||
- 25 /* popup menu and spacing */
|
||||
- 29; /* button row and spacing */
|
||||
|
||||
if (auxWidget != NULL) {
|
||||
h -= WMWidgetHeight(auxWidget) + 5;
|
||||
|
||||
br->auxWidget = auxWidget;
|
||||
W_ReparentView(WMWidgetView(auxWidget), WMWidgetView(br->win), 10, 10 + 25 + h + 5);
|
||||
}
|
||||
|
||||
br->sview = WMCreateScrollView(br->win);
|
||||
WMResizeWidget(br->sview, DEFAULT_WIDTH - 20, h);
|
||||
WMMoveWidget(br->sview, 10, 5 + 20 + 5);
|
||||
|
||||
h = DEFAULT_HEIGHT
|
||||
- 20 /* top and bottom spacing */
|
||||
- 25 /* popup menu and spacing */
|
||||
- 29; /* button row and spacing */
|
||||
WMMapSubwidgets(br->win);
|
||||
|
||||
if (auxWidget != NULL) {
|
||||
h -= WMWidgetHeight(auxWidget) + 5;
|
||||
|
||||
W_ReparentView(WMWidgetView(auxWidget),
|
||||
WMWidgetView(br->win),
|
||||
10, 10 + 25 + h + 5);
|
||||
}
|
||||
|
||||
br->sview = WMCreateScrollView(br->win);
|
||||
WMResizeWidget(br->sview, DEFAULT_WIDTH-20, h);
|
||||
WMMoveWidget(br->sview, 10, 5 + 20 + 5);
|
||||
|
||||
|
||||
|
||||
WMMapSubwidgets(br->win);
|
||||
|
||||
return br;
|
||||
return br;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShowImageBrowser(ImageBrowser *browser)
|
||||
void ShowImageBrowser(ImageBrowser * browser)
|
||||
{
|
||||
WMMapWidget(browser->win);
|
||||
WMMapWidget(browser->win);
|
||||
}
|
||||
|
||||
void
|
||||
CloseImageBrowser(ImageBrowser *browser)
|
||||
void CloseImageBrowser(ImageBrowser * browser)
|
||||
{
|
||||
WMUnmapWidget(browser->win);
|
||||
WMUnmapWidget(browser->win);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetImageBrowserPathList(ImageBrowser *browser, char **paths, int pathN)
|
||||
void SetImageBrowserPathList(ImageBrowser * browser, char **paths, int pathN)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SetImageBrowserDelegate(ImageBrowser *browser,
|
||||
ImageBrowserDelegate *delegate)
|
||||
void SetImageBrowserDelegate(ImageBrowser * browser, ImageBrowserDelegate * delegate)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
DestroyImageBrowser(ImageBrowser *browser)
|
||||
void DestroyImageBrowser(ImageBrowser * browser)
|
||||
{
|
||||
WMDestroyWidget(browser->win);
|
||||
WMDestroyWidget(browser->win);
|
||||
|
||||
/**/
|
||||
|
||||
wfree(browser);
|
||||
/**/ wfree(browser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "WPrefs.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <X11/Xlocale.h>
|
||||
@@ -29,175 +28,163 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
char *NOptionValueChanged = "NOptionValueChanged";
|
||||
|
||||
extern void Initialize(WMScreen *scr);
|
||||
extern void Initialize(WMScreen * scr);
|
||||
|
||||
#define MAX_DEATHS 64
|
||||
|
||||
struct {
|
||||
pid_t pid;
|
||||
void *data;
|
||||
void (*handler)(void*);
|
||||
pid_t pid;
|
||||
void *data;
|
||||
void (*handler) (void *);
|
||||
} DeadHandlers[MAX_DEATHS];
|
||||
|
||||
|
||||
static pid_t DeadChildren[MAX_DEATHS];
|
||||
static int DeadChildrenCount = 0;
|
||||
|
||||
void
|
||||
wAbort(Bool foo)
|
||||
void wAbort(Bool foo)
|
||||
{
|
||||
exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_help(char *progname)
|
||||
static void print_help(char *progname)
|
||||
{
|
||||
printf(_("usage: %s [options]\n"), progname);
|
||||
puts(_("options:"));
|
||||
puts(_(" -display <display> display to be used"));
|
||||
puts(_(" --version print version number and exit"));
|
||||
puts(_(" --help print this message and exit"));
|
||||
printf(_("usage: %s [options]\n"), progname);
|
||||
puts(_("options:"));
|
||||
puts(_(" -display <display> display to be used"));
|
||||
puts(_(" --version print version number and exit"));
|
||||
puts(_(" --help print this message and exit"));
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static RETSIGTYPE
|
||||
handleDeadChild(int sig)
|
||||
static RETSIGTYPE handleDeadChild(int sig)
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
pid = waitpid(-1, &status, WNOHANG);
|
||||
if (pid > 0) {
|
||||
DeadChildren[DeadChildrenCount++] = pid;
|
||||
}
|
||||
pid = waitpid(-1, &status, WNOHANG);
|
||||
if (pid > 0) {
|
||||
DeadChildren[DeadChildrenCount++] = pid;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
AddDeadChildHandler(pid_t pid, void (*handler)(void*), void *data)
|
||||
void AddDeadChildHandler(pid_t pid, void (*handler) (void *), void *data)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_DEATHS; i++) {
|
||||
if (DeadHandlers[i].pid == 0) {
|
||||
DeadHandlers[i].pid = pid;
|
||||
DeadHandlers[i].handler = handler;
|
||||
DeadHandlers[i].data = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(i!=MAX_DEATHS);
|
||||
for (i = 0; i < MAX_DEATHS; i++) {
|
||||
if (DeadHandlers[i].pid == 0) {
|
||||
DeadHandlers[i].pid = pid;
|
||||
DeadHandlers[i].handler = handler;
|
||||
DeadHandlers[i].data = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(i != MAX_DEATHS);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy;
|
||||
WMScreen *scr;
|
||||
char *locale, *path;
|
||||
int i;
|
||||
char *display_name="";
|
||||
Display *dpy;
|
||||
WMScreen *scr;
|
||||
char *locale, *path;
|
||||
int i;
|
||||
char *display_name = "";
|
||||
|
||||
wsetabort(wAbort);
|
||||
wsetabort(wAbort);
|
||||
|
||||
memset(DeadHandlers, 0, sizeof(DeadHandlers));
|
||||
memset(DeadHandlers, 0, sizeof(DeadHandlers));
|
||||
|
||||
WMInitializeApplication("WPrefs", &argc, argv);
|
||||
WMInitializeApplication("WPrefs", &argc, argv);
|
||||
|
||||
WMSetResourcePath(RESOURCE_PATH);
|
||||
path = WMPathForResourceOfType("WPrefs.tiff", NULL);
|
||||
if (!path) {
|
||||
/* maybe it is run directly from the source directory */
|
||||
WMSetResourcePath(".");
|
||||
path = WMPathForResourceOfType("WPrefs.tiff", NULL);
|
||||
if (!path) {
|
||||
WMSetResourcePath("..");
|
||||
}
|
||||
}
|
||||
if (path) {
|
||||
wfree(path);
|
||||
}
|
||||
WMSetResourcePath(RESOURCE_PATH);
|
||||
path = WMPathForResourceOfType("WPrefs.tiff", NULL);
|
||||
if (!path) {
|
||||
/* maybe it is run directly from the source directory */
|
||||
WMSetResourcePath(".");
|
||||
path = WMPathForResourceOfType("WPrefs.tiff", NULL);
|
||||
if (!path) {
|
||||
WMSetResourcePath("..");
|
||||
}
|
||||
}
|
||||
if (path) {
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
if (argc>1) {
|
||||
for (i=1; i<argc; i++) {
|
||||
if (strcmp(argv[i], "-version")==0
|
||||
|| strcmp(argv[i], "--version")==0) {
|
||||
printf("WPrefs (Window Maker) %s\n", VERSION);
|
||||
exit(0);
|
||||
} else if (strcmp(argv[i], "-display")==0) {
|
||||
i++;
|
||||
if (i>=argc) {
|
||||
wwarning(_("too few arguments for %s"), argv[i-1]);
|
||||
exit(0);
|
||||
}
|
||||
display_name = argv[i];
|
||||
} else {
|
||||
print_help(argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc > 1) {
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
|
||||
printf("WPrefs (Window Maker) %s\n", VERSION);
|
||||
exit(0);
|
||||
} else if (strcmp(argv[i], "-display") == 0) {
|
||||
i++;
|
||||
if (i >= argc) {
|
||||
wwarning(_("too few arguments for %s"), argv[i - 1]);
|
||||
exit(0);
|
||||
}
|
||||
display_name = argv[i];
|
||||
} else {
|
||||
print_help(argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locale = getenv("LANG");
|
||||
setlocale(LC_ALL, "");
|
||||
locale = getenv("LANG");
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
#ifdef I18N
|
||||
if (getenv("NLSPATH"))
|
||||
bindtextdomain("WPrefs", getenv("NLSPATH"));
|
||||
else
|
||||
bindtextdomain("WPrefs", LOCALEDIR);
|
||||
bind_textdomain_codeset("WPrefs", "UTF-8");
|
||||
textdomain("WPrefs");
|
||||
if (getenv("NLSPATH"))
|
||||
bindtextdomain("WPrefs", getenv("NLSPATH"));
|
||||
else
|
||||
bindtextdomain("WPrefs", LOCALEDIR);
|
||||
bind_textdomain_codeset("WPrefs", "UTF-8");
|
||||
textdomain("WPrefs");
|
||||
|
||||
if (!XSupportsLocale()) {
|
||||
wwarning(_("X server does not support locale"));
|
||||
}
|
||||
if (XSetLocaleModifiers("") == NULL) {
|
||||
wwarning(_("cannot set locale modifiers"));
|
||||
}
|
||||
if (!XSupportsLocale()) {
|
||||
wwarning(_("X server does not support locale"));
|
||||
}
|
||||
if (XSetLocaleModifiers("") == NULL) {
|
||||
wwarning(_("cannot set locale modifiers"));
|
||||
}
|
||||
#endif
|
||||
|
||||
dpy = XOpenDisplay(display_name);
|
||||
if (!dpy) {
|
||||
wfatal(_("could not open display %s"), XDisplayName(display_name));
|
||||
exit(0);
|
||||
}
|
||||
dpy = XOpenDisplay(display_name);
|
||||
if (!dpy) {
|
||||
wfatal(_("could not open display %s"), XDisplayName(display_name));
|
||||
exit(0);
|
||||
}
|
||||
#if 0
|
||||
XSynchronize(dpy, 1);
|
||||
XSynchronize(dpy, 1);
|
||||
#endif
|
||||
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
|
||||
if (!scr) {
|
||||
wfatal(_("could not initialize application"));
|
||||
exit(0);
|
||||
}
|
||||
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
|
||||
if (!scr) {
|
||||
wfatal(_("could not initialize application"));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
WMPLSetCaseSensitive(False);
|
||||
WMPLSetCaseSensitive(False);
|
||||
|
||||
Initialize(scr);
|
||||
Initialize(scr);
|
||||
|
||||
while (1) {
|
||||
XEvent event;
|
||||
while (1) {
|
||||
XEvent event;
|
||||
|
||||
WMNextEvent(dpy, &event);
|
||||
WMNextEvent(dpy, &event);
|
||||
|
||||
while (DeadChildrenCount-- > 0) {
|
||||
int i;
|
||||
while (DeadChildrenCount-- > 0) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_DEATHS; i++) {
|
||||
if (DeadChildren[i] == DeadHandlers[i].pid) {
|
||||
(*DeadHandlers[i].handler)(DeadHandlers[i].data);
|
||||
DeadHandlers[i].pid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MAX_DEATHS; i++) {
|
||||
if (DeadChildren[i] == DeadHandlers[i].pid) {
|
||||
(*DeadHandlers[i].handler) (DeadHandlers[i].data);
|
||||
DeadHandlers[i].pid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WMHandleEvent(&event);
|
||||
}
|
||||
WMHandleEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* keymap handling */
|
||||
/************************************************************************/
|
||||
@@ -85,36 +83,42 @@ Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
|
||||
|
||||
static int MetaIndex, HyperIndex, SuperIndex, AltIndex, ModeIndex;
|
||||
|
||||
static const char *
|
||||
index_to_name (int indice)
|
||||
static const char *index_to_name(int indice)
|
||||
{
|
||||
switch (indice)
|
||||
{
|
||||
case ShiftMapIndex: return "ModShift";
|
||||
case LockMapIndex: return "ModLock";
|
||||
case ControlMapIndex: return "ModControl";
|
||||
case Mod1MapIndex: return "Mod1";
|
||||
case Mod2MapIndex: return "Mod2";
|
||||
case Mod3MapIndex: return "Mod3";
|
||||
case Mod4MapIndex: return "Mod4";
|
||||
case Mod5MapIndex: return "Mod5";
|
||||
default: return "???";
|
||||
}
|
||||
switch (indice) {
|
||||
case ShiftMapIndex:
|
||||
return "ModShift";
|
||||
case LockMapIndex:
|
||||
return "ModLock";
|
||||
case ControlMapIndex:
|
||||
return "ModControl";
|
||||
case Mod1MapIndex:
|
||||
return "Mod1";
|
||||
case Mod2MapIndex:
|
||||
return "Mod2";
|
||||
case Mod3MapIndex:
|
||||
return "Mod3";
|
||||
case Mod4MapIndex:
|
||||
return "Mod4";
|
||||
case Mod5MapIndex:
|
||||
return "Mod5";
|
||||
default:
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
x_reset_modifier_mapping (Display *display)
|
||||
static void x_reset_modifier_mapping(Display * display)
|
||||
{
|
||||
int modifier_index, modifier_key, column, mkpm;
|
||||
int warned_about_overlapping_modifiers = 0;
|
||||
int warned_about_predefined_modifiers = 0;
|
||||
int warned_about_duplicate_modifiers = 0;
|
||||
int meta_bit = 0;
|
||||
int hyper_bit = 0;
|
||||
int super_bit = 0;
|
||||
int alt_bit = 0;
|
||||
int mode_bit = 0;
|
||||
XModifierKeymap *x_modifier_keymap = XGetModifierMapping (display);
|
||||
int modifier_index, modifier_key, column, mkpm;
|
||||
int warned_about_overlapping_modifiers = 0;
|
||||
int warned_about_predefined_modifiers = 0;
|
||||
int warned_about_duplicate_modifiers = 0;
|
||||
int meta_bit = 0;
|
||||
int hyper_bit = 0;
|
||||
int super_bit = 0;
|
||||
int alt_bit = 0;
|
||||
int mode_bit = 0;
|
||||
XModifierKeymap *x_modifier_keymap = XGetModifierMapping(display);
|
||||
|
||||
#define modwarn(name,old,other) \
|
||||
wwarning ("%s (0x%x) generates %s, which is generated by %s.\n\n", \
|
||||
@@ -154,118 +158,146 @@ x_reset_modifier_mapping (Display *display)
|
||||
else \
|
||||
old = modifier_index;
|
||||
|
||||
mkpm = x_modifier_keymap->max_keypermod;
|
||||
for (modifier_index = 0; modifier_index < 8; modifier_index++)
|
||||
for (modifier_key = 0; modifier_key < mkpm; modifier_key++) {
|
||||
KeySym last_sym = 0;
|
||||
for (column = 0; column < 4; column += 2) {
|
||||
KeyCode code = x_modifier_keymap->modifiermap[modifier_index * mkpm
|
||||
+ modifier_key];
|
||||
KeySym sym = (code ? XKeycodeToKeysym (display, code, column) : 0);
|
||||
if (sym == last_sym) continue;
|
||||
last_sym = sym;
|
||||
switch (sym) {
|
||||
case XK_Mode_switch:store_modifier ("Mode_switch", mode_bit); break;
|
||||
case XK_Meta_L: store_modifier ("Meta_L", meta_bit); break;
|
||||
case XK_Meta_R: store_modifier ("Meta_R", meta_bit); break;
|
||||
case XK_Super_L: store_modifier ("Super_L", super_bit); break;
|
||||
case XK_Super_R: store_modifier ("Super_R", super_bit); break;
|
||||
case XK_Hyper_L: store_modifier ("Hyper_L", hyper_bit); break;
|
||||
case XK_Hyper_R: store_modifier ("Hyper_R", hyper_bit); break;
|
||||
case XK_Alt_L: store_modifier ("Alt_L", alt_bit); break;
|
||||
case XK_Alt_R: store_modifier ("Alt_R", alt_bit); break;
|
||||
case XK_Control_L: check_modifier ("Control_L", ControlMask); break;
|
||||
case XK_Control_R: check_modifier ("Control_R", ControlMask); break;
|
||||
case XK_Shift_L: check_modifier ("Shift_L", ShiftMask); break;
|
||||
case XK_Shift_R: check_modifier ("Shift_R", ShiftMask); break;
|
||||
case XK_Shift_Lock: check_modifier ("Shift_Lock", LockMask); break;
|
||||
case XK_Caps_Lock: check_modifier ("Caps_Lock", LockMask); break;
|
||||
mkpm = x_modifier_keymap->max_keypermod;
|
||||
for (modifier_index = 0; modifier_index < 8; modifier_index++)
|
||||
for (modifier_key = 0; modifier_key < mkpm; modifier_key++) {
|
||||
KeySym last_sym = 0;
|
||||
for (column = 0; column < 4; column += 2) {
|
||||
KeyCode code = x_modifier_keymap->modifiermap[modifier_index * mkpm
|
||||
+ modifier_key];
|
||||
KeySym sym = (code ? XKeycodeToKeysym(display, code, column) : 0);
|
||||
if (sym == last_sym)
|
||||
continue;
|
||||
last_sym = sym;
|
||||
switch (sym) {
|
||||
case XK_Mode_switch:
|
||||
store_modifier("Mode_switch", mode_bit);
|
||||
break;
|
||||
case XK_Meta_L:
|
||||
store_modifier("Meta_L", meta_bit);
|
||||
break;
|
||||
case XK_Meta_R:
|
||||
store_modifier("Meta_R", meta_bit);
|
||||
break;
|
||||
case XK_Super_L:
|
||||
store_modifier("Super_L", super_bit);
|
||||
break;
|
||||
case XK_Super_R:
|
||||
store_modifier("Super_R", super_bit);
|
||||
break;
|
||||
case XK_Hyper_L:
|
||||
store_modifier("Hyper_L", hyper_bit);
|
||||
break;
|
||||
case XK_Hyper_R:
|
||||
store_modifier("Hyper_R", hyper_bit);
|
||||
break;
|
||||
case XK_Alt_L:
|
||||
store_modifier("Alt_L", alt_bit);
|
||||
break;
|
||||
case XK_Alt_R:
|
||||
store_modifier("Alt_R", alt_bit);
|
||||
break;
|
||||
case XK_Control_L:
|
||||
check_modifier("Control_L", ControlMask);
|
||||
break;
|
||||
case XK_Control_R:
|
||||
check_modifier("Control_R", ControlMask);
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
check_modifier("Shift_L", ShiftMask);
|
||||
break;
|
||||
case XK_Shift_R:
|
||||
check_modifier("Shift_R", ShiftMask);
|
||||
break;
|
||||
case XK_Shift_Lock:
|
||||
check_modifier("Shift_Lock", LockMask);
|
||||
break;
|
||||
case XK_Caps_Lock:
|
||||
check_modifier("Caps_Lock", LockMask);
|
||||
break;
|
||||
|
||||
/* It probably doesn't make any sense for a modifier bit to be
|
||||
assigned to a key that is not one of the above, but OpenWindows
|
||||
assigns modifier bits to a couple of random function keys for
|
||||
no reason that I can discern, so printing a warning here would
|
||||
be annoying. */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* It probably doesn't make any sense for a modifier bit to be
|
||||
assigned to a key that is not one of the above, but OpenWindows
|
||||
assigns modifier bits to a couple of random function keys for
|
||||
no reason that I can discern, so printing a warning here would
|
||||
be annoying. */
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef store_modifier
|
||||
#undef check_modifier
|
||||
#undef modwarn
|
||||
#undef modbarf
|
||||
|
||||
/* If there was no Meta key, then try using the Alt key instead.
|
||||
If there is both a Meta key and an Alt key, then the Alt key
|
||||
is not disturbed and remains an Alt key. */
|
||||
if (! meta_bit && alt_bit)
|
||||
meta_bit = alt_bit, alt_bit = 0;
|
||||
/* If there was no Meta key, then try using the Alt key instead.
|
||||
If there is both a Meta key and an Alt key, then the Alt key
|
||||
is not disturbed and remains an Alt key. */
|
||||
if (!meta_bit && alt_bit)
|
||||
meta_bit = alt_bit, alt_bit = 0;
|
||||
|
||||
/* mode_bit overrides everything, since it's processed down inside of
|
||||
XLookupString() instead of by us. If Meta and Mode_switch both
|
||||
generate the same modifier bit (which is an error), then we don't
|
||||
interpret that bit as Meta, because we can't make XLookupString()
|
||||
not interpret it as Mode_switch; and interpreting it as both would
|
||||
be totally wrong. */
|
||||
if (mode_bit)
|
||||
{
|
||||
const char *warn = 0;
|
||||
if (mode_bit == meta_bit) warn = "Meta", meta_bit = 0;
|
||||
else if (mode_bit == hyper_bit) warn = "Hyper", hyper_bit = 0;
|
||||
else if (mode_bit == super_bit) warn = "Super", super_bit = 0;
|
||||
else if (mode_bit == alt_bit) warn = "Alt", alt_bit = 0;
|
||||
if (warn)
|
||||
{
|
||||
wwarning
|
||||
("%s is being used for both Mode_switch and %s.\n\n",
|
||||
index_to_name (mode_bit), warn),
|
||||
warned_about_overlapping_modifiers = 1;
|
||||
}
|
||||
}
|
||||
/* mode_bit overrides everything, since it's processed down inside of
|
||||
XLookupString() instead of by us. If Meta and Mode_switch both
|
||||
generate the same modifier bit (which is an error), then we don't
|
||||
interpret that bit as Meta, because we can't make XLookupString()
|
||||
not interpret it as Mode_switch; and interpreting it as both would
|
||||
be totally wrong. */
|
||||
if (mode_bit) {
|
||||
const char *warn = 0;
|
||||
if (mode_bit == meta_bit)
|
||||
warn = "Meta", meta_bit = 0;
|
||||
else if (mode_bit == hyper_bit)
|
||||
warn = "Hyper", hyper_bit = 0;
|
||||
else if (mode_bit == super_bit)
|
||||
warn = "Super", super_bit = 0;
|
||||
else if (mode_bit == alt_bit)
|
||||
warn = "Alt", alt_bit = 0;
|
||||
if (warn) {
|
||||
wwarning
|
||||
("%s is being used for both Mode_switch and %s.\n\n",
|
||||
index_to_name(mode_bit), warn), warned_about_overlapping_modifiers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
MetaIndex = meta_bit;
|
||||
HyperIndex = hyper_bit;
|
||||
SuperIndex = super_bit;
|
||||
AltIndex = alt_bit;
|
||||
ModeIndex = mode_bit;
|
||||
MetaIndex = meta_bit;
|
||||
HyperIndex = hyper_bit;
|
||||
SuperIndex = super_bit;
|
||||
AltIndex = alt_bit;
|
||||
ModeIndex = mode_bit;
|
||||
|
||||
if (x_modifier_keymap != NULL)
|
||||
XFreeModifiermap(x_modifier_keymap);
|
||||
if (x_modifier_keymap != NULL)
|
||||
XFreeModifiermap(x_modifier_keymap);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ModifierFromKey(Display *dpy, char *key)
|
||||
int ModifierFromKey(Display * dpy, char *key)
|
||||
{
|
||||
static int eqw = 0;
|
||||
static int eqw = 0;
|
||||
|
||||
if (!eqw)
|
||||
x_reset_modifier_mapping(dpy);
|
||||
eqw = 1;
|
||||
if (!eqw)
|
||||
x_reset_modifier_mapping(dpy);
|
||||
eqw = 1;
|
||||
|
||||
if (strcasecmp(key, "SHIFT")==0)
|
||||
return ShiftMapIndex;
|
||||
else if (strcasecmp(key, "CONTROL")==0)
|
||||
return ControlMapIndex;
|
||||
else if (strcasecmp(key, "ALT")==0)
|
||||
return AltIndex;
|
||||
else if (strcasecmp(key, "META")==0)
|
||||
return MetaIndex;
|
||||
else if (strcasecmp(key, "SUPER")==0)
|
||||
return SuperIndex;
|
||||
else if (strcasecmp(key, "HYPER")==0)
|
||||
return HyperIndex;
|
||||
else if (strcasecmp(key, "MOD1")==0)
|
||||
return Mod1MapIndex;
|
||||
else if (strcasecmp(key, "MOD2")==0)
|
||||
return Mod2MapIndex;
|
||||
else if (strcasecmp(key, "MOD3")==0)
|
||||
return Mod3MapIndex;
|
||||
else if (strcasecmp(key, "MOD4")==0)
|
||||
return Mod4MapIndex;
|
||||
else if (strcasecmp(key, "MOD5")==0)
|
||||
return Mod5MapIndex;
|
||||
else
|
||||
return -1;
|
||||
if (strcasecmp(key, "SHIFT") == 0)
|
||||
return ShiftMapIndex;
|
||||
else if (strcasecmp(key, "CONTROL") == 0)
|
||||
return ControlMapIndex;
|
||||
else if (strcasecmp(key, "ALT") == 0)
|
||||
return AltIndex;
|
||||
else if (strcasecmp(key, "META") == 0)
|
||||
return MetaIndex;
|
||||
else if (strcasecmp(key, "SUPER") == 0)
|
||||
return SuperIndex;
|
||||
else if (strcasecmp(key, "HYPER") == 0)
|
||||
return HyperIndex;
|
||||
else if (strcasecmp(key, "MOD1") == 0)
|
||||
return Mod1MapIndex;
|
||||
else if (strcasecmp(key, "MOD2") == 0)
|
||||
return Mod2MapIndex;
|
||||
else if (strcasecmp(key, "MOD3") == 0)
|
||||
return Mod3MapIndex;
|
||||
else if (strcasecmp(key, "MOD4") == 0)
|
||||
return Mod4MapIndex;
|
||||
else if (strcasecmp(key, "MOD5") == 0)
|
||||
return Mod5MapIndex;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user