From 0ac6a1397cf8ee19cf75f3fe893c27e9f4fc0ea5 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 20 Oct 2017 18:15:25 -0600 Subject: [PATCH] folder icon move segv, resources drag scroll bug, memory leaks, global msgqual, po tweaks --- cinelerra-5.1/cinelerra/Makefile | 2 +- cinelerra-5.1/cinelerra/aboutprefs.C | 12 +-- cinelerra-5.1/cinelerra/aboutprefs.h | 3 +- cinelerra-5.1/cinelerra/appearanceprefs.C | 6 -- cinelerra-5.1/cinelerra/awindowgui.C | 119 +++++++++++++--------- cinelerra-5.1/cinelerra/colorpicker.C | 3 - cinelerra-5.1/cinelerra/interfaceprefs.C | 8 +- cinelerra-5.1/cinelerra/mwindow.C | 3 +- cinelerra-5.1/cinelerra/playbackprefs.C | 2 +- cinelerra-5.1/cinelerra/proxy.C | 5 + cinelerra-5.1/cinelerra/proxy.h | 1 + cinelerra-5.1/cinelerra/statusbar.C | 2 +- cinelerra-5.1/cinelerra/swindow.C | 2 +- cinelerra-5.1/guicast/Makefile | 2 +- cinelerra-5.1/guicast/bclistbox.C | 17 +++- cinelerra-5.1/guicast/bcwindowbase.C | 2 + cinelerra-5.1/guicast/language.h | 2 + cinelerra-5.1/plugin_config | 4 +- cinelerra-5.1/plugins/titler/titler.C | 3 +- cinelerra-5.1/po/xlat.sh | 3 +- 20 files changed, 118 insertions(+), 83 deletions(-) diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index bd59f62e..63869513 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -445,7 +445,7 @@ tags: $(OBJDIR)/%.o: %.C - $(CXX) `cat $(OBJDIR)/c_flags` -c $< -o $@ + $(CXX) `cat $(OBJDIR)/c_flags` '-DMSGQUAL="$*"' -c $< -o $@ $(OBJDIR)/sha1.o: sha1.C sha1.h $(CXX) `cat $(OBJDIR)/c_flags` -O3 -c $< -o $@ diff --git a/cinelerra-5.1/cinelerra/aboutprefs.C b/cinelerra-5.1/cinelerra/aboutprefs.C index 8ad411dd..4702c944 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.C +++ b/cinelerra-5.1/cinelerra/aboutprefs.C @@ -29,7 +29,10 @@ #include "vframe.h" #include "versioninfo.h" - +#ifndef COMPILEDATE +#define COMPILEDATE "built: " __DATE__ " " __TIME__ +#endif +const char *AboutPrefs::build_timestamp = COMPILEDATE; AboutPrefs::AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow) : PreferencesDialog(mwindow, pwindow) @@ -121,12 +124,9 @@ void AboutPrefs::create_objects() draw_text(x, y, license3); y += get_text_height(MEDIUMFONT, license3); -#ifndef COMPILEDATE -#define COMPILEDATE "built: " __DATE__ " " __TIME__ -#endif - draw_text(x, y, COMPILEDATE); + draw_text(x, y, build_timestamp); #if defined(REPOMAINTXT) - y += get_text_height(MEDIUMFONT, COMPILEDATE); + y += get_text_height(MEDIUMFONT, build_timestamp); draw_text(x, y, REPOMAINTXT); #endif diff --git a/cinelerra-5.1/cinelerra/aboutprefs.h b/cinelerra-5.1/cinelerra/aboutprefs.h index 0b9b25b1..ee87dcf1 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.h +++ b/cinelerra-5.1/cinelerra/aboutprefs.h @@ -31,8 +31,7 @@ public: AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow); ~AboutPrefs(); - - + static const char *build_timestamp; void create_objects(); ArrayList about; }; diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C index c054e340..1fc61cc0 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.C +++ b/cinelerra-5.1/cinelerra/appearanceprefs.C @@ -33,12 +33,6 @@ #include "theme.h" -#define MOVE_ALL_EDITS_TITLE N_("Drag all following edits") -#define MOVE_ONE_EDIT_TITLE N_("Drag only one edit") -#define MOVE_NO_EDITS_TITLE N_("Drag source only") -#define MOVE_EDITS_DISABLED_TITLE N_("No effect") - - AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow) : PreferencesDialog(mwindow, pwindow) { diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index da146a61..7b717fee 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -392,19 +392,40 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) { this->mwindow = mwindow; this->awindow = awindow; - file_icon = 0; - audio_icon = 0; - video_icon = 0; - folder_icon = 0; - clip_icon = 0; - label_icon = 0; - atransition_icon = 0; atransition_vframe = 0; - vtransition_icon = 0; vtransition_vframe = 0; - aeffect_icon = 0; aeffect_vframe = 0; - ladspa_icon = 0; ladspa_vframe = 0; - veffect_icon = 0; veffect_vframe = 0; - ff_aud_icon = 0; ff_aud_vframe = 0; - ff_vid_icon = 0; ff_vid_vframe = 0; + + file_vframe = 0; file_icon = 0; + folder_vframe = 0; folder_icon = 0; + audio_vframe = 0; audio_icon = 0; + video_vframe = 0; video_icon = 0; + label_vframe = 0; label_icon = 0; + + atransition_vframe = 0; atransition_icon = 0; + vtransition_vframe = 0; vtransition_icon = 0; + aeffect_vframe = 0; aeffect_icon = 0; + ladspa_vframe = 0; ladspa_icon = 0; + veffect_vframe = 0; veffect_icon = 0; + ff_aud_vframe = 0; ff_aud_icon = 0; + ff_vid_vframe = 0; ff_vid_icon = 0; + + aeffect_folder_vframe = 0; aeffect_folder_icon = 0; + atransition_folder_vframe = 0; atransition_folder_icon = 0; + clip_folder_vframe = 0; clip_folder_icon = 0; + label_folder_vframe = 0; label_folder_icon = 0; + media_folder_vframe = 0; media_folder_icon = 0; + proxy_folder_vframe = 0; proxy_folder_icon = 0; + veffect_folder_vframe = 0; veffect_folder_icon = 0; + vtransition_folder_vframe = 0; vtransition_folder_icon = 0; + + ladspa_vframe = 0; ladspa_icon = 0; + ff_aud_vframe = 0; ff_aud_icon = 0; + ff_vid_vframe = 0; ff_vid_icon = 0; + + clip_vframe = 0; clip_icon = 0; + atransition_vframe = 0; atransition_icon = 0; + vtransition_vframe = 0; vtransition_icon = 0; + aeffect_vframe = 0; aeffect_icon = 0; + veffect_vframe = 0; veffect_icon = 0; + plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1; newfolder_thread = 0; asset_menu = 0; @@ -433,20 +454,8 @@ AWindowGUI::~AWindowGUI() displayed_assets[1].remove_all_objects(); delete vicon_thread; - delete file_icon; - delete audio_icon; - delete video_icon; - delete folder_icon; - delete clip_icon; - delete label_icon; - delete atransition_icon; - delete vtransition_icon; - delete aeffect_icon; - delete veffect_icon; - delete ladspa_icon; - delete ff_aud_icon; - delete ff_vid_icon; delete newfolder_thread; + delete asset_menu; delete clip_menu; delete label_menu; @@ -457,6 +466,28 @@ AWindowGUI::~AWindowGUI() delete folderlist_menu; delete temp_picon; delete remove_plugin; + + delete file_vframe; delete file_icon; + delete folder_vframe; delete folder_icon; + delete audio_vframe; delete audio_icon; + delete video_vframe; delete video_icon; + delete label_vframe; delete label_icon; + delete clip_vframe; delete clip_icon; + delete aeffect_folder_vframe; delete aeffect_folder_icon; + delete atransition_folder_vframe; delete atransition_folder_icon; + delete veffect_folder_vframe; delete veffect_folder_icon; + delete vtransition_folder_vframe; delete vtransition_folder_icon; + delete clip_folder_vframe; delete clip_folder_icon; + delete label_folder_vframe; delete label_folder_icon; + delete media_folder_vframe; delete media_folder_icon; + delete proxy_folder_vframe; delete proxy_folder_icon; + delete ladspa_vframe; delete ladspa_icon; + delete ff_aud_vframe; delete ff_aud_icon; + delete ff_vid_vframe; delete ff_vid_icon; + delete atransition_vframe; delete atransition_icon; + delete vtransition_vframe; delete vtransition_icon; + delete aeffect_vframe; delete aeffect_icon; + delete veffect_vframe; delete veffect_icon; } bool AWindowGUI::protected_pixmap(BC_Pixmap *icon) @@ -576,22 +607,16 @@ void AWindowGUI::create_objects() mwindow->theme->get_awindow_sizes(this); load_defaults(mwindow->defaults); - add_subwindow(asset_list = new AWindowAssets(mwindow, - this, - mwindow->theme->alist_x, - mwindow->theme->alist_y, - mwindow->theme->alist_w, - mwindow->theme->alist_h)); + add_subwindow(asset_list = new AWindowAssets(mwindow, this, + mwindow->theme->alist_x, mwindow->theme->alist_y, + mwindow->theme->alist_w, mwindow->theme->alist_h)); vicon_thread = new VIconThread(asset_list); vicon_thread->start(); - add_subwindow(divider = new AWindowDivider(mwindow, - this, - mwindow->theme->adivider_x, - mwindow->theme->adivider_y, - mwindow->theme->adivider_w, - mwindow->theme->adivider_h)); + add_subwindow(divider = new AWindowDivider(mwindow, this, + mwindow->theme->adivider_x, mwindow->theme->adivider_y, + mwindow->theme->adivider_w, mwindow->theme->adivider_h)); divider->set_cursor(HSEPARATE_CURSOR, 0, 0); @@ -771,8 +796,8 @@ void AWindowRemovePluginGUI::create_objects() add_subwindow(title); y += title->get_h() + 5; list = new BC_ListBox(x, y, - get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list, - 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0); + get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list, + 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0); add_subwindow(list); show_window(); } @@ -1116,13 +1141,15 @@ void AWindowGUI::sort_assets() default: sort_picons(&assets); } - +// reset xyposition + asset_list->update_format(asset_list->get_format(), 0); update_assets(); } void AWindowGUI::sort_folders() { sort_picons(&folders); + folder_list->update_format(folder_list->get_format(), 0); update_assets(); } @@ -1926,13 +1953,13 @@ AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx) this->idx = idx; uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility; int chk = (msk & vis) ? 1 : 0; - set_checked(chk); + set_checked(chk); } int AddPluginItem::handle_event() { - int chk = get_checked() ^ 1; - set_checked(chk); + int chk = get_checked() ^ 1; + set_checked(chk); uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility; menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk; menu->gui->update_effects(); @@ -2004,8 +2031,8 @@ int AWindowListFormat::handle_event() void AWindowListFormat::update() { - set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ? - (char*)_("Display icons") : (char*)_("Display text")); + set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ? + (char*)_("Display icons") : (char*)_("Display text")); } AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui) diff --git a/cinelerra-5.1/cinelerra/colorpicker.C b/cinelerra-5.1/cinelerra/colorpicker.C index a95f6ef3..924d989b 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.C +++ b/cinelerra-5.1/cinelerra/colorpicker.C @@ -35,9 +35,6 @@ #include #include -#undef MSGQUAL -#define MSGQUAL "colorpicker" - #define PALETTE_DATA "palette.dat" ColorPicker::ColorPicker(int do_alpha, const char *title) diff --git a/cinelerra-5.1/cinelerra/interfaceprefs.C b/cinelerra-5.1/cinelerra/interfaceprefs.C index 90c67b1a..e1d69537 100644 --- a/cinelerra-5.1/cinelerra/interfaceprefs.C +++ b/cinelerra-5.1/cinelerra/interfaceprefs.C @@ -40,10 +40,10 @@ N_("Drag source only") N_("No effect") #endif -#define MOVE_ALL_EDITS_TITLE "Drag all following edits" -#define MOVE_ONE_EDIT_TITLE "Drag only one edit" -#define MOVE_NO_EDITS_TITLE "Drag source only" -#define MOVE_EDITS_DISABLED_TITLE "No effect" +#define MOVE_ALL_EDITS_TITLE N_("Drag all following edits") +#define MOVE_ONE_EDIT_TITLE N_("Drag only one edit") +#define MOVE_NO_EDITS_TITLE N_("Drag source only") +#define MOVE_EDITS_DISABLED_TITLE N_("No effect") InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow) : PreferencesDialog(mwindow, pwindow) diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 1aa06bac..238c17aa 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -18,6 +18,7 @@ * */ +#include "aboutprefs.h" #include "asset.h" #include "assets.h" #include "atrack.h" @@ -3400,7 +3401,7 @@ void MWindow::trap_hook(FILE *fp, void *vp) mwindow->dump_edl(fp); fprintf(fp, "\nUNDO:\n"); mwindow->dump_undo(fp); - fprintf(fp, "\nEXE:\n"); + fprintf(fp, "\nEXE: %s\n", AboutPrefs::build_timestamp); mwindow->dump_exe(fp); } diff --git a/cinelerra-5.1/cinelerra/playbackprefs.C b/cinelerra-5.1/cinelerra/playbackprefs.C index 91adc592..d8491313 100644 --- a/cinelerra-5.1/cinelerra/playbackprefs.C +++ b/cinelerra-5.1/cinelerra/playbackprefs.C @@ -147,7 +147,7 @@ SET_TRACE int y1 = y + (window->get_h() - BC_Title::calculate_h(this, txt)) / 2; add_subwindow(title1 = new BC_Title(x1, y1, txt)); x1 += title1->get_w() + margin; - add_subwindow(framerate_title = new BC_Title(x1, y1, _("--"), MEDIUMFONT, RED)); + add_subwindow(framerate_title = new BC_Title(x1, y1, "--", MEDIUMFONT, RED)); draw_framerate(0); y += window->get_h() + 2*margin; diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index faafc800..7f729f37 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -55,6 +55,11 @@ ProxyMenuItem::ProxyMenuItem(MWindow *mwindow) { this->mwindow = mwindow; set_alt(); + dialog = 0; +} +ProxyMenuItem::~ProxyMenuItem() +{ + delete dialog; } void ProxyMenuItem::create_objects() diff --git a/cinelerra-5.1/cinelerra/proxy.h b/cinelerra-5.1/cinelerra/proxy.h index 1404593f..c2ad5486 100644 --- a/cinelerra-5.1/cinelerra/proxy.h +++ b/cinelerra-5.1/cinelerra/proxy.h @@ -43,6 +43,7 @@ class ProxyMenuItem : public BC_MenuItem { public: ProxyMenuItem(MWindow *mwindow); + ~ProxyMenuItem(); int handle_event(); void create_objects(); diff --git a/cinelerra-5.1/cinelerra/statusbar.C b/cinelerra-5.1/cinelerra/statusbar.C index b7e97138..4e86de59 100644 --- a/cinelerra-5.1/cinelerra/statusbar.C +++ b/cinelerra-5.1/cinelerra/statusbar.C @@ -112,7 +112,7 @@ void StatusBar::show_message(const char *text, int color) void StatusBar::reset_default_message() { status_color = -1; - strcpy(default_msg, _("Welcome to cinelerra")); + strcpy(default_msg, _("Welcome to Cinelerra.")); } void StatusBar::update_default_message() { diff --git a/cinelerra-5.1/cinelerra/swindow.C b/cinelerra-5.1/cinelerra/swindow.C index fd173764..ea052eeb 100644 --- a/cinelerra-5.1/cinelerra/swindow.C +++ b/cinelerra-5.1/cinelerra/swindow.C @@ -114,7 +114,7 @@ int SWindowLoadFile::handle_event() } SWindowSaveFile::SWindowSaveFile(SWindowGUI *gui, int x, int y) - : BC_GenericButton(x, y, _("Save")) + : BC_GenericButton(x, y, C_("Save")) { this->sw_gui = gui; } diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile index 2fa43288..52090e20 100644 --- a/cinelerra-5.1/guicast/Makefile +++ b/cinelerra-5.1/guicast/Makefile @@ -118,7 +118,7 @@ install: $(LIBOBJS) $(OBJS) $(CUTOBJ): $(OBJDIR)/%.o: %.C - $(CXX) `cat $(OBJDIR)/c_flags` -c $< -o $@ + $(CXX) `cat $(OBJDIR)/c_flags` '-DMSGQUAL="$*"' -c $< -o $@ $(OBJDIR)/bootstrap: bootstrap.c $(OBJDIR)/pngtoh: pngtoh.c diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 0c3057d1..fb57b17d 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -3688,19 +3688,26 @@ int BC_ListBox::drag_start_event() { int cx, cy; get_abs_cursor_xy(cx, cy); - cx -= item_return->icon_vframe->get_w() / 2, - cy -= item_return->icon_vframe->get_h() / 2; - if( item_return->icon_vframe ) + if( item_return->icon_vframe ) { + cx -= item_return->icon_vframe->get_w() / 2, + cy -= item_return->icon_vframe->get_h() / 2; drag_popup = new BC_DragWindow(this, item_return->icon_vframe, cx, cy); + } else // this probably works not! - if( item_return->icon ) + if( item_return->icon ) { + cx -= item_return->icon->get_w() / 2, + cy -= item_return->icon->get_h() / 2; drag_popup = new BC_DragWindow(this, item_return->icon, cx, cy); - else + } + else { + cx -= drag_icon_vframe->get_w() / 2, + cy -= drag_icon_vframe->get_h() / 2; drag_popup = new BC_DragWindow(this, drag_icon_vframe, cx, cy); + } current_operation = DRAG_ITEM; // require shift down for scrolling if( allow_drag < 0 && shift_down() ) diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 12e6c34a..2794830f 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -177,6 +177,7 @@ BC_WindowBase::~BC_WindowBase() &BC_WindowBase::mediumfont, &BC_WindowBase::largefont, &BC_WindowBase::bigfont, + &BC_WindowBase::clockfont, }; for( int i=sizeof(xfont)/sizeof(xfont[0]); --i>=0; ) XFreeFont(display, this->*xfont[i]); @@ -193,6 +194,7 @@ BC_WindowBase::~BC_WindowBase() &BC_WindowBase::bold_smallfont_xft, &BC_WindowBase::bold_mediumfont_xft, &BC_WindowBase::bold_largefont_xft, + &BC_WindowBase::clockfont_xft, }; for( int i=sizeof(xft_font)/sizeof(xft_font[0]); --i>=0; ) { XftFont *xft = (XftFont *)(this->*xft_font[i]); diff --git a/cinelerra-5.1/guicast/language.h b/cinelerra-5.1/guicast/language.h index 83092869..c9e0d7ef 100644 --- a/cinelerra-5.1/guicast/language.h +++ b/cinelerra-5.1/guicast/language.h @@ -36,7 +36,9 @@ // D_: msgid decorated as: qual_id#msg_id explicitly // see po/xlat.sh for details +#ifndef MSGQUAL #define MSGQUAL 0 +#endif // qualifier from MSGQUAL #define C_(msgid) ((MSGQUAL)? msgqual(MSGQUAL,msgid) : gettext(msgid)) // qualifier from msgid diff --git a/cinelerra-5.1/plugin_config b/cinelerra-5.1/plugin_config index 5615a62e..c4d3516d 100644 --- a/cinelerra-5.1/plugin_config +++ b/cinelerra-5.1/plugin_config @@ -52,8 +52,8 @@ clean:: wc: cat *.C *.h | wc -$(OBJS): - $(CC) -c `cat $(OBJDIR)/c_flags` $(subst $(OBJDIR)/,, $*.C) -o $*.o +$(OBJDIR)/%.o: %.C + $(CXX) `cat $(OBJDIR)/c_flags` '-DMSGQUAL="$*"' -c $< -o $@ val-%: @echo $($(subst val-,,$@)) diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C index 3e13abec..e52da6db 100644 --- a/cinelerra-5.1/plugins/titler/titler.C +++ b/cinelerra-5.1/plugins/titler/titler.C @@ -25,7 +25,6 @@ // Additional support for UTF-8 by // Paolo Rampino aka Akirad - #include "asset.h" #include "bccmodels.h" #include "bcsignals.h" @@ -1145,7 +1144,7 @@ TitleMain::~TitleMain() delete outline_engine; } -const char* TitleMain::plugin_title() { return _("Title"); } +const char* TitleMain::plugin_title() { return C_("Title"); } int TitleMain::is_realtime() { return 1; } int TitleMain::is_synthesis() { return 1; } diff --git a/cinelerra-5.1/po/xlat.sh b/cinelerra-5.1/po/xlat.sh index 51c3e88c..3521ae9f 100755 --- a/cinelerra-5.1/po/xlat.sh +++ b/cinelerra-5.1/po/xlat.sh @@ -25,7 +25,8 @@ done | while read f ; do # code C_("xxx") [... code _("yyy")] #to: # code D_("qual_id#xxx") [... code D_("qual_id#yyy")] - sed -n "$f" > "$cin_dir/$f" -f - <<<'1,1{x; s/.*/_("/; x} + bn=${f##*/}; fn=${bn%.*} + sed -n "$f" > "$cin_dir/$f" -f - <<<'1,1{x; s/.*/D_("'$fn'#/; x}; t n1 :n1 s/^\(#define MSGQUAL[ ]\)/\1/; t n4 :n2 s/\