diff --git a/AUTHORS b/AUTHORS index 7de087dc..2d76365a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -212,7 +212,7 @@ dgradient fix Window list menu miniaturized/hidden hints, XDE support, XKB lock language status, WINGs enhancements, bug fixes, window commands menu enhancement, window move/resize by keyboard. GNUstepGlow.tiff icon, -WINGs color panel +WINGs color panel, Appearance section icon(s) Trae Mc Combs diff --git a/ChangeLog b/ChangeLog index 3f774888..2c04f150 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Changes since version 0.51.2: +............................. + +- made the Attributes panel be available for all windows, even +for completely broken apps (although settings wont be saved for +completely broken apps) + + Changes since version 0.51.1: ............................. @@ -10,11 +18,13 @@ Changes since version 0.51.1: - fixed WPrefs crash in Mouse Preferences - fixed crash bug in WINGs/wmaker startup - added workaround for kde pager crash bug +- made %W in root menu and wmsetbg -w take numbers starting from 1 +- fixed crash bugs with kpanel Changes since version 0.51.0: ............................. -- icon explosion is stopped when clicking on anywhere +- put . to mark hidden apps - fixed dont set xset stuff option in WPrefs - fixed menu title messup in WPrefs - fixed WPrefs message dialogs for invalid menus diff --git a/INSTALL b/INSTALL index d171af6f..34045ec0 100644 --- a/INSTALL +++ b/INSTALL @@ -138,12 +138,12 @@ To get a list of other options, run ./configure --help --with-libs-from specify additional paths for libraries to be searched. The -L flag must precede each path, like: - --with-libs-from=-L/opt/libs -L/usr/local/lib + --with-libs-from="-L/opt/libs -L/usr/local/lib" --with-incs-from specify additional paths for header files to be searched. The -I flag must precede each paths, like: - --with-incs-from=-I/opt/headers -I/usr/local/include + --with-incs-from="-I/opt/headers -I/usr/local/include" --enable-kanji support to display Kanji characters, Korean, Chinese and other diff --git a/NEWS b/NEWS index f40eaad0..910147ef 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,13 @@ NEWS for veteran Window Maker users --- 0.51.2 +New Themes +---------- + +Added 2 new cool themes (actually I added in 0.51.1, but forgot +to put it here...) from largo (LeetWM) and BadlandZ (STEP2000). + + Full Screen Maximization ------------------------ diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index f9b04bd9..15e9b344 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -1,5 +1,11 @@ +changes since wmaker 0.51.2: +............................ + +- added WMColorWellDidChangeNotification +- added wfindfileinarray() + changes since wmaker 0.51.1: -........................... +............................ - wusergnusteppath() will return a statically allocated string now. DO NOT FREE IT ANYMORE!! diff --git a/WINGs/WINGs.h b/WINGs/WINGs.h index 61140c6a..eefc5f76 100644 --- a/WINGs/WINGs.h +++ b/WINGs/WINGs.h @@ -971,6 +971,10 @@ WMColor *WMGetColorWellColor(WMColorWell *cPtr); void WSetColorWellBordered(WMColorWell *cPtr, Bool flag); + +extern char *WMColorWellDidChangeNotification; + + /* ...................................................................... */ WMScrollView *WMCreateScrollView(WMWidget *parent); diff --git a/WINGs/WUtil.h b/WINGs/WUtil.h index a2abc77a..d9309346 100644 --- a/WINGs/WUtil.h +++ b/WINGs/WUtil.h @@ -136,6 +136,8 @@ char *wfindfile(char *paths, char *file); char *wfindfileinlist(char **path_list, char *file); +char *wfindfileinarray(proplist_t array, char *file); + char *wexpandpath(char *path); /* don't free the returned string */ diff --git a/WINGs/findfile.c b/WINGs/findfile.c index 68ecca36..6a972eb4 100644 --- a/WINGs/findfile.c +++ b/WINGs/findfile.c @@ -283,3 +283,58 @@ wfindfileinlist(char **path_list, char *file) +char* +wfindfileinarray(proplist_t array, char *file) +{ + int i; + char *path; + int len, flen; + char *fullpath; + + if (!file) + return NULL; + + if (*file=='/' || *file=='~' || !array) { + if (access(file, F_OK)<0) { + fullpath = wexpandpath(file); + if (!fullpath) + return NULL; + + if (access(fullpath, F_OK)<0) { + free(fullpath); + return NULL; + } else { + return fullpath; + } + } else { + return wstrdup(file); + } + } + + flen = strlen(file); + for (i=0; PLGetNumberOfElements(array); i++) { + char *p = PLGetString(PLGetArrayElement(array, i)); + + len = strlen(p); + path = wmalloc(len+flen+2); + path = memcpy(path, p, len); + path[len]=0; + strcat(path, "/"); + strcat(path, file); + /* expand tilde */ + fullpath = wexpandpath(path); + free(path); + if (fullpath) { + /* check if file exists */ + if (access(fullpath, F_OK)==0) { + return fullpath; + } + free(fullpath); + } + } + return NULL; +} + + + + diff --git a/WINGs/wbrowser.c b/WINGs/wbrowser.c index 6fa7c3d9..4f2e79f9 100644 --- a/WINGs/wbrowser.c +++ b/WINGs/wbrowser.c @@ -918,6 +918,7 @@ listCallback(void *self, void *clientData) i = bPtr->usedColumnCount-bPtr->maxVisibleColumns; scrollToColumn(bPtr, i, True); } + /* call callback for click */ if (bPtr->action) diff --git a/WINGs/wcolor.c b/WINGs/wcolor.c index 6ae38abd..69cb659a 100644 --- a/WINGs/wcolor.c +++ b/WINGs/wcolor.c @@ -320,8 +320,8 @@ WMGetColorRGBDescription(WMColor *color) { char *str = wmalloc(32); - sprintf(str, "rgb:%4x/%4x/%4x", color->color.red, color->color.green, - color->color.blue); + sprintf(str, "#%02x%02x%02x", color->color.red>>8, color->color.green>>8, + color->color.blue>>8); return str; } diff --git a/WINGs/wcolorwell.c b/WINGs/wcolorwell.c index bbe3cd8f..f79111e4 100644 --- a/WINGs/wcolorwell.c +++ b/WINGs/wcolorwell.c @@ -5,6 +5,9 @@ #include "WINGsP.h" +char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification"; + + typedef struct W_ColorWell { W_Class widgetClass; WMView *view; @@ -323,6 +326,8 @@ dragColor(ColorWell *cPtr, XEvent *event, WMPixmap *image) case ButtonRelease: if (activeWell != NULL) { WMSetColorWellColor(activeWell, cPtr->color); + WMPostNotificationName(WMColorWellDidChangeNotification, + activeWell, NULL); } else { slideView(dragView, ev.xbutton.x_root, ev.xbutton.y_root, event->xmotion.x_root, event->xmotion.y_root); @@ -438,6 +443,8 @@ handleActionEvents(XEvent *event, void *data) color = WMCreateNamedColor(scr, t, False); if (color) { WMSetColorWellColor(cPtr, color); + WMPostNotificationName(WMColorWellDidChangeNotification, + cPtr, NULL); WMReleaseColor(color); } free(t); diff --git a/WINGs/wlist.c b/WINGs/wlist.c index 19bc6b2b..85bda305 100644 --- a/WINGs/wlist.c +++ b/WINGs/wlist.c @@ -65,6 +65,7 @@ static void updateScroller(List *lPtr); static void vScrollCallBack(WMWidget *scroller, void *self); +static void updateGeometry(WMList *lPtr); static void resizeList(); @@ -187,7 +188,9 @@ WMInsertListItem(WMList *lPtr, int row, char *text) memset(item, 0, sizeof(WMListItem)); item->text = wstrdup(text); - if (lPtr->selectedItem >= row && lPtr->selectedItem >= 0) + + if (lPtr->selectedItem >= row && lPtr->selectedItem >= 0 + && row >= 0) lPtr->selectedItem++; if (lPtr->items==NULL) { @@ -311,6 +314,8 @@ WMSetListUserDrawItemHeight(WMList *lPtr, unsigned short height) lPtr->flags.userItemHeight = 1; lPtr->itemHeight = height; + + updateGeometry(lPtr); } @@ -804,14 +809,10 @@ handleActionEvents(XEvent *event, void *data) static void -resizeList(WMList *lPtr, unsigned int width, unsigned int height) -{ - W_ResizeView(lPtr->view, width, height); - - WMResizeWidget(lPtr->vScroller, 1, height-2); - - lPtr->fullFitLines = (height - 4) / lPtr->itemHeight; - if (lPtr->fullFitLines * lPtr->itemHeight < height-4) { +updateGeometry(WMList *lPtr) +{ + lPtr->fullFitLines = (lPtr->view->size.height - 4) / lPtr->itemHeight; + if (lPtr->fullFitLines * lPtr->itemHeight < lPtr->view->size.height - 4) { lPtr->flags.dontFitAll = 1; } else { lPtr->flags.dontFitAll = 0; @@ -827,6 +828,17 @@ resizeList(WMList *lPtr, unsigned int width, unsigned int height) } +static void +resizeList(WMList *lPtr, unsigned int width, unsigned int height) +{ + W_ResizeView(lPtr->view, width, height); + + WMResizeWidget(lPtr->vScroller, 1, height-2); + + updateGeometry(lPtr); +} + + static void destroyList(List *lPtr) { diff --git a/WINGs/wview.c b/WINGs/wview.c index 9e52076c..51f58436 100644 --- a/WINGs/wview.c +++ b/WINGs/wview.c @@ -512,17 +512,17 @@ W_ResizeView(W_View *view, unsigned int width, unsigned int height) void W_RedisplayView(W_View *view) { - XExposeEvent ev; + XEvent ev; if (!view->flags.mapped) return; - ev.type = Expose; - ev.display = view->screen->display; - ev.window = view->window; - ev.count = 0; + ev.xexpose.type = Expose; + ev.xexpose.display = view->screen->display; + ev.xexpose.window = view->window; + ev.xexpose.count = 0; - WMHandleEvent((XEvent*)&ev); + WMHandleEvent(&ev); } diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c index f6086fa5..01ea152a 100644 --- a/WPrefs.app/Appearance.c +++ b/WPrefs.app/Appearance.c @@ -23,6 +23,9 @@ #include "WPrefs.h" +#include +#include + #include "TexturePanel.h" typedef struct _Panel { @@ -54,17 +57,17 @@ typedef struct _Panel { proplist_t menuTex; proplist_t mtitleTex; proplist_t backTex; - - int ftitleIndex; - int utitleIndex; - int ptitleIndex; - int iconIndex; - int menuIndex; - int mtitleIndex; - int backIndex; + int textureIndex[8]; + + WMFont *smallFont; WMFont *normalFont; - WMFont *selectedFont; + WMFont *boldFont; + + TexturePanel *texturePanel; + + WMPixmap *onLed; + WMPixmap *offLed; /* for preview shit */ Pixmap preview; @@ -75,9 +78,26 @@ typedef struct _Panel { Pixmap back; Pixmap mtitle; Pixmap mitem; + + char *fprefix; } _Panel; +typedef struct { + char *title; + char *texture; + proplist_t prop; + Pixmap preview; + + char *path; + + char selectedFor; + unsigned current:1; +} TextureListItem; + + +static void showData(_Panel *panel); + #define ICON_FILE "appearance" @@ -87,23 +107,249 @@ typedef struct _Panel { #define TEXTR_FILE "textr" + +/* XPM */ +static char * blueled_xpm[] = { +"8 8 17 1", +" c None", +". c #020204", +"+ c #16B6FC", +"@ c #176AFC", +"# c #163AFC", +"$ c #72D2FC", +"% c #224CF4", +"& c #76D6FC", +"* c #16AAFC", +"= c #CEE9FC", +"- c #229EFC", +"; c #164CFC", +"> c #FAFEFC", +", c #2482FC", +"' c #1652FC", +") c #1E76FC", +"! c #1A60FC", +" .... ", +" .=>-@. ", +".=>$@@'.", +".=$@!;;.", +".!@*+!#.", +".#'*+*,.", +" .@)@,. ", +" .... "}; + + +/* XPM */ +static char *blueled2_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 8 8 17 1", +/* colors */ +". c None", +"# c #090909", +"a c #4b63a4", +"b c #011578", +"c c #264194", +"d c #04338c", +"e c #989dac", +"f c #011a7c", +"g c #465c9c", +"h c #03278a", +"i c #6175ac", +"j c #011e74", +"k c #043a90", +"l c #042f94", +"m c #0933a4", +"n c #022184", +"o c #012998", +/* pixels */ +"..####..", +".#aimn#.", +"#aechnf#", +"#gchnjf#", +"#jndknb#", +"#bjdddl#", +".#nono#.", +"..####.." +}; + + + #define FTITLE (1<<0) #define UTITLE (1<<1) #define OTITLE (1<<2) -#define ICON (1<<3) -#define BACK (1<<4) -#define MTITLE (1<<5) -#define MITEM (1<<6) +#define MTITLE (1<<3) +#define MITEM (1<<4) +#define ICON (1<<5) +#define BACK (1<<6) #define EVERYTHING 0xff -static Pixmap -renderTexture(_Panel *panel, char *texture, int width, int height, - Bool bordered) + + +#define TEXPREV_WIDTH 40 +#define TEXPREV_HEIGHT 24 + + + + + +static void +str2rcolor(RContext *rc, char *name, RColor *color) { - return None; + XColor xcolor; + + XParseColor(rc->dpy, rc->cmap, name, &xcolor); + + color->alpha = 255; + color->red = xcolor.red >> 8; + color->green = xcolor.green >> 8; + color->blue = xcolor.blue >> 8; } + + +static void +dumpRImage(char *path, RImage *image) +{ + FILE *f; + + f = fopen(path, "w"); + if (!f) { + wsyserror(path); + return; + } + fprintf(f, "%02x%02x%1x", image->width, image->height, + image->data[3]!=NULL ? 4 : 3); + + fwrite(image->data[0], 1, image->width * image->height, f); + fwrite(image->data[1], 1, image->width * image->height, f); + fwrite(image->data[2], 1, image->width * image->height, f); + if (image->data[3]) + fwrite(image->data[3], 1, image->width * image->height, f); + + if (fclose(f) < 0) { + wsyserror(path); + } +} + + + +static Pixmap +renderTexture(WMScreen *scr, proplist_t texture, int width, int height, + char *path, Bool bordered) +{ + char *type; + RImage *image; + Pixmap pixmap; + RContext *rc = WMScreenRContext(scr); + char *str; + RColor rcolor; + + + type = PLGetString(PLGetArrayElement(texture, 0)); + + image = RCreateImage(width, height, False); + + if (strcasecmp(type, "solid")==0) { + + str = PLGetString(PLGetArrayElement(texture, 1)); + + str2rcolor(rc, str, &rcolor); + + RClearImage(image, &rcolor); + } else if (strcasecmp(&type[1], "gradient")==0) { + int style; + RColor rcolor2; + + switch (toupper(type[0])) { + case 'V': + style = RVerticalGradient; + break; + case 'H': + style = RHorizontalGradient; + break; + case 'D': + style = RDiagonalGradient; + break; + } + + str = PLGetString(PLGetArrayElement(texture, 1)); + str2rcolor(rc, str, &rcolor); + str = PLGetString(PLGetArrayElement(texture, 2)); + str2rcolor(rc, str, &rcolor2); + + image = RRenderGradient(width, height, &rcolor, &rcolor2, style); + } else if (strcasecmp(&type[2], "gradient")==0) { + int style; + RColor **colors; + int i, j; + + switch (toupper(type[1])) { + case 'V': + style = RVerticalGradient; + break; + case 'H': + style = RHorizontalGradient; + break; + case 'D': + style = RDiagonalGradient; + break; + } + + j = PLGetNumberOfElements(texture); + + if (j > 0) { + colors = wmalloc(j * sizeof(RColor*)); + + for (i = 2; i < j; i++) { + str = PLGetString(PLGetArrayElement(texture, i)); + colors[i-2] = wmalloc(sizeof(RColor)); + str2rcolor(rc, str, colors[i-2]); + } + colors[i-2] = NULL; + + image = RRenderMultiGradient(width, height, colors, style); + + for (i = 0; colors[i]!=NULL; i++) + free(colors[i]); + free(colors); + } + } else if (strcasecmp(&type[1], "pixmap")==0) { + int style; + RImage *timage; + int w, h; + char *path; + + str = PLGetString(PLGetArrayElement(texture, 1)); + + path = wfindfileinarray(GetObjectForKey("PixmapPath"), str); + timage = RLoadImage(rc, path, 0); + free(path); + if (timage) { + w = timage->width; + h = timage->height; + + if (w - TEXPREV_WIDTH > h - TEXPREV_HEIGHT) { + h = (w * TEXPREV_HEIGHT)/TEXPREV_WIDTH; + } else { + w = (h * TEXPREV_WIDTH)/TEXPREV_HEIGHT; + } + + image = RScaleImage(timage, w, h); + RDestroyImage(timage); + } + } + + if (path) { + dumpRImage(path, image); + } + + RConvertImage(rc, image, &pixmap); + RDestroyImage(image); + + return pixmap; +} + + #if 0 static void updatePreviewBox(_Panel *panel, int elements) @@ -125,7 +371,7 @@ updatePreviewBox(_Panel *panel, int elements) if (panel->ftitle) XFreePixmap(dpy, panel->ftitle); - panel->ftitle = renderTexture(panel, tmp, 180, 20, True); + panel->ftitle = renderTexture(scr, tmp, 180, 20, NULL, True); free(tmp); } @@ -163,11 +409,193 @@ getStrArrayForKey(char *key) static void -newTexture(WMButton *bPtr, void *data) +cancelNewTexture(void *data) +{ + _Panel *panel = (_Panel*)data; + + HideTexturePanel(panel->texturePanel); +} + + +static char* +makeFileName(char *prefix, char *name) +{ + char *fname, *str; + int i; + + str = wstrappend(prefix, name); + fname = wstrdup(str); + + i = 1; + while (access(fname, F_OK)==0) { + char buf[16]; + + free(fname); + sprintf(buf, "%i", i++); + fname = wstrappend(str, buf); + } + free(str); + + return fname; +} + + +static void +okNewTexture(void *data) +{ + _Panel *panel = (_Panel*)data; + WMListItem *item; + char *name; + char *str; + proplist_t prop; + TextureListItem *titem; + WMScreen *scr = WMWidgetScreen(panel->win); + + titem = wmalloc(sizeof(TextureListItem)); + memset(titem, 0, sizeof(TextureListItem)); + + HideTexturePanel(panel->texturePanel); + + name = GetTexturePanelTextureName(panel->texturePanel); + + prop = GetTexturePanelTexture(panel->texturePanel); + + str = PLGetDescription(prop); + + titem->title = name; + titem->prop = prop; + titem->texture = str; + titem->selectedFor = 0; + + titem->path = makeFileName(panel->fprefix, name); + titem->preview = renderTexture(scr, prop, TEXPREV_WIDTH, TEXPREV_HEIGHT, + titem->path, False); + + item = WMAddListItem(panel->texLs, ""); + item->clientData = titem; + + WMSetListPosition(panel->texLs, WMGetListNumberOfRows(panel->texLs)); +} + + + +static void +okEditTexture(void *data) +{ + _Panel *panel = (_Panel*)data; + WMListItem *item; + char *name; + char *str; + proplist_t prop; + TextureListItem *titem; + + item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs)); + titem = (TextureListItem*)item->clientData; + + HideTexturePanel(panel->texturePanel); + + name = GetTexturePanelTextureName(panel->texturePanel); + + prop = GetTexturePanelTexture(panel->texturePanel); + + str = PLGetDescription(prop); + + free(titem->title); + titem->title = name; + + PLRelease(titem->prop); + titem->prop = prop; + + free(titem->texture); + titem->texture = str; + + XFreePixmap(WMScreenDisplay(WMWidgetScreen(panel->texLs)), titem->preview); + titem->preview = renderTexture(WMWidgetScreen(panel->texLs), titem->prop, + TEXPREV_WIDTH, TEXPREV_HEIGHT, + titem->path, False); + + WMRedisplayWidget(panel->texLs); +} + + + +static void +editTexture(WMWidget *w, void *data) +{ + _Panel *panel = (_Panel*)data; + WMListItem *item; + TextureListItem *titem; + + item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs)); + titem = (TextureListItem*)item->clientData; + + SetTexturePanelTexture(panel->texturePanel, titem->title, titem->prop); + + SetTexturePanelCancelAction(panel->texturePanel, cancelNewTexture, panel); + SetTexturePanelOkAction(panel->texturePanel, okEditTexture, panel); + + SetTexturePanelPixmapPath(panel->texturePanel, + GetObjectForKey("PixmapPath")); + ShowTexturePanel(panel->texturePanel); +} + + + +static void +newTexture(WMWidget *w, void *data) { _Panel *panel = (_Panel*)data; - + SetTexturePanelTexture(panel->texturePanel, "New Texture", NULL); + + SetTexturePanelCancelAction(panel->texturePanel, cancelNewTexture, panel); + + SetTexturePanelOkAction(panel->texturePanel, okNewTexture, panel); + + SetTexturePanelPixmapPath(panel->texturePanel, + GetObjectForKey("PixmapPath")); + ShowTexturePanel(panel->texturePanel); +} + + + +static void +deleteTexture(WMWidget *w, void *data) +{ + _Panel *panel = (_Panel*)data; + WMListItem *item; + TextureListItem *titem; + int row; + int section; + + section = WMGetPopUpButtonSelectedItem(panel->secP); + row = WMGetListSelectedItemRow(panel->texLs); + item = WMGetListItem(panel->texLs, row); + titem = (TextureListItem*)item->clientData; + + if (titem->selectedFor & (1 << section)) { + TextureListItem *titem2; + + panel->textureIndex[section] = section; + item = WMGetListItem(panel->texLs, section); + titem2 = (TextureListItem*)item->clientData; + titem2->selectedFor |= 1 << section; + } + + free(titem->title); + free(titem->texture); + PLRelease(titem->prop); + if (titem->path) { + if (remove(titem->path) < 0 && errno != ENOENT) { + wsyserror("could not remove file %s", titem->path); + } + free(titem->path); + } + + free(titem); + + WMRemoveListItem(panel->texLs, row); + WMSetButtonEnabled(panel->delB, False); } @@ -179,34 +607,183 @@ changePage(WMWidget *w, void *data) section = WMGetPopUpButtonSelectedItem(panel->secP); - WMSelectListItem(panel->texLs, section); + WMSelectListItem(panel->texLs, panel->textureIndex[section]); + WMSetListPosition(panel->texLs, panel->textureIndex[section] + - WMGetListNumberOfRows(panel->texLs)/2); } + static void -selectTexture(WMWidget *w, void *data) +textureClick(WMWidget *w, void *data) { _Panel *panel = (_Panel*)data; - int section; + int i; + WMListItem *item; + TextureListItem *titem; - section = WMGetListSelectedItemRow(panel->secP); - + i = WMGetListSelectedItemRow(panel->texLs); + item = WMGetListItem(panel->texLs, i); + + titem = (TextureListItem*)item->clientData; + + if (titem->current) { + WMSetButtonEnabled(panel->delB, False); + } else { + WMSetButtonEnabled(panel->delB, True); + } } + + +static void +textureDoubleClick(WMWidget *w, void *data) +{ + _Panel *panel = (_Panel*)data; + int i, section; + WMListItem *item; + TextureListItem *titem; + + /* unselect old texture */ + section = WMGetPopUpButtonSelectedItem(panel->secP); + + item = WMGetListItem(panel->texLs, panel->textureIndex[section]); + titem = (TextureListItem*)item->clientData; + titem->selectedFor &= ~(1 << section); + + /* select new texture */ + i = WMGetListSelectedItemRow(panel->texLs); + + item = WMGetListItem(panel->texLs, i); + + titem = (TextureListItem*)item->clientData; + + titem->selectedFor |= 1<textureIndex[section] = i; + + WMRedisplayWidget(panel->texLs); +} + + + + +static void +paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state, + WMRect *rect) +{ + _Panel *panel = (_Panel*)WMGetHangedData(lPtr); + WMScreen *scr = WMWidgetScreen(lPtr); + int width, height, x, y; + Display *dpy = WMScreenDisplay(scr); + WMColor *white = WMWhiteColor(scr); + WMListItem *item; + WMColor *black = WMBlackColor(scr); + TextureListItem *titem; + + width = rect->size.width; + height = rect->size.height; + x = rect->pos.x; + y = rect->pos.y; + + if (state & WLDSSelected) + XFillRectangle(dpy, d, WMColorGC(white), x, y, width, height); + else + XClearArea(dpy, d, x, y, width, height, False); + + item = WMGetListItem(lPtr, index); + titem = (TextureListItem*)item->clientData; + + if (titem->preview) + XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0, TEXPREV_WIDTH, + TEXPREV_HEIGHT, x + 5, y + 5); + + if ((1 << WMGetPopUpButtonSelectedItem(panel->secP)) & titem->selectedFor) + WMDrawPixmap(panel->onLed, d, x + TEXPREV_WIDTH + 10, y + 6); + else if (titem->selectedFor) + WMDrawPixmap(panel->offLed, d, x + TEXPREV_WIDTH + 10, y + 6); + + WMDrawString(scr, d, WMColorGC(black), panel->boldFont, + x + TEXPREV_WIDTH + 22, y + 2, titem->title, + strlen(titem->title)); + + WMDrawString(scr, d, WMColorGC(black), panel->smallFont, + x + TEXPREV_WIDTH + 14, y + 18, titem->texture, + strlen(titem->texture)); + + + WMReleaseColor(white); + WMReleaseColor(black); +} + + + +static Pixmap +loadRImage(WMScreen *scr, char *path) +{ + FILE *f; + RImage *image; + int w, h, d; + int i; + Pixmap pixmap; + + f = fopen(path, "r"); + if (!f) + return None; + + fscanf(f, "%02x%02x%1x", &w, &h, &d); + + image = RCreateImage(w, h, d == 4); + for (i = 0; i < d; i++) { + fread(image->data[i], 1, w*h, f); + } + fclose(f); + + RConvertImage(WMScreenRContext(scr), image, &pixmap); + RDestroyImage(image); + + return pixmap; +} + + static void fillTextureList(WMList *lPtr) { - proplist_t textures; + proplist_t textureList; + proplist_t texture; WMUserDefaults *udb = WMGetStandardUserDefaults(); + int i; + TextureListItem *titem; + WMScreen *scr = WMWidgetScreen(lPtr); - textures = WMGetUDObjectForKey(udb, "Textures"); - - if (!textures) + textureList = WMGetUDObjectForKey(udb, "TextureList"); + if (!textureList) return; - + for (i = 0; i < PLGetNumberOfElements(textureList); i++) { + WMListItem *item; + + texture = PLGetArrayElement(textureList, i); + + titem = wmalloc(sizeof(TextureListItem)); + memset(titem, 0, sizeof(TextureListItem)); + + titem->title = wstrdup(PLGetString(PLGetArrayElement(texture, 0))); + titem->prop = PLRetain(PLGetArrayElement(texture, 1)); + titem->texture = PLGetDescription(titem->prop); + titem->selectedFor = 0; + titem->path = wstrdup(PLGetString(PLGetArrayElement(texture, 2))); + + titem->preview = loadRImage(scr, titem->path); + if (!titem->preview) { + titem->preview = renderTexture(scr, titem->prop, TEXPREV_WIDTH, + TEXPREV_HEIGHT, NULL, False); + } + item = WMAddListItem(lPtr, ""); + item->clientData = titem; + } } @@ -218,6 +795,35 @@ createPanel(Panel *p) WMFont *font; WMScreen *scr = WMWidgetScreen(panel->win); + char *tmp; + Bool ok = True; + + panel->fprefix = wstrappend(wusergnusteppath(), "/.AppInfo"); + + if (access(panel->fprefix, F_OK)!=0) { + if (mkdir(panel->fprefix, 0755) < 0) { + wsyserror(panel->fprefix); + ok = False; + } + } + if (ok) { + tmp = wstrappend(panel->fprefix, "/WPrefs/"); + free(panel->fprefix); + panel->fprefix = tmp; + if (access(panel->fprefix, F_OK)!=0) { + if (mkdir(panel->fprefix, 0755) < 0) { + wsyserror(panel->fprefix); + } + } + } + + panel->smallFont = WMSystemFontOfSize(scr, 10); + panel->normalFont = WMSystemFontOfSize(scr, 12); + panel->boldFont = WMBoldSystemFontOfSize(scr, 12); + + panel->onLed = WMCreatePixmapFromXPMData(scr, blueled_xpm); + panel->offLed = WMCreatePixmapFromXPMData(scr, blueled2_xpm); + panel->frame = WMCreateFrame(panel->win); WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT); WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP); @@ -238,7 +844,8 @@ createPanel(Panel *p) WMAddPopUpButtonItem(panel->secP, _("Titlebar of Menus")); WMAddPopUpButtonItem(panel->secP, _("Menu Items")); WMAddPopUpButtonItem(panel->secP, _("Icon Background")); - WMAddPopUpButtonItem(panel->secP, _("Workspace Backgrounds")); +/* WMAddPopUpButtonItem(panel->secP, _("Workspace Backgrounds")); + */ WMSetPopUpButtonAction(panel->secP, changePage, panel); /* texture list */ @@ -263,7 +870,12 @@ createPanel(Panel *p) panel->texLs = WMCreateList(panel->frame); WMResizeWidget(panel->texLs, 225, 144); WMMoveWidget(panel->texLs, 285, 30); - + WMSetListUserDrawItemHeight(panel->texLs, 35); + WMSetListUserDrawProc(panel->texLs, paintListItem); + WMHangData(panel->texLs, panel); + WMSetListAction(panel->texLs, textureClick, panel); + WMSetListDoubleAction(panel->texLs, textureDoubleClick, panel); + /* command buttons */ font = WMSystemFontOfSize(scr, 10); @@ -275,6 +887,7 @@ createPanel(Panel *p) WMSetButtonFont(panel->newB, font); WMSetButtonImagePosition(panel->newB, WIPAbove); WMSetButtonText(panel->newB, _("New")); + WMSetButtonAction(panel->newB, newTexture, panel); SetButtonAlphaImage(scr, panel->newB, TNEW_FILE); panel->ripB = WMCreateCommandButton(panel->frame); @@ -285,6 +898,8 @@ createPanel(Panel *p) WMSetButtonText(panel->ripB, _("Extract...")); SetButtonAlphaImage(scr, panel->ripB, TEXTR_FILE); + WMSetButtonEnabled(panel->ripB, False); + panel->editB = WMCreateCommandButton(panel->frame); WMResizeWidget(panel->editB, 56, 48); WMMoveWidget(panel->editB, 397, 180); @@ -292,7 +907,7 @@ createPanel(Panel *p) WMSetButtonImagePosition(panel->editB, WIPAbove); WMSetButtonText(panel->editB, _("Edit")); SetButtonAlphaImage(scr, panel->editB, TEDIT_FILE); - WMSetButtonEnabled(panel->editB, False); + WMSetButtonAction(panel->editB, editTexture, panel); panel->delB = WMCreateCommandButton(panel->frame); WMResizeWidget(panel->delB, 56, 48); @@ -302,6 +917,7 @@ createPanel(Panel *p) WMSetButtonText(panel->delB, _("Delete")); SetButtonAlphaImage(scr, panel->delB, TDEL_FILE); WMSetButtonEnabled(panel->delB, False); + WMSetButtonAction(panel->delB, deleteTexture, panel); WMReleaseFont(font); @@ -316,61 +932,133 @@ createPanel(Panel *p) fillTextureList(panel->texLs); + panel->texturePanel = CreateTexturePanel(panel->win); } + + static proplist_t -setupTextureFor(WMList *list, char *key, char *defValue, char *title) +setupTextureFor(WMList *list, char *key, char *defValue, char *title, + int index) { WMListItem *item; - char *tex, *str; - proplist_t prop; + TextureListItem *titem; - prop = GetObjectForKey(key); - if (!prop) { - prop = PLMakeString(defValue); + titem = wmalloc(sizeof(TextureListItem)); + memset(titem, 0, sizeof(TextureListItem)); + + titem->title = wstrdup(title); + titem->prop = GetObjectForKey(key); + if (!titem->prop) { + titem->prop = PLGetProplistWithDescription(defValue); + } else { + PLRetain(titem->prop); } - tex = PLGetDescription(prop); - str = wstrappend(title, tex); - free(tex); - item = WMAddListItem(list, str); - free(str); - item->clientData = prop; + titem->texture = PLGetDescription((proplist_t)titem->prop); + titem->current = 1; + titem->selectedFor = 1<preview = renderTexture(WMWidgetScreen(list), titem->prop, + TEXPREV_WIDTH, TEXPREV_HEIGHT, NULL, False); + + item = WMAddListItem(list, ""); + item->clientData = titem; + + return titem->prop; } + static void showData(_Panel *panel) { + int i = 0; + panel->ftitleTex = setupTextureFor(panel->texLs, "FTitleBack", - "(solid, black)", "[Focused]:"); - panel->ftitleIndex = 0; + "(solid, black)", "[Focused]", i); + panel->textureIndex[i] = i++; panel->utitleTex = setupTextureFor(panel->texLs, "UTitleBack", - "(solid, gray)", "[Unfocused]:"); - panel->utitleIndex = 1; + "(solid, gray)", "[Unfocused]", i); + panel->textureIndex[i] = i++; panel->ptitleTex = setupTextureFor(panel->texLs, "PTitleBack", "(solid, \"#616161\")", - "[Owner of Focused]:"); - panel->ptitleIndex = 2; + "[Owner of Focused]", i); + panel->textureIndex[i] = i++; panel->mtitleTex = setupTextureFor(panel->texLs, "MenuTitleBack", - "(solid, black)", "[Menu Title]:"); - panel->mtitleIndex = 3; + "(solid, black)", "[Menu Title]", i); + panel->textureIndex[i] = i++; panel->menuTex = setupTextureFor(panel->texLs, "MenuTextBack", - "(solid, gray)", "[Menu Item]:"); - panel->menuIndex = 4; + "(solid, gray)", "[Menu Item]", i); + panel->textureIndex[i] = i++; panel->iconTex = setupTextureFor(panel->texLs, "IconBack", - "(solid, gray)", "[Icon]:"); - panel->iconIndex = 5; - + "(solid, gray)", "[Icon]", i); + panel->textureIndex[i] = i++; +/* panel->backTex = setupTextureFor(panel->texLs, "WorkspaceBack", - "(solid, black)", "[Workspace]:"); - panel->backIndex = 6; + "(solid, black)", "[Workspace]", i); + panel->textureIndex[i] = i++; + */ +} + + + +static void +storeData(_Panel *panel) +{ + proplist_t textureList; + proplist_t texture; + int i; + TextureListItem *titem; + WMListItem *item; + WMUserDefaults *udb = WMGetStandardUserDefaults(); + + textureList = PLMakeArrayFromElements(NULL, NULL); + + /* store list of textures */ + for (i = 6; i < WMGetListNumberOfRows(panel->texLs); i++) { + item = WMGetListItem(panel->texLs, i); + titem = (TextureListItem*)item->clientData; + + texture = PLMakeArrayFromElements(PLMakeString(titem->title), + PLRetain(titem->prop), + PLMakeString(titem->path), + NULL); + + PLAppendArrayElement(textureList, texture); + } + + WMSetUDObjectForKey(udb, textureList, "TextureList"); + PLRelease(textureList); + + item = WMGetListItem(panel->texLs, panel->textureIndex[0]); + titem = (TextureListItem*)item->clientData; + SetObjectForKey(titem->prop, "FTitleBack"); + + item = WMGetListItem(panel->texLs, panel->textureIndex[1]); + titem = (TextureListItem*)item->clientData; + SetObjectForKey(titem->prop, "UTitleBack"); + + item = WMGetListItem(panel->texLs, panel->textureIndex[2]); + titem = (TextureListItem*)item->clientData; + SetObjectForKey(titem->prop, "PTitleBack"); + + item = WMGetListItem(panel->texLs, panel->textureIndex[3]); + titem = (TextureListItem*)item->clientData; + SetObjectForKey(titem->prop, "MenuTextBack"); + + item = WMGetListItem(panel->texLs, panel->textureIndex[4]); + titem = (TextureListItem*)item->clientData; + SetObjectForKey(titem->prop, "MenuItemBack"); + + item = WMGetListItem(panel->texLs, panel->textureIndex[5]); + titem = (TextureListItem*)item->clientData; + SetObjectForKey(titem->prop, "IconBack"); + } @@ -388,6 +1076,7 @@ InitAppearance(WMScreen *scr, WMWindow *win) panel->win = win; panel->callbacks.createWidgets = createPanel; + panel->callbacks.updateDomain = storeData; AddSection(panel, ICON_FILE); diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c index fed3f0c4..07959ac4 100644 --- a/WPrefs.app/MouseSettings.c +++ b/WPrefs.app/MouseSettings.c @@ -884,7 +884,6 @@ storeCommandInScript(char *cmd, char *line) system(buffer); end: - free(p); free(path); if (f) fclose(f); diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c index 3704634f..75493767 100644 --- a/WPrefs.app/TexturePanel.c +++ b/WPrefs.app/TexturePanel.c @@ -25,87 +25,119 @@ #include #include #include +#include #include #include + #include #include +#include "WPrefs.h" -#include "TexturePanel.h" -#include "TexturePanel.icons" +//#include "TexturePanel.h" + +typedef struct _TexturePanel TexturePanel; + +#define MAX_SECTION_PARTS 4 typedef struct _TexturePanel { WMWindow *win; - WMFrame *typeF; - WMButton *tsoliB; - WMButton *tgradB; - WMButton *tpixmB; + /* texture name */ + WMFrame *nameF; + WMTextField *nameT; - WMButton *okB; - WMButton *cancB; - - /* solid */ - WMFrame *scolorF; - WMColorWell *scolorW; - - /* gradient */ - WMFrame *gcolorF; - WMList *gcolorLs; - WMColorWell *gcolorW; - WMButton *gaddB; - WMButton *gremB; - WMButton *gupdB; + /* texture type */ + WMPopUpButton *typeP; - WMFrame *gdirF; - WMButton *ghorB; - WMButton *gverB; - WMButton *gdiaB; + /* default color */ + WMFrame *defcF; + WMColorWell *defcW; + + WMFont *listFont; + + /*-- Gradient --*/ + + Pixmap gimage; + + /* colors */ + WMFrame *gcolF; + WMList *gcolL; + WMButton *gcolaB; + WMButton *gcoldB; + WMSlider *ghueS; + WMSlider *gsatS; + WMSlider *gvalS; + + WMSlider *gbriS; + WMSlider *gconS; + + /* direction (common) */ + WMFrame *dirF; + WMButton *dirhB; + WMButton *dirvB; + WMButton *dirdB; + + /*-- Simple Gradient --*/ + + + /*-- Textured Gradient --*/ + + WMFrame *tcolF; + WMColorWell *tcol1W; + WMColorWell *tcol2W; + + WMFrame *topaF; + WMSlider *topaS; + + /*-- Image --*/ + WMFrame *imageF; + WMScrollView *imageV; + WMTextField *imageT; + WMLabel *imageL; + WMButton *browB; + WMButton *dispB; + WMPopUpButton *arrP; + + char *imageFile; + + /*****/ + + WMButton *okB; + WMButton *cancelB; - /* pixmap */ - WMFrame *pimagF; - WMLabel *pimagL; - WMTextField *pimagT; - WMButton *pbrowB; - WMFrame *pcolorF; - WMColorWell *pcolorW; - - WMFrame *pmodeF; - WMButton *pscalB; - WMButton *ptileB; - - WMAction *okAction; + WMCallback *okAction; void *okData; - WMAction *cancelAction; + WMCallback *cancelAction; void *cancelData; + + /****/ + WMWidget *sectionParts[5][MAX_SECTION_PARTS]; + + int currentType; + + proplist_t pathList; + } _TexturePanel; -char* -WMGetColorWellRGBString(WMColorWell *cPtr) -{ - char *rgbString; - WMColor *color; - - - rgbString = wmalloc(13); - color = WMGetColorWellColor(cPtr); - - if (color) { - sprintf(rgbString,"rgb:%02x/%02x/%02x", - (WMRedComponentOfColor(color) >> 8), - (WMGreenComponentOfColor(color) >> 8), - (WMBlueComponentOfColor(color) >> 8)); - } - - return rgbString; -} +#define TYPE_SOLID 0 +#define TYPE_GRADIENT 1 +#define TYPE_SGRADIENT 2 +#define TYPE_TGRADIENT 3 +#define TYPE_PIXMAP 4 + + +#define PTYPE_TILE 0 +#define PTYPE_SCALE 1 +#define PTYPE_CENTER 2 +#define PTYPE_MAXIMIZE 3 @@ -114,283 +146,510 @@ WMGetColorWellRGBString(WMColorWell *cPtr) * Private Functions *-------------------------------------------------------------------------- */ -static void buttonCallback(WMWidget *self, void *data); -static void renderTextureButtons (_TexturePanel *panel); -static void paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect); -static void notificationObserver(void *self, WMNotification *notif); + +/************/ static void -notificationObserver(void *self, WMNotification *notif) +updateGradButtons(TexturePanel *panel) { - _TexturePanel *panel = (_TexturePanel*)self; - void *object = WMGetNotificationObject(notif); - char *text; - - if (WMGetNotificationName(notif) == WMTextDidChangeNotification) { - if (object == panel->pimagT) { - text = WMGetTextFieldText(panel->pimagT); - if (strlen(text)) { - WMSetButtonEnabled(panel->okB, True); - } else { - WMSetButtonEnabled(panel->okB, False); - } - free(text); - } + RImage *image; + WMPixmap *pixmap; + int colorn; + RColor **colors; + + colorn = WMGetListNumberOfRows(panel->gcolL); + if (colorn < 1) { + pixmap = NULL; + } else { + int i; + WMListItem *item; + + colors = wmalloc(sizeof(RColor*)*(colorn+1)); + + for (i = 0; i < colorn; i++) { + item = WMGetListItem(panel->gcolL, i); + colors[i] = (RColor*)item->clientData; + } + colors[i] = NULL; + + image = RRenderMultiGradient(80, 30, colors, RHorizontalGradient); + pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL), + image, 128); + RDestroyImage(image); + WMSetButtonImage(panel->dirhB, pixmap); + WMReleasePixmap(pixmap); + + image = RRenderMultiGradient(80, 30, colors, RVerticalGradient); + pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL), + image, 128); + RDestroyImage(image); + WMSetButtonImage(panel->dirvB, pixmap); + WMReleasePixmap(pixmap); + + image = RRenderMultiGradient(80, 30, colors, RDiagonalGradient); + pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL), + image, 128); + RDestroyImage(image); + WMSetButtonImage(panel->dirdB, pixmap); + WMReleasePixmap(pixmap); + + free(colors); } } static void -paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect) +updateSGradButtons(TexturePanel *panel) { - WMScreen *scr; + RImage *image; + WMPixmap *pixmap; + RColor from; + RColor to; + WMColor *color; + + color = WMGetColorWellColor(panel->tcol1W); + from.red = WMRedComponentOfColor(color)>>8; + from.green = WMGreenComponentOfColor(color)>>8; + from.blue = WMBlueComponentOfColor(color)>>8; + + color = WMGetColorWellColor(panel->tcol2W); + to.red = WMRedComponentOfColor(color)>>8; + to.green = WMGreenComponentOfColor(color)>>8; + to.blue = WMBlueComponentOfColor(color)>>8; + + image = RRenderGradient(80, 30, &from, &to, RHorizontalGradient); + pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL), + image, 128); + RDestroyImage(image); + WMSetButtonImage(panel->dirhB, pixmap); + WMReleasePixmap(pixmap); + + image = RRenderGradient(80, 30, &from, &to, RVerticalGradient); + pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL), + image, 128); + RDestroyImage(image); + WMSetButtonImage(panel->dirvB, pixmap); + WMReleasePixmap(pixmap); + + image = RRenderGradient(80, 30, &from, &to, RDiagonalGradient); + pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL), + image, 128); + RDestroyImage(image); + WMSetButtonImage(panel->dirdB, pixmap); + WMReleasePixmap(pixmap); +} + + +static void +changeTypeCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; + int newType; + int i; + + newType = WMGetPopUpButtonSelectedItem(w); + if (newType == panel->currentType) + return; + + if (panel->currentType >= 0) { + for (i = 0; i < MAX_SECTION_PARTS; i++) { + if (panel->sectionParts[panel->currentType][i] == NULL) + break; + WMUnmapWidget(panel->sectionParts[panel->currentType][i]); + } + } + + for (i = 0; i < MAX_SECTION_PARTS; i++) { + if (panel->sectionParts[newType][i] == NULL) + break; + WMMapWidget(panel->sectionParts[newType][i]); + } + panel->currentType = newType; + + switch (newType) { + case TYPE_SGRADIENT: + updateSGradButtons(panel); + break; + case TYPE_GRADIENT: + updateGradButtons(panel); + break; + } +} + + +/*********** Gradient ************/ + +static void +updateSVSlider(WMSlider *sPtr, Bool saturation, WMFont *font, RHSVColor *hsv) +{ + RImage *image; + WMPixmap *pixmap; + WMScreen *scr = WMWidgetScreen(sPtr); + RColor from, to; + RHSVColor tmp; + + tmp = *hsv; + if (saturation) { + tmp.saturation = 0; + RHSVtoRGB(&tmp, &from); + tmp.saturation = 255; + RHSVtoRGB(&tmp, &to); + } else { + tmp.value = 0; + RHSVtoRGB(&tmp, &from); + tmp.value = 255; + RHSVtoRGB(&tmp, &to); + } + image = RRenderGradient(130, 16, &from, &to, RHorizontalGradient); + pixmap = WMCreatePixmapFromRImage(scr, image, 128); + RDestroyImage(image); + + if (hsv->value < 128 || !saturation) { + WMColor *col = WMWhiteColor(scr); + + WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2, + (16 - WMFontHeight(font))/2 - 1, + saturation ? "Saturation" : "Brightness", 10); + WMReleaseColor(col); + } else { + WMColor *col = WMBlackColor(scr); + + WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2, + (16 - WMFontHeight(font))/2 - 1, + saturation ? "Saturation" : "Brightness", 10); + WMReleaseColor(col); + } + WMSetSliderImage(sPtr, pixmap); + WMReleasePixmap(pixmap); +} + + +static void +updateHueSlider(WMSlider *sPtr, WMFont *font, RHSVColor *hsv) +{ + RColor *colors[8]; + RImage *image; + WMPixmap *pixmap; + WMScreen *scr = WMWidgetScreen(sPtr); + RHSVColor thsv; + int i; + + thsv = *hsv; + for (i = 0; i <= 6; i++) { + thsv.hue = (360*i)/6; + colors[i] = wmalloc(sizeof(RColor)); + RHSVtoRGB(&thsv, colors[i]); + } + colors[i] = NULL; + + image = RRenderMultiGradient(130, 16, colors, RGRD_HORIZONTAL); + pixmap = WMCreatePixmapFromRImage(scr, image, 128); + RDestroyImage(image); + + if (hsv->value < 128) { + WMColor *col = WMWhiteColor(scr); + + WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2, + (16 - WMFontHeight(font))/2 - 1, "Hue", 3); + WMReleaseColor(col); + } else { + WMColor *col = WMBlackColor(scr); + + WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2, + (16 - WMFontHeight(font))/2 - 1, "Hue", 3); + WMReleaseColor(col); + } + WMSetSliderImage(sPtr, pixmap); + WMReleasePixmap(pixmap); + + for (i = 0; i <= 6; i++) + free(colors[i]); +} + + + +static void +sliderChangeCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; + RHSVColor hsv, *hsvp; + int row, rows; + WMListItem *item; + RColor **colors; + int i; + RImage *image; + WMScreen *scr = WMWidgetScreen(w); + + hsv.hue = WMGetSliderValue(panel->ghueS); + hsv.saturation = WMGetSliderValue(panel->gsatS); + hsv.value = WMGetSliderValue(panel->gvalS); + + row = WMGetListSelectedItemRow(panel->gcolL); + if (row >= 0) { + RColor *rgb; + + item = WMGetListItem(panel->gcolL, row); + + rgb = (RColor*)item->clientData; + + RHSVtoRGB(&hsv, rgb); + + sprintf(item->text, "%02x,%02x,%02x", rgb->red, rgb->green, rgb->blue); + } + + if (w == panel->ghueS) { + updateSVSlider(panel->gsatS, True, panel->listFont, &hsv); + updateSVSlider(panel->gvalS, False, panel->listFont, &hsv); + } else if (w == panel->gsatS) { + updateHueSlider(panel->ghueS, panel->listFont, &hsv); + updateSVSlider(panel->gvalS, False, panel->listFont, &hsv); + } else { + updateHueSlider(panel->ghueS, panel->listFont, &hsv); + updateSVSlider(panel->gsatS, True, panel->listFont, &hsv); + } + + rows = WMGetListNumberOfRows(panel->gcolL); + if (rows == 0) + return; + + colors = wmalloc(sizeof(RColor*)*(rows+1)); + + for (i = 0; i < rows; i++) { + item = WMGetListItem(panel->gcolL, i); + + colors[i] = (RColor*)item->clientData; + } + colors[i] = NULL; + + if (panel->gimage != None) { + XFreePixmap(WMScreenDisplay(scr), panel->gimage); + } + + image = RRenderMultiGradient(30, i*WMGetListItemHeight(panel->gcolL), + colors, RVerticalGradient); + RConvertImage(WMScreenRContext(scr), image, &panel->gimage); + RDestroyImage(image); + + free(colors); + + WMRedisplayWidget(panel->gcolL); + + updateGradButtons(panel); +} + + +static void +paintGradListItem(WMList *lPtr, int index, Drawable d, char *text, int state, + WMRect *rect) +{ + TexturePanel *panel = (TexturePanel*)WMGetHangedData(lPtr); + WMScreen *scr = WMWidgetScreen(lPtr); int width, height, x, y; - GC gc; Display *dpy; - - scr = WMWidgetScreen(lPtr); + WMColor *white = WMWhiteColor(scr); + WMListItem *item; + WMColor *black = WMBlackColor(scr); + dpy = WMScreenDisplay(scr); - + width = rect->size.width; height = rect->size.height; x = rect->pos.x; y = rect->pos.y; - + if (state & WLDSSelected) - XFillRectangle(dpy, d, WMColorGC(WMWhiteColor(scr)), x, y,width, height); + XFillRectangle(dpy, d, WMColorGC(white), x, y, width, height); else - XClearArea(WMScreenDisplay(scr), d, x, y, width, height, False); - - gc = XCreateGC(dpy, RootWindow(dpy, 0),0,NULL); - WMSetColorInGC(WMCreateNamedColor(scr, text, True),gc); - XFillRectangle (dpy, d, gc,x+5,y+3,width-8,height-6); - XFreeGC(dpy,gc); + XClearArea(dpy, d, x, y, width, height, False); + + item = WMGetListItem(lPtr, index); + + if (panel->gimage) { + XCopyArea(WMScreenDisplay(scr), panel->gimage, d, WMColorGC(white), + 0, height*index, 30, height, x + 5, y); + } + WMDrawString(scr, d, WMColorGC(black), panel->listFont, + x + 40, y + 1, text, strlen(text)); + + WMReleaseColor(white); + WMReleaseColor(black); +} + + + +static void +gradAddCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; + WMListItem *item; + int row; + RColor *rgb; + + row = WMGetListSelectedItemRow(panel->gcolL) + 1; + item = WMInsertListItem(panel->gcolL, row, "00,00,00"); + rgb = wmalloc(sizeof(RColor)); + memset(rgb, 0, sizeof(RColor)); + item->clientData = rgb; + + WMSelectListItem(panel->gcolL, row); + + updateGradButtons(panel); + + sliderChangeCallback(panel->ghueS, panel); +} + + + +static void +gradClickCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; + WMListItem *item; + int row; + RHSVColor hsv; + + row = WMGetListSelectedItemRow(w); + if (row < 0) + return; + + item = WMGetListItem(panel->gcolL, row); + RRGBtoHSV((RColor*)item->clientData, &hsv); + + WMSetSliderValue(panel->ghueS, hsv.hue); + WMSetSliderValue(panel->gsatS, hsv.saturation); + WMSetSliderValue(panel->gvalS, hsv.value); + + sliderChangeCallback(panel->ghueS, panel); + sliderChangeCallback(panel->gsatS, panel); } static void -buttonCallback(WMWidget *self, void *data) +gradDeleteCallback(WMWidget *w, void *data) { - _TexturePanel *panel = (_TexturePanel*)data; - char *text, *color; - WMOpenPanel *op; - int itemRow; - - WMSetButtonEnabled(panel->okB, True); - - /* Global Buttons */ - - if (self == panel->okB) { - if (panel->okAction) { - (*panel->okAction)(self, panel->okData); - } else { - wwarning ("Texture panel OK button undefined"); - } - } else if (self == panel->cancB) { - if (panel->cancelAction) { - (*panel->cancelAction)(self, panel->cancelData); - } else { - wwarning ("Texture panel CANCEL button undefined"); - } - } else if (self == panel->tsoliB) { - WMMapWidget(panel->scolorF); - WMUnmapWidget(panel->gcolorF); - WMUnmapWidget(panel->gdirF); - WMUnmapWidget(panel->pimagF); - WMUnmapWidget(panel->pcolorF); - WMUnmapWidget(panel->pmodeF); - } else if (self == panel->tgradB) { - WMMapWidget(panel->gcolorF); - WMMapWidget(panel->gdirF); - WMUnmapWidget(panel->scolorF); - WMUnmapWidget(panel->pimagF); - WMUnmapWidget(panel->pcolorF); - WMUnmapWidget(panel->pmodeF); - } else if (self == panel->tpixmB) { - WMMapWidget(panel->pimagF); - WMMapWidget(panel->pcolorF); - WMMapWidget(panel->pmodeF); - WMUnmapWidget(panel->gcolorF); - WMUnmapWidget(panel->gdirF); - WMUnmapWidget(panel->scolorF); - - text = WMGetTextFieldText(panel->pimagT); - if (!strlen(text)) { - WMSetButtonEnabled(panel->okB, False); - } - free(text); - - /* Gradient Panel Buttons */ - - } else if (self == panel->gaddB) { - color = WMGetColorWellRGBString(panel->gcolorW); - itemRow = WMGetListSelectedItemRow(panel->gcolorLs); - WMInsertListItem(panel->gcolorLs,itemRow, color); - free(color); - renderTextureButtons(panel); - - } else if (self == panel->gremB) { - if (WMGetListNumberOfRows(panel->gcolorLs) != 1) { - itemRow = WMGetListSelectedItemRow(panel->gcolorLs); - WMRemoveListItem(panel->gcolorLs,itemRow); - renderTextureButtons(panel); - } - - } else if (self == panel->gupdB) { - color = WMGetColorWellRGBString(panel->gcolorW); - itemRow = WMGetListSelectedItemRow(panel->gcolorLs); - WMRemoveListItem(panel->gcolorLs,itemRow); - WMInsertListItem(panel->gcolorLs,itemRow, color); - free(color); - renderTextureButtons(panel); - - /* Pixmap Panel Buttons */ - - } else if (self == panel->pbrowB) { - op = WMGetOpenPanel(WMWidgetScreen(panel->pbrowB)); - if (WMRunModalFilePanelForDirectory(op, NULL, "/usr/local", NULL, NULL)) { - char *path; - path = WMGetFilePanelFileName(op); - WMSetTextFieldText(panel->pimagT, path); - if (strlen(path)) { - WMSetButtonEnabled(panel->okB, True); + TexturePanel *panel = (TexturePanel*)data; + WMListItem *item; + int row; + + row = WMGetListSelectedItemRow(panel->gcolL); + if (row < 0) + return; + + item = WMGetListItem(panel->gcolL, row); + free(item->clientData); + + WMRemoveListItem(panel->gcolL, row); + + WMSelectListItem(panel->gcolL, row - 1); + + updateGradButtons(panel); + + gradClickCallback(panel->gcolL, panel); +} + + +/*************** Simple Gradient ***************/ + +static void +colorWellObserver(void *self, WMNotification *n) +{ + updateSGradButtons(self); +} + + +/****************** Image ******************/ + +static void +browseImageCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; + WMOpenPanel *opanel; + WMScreen *scr = WMWidgetScreen(w); + + opanel = WMGetOpenPanel(scr); + WMSetFilePanelCanChooseDirectories(opanel, False); + WMSetFilePanelCanChooseFiles(opanel, True); + + if (WMRunModalFilePanelForDirectory(opanel, panel->win, "/home", + "Open Image", NULL)) { + char *path, *fullpath; + char *tmp, *tmp2; + + fullpath = WMGetFilePanelFileName(opanel); + if (!fullpath) + return; + path = wstrdup(fullpath); + + tmp2 = strrchr(fullpath, '/'); + if (tmp2) + tmp2++; + + tmp = wfindfileinarray(panel->pathList, tmp2); + + if (tmp) { + if (strcmp(fullpath, tmp)==0) { + free(path); + path = tmp2; } - free(path); + free(tmp); } - WMFreeFilePanel(op); - } - -} -#if 0 - -static void -changePanel(WMWidget *self, void *data) -{ - _TexturePanel *panel = (_TexturePanel*)data; - char *text = NULL; - - WMSetButtonEnabled(panel->okB, True); - if (self == panel->tsoliB) { - WMMapWidget(panel->scolorF); - WMUnmapWidget(panel->gcolorF); - WMUnmapWidget(panel->gdirF); - WMUnmapWidget(panel->pimagF); - WMUnmapWidget(panel->pcolorF); - WMUnmapWidget(panel->pmodeF); - } else if (self == panel->tgradB) { - WMMapWidget(panel->gcolorF); - WMMapWidget(panel->gdirF); - WMUnmapWidget(panel->scolorF); - WMUnmapWidget(panel->pimagF); - WMUnmapWidget(panel->pcolorF); - WMUnmapWidget(panel->pmodeF); - } else { - WMMapWidget(panel->pimagF); - WMMapWidget(panel->pcolorF); - WMMapWidget(panel->pmodeF); - WMUnmapWidget(panel->gcolorF); - WMUnmapWidget(panel->gdirF); - WMUnmapWidget(panel->scolorF); - - text = WMGetTextFieldText(panel->pimagT); - if (!strlen(text)) { - WMSetButtonEnabled(panel->okB, False); - } - free(text); - } - -} - -static void -modifyGradientList(WMWidget *self, void *data) -{ - _TexturePanel *panel = (_TexturePanel*)data; - char *color = NULL; - int itemRow; - - itemRow = WMGetListSelectedItemRow(panel->gcolorLs); - - color = WMGetColorWellRGBString(panel->gcolorW); - - if (self == panel->gaddB) { - WMInsertListItem(panel->gcolorLs,itemRow, color); - } else if (self == panel->gremB) { - if (WMGetListNumberOfRows(panel->gcolorLs) != 1) { - WMRemoveListItem(panel->gcolorLs,itemRow); - } - - } else { - WMRemoveListItem(panel->gcolorLs,itemRow); - WMInsertListItem(panel->gcolorLs,itemRow, color); - } - free (color); - - renderTextureButtons(panel); -} -#endif - - -static void -renderTextureButtons(_TexturePanel *panel) -{ - RColor **colors = NULL; - XColor color; - WMPixmap *icon; - RImage *imgh, *imgv, *imgd; - WMScreen *scr; - - int i, listRows; - - scr = WMWidgetScreen(panel->gcolorLs); - listRows = WMGetListNumberOfRows(panel->gcolorLs); - colors = wmalloc(sizeof(RColor*)*(listRows+1)); - - for (i=0; i < listRows; i++) { - if (!XParseColor(WMScreenDisplay(scr), (WMScreenRContext(scr))->cmap, - wstrdup(WMGetListItem(panel->gcolorLs, i)->text),&color)) { - wfatal("could not parse color \"%s\"\n", WMGetListItem(panel->gcolorLs, i)->text); - exit(1); + if (!RGetImageFileFormat(fullpath)) { + WMRunAlertPanel(scr, panel->win, _("Error"), + _("The selected file does not contain a supported image."), + _("OK"), NULL, NULL); + free(path); + free(fullpath); } else { - colors[i] = malloc(sizeof(RColor)); - colors[i]->red = color.red >> 8; - colors[i]->green = color.green >> 8; - colors[i]->blue = color.blue >> 8; + RImage *image, *scaled; + WMPixmap *pixmap; + WMSize size; + + image = RLoadImage(WMScreenRContext(scr), fullpath, 0); + if (!image) { + char *message; + + message = wstrappend(_("Could not load the selected file: "), + (char*)RMessageForError(RErrorCode)); + + WMRunAlertPanel(scr, panel->win, _("Error"), message, + _("OK"), NULL, NULL); + free(message); + free(path); + free(fullpath); + return; + } + + pixmap = WMCreatePixmapFromRImage(scr, image, 128); + RDestroyImage(image); + + size = WMGetPixmapSize(pixmap); + WMSetLabelImage(panel->imageL, pixmap); + WMResizeWidget(panel->imageL, size.width, size.height); + + WMReleasePixmap(pixmap); + + panel->imageFile = path; + + WMSetTextFieldText(panel->imageT, path); + + free(fullpath); } } - colors[i] = NULL; +} + + + +static void +buttonCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; - imgh = RRenderMultiGradient(50, 20, colors, RGRD_HORIZONTAL); - if (!imgh) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); + if (w == panel->okB) { + (*panel->okAction)(panel->okData); } else { - icon = WMCreatePixmapFromRImage(scr, imgh, 120); - RDestroyImage(imgh); - WMSetButtonImage(panel->ghorB, icon); - WMReleasePixmap(icon); + (*panel->cancelAction)(panel->cancelData); } - - imgv = RRenderMultiGradient(50, 20, colors, RGRD_VERTICAL); - if (!imgv) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, imgv, 120); - RDestroyImage(imgv); - WMSetButtonImage(panel->gverB, icon); - WMReleasePixmap(icon); - } - - imgd = RRenderMultiGradient(50, 20, colors, RGRD_DIAGONAL); - if (!imgd) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, imgd, 120); - RDestroyImage(imgd); - WMSetButtonImage(panel->gdiaB, icon); - WMReleasePixmap(icon); - } - - free(colors); } @@ -402,9 +661,7 @@ renderTextureButtons(_TexturePanel *panel) void DestroyTexturePanel(TexturePanel *panel) { - WMUnmapWidget(panel->win); - WMDestroyWidget(panel->win); - free(panel); + } @@ -421,8 +678,9 @@ HideTexturePanel(TexturePanel *panel) WMUnmapWidget(panel->win); } + void -SetTexturePanelOkAction(TexturePanel *panel, WMAction *action, void *clientData) +SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action, void *clientData) { panel->okAction = action; panel->okData = clientData; @@ -430,517 +688,669 @@ SetTexturePanelOkAction(TexturePanel *panel, WMAction *action, void *clientData) void -SetTexturePanelCancelAction(TexturePanel *panel, WMAction *action, void *clientData) +SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clientData) { panel->cancelAction = action; panel->cancelData = clientData; } + void -SetTexturePanelTexture(TexturePanel *panel, char *texture) +SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture) { - char *parseString; - char *parseStringPosition; - char *enclosures = "( )"; - char *seperators = " ,\""; - char *filename; - - WMSetButtonSelected(panel->tsoliB, False); - WMSetButtonSelected(panel->tgradB, False); - WMSetButtonSelected(panel->tpixmB, False); - - parseString = wstrdup(texture); - parseStringPosition = parseString; - - parseStringPosition = strtok(parseStringPosition,seperators); - wwarning ("Parsing..."); - - while (parseStringPosition) { - - if (!strpbrk(parseStringPosition,enclosures)) { - if (strcasecmp(parseStringPosition,"solid") == 0) { - wwarning("Switch to solid"); - WMPerformButtonClick(panel->tsoliB); - - parseStringPosition = strtok(NULL,seperators); - - while (parseStringPosition) { - if (!strpbrk(parseStringPosition,enclosures)) { - WMSetColorWellColor(panel->scolorW,WMCreateNamedColor(WMWidgetScreen(panel->scolorW), parseStringPosition, True)); - } - parseStringPosition = strtok(NULL,seperators); - } - - } else if ((strstr(parseStringPosition,"pixmap")) && (strcasecmp(strstr(parseStringPosition,"pixmap"),"pixmap") == 0)) { - WMSetButtonSelected(panel->ptileB, False); - WMSetButtonSelected(panel->pscalB, False); - - WMPerformButtonClick(panel->tpixmB); - - if (tolower(*parseStringPosition) == 't') { - wwarning ("Switch to Tiled Pixmap"); - WMPerformButtonClick(panel->ptileB); - } else { - wwarning ("Switch to Scaled Pixmap"); - WMPerformButtonClick(panel->pscalB); - } - - - filename = NULL; - parseStringPosition = strtok(NULL,seperators); - do { - if (filename) filename = wstrappend(filename," "); - filename = wstrappend(filename,parseStringPosition); - parseStringPosition = strtok(NULL,seperators); - } while (!strstr(parseStringPosition,"rgb:")); - - WMSetTextFieldText(panel->pimagT, filename); - free(filename); - - /* parseStringPosition = strtok(NULL,seperators); */ - - WMSetColorWellColor(panel->pcolorW,WMCreateNamedColor(WMWidgetScreen(panel->scolorW), parseStringPosition, True)); - - } else if ((strstr(parseStringPosition,"gradient")) && (strcasecmp(strstr(parseStringPosition,"gradient"),"gradient") == 0)) { - WMSetButtonSelected(panel->ghorB, False); - WMSetButtonSelected(panel->gverB, False); - WMSetButtonSelected(panel->gdiaB, False); - - WMPerformButtonClick(panel->tgradB); - - if (strstr(parseStringPosition,"h")) { - WMPerformButtonClick(panel->ghorB); - } else if (strstr(parseStringPosition,"v")) { - WMPerformButtonClick(panel->gverB); - } else { - WMPerformButtonClick(panel->gdiaB); - } - - WMClearList(panel->gcolorLs); - - parseStringPosition = strtok(NULL,seperators); - while (parseStringPosition) { - if (!strpbrk(parseStringPosition,enclosures)) { - WMAddListItem(panel->gcolorLs, parseStringPosition); - WMSetColorWellColor(panel->gcolorW,WMCreateNamedColor(WMWidgetScreen(panel->scolorW), parseStringPosition, True)); - } - parseStringPosition = strtok(NULL,seperators); - } - } else { - wfatal("Unknown Texture Type"); - } - - while (parseStringPosition) { - parseStringPosition = strtok(NULL,seperators); - } - - } - - parseStringPosition = strtok(NULL,seperators); + WMScreen *scr = WMWidgetScreen(panel->win); + char *str, *type; + proplist_t p; + WMColor *color; + int i; + char buffer[64]; + int gradient = 0; + + WMSetTextFieldText(panel->nameT, name); + + if (!texture) + return; + + p = PLGetArrayElement(texture, 0); + if (!p) { + goto bad_texture; } - renderTextureButtons (panel); - free(parseString); + type = PLGetString(p); + + /*...............................................*/ + if (strcasecmp(type, "solid")==0) { + + WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID); + + p = PLGetArrayElement(texture, 1); + if (!p) { + goto bad_texture; + } + + str = PLGetString(p); + color = WMCreateNamedColor(scr, str, False); + + WMSetColorWellColor(panel->defcW, color); + + WMReleaseColor(color); + /*...............................................*/ + } else if (strcasecmp(type, "hgradient")==0 + || strcasecmp(type, "vgradient")==0 + || strcasecmp(type, "dgradient")==0) { + + WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT); + + p = PLGetArrayElement(texture, 1); + if (!p) { + goto bad_texture; + } + str = PLGetString(p); + color = WMCreateNamedColor(scr, str, False); + + WMSetColorWellColor(panel->tcol1W, color); + + WMReleaseColor(color); + + p = PLGetArrayElement(texture, 2); + if (!p) { + goto bad_texture; + } + str = PLGetString(p); + color = WMCreateNamedColor(scr, str, False); + + WMSetColorWellColor(panel->tcol2W, color); + + WMReleaseColor(color); + + gradient = type[0]; + /*...............................................*/ + } else if (strcasecmp(type, "thgradient")==0 + || strcasecmp(type, "tvgradient")==0 + || strcasecmp(type, "tdgradient")==0) { + + WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_TGRADIENT); + + /****** TODO: setador de textura apartir desse */ + gradient = type[1]; + /*...............................................*/ + } else if (strcasecmp(type, "mhgradient")==0 + || strcasecmp(type, "mvgradient")==0 + || strcasecmp(type, "mdgradient")==0) { + WMListItem *item; + + for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) { + item = WMGetListItem(panel->gcolL, i); + free(item->clientData); + } + WMClearList(panel->gcolL); + + WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT); + + p = PLGetArrayElement(texture, 1); + if (!p) { + goto bad_texture; + } + + str = PLGetString(p); + color = WMCreateNamedColor(scr, str, False); + + WMSetColorWellColor(panel->defcW, color); + + WMReleaseColor(color); + + for (i = 2; i < PLGetNumberOfElements(texture); i++) { + RColor *rgb; + XColor xcolor; + + p = PLGetArrayElement(texture, i); + if (!p) { + goto bad_texture; + } + str = PLGetString(p); + + XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap, + str, &xcolor); + + rgb = wmalloc(sizeof(RColor)); + rgb->red = xcolor.red >> 8; + rgb->green = xcolor.green >> 8; + rgb->blue = xcolor.blue >> 8; + sprintf(buffer, "%02x,%02x,%02x", rgb->red, rgb->green, rgb->blue); + + item = WMAddListItem(panel->gcolL, buffer); + item->clientData = rgb; + } + + sliderChangeCallback(panel->ghueS, panel); + + gradient = type[1]; + /*...............................................*/ + } else if (strcasecmp(type, "cpixmap")==0 + || strcasecmp(type, "spixmap")==0 + || strcasecmp(type, "mpixmap")==0 + || strcasecmp(type, "tpixmap")==0) { + + WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_PIXMAP); + + switch (toupper(type[0])) { + case 'C': + WMSetPopUpButtonSelectedItem(panel->arrP, PTYPE_CENTER); + break; + case 'S': + WMSetPopUpButtonSelectedItem(panel->arrP, PTYPE_SCALE); + break; + case 'M': + WMSetPopUpButtonSelectedItem(panel->arrP, PTYPE_MAXIMIZE); + break; + default: + case 'T': + WMSetPopUpButtonSelectedItem(panel->arrP, PTYPE_TILE); + break; + } + + WMSetTextFieldText(panel->imageT, + PLGetString(PLGetArrayElement(texture, 1))); + } + + changeTypeCallback(panel->typeP, panel); + + if (gradient > 0) { + updateGradButtons(panel); + + switch (toupper(gradient)) { + case 'H': + WMPerformButtonClick(panel->dirhB); + break; + case 'V': + WMPerformButtonClick(panel->dirvB); + break; + default: + case 'D': + WMPerformButtonClick(panel->dirdB); + break; + } + } + + return; + + bad_texture: + str = PLGetDescription(texture); + wwarning("error creating texture %s", str); + free(str); + } + char* -GetTexturePanelTextureString(TexturePanel *panel) -{ - char *colorString = NULL; - char *start = "( "; - char *finish = " )"; - char *seperator = ", "; - char *quote = "\""; - int i, listRows; - - colorString = wstrappend(colorString,start); - - if (WMGetButtonSelected(panel->tsoliB)) { - colorString = wstrappend(colorString,"solid"); - colorString = wstrappend(colorString,seperator); - colorString = wstrappend(colorString, quote); - colorString = wstrappend(colorString,WMGetColorWellRGBString(panel->scolorW)); - colorString = wstrappend(colorString, quote); - - } else if (WMGetButtonSelected(panel->tgradB)) { - listRows = WMGetListNumberOfRows(panel->gcolorLs); - - if (listRows > 2) { - colorString = wstrappend(colorString,"m"); - } - if (WMGetButtonSelected(panel->ghorB)) { - colorString = wstrappend(colorString,"hgradient"); - } else if (WMGetButtonSelected(panel->gverB)) { - colorString = wstrappend(colorString,"vgradient"); - } else { - colorString = wstrappend(colorString,"dgradient"); - } - - for (i=0; i < listRows; i++) { - colorString = wstrappend(colorString, seperator); - colorString = wstrappend(colorString, quote); - colorString = wstrappend(colorString, wstrdup(WMGetListItem(panel->gcolorLs, i)->text)); - colorString = wstrappend(colorString, quote); - } - } else if (WMGetButtonSelected(panel->tpixmB)) { - if (WMGetButtonSelected(panel->pscalB)) { - colorString = wstrappend(colorString,"spixmap"); - } else { - colorString = wstrappend(colorString,"tpixmap"); - } - colorString = wstrappend(colorString,seperator); - colorString = wstrappend(colorString, WMGetTextFieldText(panel->pimagT)); - colorString = wstrappend(colorString,seperator); - colorString = wstrappend(colorString, quote); - colorString = wstrappend(colorString, WMGetColorWellRGBString(panel->pcolorW)); - colorString = wstrappend(colorString, quote); - } - - colorString = wstrappend(colorString,finish); - - return colorString; -} - - -RImage* -RenderTexturePanelTexture(TexturePanel *panel, unsigned width, unsigned height) +GetTexturePanelTextureName(TexturePanel *panel) { - XColor color; - RContext *ctx; - RColor solidColor; - RColor **colors = NULL; - RImage *image=NULL, *fileImage; - WMScreen *scr; - WMColor *wellColor; - - int i, listRows, style; - - scr = WMWidgetScreen(panel->gcolorLs); - ctx = WMScreenRContext(scr); - - if (WMGetButtonSelected(panel->tsoliB)) { - - image = RCreateImage(width, height, 1); - wellColor = WMGetColorWellColor(panel->scolorW); - - solidColor.red = (WMRedComponentOfColor(wellColor) >> 8); - solidColor.green = (WMGreenComponentOfColor(wellColor) >> 8) ; - solidColor.blue = (WMBlueComponentOfColor(wellColor) >> 8); - solidColor.alpha = 0xff; - - WMReleaseColor(wellColor); - - RClearImage(image, &solidColor); - - } else if (WMGetButtonSelected(panel->tgradB)) { - - if (WMGetButtonSelected(panel->ghorB)) { - style = RGRD_HORIZONTAL; - } else if (WMGetButtonSelected(panel->gverB)) { - style = RGRD_VERTICAL; - } else { - style = RGRD_DIAGONAL; - } - - listRows = WMGetListNumberOfRows(panel->gcolorLs); - colors = wmalloc(sizeof(RColor*)*(listRows+1)); - - for (i=0; i < listRows; i++) { - if (!XParseColor(WMScreenDisplay(scr), ctx->cmap, - wstrdup(WMGetListItem(panel->gcolorLs, i)->text),&color)) { - wfatal("could not parse color \"%s\"\n", WMGetListItem(panel->gcolorLs, i)->text); - exit(1); - } else { - colors[i] = malloc(sizeof(RColor)); - colors[i]->red = color.red >> 8; - colors[i]->green = color.green >> 8; - colors[i]->blue = color.blue >> 8; - } - } - colors[i] = NULL; - - image = RRenderMultiGradient(width, height, colors, style); - - } else if (WMGetButtonSelected(panel->tpixmB)) { - - if (fopen(WMGetTextFieldText(panel->pimagT),"r")) { - - fileImage = RLoadImage(ctx, WMGetTextFieldText(panel->pimagT), 0); - if (WMGetButtonSelected(panel->pscalB)) { - image = RScaleImage(fileImage, width, height); - } else { - image = RMakeTiledImage(fileImage, width, height);; - } - } else { - wwarning ("Invalid File Name"); - return RCreateImage(1,1,1); - } - } - - return image; + return WMGetTextFieldText(panel->nameT); + } + + +proplist_t +GetTexturePanelTexture(TexturePanel *panel) +{ + proplist_t prop = NULL; + WMColor *color; + char *str, *str2; + char buff[32]; + int i; + + + switch (WMGetPopUpButtonSelectedItem(panel->typeP)) { + + case TYPE_SOLID: + color = WMGetColorWellColor(panel->defcW); + str = WMGetColorRGBDescription(color); + prop = PLMakeArrayFromElements(PLMakeString("solid"), + PLMakeString(str), NULL); + free(str); + + break; + + case TYPE_PIXMAP: + color = WMGetColorWellColor(panel->defcW); + str = WMGetColorRGBDescription(color); + + switch (WMGetPopUpButtonSelectedItem(panel->arrP)) { + case PTYPE_SCALE: + prop = PLMakeArrayFromElements(PLMakeString("spixmap"), + PLMakeString(panel->imageFile), + PLMakeString(str), NULL); + break; + case PTYPE_MAXIMIZE: + prop = PLMakeArrayFromElements(PLMakeString("mpixmap"), + PLMakeString(panel->imageFile), + PLMakeString(str), NULL); + break; + case PTYPE_CENTER: + prop = PLMakeArrayFromElements(PLMakeString("cpixmap"), + PLMakeString(panel->imageFile), + PLMakeString(str), NULL); + break; + case PTYPE_TILE: + prop = PLMakeArrayFromElements(PLMakeString("tpixmap"), + PLMakeString(panel->imageFile), + PLMakeString(str), NULL); + break; + } + free(str); + break; + + case TYPE_SGRADIENT: + color = WMGetColorWellColor(panel->tcol1W); + str = WMGetColorRGBDescription(color); + + color = WMGetColorWellColor(panel->tcol2W); + str2 = WMGetColorRGBDescription(color); + + if (WMGetButtonSelected(panel->dirdB)) { + prop = PLMakeArrayFromElements(PLMakeString("dgradient"), + PLMakeString(str), + PLMakeString(str2), NULL); + } else if (WMGetButtonSelected(panel->dirvB)) { + prop = PLMakeArrayFromElements(PLMakeString("vgradient"), + PLMakeString(str), + PLMakeString(str2), NULL); + } else { + prop = PLMakeArrayFromElements(PLMakeString("hgradient"), + PLMakeString(str), + PLMakeString(str2), NULL); + } + free(str); + free(str2); + break; + + case TYPE_GRADIENT: + color = WMGetColorWellColor(panel->defcW); + str = WMGetColorRGBDescription(color); + + if (WMGetButtonSelected(panel->dirdB)) { + prop = PLMakeArrayFromElements(PLMakeString("mdgradient"), + PLMakeString(str), NULL); + } else if (WMGetButtonSelected(panel->dirvB)) { + prop = PLMakeArrayFromElements(PLMakeString("mvgradient"), + PLMakeString(str), NULL); + } else { + prop = PLMakeArrayFromElements(PLMakeString("mhgradient"), + PLMakeString(str), NULL); + } + free(str); + + for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) { + RColor *rgb; + WMListItem *item; + + item = WMGetListItem(panel->gcolL, i); + + rgb = (RColor*)item->clientData; + + sprintf(buff, "#%02x%02x%02x", rgb->red, rgb->green, rgb->blue); + + PLAppendArrayElement(prop, PLMakeString(buff)); + } + break; + } + + + return prop; +} + + + +void +SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array) +{ + panel->pathList = array; +} + + + TexturePanel* -CreateTexturePanel(WMScreen *scr) +CreateTexturePanel(WMWindow *keyWindow) +//CreateTexturePanel(WMScreen *scr) { - RImage *image; - WMPixmap *icon; - WMColor *red; TexturePanel *panel; - RColor white,black; + WMScreen *scr = WMWidgetScreen(keyWindow); + + panel = wmalloc(sizeof(TexturePanel)); + memset(panel, 0, sizeof(TexturePanel)); + + panel->listFont = WMSystemFontOfSize(scr, 12); + + + panel->win = WMCreatePanelWithStyleForWindow(keyWindow, "texturePanel", + WMTitledWindowMask + |WMClosableWindowMask); + /* + panel->win = WMCreateWindowWithStyle(scr, "texturePanel", + WMTitledWindowMask + |WMClosableWindowMask); + */ + + WMResizeWidget(panel->win, 325, 423); + WMSetWindowTitle(panel->win, _("Texture Panel")); + + + /* texture name */ + panel->nameF = WMCreateFrame(panel->win); + WMResizeWidget(panel->nameF, 185, 50); + WMMoveWidget(panel->nameF, 15, 10); + WMSetFrameTitle(panel->nameF, _("Texture Name")); + + panel->nameT = WMCreateTextField(panel->nameF); + WMResizeWidget(panel->nameT, 160, 20); + WMMoveWidget(panel->nameT, 12, 18); + + WMMapSubwidgets(panel->nameF); + + /* texture types */ + panel->typeP = WMCreatePopUpButton(panel->win); + WMResizeWidget(panel->typeP, 185, 20); + WMMoveWidget(panel->typeP, 15, 65); + WMAddPopUpButtonItem(panel->typeP, _("Solid Color")); + WMAddPopUpButtonItem(panel->typeP, _("Gradient Texture")); + WMAddPopUpButtonItem(panel->typeP, _("Simple Gradient Texture")); + WMAddPopUpButtonItem(panel->typeP, _("Textured Gradient")); + WMAddPopUpButtonItem(panel->typeP, _("Image Texture")); + WMSetPopUpButtonSelectedItem(panel->typeP, 0); + WMSetPopUpButtonAction(panel->typeP, changeTypeCallback, panel); + + WMSetPopUpButtonItemEnabled(panel->typeP, TYPE_TGRADIENT, False); + + /* color */ + panel->defcF = WMCreateFrame(panel->win); + WMResizeWidget(panel->defcF, 100, 75); + WMMoveWidget(panel->defcF, 210, 10); + WMSetFrameTitle(panel->defcF, _("Default Color")); + + panel->defcW = WMCreateColorWell(panel->defcF); + WMResizeWidget(panel->defcW, 60, 45); + WMMoveWidget(panel->defcW, 20, 20); + + WMMapSubwidgets(panel->defcF); + + /****** Gradient ******/ + panel->gcolF = WMCreateFrame(panel->win); + WMResizeWidget(panel->gcolF, 295, 205); + WMMoveWidget(panel->gcolF, 15, 95); + WMSetFrameTitle(panel->gcolF, _("Gradient Colors")); + + panel->gcolL = WMCreateList(panel->gcolF); + WMResizeWidget(panel->gcolL, 130, 140); + WMMoveWidget(panel->gcolL, 10, 25); + WMHangData(panel->gcolL, panel); + WMSetListUserDrawProc(panel->gcolL, paintGradListItem); + WMSetListAction(panel->gcolL, gradClickCallback, panel); + + panel->gcolaB = WMCreateCommandButton(panel->gcolF); + WMResizeWidget(panel->gcolaB, 64, 24); + WMMoveWidget(panel->gcolaB, 10, 170); + WMSetButtonText(panel->gcolaB, _("Add")); + WMSetButtonAction(panel->gcolaB, gradAddCallback, panel); - white.red=255; - white.blue=255; - white.green=255; - white.alpha=255; - - black.red=0; - black.blue=0; - black.green=0; - black.alpha=0; - - panel = wmalloc(sizeof(_TexturePanel)); - memset(panel, 0, sizeof(_TexturePanel)); - red = WMCreateRGBColor(scr,100,100,100,True); - - panel->win = WMCreateWindow(scr, "textureBuilder"); - WMResizeWidget(panel->win, 275, 365); - WMSetWindowTitle(panel->win, "Texture Builder"); - - /***************** Generic stuff ****************/ - - panel->typeF = WMCreateFrame(panel->win); - WMResizeWidget(panel->typeF, 245, 80); - WMMoveWidget(panel->typeF, 15, 10); - WMSetFrameTitle(panel->typeF, "Texture Type"); - - panel->tsoliB = WMCreateButton(panel->typeF, WBTOnOff); - WMResizeWidget(panel->tsoliB, 48, 48); - WMMoveWidget(panel->tsoliB, 42, 20); - WMSetButtonImagePosition(panel->tsoliB, WIPImageOnly); - image = RGetImageFromXPMData(WMScreenRContext(scr), solid_xpm); - if (!image) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, image, 120); - RDestroyImage(image); - WMSetButtonImage(panel->tsoliB, icon); - WMReleasePixmap(icon); + panel->gcoldB = WMCreateCommandButton(panel->gcolF); + WMResizeWidget(panel->gcoldB, 64, 24); + WMMoveWidget(panel->gcoldB, 75, 170); + WMSetButtonText(panel->gcoldB, _("Delete")); + WMSetButtonAction(panel->gcoldB, gradDeleteCallback, panel); + +#if 0 + panel->gbriS = WMCreateSlider(panel->gcolF); + WMResizeWidget(panel->gbriS, 130, 16); + WMMoveWidget(panel->gbriS, 150, 25); + WMSetSliderKnobThickness(panel->gbriS, 8); + WMSetSliderMaxValue(panel->gbriS, 100); + WMSetSliderAction(panel->gbriS, sliderChangeCallback, panel); + { + WMPixmap *pixmap; + WMColor *color; + + pixmap = WMCreatePixmap(scr, 130, 16, WMScreenDepth(scr), False); + color = WMDarkGrayColor(scr); + XFillRectangle(WMScreenDisplay(scr), WMGetPixmapXID(pixmap), + WMColorGC(color), 0, 0, 130, 16); + WMReleaseColor(color); + color = WMWhiteColor(color); + WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(color), + panel->listFont, 2, + (16 - WMFontHeight(panel->listFont))/2 - 1, + "Brightness", 10); + WMSetSliderImage(panel->gbriS, pixmap); + WMReleasePixmap(pixmap); } - WMSetButtonAction(panel->tsoliB, buttonCallback, panel); - - panel->tgradB = WMCreateButton(panel->typeF, WBTOnOff); - WMGroupButtons(panel->tsoliB, panel->tgradB); - WMResizeWidget(panel->tgradB, 48, 48); - WMMoveWidget(panel->tgradB, 98, 20); - WMSetButtonImagePosition(panel->tgradB, WIPImageOnly); - image = RGetImageFromXPMData(WMScreenRContext(scr), gradient_xpm); - if (!image) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, image, 120); - RDestroyImage(image); - WMSetButtonImage(panel->tgradB, icon); - WMReleasePixmap(icon); + + panel->gconS = WMCreateSlider(panel->gcolF); + WMResizeWidget(panel->gconS, 130, 16); + WMMoveWidget(panel->gconS, 150, 50); + WMSetSliderKnobThickness(panel->gconS, 8); + WMSetSliderMaxValue(panel->gconS, 100); + WMSetSliderAction(panel->gconS, sliderChangeCallback, panel); + { + WMPixmap *pixmap; + WMColor *color; + + pixmap = WMCreatePixmap(scr, 130, 16, WMScreenDepth(scr), False); + color = WMDarkGrayColor(scr); + XFillRectangle(WMScreenDisplay(scr), WMGetPixmapXID(pixmap), + WMColorGC(color), 0, 0, 130, 16); + WMReleaseColor(color); + color = WMWhiteColor(scr); + WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(color), + panel->listFont, 2, + (16 - WMFontHeight(panel->listFont))/2 - 1, + "Contrast", 8); + WMSetSliderImage(panel->gconS, pixmap); + WMReleasePixmap(pixmap); } - WMSetButtonAction(panel->tgradB, buttonCallback, panel); - - panel->tpixmB = WMCreateButton(panel->typeF, WBTOnOff); - WMGroupButtons(panel->tsoliB, panel->tpixmB); - WMResizeWidget(panel->tpixmB, 48, 48); - WMMoveWidget(panel->tpixmB, 154, 20); - WMSetButtonImagePosition(panel->tpixmB, WIPImageOnly); - image = RGetImageFromXPMData(WMScreenRContext(scr), pixmap_xpm); - if (!image) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, image, 120); - RDestroyImage(image); - WMSetButtonImage(panel->tpixmB, icon); - WMReleasePixmap(icon); +#endif + panel->ghueS = WMCreateSlider(panel->gcolF); + WMResizeWidget(panel->ghueS, 130, 16); + WMMoveWidget(panel->ghueS, 150, 100); + WMSetSliderKnobThickness(panel->ghueS, 8); + WMSetSliderMaxValue(panel->ghueS, 359); + WMSetSliderAction(panel->ghueS, sliderChangeCallback, panel); + + panel->gsatS = WMCreateSlider(panel->gcolF); + WMResizeWidget(panel->gsatS, 130, 16); + WMMoveWidget(panel->gsatS, 150, 125); + WMSetSliderKnobThickness(panel->gsatS, 8); + WMSetSliderMaxValue(panel->gsatS, 255); + WMSetSliderAction(panel->gsatS, sliderChangeCallback, panel); + + panel->gvalS = WMCreateSlider(panel->gcolF); + WMResizeWidget(panel->gvalS, 130, 16); + WMMoveWidget(panel->gvalS, 150, 150); + WMSetSliderKnobThickness(panel->gvalS, 8); + WMSetSliderMaxValue(panel->gvalS, 255); + WMSetSliderAction(panel->gvalS, sliderChangeCallback, panel); + + + WMMapSubwidgets(panel->gcolF); + + /** Direction **/ + panel->dirF = WMCreateFrame(panel->win); + WMSetFrameTitle(panel->dirF, _("Direction")); + WMResizeWidget(panel->dirF, 295, 75); + WMMoveWidget(panel->dirF, 15, 305); + + panel->dirvB = WMCreateButton(panel->dirF, WBTOnOff); + WMSetButtonImagePosition(panel->dirvB, WIPImageOnly); + WMResizeWidget(panel->dirvB, 90, 40); + WMMoveWidget(panel->dirvB, 10, 20); + + panel->dirhB = WMCreateButton(panel->dirF, WBTOnOff); + WMSetButtonImagePosition(panel->dirhB, WIPImageOnly); + WMResizeWidget(panel->dirhB, 90, 40); + WMMoveWidget(panel->dirhB, 102, 20); + + panel->dirdB = WMCreateButton(panel->dirF, WBTOnOff); + WMSetButtonImagePosition(panel->dirdB, WIPImageOnly); + WMResizeWidget(panel->dirdB, 90, 40); + WMMoveWidget(panel->dirdB, 194, 20); + + WMGroupButtons(panel->dirvB, panel->dirhB); + WMGroupButtons(panel->dirvB, panel->dirdB); + + WMMapSubwidgets(panel->dirF); + + /****************** Textured Gradient ******************/ + panel->tcolF = WMCreateFrame(panel->win); + WMResizeWidget(panel->tcolF, 100, 135); + WMMoveWidget(panel->tcolF, 210, 10); + WMSetFrameTitle(panel->tcolF, _("Gradient")); + + panel->tcol1W = WMCreateColorWell(panel->tcolF); + WMResizeWidget(panel->tcol1W, 60, 45); + WMMoveWidget(panel->tcol1W, 20, 25); + WMAddNotificationObserver(colorWellObserver, panel, + WMColorWellDidChangeNotification, panel->tcol1W); + + panel->tcol2W = WMCreateColorWell(panel->tcolF); + WMResizeWidget(panel->tcol2W, 60, 45); + WMMoveWidget(panel->tcol2W, 20, 75); + WMAddNotificationObserver(colorWellObserver, panel, + WMColorWellDidChangeNotification, panel->tcol2W); + + /** Opacity */ + panel->topaF = WMCreateFrame(panel->win); + WMResizeWidget(panel->topaF, 185, 50); + WMMoveWidget(panel->topaF, 15, 95); + WMSetFrameTitle(panel->topaF, _("Gradient Opacity")); + + panel->topaS = WMCreateSlider(panel->topaF); + WMResizeWidget(panel->topaS, 155, 18); + WMMoveWidget(panel->topaS, 15, 20); + WMSetSliderMaxValue(panel->topaS, 255); + WMSetSliderValue(panel->topaS, 200); + WMMapSubwidgets(panel->topaF); + + { + WMPixmap *pixmap; + Pixmap p; + WMColor *color; + + pixmap = WMCreatePixmap(scr, 155, 18, WMScreenDepth(scr), False); + p = WMGetPixmapXID(pixmap); + + color = WMDarkGrayColor(scr); + XFillRectangle(WMScreenDisplay(scr), p, WMColorGC(color), + 0, 0, 155, 18); + WMReleaseColor(color); + + color = WMWhiteColor(scr); + WMDrawString(scr, p, WMColorGC(color), panel->listFont, + 2, 1, "0%", 2); + WMDrawString(scr, p, WMColorGC(color), panel->listFont, + 153 - WMWidthOfString(panel->listFont, "100%", 4), 1, + "100%", 4); + WMReleaseColor(color); + + WMSetSliderImage(panel->topaS, pixmap); + WMReleasePixmap(pixmap); } - WMSetButtonAction(panel->tpixmB, buttonCallback, panel); - + + WMMapSubwidgets(panel->tcolF); + + /****************** Image ******************/ + panel->imageF = WMCreateFrame(panel->win); + WMResizeWidget(panel->imageF, 295, 150); + WMMoveWidget(panel->imageF, 15, 150); + WMSetFrameTitle(panel->imageF, _("Image")); + + panel->imageL = WMCreateLabel(panel->imageF); + WMSetLabelImagePosition(panel->imageL, WIPImageOnly); + + panel->imageT = WMCreateTextField(panel->imageF); + WMResizeWidget(panel->imageT, 90, 20); + WMMoveWidget(panel->imageT, 190, 25); + + panel->imageV = WMCreateScrollView(panel->imageF); + WMResizeWidget(panel->imageV, 165, 115); + WMMoveWidget(panel->imageV, 15, 20); + WMSetScrollViewRelief(panel->imageV, WRSunken); + WMSetScrollViewHasHorizontalScroller(panel->imageV, True); + WMSetScrollViewHasVerticalScroller(panel->imageV, True); + WMSetScrollViewContentView(panel->imageV, WMWidgetView(panel->imageL)); + + panel->browB = WMCreateCommandButton(panel->imageF); + WMResizeWidget(panel->browB, 90, 24); + WMMoveWidget(panel->browB, 190, 50); + WMSetButtonText(panel->browB, _("Browse...")); + WMSetButtonAction(panel->browB, browseImageCallback, panel); + + panel->dispB = WMCreateCommandButton(panel->imageF); + WMResizeWidget(panel->dispB, 90, 24); + WMMoveWidget(panel->dispB, 190, 80); + WMSetButtonText(panel->dispB, _("Show")); + + panel->arrP = WMCreatePopUpButton(panel->imageF); + WMResizeWidget(panel->arrP, 90, 20); + WMMoveWidget(panel->arrP, 190, 120); + WMAddPopUpButtonItem(panel->arrP, _("Tile")); + WMAddPopUpButtonItem(panel->arrP, _("Scale")); + WMAddPopUpButtonItem(panel->arrP, _("Center")); + WMAddPopUpButtonItem(panel->arrP, _("Maximize")); + WMSetPopUpButtonSelectedItem(panel->arrP, 0); + + WMMapSubwidgets(panel->imageF); + + /****/ + panel->okB = WMCreateCommandButton(panel->win); - WMResizeWidget(panel->okB, 70, 28); - WMMoveWidget(panel->okB, 110, 325); - WMSetButtonText(panel->okB, "OK"); - WMSetButtonAction(panel->okB,buttonCallback,panel); - - panel->cancB = WMCreateCommandButton(panel->win); - WMResizeWidget(panel->cancB, 70, 28); - WMMoveWidget(panel->cancB, 190, 325); - WMSetButtonText(panel->cancB, "Cancel"); - WMSetButtonAction(panel->cancB,buttonCallback,panel); - - WMMapSubwidgets(panel->typeF); - - /***************** Solid *****************/ - panel->scolorF = WMCreateFrame(panel->win); - WMResizeWidget(panel->scolorF, 245, 125); - WMMoveWidget(panel->scolorF, 15, 140); - WMSetFrameTitle(panel->scolorF, "Color"); - - panel->scolorW = WMCreateColorWell(panel->scolorF); - WMResizeWidget(panel->scolorW, 60, 45); - WMMoveWidget(panel->scolorW, 95, 40); - WMSetColorWellColor(panel->scolorW,WMCreateRGBColor(scr, 0xddff, 0xddff, 0, True)); - - WMMapSubwidgets(panel->scolorF); - - /***************** Gradient *****************/ - panel->gcolorF = WMCreateFrame(panel->win); - WMResizeWidget(panel->gcolorF, 245, 145); - WMMoveWidget(panel->gcolorF, 15, 95); - WMSetFrameTitle(panel->gcolorF, "Colors"); - - panel->gcolorLs = WMCreateList(panel->gcolorF); - WMResizeWidget(panel->gcolorLs, 120, 84); - WMMoveWidget(panel->gcolorLs, 20, 20); - - WMSetListUserDrawProc(panel->gcolorLs, paintListItem); - - WMAddListItem(panel->gcolorLs, "rgb:ff/ff/ff"); - WMAddListItem(panel->gcolorLs, "rgb:00/00/ff"); - - panel->gcolorW = WMCreateColorWell(panel->gcolorF); - WMResizeWidget(panel->gcolorW, 60, 45); - WMMoveWidget(panel->gcolorW, 160, 40); - WMSetColorWellColor(panel->gcolorW,WMCreateRGBColor(scr, 0xffff, 0, 0, True)); - - panel->gremB = WMCreateCommandButton(panel->gcolorF); - WMResizeWidget(panel->gremB, 64, 24); - WMMoveWidget(panel->gremB, 20, 110); - WMSetButtonText(panel->gremB, "Remove"); - WMSetButtonAction(panel->gremB,(WMAction*)buttonCallback,panel); - - panel->gupdB = WMCreateCommandButton(panel->gcolorF); - WMResizeWidget(panel->gupdB, 64, 24); - WMMoveWidget(panel->gupdB, 90, 110); - WMSetButtonText(panel->gupdB, "Update"); - WMSetButtonAction(panel->gupdB,(WMAction*)buttonCallback,panel); - - panel->gaddB = WMCreateCommandButton(panel->gcolorF); - WMResizeWidget(panel->gaddB, 64, 24); - WMMoveWidget(panel->gaddB, 160, 110); - WMSetButtonText(panel->gaddB, "Add"); - WMSetButtonAction(panel->gaddB,(WMAction*)buttonCallback,panel); - WMMapSubwidgets(panel->gcolorF); - - panel->gdirF = WMCreateFrame(panel->win); - WMResizeWidget(panel->gdirF, 245, 65); - WMMoveWidget(panel->gdirF, 15, 245); - WMSetFrameTitle(panel->gdirF, "Direction"); - - panel->ghorB = WMCreateButton(panel->gdirF, WBTOnOff); - WMResizeWidget(panel->ghorB, 64, 34); - WMMoveWidget(panel->ghorB, 20, 20); - WMSetButtonImagePosition(panel->ghorB, WIPImageOnly); - WMPerformButtonClick(panel->ghorB); - - - panel->gverB = WMCreateButton(panel->gdirF, WBTOnOff); - WMResizeWidget(panel->gverB, 64, 34); - WMMoveWidget(panel->gverB, 90, 20); - WMSetButtonImagePosition(panel->gverB, WIPImageOnly); - WMGroupButtons(panel->ghorB, panel->gverB); - - panel->gdiaB = WMCreateButton(panel->gdirF, WBTOnOff); - WMResizeWidget(panel->gdiaB, 64, 34); - WMMoveWidget(panel->gdiaB, 160, 20); - WMSetButtonImagePosition(panel->gdiaB, WIPImageOnly); - WMGroupButtons(panel->ghorB, panel->gdiaB); - - WMMapSubwidgets(panel->gdirF); - - /***************** Pixmap *****************/ - panel->pimagF = WMCreateFrame(panel->win); - WMResizeWidget(panel->pimagF, 245, 140); - WMMoveWidget(panel->pimagF, 15, 96); - WMSetFrameTitle(panel->pimagF, "Image"); - - panel->pimagL = WMCreateLabel(panel->pimagF); - WMResizeWidget(panel->pimagL, 220, 83); - WMMoveWidget(panel->pimagL, 10, 20); - WMSetLabelImagePosition(panel->pimagL, WIPImageOnly); - - panel->pimagT = WMCreateTextField(panel->pimagF); - WMResizeWidget(panel->pimagT, 147, 20); - WMMoveWidget(panel->pimagT, 10, 110); - - panel->pbrowB = WMCreateCommandButton(panel->pimagF); - WMResizeWidget(panel->pbrowB, 68, 24); - WMMoveWidget(panel->pbrowB, 165, 108); - WMSetButtonText(panel->pbrowB, "Browse..."); - WMSetButtonAction(panel->pbrowB,buttonCallback,panel); - - WMMapSubwidgets(panel->pimagF); - - panel->pcolorF = WMCreateFrame(panel->win); - WMResizeWidget(panel->pcolorF, 90, 75); - WMMoveWidget(panel->pcolorF, 15, 240); - WMSetFrameTitle(panel->pcolorF, "Color"); - - panel->pcolorW = WMCreateColorWell(panel->pcolorF); - WMResizeWidget(panel->pcolorW, 60, 45); - WMMoveWidget(panel->pcolorW, 15, 20); - WMSetColorWellColor(panel->pcolorW,WMCreateRGBColor(scr, 0x00, 0xddff, 0xffff, True)); - - - WMMapSubwidgets(panel->pcolorF); - - panel->pmodeF = WMCreateFrame(panel->win); - WMResizeWidget(panel->pmodeF, 145, 70); - WMMoveWidget(panel->pmodeF, 115, 245); - - panel->pscalB = WMCreateButton(panel->pmodeF, WBTOnOff); - WMResizeWidget(panel->pscalB, 54, 50); - WMMoveWidget(panel->pscalB, 10, 10); - WMSetButtonImagePosition(panel->pscalB, WIPImageOnly); - WMPerformButtonClick(panel->pscalB); - - image = RGetImageFromXPMData(WMScreenRContext(scr), scaled_xpm); - if (!image) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, image, 120); - RDestroyImage(image); - WMSetButtonImage(panel->pscalB, icon); - WMReleasePixmap(icon); - } - - panel->ptileB = WMCreateButton(panel->pmodeF, WBTOnOff); - WMResizeWidget(panel->ptileB, 54, 50); - WMMoveWidget(panel->ptileB, 75, 10); - WMSetButtonImagePosition(panel->ptileB, WIPImageOnly); - image = RGetImageFromXPMData(WMScreenRContext(scr), tiled_xpm); - if (!image) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, image, 120); - RDestroyImage(image); - WMSetButtonImage(panel->ptileB, icon); - WMReleasePixmap(icon); - } - WMGroupButtons(panel->pscalB, panel->ptileB); - - WMMapSubwidgets(panel->pmodeF); + WMResizeWidget(panel->okB, 84, 24); + WMMoveWidget(panel->okB, 225, 390); + WMSetButtonText(panel->okB, _("OK")); + WMSetButtonAction(panel->okB, buttonCallback, panel); + panel->cancelB = WMCreateCommandButton(panel->win); + WMResizeWidget(panel->cancelB, 84, 24); + WMMoveWidget(panel->cancelB, 130, 390); + WMSetButtonText(panel->cancelB, _("Cancel")); + WMSetButtonAction(panel->cancelB, buttonCallback, panel); + + WMMapWidget(panel->nameF); + WMMapWidget(panel->typeP); + WMMapWidget(panel->okB); + WMMapWidget(panel->cancelB); + + WMUnmapWidget(panel->arrP); + WMRealizeWidget(panel->win); - WMMapSubwidgets(panel->win); - - WMPerformButtonClick(panel->tsoliB); - - WMMapWidget(panel->win); - - renderTextureButtons (panel); - - - /* register notification observers */ - WMAddNotificationObserver(notificationObserver, panel, - WMTextDidChangeNotification, - panel->pimagT); - + + panel->currentType = -1; + + panel->sectionParts[TYPE_SOLID][0] = panel->defcF; + + panel->sectionParts[TYPE_GRADIENT][0] = panel->defcF; + panel->sectionParts[TYPE_GRADIENT][1] = panel->gcolF; + panel->sectionParts[TYPE_GRADIENT][2] = panel->dirF; + + panel->sectionParts[TYPE_SGRADIENT][0] = panel->tcolF; + panel->sectionParts[TYPE_SGRADIENT][1] = panel->dirF; + + panel->sectionParts[TYPE_TGRADIENT][0] = panel->tcolF; + panel->sectionParts[TYPE_TGRADIENT][1] = panel->dirF; + panel->sectionParts[TYPE_TGRADIENT][2] = panel->imageF; + panel->sectionParts[TYPE_TGRADIENT][3] = panel->topaF; + panel->sectionParts[TYPE_TGRADIENT][4] = panel->arrP; + + panel->sectionParts[TYPE_PIXMAP][0] = panel->defcF; + panel->sectionParts[TYPE_PIXMAP][1] = panel->imageF; + panel->sectionParts[TYPE_PIXMAP][2] = panel->arrP; + + + /* setup for first time */ + + changeTypeCallback(panel->typeP, panel); + + sliderChangeCallback(panel->ghueS, panel); + sliderChangeCallback(panel->gsatS, panel); + return panel; } @@ -952,11 +1362,13 @@ CreateTexturePanel(WMScreen *scr) *-------------------------------------------------------------------------- */ -#ifdef test +#if 0 char *ProgName = "test"; -void testOKButton(WMWidget *self, void *data){ +void +testOKButton(WMWidget *self, void *data) +{ char *test; Display *dpy; Window win; @@ -964,7 +1376,7 @@ void testOKButton(WMWidget *self, void *data){ RImage *image; TexturePanel *panel = (TexturePanel*)data; - test = GetTexturePanelTextureString(panel); +// test = GetTexturePanelTextureString(panel); wwarning(test); @@ -974,17 +1386,17 @@ void testOKButton(WMWidget *self, void *data){ XMapRaised(dpy, win); XFlush(dpy); - image = RenderTexturePanelTexture(panel, 250, 250); + // image = RenderTexturePanelTexture(panel, 250, 250); RConvertImage(WMScreenRContext(WMWidgetScreen(panel->okB)), image, &pix); XCopyArea(dpy, pix, win, (WMScreenRContext(WMWidgetScreen(panel->okB)))->copy_gc, 0, 0, image->width, image->height, 0, 0); - SetTexturePanelTexture(panel, test); free (test); } + void testCancelButton(WMWidget *self, void *data){ wwarning("Exiting test...."); exit(0); @@ -1012,16 +1424,17 @@ int main(int argc, char **argv) } scr = WMCreateSimpleApplicationScreen(dpy); - + panel = CreateTexturePanel(scr); - + SetTexturePanelOkAction(panel,(WMAction*)testOKButton,panel); SetTexturePanelCancelAction(panel,(WMAction*)testCancelButton,panel); - + + SetTexturePanelTexture(panel, "pinky", + PLGetProplistWithDescription("(mdgradient, pink, red, blue, yellow)")); + ShowTexturePanel(panel); - - SetTexturePanelTexture(panel," ( tpixmap, ballot box.xpm, \"rgb:ff/de/ff\" ) "); - + WMScreenMainLoop(scr); return 0; } diff --git a/WPrefs.app/TexturePanel.h b/WPrefs.app/TexturePanel.h index fe0d6ad8..57ceea92 100644 --- a/WPrefs.app/TexturePanel.h +++ b/WPrefs.app/TexturePanel.h @@ -28,8 +28,7 @@ typedef struct _TexturePanel TexturePanel; - -TexturePanel *CreateTexturePanel(WMScreen *scr); +TexturePanel *CreateTexturePanel(WMWindow *keyWindow); void DestroyTexturePanel(TexturePanel *panel); @@ -37,19 +36,24 @@ void ShowTexturePanel(TexturePanel *panel); void HideTexturePanel(TexturePanel *panel); -void SetTexturePanelTexture(TexturePanel *panel, char *texture); +void SetTexturePanelTexture(TexturePanel *panel, char *name, + proplist_t texture); -char *GetTexturePanelTextureString(TexturePanel *panel); + +char *GetTexturePanelTextureName(TexturePanel *panel); + +proplist_t GetTexturePanelTexture(TexturePanel *panel); RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width, unsigned height); -void SetTexturePanelOkAction(TexturePanel *panel, WMAction *action, +void SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action, void *clientData); -void SetTexturePanelCancelAction(TexturePanel *panel, WMAction *action, +void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clientData); +void SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array); #endif diff --git a/WPrefs.app/WPrefs.c b/WPrefs.app/WPrefs.c index fec14e11..18664cb5 100644 --- a/WPrefs.app/WPrefs.c +++ b/WPrefs.app/WPrefs.c @@ -518,8 +518,9 @@ Initialize(WMScreen *scr) #endif InitKeyboardShortcuts(scr, WPrefs.win); InitMouseSettings(scr, WPrefs.win); -#ifdef not_yet_fully_implemented + InitAppearance(scr, WPrefs.win); +#ifdef not_yet_fully_implemented InitText(scr, WPrefs.win); InitThemes(scr, WPrefs.win); diff --git a/WPrefs.app/WPrefs.h b/WPrefs.app/WPrefs.h index 6df8bc05..d91dc541 100644 --- a/WPrefs.app/WPrefs.h +++ b/WPrefs.app/WPrefs.h @@ -42,7 +42,7 @@ /****/ -#define WVERSION "0.20" +#define WVERSION "0.30" #define WMVERSION "0.51.x" diff --git a/WPrefs.app/main.c b/WPrefs.app/main.c index 18ec706a..fc7e8870 100644 --- a/WPrefs.app/main.c +++ b/WPrefs.app/main.c @@ -165,7 +165,7 @@ main(int argc, char **argv) wfatal(_("could not open display %s"), XDisplayName(display_name)); exit(0); } -#if 0 +#if 1 XSynchronize(dpy, 1); #endif scr = WMCreateScreen(dpy, DefaultScreen(dpy)); diff --git a/WPrefs.app/po/Makefile.am b/WPrefs.app/po/Makefile.am index 199d1f83..486b0a13 100644 --- a/WPrefs.app/po/Makefile.am +++ b/WPrefs.app/po/Makefile.am @@ -45,15 +45,15 @@ WPrefs.pot: $(POTFILES) install-data-local: $(CATALOGS) - $(mkinstalldirs) $(nlsdir) - chmod 755 $(nlsdir) + $(mkinstalldirs) $(DESTDIR)$(nlsdir) + chmod 755 $(DESTDIR)$(nlsdir) for n in $(CATALOGS) __DuMmY ; do \ if test "$$n" -a "$$n" != "__DuMmY" ; then \ l=`basename $$n .mo`; \ - $(mkinstalldirs) $(nlsdir)/$$l/LC_MESSAGES; \ - chmod 755 $(nlsdir)/$$l; \ - chmod 755 $(nlsdir)/$$l/LC_MESSAGES; \ - $(INSTALL_DATA) -m 644 $$n $(nlsdir)/$$l/LC_MESSAGES/WPrefs.mo; \ + $(mkinstalldirs) $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + $(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES/WPrefs.mo; \ fi; \ done diff --git a/WPrefs.app/po/Makefile.in b/WPrefs.app/po/Makefile.in index 9f3f4ff7..da0eecb9 100644 --- a/WPrefs.app/po/Makefile.in +++ b/WPrefs.app/po/Makefile.in @@ -219,15 +219,15 @@ WPrefs.pot: $(POTFILES) fi install-data-local: $(CATALOGS) - $(mkinstalldirs) $(nlsdir) - chmod 755 $(nlsdir) + $(mkinstalldirs) $(DESTDIR)$(nlsdir) + chmod 755 $(DESTDIR)$(nlsdir) for n in $(CATALOGS) __DuMmY ; do \ if test "$$n" -a "$$n" != "__DuMmY" ; then \ l=`basename $$n .mo`; \ - $(mkinstalldirs) $(nlsdir)/$$l/LC_MESSAGES; \ - chmod 755 $(nlsdir)/$$l; \ - chmod 755 $(nlsdir)/$$l/LC_MESSAGES; \ - $(INSTALL_DATA) -m 644 $$n $(nlsdir)/$$l/LC_MESSAGES/WPrefs.mo; \ + $(mkinstalldirs) $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + $(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES/WPrefs.mo; \ fi; \ done diff --git a/WPrefs.app/tiff/Makefile.am b/WPrefs.app/tiff/Makefile.am index 1ddbd4b3..b9b7cb6d 100644 --- a/WPrefs.app/tiff/Makefile.am +++ b/WPrefs.app/tiff/Makefile.am @@ -44,7 +44,10 @@ tiffdata_DATA = \ speed3s.tiff \ speed4.tiff \ speed4s.tiff \ + tdel.tiff \ + tedit.tiff \ temp.tiff \ + textr.tiff \ theme.tiff \ timer0.tiff \ timer0s.tiff \ @@ -58,6 +61,7 @@ tiffdata_DATA = \ timer4s.tiff \ timer5.tiff \ timer5s.tiff \ + tnew.tiff \ whandling.tiff \ windowfocus.tiff \ workspace.tiff \ diff --git a/WPrefs.app/tiff/Makefile.in b/WPrefs.app/tiff/Makefile.in index 928da52c..bd7220ba 100644 --- a/WPrefs.app/tiff/Makefile.in +++ b/WPrefs.app/tiff/Makefile.in @@ -89,7 +89,7 @@ wprefsdir = @wprefsdir@ tiffdatadir = $(wprefsdir)/tiff -tiffdata_DATA = advancetonewworkspace.tiff animations.tiff appearance.tiff clip.tiff configs.tiff cycleworkspaces.tiff dock.tiff dontlinkworkspaces.tiff ergonomic.tiff ergowood.tiff expert.tiff fonts.tiff iconprefs.tiff keyboard.tiff keyboardprefs.tiff keyshortcuts.tiff menualign1.tiff menualign2.tiff menuprefs.tiff menus.tiff minimouseleft.tiff minimousemiddle.tiff minimouseright.tiff miscprefs2.tiff moreanim.tiff mousesettings.tiff mousespeed.tiff newstyle.tiff nonopaque.tiff oldstyle.tiff opaque.tiff paths.tiff sound.tiff speed0.tiff speed0s.tiff speed1.tiff speed1s.tiff speed2.tiff speed2s.tiff speed3.tiff speed3s.tiff speed4.tiff speed4s.tiff temp.tiff theme.tiff timer0.tiff timer0s.tiff timer1.tiff timer1s.tiff timer2.tiff timer2s.tiff timer3.tiff timer3s.tiff timer4.tiff timer4s.tiff timer5.tiff timer5s.tiff whandling.tiff windowfocus.tiff workspace.tiff xis.tiff +tiffdata_DATA = advancetonewworkspace.tiff animations.tiff appearance.tiff clip.tiff configs.tiff cycleworkspaces.tiff dock.tiff dontlinkworkspaces.tiff ergonomic.tiff ergowood.tiff expert.tiff fonts.tiff iconprefs.tiff keyboard.tiff keyboardprefs.tiff keyshortcuts.tiff menualign1.tiff menualign2.tiff menuprefs.tiff menus.tiff minimouseleft.tiff minimousemiddle.tiff minimouseright.tiff miscprefs2.tiff moreanim.tiff mousesettings.tiff mousespeed.tiff newstyle.tiff nonopaque.tiff oldstyle.tiff opaque.tiff paths.tiff sound.tiff speed0.tiff speed0s.tiff speed1.tiff speed1s.tiff speed2.tiff speed2s.tiff speed3.tiff speed3s.tiff speed4.tiff speed4s.tiff tdel.tiff tedit.tiff temp.tiff textr.tiff theme.tiff timer0.tiff timer0s.tiff timer1.tiff timer1s.tiff timer2.tiff timer2s.tiff timer3.tiff timer3s.tiff timer4.tiff timer4s.tiff timer5.tiff timer5s.tiff tnew.tiff whandling.tiff windowfocus.tiff workspace.tiff xis.tiff EXTRA_DIST = $(tiffdata_DATA) diff --git a/WPrefs.app/tiff/tdel.tiff b/WPrefs.app/tiff/tdel.tiff new file mode 100644 index 00000000..58201d5f Binary files /dev/null and b/WPrefs.app/tiff/tdel.tiff differ diff --git a/WPrefs.app/tiff/tedit.tiff b/WPrefs.app/tiff/tedit.tiff new file mode 100644 index 00000000..07761a59 Binary files /dev/null and b/WPrefs.app/tiff/tedit.tiff differ diff --git a/WPrefs.app/tiff/textr.tiff b/WPrefs.app/tiff/textr.tiff new file mode 100644 index 00000000..de3a31ec Binary files /dev/null and b/WPrefs.app/tiff/textr.tiff differ diff --git a/WPrefs.app/tiff/tnew.tiff b/WPrefs.app/tiff/tnew.tiff new file mode 100644 index 00000000..f11aa8dc Binary files /dev/null and b/WPrefs.app/tiff/tnew.tiff differ diff --git a/acconfig.h b/acconfig.h index 59c0efa7..03010d18 100644 --- a/acconfig.h +++ b/acconfig.h @@ -78,3 +78,6 @@ /* the place where the configuration is stored * defined by configure */ #undef SYSCONFDIR + +/* whether XKB language MODELOCK should be enabled */ +#undef XKB_MODELOCK diff --git a/configure b/configure index 06da9ea9..6944a7cf 100755 --- a/configure +++ b/configure @@ -751,7 +751,7 @@ fi PACKAGE=WindowMaker -VERSION=0.51.2 +VERSION=0.52.0 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -3939,7 +3939,10 @@ fi # Check whether --enable-modelock or --disable-modelock was given. if test "${enable_modelock+set}" = set; then enableval="$enable_modelock" - X_CFLAGS="$X_CFLAGS -DXKB_MODELOCK" + cat >> confdefs.h <<\EOF +#define XKB_MODELOCK 1 +EOF + fi @@ -3959,7 +3962,7 @@ added_xext=no if test "$shape" = yes; then echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6 -echo "configure:3963: checking for XShapeSelectInput in -lXext" >&5 +echo "configure:3966: checking for XShapeSelectInput in -lXext" >&5 ac_lib_var=`echo Xext'_'XShapeSelectInput | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3967,7 +3970,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext $XLFLAGS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4019,7 +4022,7 @@ fi if test "$shm" = yes; then echo $ac_n "checking for XShmAttach in -lXext""... $ac_c" 1>&6 -echo "configure:4023: checking for XShmAttach in -lXext" >&5 +echo "configure:4026: checking for XShmAttach in -lXext" >&5 ac_lib_var=`echo Xext'_'XShmAttach | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4027,7 +4030,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext $XLFLAGS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4062,12 +4065,12 @@ fi if test "$ok" = yes; then echo $ac_n "checking for shmget""... $ac_c" 1>&6 -echo "configure:4066: checking for shmget" >&5 +echo "configure:4069: checking for shmget" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmget'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmget=yes" else @@ -4139,7 +4142,7 @@ LIBPL="" LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for PLGetString in -lPropList""... $ac_c" 1>&6 -echo "configure:4143: checking for PLGetString in -lPropList" >&5 +echo "configure:4146: checking for PLGetString in -lPropList" >&5 ac_lib_var=`echo PropList'_'PLGetString | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4147,7 +4150,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lPropList $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4187,17 +4190,17 @@ CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $inc_search_path" ac_safe=`echo "proplist.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for proplist.h""... $ac_c" 1>&6 -echo "configure:4191: checking for proplist.h" >&5 +echo "configure:4194: checking for proplist.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4265,7 +4268,7 @@ if test "$xpm" = yes; then LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for XpmCreatePixmapFromData in -lXpm""... $ac_c" 1>&6 -echo "configure:4269: checking for XpmCreatePixmapFromData in -lXpm" >&5 +echo "configure:4272: checking for XpmCreatePixmapFromData in -lXpm" >&5 ac_lib_var=`echo Xpm'_'XpmCreatePixmapFromData | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4273,7 +4276,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXpm $XLFLAGS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4314,17 +4317,17 @@ CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $inc_search_path" ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6 -echo "configure:4318: checking for X11/xpm.h" >&5 +echo "configure:4321: checking for X11/xpm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4331: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4386,7 +4389,7 @@ if test "$png" = yes ; then LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for png_get_valid in -lpng""... $ac_c" 1>&6 -echo "configure:4390: checking for png_get_valid in -lpng" >&5 +echo "configure:4393: checking for png_get_valid in -lpng" >&5 ac_lib_var=`echo png'_'png_get_valid | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4394,7 +4397,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng -lz -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4435,17 +4438,17 @@ CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $inc_search_path" ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for png.h""... $ac_c" 1>&6 -echo "configure:4439: checking for png.h" >&5 +echo "configure:4442: checking for png.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4481,6 +4484,7 @@ fi jpeg=yes +ljpeg="" # Check whether --enable-jpeg or --disable-jpeg was given. if test "${enable_jpeg+set}" = set; then enableval="$enable_jpeg" @@ -4495,7 +4499,7 @@ if test "$jpeg" = yes; then LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for jpeg_destroy_compress in -ljpeg""... $ac_c" 1>&6 -echo "configure:4499: checking for jpeg_destroy_compress in -ljpeg" >&5 +echo "configure:4503: checking for jpeg_destroy_compress in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_destroy_compress | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4503,7 +4507,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4539,22 +4543,25 @@ LDFLAGS="$LDFLAGS_old" if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = xyes; then + + ljpeg="-ljpeg" + CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $inc_search_path" ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6 -echo "configure:4548: checking for jpeglib.h" >&5 +echo "configure:4555: checking for jpeglib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4605,7 +4612,7 @@ if test "$gif" = yes; then LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for DGifOpenFileName in -lungif""... $ac_c" 1>&6 -echo "configure:4609: checking for DGifOpenFileName in -lungif" >&5 +echo "configure:4616: checking for DGifOpenFileName in -lungif" >&5 ac_lib_var=`echo ungif'_'DGifOpenFileName | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4613,7 +4620,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lungif $XLFLAGS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4655,7 +4662,7 @@ LDFLAGS="$LDFLAGS_old" LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for DGifOpenFileName in -lgif""... $ac_c" 1>&6 -echo "configure:4659: checking for DGifOpenFileName in -lgif" >&5 +echo "configure:4666: checking for DGifOpenFileName in -lgif" >&5 ac_lib_var=`echo gif'_'DGifOpenFileName | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4663,7 +4670,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgif $XLFLAGS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4708,17 +4715,17 @@ CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $inc_search_path" ac_safe=`echo "gif_lib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for gif_lib.h""... $ac_c" 1>&6 -echo "configure:4712: checking for gif_lib.h" >&5 +echo "configure:4719: checking for gif_lib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4779,7 +4786,7 @@ if test "$tif" = yes; then LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for TIFFGetVersion in -ltiff""... $ac_c" 1>&6 -echo "configure:4783: checking for TIFFGetVersion in -ltiff" >&5 +echo "configure:4790: checking for TIFFGetVersion in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFGetVersion | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4787,7 +4794,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltiff -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4830,15 +4837,15 @@ LDFLAGS="$LDFLAGS_old" LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for TIFFGetVersion in -ltiff""... $ac_c" 1>&6 -echo "configure:4834: checking for TIFFGetVersion in -ltiff" >&5 +echo "configure:4841: checking for TIFFGetVersion in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFGetVersion | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-ltiff -lz -lm $LIBS" +LIBS="-ltiff $ljpeg -lz -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4882,15 +4889,15 @@ LDFLAGS="$LDFLAGS_old" LDFLAGS_old="$LDFLAGS" LDFLAGS="$LDFLAGS $lib_search_path" echo $ac_n "checking for TIFFGetVersion in -ltiff34""... $ac_c" 1>&6 -echo "configure:4886: checking for TIFFGetVersion in -ltiff34" >&5 +echo "configure:4893: checking for TIFFGetVersion in -ltiff34" >&5 ac_lib_var=`echo tiff34'_'TIFFGetVersion | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-ltiff34 -lm $LIBS" +LIBS="-ltiff34 $ljpeg -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4936,17 +4943,17 @@ CPPFLAGS_old="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $inc_search_path" ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6 -echo "configure:4940: checking for tiffio.h" >&5 +echo "configure:4947: checking for tiffio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4957: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* diff --git a/configure.in b/configure.in index efc8444f..5c92539a 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_INIT(src/WindowMaker.h) -AM_INIT_AUTOMAKE(WindowMaker, 0.51.2) +AM_INIT_AUTOMAKE(WindowMaker, 0.52.0) AM_PROG_LIBTOOL @@ -342,7 +342,7 @@ dnl XKB keyboard language status dnl ============================ AC_ARG_ENABLE(modelock, [ --enable-modelock XKB keyboard language status support], - X_CFLAGS="$X_CFLAGS -DXKB_MODELOCK",) + AC_DEFINE(XKB_MODELOCK)) @@ -496,6 +496,7 @@ fi dnl JPEG Support dnl ============ jpeg=yes +ljpeg="" AC_ARG_ENABLE(jpeg, [ --disable-jpeg disable JPEG support through libjpeg], jpeg=$enableval, jpeg=yes, jpeg=no) @@ -504,6 +505,9 @@ if test "$jpeg" = yes; then WM_CHECK_LIB(jpeg, jpeg_destroy_compress) if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = xyes; then + + ljpeg="-ljpeg" + WM_CHECK_HEADER(jpeglib.h) if test "x$ac_cv_header_jpeglib_h" = xyes; then GFXLIBS="$GFXLIBS -ljpeg" @@ -576,14 +580,14 @@ dnl Retry with zlib dnl unset ac_cv_lib_tiff_TIFFGetVersion if test "x$my_libname" = x; then - WM_CHECK_LIB(tiff, TIFFGetVersion, [-lz -lm]) + WM_CHECK_LIB(tiff, TIFFGetVersion, [$ljpeg -lz -lm]) if test "x$ac_cv_lib_tiff_TIFFGetVersion" = xyes; then my_libname="-ltiff -lz" fi fi if test "x$my_libname" = x; then - WM_CHECK_LIB(tiff34, TIFFGetVersion, [-lm]) + WM_CHECK_LIB(tiff34, TIFFGetVersion, [$ljpeg -lm]) if test "x$ac_cv_lib_tiff34_TIFFGetVersion" = xyes; then my_libname="-ltiff34" fi diff --git a/doc/Makefile.in b/doc/Makefile.in index 07f1bc14..c9c51a56 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -103,7 +103,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: diff --git a/po/Makefile.am b/po/Makefile.am index c7ed348e..f16e51fe 100644 --- a/po/Makefile.am +++ b/po/Makefile.am @@ -53,14 +53,14 @@ WindowMaker.pot: $(POTFILES) fi install-data-local: $(CATALOGS) - $(mkinstalldirs) $(nlsdir) - chmod 755 $(nlsdir) + $(mkinstalldirs) $(DESTDIR)$(nlsdir) + chmod 755 $(DESTDIR)$(nlsdir) for n in $(CATALOGS) __DuMmY ; do \ if test "$$n" -a "$$n" != "__DuMmY" ; then \ l=`basename $$n .mo`; \ - $(mkinstalldirs) $(nlsdir)/$$l/LC_MESSAGES; \ - chmod 755 $(nlsdir)/$$l; \ - chmod 755 $(nlsdir)/$$l/LC_MESSAGES; \ - $(INSTALL_DATA) -m 644 $$n $(nlsdir)/$$l/LC_MESSAGES/WindowMaker.mo; \ + $(mkinstalldirs) $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + $(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES/WindowMaker.mo; \ fi; \ done diff --git a/po/Makefile.in b/po/Makefile.in index 9a09cdce..365d71ec 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -113,7 +113,7 @@ DIST_COMMON = README Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: @@ -220,15 +220,15 @@ WindowMaker.pot: $(POTFILES) fi install-data-local: $(CATALOGS) - $(mkinstalldirs) $(nlsdir) - chmod 755 $(nlsdir) + $(mkinstalldirs) $(DESTDIR)$(nlsdir) + chmod 755 $(DESTDIR)$(nlsdir) for n in $(CATALOGS) __DuMmY ; do \ if test "$$n" -a "$$n" != "__DuMmY" ; then \ l=`basename $$n .mo`; \ - $(mkinstalldirs) $(nlsdir)/$$l/LC_MESSAGES; \ - chmod 755 $(nlsdir)/$$l; \ - chmod 755 $(nlsdir)/$$l/LC_MESSAGES; \ - $(INSTALL_DATA) -m 644 $$n $(nlsdir)/$$l/LC_MESSAGES/WindowMaker.mo; \ + $(mkinstalldirs) $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l; \ + chmod 755 $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \ + $(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES/WindowMaker.mo; \ fi; \ done diff --git a/src/Makefile.in b/src/Makefile.in index 5f306861..f47d4b93 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -139,7 +139,7 @@ wconfig.h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(wmaker_SOURCES) OBJECTS = $(wmaker_OBJECTS) diff --git a/src/config.h b/src/config.h index 6dfca6a7..109e9cb0 100644 --- a/src/config.h +++ b/src/config.h @@ -125,6 +125,9 @@ * defined by configure */ #define SYSCONFDIR "/usr/local/etc/WindowMaker" +/* whether XKB language MODELOCK should be enabled */ +/* #undef XKB_MODELOCK */ + /* Define if you have the atexit function. */ #define HAVE_ATEXIT 1 @@ -174,5 +177,5 @@ #define PACKAGE "WindowMaker" /* Version number of package */ -#define VERSION "0.51.2" +#define VERSION "0.52.0" diff --git a/src/config.h.in b/src/config.h.in index 0aea7318..3746f8af 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -124,6 +124,9 @@ * defined by configure */ #undef SYSCONFDIR +/* whether XKB language MODELOCK should be enabled */ +#undef XKB_MODELOCK + /* Define if you have the atexit function. */ #undef HAVE_ATEXIT diff --git a/src/dockedapp.c b/src/dockedapp.c index 105916e9..ea4d6ec4 100644 --- a/src/dockedapp.c +++ b/src/dockedapp.c @@ -66,10 +66,12 @@ typedef struct _AppSettingsPanel { WMButton *browseBtn; WMButton *autoLaunchBtn; - + WMButton *okBtn; WMButton *cancelBtn; + Window parent; + /* kluge */ unsigned int destroyed:1; unsigned int choosingIcon:1; @@ -392,6 +394,8 @@ ShowDockAppSettingsPanel(WAppIcon *aicon) panel->wwin->client_leader = WMWidgetXID(panel->win); + panel->parent = parent; + WMMapWidget(panel->win); wWindowMap(panel->wwin); @@ -421,10 +425,10 @@ DestroyDockAppSettingsPanel(AppSettingsPanel *panel) WMDestroyWidget(panel->win); - XDestroyWindow(dpy, panel->wwin->client_win); - + XDestroyWindow(dpy, panel->parent); + panel->editedIcon->panel = NULL; - + panel->editedIcon->editing = 0; free(panel); diff --git a/src/event.c b/src/event.c index 5c9d8402..b9408fc6 100644 --- a/src/event.c +++ b/src/event.c @@ -639,11 +639,11 @@ handleButtonPress(XEvent *event) wSelectWindows(scr, event); } #ifdef MOUSE_WS_SWITCH - else if (event->xbutton.button==Button4) { + else if (event->xbutton.button==Button5) { wWorkspaceRelativeChange(scr, -1); - } else if (event->xbutton.button==Button5) { + } else if (event->xbutton.button==Button4) { wWorkspaceRelativeChange(scr, 1); diff --git a/src/misc.c b/src/misc.c index 03aef1f2..02cfc412 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1008,7 +1008,7 @@ ExpandOptions(WScreen *scr, char *cmdline) case 'W': sprintf(tmpbuf, "0x%x", - (unsigned int)scr->current_workspace); + (unsigned int)scr->current_workspace + 1); slen = strlen(tmpbuf); olen += slen; nout = realloc(out,olen); diff --git a/src/placement.c b/src/placement.c index 1c526d4c..f74201ee 100644 --- a/src/placement.c +++ b/src/placement.c @@ -196,7 +196,7 @@ PlaceIcon(WScreen *scr, int *x_ret, int *y_ret) #define INDEX(x,y) (((y)+1)*(sw+2) + (x) + 1) - for (level = WMNormalLevel; level >= WMDesktopLevel; level--) { + for (level = MAX_WINDOW_LEVELS-1; level >= WMDesktopLevel; level--) { obj = scr->stacking_list[level]; while (obj) { diff --git a/src/rootmenu.c b/src/rootmenu.c index 4704c5a5..86f27eed 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -1738,6 +1738,12 @@ OpenRootMenu(WScreen *scr, int x, int y, int keyboard) if (!menu) { /* menu hasn't changed or could not be read */ if (!scr->root_menu) { + wMessageDialog(scr, _("Error"), + _("The applications menu could not be loaded." + "Look at the console output for a detailed" + "description of the errors"), + _("OK"), NULL, NULL); + menu = makeDefaultMenu(scr); scr->root_menu = menu; } diff --git a/src/winmenu.c b/src/winmenu.c index d7625732..1dcc6699 100644 --- a/src/winmenu.c +++ b/src/winmenu.c @@ -169,8 +169,7 @@ execMenuCommand(WMenu *menu, WMenuEntry *entry) break; case MC_PROPERTIES: - if (wwin->wm_class || wwin->wm_instance) - wShowInspectorForWindow(wwin); + wShowInspectorForWindow(wwin); break; case MC_HIDE: @@ -581,7 +580,7 @@ updateMenuForWindow(WMenu *menu, WWindow *wwin) wMenuSetEnabled(menu, MC_DUMMY_MOVETO, !IS_OMNIPRESENT(wwin)); - if ((wwin->wm_class || wwin->wm_instance) && !wwin->flags.inspector_open) { + if (!wwin->flags.inspector_open) { wMenuSetEnabled(menu, MC_PROPERTIES, True); } else { wMenuSetEnabled(menu, MC_PROPERTIES, False); diff --git a/src/winspector.c b/src/winspector.c index 42392608..f3b0c8ce 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -1026,7 +1026,7 @@ createInspectorForWindow(WWindow *wwin) WMMoveWidget(panel->saveBtn, (2 * (btn_width + 10)) + 15, 310); WMSetButtonText(panel->saveBtn, _("Save")); WMResizeWidget(panel->saveBtn, btn_width, 28); - if (wPreferences.flags.noupdates) + if (wPreferences.flags.noupdates || !(wwin->wm_class || wwin->wm_instance)) WMSetButtonEnabled(panel->saveBtn, False); panel->applyBtn = WMCreateCommandButton(panel->win); @@ -1362,8 +1362,8 @@ createInspectorForWindow(WWindow *wwin) } else { int tmp; - if (wwin->transient_for!=None - && wwin->transient_for!=scr->root_win) + if ((wwin->transient_for!=None && wwin->transient_for!=scr->root_win) + || !wwin->wm_class || !wwin->wm_instance) tmp = False; else tmp = True; @@ -1380,7 +1380,12 @@ createInspectorForWindow(WWindow *wwin) else WMSetButtonEnabled(panel->attrChk[3], True); + + if (!wwin->wm_class && !wwin->wm_instance) { + WMSetPopUpButtonItemEnabled(panel->pagePopUp, 0, False); + } + WMRealizeWidget(panel->win); WMMapSubwidgets(panel->win); @@ -1428,6 +1433,7 @@ createInspectorForWindow(WWindow *wwin) showIconFor(WMWidgetScreen(panel->alwChk), panel, wwin->wm_instance, wwin->wm_class, UPDATE_TEXT_FIELD); + return panel; } diff --git a/test/Makefile.in b/test/Makefile.in index a7b9de5e..9c7ebf04 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -124,7 +124,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(wtest_SOURCES) OBJECTS = $(wtest_OBJECTS) diff --git a/util/Makefile.in b/util/Makefile.in index a3a68902..5ad9b928 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -185,7 +185,7 @@ DIST_COMMON = README Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(wxcopy_SOURCES) $(wxpaste_SOURCES) $(wdwrite_SOURCES) $(getstyle_SOURCES) $(setstyle_SOURCES) $(seticons_SOURCES) $(geticonset_SOURCES) $(wmsetbg_SOURCES) OBJECTS = $(wxcopy_OBJECTS) $(wxpaste_OBJECTS) $(wdwrite_OBJECTS) $(getstyle_OBJECTS) $(setstyle_OBJECTS) $(seticons_OBJECTS) $(geticonset_OBJECTS) $(wmsetbg_OBJECTS) diff --git a/util/wmaker.inst.in b/util/wmaker.inst.in index 7f7f2e7a..cdaf4658 100644 --- a/util/wmaker.inst.in +++ b/util/wmaker.inst.in @@ -289,6 +289,7 @@ for xinit in .xinitrc .Xclients .xsession; do fi done if test $wmaker_found = 1; then + echo "Found Window Maker to already be your default window manager." show_end_message exit 0 fi diff --git a/util/wmsetbg.c b/util/wmsetbg.c index 95ba28e4..520b986b 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -1076,8 +1076,6 @@ changeTextureForWorkspace(char *domain, char *texture, int workspace) proplist_t val; char *value; int j; - - workspace++; val = PLGetProplistWithDescription(texture); if (!val) { diff --git a/wmlib/Makefile.in b/wmlib/Makefile.in index d42b7f31..9673c5e6 100644 --- a/wmlib/Makefile.in +++ b/wmlib/Makefile.in @@ -125,7 +125,7 @@ DIST_COMMON = COPYING.LIB Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libWMaker_a_SOURCES) OBJECTS = $(libWMaker_a_OBJECTS) diff --git a/wrlib/Makefile.in b/wrlib/Makefile.in index dccf28f2..c74b5e88 100644 --- a/wrlib/Makefile.in +++ b/wrlib/Makefile.in @@ -165,7 +165,7 @@ Makefile.in NEWS TODO alloca.c configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libwraster_la_SOURCES) $(testgrad_SOURCES) $(testdraw_SOURCES) $(view_SOURCES) OBJECTS = $(libwraster_la_OBJECTS) $(testgrad_OBJECTS) $(testdraw_OBJECTS) $(view_OBJECTS)