From: Good Guy Date: Sun, 23 Jun 2019 02:30:35 +0000 (-0600) Subject: add edit clear submenu/clear hard_edges, fix tessy gl segv, mask toolgui layout,... X-Git-Tag: 2019-08~33 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=da1e39d85e138b0d552e932d875c05e8dc743244;p=goodguy%2Fcinelerra.git add edit clear submenu/clear hard_edges, fix tessy gl segv, mask toolgui layout, mask focus spot icon --- diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index af778e59..1825191e 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -129,6 +129,7 @@ CWindowGUI::~CWindowGUI() delete zoom_panel; delete active; delete inactive; + delete focus_frame; delete orig_mask_keyframe; } @@ -139,6 +140,7 @@ void CWindowGUI::create_objects() active = new BC_Pixmap(this, mwindow->theme->get_image("cwindow_active")); inactive = new BC_Pixmap(this, mwindow->theme->get_image("cwindow_inactive")); + focus_frame = new VFramePng(mwindow->theme->get_image_data("cwindow_focus.png")); mwindow->theme->get_cwindow_sizes(this, mwindow->session->cwindow_controls); mwindow->theme->draw_cwindow_bg(this); @@ -1798,12 +1800,39 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, output_to_canvas(mwindow->edl, 0, fx, fy); float r = bmax(cvs_win->get_w(), cvs_win->get_h()); float d = 0.005*r; +#if 1 + int fw = 2*d+3, fh = fw; + VFrame focus(fw,fh, BC_RGBA8888); + focus.transfer_from(gui->focus_frame); + fx -= fw/2.f; fy -= fh/2.f; + BC_Pixmap focus_pixmap(cvs_win, &focus, PIXMAP_ALPHA); + cvs_win->draw_pixmap(&focus_pixmap,fx,fy); +#else cvs_win->set_line_width((int)(0.0025*r) + 1); cvs_win->set_color(BLUE); cvs_win->draw_line(fx-d,fy-d, fx+d, fy+d); cvs_win->draw_line(fx-d,fy+d, fx+d, fy-d); cvs_win->set_line_width(0); cvs_win->set_color(WHITE); +#endif + } + if( draw && mask_gui && mask_gui->center_mark && points.size() ) { + float cx = 0, cy = 0; + int n = points.size(); + for( int i=0; ix; cy += point->y; + } + cx /= n; cy /= n; + output_to_canvas(mwindow->edl, 0, cx, cy); + float r = bmax(cvs_win->get_w(), cvs_win->get_h()); + float d = 0.003*r; + cvs_win->set_line_width((int)(0.002*r) + 1); + cvs_win->set_color(ORANGE); + cvs_win->draw_line(cx-d,cy, cx+d, cy); + cvs_win->draw_line(cx,cy-d, cx, cy+d); + cvs_win->set_line_width(0); + cvs_win->set_color(WHITE); } //printf("CWindowCanvas::do_mask 1\n"); } @@ -2122,6 +2151,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, point->control_x2 = !rotate ? px*scale : px*ct + py*st; point->control_y2 = !rotate ? py*scale : py*ct - px*st; } + rerender = 1; + redraw = 1; break; } } diff --git a/cinelerra-5.1/cinelerra/cwindowgui.h b/cinelerra-5.1/cinelerra/cwindowgui.h index 83b92434..f2ae71c3 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.h +++ b/cinelerra-5.1/cinelerra/cwindowgui.h @@ -101,6 +101,7 @@ public: CTimeBar *timebar; BC_Pixmap *active; BC_Pixmap *inactive; + VFrame *focus_frame; // MainClock *clock; diff --git a/cinelerra-5.1/cinelerra/cwindowtool.C b/cinelerra-5.1/cinelerra/cwindowtool.C index 65cb6109..d3d0b494 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.C +++ b/cinelerra-5.1/cinelerra/cwindowtool.C @@ -1482,6 +1482,18 @@ int CWindowProjectorBottom::handle_event() } +CWindowMaskTrack::CWindowMaskTrack(MWindow *mwindow, CWindowMaskGUI *gui, + int x, int y, const char *text) + : BC_Title(x, y, text, MEDIUMFONT, get_resources()->button_highlighted) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +CWindowMaskTrack::~CWindowMaskTrack() +{ +} + CWindowMaskName::CWindowMaskName(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y, const char *text) : BC_PopupTextBox(gui, 0, text, x, y, 100, 160) @@ -1787,7 +1799,7 @@ CWindowMaskFocus::CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui, int x, { this->mwindow = mwindow; this->gui = gui; - set_tooltip("Center for rotate/scale"); + set_tooltip(_("Center for rotate/scale")); } CWindowMaskFocus::~CWindowMaskFocus() @@ -1802,6 +1814,26 @@ int CWindowMaskFocus::handle_event() return 1; } +CWindowMaskDrawCenter::CWindowMaskDrawCenter(MWindow *mwindow, CWindowToolGUI *gui, int x, int y) + : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->center_mark, _("Center Mark")) +{ + this->mwindow = mwindow; + this->gui = gui; + set_tooltip(_("show center of mask points")); +} + +CWindowMaskDrawCenter::~CWindowMaskDrawCenter() +{ +} + +int CWindowMaskDrawCenter::handle_event() +{ + ((CWindowMaskGUI*)gui)->center_mark = get_value(); + gui->update(); + gui->update_preview(); + return 1; +} + CWindowMaskDrawMarkers::CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui, int x, int y) : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->markers, _("Markers")) { @@ -2220,7 +2252,7 @@ int CWindowMaskGangFeather::handle_event() CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread) : CWindowToolGUI(mwindow, thread, - _(PROGRAM_NAME ": Mask"), 360, 500) + _(PROGRAM_NAME ": Mask"), 360, 620) { this->mwindow = mwindow; this->thread = thread; @@ -2228,6 +2260,7 @@ CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread) fade = 0; feather = 0; focused = 0; + center_mark = 0; markers = 1; boundary = 1; } @@ -2251,9 +2284,16 @@ void CWindowMaskGUI::create_objects() // keyframe = (MaskAuto*)mwindow->cwindow->calculate_affected_auto(track->automation->autos[AUTOMATION_MASK], 0); lock_window("CWindowMaskGUI::create_objects"); + BC_TitleBar *title_bar; + add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Masks on Track"))); + y += title_bar->get_h() + margin; + int x1 = x + 70; + add_subwindow(mask_track = new CWindowMaskTrack(mwindow, this, x1, y, "")); + y += mask_track->get_h() + margin; + add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Masks"))); + y += title_bar->get_h() + margin; BC_Title *title; add_subwindow(title = new BC_Title(x, y, _("Mask:"))); - int x1 = x + 70; name = new CWindowMaskName(mwindow, this, x1, y, ""); name->create_objects(); add_subwindow(clr_mask = new CWindowMaskClrMask(mwindow, this, clr_x, y)); @@ -2279,7 +2319,9 @@ void CWindowMaskGUI::create_objects() mask_blabels[i] = new BC_Title(x2+tx, y, text); add_subwindow(mask_blabels[i]); } - y += bh + 2*margin; + y += mask_blabels[0]->get_h() + 2*margin; + add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Fade & Feather"))); + y += title_bar->get_h() + margin; add_subwindow(title = new BC_Title(x, y, _("Fade:"))); fade = new CWindowMaskFade(mwindow, this, x1, y); @@ -2296,7 +2338,9 @@ void CWindowMaskGUI::create_objects() feather_slider = new CWindowMaskFeatherSlider(mwindow, this, x2, y, w2, 0); add_subwindow(feather_slider); add_subwindow(gang_feather = new CWindowMaskGangFeather(mwindow, this, clr_x, y)); - y += feather->get_h() + 3*margin; + y += feather->get_h() + 2*margin; + add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Mask Points"))); + y += title_bar->get_h() + margin; add_subwindow(title = new BC_Title(x, y, _("Point:"))); active_point = new CWindowMaskAffectedPoint(mwindow, this, x1, y); @@ -2312,10 +2356,9 @@ void CWindowMaskGUI::create_objects() this->y = new CWindowCoord(this, x1, y, (float)0.0); this->y->create_objects(); add_subwindow(draw_boundary = new CWindowMaskDrawBoundary(mwindow, this, del_x, y)); - y += this->y->get_h() + margin; - BC_Bar *bar; - add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); - y += bar->get_h() + margin; + y += this->y->get_h() + 2*margin; + add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Pivot Point"))); + y += title_bar->get_h() + margin; add_subwindow(title = new BC_Title(x, y, "X:")); focus_x = new CWindowCoord(this, x1, y, (float)0.0); @@ -2325,7 +2368,11 @@ void CWindowMaskGUI::create_objects() add_subwindow(title = new BC_Title(x, y, "Y:")); focus_y = new CWindowCoord(this, x1, y, (float)0.0); focus_y->create_objects(); - y += focus_x->get_h() + margin; + add_subwindow(draw_center = new CWindowMaskDrawCenter(mwindow, this, del_x, y)); + y += focus_x->get_h() + 2*margin; + BC_Bar *bar; + add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x)); + y += bar->get_h() + margin; add_subwindow(this->apply_before_plugins = new CWindowMaskBeforePlugins(this, 10, y)); y += this->apply_before_plugins->get_h(); add_subwindow(this->disable_opengl_masking = new CWindowDisableOpenGLMasking(this, 10, y)); @@ -2391,6 +2438,7 @@ void CWindowMaskGUI::update() //printf("CWindowMaskGUI::update 1\n"); get_keyframe(track, autos, keyframe, mask, point, 0); + mask_track->update(!track ? "" : track->title); name->update_items(keyframe); const char *text = ""; int sz = !keyframe ? 0 : keyframe->masks.size(); diff --git a/cinelerra-5.1/cinelerra/cwindowtool.h b/cinelerra-5.1/cinelerra/cwindowtool.h index e6922e4b..dcdfa160 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.h +++ b/cinelerra-5.1/cinelerra/cwindowtool.h @@ -128,6 +128,16 @@ public: CWindowCoord *x1, *y1, *width, *height; }; +class CWindowMaskTrack : public BC_Title +{ +public: + CWindowMaskTrack(MWindow *mwindow, CWindowMaskGUI *gui, + int x, int y, const char *text); + ~CWindowMaskTrack(); + MWindow *mwindow; + CWindowMaskGUI *gui; +}; + class CWindowMaskItems : public ArrayList { public: @@ -260,6 +270,17 @@ public: CWindowToolGUI *gui; }; +class CWindowMaskDrawCenter : public BC_CheckBox +{ +public: + CWindowMaskDrawCenter(MWindow *mwindow, CWindowToolGUI *gui, + int x, int y); + ~CWindowMaskDrawCenter(); + int handle_event(); + MWindow *mwindow; + CWindowToolGUI *gui; +}; + class CWindowMaskDrawMarkers : public BC_CheckBox { public: @@ -365,6 +386,7 @@ public: SubMask* &mask, MaskPoint* &point, int create_it); void update_preview(); + CWindowMaskTrack *mask_track; CWindowMaskName *name; CWindowMaskButton *mask_buttons[SUBMASKS]; CWindowMaskThumbler *mask_thumbler; @@ -379,6 +401,8 @@ public: CWindowCoord *x, *y; CWindowMaskFocus *focus; int focused; + CWindowMaskDrawCenter *draw_center; + int center_mark; CWindowMaskDrawMarkers *draw_markers; int markers; CWindowMaskDrawBoundary *draw_boundary; diff --git a/cinelerra-5.1/cinelerra/cwindowtool.inc b/cinelerra-5.1/cinelerra/cwindowtool.inc index 2a8ed55f..9d8118d3 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.inc +++ b/cinelerra-5.1/cinelerra/cwindowtool.inc @@ -28,6 +28,7 @@ class CWindowCurveToggle; class CWindowCoord; class CWindowCropOK; class CWindowCropGUI; +class CWindowMaskTrack; class CWindowMaskItems; class CWindowMaskName; class CWindowMaskDelMask; @@ -39,6 +40,7 @@ class CWindowMaskFadeSlider; class CWindowMaskGangFader; class CWindowMaskAffectedPoint; class CWindowMaskFocus; +class CWindowMaskDrawCenter; class CWindowMaskDrawMarkers; class CWindowMaskDrawBoundary; class CWindowMaskDelPoint; diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index cc2e84fb..640092d1 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -802,6 +802,11 @@ int EDL::clear(double start, double end, return 0; } +int EDL::clear_hard_edges(double start, double end) +{ + return tracks->clear_hard_edges(start, end); +} + static int dead_edit_cmp(Edit**ap, Edit**bp) { Edit *a = *ap, *b = *bp; diff --git a/cinelerra-5.1/cinelerra/edl.h b/cinelerra-5.1/cinelerra/edl.h index e8dadce0..b1c4fd3f 100644 --- a/cinelerra-5.1/cinelerra/edl.h +++ b/cinelerra-5.1/cinelerra/edl.h @@ -211,7 +211,7 @@ public: int clear_labels, int clear_plugins, int edit_autos); - void deglitch(double position); + int clear_hard_edges(double start, double end); // Insert the asset at a point in the EDL void insert_asset(Asset *asset, EDL *nested_edl, diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C index bc12bed7..52cfe6eb 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.C +++ b/cinelerra-5.1/cinelerra/mainmenu.C @@ -148,9 +148,9 @@ void MainMenu::create_objects() editmenu->add_item(new Cut(mwindow)); editmenu->add_item(new Copy(mwindow)); editmenu->add_item(new Paste(mwindow)); - editmenu->add_item(new Clear(mwindow)); editmenu->add_item(new PasteSilence(mwindow)); - editmenu->add_item(new MuteSelection(mwindow)); + editmenu->add_item(clear_menu = new EditClearMenu(mwindow)); + clear_menu->create_objects(); editmenu->add_item(new TrimSelection(mwindow)); editmenu->add_item(new SelectAll(mwindow)); editmenu->add_item(new BC_MenuItem("-")); @@ -161,7 +161,6 @@ void MainMenu::create_objects() editmenu->add_item(new MenuTransitionLength(mwindow)); editmenu->add_item(new DetachTransitions(mwindow)); editmenu->add_item(new BC_MenuItem("-")); - editmenu->add_item(new ClearLabels(mwindow)); editmenu->add_item(new CutCommercials(mwindow)); editmenu->add_item(new PasteSubttl(mwindow)); @@ -956,6 +955,34 @@ int Paste::handle_event() return 1; } +EditClearSubMenu::EditClearSubMenu(BC_MenuItem *menu_item) + : BC_SubMenu() +{ + this->menu_item = menu_item; +} +EditClearSubMenu::~EditClearSubMenu() +{ +} + +EditClearMenu::EditClearMenu(MWindow *mwindow) + : BC_MenuItem(_("Clear...")) +{ + this->mwindow = mwindow; + this->clear_sub_menu = 0; +} +EditClearMenu::~EditClearMenu() +{ +} + +void EditClearMenu::create_objects() +{ + add_submenu(clear_sub_menu = new EditClearSubMenu(this)); + clear_sub_menu->add_item(new Clear(mwindow)); + clear_sub_menu->add_item(new MuteSelection(mwindow)); + clear_sub_menu->add_item(new ClearHardEdges(mwindow)); + clear_sub_menu->add_item(new ClearLabels(mwindow)); +}; + Clear::Clear(MWindow *mwindow) : BC_MenuItem(_("Clear"), _("Del"), DELETE) { @@ -999,6 +1026,17 @@ int SelectAll::handle_event() return 1; } +ClearHardEdges::ClearHardEdges(MWindow *mwindow) : BC_MenuItem(_("Clear Hard Edges")) +{ + this->mwindow = mwindow; +} + +int ClearHardEdges::handle_event() +{ + mwindow->clear_hard_edges(); + return 1; +} + ClearLabels::ClearLabels(MWindow *mwindow) : BC_MenuItem(_("Clear labels")) { this->mwindow = mwindow; diff --git a/cinelerra-5.1/cinelerra/mainmenu.h b/cinelerra-5.1/cinelerra/mainmenu.h index 482cce3a..ccb9d25b 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.h +++ b/cinelerra-5.1/cinelerra/mainmenu.h @@ -91,6 +91,7 @@ public: MenuVEffectItem *veffect[TOTAL_EFFECTS]; Quit *quit_program; // affected by save MainDumpsMenu *dump_menu; + EditClearMenu *clear_menu; Undo *undo; Redo *redo; int total_aeffects; @@ -237,6 +238,26 @@ public: MWindow *mwindow; }; +class EditClearSubMenu : public BC_SubMenu +{ +public: + EditClearSubMenu(BC_MenuItem *menu_item); + ~EditClearSubMenu(); + + BC_MenuItem *menu_item; +}; + +class EditClearMenu : public BC_MenuItem +{ +public: + EditClearMenu(MWindow *mwindow); + ~EditClearMenu(); + void create_objects(); + + MWindow *mwindow; + EditClearSubMenu *clear_sub_menu; +}; + class Clear : public BC_MenuItem { public: @@ -377,6 +398,14 @@ public: MWindow *mwindow; }; +class ClearHardEdges : public BC_MenuItem +{ +public: + ClearHardEdges(MWindow *mwindow); + int handle_event(); + MWindow *mwindow; +}; + class ClearLabels : public BC_MenuItem { public: diff --git a/cinelerra-5.1/cinelerra/mainmenu.inc b/cinelerra-5.1/cinelerra/mainmenu.inc index f541463c..e145397e 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.inc +++ b/cinelerra-5.1/cinelerra/mainmenu.inc @@ -37,6 +37,8 @@ class Redo; class Cut; class Copy; class Paste; +class EditClearSubMenu; +class EditClearMenu; class Clear; class CutKeyframes; class CopyKeyframes; @@ -53,6 +55,7 @@ class PasteDefaultKeyframe; class ClearDefaultKeyframe; class PasteSilence; class SelectAll; +class ClearHardEdges; class ClearLabels; class CutCommercials; class DetachTransitions; @@ -61,6 +64,7 @@ class TrimSelection; class MixerItems; class MixerViewer; class TileMixers; +class AlignMixers; class AddAudioTrack; class DeleteAudioTrack; class DefaultATransition; diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 3256ace6..11d393c8 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -348,6 +348,8 @@ public: void clear(int clear_handle); void clear_labels(); int clear_labels(double start, double end); + void clear_hard_edges(); + int clear_hard_edges(double start, double end); void concatenate_tracks(); int copy_flags(int copy_flags=COPY_CLIPBOARD); void copy(); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 6be47c54..d3e5218f 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -403,10 +403,37 @@ void MWindow::clear_labels() int MWindow::clear_labels(double start, double end) { + if( start == end ) { + start = 0; + end = edl->tracks->total_length(); + } edl->labels->clear(start, end, 0); return 0; } +void MWindow::clear_hard_edges() +{ + undo_before(); + clear_hard_edges(edl->local_session->get_selectionstart(), + edl->local_session->get_selectionend()); + edl->optimize(); + save_backup(); + undo_after(_("clear hard edges"), LOAD_EDITS); + restart_brender(); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); + cwindow->refresh_frame(CHANGE_EDL); +} + +int MWindow::clear_hard_edges(double start, double end) +{ + if( start == end ) { + start = 0; + end = edl->tracks->total_length(); + } + edl->clear_hard_edges(start, end); + return 0; +} + void MWindow::concatenate_tracks() { undo_before(); diff --git a/cinelerra-5.1/cinelerra/playback3d.C b/cinelerra-5.1/cinelerra/playback3d.C index 9b4aea73..1c7ddc75 100644 --- a/cinelerra-5.1/cinelerra/playback3d.C +++ b/cinelerra-5.1/cinelerra/playback3d.C @@ -1224,10 +1224,12 @@ static void combineData(GLdouble coords[3], vertex[1] = coords[1]; vertex[2] = coords[2]; for( int i=3; i<6; ++i ) { - vertex[i] = weight[0] * vertex_data[0][i] + - weight[1] * vertex_data[1][i] + - weight[2] * vertex_data[2][i] + - weight[3] * vertex_data[3][i]; + GLdouble v = 0; + for( int k=0; k<4; ++k ) { + if( !weight[k] || !vertex_data[k] ) continue; + v += weight[k] * vertex_data[k][i]; + } + vertex[i] = v; } *outData = vertex; } diff --git a/cinelerra-5.1/cinelerra/tracks.h b/cinelerra-5.1/cinelerra/tracks.h index b7cd63ac..da867148 100644 --- a/cinelerra-5.1/cinelerra/tracks.h +++ b/cinelerra-5.1/cinelerra/tracks.h @@ -58,6 +58,7 @@ public: // Construct a list of all the recordable edits which start on position void clear_selected_edits(); void select_affected_edits(double position, Track *start_track, int sense); + int clear_hard_edges(double start, double end); void get_selected_edits(ArrayList *drag_edits); int next_group_id(); int new_group(int id); diff --git a/cinelerra-5.1/cinelerra/tracksedit.C b/cinelerra-5.1/cinelerra/tracksedit.C index 9cc095bf..183f35f7 100644 --- a/cinelerra-5.1/cinelerra/tracksedit.C +++ b/cinelerra-5.1/cinelerra/tracksedit.C @@ -120,6 +120,24 @@ void Tracks::clear_transitions(double start, double end) } } +int Tracks::clear_hard_edges(double start, double end) +{ + for( Track *track=first; track; track=track->next ) { + if( !track->record ) continue; + int64_t start_units = track->to_units(start, 0); + int64_t end_units = track->to_units(end, 0); + + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + if( edit->startproject < start_units ) continue; + if( edit->startproject >= end_units ) continue; + edit->hard_left = 0; + if( !edit->previous ) continue; + edit->previous->hard_right = 0; + } + } + return 0; +} + void Tracks::shuffle_edits(double start, double end) { // This doesn't affect automation or effects diff --git a/cinelerra-5.1/guicast/bctitle.C b/cinelerra-5.1/guicast/bctitle.C index 3716e3b8..57d1e093 100644 --- a/cinelerra-5.1/guicast/bctitle.C +++ b/cinelerra-5.1/guicast/bctitle.C @@ -21,7 +21,8 @@ #include "bcresources.h" #include "bctitle.h" -#include "bcresources.h" +#include "bcpixmap.h" +#include "vframe.h" #include #include @@ -112,8 +113,6 @@ char* BC_Title::get_text() int BC_Title::draw(int flush) { - int i, j, x, y; - // Fix background for block fonts. // This should eventually be included in a BC_WindowBase::is_blocked_font() @@ -130,30 +129,21 @@ int BC_Title::draw(int flush) set_font(font); BC_WindowBase::set_color(color); - int text_len = strlen(text); - j = 0; x = 0; y = get_text_ascent(font); - for(i = 0; i <= text_len; i++) - { - if(text[i] == '\n' || text[i] == 0) - { - if(centered) - { - draw_center_text(get_w() / 2, - y, - &text[j], - i - j); - j = i + 1; - } - else - { - draw_text(x, - y, - &text[j], - i - j); - j = i + 1; - } - y += get_text_height(font); - } + return draw(flush, 0, 0); +} + +int BC_Title::draw(int flush, int x, int y) +{ + y += get_text_ascent(font); + int len = strlen(text); + for( int i=0,j=0; i<=len; ++i ) { + if( text[i] && text[i] != '\n' ) continue; + if( centered ) + draw_center_text(get_w()/2, y, &text[j], i - j); + else + draw_text(x, y, &text[j], i - j); + j = i + 1; + y += get_text_height(font); } set_font(MEDIUMFONT); // reset flash(flush); @@ -206,3 +196,53 @@ void BC_Title::get_size(BC_WindowBase *gui, int font, const char *text, int fixe w += 5; if(fixed_w > 0) w = fixed_w; } + + +BC_TitleBar::BC_TitleBar(int x, int y, int w, int offset, int margin, + const char *text, int font, int color, VFrame *data) +: BC_Title(x, y, text, font, color, 0, w) +{ + this->offset = offset; + this->margin = margin; + this->data = data; + image = 0; +} + +BC_TitleBar::~BC_TitleBar() +{ + delete image; +} + +void BC_TitleBar::set_image(VFrame *data) +{ + delete image; + image = new BC_Pixmap(get_parent_window(), data, PIXMAP_ALPHA); +} + +int BC_TitleBar::initialize() +{ + if(data) + set_image(data); + else + set_image(get_resources()->bar_data); + BC_Title::initialize(); + draw(0); + return 0; +} + +int BC_TitleBar::draw(int flush) +{ + int w = get_w(), h = get_h(), h2 = h/2; + draw_top_background(get_parent_window(), 0, 0,w, h); + draw_3segmenth(0,h2, offset, 0, offset, image); + int tx = offset + margin, tw, th; + set_font(font); + BC_WindowBase::set_color(color); + BC_Title::draw(flush, tx, 0); + get_size(get_parent_window(), font, text, 0, tw, th); + tx += tw + margin; + draw_3segmenth(tx,h2, w-tx, tx,w-tx, image); + flash(flush); + return 0; +} + diff --git a/cinelerra-5.1/guicast/bctitle.h b/cinelerra-5.1/guicast/bctitle.h index adb59f24..3c492c3a 100644 --- a/cinelerra-5.1/guicast/bctitle.h +++ b/cinelerra-5.1/guicast/bctitle.h @@ -26,8 +26,11 @@ #include "bccolors.h" #include "fonts.h" +class BC_TitleBar; + class BC_Title : public BC_SubWindow { + friend class BC_TitleBar; public: BC_Title(int x, int y, @@ -49,8 +52,10 @@ public: char* get_text(); private: - int draw(int flush); + int draw(int flush, int x, int y); + virtual int draw(int flush); static void get_size(BC_WindowBase *gui, int font, const char *text, int fixed_w, int &w, int &h); + BC_WindowBase *get_parent_window() { return parent_window; } char text[BCTEXTLEN]; int color; @@ -60,4 +65,22 @@ private: int fixed_w; }; +class BC_TitleBar : public BC_Title +{ +public: + BC_TitleBar(int x, int y, int w, int offset, int margin, + const char *text, int font = MEDIUMFONT, + int color = -1, VFrame *data = 0); + virtual ~BC_TitleBar(); + + int initialize(); + void set_image(VFrame *data); + + int w, offset, margin; + VFrame *data; + BC_Pixmap *image; +private: + int draw(int flush); +}; + #endif diff --git a/cinelerra-5.1/plugins/theme_blond/blondtheme.C b/cinelerra-5.1/plugins/theme_blond/blondtheme.C index 37e2c397..10f4285b 100644 --- a/cinelerra-5.1/plugins/theme_blond/blondtheme.C +++ b/cinelerra-5.1/plugins/theme_blond/blondtheme.C @@ -513,6 +513,7 @@ void BlondTheme::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png"); diff --git a/cinelerra-5.1/plugins/theme_blond/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_blond/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blond/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_blond_cv/blondcvtheme.C b/cinelerra-5.1/plugins/theme_blond_cv/blondcvtheme.C index 6ab7a9e7..46c12e6d 100644 --- a/cinelerra-5.1/plugins/theme_blond_cv/blondcvtheme.C +++ b/cinelerra-5.1/plugins/theme_blond_cv/blondcvtheme.C @@ -471,6 +471,7 @@ void BlondCVTheme::initialize() cbuttons_left = new_image("cbuttons_left.png"); cbuttons_right = new_image("cbuttons_right.png"); cmeter_bg = new_image("cmeter_bg.png"); + new_image("cwindow_focus", "cwindow_focus.png"); ctimebar_x = ccanvas_x; ctimebar_y = ccanvas_y + ccanvas_h; diff --git a/cinelerra-5.1/plugins/theme_blond_cv/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_blond_cv/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blond_cv/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_blue/bluetheme.C b/cinelerra-5.1/plugins/theme_blue/bluetheme.C index ea43e59d..0fa46e8e 100644 --- a/cinelerra-5.1/plugins/theme_blue/bluetheme.C +++ b/cinelerra-5.1/plugins/theme_blue/bluetheme.C @@ -513,6 +513,7 @@ void BlueDotTheme::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png"); diff --git a/cinelerra-5.1/plugins/theme_blue/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_blue/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C b/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C index e55d920b..49508a9d 100644 --- a/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C +++ b/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C @@ -548,6 +548,7 @@ void BlueDotTheme::initialize() 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"); new_image("vbuttons_left", "vbuttons_left.png"); new_image("vbuttons_right", "vbuttons_right.png"); timebar_view_data = new_image("timebar_view.png"); diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_blue_dot/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_bright/brighttheme.C b/cinelerra-5.1/plugins/theme_bright/brighttheme.C index cd3acc9c..3c7f56d3 100644 --- a/cinelerra-5.1/plugins/theme_bright/brighttheme.C +++ b/cinelerra-5.1/plugins/theme_bright/brighttheme.C @@ -519,6 +519,7 @@ void BrightTheme::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png"); diff --git a/cinelerra-5.1/plugins/theme_bright/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_bright/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_bright/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C b/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C index b4170efd..97620ca0 100644 --- a/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C +++ b/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C @@ -515,6 +515,7 @@ void CAKEWALKTHEME::initialize() 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"); new_image("vbuttons_left", "vbuttons_left.png"); new_image("vbuttons_right", "vbuttons_right.png"); new_image("vclock", "vclock.png"); diff --git a/cinelerra-5.1/plugins/theme_cakewalk/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_cakewalk/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_cakewalk/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_hulk/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_hulk/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_hulk/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_hulk/hulktheme.C b/cinelerra-5.1/plugins/theme_hulk/hulktheme.C index 8222d6df..ca798198 100644 --- a/cinelerra-5.1/plugins/theme_hulk/hulktheme.C +++ b/cinelerra-5.1/plugins/theme_hulk/hulktheme.C @@ -514,6 +514,7 @@ void HULKTHEME::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png"); diff --git a/cinelerra-5.1/plugins/theme_neophyte/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_neophyte/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_neophyte/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_neophyte/neophyte.C b/cinelerra-5.1/plugins/theme_neophyte/neophyte.C index 3d34c837..24fec36c 100644 --- a/cinelerra-5.1/plugins/theme_neophyte/neophyte.C +++ b/cinelerra-5.1/plugins/theme_neophyte/neophyte.C @@ -650,6 +650,7 @@ void NEOPHYTETHEME::initialize() 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. diff --git a/cinelerra-5.1/plugins/theme_pinklady/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_pinklady/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_pinklady/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_pinklady/pinkladytheme.C b/cinelerra-5.1/plugins/theme_pinklady/pinkladytheme.C index 50017627..0dce66d6 100644 --- a/cinelerra-5.1/plugins/theme_pinklady/pinkladytheme.C +++ b/cinelerra-5.1/plugins/theme_pinklady/pinkladytheme.C @@ -499,6 +499,7 @@ void PINKLADY::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png"); diff --git a/cinelerra-5.1/plugins/theme_suv/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_suv/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_suv/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_suv/suv.C b/cinelerra-5.1/plugins/theme_suv/suv.C index 40ad35c4..4fae7dbb 100644 --- a/cinelerra-5.1/plugins/theme_suv/suv.C +++ b/cinelerra-5.1/plugins/theme_suv/suv.C @@ -500,6 +500,7 @@ void SUV::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png"); diff --git a/cinelerra-5.1/plugins/theme_unflat/data/cwindow_focus.png b/cinelerra-5.1/plugins/theme_unflat/data/cwindow_focus.png new file mode 100644 index 00000000..8fe07fc1 Binary files /dev/null and b/cinelerra-5.1/plugins/theme_unflat/data/cwindow_focus.png differ diff --git a/cinelerra-5.1/plugins/theme_unflat/unflattheme.C b/cinelerra-5.1/plugins/theme_unflat/unflattheme.C index 55a3dd04..fa449a4a 100644 --- a/cinelerra-5.1/plugins/theme_unflat/unflattheme.C +++ b/cinelerra-5.1/plugins/theme_unflat/unflattheme.C @@ -508,6 +508,7 @@ void UNFLATTHEME::initialize() 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 new_image("vbuttons_left", "vbuttons_left.png");