File: w_setup.c

package info (click to toggle)
xfig 1%3A3.2.3.a-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 8,780 kB
  • ctags: 5,921
  • sloc: ansic: 57,498; makefile: 681; sh: 120; csh: 5
file content (101 lines) | stat: -rw-r--r-- 3,496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 * FIG : Facility for Interactive Generation of figures
 * Copyright (c) 1985-1988 by Supoj Sutanthavibul
 * Parts Copyright (c) 1989-2000 by Brian V. Smith
 * Parts Copyright (c) 1991 by Paul King
 *
 * Any party obtaining a copy of these files is granted, free of charge, a
 * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
 * nonexclusive right and license to deal in this software and
 * documentation files (the "Software"), including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons who receive
 * copies from any such party to do so, with the only requirement being
 * that this copyright notice remain intact.
 *
 */

#include "fig.h"
#include "resources.h"
#include "w_cmdpanel.h"
#include "w_icons.h"
#include "w_setup.h"
#include "w_util.h"

#define	NUM_DRAW_SW 17 /* kludge - shouldn't have to edit this by hand */

int		TOOL_WD, TOOL_HT;
int		CMDFORM_WD, CMDFORM_HT = CMD_BUT_HT;
int		NAMEPANEL_WD;
int		MODEPANEL_WD, MODEPANEL_HT;
int		MODEPANEL_SPACE;
int		MSGPANEL_WD;
int		MSGPANEL_HT = 18;
int		MOUSEFUN_HT;
int		INDPANEL_WD;
int		CANVAS_WD, CANVAS_HT;
int		CANVAS_WD_LAND, CANVAS_HT_LAND;
int		CANVAS_WD_PORT, CANVAS_HT_PORT;
int		INTERNAL_BW;
int		TOPRULER_WD, TOPRULER_HT;
int		SIDERULER_WD, SIDERULER_HT;
int		SW_PER_ROW, SW_PER_COL;

setup_sizes(new_canv_wd, new_canv_ht)
    int		    new_canv_wd, new_canv_ht;
{
    int		    NUM_CMD_MENUS;

    /*
     * make the width of the mousefun panel about 1/3 of the size of the
     * canvas width and the cmdpanel the remaining width. Be sure to set it
     * up so that cmdpanel buttons can be allocated a size which divides
     * evenly into the remaining space.
     */
    CANVAS_WD = new_canv_wd;
    if (CANVAS_WD < 10)
	CANVAS_WD = 10;
    CANVAS_HT = new_canv_ht;
    if (CANVAS_HT < 10)
	CANVAS_HT = 10;

    if (appres.RHS_PANEL) {
	SIDERULER_WD = UNITBOX_WD - 3;	  /* must make side ruler wider to show unitbox */
	TOPRULER_WD = CANVAS_WD-UNITBOX_WD+SIDERULER_WD - 2*INTERNAL_BW + 4;
    } else {
	SIDERULER_WD = DEF_RULER_WD + 20;  /* allow for 100's and decimals at large zooms */
	TOPRULER_WD = CANVAS_WD-UNITBOX_WD+SIDERULER_WD - 2*INTERNAL_BW + 2;
    }
    TOPRULER_HT = RULER_WD;
    SIDERULER_HT = CANVAS_HT;
    if (TOPRULER_WD > MAX_TOPRULER_WD)
	TOPRULER_WD = MAX_TOPRULER_WD;
    if (SIDERULER_HT > MAX_SIDERULER_HT)
	SIDERULER_HT = MAX_SIDERULER_HT;

    /* side mode panel */
    MODEPANEL_WD = (MODE_SW_WD + INTERNAL_BW) * SW_PER_ROW + INTERNAL_BW;

    NUM_CMD_MENUS = num_main_menus();	/* kludge - NUM_CMD_MENUS local to w_cmdpanel.c */
    /* width of the command menu button form */
    CMDFORM_WD = NUM_CMD_MENUS*(CMD_BUT_WD+INTERNAL_BW);

    /* filename panel to the right of the command menu buttons */
    NAMEPANEL_WD = MODEPANEL_WD + CANVAS_WD + SIDERULER_WD - CMDFORM_WD - 
			MOUSEFUN_WD - INTERNAL_BW;
    if (NAMEPANEL_WD < 75)
	NAMEPANEL_WD = 75;

    /* message window under command buttons */
    MSGPANEL_WD = CMDFORM_WD + NAMEPANEL_WD - INTERNAL_BW;

    /* lower indicator panel */
    INDPANEL_WD = MODEPANEL_WD + CANVAS_WD + SIDERULER_WD;

    /* space for both modepanel titles (Drawing modes and Editing modes) */
    MODEPANEL_SPACE = 1 + CANVAS_HT + RULER_WD - 
	(MODE_SW_HT + INTERNAL_BW) * (ceil((double)NUM_DRAW_SW/SW_PER_ROW) +
			ceil((double)(NUM_MODE_SW-NUM_DRAW_SW)/SW_PER_ROW));
    if (MODEPANEL_SPACE < 2)
	MODEPANEL_SPACE = 2;
}