fix listbox select for packed icon, tweak show edit
authorGood Guy <good1.2guy@gmail.com>
Sat, 28 Jul 2018 17:20:52 +0000 (11:20 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sat, 28 Jul 2018 17:20:52 +0000 (11:20 -0600)
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/edit.h
cinelerra-5.1/cinelerra/editpopup.C
cinelerra-5.1/cinelerra/resourcepixmap.C
cinelerra-5.1/guicast/bclistbox.C

index 853baf7ef673366e9eebda7167f9d784353018f9..198a0fdfc0f62e435cb7cf2347f1132858c1f82e 100644 (file)
@@ -823,3 +823,23 @@ int Edit::select_handle(float view_start, float zoom_units, int cursor_x, int cu
        return 0;
 }
 
+void Edit::get_title(char *title)
+{
+       if( user_title[0] ) {
+               strcpy(title, user_title);
+               return;
+       }
+       Indexable *idxbl = asset ? (Indexable*)asset : (Indexable*)nested_edl;
+       if( !idxbl ) {
+               title[0] = 0;
+               return;
+       }
+       FileSystem fs;
+       fs.extract_name(title, idxbl->path);
+       if( asset || track->data_type == TRACK_AUDIO ) {
+               char number[BCSTRLEN];
+               sprintf(number, " #%d", channel + 1);
+               strcat(title, number);
+       }
+}
+
index e4bbcc5d2a8069d15540e4b248aae37c61b57444..d3598adb96af4d98271e257fb92f2d872bf0af34 100644 (file)
@@ -152,28 +152,9 @@ public:
 // Parent EDL of this edit
        EDL *edl;
 
-
-// ============================= initialization
-
        int load_properties(FileXML *xml, int64_t &startproject);
        virtual int load_properties_derived(FileXML *xml) { return 0; };
 
-// ============================= drawing
-
-       virtual int draw(int flash, int center_pixel,
-               int x, int w, int y, int h, int set_index_file) { return 0; }
-       virtual int set_index_file(int flash, int center_pixel,
-               int x, int y, int w, int h) { return 0; }
-       int draw_transition(int flash, int center_pixel,
-               int x, int w, int y, int h, int set_index_file);
-
-       int draw_handles(BC_SubWindow *canvas, float view_start, float view_units,
-               float zoom_units, int view_pixels, int center_pixel);
-       int draw_titles(BC_SubWindow *canvas, float view_start, float zoom_units,
-               int view_pixels, int center_pixel);
-
-// ============================= editing
-
        virtual int copy_properties_derived(FileXML *xml,
                int64_t length_in_selection) { return 0; }
 
@@ -186,6 +167,8 @@ public:
                int64_t &left_sample, int64_t &right_sample, float view_start,
                float zoom_units) { return 0; }
        virtual int64_t get_source_end(int64_t default_);
+       void get_title(char *title);
+
        int dump(FILE *fp=stdout);
        virtual int dump_derived() { return 0; }
 };
index 1851e058da35b8ed1e281bd3a42ea2b93c6967ec..f20f9b95850b317614290869e0740841e52461c0 100644 (file)
@@ -24,6 +24,7 @@
 #include "awindow.h"
 #include "awindowgui.h"
 #include "edit.h"
+#include "edits.h"
 #include "editpopup.h"
 #include "edl.h"
 #include "edlsession.h"
@@ -430,7 +431,7 @@ void EditShowDialogThread::handle_close_event(int result)
 EditPopupShowWindow::EditPopupShowWindow(MWindow *mwindow,
                EditPopup *popup, int wx, int wy)
  : BC_Window(_(PROGRAM_NAME ": Show edit"), wx, wy,
-       300, 200, 300, 200, 0, 0, 1)
+       300, 220, 300, 220, 0, 0, 1)
 {
        this->mwindow = mwindow;
        this->popup = popup;
@@ -444,22 +445,38 @@ void EditPopupShowWindow::create_objects()
 {
        lock_window("EditPopupShowWindow::create_objects");
        int x = 10, y = 10;
-       add_subwindow(new BC_Title(x, y, _("Show edit:")));
+       BC_Title *title;
+       char text[BCTEXTLEN];
+       Track *track = popup->track;
+       Edit *edit = popup->edit;
+       sprintf(text, _("Track %d:"), mwindow->edl->tracks->number_of(track)+1);
+       add_subwindow(title = new BC_Title(x, y, text));
+       int x1 = x + title->get_w() + 10;
+       int tw = get_w() - x1 - 20;
+       truncate_text(text, track->title, tw);
+       add_subwindow(new BC_Title(x1, y, text));
+       y += title->get_h() + 5;
+       sprintf(text, _("Edit %d:"), track->edits->number_of(edit)+1);
+       add_subwindow(title = new BC_Title(x, y, text));
+       char edit_title[BCTEXTLEN];
+       edit->get_title(edit_title);
+       truncate_text(text, edit_title, tw);
+       add_subwindow(new BC_Title(x1, y, text));
+       y += title->get_h() + 5;
 
        EDLSession *session = mwindow->edl->session;
        int time_format = session->time_format;
-        int sample_rate = session->sample_rate;
+       int sample_rate = session->sample_rate;
        double frame_rate = session->frame_rate;
        double frames_per_foot = session->frames_per_foot;
 
-       Track *track = popup->track;
-       Edit *edit = popup->edit;
-        double startsource = track->from_units(edit->startsource);
+       double startsource = track->from_units(edit->startsource);
        double startproject = track->from_units(edit->startproject);
        double length = track->from_units(edit->length);
 
-       char text[BCTEXTLEN], text_length[BCSTRLEN];
-       char text_startsource[BCSTRLEN], text_startproject[BCSTRLEN];
+       char text_startsource[BCSTRLEN];
+       char text_startproject[BCSTRLEN];
+       char text_length[BCSTRLEN];
        sprintf(text, _("StartSource: %s\nStartProject: %s\nLength: %s\n"),
                Units::totext(text_startsource, startsource,
                        time_format, sample_rate, frame_rate, frames_per_foot),
@@ -467,7 +484,7 @@ void EditPopupShowWindow::create_objects()
                        time_format, sample_rate, frame_rate, frames_per_foot),
                Units::totext(text_length, length,
                        time_format, sample_rate, frame_rate, frames_per_foot));
-       show_text = new EditPopupShowText(this, mwindow, x+15, y+20, text);
+       show_text = new EditPopupShowText(this, mwindow, x+15, y+10, text);
        add_subwindow(show_text);
        add_tool(new BC_OKButton(this));
 
index 319c6b4023dc7def7fb075bd847a4f898ea95f26..6f74c85dcf3a4de2a052acd1a1139a9424b707d4 100644 (file)
@@ -434,29 +434,7 @@ void ResourcePixmap::draw_title(TrackCanvas *canvas,
 
 //     if( total_x > -BC_INFINITY ) {
                char title[BCTEXTLEN];
-               char channel[BCTEXTLEN];
-               title[0] = 0;
-               channel[0] = 0;
-               FileSystem fs;
-
-               if( edit->user_title[0] )
-                       strcpy(title, edit->user_title);
-               else if( edit->nested_edl ) {
-//printf("ResourcePixmap::draw_title %s\n", edit->nested_edl->project_path);
-                       fs.extract_name(title, edit->nested_edl->path);
-
-// EDLs only have 1 video output
-                       if( edit->track->data_type == TRACK_AUDIO ) {
-                               sprintf(channel, " #%d", edit->channel + 1);
-                               strcat(title, channel);
-                       }
-               }
-               else if( edit->asset ) {
-                       fs.extract_name(title, edit->asset->path);
-                       sprintf(channel, " #%d", edit->channel + 1);
-                       strcat(title, channel);
-               }
-
+               edit->get_title(title);
                canvas->set_color(mwindow->theme->title_color);
                canvas->set_font(mwindow->theme->title_font);
 
index a6946530ffb1638f2cfe0690589d7653dcd44462..b10cdf0860c7a22aceb2ee9f5844fff3a4524383 100644 (file)
@@ -2076,6 +2076,7 @@ int BC_ListBox::get_cursor_item(ArrayList<BC_ListBoxItem*> *data, int cursor_x,
 // Icons are not treed
        switch( display_format ) {
        case LISTBOX_ICONS:
+       case LISTBOX_ICONS_PACKED:
        case LISTBOX_ICON_LIST: {
                for( int j=data[master_column].total; --j>=0; ) {
                        int icon_x, icon_y, icon_w, icon_h;