/*
 *
 * CINELERRA
 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
 * by Paolo Rampino <info at tuttoainternet dot it>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "bcsignals.h"
#include "clip.h"
#include "cwindowgui.h"
#include "neophyte.h"
#include "edl.h"
#include "edlsession.h"
#include "mainmenu.h"
#include "mainsession.h"
#include "mbuttons.h"
#include "meterpanel.h"
#include "mwindow.h"
#include "mwindowgui.h"
#include "new.h"
#include "patchbay.h"
#include "preferencesthread.h"
#include "recordgui.h"
#include "recordmonitor.h"
#include "setformat.h"
#include "statusbar.h"
#include "timebar.h"
#include "trackcanvas.h"
#include "vframe.h"
#include "vwindowgui.h"

#define ALARM 0xff00ff             // not yet defined, to search for the element
#define CreamyWhite 0xe6e4dd       // creamy white 10% black
#define CreamyWhiteBright 0xfffdee // creamy white without black
#define BlackNineTwo 0x141414      // 92% black
#define BlackSevenTwo 0x474747     // 72% black
#define BlackEightFive 0x262626    // 85% black
#define BlackFive 0xf2f2f2         //  5% black
#define BabyBlue 0x5f8dd3
#define BabyBlueDark 0x162d50      // baby-blue -3 (inkscape), e.g. dialog Subtitle
// traffic lights, light green: 0x27ae60/0x37c871 - just on the buttons.
#define ComicYellow 0xffcc00       // heads up!
#define DarkRed 0xaa0000           // locked or not switched on. 
#define LockedRed 0xda4453

PluginClient* new_plugin(PluginServer *server)
{
	return new NEOPHYTETHEMEMain(server);
}

NEOPHYTETHEMEMain::NEOPHYTETHEMEMain(PluginServer *server)
	: PluginTClient(server)
{
}

NEOPHYTETHEMEMain::~NEOPHYTETHEMEMain()
{
}

const char* NEOPHYTETHEMEMain::plugin_title() { return N_("Neophyte"); }

Theme* NEOPHYTETHEMEMain::new_theme()
{
	theme = new NEOPHYTETHEME;
	extern unsigned char _binary_theme_neophyte_data_start[];
	theme->set_data(_binary_theme_neophyte_data_start);
	return theme;
}

NEOPHYTETHEME::NEOPHYTETHEME()
	: Theme()
{
}

NEOPHYTETHEME::~NEOPHYTETHEME()
{
	delete camerakeyframe_data;
	delete channel_position_data;
	delete keyframe_data;
	delete maskkeyframe_data;
	delete modekeyframe_data;
	delete hardedge_data;
	delete pankeyframe_data;
	delete projectorkeyframe_data;
}

void NEOPHYTETHEME::initialize()
{
	//printf("Neophyte::initialize 1\n");
	BC_Resources *resources = BC_WindowBase::get_resources();

	/* Something own, fitting to the theme and independent of
	   the integrated splash screen/about */
	// Preferences: About (logo)
	delete about_bg;
	about_bg = new VFramePng(get_image_data("about_bg.png"));
	
	/* Replacement for the heroine icon. Everyone has his 
	   own ideas about this, especially in connection with the 
	   new desktops[tm]. It would be better to solve this globally,
	   irrespective of the theme currently in use. */
	// /home/olaf/src/cinelerra-gg/cin5/cinelerra-5.1/cinelerra/theme.C-237
	new_image_set_images("mwindow_icon", 1, new VFramePng(get_image_data("cin_icon_mwin.png")));
	new_image_set_images("vwindow_icon", 1, new VFramePng(get_image_data("cin_icon_vwin.png")));
	new_image_set_images("cwindow_icon", 1, new VFramePng(get_image_data("cin_icon_cwin.png")));
	new_image_set_images("awindow_icon", 1, new VFramePng(get_image_data("cin_icon_awin.png")));
	new_image_set_images("record_icon",  1, new VFramePng(get_image_data("cin_icon_rec.png")));
	// Windows without an icon: Camera, Overlays, etc.
	
	resources->text_default = CreamyWhite;     // general text color
	resources->text_background = BlackNineTwo;
	resources->text_background_disarmed = LockedRed; // arm track locked (!)
	resources->text_border2 = BlackNineTwo;    // l,t outside
	resources->text_border1 = BLACK;           // l,t inside
	resources->text_border3 = BlackSevenTwo;   // r,d inside
	resources->text_border4 = BlackNineTwo;    // r,d outside
	resources->text_border2_hi = ComicYellow;  // highlighting on mouseover
	resources->text_border3_hi = ComicYellow;
	resources->text_inactive_highlight = BabyBlueDark; /* e.g. Subtitle (double click
														  on inactive text, choose next or 
														  prev and be amazed). */
	resources->text_highlight = BabyBlue;
  
	resources->bg_color = BlackEightFive;
	resources->border_light2 = resources->bg_color;
	resources->border_shadow2 = resources->bg_color;

	resources->default_text_color = CreamyWhite; // Timeline, dialogs and much more. 
	resources->menu_title_text = WHITE;          // high contrast
	resources->popup_title_text = WHITE;
	resources->menu_item_text = WHITE; 

	resources->menu_highlighted_fontcolor = CreamyWhiteBright;
	/* This indent is too global and the fullness ultimately depends
	 * on the text. (Pref. top right, engl.: ~17) */
	resources->generic_button_margin = xS(20);     // [15]
	resources->pot_needle_color = CreamyWhite; // [resources->text_default] – marginal
	resources->pot_offset = 1;                 // only the needle
	resources->progress_text = resources->text_default;
	resources->meter_font_color = resources->default_text_color;

	// the following four are overwritten by graphics
	resources->menu_light = BlackEightFive;  
	resources->menu_down = ALARM;
	resources->menu_up = ALARM;
	resources->menu_shadow = ALARM;

	resources->menu_highlighted = BabyBlue;
	resources->popupmenu_margin = xS(15);       // indent, moves the button text to the right
	resources->popupmenu_triangle_margin = xS(15);

	resources->listbox_title_color = CreamyWhiteBright; // columns header
	resources->listbox_title_margin = xS(15);               // [20] indent
	resources->listbox_title_hotspot = xS(15);              // [20]

	resources->listbox_border2 = BlackNineTwo; // as text_border
	resources->listbox_border1 = BLACK;
	resources->listbox_border3 = BlackSevenTwo;
	resources->listbox_border4 = BlackNineTwo;
	// ../../guicast/bcresources.C:684, highlighting on mouseover
	resources->listbox_border2_hi = BabyBlue;
	resources->listbox_border3_hi = BabyBlue;

	resources->listbox_highlighted = BabyBlue;  // recources, loadfiles
	resources->listbox_inactive = BlackNineTwo; //       background
	resources->listbox_bg = 0;                  // s.a. ../theme_blond_cv/blondcvtheme.C:249
	resources->listbox_text = CreamyWhite;
	resources->listbox_selected = 0x3d5477;     // approximately matches column_hi
  
	resources->filebox_margin = yS(130); // [130]
	resources->file_color = WHITE;
	resources->directory_color = BabyBlue;

	// Footage in the timeline
	title_font = MEDIUMFONT;
	title_color = WHITE;

	/* Because the colors of the text in the list are fixed.
	   So it is at least uniform. */
	recordgui_fixed_color = YELLOW;
	recordgui_variable_color = RED;
	      
	channel_position_color = ComicYellow; // Set Format, speaker numbers 
	resources->meter_title_w = xS(28);

	// (asset) edit info text color
	edit_font_color = ComicYellow; // ? ../../cinelerra/theme.h:282
	assetedit_color = CreamyWhiteBright; // variable attributes

	// flash_color = ALARM;          // ../../cinelerra/recordgui.C:135
	timebar_cursor_color = WHITE; // ../../cinelerra/theme.C:73
    
	// tooltip ../../guicast/bcresources.C:786
	resources->tooltip_bg_color = CreamyWhiteBright;
	// resources->tooltip_fg_color = ALARM; // undefined.
	resources->tooltip_delay = 1500; // [1000]
  
	/* Waveform of audio tracks.
	   Instead of squeaky [GREEN]. This three are soft, warm and matte:
	   848661 beige, 6d876f green, 665f8a purple */
	audio_color = 0x6d876f;

	/* Resources: the text overlay location display. Affects 
	   a) Preferences, Performace: BR "Video" (text).
	   b) Render. */
	resources->audiovideo_color = CreamyWhite; // BlackNineTwo;

	/* ../../guicast/bcresources.C:781 ff.
	   Delays must all be different for repeaters */
	resources->blink_rate = 750; // [250] - we're not on the run.

	// ../../cinelerra/theme.C:87
	clock_fg_color = ComicYellow;
	// clock_bg_color = ALARM; // see vclock

	// The line between the in and out markings
	inout_highlight_color=BabyBlue;

	new_toggle(
		"loadmode_new.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_new");
	new_toggle(
		"loadmode_none.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_none");
	new_toggle(
		"loadmode_newcat.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_newcat");
	new_toggle(
		"loadmode_cat.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_cat");
	new_toggle(
		"loadmode_newtracks.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_newtracks");
	new_toggle(
		"loadmode_paste.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_paste");
	new_toggle(
		"loadmode_resource.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_resource");

	new_toggle(
		"loadmode_edl_clip.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_edl_clip");
	new_toggle(
		"loadmode_edl_nested.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_edl_nested");
	new_toggle(
		"loadmode_edl_fileref.png",
		"loadmode_up.png",
		"loadmode_hi.png",
		"loadmode_checked.png",
		"loadmode_dn.png",
		"loadmode_checkedhi.png",
		"loadmode_edl_fileref");

	resources->filebox_icons_images = new_button(
		"icons.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_icons");
	resources->filebox_text_images = new_button(
		"text.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_text");
	resources->filebox_newfolder_images = new_button(
		"folder.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_newfolder");
	resources->filebox_rename_images = new_button(
		"rename.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_rename");
	resources->filebox_updir_images = new_button(
		"updir.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_updir");
	resources->filebox_delete_images = new_button(
		"delete.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_delete");
	resources->filebox_reload_images = new_button(
		"reload.png",
		"fileboxbutton_up.png",
		"fileboxbutton_hi.png",
		"fileboxbutton_dn.png",
		"filebox_reload");
	resources->filebox_descend_images = new_button(
		"openfolder.png",
		"filebox_bigbutton_up.png",
		"filebox_bigbutton_hi.png",
		"filebox_bigbutton_dn.png",
		"filebox_descend");
	resources->usethis_button_images = resources->ok_images = new_button(
		"ok.png",
		"filebox_bigbutton_up.png",
		"filebox_bigbutton_hi.png",
		"filebox_bigbutton_dn.png",
		"ok_button");
	new_button(
		"ok.png",
		"new_bigbutton_up.png",
		"new_bigbutton_hi.png",
		"new_bigbutton_dn.png",
		"new_ok_images");
        new_button(
		"reset.png",
                "reset_up.png",
                "reset_hi.png",
                "reset_dn.png",
                "reset_button");
	new_button(
		"unclear.png",
		"unclear_up.png",
		"unclear_hi.png",
		"unclear_dn.png",
		"unclear_button");
	new_button("keyframe.png",
		"keyframe_up.png",
		"keyframe_hi.png",
		"keyframe_dn.png",
		"keyframe_button");

	resources->cancel_images = new_button(
		"cancel.png",
		"filebox_bigbutton_up.png",
		"filebox_bigbutton_hi.png",
		"filebox_bigbutton_dn.png",
		"cancel_button");
	new_button(
		"cancel.png",
		"new_bigbutton_up.png",
		"new_bigbutton_hi.png",
		"new_bigbutton_dn.png",
		"new_cancel_images");

	new_button("mask_pnt_linear.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_pnt_linear_images");
	new_button("mask_crv_linear.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_crv_linear_images");
	new_button("mask_all_linear.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_all_linear_images");

	new_button("mask_pnt_smooth.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_pnt_smooth_images");
	new_button("mask_crv_smooth.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_crv_smooth_images");
	new_button("mask_all_smooth.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_all_smooth_images");

	new_button("mask_prst_sqr.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_sqr_images");
	new_button("mask_prst_crc.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_crc_images");
	new_button("mask_prst_tri.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_tri_images");
	new_button("mask_prst_ovl.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_ovl_images");

	new_button("mask_prst_load.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_load_images");
	new_button("mask_prst_save.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_save_images");
	new_button("mask_prst_trsh.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_prst_trsh_images");

	new_button("mask_pstn_cen.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_pstn_cen_images");
	new_button("mask_pstn_nrm.png",
		"mask_button_up.png",
		"mask_button_hi.png",
		"mask_button_dn.png",
		"mask_pstn_nrm_images");

	// Clock - is not used (AFAIK). See also clock color.
	// resources->medium_7segment = new_image_set(TOTAL_7SEGMENT,
	// 	"0.png", "1.png", "2.png", "3.png", "4.png", "5.png", "6.png", "7.png",
	// 	"8.png", "9.png", "colon.png", "period.png", "a.png", "b.png", "c.png",
	// 	"d.png", "e.png", "f.png", "space.png", "dash.png");

	resources->bar_data = new_image("bar", "bar.png");
	resources->check = new_image("check", "check.png");

	resources->min_menu_w = xS(96);
	resources->menu_popup_bg = new_image("menu_popup_bg.png");
	resources->menu_item_bg = new_image_set(
		3,
		"menuitem_up.png",
		"menuitem_hi.png",
		"menuitem_dn.png");
	resources->menu_bar_bg = new_image("menubar_bg.png");
	resources->menu_title_bg = new_image_set
		(3,
		 "menubar_up.png",
		 "menubar_hi.png",
		 "menubar_dn.png");
	resources->popupmenu_images = 0;
	// new_image_set(3,
	// "menupopup_up.png",
	// "menupopup_hi.png",
	// "menupopup_dn.png");
	resources->toggle_highlight_bg = new_image(
		"toggle_highlight_bg",
		"text_highlight.png");
	resources->generic_button_images = new_image_set(
		3,
		"generic_up.png",
		"generic_hi.png",
		"generic_dn.png");
	resources->horizontal_slider_data = new_image_set(
		6,
		"hslider_fg_up.png",
		"hslider_fg_hi.png",
		"hslider_fg_dn.png",
		"hslider_bg_up.png",
		"hslider_bg_hi.png",
		"hslider_bg_dn.png");
	resources->vertical_slider_data = new_image_set(
		6,
		"hslider_fg_up.png",
		"hslider_fg_hi.png",
		"hslider_fg_dn.png",
		"hslider_bg_up.png",
		"hslider_bg_hi.png",
		"hslider_bg_dn.png");
  
	for( int i=0; i<6; ++i )
		resources->vertical_slider_data[i]->rotate90();

	resources->progress_images = new_image_set(
		2,
		"progress_bg.png",
		"progress_hi.png");
	resources->tumble_data = new_image_set(
		4,
		"tumble_up.png",
		"tumble_hi.png",
		"tumble_bottom.png",
		"tumble_top.png");
	new_image_set("tumblepatch_data", 4,
		"tumblepatch_up.png",
		"tumblepatch_hi.png",
		"tumblepatch_bottom.png",
		"tumblepatch_top.png");
	resources->listbox_button = new_button4(
		"listbox_button.png",
		"editpanel_up.png",
		"editpanel_hi.png",
		"editpanel_dn.png",
		"editpanel_hi.png",
		"listbox_button");
	// Dialog "Load files…" switch SI/IEC
	resources->filebox_szfmt_images = new_image_set(
		12,
		"file_size_zero_up.png",
		"file_size_zero_hi.png",
		"file_size_zero_dn.png",
		"file_size_lwrb_up.png",
		"file_size_lwrb_hi.png",
		"file_size_lwrb_dn.png",
		"file_size_capb_up.png",
		"file_size_capb_hi.png",
		"file_size_capb_dn.png",
		"file_size_semi_up.png",
		"file_size_semi_hi.png",
		"file_size_semi_dn.png");
	resources->listbox_column = new_image_set(
		3,
		"column_up.png",
		"column_hi.png",
		"column_dn.png");
	resources->listbox_up = new_image("listbox_up.png");
	resources->listbox_dn = new_image("listbox_dn.png");
	resources->pan_data = new_image_set(
		7,
		"pan_up.png",
		"pan_hi.png",
		"pan_popup.png",
		"pan_channel.png",
		"pan_stick.png",
		"pan_channel_small.png",
		"pan_stick_small.png");
	resources->pan_text_color = CreamyWhiteBright;
	resources->pot_images = new_image_set(
		3,
		"pot_up.png",
		"pot_hi.png",
		"pot_dn.png");
	resources->checkbox_images = new_image_set(
		5,
		"checkbox_up.png",
		"checkbox_hi.png",
		"checkbox_checked.png",
		"checkbox_dn.png",
		"checkbox_checkedhi.png");
	resources->radial_images = new_image_set(
		5,
		"radial_up.png",
		"radial_hi.png",
		"radial_checked.png",
		"radial_dn.png",
		"radial_checkedhi.png");
	resources->xmeter_images = new_image_set(
		7,
		"xmeter_normal.png",
		"xmeter_green.png",
		"xmeter_red.png",
		"xmeter_yellow.png",
		"xmeter_white.png",
		"xmeter_over.png",
		"downmix51_2.png");
	resources->ymeter_images = new_image_set(
		7,
		"ymeter_normal.png",
		"ymeter_green.png",
		"ymeter_red.png",
		"ymeter_yellow.png",
		"ymeter_white.png",
		"ymeter_over.png",
		"downmix51_2.png");
	resources->hscroll_data = new_image_set(
		10,
		"hscroll_handle_up.png",
		"hscroll_handle_hi.png",
		"hscroll_handle_dn.png",
		"hscroll_handle_bg.png",
		"hscroll_left_up.png",
		"hscroll_left_hi.png",
		"hscroll_left_dn.png",
		"hscroll_right_up.png",
		"hscroll_right_hi.png",
		"hscroll_right_dn.png");
	resources->vscroll_data = new_image_set(
		10,
		"vscroll_handle_up.png",
		"vscroll_handle_hi.png",
		"vscroll_handle_dn.png",
		"vscroll_handle_bg.png",
		"vscroll_left_up.png",
		"vscroll_left_hi.png",
		"vscroll_left_dn.png",
		"vscroll_right_up.png",
		"vscroll_right_hi.png",
		"vscroll_right_dn.png");
	resources->scroll_minhandle = 20;
    
	new_button(
		"prevtip.png", "tipbutton_up.png",
		"tipbutton_hi.png", "tipbutton_dn.png", "prev_tip");
	new_button(
		"nexttip.png", "tipbutton_up.png",
		"tipbutton_hi.png", "tipbutton_dn.png", "next_tip");
	new_button(
		"closetip.png", "tipbutton_up.png",
		"tipbutton_hi.png", "tipbutton_dn.png", "close_tip");
	new_button(
		"swap_extents.png", "editpanel_up.png",
		"editpanel_hi.png", "editpanel_dn.png", "swap_extents");

	// Record windows
	preferences_category_overlap = 0;
	preferencescategory_x = 0;
	preferencescategory_y = yS(5);
	preferencestitle_x = xS(5);
	preferencestitle_y = yS(10);
	preferencesoptions_x = xS(5);
	preferencesoptions_y = 0;

	// MWindow
	message_normal = resources->text_default;

	mtransport_margin = xS(10);
	toggle_margin = xS(10);

	new_button("pane.png", "pane_up.png", "pane_hi.png", "pane_dn.png",
			   "pane");
	new_image_set("xpane", 3,
				  "xpane_up.png",
				  "xpane_hi.png",
				  "xpane_dn.png");
	new_image_set("ypane", 3,
				  "ypane_up.png",
				  "ypane_hi.png",
				  "ypane_dn.png");

	new_image("mbutton_bg", "mbutton_bg.png");
	new_image("timebar_bg", "timebar_bg_flat.png");
	new_image("timebar_brender", "timebar_brender.png");
	new_image("clock_bg", "mclock_flat.png");
	new_image("patchbay_bg", "patchbay_bg.png");
	new_image("statusbar", "statusbar.png");
	// new_image("mscroll_filler", "mscroll_filler.png");

	new_image_set("zoombar_menu", 3,
				  "zoompopup_up.png",
				  "zoompopup_hi.png",
				  "zoompopup_dn.png");
	new_image_set("zoombar_tumbler", 4,
				  "zoomtumble_up.png",
				  "zoomtumble_hi.png",
				  "zoomtumble_bottom.png",
				  "zoomtumble_top.png");
	new_image_set("auto_range", 4,
				  "autorange_up.png",
				  "autorange_hi.png",
				  "autorange_bottom.png",
				  "autorange_top.png");

	new_image_set("mode_popup", 3,
				  "mode_up.png", "mode_hi.png", "mode_dn.png");
	new_image("mode_add", "mode_add.png");
	new_image("mode_divide", "mode_divide.png");
	new_image("mode_multiply", "mode_multiply.png");
	new_image("mode_normal", "mode_normal.png");
	new_image("mode_replace", "mode_replace.png");
	new_image("mode_subtract", "mode_subtract.png");
	new_image("mode_max", "mode_max.png");

	new_image_set("plugin_on", 5,
				  "plugin_on.png",
				  "plugin_onhi.png",
				  "plugin_onselect.png",
				  "plugin_ondn.png",
				  "plugin_onselecthi.png");
	new_image_set("plugin_show", 5,
				  "plugin_show.png",
				  "plugin_showhi.png",
				  "plugin_showselect.png",
				  "plugin_showdn.png",
				  "plugin_showselecthi.png");
	
	// Mixer
	new_image_set("mixpatch_data", 5,
				  "mixpatch_up.png",
				  "mixpatch_hi.png",
				  "mixpatch_checked.png",
				  "mixpatch_dn.png",
				  "mixpatch_checkedhi.png");
	
	// CWindow
	new_image("cpanel_bg", "cpanel_bg.png");
	new_image("cbuttons_left", "cbuttons_left.png");
	new_image("cbuttons_right", "cbuttons_right.png");
	new_image("cmeter_bg", "cmeter_bg.png");
	new_image("cwindow_focus", "cwindow_focus.png");
	
	// VWindow
	/* The red position indicator is currently only 5 px high.
	   The backgrounds were made according to this. */
	new_image("vbuttons_left", "vbuttons_left.png");
	new_image("vbuttons_right", "vbuttons_right.png"); // unset = cbuttons_right
	new_image("vclock", "vclock.png");
	//new_image("vmeter_bg", ".png"); // ! 
  
	new_image("preferences_bg", "preferences_bg.png");

	new_image("new_bg", "new_bg.png");
	new_image("setformat_bg", "setformat_bg.png");

	timebar_view_data = new_image("timebar_view.png");

	setformat_w = get_image("setformat_bg")->get_w();
	setformat_h = get_image("setformat_bg")->get_h();
	setformat_x1 = xS(15);
	setformat_x2 = xS(110);
	setformat_x3 = xS(315);
	setformat_x4 = xS(425);
	setformat_y1 = yS(20);
	setformat_y2 = yS(85);
	setformat_y3 = yS(125);
	setformat_margin = xS(30);
	setformat_channels_x = xS(25);
	setformat_channels_y = yS(242);
	setformat_channels_w = xS(250);
	setformat_channels_h = yS(250);

	loadfile_pad = get_image_set("loadmode_new")[0]->get_h() + yS(10);
	browse_pad = yS(20);

	new_toggle("playpatch.png",
			   "playpatch_up.png",
			   "playpatch_hi.png",
			   "playpatch_checked.png",
			   "playpatch_dn.png",
			   "playpatch_checkedhi.png",
			   "playpatch_data");
	new_toggle("recordpatch.png",
			   "recordpatch_up.png",
			   "recordpatch_hi.png",
			   "recordpatch_checked.png",
			   "recordpatch_dn.png",
			   "recordpatch_checkedhi.png",
			   "recordpatch_data");
	new_toggle("gangpatch.png",
			   "patch_up.png",
			   "patch_hi.png",
			   "patch_checked.png",
			   "patch_dn.png",
			   "patch_checkedhi.png",
			   "gangpatch_data");
	new_toggle("drawpatch.png",
			   "patch_up.png",
			   "patch_hi.png",
			   "patch_checked.png",
			   "patch_dn.png",
			   "patch_checkedhi.png",
			   "drawpatch_data");

	new_toggle("masterpatch.png",
			   "patch_up.png",
			   "patch_hi.png",
			   "patch_checked.png",
			   "patch_dn.png",
			   "patch_checkedhi.png",
			   "masterpatch_data");

	new_image_set("mutepatch_data",
				  5,
				  "mutepatch_up.png",
				  "mutepatch_hi.png",
				  "mutepatch_checked.png",
				  "mutepatch_dn.png",
				  "mutepatch_checkedhi.png");
	new_image_set("expandpatch_data",
				  5,
				  "expandpatch_up.png",
				  "expandpatch_hi.png",
				  "expandpatch_checked.png",
				  "expandpatch_dn.png",
				  "expandpatch_checkedhi.png");

	build_bg_data();
	build_overlays();

	out_point = new_image_set(
		5,
		"out_up.png",
		"out_hi.png",
		"out_checked.png",
		"out_dn.png",
		"out_checkedhi.png");
	in_point = new_image_set(
		5,
		"in_up.png",
		"in_hi.png",
		"in_checked.png",
		"in_dn.png",
		"in_checkedhi.png");
	label_toggle = new_image_set(
		5,
		"labeltoggle_up.png",
		"labeltoggle_uphi.png",
		"label_checked.png",
		"labeltoggle_dn.png",
		"label_checkedhi.png");
	ffmpeg_toggle = new_image_set(
		5,
		"ff_up.png",
		"ff_hi.png",
		"ff_checked.png",
		"ff_down.png",
		"ff_checkedhi.png");
	proxy_p_toggle = new_image_set(
		5,
		"proxy_p_up.png",
		"proxy_p_hi.png",
		"proxy_p_chkd.png",
		"proxy_p_down.png",
		"proxy_p_chkdhi.png");
	proxy_s_toggle = new_image_set( // proxy use ffmpeg scaler
		5,
		"proxy_s_up.png",
		"proxy_s_hi.png",
		"proxy_s_chkd.png",
		"proxy_s_down.png",
		"proxy_s_chkdhi.png");
	mask_mode_toggle = new_image_set(5,
		"mask_mode_up.png",
		"mask_mode_hi.png",
		"mask_mode_chkd.png",
		"mask_mode_down.png",
		"mask_mode_chkdhi.png");
	shbtn_data = new_image_set(
		3,
		"shbtn_up.png",
		"shbtn_hi.png",
		"shbtn_dn.png");
	new_image_set(
		"preset_edit",
		3,
		"preset_edit0.png",
		"preset_edit1.png",
		"preset_edit2.png");
	new_image_set(
		"histogram_carrot",
		5,
		"histogram_carrot_up.png",
		"histogram_carrot_hi.png",
		"histogram_carrot_checked.png",
		"histogram_carrot_dn.png",
		"histogram_carrot_checkedhi.png");
	statusbar_cancel_data = new_image_set(
		3,
		"statusbar_cancel_up.png",
		"statusbar_cancel_hi.png",
		"statusbar_cancel_dn.png");

	VFrame *editpanel_up = new_image("editpanel_up.png");
	VFrame *editpanel_hi = new_image("editpanel_hi.png");
	VFrame *editpanel_dn = new_image("editpanel_dn.png");
	VFrame *editpanel_checked = new_image("editpanel_checked.png");
	VFrame *editpanel_checkedhi = new_image("editpanel_checkedhi.png");

	new_image("panel_divider", "panel_divider.png");
	new_button("bottom_justify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "bottom_justify");
	new_button("center_justify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "center_justify");
	new_button("channel.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "channel");
	new_button("lok.png", // popup slider
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "lok");
	new_toggle("histogram_toggle.png",
			   editpanel_up,
			   editpanel_hi,
			   editpanel_checked,
			   editpanel_dn,
			   editpanel_checkedhi,
			   "histogram_toggle");
	new_toggle("histogram_rgb.png",
			   editpanel_up,
			   editpanel_hi,
			   editpanel_checked,
			   editpanel_dn,
			   editpanel_checkedhi,
			   "histogram_rgb_toggle");
	new_toggle("waveform.png",
			   editpanel_up,
			   editpanel_hi,
			   editpanel_checked,
			   editpanel_dn,
			   editpanel_checkedhi,
			   "waveform_toggle");
	new_toggle("waveform_rgb.png",
			   editpanel_up,
			   editpanel_hi,
			   editpanel_checked,
			   editpanel_dn,
			   editpanel_checkedhi,
			   "waveform_rgb_toggle");
	new_toggle("scope.png",
			   editpanel_up,
			   editpanel_hi,
			   editpanel_checked,
			   editpanel_dn,
			   editpanel_checkedhi,
			   "scope_toggle");

	new_button("picture.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "picture");
	new_button("histogram_img.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "histogram_img");
	new_button("copy.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "copy");
	new_button("commercial.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "commercial"); // cdb
	new_button("cut.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "cut");
	new_button("fit.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "fit");
	new_button("fitautos.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "fitautos");
	new_button("inpoint.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "inbutton");
	new_button("label.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "labelbutton");
	new_button("left_justify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "left_justify");
	new_button("magnify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "magnify_button");
	new_button("middle_justify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "middle_justify");
	new_button("nextlabel.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "nextlabel");
	new_button("prevlabel.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "prevlabel");
	new_button("nextedit.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "nextedit");
	new_button("prevedit.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "prevedit");
	new_button("outpoint.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "outbutton");
	over_button = new_button("over.png",
							 editpanel_up, editpanel_hi, editpanel_dn,
							 "overbutton");
	overwrite_data = new_button("overwrite.png",
								editpanel_up, editpanel_hi, editpanel_dn,
								"overwritebutton");
	new_button("paste.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "paste");
	new_button("redo.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "redo");
	new_button("right_justify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "right_justify");
	splice_data = new_button("splice.png",
							 editpanel_up, editpanel_hi, editpanel_dn,
							 "splicebutton");
	new_button("toclip.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "toclip");
	new_button("goto.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "goto");
	new_button("clapper.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "clapperbutton");
	new_button("top_justify.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "top_justify");
	new_button("undo.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "undo");
	new_button("wrench.png",
			   editpanel_up, editpanel_hi, editpanel_dn,
			   "wrench");

	VFrame **edge_on  = new_toggle("edge_on.png",
		editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "edge_on");
	VFrame **edge_off = new_toggle("edge_off.png",
		editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "edge_off");
	new_image_set_images("bump_edge", 5,
		new VFrame(*edge_off[0]), new VFrame(*edge_off[1]),
		new VFrame(*edge_on[0]),  new VFrame(*edge_off[3]),
		new VFrame(*edge_on[4]));
	VFrame **span_on  = new_toggle("span_on.png",
		editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "span_on");
	VFrame **span_off = new_toggle("span_off.png",
		editpanel_up, editpanel_hi, editpanel_checked, editpanel_dn, editpanel_checkedhi, "span_off");
	new_image_set_images("bump_span", 5,
		 new VFrame(*span_off[0]),  new VFrame(*span_off[1]),
		 new VFrame(*span_on[0]), new VFrame(*span_off[3]),
		 new VFrame(*span_on[4]));

	VFrame *transport_up = new_image("transportup.png");
	VFrame *transport_hi = new_image("transporthi.png");
	VFrame *transport_dn = new_image("transportdn.png");

	new_button("end.png",
			   transport_up, transport_hi, transport_dn,
			   "end");
	new_button("fastfwd.png",
			   transport_up, transport_hi, transport_dn,
			   "fastfwd");
	new_button("fastrev.png",
			   transport_up, transport_hi, transport_dn,
			   "fastrev");
	new_button("play.png",
			   transport_up, transport_hi, transport_dn,
			   "play");
	new_button("framefwd.png",
			   transport_up, transport_hi, transport_dn,
			   "framefwd");
	new_button("framerev.png",
			   transport_up, transport_hi, transport_dn,
			   "framerev");
	new_button("pause.png",
			   transport_up, transport_hi, transport_dn,
			   "pause");
	new_button("record.png",
			   transport_up, transport_hi, transport_dn,
			   "record");
	new_button("singleframe.png",
			   transport_up, transport_hi, transport_dn,
			   "recframe");
	new_button("reverse.png",
			   transport_up, transport_hi, transport_dn,
			   "reverse");
	new_button("rewind.png",
			   transport_up, transport_hi, transport_dn,
			   "rewind");
	new_button("stop.png",
			   transport_up, transport_hi, transport_dn,
			   "stop");
	new_button("stop.png",
			   transport_up, transport_hi, transport_dn,
			   "stoprec");

	// CWindow icons (led)
	new_image("cwindow_inactive", "cwindow_inactive.png");
	new_image("cwindow_active", "cwindow_active.png");

	new_image_set("category_button",
				  3,
				  "preferencesbutton_dn.png",
				  "preferencesbutton_dnhi.png",
				  "preferencesbutton_dnlo.png");
	new_image_set("category_button_checked",
				  3,
				  "preferencesbutton_up.png",
				  "preferencesbutton_uphi.png",
				  "preferencesbutton_dnlo.png");
	new_image_set("color3way_point",
				  3,
				  "color3way_up.png",
				  "color3way_hi.png",
				  "color3way_dn.png");

	new_toggle("arrow.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "arrow");
	new_toggle("autokeyframe.png",
			   transport_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "autokeyframe");
	new_toggle("spankeyframe.png",
			   transport_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "spankeyframe");
	new_toggle("ibeam.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "ibeam");
	new_toggle("show_meters.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "meters");
	new_toggle("blank30x30.png",
			   new_image("locklabels_locked.png"),
			   new_image("locklabels_lockedhi.png"),
			   new_image("locklabels_unlocked.png"),
			   new_image("locklabels_dn.png"), // can't have seperate down for each!!??
			   new_image("locklabels_unlockedhi.png"),
			   "locklabels");
	new_toggle("gang0.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "gang0");
	new_toggle("gang1.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "gang1");
	new_toggle("gang2.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "gang2");

	VFrame *cpanel_up = new_image("cpanel_up.png");
	VFrame *cpanel_hi = new_image("cpanel_hi.png");
	VFrame *cpanel_dn = new_image("cpanel_dn.png");
	VFrame *cpanel_checked = new_image("cpanel_checked.png");
	VFrame *cpanel_checkedhi = new_image("cpanel_checkedhi.png");

	new_toggle("camera.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "camera");
	new_toggle("crop.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "crop");
	new_toggle("eyedrop.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "eyedrop");
	new_toggle("magnify.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "magnify");
	new_toggle("mask.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "mask");
	new_toggle("ruler.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "ruler");
	new_toggle("projector.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "projector");
	new_toggle("protect.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "protect");
	new_toggle("titlesafe.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "titlesafe");
	new_toggle("toolwindow.png",
			   cpanel_up, cpanel_hi, cpanel_checked, cpanel_dn, cpanel_checkedhi,
			   "tool");
	// toggle for tangent mode (compositor/tool window)
	new_toggle("tan_smooth.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "tan_smooth");
	new_toggle("tan_linear.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "tan_linear");
	new_toggle("tan_tangent.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "tan_tangent");
	new_toggle("tan_free.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "tan_free");
	new_toggle("tan_bump.png",
			   editpanel_up, editpanel_hi, editpanel_checked,
			   editpanel_dn, editpanel_checkedhi,
			   "tan_bump");

	new_toggle("mask_scale_x.png",   "mask_scale_up.png",    "mask_scale_uphi.png",
		"mask_scale_chkd.png",  "mask_scale_xdown.png",  "mask_scale_chkdhi.png",
		"mask_scale_x");
	new_toggle("mask_scale_y.png",   "mask_scale_up.png",    "mask_scale_uphi.png",
		"mask_scale_chkd.png",  "mask_scale_ydown.png",  "mask_scale_chkdhi.png",
		"mask_scale_y");
	new_toggle("mask_scale_xy.png",  "mask_scale_up.png",   "mask_scale_uphi.png",
		"mask_scale_chkd.png", "mask_scale_xydown.png", "mask_scale_chkdhi.png",
		"mask_scale_xy");

	flush_images();
}

// Re-align the Clock. theme.c:931 
void NEOPHYTETHEME::get_vwindow_sizes(VWindowGUI *gui)
{
	int edit_w = EditPanel::calculate_w(mwindow, 0, 12);
	int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin;
	vtimebar_h = yS(16);       // The height of the position indicator
	int division_w = xS(30);
	
	/* For the deco, [150]-10. The remaining space should theoretically
	   suffice for 999,999:59:59.960 hours. Total size: 140 x 26, where
	   a height of 24 or 22 px would be nicer. */
	vtime_w = xS(140);
	
	/* Indent, flat. Larger indentation also puts
	   the 35% view into the compact view. */
	int vtime_border = xS(15);
  
	vmeter_y = widget_border;
	vmeter_h = mwindow->session->vwindow_h - cmeter_y - widget_border;

	int buttons_h;
	if (mwindow->edl->session->vwindow_meter) {
		vmeter_x = mwindow->session->vwindow_w -
			MeterPanel::get_meters_width(this,
										 mwindow->edl->session->audio_channels,
										 mwindow->edl->session->vwindow_meter);
	} else {
		vmeter_x = mwindow->session->vwindow_w + widget_border;
	}

	vcanvas_x = 0;
	vcanvas_y = 0;
	vcanvas_w = vmeter_x - vcanvas_x - widget_border;

	if (edit_w +
		widget_border * 2 +
		transport_w + widget_border +
		vtime_w + division_w +
		vtime_border > vmeter_x) {
		buttons_h = get_image("vbuttons_left")->get_h();
		vedit_x = widget_border;
		vedit_y = mwindow->session->vwindow_h -
			buttons_h +
			vtimebar_h +
			widget_border;

		vtransport_x = widget_border;
		vtransport_y = mwindow->session->vwindow_h -
			get_image_set("autokeyframe")[0]->get_h() -
			widget_border;

		vdivision_x = xS(280);      // field width, compact
		vtime_x = vedit_x + xS(38); // concentric
		vtime_y = vedit_y + yS(24); // vertical alignment
	} else {
		buttons_h = vtimebar_h +
			widget_border +
			EditPanel::calculate_h(mwindow) +
			widget_border;
		vtransport_x = widget_border;
		vtransport_y = mwindow->session->vwindow_h -
			buttons_h +
			vtimebar_h +
			widget_border;

		vedit_x = vtransport_x + transport_w + widget_border;
		vedit_y = vtransport_y;

		vdivision_x = vedit_x + edit_w + division_w;
		vtime_x = vdivision_x + vtime_border;
		// vertical height concentric at button height
		vtime_y = vedit_y + widget_border - yS(7);
	}

	// vtimebar_x = vcanvas_x;
	// vtimebar_y = vcanvas_y + vcanvas_h;
	// vtimebar_w = vcanvas_w;

	vcanvas_h = mwindow->session->vwindow_h - buttons_h;
	vtimebar_x = 0;
	vtimebar_y = vcanvas_y + vcanvas_h;
	vtimebar_w = vmeter_x - widget_border;
}

void NEOPHYTETHEME::build_bg_data()
{
	// Audio settings
	channel_position_data = new VFramePng(get_image_data("channel_position.png"));
	// Track bitmaps
	new_image1("resource1024", "resource1024.png");
	new_image1("resource512", "resource512.png");
	new_image1("resource256", "resource256.png");
	new_image1("resource128", "resource128.png");
	new_image1("resource64", "resource64.png");
	new_image1("resource32", "resource32.png");
	new_image("plugin_bg_data", "plugin_bg.png");
	new_image("title_bg_data", "title_bg.png");
	new_image("vtimebar_bg_data", "vwindow_timebar.png");
}

void NEOPHYTETHEME::build_overlays()
{
	keyframe_data = new VFramePng(get_image_data("keyframe3.png"));
	camerakeyframe_data = new VFramePng(get_image_data("camerakeyframe.png"));
	maskkeyframe_data = new VFramePng(get_image_data("maskkeyframe.png"));
	modekeyframe_data = new VFramePng(get_image_data("modekeyframe.png"));
	hardedge_data = new VFramePng(get_image_data("hardedge.png"));
	pankeyframe_data = new VFramePng(get_image_data("pankeyframe.png"));
	projectorkeyframe_data = new VFramePng(get_image_data("projectorkeyframe.png"));
}

void NEOPHYTETHEME::draw_rwindow_bg(RecordGUI *gui)
{
	// int y;
	// int margin = xS(50);
	// int margin2 = xS(80);
	// gui->draw_9segment(recordgui_batch_x - margin, 0,
	// 	mwindow->session->rwindow_w - recordgui_status_x + margin,
	// 	recordgui_buttons_y,
	// 	rgui_batch);
	// gui->draw_3segmenth(recordgui_options_x - margin2,
	// 	recordgui_buttons_y - yS(5),
	// 	mwindow->session->rwindow_w - recordgui_options_x + margin2,
	// 	rgui_controls);
	// y = recordgui_buttons_y - yS(5) + rgui_controls->get_h();
	// gui->draw_9segment(0, y,
	// 	mwindow->session->rwindow_w,
	// 	mwindow->session->rwindow_h - y,
	// 	rgui_list);
}

void NEOPHYTETHEME::draw_rmonitor_bg(RecordMonitorGUI *gui)
{
	// int margin = xS(45);
	// int panel_w = xS(300);
	// int x = rmonitor_meter_x - margin;
	// int w = mwindow->session->rmonitor_w - x;
	// if(w < rmonitor_meters->get_w()) w = rmonitor_meters->get_w();
	// gui->clear_box(0, 0,
	// 	mwindow->session->rmonitor_w,
	// 	mwindow->session->rmonitor_h);
	// gui->draw_9segment(x, 0,
	// 	w,
	// 	mwindow->session->rmonitor_h,
	// 	rmonitor_meters);
}

void NEOPHYTETHEME::draw_mwindow_bg(MWindowGUI *gui)
{
	// Button bar
	gui->draw_3segmenth(mbuttons_x, mbuttons_y - 1,
						gui->menu_w(), get_image("mbutton_bg"));

	int pdw = get_image("panel_divider")->get_w();
	int x = mbuttons_x;
	x += 9 * get_image("play")->get_w();
	x += mtransport_margin;                                     // the control buttons

	gui->draw_vframe(get_image("panel_divider"),
					 x - toggle_margin / 2 - pdw / 2 + 2,
					 mbuttons_y - 1);
	x += 2 * get_image("arrow")->get_w() + toggle_margin;       // the mode buttons

	gui->draw_vframe(get_image("panel_divider"),
					 x - toggle_margin / 2 - pdw / 2 + 2,
					 mbuttons_y - 1);

	x += 3 * get_image("autokeyframe")->get_w() + toggle_margin; // the state toggle buttons
	gui->draw_vframe(get_image("panel_divider"),
					 x - toggle_margin / 2 - pdw / 2 + 2,
					 mbuttons_y - 1);
	// Clock
	gui->draw_3segmenth(0,
						mbuttons_y - 1 + get_image("mbutton_bg")->get_h(),
						get_image("patchbay_bg")->get_w(),
						get_image("clock_bg"));
	// Patchbay
	gui->draw_3segmentv(patchbay_x,
						patchbay_y,
						patchbay_h,
						get_image("patchbay_bg"));
	// Track canvas
	gui->set_color(BLACK);
	gui->draw_box(mcanvas_x + get_image("patchbay_bg")->get_w(),
				  mcanvas_y + mtimebar_h,
				  mcanvas_w - BC_ScrollBar::get_span(SCROLL_VERT),
				  mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ) - mtimebar_h);
	// Timebar
	gui->draw_3segmenth(mtimebar_x, mtimebar_y,
		mtimebar_w, get_image("timebar_bg"));
	// Zoombar
	gui->set_color(BlackNineTwo);
	gui->draw_box(mzoom_x, mzoom_y,
		mwindow->session->mwindow_w, yS(25));
	// Scrollbar filler
	// gui->draw_vframe(get_image("mscroll_filler"),
	//                  mcanvas_x + mcanvas_w - BC_ScrollBar::get_span(SCROLL_VERT),
	//                  mcanvas_y + mcanvas_h - BC_ScrollBar::get_span(SCROLL_HORIZ));

	// Status
	gui->draw_3segmenth(mzoom_x, mzoom_y,
		mzoom_w, get_image("statusbar"));
}

void NEOPHYTETHEME::draw_cwindow_bg(CWindowGUI *gui)
{
	gui->draw_3segmentv(0, 0, ccomposite_h, get_image("cpanel_bg"));

	gui->draw_3segmenth(0, ccomposite_h, cstatus_x, get_image("cbuttons_left"));

	if(mwindow->edl->session->cwindow_meter)
	{
		gui->draw_3segmenth(cstatus_x,
							ccomposite_h,
							cmeter_x - widget_border - cstatus_x,
							get_image("cbuttons_right"));
		gui->draw_9segment(cmeter_x - widget_border,
						   0,
						   mwindow->session->cwindow_w - cmeter_x + widget_border,
						   mwindow->session->cwindow_h,
						   get_image("cmeter_bg"));
	} else {
		gui->draw_3segmenth(cstatus_x, ccomposite_h,
			cmeter_x - widget_border - cstatus_x + xS(100),
			get_image("cbuttons_right"));
	}
}

void NEOPHYTETHEME::draw_vwindow_bg(VWindowGUI *gui)
{
	gui->draw_3segmenth(0, vcanvas_h,
		vdivision_x, get_image("vbuttons_left"));
	if(mwindow->edl->session->vwindow_meter)
	{
		gui->draw_3segmenth(vdivision_x, vcanvas_h,
			vmeter_x - widget_border - vdivision_x, get_image("vbuttons_right"));
		gui->draw_9segment(vmeter_x - widget_border, 0,
			   mwindow->session->vwindow_w - vmeter_x + widget_border,
			   mwindow->session->vwindow_h, get_image("cmeter_bg"));
	} else {
		gui->draw_3segmenth(vdivision_x, vcanvas_h,
			vmeter_x - widget_border - vdivision_x + xS(100),
			get_image("vbuttons_right"));
	}

	// Clock deco
	gui->draw_3segmenth(
		vtime_x - xS(5),  // -left, +right
		vtime_y + 0,      // -up, +down. Careful, move some of the buttons as well.
		vtime_w + xS(10), // protruded l/r x*2
		get_image("vclock"));

}

void NEOPHYTETHEME::draw_preferences_bg(PreferencesWindow *gui)
{
	gui->draw_vframe(get_image("preferences_bg"), 0, 0);
}

void NEOPHYTETHEME::draw_new_bg(NewWindow *gui)
{
	gui->draw_vframe(get_image("new_bg"), 0, 0);
}

void NEOPHYTETHEME::draw_setformat_bg(SetFormatWindow *gui)
{
	gui->draw_vframe(get_image("setformat_bg"), 0, 0);
}
