aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz
diff options
context:
space:
mode:
Diffstat (limited to 'src/extantz')
-rw-r--r--src/extantz/extantz.c152
-rw-r--r--src/extantz/woMan.c23
2 files changed, 65 insertions, 110 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index 355a195..5a7d030 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -454,90 +454,61 @@ static void init_evas_gl(globals *ourGlobals)
454 454
455//-------------------------// 455//-------------------------//
456 456
457static void _on_menu_focus(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
458{
459 evas_object_raise(obj);
460}
461 457
462static Evas_Object *_menuAdd(Evas_Object *win, Evas_Object *tb, char *label) 458static winFang *_makeMainMenu(globals *ourGlobals)
463{ 459{
464 Evas_Object *menu= NULL; 460 GLData *gld = &ourGlobals->gld;
465 Elm_Object_Item *tb_it; 461 winFang *me;
466 462 Evas_Object *menu, *tb;
467 // Evas_Object * obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data 463 Elm_Object_Item *it;
468 // The function is called when the item is clicked.
469 tb_it = elm_toolbar_item_append(tb, NULL, label, NULL, NULL);
470 // Mark it as a menu.
471 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
472 // This alledgedly marks it as a menu (not true), and gets an Evas_Object for us to play with.
473 menu = elm_toolbar_item_menu_get(tb_it);
474 // Alas this does not work. B-(
475 evas_object_smart_callback_add(menu, "focused", _on_menu_focus, NULL);
476
477 // Priority is for when toolbar items are set to hide or menu when there are too many of them. They get hidden or put on the menu based on priority.
478 elm_toolbar_item_priority_set(tb_it, 9999);
479
480 // The docs for this functien are meaningless, but it wont work right if you leave it out.
481 elm_toolbar_menu_parent_set(tb, win);
482
483 // Add a seperator after, so that there's some visual distinction between menu items.
484 // Coz using all lower case and with no underline on the first letter, it's hard to tell.
485 tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL);
486 elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
487
488 return menu;
489}
490 464
491static void makeMainMenu(globals *ourGlobals) 465 // GL focus gets lost when any menu is used. sigh
492{ 466
493 GLData *gld = &ourGlobals->gld; 467 // Try to work around the borkedness of EFL menus by creating our own window.
494 Evas_Object *menu, *tb; 468 // I can't figure it out, but the main menu wont appear otherwise. It worked before.
495 Elm_Object_Item *tb_it; 469 // TODO - rip out ELMs menu and create my own. It sucks.
496 470 me = winFangAdd(ourGlobals->mainWindow, 0, -4, ourGlobals->win_w, 0, "main menu hack", "mainMenu", ourGlobals->world);
497 // A toolbar thingy. 471
498 tb = eo_add(ELM_TOOLBAR_CLASS, ourGlobals->win, 472 tb = makeMainMenu(me);
499 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), 473 ourGlobals->tb = tb;
500 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), 474
501 elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), 475 menu = menuAdd(ourGlobals->mainWindow, tb, "file");
502 efl_gfx_position_set(0, 0), 476 // Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data
503 elm_obj_toolbar_align_set(0.0) 477 elm_menu_item_add(menu, NULL, NULL, "open", _on_open, ourGlobals);
504 ); 478 elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld);
505 ourGlobals->tb = tb; 479
506 480 menu = menuAdd(ourGlobals->mainWindow, tb, "edit");
507 // Menus. 481 elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL);
508 menu = _menuAdd(ourGlobals->win, tb, "file"); 482
509 // Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data 483 menu = menuAdd(ourGlobals->mainWindow, tb, "view");
510 elm_menu_item_add(menu, NULL, NULL, "open", _on_open, ourGlobals); 484 menu = menuAdd(ourGlobals->mainWindow, tb, "world");
511 elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld); 485 menu = menuAdd(ourGlobals->mainWindow, tb, "tools");
512 486
513 menu = _menuAdd(ourGlobals->win, tb, "edit"); 487 menu = menuAdd(ourGlobals->mainWindow, tb, "help");
514 elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL); 488 elm_menu_item_add(menu, NULL, NULL, "grid help", NULL, NULL);
515 489 elm_menu_item_separator_add(menu, NULL);
516 menu = _menuAdd(ourGlobals->win, tb, "view"); 490 elm_menu_item_add(menu, NULL, NULL, "extantz blogs", NULL, NULL);
517 menu = _menuAdd(ourGlobals->win, tb, "world"); 491 elm_menu_item_add(menu, NULL, NULL, "extantz forum", NULL, NULL);
518 menu = _menuAdd(ourGlobals->win, tb, "tools"); 492 elm_menu_item_separator_add(menu, NULL);
519 493 elm_menu_item_add(menu, NULL, NULL, "about extantz", NULL, NULL);
520 menu = _menuAdd(ourGlobals->win, tb, "help"); 494
521 elm_menu_item_add(menu, NULL, NULL, "grid help", NULL, NULL); 495 menu = menuAdd(ourGlobals->mainWindow, tb, "advanced");
522 elm_menu_item_separator_add(menu, NULL); 496 elm_menu_item_add(menu, NULL, NULL, "debug settings", NULL, NULL);
523 elm_menu_item_add(menu, NULL, NULL, "extantz blogs", NULL, NULL); 497
524 elm_menu_item_add(menu, NULL, NULL, "extantz forum", NULL, NULL); 498 menu = menuAdd(ourGlobals->mainWindow, tb, "god");
525 elm_menu_item_separator_add(menu, NULL); 499
526 elm_menu_item_add(menu, NULL, NULL, "about extantz", NULL, NULL); 500 makeMainMenuFinish(me, tb);
527 501
528 menu = _menuAdd(ourGlobals->win, tb, "advanced"); 502 // Other stuff in the toolbar.
529 elm_menu_item_add(menu, NULL, NULL, "debug settings", NULL, NULL); 503 it = elm_toolbar_item_append(tb, NULL, "restriction icons", NULL, NULL);
530 504 it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(it, EINA_TRUE);
531 menu = _menuAdd(ourGlobals->win, tb, "god"); 505 it = elm_toolbar_item_append(tb, NULL, "hop://localhost/Anarchadia 152, 155, 51 - Lost plot (Adult)", NULL, NULL);
532 506 it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(it, EINA_TRUE);
533 // Other stuff in the toolbar. 507 it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL);
534 tb_it = elm_toolbar_item_append(tb, NULL, "restriction icons", NULL, NULL); 508
535 tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(tb_it, EINA_TRUE); 509 winFangCalcMinSize(me);
536 tb_it = elm_toolbar_item_append(tb, NULL, "hop://localhost/Anarchadia 152, 155, 51 - Lost plot (Adult)", NULL, NULL); 510
537 tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(tb_it, EINA_TRUE); 511 return me;
538 tb_it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL);
539
540 evas_object_show(tb);
541} 512}
542 513
543// Elm inlined image windows needs this to change focus on mouse click. 514// Elm inlined image windows needs this to change focus on mouse click.
@@ -633,6 +604,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
633 setenv("ECORE_EVAS_ENGINE", "opengl_x11", 1); 604 setenv("ECORE_EVAS_ENGINE", "opengl_x11", 1);
634 elm_config_preferred_engine_set("opengl_x11"); 605 elm_config_preferred_engine_set("opengl_x11");
635 elm_config_accel_preference_set("3d"); 606 elm_config_accel_preference_set("3d");
607
636 ourGlobals.mainWindow = winFangAdd(NULL, 0, 0, 50, 20, "extantz virtual world viewer", "extantz", NULL); 608 ourGlobals.mainWindow = winFangAdd(NULL, 0, 0, 50, 20, "extantz virtual world viewer", "extantz", NULL);
637 609
638 ourGlobals.win = ourGlobals.mainWindow->win; 610 ourGlobals.win = ourGlobals.mainWindow->win;
@@ -648,6 +620,8 @@ EAPI_MAIN int elm_main(int argc, char **argv)
648 // Get the screen size. 620 // Get the screen size.
649 elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h); 621 elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h);
650 ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3); 622 ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3);
623 // TODO - Now we have to take the frame height into consideration, didn't have to do that before. Faked for now.
624 ourGlobals.win_y += 28;
651 ourGlobals.win_w = ourGlobals.scr_w / 2; 625 ourGlobals.win_w = ourGlobals.scr_w / 2;
652 ourGlobals.win_h = ourGlobals.scr_h - 30; 626 ourGlobals.win_h = ourGlobals.scr_h - 30;
653 evas_object_move(ourGlobals.win, ourGlobals.win_x, ourGlobals.win_y); 627 evas_object_move(ourGlobals.win, ourGlobals.win_x, ourGlobals.win_y);
@@ -655,6 +629,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
655 629
656 evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); 630 evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals);
657 631
632
658 /* Our "layers". TODO - This is out of date, I should update it. 633 /* Our "layers". TODO - This is out of date, I should update it.
659 634
660 Elm win - our real main window 635 Elm win - our real main window
@@ -693,7 +668,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
693#else 668#else
694 snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get()); 669 snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get());
695 eo_do(ourGlobals.mainWindow->bg, 670 eo_do(ourGlobals.mainWindow->bg,
696 elm_obj_image_file_set(buf, NULL), 671 efl_file_set(buf, NULL),
697 efl_gfx_color_set(255, 255, 255, 255) 672 efl_gfx_color_set(255, 255, 255, 255)
698 ); 673 );
699#endif 674#endif
@@ -710,11 +685,6 @@ EAPI_MAIN int elm_main(int argc, char **argv)
710 ourGlobals.scene->clickCb = _onWorldClick; 685 ourGlobals.scene->clickCb = _onWorldClick;
711#endif 686#endif
712 687
713 // Gotta do this after adding the windows, otherwise the menu renders under the window.
714 // This sucks, gotta redefine this menu each time we create a new window?
715 // Also, GL focus gets lost when any menu is used. sigh
716 makeMainMenu(&ourGlobals);
717
718 ourGlobals.world = ephysicsAdd(&ourGlobals); 688 ourGlobals.world = ephysicsAdd(&ourGlobals);
719 689
720// overlay_add(&ourGlobals); 690// overlay_add(&ourGlobals);
@@ -724,13 +694,14 @@ EAPI_MAIN int elm_main(int argc, char **argv)
724 ourGlobals.LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals.mainWindow, ourGlobals.world); 694 ourGlobals.LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals.mainWindow, ourGlobals.world);
725 ourGlobals.files = filesAdd(&ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); 695 ourGlobals.files = filesAdd(&ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE);
726 696
697 // Gotta do this after adding the windows, otherwise the menu renders under the window.
698 // This sucks, gotta redefine this menu each time we create a new window?
699 _makeMainMenu(&ourGlobals);
700
727 // Try to connect to a local love server. 701 // Try to connect to a local love server.
728 serverStream = eina_strbuf_new(); 702 serverStream = eina_strbuf_new();
729 reachOut("127.0.0.1", 8211 + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _add, (Ecore_Event_Handler_Cb) _data, (Ecore_Event_Handler_Cb) _del); 703 reachOut("127.0.0.1", 8211 + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _add, (Ecore_Event_Handler_Cb) _data, (Ecore_Event_Handler_Cb) _del);
730 704
731 // Bump the top toolbar above the windows.
732 evas_object_raise(ourGlobals.tb);
733
734 _on_resize(&ourGlobals, NULL, NULL, NULL); 705 _on_resize(&ourGlobals, NULL, NULL, NULL);
735 706
736 elm_run(); 707 elm_run();
@@ -747,7 +718,6 @@ EAPI_MAIN int elm_main(int argc, char **argv)
747#if USE_EVAS_3D 718#if USE_EVAS_3D
748 scenriDel(ourGlobals.scene); 719 scenriDel(ourGlobals.scene);
749#endif 720#endif
750// eo_unref(ourGlobals.tb);
751 winFangDel(ourGlobals.mainWindow); 721 winFangDel(ourGlobals.mainWindow);
752 } 722 }
753 723
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c
index 42b31fc..5436cc2 100644
--- a/src/extantz/woMan.c
+++ b/src/extantz/woMan.c
@@ -155,26 +155,14 @@ winFang *woMan_add(globals *ourGlobals)
155{ 155{
156 winFang *me; 156 winFang *me;
157 Evas_Object *bt, *nf, *tab, *tb, *gridList, *viewerList, *menu; 157 Evas_Object *bt, *nf, *tab, *tb, *gridList, *viewerList, *menu;
158 Elm_Object_Item *tb_it, *menu_it, *tab_it; 158 Elm_Object_Item *menu_it, *tab_it;
159 char buf[PATH_MAX]; 159 char buf[PATH_MAX];
160 int i; 160 int i;
161 161
162 me = winFangAdd(ourGlobals->mainWindow, 600, 650, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world); 162 me = winFangAdd(ourGlobals->mainWindow, 600, 650, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world);
163 163
164 // A tab thingy. 164 tb = makeMainMenu(me);
165 tb = elm_toolbar_add(me->win); 165 menu = menuAdd(me, tb, "Menu");
166 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
167 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
168 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
169
170 // Menu.
171 tb_it = elm_toolbar_item_append(tb, NULL, "Menu", NULL, NULL);
172 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
173 // Priority is for when toolbar items are set to hide or menu when there are too many of them. They get hidden or put on the menu based on priority.
174 elm_toolbar_item_priority_set(tb_it, 9999);
175 elm_toolbar_menu_parent_set(tb, me->win);
176 menu = elm_toolbar_item_menu_get(tb_it);
177
178 menu_it = elm_menu_item_add(menu, NULL, NULL, "edit", NULL, NULL); 166 menu_it = elm_menu_item_add(menu, NULL, NULL, "edit", NULL, NULL);
179 elm_menu_item_add(menu, menu_it, NULL, "preferences", NULL, NULL); 167 elm_menu_item_add(menu, menu_it, NULL, "preferences", NULL, NULL);
180 menu_it = elm_menu_item_add(menu, NULL, NULL, "help", NULL, NULL); 168 menu_it = elm_menu_item_add(menu, NULL, NULL, "help", NULL, NULL);
@@ -183,9 +171,7 @@ winFang *woMan_add(globals *ourGlobals)
183 menu_it = elm_menu_item_add(menu, NULL, NULL, "advanced", NULL, NULL); 171 menu_it = elm_menu_item_add(menu, NULL, NULL, "advanced", NULL, NULL);
184 elm_menu_item_add(menu, menu_it, NULL, "debug settings", NULL, NULL); 172 elm_menu_item_add(menu, menu_it, NULL, "debug settings", NULL, NULL);
185 173
186 // The toolbar needs to be packed into the box AFTER the menus are added. 174 makeMainMenuFinish(me, tb);
187 elm_layout_box_append(me->win, WF_BOX, tb);
188 evas_object_show(tb);
189 175
190 gridList = elm_genlist_add(me->win); 176 gridList = elm_genlist_add(me->win);
191 grids = eina_hash_stringshared_new(free); 177 grids = eina_hash_stringshared_new(free);
@@ -280,7 +266,6 @@ winFang *woMan_add(globals *ourGlobals)
280 elm_object_text_set(bt, "Login"); // No eo interface for this that I can find. 266 elm_object_text_set(bt, "Login"); // No eo interface for this that I can find.
281// evas_object_smart_callback_add(bt, "clicked", NULL, NULL); 267// evas_object_smart_callback_add(bt, "clicked", NULL, NULL);
282 elm_layout_box_append(me->win, WF_BOX, bt); 268 elm_layout_box_append(me->win, WF_BOX, bt);
283// eo_unref(bt);
284 269
285 winFangCalcMinSize(me); 270 winFangCalcMinSize(me);
286 271