add size numeric format in bcfilebox
authorGood Guy <good1.2guy@gmail.com>
Thu, 8 Feb 2018 19:43:46 +0000 (12:43 -0700)
committerGood Guy <good1.2guy@gmail.com>
Thu, 8 Feb 2018 19:43:46 +0000 (12:43 -0700)
13 files changed:
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/guicast/bcfilebox.h
cinelerra-5.1/guicast/bcfilebox.inc
cinelerra-5.1/guicast/bcresources.C
cinelerra-5.1/guicast/bcresources.h
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/images/file_size_fmt_dn.png [new file with mode: 0644]
cinelerra-5.1/guicast/images/file_size_fmt_dn_png.h [new file with mode: 0644]
cinelerra-5.1/guicast/images/file_size_fmt_hi.png [new file with mode: 0644]
cinelerra-5.1/guicast/images/file_size_fmt_hi_png.h [new file with mode: 0644]
cinelerra-5.1/guicast/images/file_size_fmt_up.png [new file with mode: 0644]
cinelerra-5.1/guicast/images/file_size_fmt_up_png.h [new file with mode: 0644]
cinelerra-5.1/guicast/units.C

index 03a49e9a9161c3968e3919d7660ce597c567d0d5..e050bfe3b2150dd9f75b2233d736594ee53e308e 100644 (file)
@@ -172,8 +172,6 @@ int BC_FileBoxListBox::evaluate_query(char *string)
 }
 
 
-
-
 BC_FileBoxTextBox::BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox)
  : BC_TextBox(x, y, filebox->get_w() - 20, 1,
        filebox->want_directory ?  filebox->directory : filebox->filename)
@@ -185,9 +183,6 @@ BC_FileBoxTextBox::~BC_FileBoxTextBox()
 {
 }
 
-
-
-
 int BC_FileBoxTextBox::handle_event()
 {
        int result = 0;
@@ -199,8 +194,6 @@ int BC_FileBoxTextBox::handle_event()
 }
 
 
-
-
 BC_FileBoxDirectoryText::BC_FileBoxDirectoryText(int x, int y, BC_FileBox *filebox)
  : BC_TextBox(x, y, filebox->get_w() - 40, 1, filebox->fs->get_current_dir())
 {
@@ -229,9 +222,6 @@ int BC_FileBoxDirectoryText::handle_event()
 }
 
 
-
-
-
 BC_FileBoxFilterText::BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox)
  : BC_TextBox(x, y, filebox->get_w() - 50, 1, filebox->get_resources()->filebox_filter)
 {
@@ -245,20 +235,9 @@ int BC_FileBoxFilterText::handle_event()
 }
 
 
-
-
 BC_FileBoxFilterMenu::BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox)
- : BC_ListBox(x,
-       y,
-       filebox->get_w() - 30,
-       120,
-       LISTBOX_TEXT,
-       &filebox->filter_list,
-       0,
-       0,
-       1,
-       0,
-       1)
+ : BC_ListBox(x, y, filebox->get_w() - 30, 120,
+       LISTBOX_TEXT, &filebox->filter_list, 0, 0, 1, 0, 1)
 {
        this->filebox = filebox;
        set_tooltip(_("Change the filter"));
@@ -274,39 +253,26 @@ int BC_FileBoxFilterMenu::handle_event()
 }
 
 
-
-
-
-
-
-
-
-
-BC_FileBoxCancel::BC_FileBoxCancel(BC_FileBox *filebox)
- : BC_CancelButton(filebox)
+BC_FileBoxSizeFormat::BC_FileBoxSizeFormat(int x, int y, BC_FileBox *file_box)
+ : BC_Button(x, y, BC_WindowBase::get_resources()->filebox_szfmt_images)
 {
-       this->filebox = filebox;
-       set_tooltip(_("Cancel the operation"));
+       this->file_box = file_box;
+       set_tooltip(_("Size numeric format"));
 }
-
-BC_FileBoxCancel::~BC_FileBoxCancel()
+BC_FileBoxSizeFormat::~BC_FileBoxSizeFormat()
 {
 }
 
-int BC_FileBoxCancel::handle_event()
+int BC_FileBoxSizeFormat::handle_event()
 {
-//     filebox->submit_file(filebox->textbox->get_text());
-       filebox->newfolder_thread->interrupt();
-       filebox->set_done(1);
+       if( ++file_box->size_format > FILEBOX_SIZE_THOU )
+               file_box->size_format = FILEBOX_SIZE_RAW;
+       BC_WindowBase::get_resources()->filebox_size_format = file_box->size_format;
+       file_box->refresh(0);
        return 1;
 }
 
 
-
-
-
-
-
 BC_FileBoxUseThis::BC_FileBoxUseThis(BC_FileBox *filebox)
  : BC_Button(filebox->get_w() / 2 -
                BC_WindowBase::get_resources()->usethis_button_images[0]->get_w() / 2,
@@ -331,9 +297,6 @@ int BC_FileBoxUseThis::handle_event()
 }
 
 
-
-
-
 BC_FileBoxOK::BC_FileBoxOK(BC_FileBox *filebox)
  : BC_OKButton(filebox,
        !filebox->want_directory ?
@@ -359,6 +322,26 @@ int BC_FileBoxOK::handle_event()
        return 1;
 }
 
+BC_FileBoxCancel::BC_FileBoxCancel(BC_FileBox *filebox)
+ : BC_CancelButton(filebox)
+{
+       this->filebox = filebox;
+       set_tooltip(_("Cancel the operation"));
+}
+
+BC_FileBoxCancel::~BC_FileBoxCancel()
+{
+}
+
+int BC_FileBoxCancel::handle_event()
+{
+//     filebox->submit_file(filebox->textbox->get_text());
+       filebox->newfolder_thread->interrupt();
+       filebox->set_done(1);
+       return 1;
+}
+
+
 
 BC_FileBoxText::BC_FileBoxText(int x, int y, BC_FileBox *filebox)
  : BC_Button(x, y, BC_WindowBase::get_resources()->filebox_text_images)
@@ -455,13 +438,6 @@ int BC_FileBoxReload::handle_event()
 
 
 
-
-
-
-
-
-
-
 BC_FileBox::BC_FileBox(int x, int y, const char *init_path,
                const char *title, const char *caption, int show_all_files,
                int want_directory, int multiple_files, int h_padding)
@@ -489,6 +465,7 @@ BC_FileBox::BC_FileBox(int x, int y, const char *init_path,
        filter_text = 0;
        filter_popup = 0;
        usethis_button = 0;
+       size_format = BC_WindowBase::get_resources()->filebox_size_format;
 
        strcpy(this->caption, caption);
        strcpy(this->current_path, init_path);
@@ -619,6 +596,9 @@ void BC_FileBox::create_objects()
        x -= resources->filebox_updir_images[0]->get_w() + 5;
 
        add_subwindow(updir_button = new BC_FileBoxUpdir(x, y, this));
+       x -= resources->filebox_szfmt_images[0]->get_w() + 5;
+
+       add_subwindow(szfmt_button = new BC_FileBoxSizeFormat(x, y, this));
 
        x = 10;
        y += directory_title_margin + 3;
@@ -755,6 +735,7 @@ int BC_FileBox::resize_event(int w, int h)
        reload_button->reposition_window(reload_button->get_x()+dx, reload_button->get_y());
        delete_button->reposition_window(delete_button->get_x()+dx, delete_button->get_y());
        updir_button->reposition_window(updir_button->get_x()+dx, updir_button->get_y());
+       szfmt_button->reposition_window(szfmt_button->get_x()+dx, szfmt_button->get_y());
        set_w(w);  set_h(h);
        get_resources()->filebox_w = get_w();
        get_resources()->filebox_h = get_h();
@@ -829,26 +810,34 @@ int BC_FileBox::create_tables()
                        if(!is_dir)
                        {
                                int64_t size = file_item->size;
-#if 1
-                               int len = 1;
-                               static const char *suffix[] = { "", "K", "M", "G", "T", "P" };
-                               for( int64_t s=size; len<15 && (s/=10)>0; ++len );
-                               int drop = len-3;
-                               if( drop > 0 ) {
+                               if( (size_format == FILEBOX_SIZE_1000 && size >= 1000) ||
+                                   (size_format == FILEBOX_SIZE_1024 && size >= 1024) ) {
+                                       static const char *suffix[] = { "", "K", "M", "G", "T", "P" };
+                                       if( size_format == FILEBOX_SIZE_1024 ) {
+                                               static const long double kk = logl(1000.)/logl(1024.);
+                                               size = expl(kk*logl((long double)size)) + 0.5;
+                                       }
+                                       int len = 1;
+                                       for( int64_t s=size; len<16 && (s/=10)>0; ++len );
+                                       int drop = len-3;
                                        size /= ipow(10,drop);
                                        int sfx = (len-1)/3;
                                        int digits = (sfx+1)*3 - len;
                                        int64_t frac = ipow(10,digits);
-                                       int mantisa = size / frac;
-                                       int fraction = size - mantisa*frac;
+                                       int mant  = size / frac;
+                                       int fraction = size - mant*frac;
                                        if( fraction )
-                                               sprintf(string, "%d.%0*d%s", mantisa, digits, fraction, suffix[sfx]);
+                                               sprintf(string, "%d.%0*d%s",
+                                                       mant, digits, fraction, suffix[sfx]);
                                        else
-                                               sprintf(string, "%d%s", mantisa, suffix[sfx]);
+                                               sprintf(string, "%d%s",
+                                                       mant, suffix[sfx]);
                                }
-                               else
-#endif
+                               else {
                                        sprintf(string, "%jd", size);
+                                       if( size_format == FILEBOX_SIZE_THOU )
+                                               Units::punctuate(string);
+                               }
                                new_item = new BC_ListBoxItem(string, get_resources()->file_color);
                        }
                        else
index 682fa9c30137cdea71a4497283e2d31266361d47..4192077fdabf2b28be0e295e53ea101943605b7d 100644 (file)
@@ -78,22 +78,22 @@ public:
        BC_FileBox *filebox;
 };
 
-class BC_FileBoxOK : public BC_OKButton
+class BC_FileBoxUseThis : public BC_Button
 {
 public:
-       BC_FileBoxOK(BC_FileBox *filebox);
-       ~BC_FileBoxOK();
-
+       BC_FileBoxUseThis(BC_FileBox *filebox);
+       ~BC_FileBoxUseThis();
        int handle_event();
 
        BC_FileBox *filebox;
 };
 
-class BC_FileBoxUseThis : public BC_Button
+class BC_FileBoxOK : public BC_OKButton
 {
 public:
-       BC_FileBoxUseThis(BC_FileBox *filebox);
-       ~BC_FileBoxUseThis();
+       BC_FileBoxOK(BC_FileBox *filebox);
+       ~BC_FileBoxOK();
+
        int handle_event();
 
        BC_FileBox *filebox;
@@ -191,6 +191,15 @@ public:
        BC_FileBox *filebox;
 };
 
+class BC_FileBoxSizeFormat : public BC_Button
+{
+public:
+       BC_FileBoxSizeFormat(int x, int y, BC_FileBox *file_box);
+       ~BC_FileBoxSizeFormat();
+
+       int handle_event();
+       BC_FileBox *file_box;
+};
 
 
 class BC_FileBoxRecent : public BC_ListBox
@@ -239,6 +248,7 @@ public:
        friend class BC_FileBoxDelete;
        friend class BC_FileBoxReload;
        friend class BC_FileBoxRecent;
+       friend class BC_FileBoxSizeFormat;
 
        virtual void create_objects();
        virtual int keypress_event();
@@ -307,6 +317,7 @@ private:
        BC_Button *updir_button;
        BC_Button *delete_button;
        BC_Button *reload_button;
+       BC_FileBoxSizeFormat *szfmt_button;
        BC_Button *ok_button, *cancel_button;
        BC_FileBoxUseThis *usethis_button;
        char caption[BCTEXTLEN];
@@ -320,6 +331,7 @@ private:
 
        int sort_column;
        int sort_order;
+       int size_format;
 
        const char *column_titles[FILEBOX_COLUMNS];
        ArrayList<BC_ListBoxItem*> filter_list;
index 92e974c0092e5e44cf036d18f2e2345ad606af34..433acc92d75e3773cb2e75a30c0b49166695ef59 100644 (file)
@@ -39,6 +39,11 @@ class BC_FileBox;
 #define FILEBOX_DATE 2
 #define FILEBOX_EXTENSION 3
 
+#define FILEBOX_SIZE_RAW  0
+#define FILEBOX_SIZE_1000 1
+#define FILEBOX_SIZE_1024 2
+#define FILEBOX_SIZE_THOU 3
+
 #define FILEBOX_NAME_TEXT _("File")
 #define FILEBOX_SIZE_TEXT _("Size")
 #define FILEBOX_DATE_TEXT _("Date")
index 38053d0943d67970ebaf45fdbdd760788cbfad65..bad4b6db393a84992838d28b7349998f85ab6f6e 100644 (file)
@@ -347,6 +347,7 @@ VFrame *BC_Resources::default_filebox_newfolder_images[3] = { 0, };
 VFrame *BC_Resources::default_filebox_rename_images[3] = { 0, };
 VFrame *BC_Resources::default_filebox_delete_images[3] = { 0, };
 VFrame *BC_Resources::default_filebox_reload_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_szfmt_images[3] = { 0, };
 VFrame *BC_Resources::default_listbox_button[4] = { 0, };
 VFrame *BC_Resources::default_listbox_bg = 0;
 VFrame *BC_Resources::default_listbox_expand[5] = { 0, };
@@ -508,6 +509,10 @@ new_vframes(3,default_menubar_data,
 #include "images/file_reload_up_png.h"
 #include "images/file_reload_hi_png.h"
 #include "images/file_reload_dn_png.h"
+#include "images/file_size_fmt_up_png.h"
+#include "images/file_size_fmt_hi_png.h"
+#include "images/file_size_fmt_dn_png.h"
+
 new_vframes(3,default_filebox_text_images,
        new VFramePng(file_text_up_png),
        new VFramePng(file_text_hi_png),
@@ -543,6 +548,11 @@ new_vframes(3,default_filebox_reload_images,
        new VFramePng(file_reload_hi_png),
        new VFramePng(file_reload_dn_png));
 
+new_vframes(3,default_filebox_szfmt_images,
+       new VFramePng(file_size_fmt_up_png),
+       new VFramePng(file_size_fmt_hi_png),
+       new VFramePng(file_size_fmt_dn_png));
+
 #include "images/listbox_button_dn_png.h"
 #include "images/listbox_button_hi_png.h"
 #include "images/listbox_button_up_png.h"
@@ -783,6 +793,8 @@ new_vframes(20,default_medium_7segment,
        filebox_rename_images = default_filebox_rename_images;
        filebox_delete_images = default_filebox_delete_images;
        filebox_reload_images = default_filebox_reload_images;
+       filebox_szfmt_images = default_filebox_szfmt_images;
+       filebox_size_format = FILEBOX_SIZE_RAW;
        directory_color = BLUE;
        file_color = BLACK;
 
@@ -859,6 +871,7 @@ BC_Resources::~BC_Resources()
        del_vframes(default_filebox_rename_images, 3);
        del_vframes(default_filebox_delete_images, 3);
        del_vframes(default_filebox_reload_images, 3);
+       del_vframes(default_filebox_szfmt_images, 3);
        del_vframes(default_listbox_button, 4);
        delete default_listbox_bg;
        del_vframes(default_listbox_expand, 5);
index 1c73f71377c8d342b69ea02a7f464712ee19fb68..dae013078a90108b043cce15e78683c016b4617a 100644 (file)
@@ -195,6 +195,7 @@ public:
        VFrame **filebox_descend_images;
        VFrame **filebox_delete_images;
        VFrame **filebox_reload_images;
+       VFrame **filebox_szfmt_images;
 
 // Generic button images
        VFrame **generic_button_images;
@@ -388,6 +389,7 @@ public:
        static VFrame *default_filebox_rename_images[3];
        static VFrame *default_filebox_delete_images[3];
        static VFrame *default_filebox_reload_images[3];
+       static VFrame *default_filebox_szfmt_images[3];
        static VFrame *default_listbox_button[4];
        static VFrame *default_listbox_bg;
        static VFrame *default_listbox_expand[5];
@@ -414,7 +416,8 @@ public:
        int use_xvideo;
 // Seems to help if only 1 window is created at a time.
        Mutex *create_window_lock;
-
+// size raw, 1000, 1024, thou
+       int filebox_size_format;
 private:
 // Test for availability of shared memory pixmaps
        void init_shm(BC_WindowBase *window);
index 58055f78f98bbabffddfe7161c7db317f1bff7ee..b429da4ca13f1d5b28d7c6a877b03dd5b9159c58 100644 (file)
@@ -4256,6 +4256,7 @@ int BC_WindowBase::load_defaults(BC_Hash *defaults)
        resources->filebox_columnwidth[1] = defaults->get("FILEBOX_WIDTH1", resources->filebox_columnwidth[1]);
        resources->filebox_columnwidth[2] = defaults->get("FILEBOX_WIDTH2", resources->filebox_columnwidth[2]);
        resources->filebox_columnwidth[3] = defaults->get("FILEBOX_WIDTH3", resources->filebox_columnwidth[3]);
+       resources->filebox_size_format = defaults->get("FILEBOX_SIZE_FORMAT", get_resources()->filebox_size_format);
        defaults->get("FILEBOX_FILTER", resources->filebox_filter);
        return 0;
 }
@@ -4283,6 +4284,7 @@ int BC_WindowBase::save_defaults(BC_Hash *defaults)
        defaults->update("FILEBOX_WIDTH2", resources->filebox_columnwidth[2]);
        defaults->update("FILEBOX_WIDTH3", resources->filebox_columnwidth[3]);
        defaults->update("FILEBOX_FILTER", resources->filebox_filter);
+       defaults->update("FILEBOX_SIZE_FORMAT", get_resources()->filebox_size_format);
        return 0;
 }
 
diff --git a/cinelerra-5.1/guicast/images/file_size_fmt_dn.png b/cinelerra-5.1/guicast/images/file_size_fmt_dn.png
new file mode 100644 (file)
index 0000000..18a7f4c
Binary files /dev/null and b/cinelerra-5.1/guicast/images/file_size_fmt_dn.png differ
diff --git a/cinelerra-5.1/guicast/images/file_size_fmt_dn_png.h b/cinelerra-5.1/guicast/images/file_size_fmt_dn_png.h
new file mode 100644 (file)
index 0000000..a5281ce
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef FILE_SIZE_FMT_DN_PNG_H
+#define FILE_SIZE_FMT_DN_PNG_H
+
+static unsigned char file_size_fmt_dn_png[] = 
+{
+       0x00, 0x00, 0x01, 0x4e, 
+       0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 
+       0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x19, 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xe9, 0x85, 
+       0x63, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 
+       0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 
+       0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 
+       0x07, 0xe2, 0x02, 0x08, 0x0f, 0x32, 0x3b, 0x7f, 0x0b, 0x91, 0xce, 0x00, 0x00, 0x00, 0x21, 0x69, 
+       0x54, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 
+       0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 
+       0x47, 0x49, 0x4d, 0x50, 0x6d, 0xb0, 0x97, 0x00, 0x00, 0x00, 0x00, 0xae, 0x49, 0x44, 0x41, 0x54, 
+       0x48, 0xc7, 0xcd, 0x96, 0xc1, 0x0e, 0x03, 0x21, 0x08, 0x44, 0x07, 0xc3, 0x77, 0x73, 0xe0, 0xc7, 
+       0xa7, 0x87, 0xa6, 0x89, 0xda, 0x56, 0x31, 0xe8, 0xee, 0x72, 0x36, 0x3c, 0x9d, 0x19, 0x82, 0x42, 
+       0x92, 0xa8, 0x4a, 0x44, 0x90, 0xad, 0xae, 0x25, 0xb4, 0x07, 0xb8, 0x7b, 0x1a, 0x22, 0x22, 0x0d, 
+       0xa8, 0xec, 0x06, 0x00, 0x80, 0xbb, 0x37, 0x8a, 0xe8, 0x3f, 0x80, 0x99, 0x85, 0x9a, 0xcd, 0x40, 
+       0x24, 0x21, 0x00, 0xf8, 0xeb, 0x70, 0x04, 0x12, 0x81, 0x99, 0x59, 0xeb, 0xc9, 0x4a, 0x93, 0xfa, 
+       0x12, 0x66, 0x36, 0x04, 0x95, 0x8c, 0xee, 0xd1, 0x2a, 0x59, 0x83, 0x8f, 0x43, 0x2e, 0x79, 0x49, 
+       0x34, 0x1c, 0x65, 0x07, 0x60, 0x26, 0x9b, 0x66, 0x6f, 0x1c, 0xf1, 0x25, 0xed, 0x49, 0x44, 0x32, 
+       0xcd, 0xa4, 0xe8, 0x03, 0x38, 0x36, 0x27, 0xb7, 0x44, 0x78, 0x24, 0xdb, 0xf3, 0xe7, 0xe4, 0xf2, 
+       0x61, 0x1c, 0xf9, 0xa3, 0x3b, 0x62, 0x3a, 0x0b, 0x40, 0x5a, 0xae, 0x48, 0xc2, 0x84, 0x24, 0x77, 
+       0xae, 0xde, 0x5e, 0x01, 0x92, 0xef, 0x97, 0x90, 0x5c, 0xda, 0x84, 0x2b, 0x80, 0x46, 0xae, 0x9d, 
+       0xa0, 0x1a, 0xf0, 0x65, 0x3c, 0xc9, 0x23, 0xff, 0xae, 0x17, 0x77, 0x17, 0x63, 0x3e, 0xb4, 0x01, 
+       0x4c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
+#endif
diff --git a/cinelerra-5.1/guicast/images/file_size_fmt_hi.png b/cinelerra-5.1/guicast/images/file_size_fmt_hi.png
new file mode 100644 (file)
index 0000000..fa57d86
Binary files /dev/null and b/cinelerra-5.1/guicast/images/file_size_fmt_hi.png differ
diff --git a/cinelerra-5.1/guicast/images/file_size_fmt_hi_png.h b/cinelerra-5.1/guicast/images/file_size_fmt_hi_png.h
new file mode 100644 (file)
index 0000000..b9b85c3
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef FILE_SIZE_FMT_HI_PNG_H
+#define FILE_SIZE_FMT_HI_PNG_H
+
+static unsigned char file_size_fmt_hi_png[] = 
+{
+       0x00, 0x00, 0x01, 0x3b, 
+       0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 
+       0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x19, 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xe9, 0x85, 
+       0x63, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 
+       0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 
+       0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 
+       0x07, 0xe2, 0x02, 0x08, 0x0f, 0x2e, 0x26, 0xfa, 0x7a, 0xa0, 0x4a, 0x00, 0x00, 0x00, 0x21, 0x69, 
+       0x54, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 
+       0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 
+       0x47, 0x49, 0x4d, 0x50, 0x6d, 0xb0, 0x97, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x49, 0x44, 0x41, 0x54, 
+       0x48, 0xc7, 0xd5, 0x56, 0x41, 0x0a, 0xc0, 0x30, 0x08, 0xab, 0xc1, 0xff, 0x7f, 0xd9, 0x1d, 0x46, 
+       0x41, 0xa4, 0xba, 0xad, 0x4b, 0x3b, 0xe6, 0xad, 0x50, 0x8c, 0xc6, 0x04, 0x15, 0x33, 0xb3, 0xe6, 
+       0x42, 0x44, 0xda, 0xdb, 0x08, 0x29, 0x9b, 0x46, 0x80, 0xf8, 0x61, 0x26, 0x62, 0x1e, 0xb0, 0x01, 
+       0x7a, 0x27, 0x9e, 0x11, 0xb0, 0x01, 0x46, 0x40, 0x72, 0xbe, 0x2d, 0x6d, 0xfb, 0x29, 0xff, 0xa3, 
+       0x1c, 0x60, 0xf0, 0x7f, 0x55, 0x8c, 0xce, 0x2a, 0x26, 0x76, 0x5a, 0x51, 0x0e, 0xa6, 0x54, 0xb3, 
+       0x00, 0xdb, 0x13, 0x4b, 0x40, 0xb6, 0x74, 0x72, 0x47, 0x81, 0x60, 0x01, 0x54, 0xb4, 0x29, 0xa3, 
+       0xe2, 0xab, 0xb9, 0x50, 0x66, 0xb2, 0xd4, 0x27, 0x1e, 0x60, 0x99, 0x4f, 0x3e, 0x91, 0x70, 0x46, 
+       0xdb, 0x3f, 0x7c, 0xb2, 0xdd, 0x8c, 0xd9, 0x7c, 0x94, 0x25, 0xd3, 0x4a, 0x00, 0x88, 0xab, 0x92, 
+       0xa9, 0xb0, 0x2e, 0x6b, 0xe9, 0x6b, 0x91, 0xbd, 0x82, 0x7d, 0x3e, 0x64, 0xcb, 0x9f, 0x79, 0xad, 
+       0x68, 0x75, 0x65, 0xb0, 0xe8, 0x3b, 0x00, 0x46, 0x97, 0x60, 0x33, 0x27, 0x00, 0x36, 0xeb, 0x00, 
+       0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
+#endif
diff --git a/cinelerra-5.1/guicast/images/file_size_fmt_up.png b/cinelerra-5.1/guicast/images/file_size_fmt_up.png
new file mode 100644 (file)
index 0000000..3871acd
Binary files /dev/null and b/cinelerra-5.1/guicast/images/file_size_fmt_up.png differ
diff --git a/cinelerra-5.1/guicast/images/file_size_fmt_up_png.h b/cinelerra-5.1/guicast/images/file_size_fmt_up_png.h
new file mode 100644 (file)
index 0000000..5bd5c29
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef FILE_SIZE_FMT_UP_PNG_H
+#define FILE_SIZE_FMT_UP_PNG_H
+
+static unsigned char file_size_fmt_up_png[] = 
+{
+       0x00, 0x00, 0x01, 0x41, 
+       0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 
+       0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x19, 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xe9, 0x85, 
+       0x63, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 
+       0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 
+       0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 
+       0x07, 0xe2, 0x02, 0x08, 0x0f, 0x2f, 0x2d, 0x74, 0xb3, 0x48, 0x83, 0x00, 0x00, 0x00, 0x21, 0x69, 
+       0x54, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 
+       0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 
+       0x47, 0x49, 0x4d, 0x50, 0x6d, 0xb0, 0x97, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x49, 0x44, 0x41, 0x54, 
+       0x48, 0xc7, 0xcd, 0x56, 0x41, 0x0e, 0xc0, 0x20, 0x08, 0x13, 0xc2, 0xff, 0xbf, 0xdc, 0x1d, 0x16, 
+       0x13, 0x47, 0x1c, 0x12, 0xad, 0x6e, 0xbd, 0x99, 0x18, 0x0a, 0xa5, 0x88, 0x02, 0x00, 0xa5, 0x81, 
+       0x88, 0x94, 0x55, 0xb8, 0x90, 0xc5, 0x3c, 0x81, 0xbf, 0x30, 0x03, 0x1f, 0x47, 0xd9, 0x04, 0xb5, 
+       0x92, 0x56, 0x11, 0x7b, 0x23, 0xc8, 0xc8, 0x16, 0x25, 0x55, 0x89, 0x00, 0x14, 0xb9, 0xcf, 0xe8, 
+       0x96, 0x3c, 0xdb, 0x03, 0x1f, 0xc7, 0x66, 0x83, 0xb4, 0x49, 0x8c, 0xa4, 0x56, 0x96, 0x83, 0x22, 
+       0x28, 0xd3, 0xaa, 0x5b, 0x48, 0x8e, 0x54, 0x92, 0x35, 0x87, 0x32, 0x08, 0x46, 0xb2, 0xd9, 0x6a, 
+       0xc6, 0x99, 0xbe, 0x28, 0xe3, 0x09, 0x19, 0xc1, 0x56, 0x5c, 0x54, 0x09, 0xb6, 0xcd, 0xc9, 0x27, 
+       0x16, 0x8e, 0x64, 0xfb, 0xff, 0x9c, 0x1c, 0x1f, 0xc6, 0xa8, 0x3f, 0xc6, 0xb0, 0xe9, 0xc8, 0x00, 
+       0xcb, 0x72, 0x65, 0x1c, 0x26, 0x00, 0xc0, 0x5c, 0xbd, 0xbd, 0x5d, 0xaf, 0xbd, 0x9d, 0xcc, 0x24, 
+       0x78, 0xc8, 0xc5, 0x24, 0xf2, 0xca, 0x58, 0xf4, 0xcb, 0x60, 0xf5, 0xe9, 0x02, 0x95, 0xa5, 0x66, 
+       0x2c, 0xf8, 0x7c, 0xed, 0xab, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 
+       0x82
+};
+
+#endif
index 8e24d3efaed6c8b6bbe9325e9b9f1d80d364f916..9c2f1d27106b7f4be2cee7ec37f70c5bd91edf04 100644 (file)
@@ -620,14 +620,13 @@ const char* Units::format_to_separators(int time_format)
 
 void Units::punctuate(char *string)
 {
-       int len = strlen(string);
-       int commas = (len - 1) / 3;
-       for(int i = len + commas, j = len, k; j >= 0 && i >= 0; i--, j--) {
-               k = (len - j - 1) / 3;
-               if(k * 3 == len - j - 1 && j != len - 1 && string[j] != 0) {
-                       string[i--] = ',';
-               }
-               string[i] = string[j];
+       int sep = ',', len = strlen(string), commas = (len - 1) / 3;
+       char *cp = string + len, *bp = cp + commas;
+       *bp = 0;
+       for( int k=3; cp < bp && bp > string; ) {
+               *--bp = *--cp;
+               if( --k > 0 ) continue;
+               *--bp = sep;  k = 3;
        }
 }