Browse Source

add xfont, wfont, wfont_size variables

pre-master-46
h_vogt 16 years ago
parent
commit
7dc6417e6d
  1. 4
      ChangeLog
  2. 2
      src/frontend/plotting/x11.c
  3. 12
      src/frontend/wdisp/windisp.c
  4. 38
      src/winmain.c

4
ChangeLog

@ -3,6 +3,10 @@
in mingw and MS Visual Studio.
gnuplot.c: small update, call to gnuplot tested up to ver. 4.2.6,
does not work for Windows and gnuplot 4.4.
* x11.c: add xfont parameter
* windisp.c: add wfont and wfont_size parameter
* winmain.c: use SystemParametersInfo() to get screen size to
improve placement of GUI on the screen.
2010-01-01 Holger Vogt
* spinit.in: Small update

2
src/frontend/plotting/x11.c

@ -410,7 +410,7 @@ X11_NewViewport(GRAPH *graph)
XtAddCallback(DEVDEP(graph).buttons[1], XtNcallback, (XtCallbackProc) hardcopy, graph);
/* set up fonts */
if (!cp_getvar("font", VT_STRING, fontname)) {
if (!cp_getvar("xfont", VT_STRING, fontname)) {
(void) strcpy(fontname, DEF_FONT);
}

12
src/frontend/wdisp/windisp.c

@ -69,6 +69,8 @@ extern int NewViewport(GRAPH *pgraph);
#define M_LN10 2.30258509299404568402
#endif
#define DEF_FONTW "Courier"
/* local variables */
static int IsRegistered = 0; /* 1 if window class is registered */
#define NumWinColors 23 /* predefined colors */
@ -815,8 +817,16 @@ int WIN_Text( char * text, int x, int y, int CentiDegrees)
lf.lfClipPrecision = 0 ;
lf.lfQuality = 0 ;
lf.lfPitchAndFamily = 0 ;
/* set up fonts */
if (!cp_getvar("wfont", VT_STRING, lf.lfFaceName)) {
(void) lstrcpy(lf.lfFaceName, DEF_FONTW);
}
if (!cp_getvar("wfont_size", VT_NUM, (char *) &(lf.lfHeight))) {
lf.lfHeight = (int) (1.1 * currentgraph->fontheight) ;
}
lstrcpy (lf.lfFaceName, "Courier"/*"Times New Roman"*/) ;
// lstrcpy (lf.lfFaceName, "Courier"/*"Times New Roman"*/) ;
hfont = CreateFontIndirect (&lf);
SelectObject(wd->hDC, hfont);

38
src/winmain.c

@ -8,14 +8,14 @@
#include "config.h"
#ifdef HAS_WINDOWS
#define STRICT // strikte Typpruefung
#define STRICT // strict type checking
#define WIN32_LEAN_AND_MEAN
#include <windows.h> // normale Windows-Aufrufe
#include <windowsx.h> // Win32 Message Cracker
#include <stdio.h> // sprintf und co
#include <stdlib.h> // exit-codes
#include <stdarg.h> // var. argumente
#include <assert.h> // assert-macro
#include <windows.h> // standard Windows calls
#include <windowsx.h> // Win32 message cracker
#include <stdio.h> // sprintf and co
#include <stdlib.h> // exit codes
#include <stdarg.h> // var. arguments
#include <assert.h> // assert macro
#include "misc/stringutil.h" // copy
#include <io.h> // _read
@ -29,13 +29,13 @@
#include "misc/misc_time.h" /* timediff */
/* Constants */
#define TBufSize 8192 // Groesze des Textbuffers
#define CR VK_RETURN // Carriage Return
#define TBufSize 8192 // size of text buffer
#define CR VK_RETURN // Carriage Return
#define LF 10 // Line Feed
#define SE 0 // String termination
#define BorderSize 8 // Umrandung des Stringfeldes
#define SBufSize 100 // Groesze des Stringbuffers
#define IOBufSize 4096 // Groesze des printf-Buffers
#define BorderSize 8 // Umrandung des Stringfeldes
#define SBufSize 100 // Groesze des Stringbuffers
#define IOBufSize 4096 // Groesze des printf-Buffers
#define HistSize 20 // Zeilen History-Buffer
#define StatusHeight 25 // Hoehe des Status Bars
#define StatusFrame 2 // Abstand Statusbar / StatusElement
@ -774,6 +774,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
int argc;
char **argv;
RECT wsize; /* size of usable window */
/* fill global variables */
hInst = hInstance;
nShowState = nCmdShow;
@ -829,9 +831,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
if (!RegisterClass( &hwElementClass)) goto THE_END;
/*Create main window */
iy = GetSystemMetrics( SM_CYSCREEN);
iyt = GetSystemMetrics( SM_CYSCREEN) / 3;
ix = GetSystemMetrics( SM_CXSCREEN);
SystemParametersInfo(SPI_GETWORKAREA, 0, &wsize, NULL);
iy = wsize.bottom;
iyt = iy / 3;
ix = wsize.right;
// iy = GetSystemMetrics( SM_CYSCREEN);
// iyt = GetSystemMetrics( SM_CYSCREEN) / 3;
// ix = GetSystemMetrics( SM_CXSCREEN);
hwMain = CreateWindow( hwClassName, hwWindowName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
0, iyt * 2, ix, iyt, NULL, NULL, hInst, NULL);
if (!hwMain) goto THE_END;
@ -898,7 +904,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
Size of windows allows display of 80 character line.
Limit window to screen size (if only VGA). */
if (ix < WinLineWidth) WinLineWidth = ix;
MoveWindow( hwMain, 0, (iyt * 2 - 22), WinLineWidth, iyt, FALSE);
MoveWindow( hwMain, 0, (iyt * 2), WinLineWidth, iyt, FALSE);
ShowWindow( hwMain, nShowState);
ShowWindow( twText, SW_SHOWNORMAL);
ShowWindow( swString, SW_SHOWNORMAL);

Loading…
Cancel
Save