From c56756dc73a1f22ac53e8ebf9d28288fcfd7548d Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 14 Mar 1999 22:35:50 +0000 Subject: [PATCH] Update for 0.52.0. This is a test version, which brings the Appearance section to WPrefs for testing purposes. --- AUTHORS | 2 +- ChangeLog | 12 +- INSTALL | 4 +- NEWS | 7 + WINGs/ChangeLog | 8 +- WINGs/WINGs.h | 4 + WINGs/WUtil.h | 2 + WINGs/findfile.c | 55 + WINGs/wbrowser.c | 1 + WINGs/wcolor.c | 4 +- WINGs/wcolorwell.c | 7 + WINGs/wlist.c | 30 +- WINGs/wview.c | 12 +- WPrefs.app/Appearance.c | 809 ++++++++++++-- WPrefs.app/MouseSettings.c | 1 - WPrefs.app/TexturePanel.c | 2469 +++++++++++++++++++++++++------------------ WPrefs.app/TexturePanel.h | 16 +- WPrefs.app/WPrefs.c | 3 +- WPrefs.app/WPrefs.h | 2 +- WPrefs.app/main.c | 2 +- WPrefs.app/po/Makefile.am | 12 +- WPrefs.app/po/Makefile.in | 12 +- WPrefs.app/tiff/Makefile.am | 4 + WPrefs.app/tiff/Makefile.in | 2 +- WPrefs.app/tiff/tdel.tiff | Bin 0 -> 2756 bytes WPrefs.app/tiff/tedit.tiff | Bin 0 -> 3774 bytes WPrefs.app/tiff/textr.tiff | Bin 0 -> 3128 bytes WPrefs.app/tiff/tnew.tiff | Bin 0 -> 2914 bytes acconfig.h | 3 + configure | 123 ++- configure.in | 12 +- doc/Makefile.in | 2 +- po/Makefile.am | 12 +- po/Makefile.in | 14 +- src/Makefile.in | 2 +- src/config.h | 5 +- src/config.h.in | 3 + src/dockedapp.c | 12 +- src/event.c | 4 +- src/misc.c | 2 +- src/placement.c | 2 +- src/rootmenu.c | 6 + src/winmenu.c | 5 +- src/winspector.c | 12 +- test/Makefile.in | 2 +- util/Makefile.in | 2 +- util/wmaker.inst.in | 1 + util/wmsetbg.c | 2 - wmlib/Makefile.in | 2 +- wrlib/Makefile.in | 2 +- 50 files changed, 2479 insertions(+), 1231 deletions(-) rewrite WPrefs.app/TexturePanel.c (84%) create mode 100644 WPrefs.app/tiff/tdel.tiff create mode 100644 WPrefs.app/tiff/tedit.tiff create mode 100644 WPrefs.app/tiff/textr.tiff create mode 100644 WPrefs.app/tiff/tnew.tiff 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; @@ -828,6 +829,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) { WMListItem *itemPtr; 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 + + +#define TEXPREV_WIDTH 40 +#define TEXPREV_HEIGHT 24 + + + + + +static void +str2rcolor(RContext *rc, char *name, RColor *color) +{ + 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(_Panel *panel, char *texture, int width, int height, - Bool bordered) +renderTexture(WMScreen *scr, proplist_t texture, int width, int height, + char *path, Bool bordered) { - return None; + 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,50 +409,381 @@ 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 -changePage(WMWidget *w, void *data) +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; - WMSelectListItem(panel->texLs, section); + 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); } static void -selectTexture(WMWidget *w, void *data) +changePage(WMWidget *w, void *data) { _Panel *panel = (_Panel*)data; int section; - section = WMGetListSelectedItemRow(panel->secP); - + section = WMGetPopUpButtonSelectedItem(panel->secP); + + WMSelectListItem(panel->texLs, panel->textureIndex[section]); + WMSetListPosition(panel->texLs, panel->textureIndex[section] + - WMGetListNumberOfRows(panel->texLs)/2); } + + +static void +textureClick(WMWidget *w, void *data) +{ + _Panel *panel = (_Panel*)data; + int i; + WMListItem *item; + TextureListItem *titem; + + 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; + + titem = wmalloc(sizeof(TextureListItem)); + memset(titem, 0, sizeof(TextureListItem)); - prop = GetObjectForKey(key); - if (!prop) { - prop = PLMakeString(defValue); + 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); - return prop; + 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 dissimilarity index 84% index 3704634f..75493767 100644 --- a/WPrefs.app/TexturePanel.c +++ b/WPrefs.app/TexturePanel.c @@ -1,1028 +1,1441 @@ -/* TexturePanel.c- texture editting panel - * - * WPrefs - WindowMaker Preferences Program - * - * Copyright (c) 1998, 1999 Alfredo K. Kojima - * Copyright (c) 1998 James Thompson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - * - */ - -#include -#include -#include -#include - -#include - -#include -#include - - -#include "TexturePanel.h" -#include "TexturePanel.icons" - -typedef struct _TexturePanel { - WMWindow *win; - - WMFrame *typeF; - WMButton *tsoliB; - WMButton *tgradB; - WMButton *tpixmB; - - WMButton *okB; - WMButton *cancB; - - /* solid */ - WMFrame *scolorF; - WMColorWell *scolorW; - - /* gradient */ - WMFrame *gcolorF; - WMList *gcolorLs; - WMColorWell *gcolorW; - WMButton *gaddB; - WMButton *gremB; - WMButton *gupdB; - - WMFrame *gdirF; - WMButton *ghorB; - WMButton *gverB; - WMButton *gdiaB; - - /* pixmap */ - WMFrame *pimagF; - WMLabel *pimagL; - WMTextField *pimagT; - WMButton *pbrowB; - - WMFrame *pcolorF; - WMColorWell *pcolorW; - - WMFrame *pmodeF; - WMButton *pscalB; - WMButton *ptileB; - - WMAction *okAction; - void *okData; - - WMAction *cancelAction; - void *cancelData; - -} _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; -} - - - -/* - *-------------------------------------------------------------------------- - * 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) -{ - _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); - } - } -} - - -static void -paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect) -{ - WMScreen *scr; - int width, height, x, y; - GC gc; - Display *dpy; - - scr = WMWidgetScreen(lPtr); - 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); - 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); -} - - -static void -buttonCallback(WMWidget *self, 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); - } - free(path); - } - 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); - } 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; - - imgh = RRenderMultiGradient(50, 20, colors, RGRD_HORIZONTAL); - if (!imgh) { - wwarning("internal error:%s", RMessageForError(RErrorCode)); - } else { - icon = WMCreatePixmapFromRImage(scr, imgh, 120); - RDestroyImage(imgh); - WMSetButtonImage(panel->ghorB, icon); - WMReleasePixmap(icon); - } - - 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); -} - - -/* - *-------------------------------------------------------------------------- - * Public functions - *-------------------------------------------------------------------------- - */ -void -DestroyTexturePanel(TexturePanel *panel) -{ - WMUnmapWidget(panel->win); - WMDestroyWidget(panel->win); - free(panel); -} - - -void -ShowTexturePanel(TexturePanel *panel) -{ - WMMapWidget(panel->win); -} - - -void -HideTexturePanel(TexturePanel *panel) -{ - WMUnmapWidget(panel->win); -} - -void -SetTexturePanelOkAction(TexturePanel *panel, WMAction *action, void *clientData) -{ - panel->okAction = action; - panel->okData = clientData; -} - - -void -SetTexturePanelCancelAction(TexturePanel *panel, WMAction *action, void *clientData) -{ - panel->cancelAction = action; - panel->cancelData = clientData; -} - -void -SetTexturePanelTexture(TexturePanel *panel, char *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); - } - renderTextureButtons (panel); - free(parseString); -} - - -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) -{ - 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; -} - -TexturePanel* -CreateTexturePanel(WMScreen *scr) -{ - RImage *image; - WMPixmap *icon; - WMColor *red; - TexturePanel *panel; - RColor white,black; - - 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); - } - 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); - } - 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); - } - WMSetButtonAction(panel->tpixmB, buttonCallback, panel); - - 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); - - WMRealizeWidget(panel->win); - WMMapSubwidgets(panel->win); - - WMPerformButtonClick(panel->tsoliB); - - WMMapWidget(panel->win); - - renderTextureButtons (panel); - - - /* register notification observers */ - WMAddNotificationObserver(notificationObserver, panel, - WMTextDidChangeNotification, - panel->pimagT); - - return panel; -} - - - -/* - *-------------------------------------------------------------------------- - * Test stuff - *-------------------------------------------------------------------------- - */ - -#ifdef test - -char *ProgName = "test"; - -void testOKButton(WMWidget *self, void *data){ - char *test; - Display *dpy; - Window win; - Pixmap pix; - RImage *image; - - TexturePanel *panel = (TexturePanel*)data; - test = GetTexturePanelTextureString(panel); - - wwarning(test); - - dpy = WMScreenDisplay(WMWidgetScreen(panel->okB)); - win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 250, 250, - 0, 0, 0); - XMapRaised(dpy, win); - XFlush(dpy); - - 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); -} - -void wAbort() -{ - exit(1); -} - -int main(int argc, char **argv) -{ - TexturePanel *panel; - - Display *dpy = XOpenDisplay(""); - WMScreen *scr; - - /* char *test; */ - - WMInitializeApplication("Test", &argc, argv); - - if (!dpy) { - wfatal("could not open display"); - exit(1); - } - - scr = WMCreateSimpleApplicationScreen(dpy); - - panel = CreateTexturePanel(scr); - - SetTexturePanelOkAction(panel,(WMAction*)testOKButton,panel); - SetTexturePanelCancelAction(panel,(WMAction*)testCancelButton,panel); - - ShowTexturePanel(panel); - - SetTexturePanelTexture(panel," ( tpixmap, ballot box.xpm, \"rgb:ff/de/ff\" ) "); - - WMScreenMainLoop(scr); - return 0; -} -#endif +/* TexturePanel.c- texture editting panel + * + * WPrefs - WindowMaker Preferences Program + * + * Copyright (c) 1998, 1999 Alfredo K. Kojima + * Copyright (c) 1998 James Thompson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + * + */ + +#include +#include +#include +#include +#include + +#include + + +#include +#include + +#include "WPrefs.h" + +//#include "TexturePanel.h" + +typedef struct _TexturePanel TexturePanel; + +#define MAX_SECTION_PARTS 4 + +typedef struct _TexturePanel { + WMWindow *win; + + /* texture name */ + WMFrame *nameF; + WMTextField *nameT; + + /* texture type */ + WMPopUpButton *typeP; + + /* 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; + + + WMCallback *okAction; + void *okData; + + WMCallback *cancelAction; + void *cancelData; + + /****/ + WMWidget *sectionParts[5][MAX_SECTION_PARTS]; + + int currentType; + + + proplist_t pathList; + +} _TexturePanel; + + + +#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 + + + +/* + *-------------------------------------------------------------------------- + * Private Functions + *-------------------------------------------------------------------------- + */ + +/************/ + +static void +updateGradButtons(TexturePanel *panel) +{ + 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 +updateSGradButtons(TexturePanel *panel) +{ + 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; + Display *dpy; + 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(white), x, y, width, height); + else + 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 +gradDeleteCallback(WMWidget *w, void *data) +{ + 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(tmp); + } + + 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 { + 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); + } + } +} + + + +static void +buttonCallback(WMWidget *w, void *data) +{ + TexturePanel *panel = (TexturePanel*)data; + + if (w == panel->okB) { + (*panel->okAction)(panel->okData); + } else { + (*panel->cancelAction)(panel->cancelData); + } +} + + +/* + *-------------------------------------------------------------------------- + * Public functions + *-------------------------------------------------------------------------- + */ +void +DestroyTexturePanel(TexturePanel *panel) +{ + +} + + +void +ShowTexturePanel(TexturePanel *panel) +{ + WMMapWidget(panel->win); +} + + +void +HideTexturePanel(TexturePanel *panel) +{ + WMUnmapWidget(panel->win); +} + + +void +SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action, void *clientData) +{ + panel->okAction = action; + panel->okData = clientData; +} + + +void +SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clientData) +{ + panel->cancelAction = action; + panel->cancelData = clientData; +} + + +void +SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture) +{ + 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; + } + 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* +GetTexturePanelTextureName(TexturePanel *panel) +{ + 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(WMWindow *keyWindow) +//CreateTexturePanel(WMScreen *scr) +{ + TexturePanel *panel; + 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); + + 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); + } + + 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); + } +#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); + } + + 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, 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); + + 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; +} + + + +/* + *-------------------------------------------------------------------------- + * Test stuff + *-------------------------------------------------------------------------- + */ + +#if 0 + +char *ProgName = "test"; + +void +testOKButton(WMWidget *self, void *data) +{ + char *test; + Display *dpy; + Window win; + Pixmap pix; + RImage *image; + + TexturePanel *panel = (TexturePanel*)data; +// test = GetTexturePanelTextureString(panel); + + wwarning(test); + + dpy = WMScreenDisplay(WMWidgetScreen(panel->okB)); + win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 250, 250, + 0, 0, 0); + XMapRaised(dpy, win); + XFlush(dpy); + + // 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); + + free (test); + +} + +void testCancelButton(WMWidget *self, void *data){ + wwarning("Exiting test...."); + exit(0); +} + +void wAbort() +{ + exit(1); +} + +int main(int argc, char **argv) +{ + TexturePanel *panel; + + Display *dpy = XOpenDisplay(""); + WMScreen *scr; + + /* char *test; */ + + WMInitializeApplication("Test", &argc, argv); + + if (!dpy) { + wfatal("could not open display"); + exit(1); + } + + 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); + + WMScreenMainLoop(scr); + return 0; +} +#endif 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 *GetTexturePanelTextureName(TexturePanel *panel); -char *GetTexturePanelTextureString(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 0000000000000000000000000000000000000000..58201d5f0ceec85d2c7c7b02143eee9cc18fb340 GIT binary patch literal 2756 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 literal 0 HcwPel00001 diff --git a/WPrefs.app/tiff/textr.tiff b/WPrefs.app/tiff/textr.tiff new file mode 100644 index 0000000000000000000000000000000000000000..de3a31ec1cd384a88d6e356c63026572b63f4a4b GIT binary patch literal 3128 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 JP6zzc{|`bhfsz0K literal 0 HcwPel00001 diff --git a/WPrefs.app/tiff/tnew.tiff b/WPrefs.app/tiff/tnew.tiff new file mode 100644 index 0000000000000000000000000000000000000000..f11aa8dc0f3c4cb3a5416874829b94c6f9356349 GIT binary patch literal 2914 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 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) -- 2.11.4.GIT