home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / video / xmovie-1.5.3.tar.gz / xmovie-1.5.3.tar / xmovie-1.5.3 / xmovie / theme.C < prev    next >
C/C++ Source or Header  |  2000-11-29  |  7KB  |  291 lines

  1. #include "asset.h"
  2. #include "bcresources.h"
  3. #include "blond/bg_image_png.h"
  4. #include "blond/bar_left_png.h"
  5. #include "blond/bar_mid_png.h"
  6. #include "blond/bar_right_png.h"
  7. #include "blond/cancel_dn_png.h"
  8. #include "blond/cancel_up_png.h"
  9. #include "blond/cancel_uphi_png.h"
  10. #include "blond/checkbox_checked_png.h"
  11. #include "blond/checkbox_checkedhi_png.h"
  12. #include "blond/checkbox_downhi_png.h"
  13. #include "blond/checkbox_up_png.h"
  14. #include "blond/checkbox_uphi_png.h"
  15. #include "blond/files_icon_dn_png.h"
  16. #include "blond/files_icon_hi_png.h"
  17. #include "blond/files_icon_up_png.h"
  18. #include "blond/files_newfolder_dn_png.h"
  19. #include "blond/files_newfolder_hi_png.h"
  20. #include "blond/files_newfolder_up_png.h"
  21. #include "blond/files_prevdir_dn_png.h"
  22. #include "blond/files_prevdir_hi_png.h"
  23. #include "blond/files_prevdir_up_png.h"
  24. #include "blond/files_text_dn_png.h"
  25. #include "blond/files_text_hi_png.h"
  26. #include "blond/files_text_up_png.h"
  27. #include "blond/framebacksmall_downhi_png.h"
  28. #include "blond/framebacksmall_up_png.h"
  29. #include "blond/framebacksmall_uphi_png.h"
  30. #include "blond/framefwdsmall_downhi_png.h"
  31. #include "blond/framefwdsmall_up_png.h"
  32. #include "blond/framefwdsmall_uphi_png.h"
  33. #include "blond/heroine_bg_png.h"
  34. #include "blond/listbutton_dn_png.h"
  35. #include "blond/listbutton_hi_png.h"
  36. #include "blond/listbutton_up_png.h"
  37. #include "blond/ok_dn_png.h"
  38. #include "blond/ok_up_png.h"
  39. #include "blond/ok_uphi_png.h"
  40. #include "blond/pausesmall_downhi_png.h"
  41. #include "blond/pausesmall_up_png.h"
  42. #include "blond/pausesmall_uphi_png.h"
  43. #include "blond/playsmall_downhi_png.h"
  44. #include "blond/playsmall_up_png.h"
  45. #include "blond/playsmall_uphi_png.h"
  46. #include "blond/slider_hi_png.h"
  47. #include "blond/slider_left_png.h"
  48. #include "blond/slider_mid_png.h"
  49. #include "blond/slider_right_png.h"
  50. #include "blond/slider_dn_png.h"
  51. #include "blond/slider_up_png.h"
  52. #include "blond/slider_uphi_png.h"
  53. #include "blond/usethis_dn_png.h"
  54. #include "blond/usethis_up_png.h"
  55. #include "blond/usethis_uphi_png.h"
  56. #include "guicast.h"
  57. #include "mainmenu.h"
  58. #include "mainwindow.h"
  59. #include "mwindowgui.h"
  60. #include "theme.h"
  61. #include "vframe.h"
  62.  
  63. VFrame *blond_checkbox[5] =
  64. {
  65.     new VFrame(checkbox_up_png),
  66.     new VFrame(checkbox_uphi_png),
  67.     new VFrame(checkbox_checked_png),
  68.     new VFrame(checkbox_downhi_png),
  69.     new VFrame(checkbox_checkedhi_png)
  70. };
  71.  
  72. VFrame *blond_listbutton[3] = 
  73. {
  74.     new VFrame(listbutton_up_png),
  75.     new VFrame(listbutton_hi_png),
  76.     new VFrame(listbutton_dn_png)
  77. };
  78.  
  79. VFrame *blond_bg_image = new VFrame(bg_image_png);
  80. VFrame *blond_play[] = 
  81. {
  82.     new VFrame(playsmall_up_png),
  83.     new VFrame(playsmall_uphi_png),
  84.     new VFrame(playsmall_downhi_png)
  85. };
  86.  
  87. VFrame *blond_frame_fwd[] = 
  88. {
  89.     new VFrame(framefwdsmall_up_png),
  90.     new VFrame(framefwdsmall_uphi_png),
  91.     new VFrame(framefwdsmall_downhi_png)
  92. };
  93.  
  94. VFrame *blond_frame_bck[] = 
  95. {
  96.     new VFrame(framebacksmall_up_png),
  97.     new VFrame(framebacksmall_uphi_png),
  98.     new VFrame(framebacksmall_downhi_png)
  99. };
  100.  
  101. VFrame *blond_pause[] = 
  102. {
  103.     new VFrame(pausesmall_up_png),
  104.     new VFrame(pausesmall_uphi_png),
  105.     new VFrame(pausesmall_downhi_png)
  106. };
  107.  
  108. VFrame *blond_slider_data[] = 
  109. {
  110.     new VFrame(slider_up_png),
  111.     new VFrame(slider_uphi_png),
  112.     new VFrame(slider_dn_png),
  113.     new VFrame(slider_left_png),
  114.     new VFrame(slider_mid_png),
  115.     new VFrame(slider_right_png)
  116. };
  117.  
  118. VFrame *blond_ok_images[] = 
  119. {
  120.     new VFrame(ok_up_png),
  121.     new VFrame(ok_uphi_png),
  122.     new VFrame(ok_dn_png)
  123. };
  124.  
  125. VFrame *blond_cancel_images[] = 
  126. {
  127.     new VFrame(cancel_up_png),
  128.     new VFrame(cancel_uphi_png),
  129.     new VFrame(cancel_dn_png)
  130. };
  131.  
  132. VFrame *blond_filebox_text_images[] = 
  133. {
  134.     new VFrame(files_text_up_png),
  135.     new VFrame(files_text_hi_png),
  136.     new VFrame(files_text_dn_png)
  137. };
  138.  
  139. VFrame *blond_filebox_icons_images[] = 
  140. {
  141.     new VFrame(files_icon_up_png),
  142.     new VFrame(files_icon_hi_png),
  143.     new VFrame(files_icon_dn_png)
  144. };
  145.  
  146. VFrame *blond_filebox_updir_images[] = 
  147. {
  148.     new VFrame(files_prevdir_up_png),
  149.     new VFrame(files_prevdir_hi_png),
  150.     new VFrame(files_prevdir_dn_png)
  151. };
  152.  
  153. VFrame *blond_filebox_newfolder_images[] = 
  154. {
  155.     new VFrame(files_newfolder_up_png),
  156.     new VFrame(files_newfolder_hi_png),
  157.     new VFrame(files_newfolder_dn_png)
  158. };
  159.  
  160.  
  161. Theme::Theme()
  162. {
  163.     play = blond_play;
  164.     frame_fwd = blond_frame_fwd;
  165.     frame_bck = blond_frame_bck;
  166.     pause = blond_pause;
  167. }
  168.  
  169. GoldTheme::GoldTheme()
  170.  : Theme()
  171. {
  172.     BC_WindowBase::get_resources()->bg_image = 0;
  173.     BC_WindowBase::get_resources()->bg_color = 0xb4b487;
  174. //    BC_WindowBase::get_resources()->ok_images = blond_ok_images;
  175. //    BC_WindowBase::get_resources()->cancel_images = blond_cancel_images;
  176. //    BC_WindowBase::get_resources()->checkbox_images = blond_checkbox;
  177.     BC_WindowBase::get_resources()->button_up = 0xffc000;
  178.     BC_WindowBase::get_resources()->button_highlighted = 0xffe000;
  179. //    BC_WindowBase::get_resources()->filebox_text_images = blond_filebox_text_images;
  180. //    BC_WindowBase::get_resources()->filebox_icons_images = blond_filebox_icons_images;
  181. //    BC_WindowBase::get_resources()->filebox_updir_images = blond_filebox_updir_images;
  182. //    BC_WindowBase::get_resources()->filebox_newfolder_images = blond_filebox_newfolder_images;
  183. //    BC_WindowBase::get_resources()->listbox_button = blond_listbutton;
  184.     BC_WindowBase::get_resources()->horizontal_slider = blond_slider_data;
  185.  
  186.     bar_left = new VFrame(bar_left_png);
  187.     bar_mid = new VFrame(bar_mid_png);
  188.     bar_right = new VFrame(bar_right_png);
  189.     heroine_bg = new VFrame(heroine_bg_png);
  190. }
  191.  
  192. int GoldTheme::update_positions(MainWindow *mwindow, MWindowGUI *gui, int &w, int &h)
  193. {
  194.     int x = 0, y = gui->menu->get_h();
  195.  
  196. // Get canvas dimensions
  197.     canvas_x = x;
  198.     canvas_y = y;
  199. // Fix minimum height
  200.     if(h <= 0)
  201.     {
  202.         h = y + bar_left->get_h() + 5;
  203.     }
  204.  
  205.     if(mwindow->asset && mwindow->asset->video_data)
  206.     {
  207.         int full_w, full_h;
  208.         mwindow->get_full_size(full_w, full_h);
  209.         if(labs(full_w - w) < 50)
  210.         {
  211.             w = full_w;
  212.         }
  213.  
  214.         mwindow->get_canvas_sizes(w);
  215.         w = mwindow->canvas_w + canvas_x;
  216.         h = canvas_y + mwindow->canvas_h + bar_left->get_h();
  217.     }
  218.     else
  219.     {
  220.         mwindow->canvas_w = w;
  221.         mwindow->canvas_h = h - bar_left->get_h() - canvas_y;
  222.     }
  223.  
  224.     x += 5;
  225.     y += mwindow->canvas_h;
  226.     time_x = x;
  227.     time_y = y + 3;
  228.     x += TIMEW;
  229.     play_x = x;
  230.     play_y = y + 3;
  231.     x += blond_play[0]->get_w();
  232.     frameback_x = x;
  233.     frameback_y = y + 3;
  234.     x += blond_frame_bck[0]->get_w();
  235.     framefwd_x = x;
  236.     framefwd_y = y + 3;
  237.     x += blond_frame_fwd[0]->get_w() + bar_mid->get_w();
  238.     scroll_x = x;
  239.     scroll_y = y + 7;
  240.     scroll_w = w - scroll_x - 5;
  241.     return 0;
  242. }
  243.  
  244.  
  245. int GoldTheme::draw_mwindow_bg(MainWindow *mwindow, MWindowGUI *gui)
  246. {
  247.     int x;
  248.  
  249.     gui->draw_background(canvas_x, canvas_y, mwindow->canvas_w, mwindow->canvas_h);
  250.  
  251.     gui->draw_vframe(heroine_bg, 
  252.         gui->get_w() / 2 - heroine_bg->get_w() / 2,
  253.         gui->get_h() / 2 - heroine_bg->get_h() / 2);
  254.  
  255.     scroll_x -= bar_mid->get_w();
  256.     for(x = 0; x < scroll_x; )
  257.     {
  258.         int dest_w = (x + bar_left->get_w() - 1 < scroll_x) ? (bar_left->get_w() - 1) : (scroll_x - x);
  259.  
  260.         gui->draw_vframe(bar_left, 
  261.             x, 
  262.             gui->get_h() - bar_left->get_h(), 
  263.             dest_w);
  264.  
  265.         x += dest_w;
  266.     }
  267.  
  268.     gui->draw_vframe(bar_mid, 
  269.             x, 
  270.             gui->get_h() - bar_mid->get_h());
  271.     x += bar_mid->get_w() - 1;
  272.  
  273.     while(x < gui->get_w())
  274.     {
  275.         int dest_w = (x + bar_right->get_w() - 1 < gui->get_w()) ? (bar_right->get_w() - 1) : (gui->get_w() - x);
  276.  
  277.         gui->draw_vframe(bar_right, 
  278.             x, 
  279.             gui->get_h() - bar_right->get_h(), 
  280.             dest_w);
  281.         x += dest_w;
  282.     }
  283.  
  284.     scroll_x += bar_mid->get_w();
  285.     gui->flash();
  286.     return 0;
  287. }
  288.  
  289.  
  290.  
  291.