1 /*This file is a part of luscus project*/
2 /*Licensed under the Academic Free License version 3.0*/
3 #include<gtk/gtk.h>
4 #ifdef GTK_GLEXT
5 #include<gtk/gtkgl.h>
6 #else
7 #include<gdk/gdkx.h>
8 #include<GL/glx.h>
9 #endif
10 #include<gdk/gdkkeysyms.h>
11 #include<math.h>
12 #include<GL/gl.h>
13 #include"luscus.h"
14 #include"gv.h"
15 #include"gv_gtk.h"
16 #include"gv_functions.h"
17 #include"gv_gtk_multiview.h"
18
19 /*minimal size of the subwindow in pixels*/
20 #define MINW 250
21 #define MINH 250
22
23 #ifdef GTK_GLEXT
24
25 #define BEGIN_OGL_STUFF \
26 GdkWindow *window = gtk_widget_get_window(widget); \
27 GdkGLContext *glcontext = gtk_widget_get_gl_context(widget); \
28 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget); \
29 if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext)) return FALSE
30
31 #define END_OGL_STUFF gdk_gl_drawable_gl_end(gldrawable);
32 #define SWAP_OGL_BUFFERS gdk_gl_drawable_swap_buffers(gldrawable);
33
34 #else
35
36 GdkVisual* gvisual;
37 Colormap gxcolormap;
38 Display *gdisplay;
39
40 #ifdef GTK2
41 #define BEGIN_OGL_STUFF \
42 GdkWindow *window = gtk_widget_get_window(widget); \
43 Display *display = gdk_x11_display_get_xdisplay(gdk_window_get_display(window)); \
44 int id = gdk_x11_drawable_get_xid(window); \
45 if (!glXMakeCurrent(display, id, context)) return FALSE
46
47 #endif
48 #ifdef GTK3
49 #define BEGIN_OGL_STUFF \
50 GdkWindow *window = gtk_widget_get_window(widget); \
51 Display *display = gdk_x11_display_get_xdisplay(gdk_window_get_display(window)); \
52 int id = gdk_x11_window_get_xid(window); \
53 if (!glXMakeCurrent(display, id, context)) return FALSE
54 #endif
55
56 #define END_OGL_STUFF
57 #define SWAP_OGL_BUFFERS glXSwapBuffers(display, id);
58
59 #endif
60
61 static gboolean luscus_init_orb_sub_callback(GtkWidget*, gpointer);
62 static gboolean luscus_init_sizes_orb_callback(GtkWidget*, GdkEventConfigure*, gpointer);
63 #ifdef GTK2
64 static gboolean draw_callback(GtkWidget*, GdkEventExpose*, gpointer);
65 #endif
66 #ifdef GTK3
67 static gboolean draw_callback(GtkWidget*, cairo_t*, gpointer);
68 #endif
69 static gboolean luscus_orb_sub_button_press_event(GtkWidget*, GdkEventButton*, gpointer);
70 static gboolean luscus_orb_sub_button_release_event(GtkWidget*, GdkEventButton*, gpointer);
71 static gboolean luscus_orb_sub_motion_notify_event(GtkWidget*, GdkEventMotion*, gpointer);
72
73 /*void draw_Surface(void);*/
74 static guint idle_id = 0;
75 void luscus_gtk_get_cur_color(int, GLfloat*, GLfloat*, GLfloat*);
76 double cum_ang = 0.;
77 #ifndef GTK_GLEXT
78 GLXContext context;
79 #endif
80
81 const gchar orb_typ[] =
82 {
83 'U', 'F', 'I', '1', '2', '3', 'S', 'D'
84 };
85
86 const char *molcas_icon[] =
87 {
88 "64 64 938 2",
89 " c None",
90 ". c #020500",
91 "+ c #000400",
92 "@ c #010301",
93 "# c #010400",
94 "$ c #030600",
95 "% c #040400",
96 "& c #030200",
97 "* c #050100",
98 "= c #060100",
99 "- c #020101",
100 "; c #020201",
101 "> c #010302",
102 ", c #000300",
103 "' c #050200",
104 ") c #0C0200",
105 "! c #120100",
106 "~ c #170201",
107 "{ c #180300",
108 "] c #180200",
109 "^ c #140100",
110 "/ c #100100",
111 "( c #0B0000",
112 "_ c #090000",
113 ": c #020202",
114 "< c #010200",
115 "[ c #010300",
116 "} c #130100",
117 "| c #1D0200",
118 "1 c #240000",
119 "2 c #270100",
120 "3 c #2A0300",
121 "4 c #280200",
122 "5 c #250000",
123 "6 c #220100",
124 "7 c #200200",
125 "8 c #1F0200",
126 "9 c #070100",
127 "0 c #030102",
128 "a c #000301",
129 "b c #150200",
130 "c c #2D0300",
131 "d c #330200",
132 "e c #360300",
133 "f c #380100",
134 "g c #3A0100",
135 "h c #370200",
136 "i c #350300",
137 "j c #330400",
138 "k c #2F0300",
139 "l c #290100",
140 "m c #260100",
141 "n c #210200",
142 "o c #1A0200",
143 "p c #0C0000",
144 "q c #010202",
145 "r c #260300",
146 "s c #2F0200",
147 "t c #3C0200",
148 "u c #420300",
149 "v c #480600",
150 "w c #4D0400",
151 "x c #4C0400",
152 "y c #4B0400",
153 "z c #490500",
154 "A c #480500",
155 "B c #450400",
156 "C c #410200",
157 "D c #3C0100",
158 "E c #380300",
159 "F c #330300",
160 "G c #2C0200",
161 "H c #1A0100",
162 "I c #110100",
163 "J c #040202",
164 "K c #2D0200",
165 "L c #3C0300",
166 "M c #4B0300",
167 "N c #510400",
168 "O c #550500",
169 "P c #570400",
170 "Q c #5A0800",
171 "R c #580500",
172 "S c #580300",
173 "T c #580400",
174 "U c #570600",
175 "V c #540400",
176 "W c #4F0600",
177 "X c #490300",
178 "Y c #450300",
179 "Z c #3F0200",
180 "` c #390200",
181 " . c #260200",
182 ".. c #150100",
183 "+. c #560300",
184 "@. c #5F0500",
185 "#. c #640600",
186 "$. c #660700",
187 "%. c #670500",
188 "&. c #690700",
189 "*. c #680600",
190 "=. c #670600",
191 "-. c #650600",
192 ";. c #620500",
193 ">. c #600600",
194 ",. c #5D0600",
195 "'. c #550300",
196 "). c #500500",
197 "!. c #490400",
198 "~. c #440400",
199 "{. c #3E0300",
200 "]. c #370300",
201 "^. c #290200",
202 "/. c #0D0000",
203 "(. c #620400",
204 "_. c #6B0600",
205 ":. c #730800",
206 "<. c #740800",
207 "[. c #790900",
208 "}. c #7A0900",
209 "|. c #730900",
210 "1. c #720800",
211 "2. c #6C0600",
212 "3. c #680800",
213 "4. c #640700",
214 "5. c #600400",
215 "6. c #5B0400",
216 "7. c #4E0400",
217 "8. c #470400",
218 "9. c #3B0100",
219 "0. c #2B0200",
220 "a. c #1B0200",
221 "b. c #530400",
222 "c. c #7F0700",
223 "d. c #850800",
224 "e. c #870900",
225 "f. c #8A0600",
226 "g. c #860A00",
227 "h. c #860900",
228 "i. c #830700",
229 "j. c #800700",
230 "k. c #7E0800",
231 "l. c #7D0900",
232 "m. c #760900",
233 "n. c #700500",
234 "o. c #6D0700",
235 "p. c #6A0700",
236 "q. c #650700",
237 "r. c #5E0400",
238 "s. c #5A0400",
239 "t. c #550200",
240 "u. c #3E0100",
241 "v. c #340300",
242 "w. c #2A0100",
243 "x. c #230100",
244 "y. c #040001",
245 "z. c #020600",
246 "A. c #7B0700",
247 "B. c #920B00",
248 "C. c #970600",
249 "D. c #990800",
250 "E. c #970800",
251 "F. c #940A00",
252 "G. c #930900",
253 "H. c #930800",
254 "I. c #920800",
255 "J. c #8F0A00",
256 "K. c #8C0B00",
257 "L. c #870B00",
258 "M. c #840600",
259 "N. c #810700",
260 "O. c #7E0900",
261 "P. c #770700",
262 "Q. c #720700",
263 "R. c #6E0600",
264 "S. c #690800",
265 "T. c #620600",
266 "U. c #5D0500",
267 "V. c #400200",
268 "W. c #2B0100",
269 "X. c #240100",
270 "Y. c #190200",
271 "Z. c #040700",
272 "`. c #870800",
273 " + c #A00A00",
274 ".+ c #9F0B00",
275 "++ c #A10A00",
276 "@+ c #A40B00",
277 "#+ c #A30B00",
278 "$+ c #A00800",
279 "%+ c #9B0A00",
280 "&+ c #980800",
281 "*+ c #960800",
282 "=+ c #8F0900",
283 "-+ c #8B0800",
284 ";+ c #820800",
285 ">+ c #710700",
286 ",+ c #6B0800",
287 "'+ c #5E0500",
288 ")+ c #580700",
289 "!+ c #480400",
290 "~+ c #080000",
291 "{+ c #570500",
292 "]+ c #9E0B00",
293 "^+ c #A30700",
294 "/+ c #AA0900",
295 "(+ c #AD0A00",
296 "_+ c #AA0A00",
297 ":+ c #A60A00",
298 "<+ c #A30A00",
299 "[+ c #A00900",
300 "}+ c #9C0900",
301 "|+ c #950800",
302 "1+ c #910A00",
303 "2+ c #8C0900",
304 "3+ c #820900",
305 "4+ c #7B0900",
306 "5+ c #740700",
307 "6+ c #6D0600",
308 "7+ c #680700",
309 "8+ c #590400",
310 "9+ c #500400",
311 "0+ c #3E0200",
312 "a+ c #060201",
313 "b+ c #140500",
314 "c+ c #210300",
315 "d+ c #220200",
316 "e+ c #AC0B00",
317 "f+ c #B40B00",
318 "g+ c #B00A00",
319 "h+ c #AB0900",
320 "i+ c #A80A00",
321 "j+ c #A70B00",
322 "k+ c #940800",
323 "l+ c #8E0900",
324 "m+ c #890900",
325 "n+ c #830800",
326 "o+ c #750800",
327 "p+ c #6C0700",
328 "q+ c #670700",
329 "r+ c #5F0400",
330 "s+ c #580600",
331 "t+ c #310300",
332 "u+ c #030201",
333 "v+ c #270300",
334 "w+ c #100200",
335 "x+ c #AB0A00",
336 "y+ c #B90B00",
337 "z+ c #B50A00",
338 "A+ c #B10B00",
339 "B+ c #AF0B00",
340 "C+ c #AA0700",
341 "D+ c #A60C00",
342 "E+ c #A30D00",
343 "F+ c #9D0A00",
344 "G+ c #970A00",
345 "H+ c #910900",
346 "I+ c #8D0A00",
347 "J+ c #820600",
348 "K+ c #670800",
349 "L+ c #560500",
350 "M+ c #4B0200",
351 "N+ c #430400",
352 "O+ c #380200",
353 "P+ c #080100",
354 "Q+ c #010600",
355 "R+ c #250800",
356 "S+ c #220300",
357 "T+ c #A50A00",
358 "U+ c #B80A00",
359 "V+ c #B80B00",
360 "W+ c #B50B00",
361 "X+ c #B30D00",
362 "Y+ c #B40A00",
363 "Z+ c #B10A00",
364 "`+ c #A90D00",
365 " @ c #A20A00",
366 ".@ c #870700",
367 "+@ c #530600",
368 "@@ c #4A0300",
369 "#@ c #3F0400",
370 "$@ c #280100",
371 "%@ c #1E0200",
372 "&@ c #0A0000",
373 "*@ c #030101",
374 "=@ c #0A0100",
375 "-@ c #AC0A00",
376 ";@ c #BB0C00",
377 ">@ c #B70C00",
378 ",@ c #BF0C00",
379 "'@ c #BA0E00",
380 ")@ c #AD0E00",
381 "!@ c #970900",
382 "~@ c #940900",
383 "{@ c #850B00",
384 "]@ c #7C0800",
385 "^@ c #730700",
386 "/@ c #4F0500",
387 "(@ c #3A0200",
388 "_@ c #140200",
389 ":@ c #540500",
390 "<@ c #590500",
391 "[@ c #320300",
392 "}@ c #040200",
393 "|@ c #AC0E00",
394 "1@ c #BF0D00",
395 "2@ c #C10D00",
396 "3@ c #BB0B00",
397 "4@ c #C00C00",
398 "5@ c #BB0E00",
399 "6@ c #B20D00",
400 "7@ c #AA0C00",
401 "8@ c #9E0900",
402 "9@ c #980A00",
403 "0@ c #920900",
404 "a@ c #8A0900",
405 "b@ c #820700",
406 "c@ c #700700",
407 "d@ c #4A0400",
408 "e@ c #340400",
409 "f@ c #2C0500",
410 "g@ c #050201",
411 "h@ c #AB0B00",
412 "i@ c #C10E00",
413 "j@ c #CB0C00",
414 "k@ c #DD1000",
415 "l@ c #BE0E00",
416 "m@ c #A90C00",
417 "n@ c #A10B00",
418 "o@ c #810900",
419 "p@ c #780800",
420 "q@ c #650800",
421 "r@ c #460400",
422 "s@ c #1F0100",
423 "t@ c #0E0100",
424 "u@ c #850900",
425 "v@ c #6F0600",
426 "w@ c #2C0400",
427 "x@ c #000A02",
428 "y@ c #000A03",
429 "z@ c #000803",
430 "A@ c #AC0C00",
431 "B@ c #B90D00",
432 "C@ c #CE0B00",
433 "D@ c #F10F00",
434 "E@ c #B90E00",
435 "F@ c #A20C00",
436 "G@ c #600500",
437 "H@ c #550600",
438 "I@ c #4A0500",
439 "J@ c #3F0300",
440 "K@ c #300400",
441 "L@ c #230000",
442 "M@ c #6E0800",
443 "N@ c #880A00",
444 "O@ c #950700",
445 "P@ c #8A0B00",
446 "Q@ c #660500",
447 "R@ c #470300",
448 "S@ c #001A07",
449 "T@ c #001B08",
450 "U@ c #001A08",
451 "V@ c #001507",
452 "W@ c #000E03",
453 "X@ c #010601",
454 "Y@ c #020200",
455 "Z@ c #4A0700",
456 "`@ c #9D0900",
457 " # c #CC0D00",
458 ".# c #EC0F00",
459 "+# c #EC1100",
460 "@# c #B10D00",
461 "## c #B80F00",
462 "$# c #A80D00",
463 "%# c #9C0B00",
464 "&# c #910800",
465 "*# c #8A0A00",
466 "=# c #790800",
467 "-# c #630600",
468 ";# c #5A0300",
469 "># c #4C0300",
470 ",# c #430300",
471 "'# c #170200",
472 ")# c #060101",
473 "!# c #9B0900",
474 "~# c #9D0800",
475 "{# c #610600",
476 "]# c #470500",
477 "^# c #3C0400",
478 "/# c #190300",
479 "(# c #011A04",
480 "_# c #003211",
481 ":# c #002D0E",
482 "<# c #00290D",
483 "[# c #00250B",
484 "}# c #001E0A",
485 "|# c #001205",
486 "1# c #000A04",
487 "2# c #060200",
488 "3# c #230101",
489 "4# c #C80E00",
490 "5# c #E10B00",
491 "6# c #CF0F00",
492 "7# c #B90F00",
493 "8# c #B40C00",
494 "9# c #5D0400",
495 "0# c #4F0300",
496 "a# c #350100",
497 "b# c #290300",
498 "c# c #080101",
499 "d# c #760B00",
500 "e# c #930A00",
501 "f# c #A80E00",
502 "g# c #7D0700",
503 "h# c #5E0700",
504 "i# c #5C0300",
505 "j# c #2C0300",
506 "k# c #002E0B",
507 "l# c #003810",
508 "m# c #00370F",
509 "n# c #00330F",
510 "o# c #002E0D",
511 "p# c #002B0D",
512 "q# c #001F0A",
513 "r# c #021102",
514 "s# c #110501",
515 "t# c #2A0001",
516 "u# c #340005",
517 "v# c #2D0002",
518 "w# c #900900",
519 "x# c #BA0B00",
520 "y# c #C50D00",
521 "z# c #B90C00",
522 "A# c #A50D00",
523 "B# c #9C0C00",
524 "C# c #890A00",
525 "D# c #6B0700",
526 "E# c #530300",
527 "F# c #3A0001",
528 "G# c #190100",
529 "H# c #080001",
530 "I# c #B60C00",
531 "J# c #A40C00",
532 "K# c #640400",
533 "L# c #800A00",
534 "M# c #720600",
535 "N# c #4B0700",
536 "O# c #0B2307",
537 "P# c #00390F",
538 "Q# c #00390C",
539 "R# c #023202",
540 "S# c #013508",
541 "T# c #00370E",
542 "U# c #00320E",
543 "V# c #032509",
544 "W# c #161401",
545 "X# c #270800",
546 "Y# c #2C0201",
547 "Z# c #1F0001",
548 "`# c #0D0100",
549 " $ c #010500",
550 ".$ c #BC0D00",
551 "+$ c #BE0D00",
552 "@$ c #AA0B00",
553 "#$ c #9D0B00",
554 "$$ c #950900",
555 "%$ c #8D0C00",
556 "&$ c #830500",
557 "*$ c #770800",
558 "=$ c #630700",
559 "-$ c #2B0300",
560 ";$ c #020300",
561 ">$ c #8D0900",
562 ",$ c #B70E00",
563 "'$ c #900B00",
564 ")$ c #700600",
565 "!$ c #511701",
566 "~$ c #023308",
567 "{$ c #003D08",
568 "]$ c #093A01",
569 "^$ c #0B3700",
570 "/$ c #093700",
571 "($ c #013805",
572 "_$ c #003A0E",
573 ":$ c #062E07",
574 "<$ c #241C00",
575 "[$ c #1D1401",
576 "}$ c #0E1103",
577 "|$ c #020701",
578 "1$ c #C30E00",
579 "2$ c #BE0C00",
580 "3$ c #BC0B00",
581 "4$ c #AC0800",
582 "5$ c #980900",
583 "6$ c #940700",
584 "7$ c #B70A00",
585 "8$ c #B40F00",
586 "9$ c #710600",
587 "0$ c #9C0A00",
588 "a$ c #2C2701",
589 "b$ c #003E07",
590 "c$ c #054206",
591 "d$ c #133F00",
592 "e$ c #134100",
593 "f$ c #0E3A00",
594 "g$ c #053D01",
595 "h$ c #00390B",
596 "i$ c #062E0A",
597 "j$ c #032D0B",
598 "k$ c #002209",
599 "l$ c #001306",
600 "m$ c #000602",
601 "n$ c #B00B00",
602 "o$ c #A40A00",
603 "p$ c #920700",
604 "q$ c #870A00",
605 "r$ c #710800",
606 "s$ c #640500",
607 "t$ c #5A0200",
608 "u$ c #BB0D00",
609 "v$ c #9F0A00",
610 "w$ c #690900",
611 "x$ c #460300",
612 "y$ c #781400",
613 "z$ c #063705",
614 "A$ c #00470C",
615 "B$ c #144701",
616 "C$ c #184900",
617 "D$ c #194A00",
618 "E$ c #174600",
619 "F$ c #074001",
620 "G$ c #003E02",
621 "H$ c #003C0B",
622 "I$ c #003B0E",
623 "J$ c #003912",
624 "K$ c #002D0D",
625 "L$ c #001E09",
626 "M$ c #000E04",
627 "N$ c #C00E00",
628 "O$ c #B70B00",
629 "P$ c #B00C00",
630 "Q$ c #A70800",
631 "R$ c #720900",
632 "S$ c #2A0200",
633 "T$ c #B40D00",
634 "U$ c #8C0A00",
635 "V$ c #004912",
636 "W$ c #0A4D08",
637 "X$ c #194C00",
638 "Y$ c #1B4F00",
639 "Z$ c #1C5400",
640 "`$ c #174900",
641 " % c #074301",
642 ".% c #003F04",
643 "+% c #00410C",
644 "@% c #004314",
645 "#% c #003711",
646 "$% c #00280B",
647 "%% c #001807",
648 "&% c #000D04",
649 "*% c #C30F00",
650 "=% c #BD0C00",
651 "-% c #B30B00",
652 ";% c #A80B00",
653 ">% c #710900",
654 ",% c #560400",
655 "'% c #3A0000",
656 ")% c #270200",
657 "!% c #6C0800",
658 "~% c #280300",
659 "{% c #004716",
660 "]% c #005817",
661 "^% c #104F03",
662 "/% c #1B5000",
663 "(% c #1C5600",
664 "_% c #1D5F00",
665 ":% c #1D6000",
666 "<% c #1A5400",
667 "[% c #114800",
668 "}% c #004509",
669 "|% c #004E14",
670 "1% c #004D18",
671 "2% c #003F12",
672 "3% c #00320F",
673 "4% c #00240A",
674 "5% c #010502",
675 "6% c #AA0D00",
676 "7% c #890700",
677 "8% c #7D0800",
678 "9% c #0B0100",
679 "0% c #A30C00",
680 "a% c #004E16",
681 "b% c #00631B",
682 "c% c #095D0C",
683 "d% c #195600",
684 "e% c #1B5C00",
685 "f% c #0F5F00",
686 "g% c #044E00",
687 "h% c #005716",
688 "i% c #005A19",
689 "j% c #00521A",
690 "k% c #004414",
691 "l% c #003911",
692 "m% c #002C0D",
693 "n% c #001C08",
694 "o% c #000903",
695 "p% c #C40E00",
696 "q% c #500300",
697 "r% c #420200",
698 "s% c #300300",
699 "t% c #005D1B",
700 "u% c #006F22",
701 "v% c #007321",
702 "w% c #066910",
703 "x% c #0E5F00",
704 "y% c #065E03",
705 "z% c #005B0B",
706 "A% c #00641A",
707 "B% c #005E1C",
708 "C% c #00551B",
709 "D% c #004C18",
710 "E% c #003F13",
711 "F% c #00310F",
712 "G% c #002109",
713 "H% c #001005",
714 "I% c #010501",
715 "J% c #AD0D00",
716 "K% c #690600",
717 "L% c #5C0500",
718 "M% c #4C0500",
719 "N% c #3B0300",
720 "O% c #750900",
721 "P% c #006620",
722 "Q% c #007122",
723 "R% c #007726",
724 "S% c #007C26",
725 "T% c #017922",
726 "U% c #056D16",
727 "V% c #145B00",
728 "W% c #065B08",
729 "X% c #00691B",
730 "Y% c #00681E",
731 "Z% c #00621F",
732 "`% c #005819",
733 " & c #004E18",
734 ".& c #004114",
735 "+& c #00350F",
736 "@& c #00260B",
737 "#& c #001407",
738 "$& c #B80D00",
739 "%& c #AD0B00",
740 "&& c #840900",
741 "*& c #660600",
742 "=& c #1C0100",
743 "-& c #4F0400",
744 ";& c #006419",
745 ">& c #007424",
746 ",& c #007323",
747 "'& c #007826",
748 ")& c #007C28",
749 "!& c #017320",
750 "~& c #125C01",
751 "{& c #0B5304",
752 "]& c #006215",
753 "^& c #00671B",
754 "/& c #005F1E",
755 "(& c #004D19",
756 "_& c #00360E",
757 ":& c #001809",
758 "<& c #010803",
759 "[& c #A90A00",
760 "}& c #AF0D00",
761 "|& c #8F0B00",
762 "1& c #5F0600",
763 "2& c #3A0300",
764 "3& c #0A0300",
765 "4& c #090200",
766 "5& c #00671E",
767 "6& c #007021",
768 "7& c #0A5A0B",
769 "8& c #114C00",
770 "9& c #015A11",
771 "0& c #006422",
772 "a& c #005419",
773 "b& c #004A17",
774 "c& c #003F14",
775 "d& c #00340F",
776 "e& c #001305",
777 "f& c #BB0A00",
778 "g& c #AC0900",
779 "h& c #960900",
780 "i& c #860700",
781 "j& c #550400",
782 "k& c #420400",
783 "l& c #2E0200",
784 "m& c #0F0100",
785 "n& c #00661A",
786 "o& c #006E20",
787 "p& c #007023",
788 "q& c #006B1E",
789 "r& c #006A20",
790 "s& c #09560B",
791 "t& c #194400",
792 "u& c #034E0E",
793 "v& c #00581A",
794 "w& c #005319",
795 "x& c #004B18",
796 "y& c #004112",
797 "z& c #00350D",
798 "A& c #032D0D",
799 "B& c #042408",
800 "C& c #4E0B00",
801 "D& c #480300",
802 "E& c #350400",
803 "F& c #1B0100",
804 "G& c #040800",
805 "H& c #005F1C",
806 "I& c #00601C",
807 "J& c #005F20",
808 "K& c #0C4C12",
809 "L& c #283000",
810 "M& c #093805",
811 "N& c #004B19",
812 "O& c #004516",
813 "P& c #003E12",
814 "Q& c #003811",
815 "R& c #4D0300",
816 "S& c #1E0100",
817 "T& c #400400",
818 "U& c #1C0400",
819 "V& c #0A1701",
820 "W& c #170300",
821 "X& c #310200",
822 "Y& c #510500",
823 "Z& c #4A0200",
824 "`& c #250100",
825 " * c #120400",
826 ".* c #570200",
827 "+* c #270400",
828 "@* c #000500",
829 "#* c #030300",
830 "$* c #040600",
831 "%* c #1D0100",
832 "&* c #4E0200",
833 "** c #590900",
834 "=* c #590800",
835 "-* c #520500",
836 ";* c #430500",
837 ">* c #300200",
838 ",* c #030400",
839 "'* c #030302",
840 ")* c #020203",
841 "!* c #060000",
842 "~* c #180100",
843 "{* c #080300",
844 "]* c #6F0700",
845 "^* c #4B0600",
846 "/* c #410500",
847 "(* c #3C0600",
848 "_* c #320400",
849 ":* c #2E0400",
850 "<* c #290400",
851 "[* c #2A0400",
852 "}* c #2A0201",
853 "|* c #2F0100",
854 "1* c #320200",
855 "2* c #3A0500",
856 "3* c #3F0500",
857 "4* c #440500",
858 "5* c #4C0200",
859 "6* c #450500",
860 "7* c #410300",
861 "8* c #360200",
862 "9* c #7F0800",
863 "0* c #840800",
864 "a* c #830900",
865 "b* c #800800",
866 "c* c #7C0900",
867 "d* c #780A00",
868 "e* c #5A0500",
869 "f* c #590600",
870 "g* c #5C0600",
871 "h* c #630800",
872 "i* c #620700",
873 "j* c #5B0800",
874 "k* c #530500",
875 "l* c #540600",
876 "m* c #160200",
877 "n* c #900A00",
878 "o* c #8D0800",
879 "p* c #8B0900",
880 "q* c #8B0B00",
881 "r* c #880900",
882 "s* c #7F0900",
883 "t* c #810A00",
884 "u* c #650500",
885 "v* c #520600",
886 "w* c #980700",
887 "x* c #9A0900",
888 "y* c #9A0B00",
889 "z* c #960B00",
890 "A* c #960A00",
891 "B* c #8C0800",
892 "C* c #980B00",
893 "D* c #6E0700",
894 "E* c #660900",
895 "F* c #5B0500",
896 "G* c #340200",
897 "H* c #1C0200",
898 "I* c #8E0A00",
899 "J* c #9C0800",
900 "K* c #A00B00",
901 "L* c #A20900",
902 "M* c #A00C00",
903 "N* c #9F0D00",
904 "O* c #9A0A00",
905 "P* c #880700",
906 "Q* c #850A00",
907 "R* c #730600",
908 "S* c #5B0300",
909 "T* c #5A0600",
910 "U* c #320100",
911 "V* c #9F0C00",
912 "W* c #A20B00",
913 "X* c #A90800",
914 "Y* c #A90700",
915 "Z* c #AD0800",
916 "`* c #AB0D00",
917 " = c #A70C00",
918 ".= c #A50C00",
919 "+= c #A00700",
920 "@= c #8F0800",
921 "#= c #880B00",
922 "$= c #7D0A00",
923 "%= c #170100",
924 "&= c #040101",
925 "*= c #8E0800",
926 "== c #A10C00",
927 "-= c #AE0E00",
928 ";= c #B01000",
929 ">= c #B30E00",
930 ",= c #BC0C00",
931 "'= c #B40E00",
932 ")= c #AE0C00",
933 "!= c #A60900",
934 "~= c #9F0600",
935 "{= c #7A0800",
936 "]= c #5C0400",
937 "^= c #410400",
938 "/= c #250300",
939 "(= c #0F0000",
940 "_= c #9E0A00",
941 ":= c #B20C00",
942 "<= c #BA0A00",
943 "[= c #BD0E00",
944 "}= c #B71000",
945 "|= c #B31000",
946 "1= c #B50F00",
947 "2= c #B60D00",
948 "3= c #A10900",
949 "4= c #300100",
950 "5= c #230200",
951 "6= c #960700",
952 "7= c #9E0C00",
953 "8= c #AB0800",
954 "9= c #B60A00",
955 "0= c #B41100",
956 "a= c #AB0E00",
957 "b= c #AD0F00",
958 "c= c #B51000",
959 "d= c #A40E00",
960 "e= c #8C0D00",
961 "f= c #960600",
962 "g= c #A70A00",
963 "h= c #BD0B00",
964 "i= c #BA0F00",
965 "j= c #B70F00",
966 "k= c #BA0C00",
967 "l= c #AE0B00",
968 "m= c #A50E00",
969 "n= c #990900",
970 "o= c #8E0B00",
971 "p= c #7A0A00",
972 "q= c #560600",
973 "r= c #2D0100",
974 "s= c #070200",
975 "t= c #AA0800",
976 "u= c #B60B00",
977 "v= c #B91000",
978 "w= c #B80E00",
979 "x= c #AE0900",
980 "y= c #A40D00",
981 "z= c #9A0700",
982 "A= c #3B0200",
983 "B= c #130000",
984 "C= c #990B00",
985 "D= c #B20B00",
986 "E= c #B90A00",
987 "F= c #C10C00",
988 "G= c #BD0D00",
989 "H= c #B00900",
990 "I= c #7B0A00",
991 "J= c #510600",
992 "K= c #370100",
993 "L= c #B00F00",
994 "M= c #AD0C00",
995 "N= c #4D0100",
996 "O= c #0C0300",
997 "P= c #9A0D00",
998 "Q= c #AF1000",
999 "R= c #860800",
1000 "S= c #760800",
1001 "T= c #120200",
1002 "U= c #A80800",
1003 "V= c #AF0E00",
1004 "W= c #A80900",
1005 "X= c #970700",
1006 "Y= c #8B0C00",
1007 "Z= c #5E0600",
1008 "`= c #340100",
1009 " - c #B30A00",
1010 ".- c #9A0800",
1011 "+- c #3D0300",
1012 "@- c #9B0600",
1013 "#- c #830600",
1014 "$- c #610500",
1015 "%- c #440300",
1016 "&- c #970C00",
1017 "*- c #9B0800",
1018 "=- c #7A0700",
1019 "-- c #910700",
1020 ";- c #900800",
1021 ">- c #800900",
1022 ",- c #550A00",
1023 "'- c #7A0600",
1024 ")- c #770601",
1025 "!- c #770701",
1026 "~- c #6A0600",
1027 " ",
1028 " ",
1029 " . + @ @ # # + $ ",
1030 " % & * * * = * - ; > , + , # # ",
1031 " ' ) ! ! ~ { ] ^ ! / ( _ * : < , + [ # . ",
1032 " } | 1 2 3 3 3 4 5 6 7 8 { ! ( 9 0 a + , [ # ",
1033 " b 7 c d e f f f g h i j k l m n o ^ p = q [ + , , ",
1034 " r s t u v w x x y z A B C D E F G 2 6 H I 9 J [ , + [ ",
1035 " K L M N O P Q R S T U V W x X Y Z ` F G .7 ..p * [ + + , ",
1036 " k Y +.@.#.$.%.&.*.=.-.;.>.,.T '.).!.~.{.].s ^.6 o /.* [ + # , ",
1037 " ).(._.:.<.[.}.}.:.|.1.2._.3.4.5.6.U 7.8.~.9.F 0.n a./.* [ + , # ",
1038 " b.1.c.d.e.f.e.g.h.i.j.k.l.m.n.o.p.q.r.s.t.X B u.v.w.x.a./.y.> , [ z. ",
1039 " A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.U w A V.v.W.X.Y.p & , , Z. ",
1040 " `. +.+++@+@+#+++$+%+&+*+H.=+-+`.;+k.P.>+,+q.'+)+).!+C F 0.X.^ ~+@ , , ",
1041 " {+ ]+^+/+(+_+:+<+[+}+&+|+1+2+g.3+4+5+6+7+'+8+9+8.0+v.0.7 I a+, + [ ",
1042 " b+c+d+ e+f+g+h+i+j+<+]+D.k+l+m+n+k.o+p+q+r+s+y ~.9.t+ .| ( u++ [ ",
1043 " v+].s w+ x+y+z+A+B+C+D+E+F+G+H+I+J+c.o+6+K+r.L+M+N+O+K c+} P+> , Q+ ",
1044 " R+L X N+S+ T+U+V+W+X+Y+Z+`+ @&+G..@h.c.<.6+q.U.+@@@#@F $@%@&@*@, # ",
1045 " k !.s.R #@=@ -@;@;@U+>@,@'@)@<+!@~@2+{@]@^@,+;.s./@Y (@c 7 _@= [ , ",
1046 " d :@q+2.<@[@}@ |@1@2@3@4@5@6@7@8@9@0@a@b@A.c@3.5.L+d@C e@m o ~+[ , ",
1047 " U Q.]@^@9+f@g@ # [ [ # h@i@2@j@k@ l@m@n@D.H+a@o@p@p+q@6./@r@E G s@t@*@, ",
1048 " :@<.g.u@v@X w@~+ x@y@z@[ < , # A@B@C@D@ E@m@F@*+l+e.O.:.S.G@H@I@J@K@L@/ * [ ",
1049 " M@N@O@P@Q@R@v.| # S@T@U@V@W@X@Y@[ + Z@`@ #.#+# @###$#%#&#*#N.=#p+-#;#>#,#F m '#)#[ ",
1050 " #.c.!#~#n+{#>#]#^#/# (#_#:#<#[#}#|#1#< 2#3# j+4#5#6#7#y+8#++E.J.M.l.>+&.9#0#B a#b#Y.c#< ",
1051 " d#e#/+f#g#'+s+h#i#7.j#'# k#l#m#n#o#p#q#r#s#t#u#v# w#x#y#l@E@z#V+A#B#H.C#j.<.D#>.E#!+F#w@G#H#[ ",
1052 " ;+ +I#J#:.@.K#P.L#o@M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`# $ [+,@y#.$+$;@@$#$$$%$&$*$p+=$O d@D -$G#H#;$ ",
1053 " >$A@,$'$&.5.)$a@B#h@:+!$~${$]$^$/$($_$:$<$[$}$|$[ , |@1$2$3$I#4$F@5$J.d.]@p+#.S d@{.-$G#= ",
1054 " 6$7$8$k.<@,.9$`.0$8#`+a$b$c$d$e$f$g${$h$i$j$k$l$m$, # >@1$3$V+n$o$D.p$q$]@r$s$t$@@0+-$] }@ ",
1055 " !#u$v$w$@@x$ y$z$A$B$C$D$E$F$G$H$I$J$K$L$M$, [ $ N$2@O$P$Q$!#H.g.k.R$s$S @@^#S$'#' ",
1056 " T+T$U$@@w@ V$W$X$Y$Z$Y$`$ %.%+%@%#%$%%%&%[ # @#*%=%-%;%8@G.f.k.>%s$,%d@'%)%`# ",
1057 " :+n$!%~% {%]%^%/%(%_%:%<%[%}%|%1%2%3%4%l$5%[ i@2@-%6%$+H.7%8%c@-#:@X F x.9% ",
1058 " 0%Y a%b%c%d%e% f%g%h%i%j%k%l%m%n%o%[ n$p%>@A@$+k+g.4+o.>.q%r%s%H ",
1059 " 1+ t%u%v%w%x% y%z%A%B%C%D%E%F%G%H%I% p%;@J%v$H.q$[.K%L%M%N% .t@ ",
1060 " O% P%Q%R%S%T%U%V%W%X%Y%Z%`% &.&+&@&#&m$ $&=%%&]+H+&&o+*&L+r@t+=& ",
1061 " -& ;&>&,&'&)&!&~&{&]&^&/&`%(&.&_&@&:&<& [&i@}&F+|&O.p+1&7.2&^.3& ",
1062 " N+4& 5&6&>&,&,&6&7&8&9&0&i%a&b&c&d&@&e& `@f&g&h&i&o+*&j&k&l&I ",
1063 " k&m&Q+ n&o&p&q&r&s&t&u&v&w&x&y&z&A&B& C&l+e+F+*#=#&.P D&E&F& ",
1064 " >#c+;$G& H&I&J&K&L&M&N&O&P&Q& R&]@g.;+*$7+s.d@` S& ",
1065 " <@8+T&U&Y@+ V& W&X&Y&=.2._.;.{+Z&2&`& * ",
1066 " {#T..*~.+*w+Y@+ @* #*[ # # # @*@*$*}@`#%*s N+&***=*,%0#r@].l .. ",
1067 " 7+o.p+;.-*;*>*8 ! =@& #*& @ + + [ ,*,*& '*)*!*=@! F&~%s 2&~.!.M+>#M !+,#i ^.~*{* ",
1068 " 6+o+*$*$]*&.L%L+^*/*(*_*:*v+r r r 3 <*[*}*|*1*2*3*u 4*!.d@M 5*>#!.6*7*8*W.7 ( # ",
1069 " *$9*M.0*a*b*c*d*9$6+S.-#@.'+e*f*g*h*i*j*H@k*)+s+L+P P O l*N >#w !+N+f t+`&m*}@ ",
1070 " ]@i.m+n*n*w#o*p*q*r*&&o@s*l.P.o+k.J.>$t*)$7+p.K+-.u*;.'+6.f*v*5*!+,#h S$d+/ @ ",
1071 " c.C#H+k+w*x*y*x*D.5$z*A*e#=+B*-+w#o$o$C*n+*$=#<.D*p+p.E*G@F*U M+!+u G*4 H*_ a ",
1072 " n+I*G.J*]+K* @<+L*<+ @M*N*`@J*5$$$O*j+!#P*Q*0*c.c*R*6+,+#.S*T*0#!.u U*2 ] !*# ",
1073 " a@&#E.V*W*X*C+Y*J%C+h+Z*%&`*6% =.=+=E.~@&#@=#=d.k.$=R*o.S.(.F*9+!+u U*2 %=&= ",
1074 " *=G.~#==X*C+e+-=6@;=>=7$,=3$;@'@'=)=!=~=*+G.@=C#M.k.{=>+D#-.]=k*!+^=X&/=(=[ ",
1075 " a@O@_=F@C+A@:=X+W+<=3$[=E@}=|=1=2=5@@#D+3=|+G.w#N@&$l.o+p+$.'+L+!+k&4=5=t@[ ",
1076 " 6=7=#+8=)=-%9=7$x#2$.$E@0=a=b=c=E@,$6%d=`@$$0@e=d.N.[.6+q+'+.*!+T&l&S&p ,* ",
1077 " f=.+g=/+B+f+W+U+x#h=4@i=j=8$1=,$'@k=l=m=M*n=H.o=q$J+p=>+q+'+q=R@{.r==&s= ",
1078 " V*g=t=%&f+u=u=<=3@+$+$;@v=w=i=.$9=x=y=M*z=H.J.q$J+}.n.q+'+k*R@A=b#B=,* ",
1079 " C=:+C+e+D=z+7$V+E=3@,@F=2$,@G=u=H=8=X*]+z=H.&#q$J+I=1.q+L%J=R@K=v+/. ",
1080 " #+C+A@L=W+W+7$y+E=E=3@3$3$z#L=M=t=g=]+z=H.I*q$J+[.p+$.L%N=N+X&%@O= ",
1081 " P=!=h+J%A+z+9=u=9=O$7$9=9=T$Q=h@C+#+]+D.H.o=R=j.S=D#(.R !.t ^.T= ",
1082 " _=U=h+V=P$8#z+u=u=u=9=-%}&e+/+W===]+X=H+Y=&$l.>+&.Z=-*r@`=8 ",
1083 " ++X*t=-=L=P$ -Y+Y+A+}&e+C+X*<+V*.-H.I*d.9*}.2.-.T d@+- . ",
1084 " n@X*t=t=t=-@M=M=M=t=C+W=n@V*@-G.H+r*J+O.D*p.'+9+u X& ",
1085 " B#@+C+X*X*X*X*X*X*0%V*V*.-e#0@a@#-9*:._.>.E#Y s% ",
1086 " C=7= @@+J#F@V*]+#$}+C.e#&#p*J+k.:.p.$-b.%-d ",
1087 " &-O*%+0$*-&+6$0@n*a@q$b*=-r$&.9#q%,# ",
1088 " --;-*=*=7%h.>-]@<.p+{#8+,- ",
1089 " '-)-!-~- ",
1090 " "
1091 };
1092
1093 ORB_DISP *od = NULL;
1094 GtkWidget *layout;
1095
kill_multi_view_win(GtkWidget * widget,gpointer data)1096 void kill_multi_view_win(GtkWidget *widget, gpointer data)
1097 {
1098 gtk_widget_destroy(multi_view_win);
1099 printf("KILL MULTI VIEW WIN\n");
1100
1101 #ifndef GTK_GLEXT
1102 glXDestroyContext(gdisplay, context);
1103 XFreeColormap(gdisplay, gxcolormap);
1104 g_object_unref(G_OBJECT(gvisual));
1105 #endif
1106
1107 g_free(od);
1108 od = NULL;
1109 }
1110
luscus_init_orb_sub_callback(GtkWidget * widget,gpointer data)1111 static gboolean luscus_init_orb_sub_callback(GtkWidget *widget, gpointer data)
1112 {
1113 GLfloat lpos1[4]={-.5,-.5,1,0};
1114 GLfloat lpos2[4]={-1,0,0,0};
1115 GLfloat lwhite[4]={1.,1.,1.,1.};
1116 GLfloat lgray[4]={0.3,0.3,0.3,1.};
1117 float tmp[]={1.0, 1.0, 1.0};
1118 gint iiorb = GPOINTER_TO_INT(data);
1119 gint i, j;
1120 gint currentview;
1121 GLfloat bg0, bg1, bg2, bg3;
1122 GLdouble *mvm_main;
1123 BEGIN_OGL_STUFF;
1124
1125 iorb = iiorb;
1126 bg0=Input_Data.background_color[0];
1127 bg1=Input_Data.background_color[1];
1128 bg2=Input_Data.background_color[2];
1129 bg3=Input_Data.background_color[3];
1130
1131 glLightfv(GL_LIGHT0,GL_POSITION,lpos1);
1132 glLightfv(GL_LIGHT0,GL_DIFFUSE,lwhite);
1133 glLightfv(GL_LIGHT0,GL_SPECULAR,lwhite);
1134
1135 /* glLightfv(GL_LIGHT1,GL_POSITION,lpos2);
1136 glLightfv(GL_LIGHT1,GL_DIFFUSE,lwhite);
1137 glLightfv(GL_LIGHT1,GL_SPECULAR,lwhite);
1138 glLightfv(GL_LIGHT1,GL_AMBIENT,lgray);*/
1139
1140 glEnable(GL_LIGHTING);
1141 glEnable(GL_LIGHT0);
1142
1143 glEnable(GL_COLOR_MATERIAL);
1144
1145 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, tmp);
1146 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100);
1147
1148 glEnable(GL_DEPTH_TEST);
1149
1150 glEnable(GL_BLEND);
1151 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1152
1153 glDisable(GL_CULL_FACE);
1154 glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
1155 glEnable(GL_NORMALIZE);
1156 glShadeModel(GL_SMOOTH);
1157
1158 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE);
1159
1160 /*draw orbital and store it in list*/
1161
1162 od[iiorb].olist = glGenLists(1);
1163 glNewList(od[iiorb].olist, GL_COMPILE);
1164
1165 /* j = 0;
1166 for(i = 0; i < m->ngrids; i++)
1167 if(currentGridData->FltTitle[i]>0)
1168 {
1169 if(j==iorb) {currentview=i; break;}
1170 else j++;
1171 }*/
1172
1173 glMatrixMode(GL_MODELVIEW);
1174 mvm_main = get_main_mvm();
1175
1176 glLoadMatrixd(mvm_main);
1177
1178 if(iiorb < m->ngrids-1)
1179 {
1180 do_remove_grid();
1181 do_load_grid();
1182 /* Do_LoadGrid(currentview,0);*/
1183
1184 luscus_gtk_get_cur_color(od[iiorb].type, &bg0, &bg1, &bg2);
1185 /* if(Input_Data.RainBowBG) getCurIndexColor(&bg0, &bg1, &bg2);*/
1186
1187 glClearColor(bg0, bg1, bg2, bg3);
1188 glClearDepth(1.0);
1189 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1190
1191 /* glDepthMask(GL_FALSE);*/
1192 glDepthMask(GL_TRUE);
1193
1194 draw_molecule_for_multiview();
1195
1196 draw_grid();
1197 }
1198 else
1199 {
1200 glClearColor(Input_Data.background_color[0], Input_Data.background_color[1], Input_Data.background_color[2], Input_Data.background_color[3]);
1201 glClearDepth(1.0);
1202 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
1203
1204 glDepthMask(GL_FALSE);
1205 }
1206
1207 glDepthMask(GL_TRUE);
1208
1209 glEndList();
1210
1211 END_OGL_STUFF
1212 return TRUE;
1213 }
1214
luscus_gtk_get_cur_color(int itype,GLfloat * bg0,GLfloat * bg1,GLfloat * bg2)1215 void luscus_gtk_get_cur_color(int itype, GLfloat* bg0, GLfloat* bg1, GLfloat*bg2) /*this function works what getCurIndexColor does, but since there is a bug in writing "ThisTitle", this function works correctly*/
1216 {
1217 switch(itype)
1218 {
1219 case 0: *bg0=0.0f; *bg1=0.0f; *bg2=0.0f; break;
1220 case 1: *bg0=1.0f; *bg1=0.5f; *bg2=0.5f; break;
1221 case 2: *bg0=1.0f; *bg1=0.78f; *bg2=0.5f; break;
1222 case 3: *bg0=1.0f; *bg1=1.0f; *bg2=0.5f; break;
1223 case 4: *bg0=0.5f; *bg1=0.78f; *bg2=0.5f; break;
1224 case 5: *bg0=0.5f; *bg1=1.0f; *bg2=1.0f; break;
1225 case 6: *bg0=0.5f; *bg1=0.5f; *bg2=1.0f; break;
1226 case 7: *bg0=0.78f; *bg1=0.5f; *bg2=0.78f; break;
1227 default: *bg0=0.0f; *bg1=0.0f; *bg2=0.0f; break;
1228 }
1229 }
1230
1231
luscus_gtk_multiview_redraw_list(int iorb,int type)1232 gboolean luscus_gtk_multiview_redraw_list(int iorb, int type)
1233 {
1234 GdkRectangle rect;
1235 gchar *tmpchar;
1236 GtkWidget *widget;
1237 gdouble w, h;
1238 #ifndef GTK_OLD
1239 GtkAllocation allocation;
1240 #endif
1241
1242 if (od == NULL) return FALSE;
1243 widget = od[iorb].draw;
1244
1245 BEGIN_OGL_STUFF;
1246
1247 od[iorb].type = type;
1248 #ifdef GTK_OLD
1249 w = od[iorb].draw->allocation.width;
1250 h = od[iorb].draw->allocation.height;
1251 #else
1252 gtk_widget_get_allocation(od[iorb].draw, &allocation);
1253
1254 w = allocation.width;
1255 h = allocation.height;
1256 #endif
1257
1258 /* od[iorb].type = luscus_gtk_change_orbital_type(od[iorb].sym_num, od[iorb].index_num);*/
1259
1260 tmpchar = g_strdup_printf("t: %c", orb_types_1_c[type/*od[iorb].type*/]);
1261 gtk_label_set_text(GTK_LABEL(od[iorb].label), tmpchar);
1262 g_free(tmpchar);
1263
1264 redraw_list(iorb);
1265
1266 END_OGL_STUFF;
1267
1268 rect.x = 2;
1269 rect.y = 2;
1270 rect.width=w;
1271 rect.height=h;
1272
1273 gdk_window_invalidate_rect(window, &rect, FALSE);
1274 return TRUE;
1275 }
1276
redraw_list(int iiorb)1277 void redraw_list(int iiorb)
1278 {
1279 gint i, j;
1280 gint currentview;
1281 GLfloat bg0, bg1, bg2, bg3;
1282
1283 bg0=Input_Data.background_color[0];
1284 bg1=Input_Data.background_color[1];
1285 bg2=Input_Data.background_color[2];
1286 bg3=Input_Data.background_color[3];
1287
1288 glDeleteLists(od[iiorb].olist, 1);
1289 od[iiorb].olist = glGenLists(1);
1290
1291 glNewList(od[iiorb].olist, GL_COMPILE);
1292
1293 j = 0;
1294 for(i=0; i< m->ngrids; i++)
1295 if(m->grid_type[i] == ORBITAL)
1296 {
1297 if(j==iiorb) {currentview=i; break;}
1298 else j++;
1299 }
1300
1301 if(currentview< m->ngrids-1)
1302 {
1303 /* do_remove_grid();*/
1304 iorb = iiorb;
1305 do_load_grid(); /*remove_grid; load_grid*/
1306
1307 /* if(Input_Data.RainBowBG)*/
1308 luscus_gtk_get_cur_color(od[iiorb].type, &bg0, &bg1, &bg2);
1309 /* getCurIndexColor(&bg0, &bg1, &bg2);*/
1310
1311 glClearColor(bg0, bg1, bg2, bg3);
1312 glClearDepth(1.0);
1313 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1314
1315 /* glDepthMask(GL_FALSE);*/
1316
1317 draw_molecule_for_multiview();
1318
1319 draw_grid();
1320 }
1321 else
1322 {
1323 glClearColor(Input_Data.background_color[0], Input_Data.background_color[1], Input_Data.background_color[2], Input_Data.background_color[3]);
1324 glClearDepth(1.0);
1325 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
1326
1327 /* glDepthMask(GL_FALSE);*/
1328 }
1329
1330 /* glDepthMask(GL_TRUE); */
1331
1332 glEndList();
1333 }
1334
luscus_init_sizes_orb_callback(GtkWidget * widget,GdkEventConfigure * event,gpointer data)1335 static gboolean luscus_init_sizes_orb_callback(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
1336 { /*this function replaces Init_Sizes and setSizes i Set_Scale*/
1337 #ifdef GTK_OLD
1338 GLfloat h = (GLfloat) (widget->allocation.height);
1339 GLfloat w = (GLfloat) (widget->allocation.width);
1340 #else
1341 GLfloat w, h;
1342
1343 GtkAllocation allocation;
1344 #endif
1345
1346 BEGIN_OGL_STUFF;
1347 #ifndef GTK_OLD
1348 gtk_widget_get_allocation(od[iorb].draw, &allocation);
1349
1350 w = allocation.width;
1351 h = allocation.height;
1352 #endif
1353
1354 /* GLdouble d=Calc_Diameter();
1355
1356 if(d<5) d=5;*/
1357
1358 glViewport (0, 0, w, h);
1359 glMatrixMode(GL_PROJECTION);
1360 glLoadIdentity();
1361
1362 if (w > h) glOrtho(-2.50*w/h, 2.50*w/h, -2.50 * h/w, 2.50 * h/w, -50.0, 3.0 /*GuiState.win_state.front_plane, GuiState.win_state.back_plane*/);
1363 else glOrtho(-2.50, 2.50, -2.50 * h/w, 2.50 * h/w, -50.0, 3.0 /*GuiState.win_state.front_plane, GuiState.win_state.back_plane*/);
1364
1365 glMatrixMode(GL_MODELVIEW);
1366
1367 glLoadIdentity ();
1368
1369 END_OGL_STUFF
1370 return TRUE;
1371 }
1372
1373 #ifdef GTK2
draw_callback(GtkWidget * widget,GdkEventExpose * event,gpointer data)1374 static gboolean draw_callback(GtkWidget *widget, GdkEventExpose *event, gpointer data)
1375 #endif
1376 #ifdef GTK3
1377 static gboolean draw_callback(GtkWidget *widget, cairo_t *cr, gpointer data)
1378 #endif
1379 {
1380 gint iorb = GPOINTER_TO_INT(data);
1381 BEGIN_OGL_STUFF;
1382 /* GLfloat bg0, bg1, bg2, bg3;
1383 gint i, j;
1384 gint currentview;*/
1385
1386 /* bg0=Input_Data.bgcolor[0];
1387 bg1=Input_Data.bgcolor[1];
1388 bg2=Input_Data.bgcolor[2];
1389 bg3=Input_Data.bgcolor[3];
1390
1391 glDepthMask(GL_FALSE);*/
1392 glScalef(od[iorb].size, od[iorb].size, od[iorb].size);
1393 od[iorb].size = 1.0;
1394 glCallList(od[iorb].olist);
1395
1396 SWAP_OGL_BUFFERS
1397 END_OGL_STUFF
1398
1399 return TRUE;
1400 }
1401
luscus_orb_sub_button_press_event(GtkWidget * draw,GdkEventButton * event,gpointer data)1402 static gboolean luscus_orb_sub_button_press_event(GtkWidget *draw, GdkEventButton *event, gpointer data)
1403 {
1404 gint iorb = GPOINTER_TO_INT(data);
1405 gint new_orb_type;
1406 /* GdkGLContext *glcontext;
1407 GdkGLDrawable *gldrawable;
1408 GdkRectangle rect;
1409 gchar *tmpchar;*/
1410 #ifdef GTK_OLD
1411 gdouble w = draw->allocation.width;
1412 gdouble h = draw->allocation.height;
1413 #else
1414 GLfloat w, h;
1415
1416 GtkAllocation allocation;
1417
1418 gtk_widget_get_allocation(od[iorb].draw, &allocation);
1419
1420 w = allocation.width;
1421 h = allocation.height;
1422 #endif
1423
1424 /*luscus_gtk_search_orbital_in_list*/
1425 luscus_gtk_search_orbital_in_list(od[iorb].sym_num, od[iorb].index_num);
1426 if(event->button == 1 || event->button == 3)
1427 {
1428 od[iorb].mx = event->x * 2. / w - 1.;
1429 od[iorb].my = (h - event->y) * 2. / h - 1.;
1430 }
1431 else if (event->button == 2)
1432 {
1433
1434 od[iorb].type = luscus_gtk_change_orbital_type(od[iorb].sym_num, od[iorb].index_num);
1435 /* luscus_gtk_multiview_redraw_list(iorb);*/
1436
1437 /* od[iorb].type = luscus_gtk_change_orbital_type(od[iorb].sym_num, od[iorb].index_num);
1438
1439 tmpchar = g_strdup_printf("t: %c", orb_types_1_c[od[iorb].type]);
1440 gtk_label_set_text(GTK_LABEL(od[iorb].label), tmpchar);
1441 g_free(tmpchar);
1442
1443 glcontext = gtk_widget_get_gl_context(draw);
1444 gldrawable = gtk_widget_get_gl_drawable(draw);
1445
1446 if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext)) return;
1447
1448 redraw_list(iorb);
1449
1450 gdk_gl_drawable_gl_end(gldrawable);
1451
1452 rect.x = 2;
1453 rect.y = 2;
1454 rect.width=w;
1455 rect.height=h;
1456
1457 gdk_window_invalidate_rect(draw->window, &rect, FALSE);*/
1458 }
1459
1460 return TRUE;
1461 }
1462
luscus_orb_sub_button_release_event(GtkWidget * widget,GdkEventButton * event,gpointer data)1463 static gboolean luscus_orb_sub_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
1464 {
1465 /* gint iorb = GPOINTER_TO_INT(data);
1466 printf("button released iorb = %d ccords: %f %f\n", iorb, od[iorb].mx, od[iorb].my);*/
1467
1468 return FALSE;
1469 }
1470
luscus_orb_sub_motion_notify_event(GtkWidget * widget,GdkEventMotion * event,gpointer data)1471 static gboolean luscus_orb_sub_motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
1472 {
1473 gdouble mx;
1474 gdouble my;
1475 gdouble x_ax, y_ax, z_ax, angle;
1476 gdouble dx, dy;
1477 gint iorb = GPOINTER_TO_INT(data);
1478 GdkRectangle rect;
1479
1480 gint currentview;
1481
1482 #ifdef GTK_OLD
1483 gdouble w = widget->allocation.width;
1484 gdouble h = widget->allocation.height;
1485 #else
1486 gdouble w, h;
1487
1488 GtkAllocation allocation;
1489 #endif
1490
1491 BEGIN_OGL_STUFF;
1492
1493 mx = event->x * 2. / w - 1.;
1494 my = (h - event->y) * 2. / h - 1.;
1495
1496 #ifndef GTK_OLD
1497 gtk_widget_get_allocation(od[iorb].draw, &allocation);
1498
1499 w = allocation.width;
1500 h = allocation.height;
1501 #endif
1502
1503 dx = mx - od[iorb].mx;
1504 dy = my - od[iorb].my;
1505
1506 if (event->state & GDK_BUTTON1_MASK)
1507 {
1508 x_ax = (od[iorb].my - my);
1509 y_ax = (mx - od[iorb].mx);
1510 z_ax = (od[iorb].mx * my - mx * od[iorb].my);
1511
1512
1513 angle = sqrt((x_ax*x_ax+y_ax*y_ax+z_ax*z_ax) / (mx*mx+my*my+1) * (od[iorb].mx*od[iorb].mx+od[iorb].my*od[iorb].my+1));
1514 angle*=(180.0e0/M_PI);
1515 cum_ang += fabs(angle);
1516 if (cum_ang > 45.0)
1517 {
1518 redraw_list(iorb); /*this automatically resorts surfaces also!*/
1519 cum_ang = 0.0;
1520 }
1521 /* if (angle > 1.) angle = 1.;
1522 if (angle < -1.) angle = -1.;*/
1523
1524 glMatrixMode(GL_MODELVIEW);
1525 glGetDoublev(GL_MODELVIEW_MATRIX,od[iorb].mvm);
1526 glLoadIdentity();
1527 glRotated(angle,x_ax,y_ax,z_ax);
1528 glMultMatrixd(od[iorb].mvm);
1529 }
1530 else if (event->state & GDK_BUTTON3_MASK)
1531 {
1532 if (2.0 * fabs(dy) < fabs(dx))
1533 {
1534 if (dx > 0.0) od[iorb].size *= 1.01;
1535 else od[iorb].size /= 1.01;
1536 }
1537 else
1538 {
1539 if (dy > 0.0) Input_Data.lev*=1.01;
1540 else Input_Data.lev*=0.99;
1541 make_surfaces();
1542 redraw_list(iorb);
1543 }
1544 /* printf("od - size = %f lev = %f\n", od[iorb].size, Input_Data.lev);*/
1545
1546 }
1547
1548 rect.x = 2;
1549 rect.y = 2;
1550 rect.width=w;
1551 rect.height=h;
1552
1553 gdk_window_invalidate_rect(window, &rect, FALSE);
1554
1555 END_OGL_STUFF
1556
1557 od[iorb].mx = mx;
1558 od[iorb].my = my;
1559 return TRUE;
1560 }
1561
luscus_multi_view_key_press(GtkWidget * window,GdkEventKey * event,gpointer data)1562 gboolean luscus_multi_view_key_press(GtkWidget* window, GdkEventKey* event, gpointer data)
1563 {
1564 printf("KEY PRESS EVENT!\n");
1565 if (!m->ngrids) return FALSE;
1566 switch(event->keyval)
1567 {
1568 case GDK_KEY_1:
1569 #ifdef GTK_OLD
1570 case GDK_KP_1:
1571 #else
1572 case GDK_KEY_KP_1:
1573 #endif
1574 case 1:
1575 change_orbital_type(ORBITAL_TYPE_1);
1576 break;
1577 case GDK_KEY_2:
1578 #ifdef GTK_OLD
1579 case GDK_KP_2:
1580 #else
1581 case GDK_KEY_KP_2:
1582 #endif
1583 case 2:
1584 case 'a':
1585 change_orbital_type(ORBITAL_TYPE_2);
1586 break;
1587 case GDK_KEY_3:
1588 #ifdef GTK_OLD
1589 case GDK_KP_3:
1590 #else
1591 case GDK_KEY_KP_3:
1592 #endif
1593 case 3:
1594 change_orbital_type(ORBITAL_TYPE_3);
1595 break;
1596 case 's':
1597 change_orbital_type(ORBITAL_TYPE_S);
1598 break;
1599 case 'd':
1600 change_orbital_type(ORBITAL_TYPE_D);
1601 break;
1602 case 'f':
1603 change_orbital_type(ORBITAL_TYPE_F);
1604 break;
1605 case 'i':
1606 change_orbital_type(ORBITAL_TYPE_I);
1607 break;
1608 }
1609 return FALSE;
1610 }
1611
1612 /*gboolean luscus_multi_view_win_resize(GtkWidget *window, GdkEvent *event, gpointer data)
1613 {
1614 arrange_frames_in_layout();
1615 }*/
1616
arrange_frames_in_layout(void)1617 void arrange_frames_in_layout(void)
1618 {
1619 gint i;
1620 gint frames_in_row;
1621 #ifdef GTK3
1622 GtkAllocation allocation;
1623 #endif
1624
1625 for(i = 0; i < number_of_orbitals; i++) gtk_widget_set_size_request(od[i].frame, MINW + magnification_level*10, MINH + magnification_level*10);
1626
1627 #ifdef GTK2
1628 frames_in_row = layout->allocation.width / (MINW + magnification_level * 10);
1629 #endif
1630 #ifdef GTK3
1631 gtk_widget_get_allocation(layout, &allocation);
1632 frames_in_row = allocation.width / (MINW + magnification_level * 10);
1633 #endif
1634 gtk_layout_set_size(GTK_LAYOUT(layout), frames_in_row * (MINW + magnification_level * 10), (number_of_orbitals/frames_in_row + 1) * (MINH + magnification_level * 10));
1635
1636 for(i = 0; i < number_of_orbitals; i++)
1637 gtk_layout_move(GTK_LAYOUT(layout), od[i].frame, (MINW + magnification_level * 10)*(i%frames_in_row), (MINH + magnification_level * 10)*(i/frames_in_row));
1638
1639 }
1640
magnify_frames(GtkWidget button,gpointer data)1641 void magnify_frames(GtkWidget button, gpointer data)
1642 {
1643 magnification_level++;
1644 arrange_frames_in_layout();
1645 }
1646
extenuate_frames(GtkWidget button,gpointer data)1647 void extenuate_frames(GtkWidget button, gpointer data)
1648 {
1649 magnification_level--;
1650 arrange_frames_in_layout();
1651 }
1652
luscus_gtk_wsub_create(gint iod)1653 void luscus_gtk_wsub_create(gint iod)
1654 {
1655 GtkWidget *hbox, *vbox;
1656 /*GtkWidget *draw;*/
1657 GtkWidget *label;
1658 #ifdef GTK_GLEXT
1659 GdkGLConfig *glconfig;
1660 #else
1661 int attributes[] ={GLX_RGBA,
1662 GLX_ALPHA_SIZE, 1,
1663 GLX_RED_SIZE, 1,
1664 GLX_GREEN_SIZE, 1,
1665 GLX_BLUE_SIZE, 1,
1666 GLX_DOUBLEBUFFER, True,
1667 GLX_DEPTH_SIZE, 12,
1668 None};
1669
1670 int xscreen;
1671 GdkScreen *screen;
1672 XVisualInfo *xvisual;
1673 Window root;
1674 #endif
1675 gchar *tmpchar;
1676
1677 od[iod].frame = gtk_frame_new(NULL);
1678 gtk_widget_set_size_request(od[iod].frame, MINW + magnification_level*10, MINH + magnification_level*10);
1679
1680 #ifdef GTK2
1681 vbox = gtk_vbox_new(FALSE, 0);
1682 #endif
1683 #ifdef GTK3
1684 vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
1685 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
1686 #endif
1687 gtk_container_add(GTK_CONTAINER(od[iod].frame), vbox);
1688
1689 #ifdef GTK_GLEXT
1690 glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE);
1691 #else
1692
1693
1694
1695 gdisplay = gdk_x11_get_default_xdisplay();
1696 xscreen = DefaultScreen(gdisplay);
1697 screen = gdk_screen_get_default();
1698 xvisual = glXChooseVisual(gdisplay, xscreen, attributes); /*xscreen => glxvis.id */
1699 gvisual = gdk_x11_screen_lookup_visual(screen, xvisual->visualid); /*xscreen => glxvis.id */
1700 root = RootWindow(gdisplay, xscreen);
1701 gxcolormap = XCreateColormap(gdisplay, root, xvisual->visual, AllocNone);
1702 gtk_widget_set_visual(multi_view_win, gvisual);
1703 context = glXCreateContext(gdisplay, xvisual, NULL, TRUE);
1704 XFree(xvisual);
1705 #endif
1706
1707 od[iod].draw = gtk_drawing_area_new();
1708 gtk_widget_add_events(od[iod].draw, GDK_BUTTON1_MOTION_MASK |
1709 GDK_BUTTON2_MOTION_MASK |
1710 GDK_BUTTON3_MOTION_MASK |
1711 GDK_BUTTON_PRESS_MASK |
1712 GDK_BUTTON_RELEASE_MASK |
1713 GDK_VISIBILITY_NOTIFY_MASK);
1714
1715 gtk_box_pack_start(GTK_BOX(vbox), od[iod].draw, TRUE, TRUE, 0);
1716 #ifdef GTK_GLEXT
1717 gtk_widget_set_gl_capability(od[iod].draw, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE);
1718 #endif
1719 g_signal_connect_after(G_OBJECT(od[iod].draw), "realize", G_CALLBACK(luscus_init_orb_sub_callback), GINT_TO_POINTER(iod));
1720 g_signal_connect(G_OBJECT(od[iod].draw), "configure_event", G_CALLBACK(luscus_init_sizes_orb_callback), NULL);
1721 #ifdef GTK2
1722 g_signal_connect(G_OBJECT(od[iod].draw), "expose_event", G_CALLBACK(draw_callback), GINT_TO_POINTER(iod));
1723 #endif
1724 #ifdef GTK3
1725 g_signal_connect(G_OBJECT(od[iod].draw), "draw", G_CALLBACK(draw_callback), GINT_TO_POINTER(iod));
1726 #endif
1727
1728 g_signal_connect(G_OBJECT(od[iod].draw), "button_press_event", G_CALLBACK(luscus_orb_sub_button_press_event), GINT_TO_POINTER(iod));
1729 g_signal_connect(G_OBJECT(od[iod].draw), "button_release_event", G_CALLBACK(luscus_orb_sub_button_release_event), GINT_TO_POINTER(iod));
1730 g_signal_connect(G_OBJECT(od[iod].draw), "motion_notify_event", G_CALLBACK(luscus_orb_sub_motion_notify_event), GINT_TO_POINTER(iod));
1731
1732 /* g_signal_connect(G_OBJECT(draw), "map_event", G_CALLBACK(luscus_orb_sub_map_event), NULL);
1733 g_signal_connect(G_OBJECT(draw), "unmap_event", G_CALLBACK(luscus_orb_sub_unmap_event), NULL);*/
1734
1735 gtk_widget_show(od[iod].draw);
1736
1737 #ifdef GTK2
1738 hbox = gtk_hbox_new(TRUE, 0);
1739 #endif
1740 #ifdef GTK3
1741 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
1742 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
1743 #endif
1744 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1745
1746 tmpchar = g_strdup_printf("s: %d", od[iod].sym_num);
1747 label = gtk_label_new(tmpchar);
1748 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1749 gtk_widget_show(label);
1750 g_free(tmpchar);
1751
1752 tmpchar = g_strdup_printf("i: %d", od[iod].index_num);
1753 label = gtk_label_new(tmpchar);
1754 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1755 gtk_widget_show(label);
1756 g_free(tmpchar);
1757
1758 tmpchar = g_strdup_printf("t: %c", orb_types_1_c[od[iod].type]);
1759 od[iod].label = gtk_label_new(tmpchar);
1760 gtk_box_pack_start(GTK_BOX(hbox), od[iod].label, FALSE, FALSE, 0);
1761 gtk_widget_show(od[iod].label);
1762 g_free(tmpchar);
1763
1764 gtk_widget_show(hbox);
1765
1766 gtk_widget_show(vbox);
1767
1768 gtk_widget_show(od[iod].frame);
1769 }
1770
luscus_gtk_show_multiorb_window(void)1771 void luscus_gtk_show_multiorb_window(void)
1772 {
1773 GtkWidget *vbox, *hbox;
1774 GtkWidget *scrolled_window;
1775 GtkWidget *button;
1776 GdkPixbuf *pix;
1777 gint lw_w, lw_h; /*layout window width and height*/
1778 gint i, j;
1779 gint norb = 0;
1780 gint frames_in_row;
1781 magnification_level = 0;
1782
1783 pix = gdk_pixbuf_new_from_xpm_data(molcas_icon);
1784 if (GTK_IS_WIDGET(multi_view_win))
1785 {
1786 gtk_widget_destroy(multi_view_win);
1787 g_free(od);
1788 return;
1789 }
1790
1791 for(i = 0; i < m->ngrids; i++)
1792 if (m->grid_type[i] == ORBITAL)
1793 norb++;
1794
1795 number_of_orbitals = norb;
1796 od = (ORB_DISP*) g_malloc(sizeof(ORB_DISP) * norb);
1797
1798 j = 0;
1799 for(i = 0; i < m->ngrids; i++)
1800 {
1801 if (m->grid_type[i] == ORBITAL)
1802 {
1803 od[j].sym_num = m->grid_symmetry[i];
1804 od[j].index_num = m->grid_index[i];
1805 od[j].energ = m->grid_energy[i];
1806 od[j].occ = m->grid_occ[i];
1807 od[j].type = m->orbital_type[i];
1808 j++;
1809 }
1810 }
1811
1812 multi_view_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1813 g_signal_connect(G_OBJECT(multi_view_win), "delete-event", G_CALLBACK(kill_multi_view_win), NULL);
1814 g_signal_connect(G_OBJECT(multi_view_win), "key_press_event", G_CALLBACK(luscus_multi_view_key_press), NULL);
1815 /* g_signal_connect(G_OBJECT(multi_view_win), "configure-event", G_CALLBACK(luscus_multi_view_win_resize), NULL);*/
1816 gtk_window_set_title(GTK_WINDOW(multi_view_win), "Luscus multiview");
1817 if (GDK_IS_PIXBUF(pix)) gtk_window_set_icon(GTK_WINDOW(multi_view_win), pix);
1818
1819 #ifdef GTK2
1820 vbox = gtk_vbox_new(FALSE, 0);
1821 #endif
1822 #ifdef GTK3
1823 vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
1824 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
1825 #endif
1826 gtk_container_add(GTK_CONTAINER(multi_view_win), vbox);
1827
1828 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
1829 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1830 gtk_widget_set_size_request(GTK_WIDGET(scrolled_window), Input_Data.init_screen_size, Input_Data.init_screen_size);
1831 gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
1832 /* gtk_container_add(GTK_CONTAINER(multi_view_win), scrolled_window);*/
1833
1834 layout = gtk_layout_new(NULL, NULL);
1835 gtk_container_add(GTK_CONTAINER(scrolled_window), layout);
1836
1837 frames_in_row = Input_Data.init_screen_size / (MINW + magnification_level * 10);
1838 gtk_layout_set_size(GTK_LAYOUT(layout), frames_in_row * (MINW + magnification_level * 10), (norb/frames_in_row + 1) * (MINH + magnification_level * 10));
1839
1840 j = 0;
1841 for(i = 0; i < m->ngrids; i++)
1842 {
1843 if (m->grid_type[i] == ORBITAL)
1844 {
1845 od[j].size = 1.;
1846 luscus_gtk_wsub_create(j);
1847 gtk_layout_put(GTK_LAYOUT(layout), od[j].frame, (MINW + magnification_level * 10)*(j%frames_in_row), (MINH + magnification_level * 10)*(j/frames_in_row));
1848 j++;
1849 }
1850 }
1851
1852 gtk_widget_show(layout);
1853
1854 gtk_widget_show(scrolled_window);
1855
1856 #ifdef GTK2
1857 hbox = gtk_hbox_new(FALSE, 0);
1858 #endif
1859 #ifdef GTK3
1860 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
1861 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
1862 #endif
1863 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1864
1865 button = gtk_button_new_from_stock(GTK_STOCK_ZOOM_IN);
1866 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1867 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(magnify_frames), NULL);
1868 gtk_widget_show(button);
1869
1870 button = gtk_button_new_from_stock(GTK_STOCK_ZOOM_OUT);
1871 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1872 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(extenuate_frames), NULL);
1873 gtk_widget_show(button);
1874
1875 gtk_widget_show(hbox);
1876 gtk_widget_show(vbox);
1877 gtk_widget_show(multi_view_win);
1878 }
1879
1880
1881