1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00
Files
wmaker/WINGs/Tests/wmfile.c
dan c2ec1cfe8a - Fixed userdefaults in WINGs not to synchronize on exit a domain that is
marked not to be synchronized.
- WMGLOBAL options can now be set in the WindowMaker configuration files
  to overwrite values in WMGLOBAL.
- You can now pass "SystemFont", "BoldSystemFont", "SystemFont-##" or
  "BoldSystemFont-##", with ## being the font size to any font creating
  function to create a font with the (bold) system font font specification.
- Replaced AA with Anitialiased in WINGs font creation function names
- Added WMCreateFontWithFlags(), WMHasAntialiasingSupport() and
  WMIsAntialiasingEnabled()
- Created a separate font cacahe for antialiased fonts
- Added test at startup if Xft supports rendering antialiased fonts (in case
  the application was compiled with Xft support, but is run on an X server
  without support for xft rendering (RENDER extension missing). If no Xft
  support antialiasing will be disabled even if it is enabled in the
  configuration file.
- Finished the Info Panel to work with antialiased fonts.
- Code cleanup in dialog.c. Remade part of Info Panel drawing the Window Maker
  logo.
- Fixed technical style drawing of window resizing.
2002-11-13 15:13:48 +00:00

126 lines
2.4 KiB
C

/*
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
*/
/*
Update: Franck Wolff <frawolff@club-internet.fr>
-----------------------------------------------------------------------
List of updated functions :
- main :
add -s option for a save panel...
-----------------------------------------------------------------------
*/
#include <WINGs/WINGs.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "logo.xpm"
void
wAbort()
{
exit(1);
}
char *ProgName;
void usage(void)
{
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -s\t\tSave panel (default open panel)\n"
" -i <str>\tInitial directory (default /)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style file selection panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
}
#define OPEN_PANEL_TYPE 0
#define SAVE_PANEL_TYPE 1
int main(int argc, char **argv)
{
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
WMOpenPanel *oPanel;
WMSavePanel *sPanel;
/* RImage *image;*/
char *title = NULL;
char *initial = "/";
int ch;
int panelType = OPEN_PANEL_TYPE;
extern char *optarg;
extern int optind;
if (!dpy) {
puts("could not open display");
exit(1);
}
WMInitializeApplication("WMFile", &argc, argv);
ProgName = argv[0];
while((ch = getopt(argc, argv, "si:ht:")) != -1)
switch(ch)
{
case 's':
panelType = SAVE_PANEL_TYPE;
break;
case 'i':
initial = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
for(; optind <argc; optind++)
usage();
scr = WMCreateSimpleApplicationScreen(dpy);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
if (panelType == SAVE_PANEL_TYPE) {
sPanel = WMGetSavePanel(scr);
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(sPanel));
else
printf("\n");
} else {
oPanel = WMGetOpenPanel(scr);
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(oPanel));
else
printf("\n");
}
return 0;
}