PIPS
xv_frames.c File Reference
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/defaults.h>
#include "genC.h"
#include "misc.h"
#include "wpips.h"
#include "xv_sizes.h"
+ Include dependency graph for xv_frames.c:

Go to the source code of this file.

Macros

#define BOUND(x, lb, ub)
 

Functions

void event_procedure (Xv_Window window, Event *event, Notify_arg arg)
 
void install_event_procedure (Xv_Window window)
 
void place_frame (Frame frame, int l, int t)
 
void create_frames ()
 
void place_frames ()
 

Variables

static int display_width
 define MAX(a, b) ((a)>(b) ? (a) : (b)) More...
 
static int display_height
 

Macro Definition Documentation

◆ BOUND

#define BOUND (   x,
  lb,
  ub 
)
Value:
((x)<(lb)) ? (lb) :\
((x)>(ub)) ? (ub) : (x)
static char * x
Definition: split_file.c:159

Definition at line 40 of file xv_frames.c.

Function Documentation

◆ create_frames()

void create_frames ( )

XV_WIDTH, WPIPS_WIDTH, XV_HEIGHT, WPIPS_HEIGHT,

get the display dimensions

Footers added to edit window. RK, 21/05/1993.

Definition at line 91 of file xv_frames.c.

92 {
93  int i;
94  Display *dpy;
95  Xv_Screen screen;
96  int screen_no,display_width,display_height;
97 
98  main_frame = xv_create(NULL, FRAME,
99  FRAME_LABEL, "Wpips",
100  /* XV_WIDTH, WPIPS_WIDTH,
101  XV_HEIGHT, WPIPS_HEIGHT,
102  */ NULL);
104 
105 
106  /* get the display dimensions */
107  dpy = (Display *)xv_get(main_frame, XV_DISPLAY);
108  screen = (Xv_Screen)xv_get(main_frame, XV_SCREEN);
109  screen_no = (int)xv_get(screen, SCREEN_NUMBER);
110 
111  display_width = DisplayWidth(dpy, screen_no);
112  display_height = DisplayHeight(dpy, screen_no);
113 
114  log_frame = xv_create(main_frame, FRAME,
115  XV_SHOW, FALSE,
116  FRAME_DONE_PROC, close_log_subwindow,
119  NULL);
121 
122  xv_set(log_frame, FRAME_LABEL, "Pips Log Window", NULL);
123 
124 
125  /* Footers added to edit window.
126  RK, 21/05/1993. */
127  for (i = 0; i < MAX_NUMBER_OF_WPIPS_WINDOWS; i++)
128  edit_frame[i] = xv_create(main_frame, FRAME,
129  XV_SHOW, FALSE,
130  FRAME_DONE_PROC, hide_window,
131  XV_WIDTH, EDIT_WIDTH,
132  XV_HEIGHT, EDIT_HEIGHT,
133  FRAME_SHOW_FOOTER, TRUE,
134  FRAME_LEFT_FOOTER, "<",
135  FRAME_RIGHT_FOOTER, ">",
136  NULL);
137 
138 
139  help_frame = xv_create(main_frame, FRAME,
140  FRAME_LABEL, "Pips On Line Help Facility",
141  XV_SHOW, FALSE,
142  FRAME_DONE_PROC, hide_window,
143  XV_WIDTH, HELP_WIDTH,
144  XV_HEIGHT, HELP_HEIGHT,
145  NULL);
147 
148  mchoose_frame = xv_create(main_frame, FRAME,
149  XV_SHOW, FALSE,
150  FRAME_DONE_PROC, hide_window,
151  NULL);
153 
154  schoose_frame = xv_create(main_frame, FRAME,
155  XV_SHOW, FALSE,
156  FRAME_DONE_PROC, hide_window,
157  NULL);
159 
160  query_frame = xv_create(main_frame, FRAME,
161  XV_SHOW, FALSE,
162  FRAME_DONE_PROC, hide_window,
163  XV_WIDTH, QUERY_WIDTH,
164  XV_HEIGHT, QUERY_HEIGHT,
165  NULL);
167 
168  options_frame = xv_create(main_frame, FRAME,
169  FRAME_LABEL, "Wpips options",
170  XV_SHOW, FALSE,
171  XV_WIDTH, display_width - EDIT_WIDTH -2*X_WM_DECOR_SIZE,
172  FRAME_DONE_PROC, hide_window,
173  NULL);
175 }
void const char const char const int
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
GtkWidget * mchoose_frame
Definition: gpips-local.h:42
GtkWidget * help_frame
Definition: gpips-local.h:43
GtkWidget * query_frame
Definition: gpips-local.h:42
void close_log_subwindow(GtkWidget *widget, gpointer data)
Definition: gtk_log.c:172
GtkWidget * options_frame
Definition: gtk_props.c:67
#define EDIT_HEIGHT
#define EDIT_HEIGHT 400
Definition: gtk_sizes.h:35
#define HELP_HEIGHT
Definition: gtk_sizes.h:41
#define QUERY_WIDTH
Definition: gtk_sizes.h:50
#define EDIT_WIDTH
Definition: gtk_sizes.h:33
#define QUERY_HEIGHT
Definition: gtk_sizes.h:49
#define HELP_WIDTH
Definition: gtk_sizes.h:40
#define X_WM_DECOR_SIZE
Definition: gtk_sizes.h:28
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
Definition: gtk_utils.c:89
#define WPIPS_LOG_WINDOW_WIDTH_RESSOURCE_NAME
Here are the X ressource stuff:
Definition: wpips-local.h:100
#define MAX_NUMBER_OF_WPIPS_WINDOWS
How many display wondows can be opened :
Definition: wpips-local.h:30
#define WPIPS_LOG_WINDOW_WIDTH_DEFAULT
Definition: wpips-local.h:102
Frame log_frame
Definition: wpips-local.h:40
Frame schoose_frame
Definition: wpips-local.h:38
#define WPIPS_LOG_WINDOW_WIDTH_RESSOURCE_CLASS
Definition: wpips-local.h:101
#define WPIPS_LOG_WINDOW_HEIGHT_DEFAULT
Definition: wpips-local.h:106
Frame edit_frame[MAX_NUMBER_OF_WPIPS_WINDOWS]
Definition: wpips-local.h:41
#define WPIPS_LOG_WINDOW_HEIGHT_RESSOURCE_CLASS
Definition: wpips-local.h:105
#define WPIPS_LOG_WINDOW_HEIGHT_RESSOURCE_NAME
Definition: wpips-local.h:104
static int display_height
Definition: xv_frames.c:45
void install_event_procedure(Xv_Window window)
Definition: xv_frames.c:66
static int display_width
define MAX(a, b) ((a)>(b) ? (a) : (b))
Definition: xv_frames.c:45

References close_log_subwindow(), display_height, display_width, edit_frame, EDIT_HEIGHT, EDIT_WIDTH, help_frame, HELP_HEIGHT, HELP_WIDTH, hide_window(), install_event_procedure(), int, log_frame, main_frame, MAX_NUMBER_OF_WPIPS_WINDOWS, mchoose_frame, options_frame, query_frame, QUERY_HEIGHT, QUERY_WIDTH, schoose_frame, WPIPS_LOG_WINDOW_HEIGHT_DEFAULT, WPIPS_LOG_WINDOW_HEIGHT_RESSOURCE_CLASS, WPIPS_LOG_WINDOW_HEIGHT_RESSOURCE_NAME, WPIPS_LOG_WINDOW_WIDTH_DEFAULT, WPIPS_LOG_WINDOW_WIDTH_RESSOURCE_CLASS, WPIPS_LOG_WINDOW_WIDTH_RESSOURCE_NAME, and X_WM_DECOR_SIZE.

Referenced by wpips_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ event_procedure()

void event_procedure ( Xv_Window  window,
Event *  event,
Notify_arg  arg 
)

Definition at line 49 of file xv_frames.c.

50 {
51  debug_on("WPIPS_EVENT_DEBUG_LEVEL");
52  debug(2, "event_procedure",
53  "Event_id %d, event_action %d\n",
54  event_id(event), event_action(event));
55  switch (event_id(event)) {
56  case LOC_WINENTER :
57  win_set_kbd_focus(window, xv_get(window, XV_XID));
58  debug(2, "event_procedure", "LOC_WINENTER\n");
59  break;
60  }
61  debug_off();
62 }
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189

References debug(), debug_off, and debug_on.

Referenced by install_event_procedure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ install_event_procedure()

void install_event_procedure ( Xv_Window  window)

Definition at line 66 of file xv_frames.c.

67 {
68  xv_set(window,
69  WIN_EVENT_PROC, event_procedure,
70  WIN_CONSUME_EVENTS, LOC_WINENTER, NULL,
71  NULL);
72 }
void event_procedure(Xv_Window window, Event *event, Notify_arg arg)
Definition: xv_frames.c:49

References event_procedure().

Referenced by create_frames().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ place_frame()

void place_frame ( Frame  frame,
int  l,
int  t 
)

We need to estimate the size of the decor added by the widow manager, Y_WM_DECOR_SIZE & X_WM_DECOR_SIZE. RK, 9/10/1993.

Definition at line 75 of file xv_frames.c.

78 {
79  Rect rect;
80 
81  frame_get_rect(frame, &rect);
82 
83  /* We need to estimate the size of the decor added by the widow
84  manager, Y_WM_DECOR_SIZE & X_WM_DECOR_SIZE. RK, 9/10/1993. */
85  rect.r_top = BOUND(t, 0, MAX(0,display_height-rect.r_height-Y_WM_DECOR_SIZE));
86  rect.r_left = BOUND(l, 0, MAX(0,display_width-rect.r_width-X_WM_DECOR_SIZE));
87 
88  frame_set_rect(frame, &rect);
89 }
#define Y_WM_DECOR_SIZE
We need to estimate the size of the decor added by the widow manager, Y_WM_DECOR_SIZE & X_WM_DECOR_SI...
Definition: gtk_sizes.h:27
#define MAX(x, y)
Definition: string.c:110
#define BOUND(x, lb, ub)
Definition: xv_frames.c:40

References BOUND, display_height, display_width, MAX, X_WM_DECOR_SIZE, and Y_WM_DECOR_SIZE.

Referenced by place_frames().

+ Here is the caller graph for this function:

◆ place_frames()

void place_frames ( )

get the display dimensions

warning: some window managers do NOT place the top frame (main_frame) themselves. In this case add this fonction call and modify the call to place_frames().

place_frame(main_frame, (display_width-WPIPS_WIDTH)/2, (display_height-WPIPS_HEIGHT)/2);

in the bottom left :

Above the main frame :

in the upper right corner, in the bottom right corner, etc :

According to the 2 least bits of the window number...

in the upper

in the upper left corner :

in the upper left corner :

in the upper left corner

Definition at line 177 of file xv_frames.c.

178 {
179  Rect rect;
180  int main_l, main_t, main_w, main_h;
181  int main_center_l, main_center_t;
182  int i;
183 
184  Frame full_frame;
185  Xv_Screen screen;
186  Display *dpy;
187  int screen_no;
188 
189  /* get the display dimensions */
190  full_frame = (Frame) xv_create(XV_NULL, FRAME, NULL);
191  dpy = (Display *)xv_get(full_frame, XV_DISPLAY);
192  screen = (Xv_Screen)xv_get(full_frame, XV_SCREEN);
193  screen_no = (int)xv_get(screen, SCREEN_NUMBER);
194  xv_destroy(full_frame);
195 
196  display_width = DisplayWidth(dpy, screen_no);
197  display_height = DisplayHeight(dpy, screen_no);
198 
199  /* warning: some window managers do NOT place the top frame (main_frame)
200  themselves. In this case add this fonction call and modify the call
201  to place_frames().
202 
203  place_frame(main_frame,
204  (display_width-WPIPS_WIDTH)/2,
205  (display_height-WPIPS_HEIGHT)/2);
206  */
207  /* in the bottom left : */
209 
210  frame_get_rect(log_frame, &rect);
211 
212  main_t = rect.r_top;
213  main_w = rect.r_width;
214  main_h = rect.r_height;
215  main_l = rect.r_left;
216 
218  0,
219  main_t - xv_get(main_frame, XV_HEIGHT) - Y_WM_DECOR_SIZE);
220 
221  frame_get_rect(main_frame, &rect);
222 
223  main_t = rect.r_top;
224  main_w = rect.r_width;
225  main_h = rect.r_height;
226  main_l = rect.r_left;
227 
228  main_center_t = main_t+main_h/2;
229  main_center_l = main_l+main_w/2;
230 
231 
232  /* Above the main frame : */
234  0,
235  main_t - xv_get(options_frame, XV_HEIGHT) - Y_WM_DECOR_SIZE);
236 
237  /* in the upper right corner, in the bottom right corner, etc : */
238  for(i = 0; i < MAX_NUMBER_OF_WPIPS_WINDOWS; i++)
239  /* According to the 2 least bits of the window number... */
240  place_frame(edit_frame[i], display_width*(1 - ((i >> 1) & 1)),
241  display_height*(i & 1));
242 
243  /* in the upper */
245  main_l + (main_w - HELP_WIDTH)/2,
246  main_t - HELP_HEIGHT);
247 
248  /* in the upper left corner : */
249  place_frame(mchoose_frame, 0, 0);
250 
251  /* in the upper left corner : */
252  place_frame(schoose_frame, 0, 0);
253 
254  /* in the upper left corner */
256  main_l - QUERY_WIDTH + MIN(main_w, QUERY_WIDTH)/3,
257  main_t - QUERY_HEIGHT - Y_WM_DECOR_SIZE);
258 }
#define MIN(x, y)
minimum and maximum if they are defined somewhere else, they are very likely to be defined the same w...
void place_frame(Frame frame, int l, int t)
Definition: xv_frames.c:75

References display_height, display_width, edit_frame, help_frame, HELP_HEIGHT, HELP_WIDTH, int, log_frame, main_frame, MAX_NUMBER_OF_WPIPS_WINDOWS, mchoose_frame, MIN, options_frame, place_frame(), query_frame, QUERY_HEIGHT, QUERY_WIDTH, schoose_frame, and Y_WM_DECOR_SIZE.

Referenced by main_event_proc(), and wpips_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ display_height

int display_height
static

Definition at line 45 of file xv_frames.c.

Referenced by create_frames(), place_frame(), and place_frames().

◆ display_width

int display_width
static

define MAX(a, b) ((a)>(b) ? (a) : (b))

Definition at line 45 of file xv_frames.c.

Referenced by create_frames(), place_frame(), and place_frames().