mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
WPrefs appearance stuff update (shows preview)
This commit is contained in:
@@ -13,6 +13,7 @@ Changes since version 0.51.2:
|
|||||||
- added a dot to mark hidden applications (compile time) (id@windowmaker.org)
|
- added a dot to mark hidden applications (compile time) (id@windowmaker.org)
|
||||||
- enhancements to the modelock patch (id@windowmaker.org)
|
- enhancements to the modelock patch (id@windowmaker.org)
|
||||||
- show kbd mode for modelock (id@windowmaker.org)
|
- show kbd mode for modelock (id@windowmaker.org)
|
||||||
|
- enhanced positioning of transient windows
|
||||||
|
|
||||||
|
|
||||||
Changes since version 0.51.1:
|
Changes since version 0.51.1:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <wraster.h>
|
#include <wraster.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#define WINGS_H_VERSION 990222
|
#define WINGS_H_VERSION 990316
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -660,6 +660,10 @@ void WMSetWindowMiniwindowImage(WMWindow *win, WMPixmap *pixmap);
|
|||||||
|
|
||||||
void WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData);
|
void WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData);
|
||||||
|
|
||||||
|
void WMSetWindowUPosition(WMWindow *win, int x, int y);
|
||||||
|
|
||||||
|
void WMSetWindowUSize(WMWindow *win, unsigned width, unsigned height);
|
||||||
|
|
||||||
void WMSetWindowMaxSize(WMWindow *win, unsigned width, unsigned height);
|
void WMSetWindowMaxSize(WMWindow *win, unsigned width, unsigned height);
|
||||||
|
|
||||||
void WMSetWindowMinSize(WMWindow *win, unsigned width, unsigned height);
|
void WMSetWindowMinSize(WMWindow *win, unsigned width, unsigned height);
|
||||||
|
|||||||
@@ -344,15 +344,14 @@ WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WMSetWindowUPosition(panel->win,
|
||||||
|
(scr->rootView->size.width - WMWidgetWidth(panel->win))/2,
|
||||||
|
(scr->rootView->size.height - WMWidgetHeight(panel->win))/2);
|
||||||
WMSetLabelText(panel->titleLabel, name);
|
WMSetLabelText(panel->titleLabel, name);
|
||||||
|
|
||||||
scr->modalView = W_VIEW(panel->win);
|
scr->modalView = W_VIEW(panel->win);
|
||||||
WMMapWidget(panel->win);
|
WMMapWidget(panel->win);
|
||||||
|
|
||||||
WMMoveWidget(panel->win,
|
|
||||||
(scr->rootView->size.width - WMWidgetWidth(panel->win))/2,
|
|
||||||
(scr->rootView->size.height - WMWidgetHeight(panel->win))/2);
|
|
||||||
|
|
||||||
scr->modal = 1;
|
scr->modal = 1;
|
||||||
while (!panel->flags.done) {
|
while (!panel->flags.done) {
|
||||||
WMNextEvent(scr->display, &event);
|
WMNextEvent(scr->display, &event);
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ typedef struct W_Window {
|
|||||||
WMSize minSize;
|
WMSize minSize;
|
||||||
WMSize maxSize;
|
WMSize maxSize;
|
||||||
|
|
||||||
|
WMPoint upos;
|
||||||
|
WMSize usize;
|
||||||
|
|
||||||
WMAction *closeAction;
|
WMAction *closeAction;
|
||||||
void *closeData;
|
void *closeData;
|
||||||
|
|
||||||
@@ -35,7 +38,8 @@ typedef struct W_Window {
|
|||||||
unsigned style:4;
|
unsigned style:4;
|
||||||
unsigned configured:1;
|
unsigned configured:1;
|
||||||
unsigned documentEdited:1;
|
unsigned documentEdited:1;
|
||||||
unsigned moved:1;
|
|
||||||
|
unsigned upos_set:1;
|
||||||
} flags;
|
} flags;
|
||||||
} _Window;
|
} _Window;
|
||||||
|
|
||||||
@@ -76,7 +80,7 @@ static void moveWindow(WMWidget *, int, int);
|
|||||||
struct W_ViewProcedureTable _WindowViewProcedures = {
|
struct W_ViewProcedureTable _WindowViewProcedures = {
|
||||||
NULL,
|
NULL,
|
||||||
resizeWindow,
|
resizeWindow,
|
||||||
moveWindow
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -267,14 +271,6 @@ WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
moveWindow(WMWidget *w, int x, int y)
|
|
||||||
{
|
|
||||||
((WMWindow*)w)->flags.moved = 1;
|
|
||||||
|
|
||||||
W_MoveView(W_VIEW(w), x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
resizeWindow(WMWidget *w, unsigned width, unsigned height)
|
resizeWindow(WMWidget *w, unsigned width, unsigned height)
|
||||||
@@ -311,6 +307,17 @@ setSizeHints(WMWindow *win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hints->flags = 0;
|
hints->flags = 0;
|
||||||
|
|
||||||
|
if (win->flags.upos_set) {
|
||||||
|
hints->flags |= USPosition;
|
||||||
|
hints->x = win->upos.x;
|
||||||
|
hints->y = win->upos.y;
|
||||||
|
}
|
||||||
|
if (win->usize.width>0 && win->usize.height>0) {
|
||||||
|
hints->flags |= USSize;
|
||||||
|
hints->width = win->usize.width;
|
||||||
|
hints->height = win->usize.height;
|
||||||
|
}
|
||||||
if (win->minSize.width>0 && win->minSize.height>0) {
|
if (win->minSize.width>0 && win->minSize.height>0) {
|
||||||
hints->flags |= PMinSize;
|
hints->flags |= PMinSize;
|
||||||
hints->min_width = win->minSize.width;
|
hints->min_width = win->minSize.width;
|
||||||
@@ -389,12 +396,6 @@ realizeWindow(WMWindow *win)
|
|||||||
Atom atoms[4];
|
Atom atoms[4];
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (!win->flags.moved && win->owner!=NULL) {
|
|
||||||
W_MoveView(win->view,
|
|
||||||
(scr->rootView->size.width-win->view->size.width)/2,
|
|
||||||
(scr->rootView->size.height-win->view->size.height)/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
classHint = XAllocClassHint();
|
classHint = XAllocClassHint();
|
||||||
classHint->res_name = win->wname;
|
classHint->res_name = win->wname;
|
||||||
classHint->res_class = WMGetApplicationName();
|
classHint->res_class = WMGetApplicationName();
|
||||||
@@ -442,6 +443,29 @@ realizeWindow(WMWindow *win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetWindowUPosition(WMWindow *win, int x, int y)
|
||||||
|
{
|
||||||
|
win->flags.upos_set = 1;
|
||||||
|
win->upos.x = x;
|
||||||
|
win->upos.y = y;
|
||||||
|
if (win->view->flags.realized)
|
||||||
|
setSizeHints(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetWindowUSize(WMWindow *win, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
win->usize.width = width;
|
||||||
|
win->usize.height = height;
|
||||||
|
if (win->view->flags.realized)
|
||||||
|
setSizeHints(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetWindowMinSize(WMWindow *win, unsigned width, unsigned height)
|
WMSetWindowMinSize(WMWindow *win, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "TexturePanel.h"
|
#include "TexturePanel.h"
|
||||||
|
|
||||||
typedef struct _Panel {
|
typedef struct _Panel {
|
||||||
@@ -36,7 +38,7 @@ typedef struct _Panel {
|
|||||||
|
|
||||||
WMWindow *win;
|
WMWindow *win;
|
||||||
|
|
||||||
WMButton *prevB;
|
WMLabel *prevL;
|
||||||
|
|
||||||
WMPopUpButton *secP;
|
WMPopUpButton *secP;
|
||||||
|
|
||||||
@@ -69,15 +71,7 @@ typedef struct _Panel {
|
|||||||
WMPixmap *onLed;
|
WMPixmap *onLed;
|
||||||
WMPixmap *offLed;
|
WMPixmap *offLed;
|
||||||
|
|
||||||
/* for preview shit */
|
|
||||||
Pixmap preview;
|
Pixmap preview;
|
||||||
Pixmap ftitle;
|
|
||||||
Pixmap utitle;
|
|
||||||
Pixmap otitle;
|
|
||||||
Pixmap icon;
|
|
||||||
Pixmap back;
|
|
||||||
Pixmap mtitle;
|
|
||||||
Pixmap mitem;
|
|
||||||
|
|
||||||
char *fprefix;
|
char *fprefix;
|
||||||
} _Panel;
|
} _Panel;
|
||||||
@@ -99,6 +93,8 @@ typedef struct {
|
|||||||
static void showData(_Panel *panel);
|
static void showData(_Panel *panel);
|
||||||
|
|
||||||
|
|
||||||
|
static void OpenExtractPanelFor(_Panel *panel, char *path);
|
||||||
|
|
||||||
#define ICON_FILE "appearance"
|
#define ICON_FILE "appearance"
|
||||||
|
|
||||||
#define TNEW_FILE "tnew"
|
#define TNEW_FILE "tnew"
|
||||||
@@ -235,7 +231,7 @@ dumpRImage(char *path, RImage *image)
|
|||||||
|
|
||||||
static Pixmap
|
static Pixmap
|
||||||
renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
||||||
char *path, Bool bordered)
|
char *path, int border)
|
||||||
{
|
{
|
||||||
char *type;
|
char *type;
|
||||||
RImage *image;
|
RImage *image;
|
||||||
@@ -324,7 +320,15 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
path = wfindfileinarray(GetObjectForKey("PixmapPath"), str);
|
path = wfindfileinarray(GetObjectForKey("PixmapPath"), str);
|
||||||
timage = RLoadImage(rc, path, 0);
|
timage = RLoadImage(rc, path, 0);
|
||||||
free(path);
|
free(path);
|
||||||
if (timage) {
|
|
||||||
|
if (toupper(type[0]) == 'T') {
|
||||||
|
if (timage->width < TEXPREV_WIDTH
|
||||||
|
|| timage->height < TEXPREV_HEIGHT) {
|
||||||
|
image = RMakeTiledImage(timage, TEXPREV_WIDTH, TEXPREV_HEIGHT);
|
||||||
|
RDestroyImage(timage);
|
||||||
|
timage = image;
|
||||||
|
}
|
||||||
|
} else if (timage) {
|
||||||
w = timage->width;
|
w = timage->width;
|
||||||
h = timage->height;
|
h = timage->height;
|
||||||
|
|
||||||
@@ -336,12 +340,17 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
|
|
||||||
image = RScaleImage(timage, w, h);
|
image = RScaleImage(timage, w, h);
|
||||||
RDestroyImage(timage);
|
RDestroyImage(timage);
|
||||||
|
timage = image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
dumpRImage(path, image);
|
dumpRImage(path, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (border) {
|
||||||
|
RBevelImage(image, border);
|
||||||
|
}
|
||||||
|
|
||||||
RConvertImage(rc, image, &pixmap);
|
RConvertImage(rc, image, &pixmap);
|
||||||
RDestroyImage(image);
|
RDestroyImage(image);
|
||||||
@@ -350,7 +359,8 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
updatePreviewBox(_Panel *panel, int elements)
|
updatePreviewBox(_Panel *panel, int elements)
|
||||||
{
|
{
|
||||||
@@ -358,28 +368,78 @@ updatePreviewBox(_Panel *panel, int elements)
|
|||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
/* RContext *rc = WMScreenRContext(scr);*/
|
/* RContext *rc = WMScreenRContext(scr);*/
|
||||||
int refresh = 0;
|
int refresh = 0;
|
||||||
char *tmp;
|
Pixmap pix;
|
||||||
|
GC gc;
|
||||||
|
|
||||||
|
gc = XCreateGC(dpy, WMWidgetXID(panel->win), 0, NULL);
|
||||||
|
|
||||||
|
|
||||||
if (!panel->preview) {
|
if (!panel->preview) {
|
||||||
|
WMColor *color;
|
||||||
|
|
||||||
panel->preview = XCreatePixmap(dpy, WMWidgetXID(panel->win),
|
panel->preview = XCreatePixmap(dpy, WMWidgetXID(panel->win),
|
||||||
220-4, 185-4, WMScreenDepth(scr));
|
220-4, 185-4, WMScreenDepth(scr));
|
||||||
|
|
||||||
|
color = WMGrayColor(scr);
|
||||||
|
XFillRectangle(dpy, panel->preview, WMColorGC(color),
|
||||||
|
0, 0, 220-4, 185-4);
|
||||||
|
WMReleaseColor(color);
|
||||||
|
|
||||||
refresh = -1;
|
refresh = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elements & FTITLE) {
|
if (elements & FTITLE) {
|
||||||
if (panel->ftitle)
|
pix = renderTexture(scr, panel->ftitleTex, 180, 20, NULL,
|
||||||
XFreePixmap(dpy, panel->ftitle);
|
RBEV_RAISED2);
|
||||||
|
|
||||||
panel->ftitle = renderTexture(scr, tmp, 180, 20, NULL, True);
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 180, 20, 5, 10);
|
||||||
free(tmp);
|
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
|
}
|
||||||
|
if (elements & UTITLE) {
|
||||||
|
pix = renderTexture(scr, panel->utitleTex, 180, 20, NULL,
|
||||||
|
RBEV_RAISED2);
|
||||||
|
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 180, 20, 10, 35);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
|
}
|
||||||
|
if (elements & OTITLE) {
|
||||||
|
pix = renderTexture(scr, panel->ptitleTex, 180, 20, NULL,
|
||||||
|
RBEV_RAISED2);
|
||||||
|
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 180, 20, 15, 60);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
|
}
|
||||||
|
if (elements & MTITLE) {
|
||||||
|
pix = renderTexture(scr, panel->mtitleTex, 100, 20, NULL,
|
||||||
|
RBEV_RAISED2);
|
||||||
|
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 100, 20, 20, 95);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
|
}
|
||||||
|
if (elements & MITEM) {
|
||||||
|
pix = renderTexture(scr, panel->menuTex, 100, 18, NULL,
|
||||||
|
RBEV_RAISED2);
|
||||||
|
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 100, 20, 20, 115);
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 100, 20, 20, 115+18);
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 100, 20, 20, 115+36);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
|
}
|
||||||
|
if (elements & ICON) {
|
||||||
|
pix = renderTexture(scr, panel->iconTex, 64, 64, NULL,
|
||||||
|
RBEV_RAISED3);
|
||||||
|
|
||||||
|
XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 64, 64, 130, 100);
|
||||||
|
|
||||||
|
XFreePixmap(dpy, pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* have to repaint everything to make things simple, eliminating
|
|
||||||
* clipping stuff */
|
|
||||||
if (refresh) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refresh<0) {
|
if (refresh<0) {
|
||||||
WMPixmap *pix;
|
WMPixmap *pix;
|
||||||
@@ -389,24 +449,12 @@ updatePreviewBox(_Panel *panel, int elements)
|
|||||||
WMSetLabelImage(panel->prevL, pix);
|
WMSetLabelImage(panel->prevL, pix);
|
||||||
WMReleasePixmap(pix);
|
WMReleasePixmap(pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XFreeGC(dpy, gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static char*
|
|
||||||
getStrArrayForKey(char *key)
|
|
||||||
{
|
|
||||||
proplist_t v;
|
|
||||||
|
|
||||||
v = GetObjectForKey(key);
|
|
||||||
if (!v)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return PLGetDescription(v);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cancelNewTexture(void *data)
|
cancelNewTexture(void *data)
|
||||||
@@ -469,7 +517,7 @@ okNewTexture(void *data)
|
|||||||
|
|
||||||
titem->path = makeFileName(panel->fprefix, name);
|
titem->path = makeFileName(panel->fprefix, name);
|
||||||
titem->preview = renderTexture(scr, prop, TEXPREV_WIDTH, TEXPREV_HEIGHT,
|
titem->preview = renderTexture(scr, prop, TEXPREV_WIDTH, TEXPREV_HEIGHT,
|
||||||
titem->path, False);
|
titem->path, 0);
|
||||||
|
|
||||||
item = WMAddListItem(panel->texLs, "");
|
item = WMAddListItem(panel->texLs, "");
|
||||||
item->clientData = titem;
|
item->clientData = titem;
|
||||||
@@ -514,7 +562,7 @@ okEditTexture(void *data)
|
|||||||
XFreePixmap(WMScreenDisplay(WMWidgetScreen(panel->texLs)), titem->preview);
|
XFreePixmap(WMScreenDisplay(WMWidgetScreen(panel->texLs)), titem->preview);
|
||||||
titem->preview = renderTexture(WMWidgetScreen(panel->texLs), titem->prop,
|
titem->preview = renderTexture(WMWidgetScreen(panel->texLs), titem->prop,
|
||||||
TEXPREV_WIDTH, TEXPREV_HEIGHT,
|
TEXPREV_WIDTH, TEXPREV_HEIGHT,
|
||||||
titem->path, False);
|
titem->path, 0);
|
||||||
|
|
||||||
WMRedisplayWidget(panel->texLs);
|
WMRedisplayWidget(panel->texLs);
|
||||||
}
|
}
|
||||||
@@ -601,6 +649,34 @@ deleteTexture(WMWidget *w, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
extractTexture(WMWidget *w, void *data)
|
||||||
|
{
|
||||||
|
_Panel *panel = (_Panel*)data;
|
||||||
|
char *path;
|
||||||
|
WMOpenPanel *opanel;
|
||||||
|
WMScreen *scr = WMWidgetScreen(w);
|
||||||
|
|
||||||
|
opanel = WMGetOpenPanel(scr);
|
||||||
|
WMSetFilePanelCanChooseDirectories(opanel, False);
|
||||||
|
WMSetFilePanelCanChooseFiles(opanel, True);
|
||||||
|
|
||||||
|
if (WMRunModalFilePanelForDirectory(opanel, panel->win, wgethomedir(),
|
||||||
|
_("Select File"), NULL)) {
|
||||||
|
path = WMGetFilePanelFileName(opanel);
|
||||||
|
|
||||||
|
puts(path);
|
||||||
|
OpenExtractPanelFor(panel, path);
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
changePage(WMWidget *w, void *data)
|
changePage(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
@@ -782,7 +858,7 @@ fillTextureList(WMList *lPtr)
|
|||||||
titem->preview = loadRImage(scr, titem->path);
|
titem->preview = loadRImage(scr, titem->path);
|
||||||
if (!titem->preview) {
|
if (!titem->preview) {
|
||||||
titem->preview = renderTexture(scr, titem->prop, TEXPREV_WIDTH,
|
titem->preview = renderTexture(scr, titem->prop, TEXPREV_WIDTH,
|
||||||
TEXPREV_HEIGHT, NULL, False);
|
TEXPREV_HEIGHT, NULL, 0);
|
||||||
}
|
}
|
||||||
item = WMAddListItem(lPtr, "");
|
item = WMAddListItem(lPtr, "");
|
||||||
item->clientData = titem;
|
item->clientData = titem;
|
||||||
@@ -832,10 +908,10 @@ createPanel(Panel *p)
|
|||||||
WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
|
WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
|
||||||
|
|
||||||
/* preview box */
|
/* preview box */
|
||||||
panel->prevB = WMCreateCommandButton(panel->frame);
|
panel->prevL = WMCreateLabel(panel->frame);
|
||||||
WMResizeWidget(panel->prevB, 260, 165);
|
WMResizeWidget(panel->prevL, 260, 165);
|
||||||
WMMoveWidget(panel->prevB, 15, 10);
|
WMMoveWidget(panel->prevL, 15, 10);
|
||||||
WMSetButtonImagePosition(panel->prevB, WIPImageOnly);
|
WMSetLabelImagePosition(panel->prevL, WIPImageOnly);
|
||||||
|
|
||||||
panel->secP = WMCreatePopUpButton(panel->frame);
|
panel->secP = WMCreatePopUpButton(panel->frame);
|
||||||
WMResizeWidget(panel->secP, 260, 20);
|
WMResizeWidget(panel->secP, 260, 20);
|
||||||
@@ -899,6 +975,7 @@ createPanel(Panel *p)
|
|||||||
WMSetButtonFont(panel->ripB, font);
|
WMSetButtonFont(panel->ripB, font);
|
||||||
WMSetButtonImagePosition(panel->ripB, WIPAbove);
|
WMSetButtonImagePosition(panel->ripB, WIPAbove);
|
||||||
WMSetButtonText(panel->ripB, _("Extract..."));
|
WMSetButtonText(panel->ripB, _("Extract..."));
|
||||||
|
WMSetButtonAction(panel->ripB, extractTexture, panel);
|
||||||
SetButtonAlphaImage(scr, panel->ripB, TEXTR_FILE);
|
SetButtonAlphaImage(scr, panel->ripB, TEXTR_FILE);
|
||||||
|
|
||||||
WMSetButtonEnabled(panel->ripB, False);
|
WMSetButtonEnabled(panel->ripB, False);
|
||||||
@@ -962,7 +1039,7 @@ setupTextureFor(WMList *list, char *key, char *defValue, char *title,
|
|||||||
titem->selectedFor = 1<<index;
|
titem->selectedFor = 1<<index;
|
||||||
|
|
||||||
titem->preview = renderTexture(WMWidgetScreen(list), titem->prop,
|
titem->preview = renderTexture(WMWidgetScreen(list), titem->prop,
|
||||||
TEXPREV_WIDTH, TEXPREV_HEIGHT, NULL, False);
|
TEXPREV_WIDTH, TEXPREV_HEIGHT, NULL, 0);
|
||||||
|
|
||||||
item = WMAddListItem(list, "");
|
item = WMAddListItem(list, "");
|
||||||
item->clientData = titem;
|
item->clientData = titem;
|
||||||
@@ -1006,6 +1083,8 @@ showData(_Panel *panel)
|
|||||||
"(solid, black)", "[Workspace]", i);
|
"(solid, black)", "[Workspace]", i);
|
||||||
panel->textureIndex[i] = i++;
|
panel->textureIndex[i] = i++;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
updatePreviewBox(panel, EVERYTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1085,3 +1164,88 @@ InitAppearance(WMScreen *scr, WMWindow *win)
|
|||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct ExtractPanel {
|
||||||
|
WMWindow *win;
|
||||||
|
|
||||||
|
WMLabel *label;
|
||||||
|
WMList *list;
|
||||||
|
|
||||||
|
WMButton *closeB;
|
||||||
|
WMButton *extrB;
|
||||||
|
} ExtractPanel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
OpenExtractPanelFor(_Panel *panel, char *path)
|
||||||
|
{
|
||||||
|
ExtractPanel *epanel;
|
||||||
|
WMColor *color;
|
||||||
|
WMFont *font;
|
||||||
|
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||||
|
|
||||||
|
epanel = wmalloc(sizeof(ExtractPanel));
|
||||||
|
epanel->win = WMCreatePanelWithStyleForWindow(panel->win, "extract",
|
||||||
|
WMTitledWindowMask
|
||||||
|
|WMClosableWindowMask);
|
||||||
|
WMResizeWidget(epanel->win, 245, 250);
|
||||||
|
WMSetWindowTitle(epanel->win, _("Extract Texture"));
|
||||||
|
|
||||||
|
epanel->label = WMCreateLabel(epanel->win);
|
||||||
|
WMResizeWidget(epanel->label, 225, 18);
|
||||||
|
WMMoveWidget(epanel->label, 10, 10);
|
||||||
|
WMSetLabelTextAlignment(epanel->label, WACenter);
|
||||||
|
WMSetLabelRelief(epanel->label, WRSunken);
|
||||||
|
|
||||||
|
color = WMDarkGrayColor(scr);
|
||||||
|
WMSetWidgetBackgroundColor(epanel->label, color);
|
||||||
|
WMReleaseColor(color);
|
||||||
|
|
||||||
|
color = WMWhiteColor(scr);
|
||||||
|
WMSetLabelTextColor(epanel->label, color);
|
||||||
|
WMReleaseColor(color);
|
||||||
|
|
||||||
|
font = WMBoldSystemFontOfSize(scr, 12);
|
||||||
|
WMSetLabelFont(epanel->label, font);
|
||||||
|
WMReleaseFont(font);
|
||||||
|
|
||||||
|
WMSetLabelText(epanel->label, _("Textures"));
|
||||||
|
|
||||||
|
epanel->list = WMCreateList(epanel->win);
|
||||||
|
WMResizeWidget(epanel->list, 225, 165);
|
||||||
|
WMMoveWidget(epanel->list, 10, 30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
epanel->closeB = WMCreateCommandButton(epanel->win);
|
||||||
|
WMResizeWidget(epanel->closeB, 74, 24);
|
||||||
|
WMMoveWidget(epanel->closeB, 165, 215);
|
||||||
|
WMSetButtonText(epanel->closeB, _("Close"));
|
||||||
|
|
||||||
|
epanel->extrB = WMCreateCommandButton(epanel->win);
|
||||||
|
WMResizeWidget(epanel->extrB, 74, 24);
|
||||||
|
WMMoveWidget(epanel->extrB, 80, 215);
|
||||||
|
WMSetButtonText(epanel->extrB, _("Extract"));
|
||||||
|
|
||||||
|
WMMapSubwidgets(epanel->win);
|
||||||
|
|
||||||
|
|
||||||
|
/* take textures from file */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WMRealizeWidget(epanel->win);
|
||||||
|
|
||||||
|
WMMapWidget(epanel->win);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,8 @@
|
|||||||
|
|
||||||
#include "WPrefs.h"
|
#include "WPrefs.h"
|
||||||
|
|
||||||
//#include "TexturePanel.h"
|
#include "TexturePanel.h"
|
||||||
|
|
||||||
typedef struct _TexturePanel TexturePanel;
|
|
||||||
|
|
||||||
#define MAX_SECTION_PARTS 4
|
#define MAX_SECTION_PARTS 4
|
||||||
|
|
||||||
@@ -1012,7 +1011,7 @@ SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array)
|
|||||||
|
|
||||||
TexturePanel*
|
TexturePanel*
|
||||||
CreateTexturePanel(WMWindow *keyWindow)
|
CreateTexturePanel(WMWindow *keyWindow)
|
||||||
//CreateTexturePanel(WMScreen *scr)
|
/*CreateTexturePanel(WMScreen *scr)*/
|
||||||
{
|
{
|
||||||
TexturePanel *panel;
|
TexturePanel *panel;
|
||||||
WMScreen *scr = WMWidgetScreen(keyWindow);
|
WMScreen *scr = WMWidgetScreen(keyWindow);
|
||||||
|
|||||||
@@ -641,8 +641,8 @@ void
|
|||||||
wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
|
wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
|
||||||
int *x, int *y, unsigned *width, unsigned *height)
|
int *x, int *y, unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
int pre_icccm=0;
|
int pre_icccm = 0; /* not used */
|
||||||
|
|
||||||
/* find a position for the window */
|
/* find a position for the window */
|
||||||
if (!wwin->normal_hints)
|
if (!wwin->normal_hints)
|
||||||
wwin->normal_hints = XAllocSizeHints();
|
wwin->normal_hints = XAllocSizeHints();
|
||||||
@@ -714,8 +714,7 @@ wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
|
|||||||
wwin->normal_hints->min_width = wwin->normal_hints->max_width;
|
wwin->normal_hints->min_width = wwin->normal_hints->max_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pre ICCCM (old) client */
|
if (/*pre_icccm && */!wwin->screen_ptr->flags.startup && geometry) {
|
||||||
if (pre_icccm && !wwin->screen_ptr->flags.startup && geometry) {
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("PRE ICCCM\n");
|
printf("PRE ICCCM\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -723,6 +722,7 @@ wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry,
|
|||||||
wwin->normal_hints->flags &= ~PPosition;
|
wwin->normal_hints->flags &= ~PPosition;
|
||||||
#endif
|
#endif
|
||||||
if (wwin->normal_hints->flags & (USPosition|PPosition)) {
|
if (wwin->normal_hints->flags & (USPosition|PPosition)) {
|
||||||
|
puts("QWEWQEWQ");
|
||||||
*x = wwin->normal_hints->x;
|
*x = wwin->normal_hints->x;
|
||||||
*y = wwin->normal_hints->y;
|
*y = wwin->normal_hints->y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,9 +502,9 @@ main(int argc, char **argv)
|
|||||||
sprintf(str, "DISPLAY=%s", DisplayName);
|
sprintf(str, "DISPLAY=%s", DisplayName);
|
||||||
putenv(str);
|
putenv(str);
|
||||||
|
|
||||||
//#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
XSynchronize(dpy, True);
|
XSynchronize(dpy, True);
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
wXModifierInitialize();
|
wXModifierInitialize();
|
||||||
|
|
||||||
|
|||||||
@@ -816,7 +816,9 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
if (win_state && win_state->state->use_geometry) {
|
if (win_state && win_state->state->use_geometry) {
|
||||||
x = win_state->state->x;
|
x = win_state->state->x;
|
||||||
y = win_state->state->y;
|
y = win_state->state->y;
|
||||||
} else if (wwin->transient_for==None && !scr->flags.startup
|
} else if ((wwin->transient_for==None
|
||||||
|
|| wPreferences.window_placement!=WPM_MANUAL)
|
||||||
|
&& !scr->flags.startup
|
||||||
&& workspace == scr->current_workspace
|
&& workspace == scr->current_workspace
|
||||||
&& !wwin->flags.miniaturized
|
&& !wwin->flags.miniaturized
|
||||||
&& !wwin->flags.maximized
|
&& !wwin->flags.maximized
|
||||||
@@ -861,7 +863,7 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
|
|
||||||
/* setup button images */
|
/* setup button images */
|
||||||
wWindowUpdateButtonImages(wwin);
|
wWindowUpdateButtonImages(wwin);
|
||||||
|
|
||||||
/* hide unused buttons */
|
/* hide unused buttons */
|
||||||
foo = 0;
|
foo = 0;
|
||||||
if (WFLAGP(wwin, no_close_button))
|
if (WFLAGP(wwin, no_close_button))
|
||||||
@@ -917,6 +919,7 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
if (gy > 0)
|
if (gy > 0)
|
||||||
y -= wwin->frame->top_width + wwin->frame->bottom_width;
|
y -= wwin->frame->top_width + wwin->frame->bottom_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wWindowConfigure() will init the client window's size
|
* wWindowConfigure() will init the client window's size
|
||||||
* (wwin->client.{width,height}) and all other geometry
|
* (wwin->client.{width,height}) and all other geometry
|
||||||
|
|||||||
Reference in New Issue
Block a user