1
//------------------------------------------------------------------------
2
// WINDOW : Main application window
3
//------------------------------------------------------------------------
5
// GL-Node Viewer (C) 2004-2007 Andrew Apted
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public License
9
// as published by the Free Software Foundation; either version 2
10
// of the License, or (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
//------------------------------------------------------------------------
19
// this includes everything we need
27
Guix_MainWin *guix_win;
30
#define WINDOW_MIN_W 480
31
#define WINDOW_MIN_H 440
33
#define WINDOW_NORM_W 620
34
#define WINDOW_NORM_H 460
37
static void main_win_close_CB(Fl_Widget *w, void *data)
40
guix_win->want_quit = true;
47
// This routine is meant to delay a short time (e.g. 1/5th of a
48
// second) to allow the window manager to move our windows around.
50
// Hopefully such nonsense doesn't happen under Win32.
52
void WindowSmallDelay(void)
55
Fl::wait(0); usleep(100 * 1000);
56
Fl::wait(0); usleep(100 * 1000);
64
// MainWin Constructor
66
Guix_MainWin::Guix_MainWin(const char *title) :
67
Fl_Double_Window(WINDOW_NORM_W, WINDOW_NORM_H, title)
69
// turn off auto-add-widget mode
72
size_range(WINDOW_MIN_W, WINDOW_MIN_H);
74
// Set initial position.
76
// Note: this may not work properly. It seems that when my window
77
// manager adds the titlebar/border, it moves the actual window
78
// down and slightly to the right, causing subsequent invokations
79
// to keep going lower and lower.
81
/// position(guix_prefs.win_x, guix_prefs.win_y);
83
callback((Fl_Callback *) main_win_close_CB);
85
// set a nice darkish gray for the space between main boxes
86
color(MAIN_BG_COLOR, MAIN_BG_COLOR);
92
int hw = (w() - 8*2 - 4) / 2;
99
menu_bar = MenuCreate(0, 0, w()-200, 28);
102
grid = new W_Grid(0, mh, w()-200, h()-mh);
106
info = new W_Info(w()-200, mh*0, 200, h()-mh*0);
110
build_mode = new Guix_BuildMode(8, 4+mh, hw, 176);
113
misc_opts = new Guix_MiscOptions(8+hw+4, 4+mh, hw, 136);
116
factor = new Guix_FactorBox(8+hw+4, 140+mh, hw, 40);
119
files = new Guix_FileBox(8, 184+mh, w()-8*2, 86);
122
builder = new Guix_BuildButton(8, 274+10+mh, hw, 60);
125
progress = new Guix_ProgressBox(8+hw+4, 274+mh, hw, 74);
128
text_box = new Guix_TextBox(0, 352+mh, w(), h() - 352 - mh);
133
// show window (pass some dummy arguments)
135
char *argv[] = { "nodeview", NULL };
139
// read initial pos, giving 1/5th of a second for the WM to adjust
140
// our window's position (naughty WM...)
143
init_x = x(); init_y = y();
144
init_w = w(); init_h = h();
148
// MainWin Destructor
150
Guix_MainWin::~Guix_MainWin()
156
void Guix_MainWin::WritePrefs()
158
// check if moved or resized
159
if (x() != init_x || y() != init_y)
161
/// guix_prefs.win_x = x();
162
/// guix_prefs.win_y = y();
165
if (w() != init_w || h() != init_h)
167
/// guix_prefs.win_w = w();
168
/// guix_prefs.win_h = h();