fix awdw solo vicon crash, fix nested clip for binfolders, open edit edl
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcresources.C
index 43a713e7a47ac80d49929fdebdca4bb09e83f8db..54cef106d9f37d873b565861bdd30c477e9c6504 100644 (file)
@@ -362,12 +362,20 @@ VFrame *BC_Resources::default_vscroll_data[10] = { 0, };
 VFrame *BC_Resources::default_hscroll_data[10] = { 0, };
 VFrame *BC_Resources::default_icon_img = 0;
 
-BC_Resources::BC_Resources()
+BC_Resources::BC_Resources(float x_scale, float y_scale)
 {
+       BC_WindowBase::resources = this;
        synchronous = 0;
        vframe_shm = 0;
-       double default_scale = 1.0; // display_size/1000.;
-       char *env = getenv("BC_FONT_DEBUG");
+       use_shm = -1;
+       shm_reply = 1;
+
+       if( x_scale <= 0 ) x_scale = 1;
+       if( y_scale <= 0 ) y_scale = x_scale;
+       this->x_scale = x_scale;
+       this->y_scale = y_scale;
+       float default_scale = bmin(x_scale, y_scale);
+       const char *env = getenv("BC_FONT_DEBUG");
        font_debug = env ? atoi(env) : 0;
        env = getenv("BC_FONT_SCALE");
        font_scale = env ? atof(env) : default_scale;
@@ -732,7 +740,7 @@ new_vframes(10,default_vscroll_data,
        listbox_title_overlap = 0;
        listbox_title_margin = 0;
        listbox_title_color = BLACK;
-       listbox_title_hotspot = 5;
+       listbox_title_hotspot = xS(5);
 
        listbox_border1 = DKGREY;
        listbox_border2_hi = RED;
@@ -748,12 +756,9 @@ new_vframes(10,default_vscroll_data,
        pan_data = 0;
        pan_text_color = YELLOW;
 
-       generic_button_margin = 15;
+       generic_button_margin = xS(15);
        draw_clock_background=1;
 
-       use_shm = -1;
-       shm_reply = 1;
-
 // Initialize
        bg_color = ORANGE;
        bg_shadow1 = DKGREY;
@@ -780,6 +785,7 @@ new_vframes(10,default_vscroll_data,
        button_uphighlighted = RED;   // upper side when highlighted
 
        tumble_data = 0;
+       tumblepatch_data = 0;
        tumble_duration = 150;
 
        ok_images = default_ok_images;
@@ -800,9 +806,9 @@ new_vframes(10,default_vscroll_data,
        popupmenu_images = 0;
 
 
-       popupmenu_margin = 10;
+       popupmenu_margin = xS(10);
        popupmenu_btnup = 1;
-       popupmenu_triangle_margin = 10;
+       popupmenu_triangle_margin = xS(10);
 
        min_menu_w = 0;
        menu_title_text = BLACK;
@@ -841,24 +847,24 @@ new_vframes(10,default_vscroll_data,
        tooltips_enabled = 1;
        textbox_focus_policy = 0;
 
-       filebox_margin = 110;
-       dirbox_margin = 90;
+       filebox_margin = yS(110);
+       dirbox_margin = yS(90);
        filebox_mode = LISTBOX_TEXT;
        sprintf(filebox_filter, "*");
-       filebox_w = 640;
-       filebox_h = 480;
+       filebox_w = xS(640);
+       filebox_h = yS(480);
        filebox_columntype[0] = FILEBOX_NAME;
        filebox_columntype[1] = FILEBOX_SIZE;
        filebox_columntype[2] = FILEBOX_DATE;
        filebox_columntype[3] = FILEBOX_EXTENSION;
-       filebox_columnwidth[0] = 200;
-       filebox_columnwidth[1] = 100;
-       filebox_columnwidth[2] = 100;
-       filebox_columnwidth[3] = 100;
+       filebox_columnwidth[0] = xS(200);
+       filebox_columnwidth[1] = xS(100);
+       filebox_columnwidth[2] = xS(100);
+       filebox_columnwidth[3] = xS(100);
        dirbox_columntype[0] = FILEBOX_NAME;
        dirbox_columntype[1] = FILEBOX_DATE;
-       dirbox_columnwidth[0] = 200;
-       dirbox_columnwidth[1] = 100;
+       dirbox_columnwidth[0] = xS(200);
+       dirbox_columnwidth[1] = xS(100);
 
        filebox_text_images = default_filebox_text_images;
        filebox_icons_images = default_filebox_icons_images;
@@ -880,8 +886,8 @@ new_vframes(10,default_vscroll_data,
 
        pot_images = default_pot_images;
        pot_offset = 2;
-       pot_x1 = pot_images[0]->get_w() / 2 - pot_offset;
-       pot_y1 = pot_images[0]->get_h() / 2 - pot_offset;
+       pot_x1 = pot_images[0]->get_w() / 2 - xS(pot_offset);
+       pot_y1 = pot_images[0]->get_h() / 2 - yS(pot_offset);
        pot_r = pot_x1;
        pot_needle_color = BLACK;
 
@@ -891,7 +897,7 @@ new_vframes(10,default_vscroll_data,
        ymeter_images = 0;
        meter_font = SMALLFONT_3D;
        meter_font_color = RED;
-       meter_title_w = 20;
+       meter_title_w = xS(20);
        meter_3d = 1;
        medium_7segment = default_medium_7segment;
 
@@ -907,11 +913,8 @@ new_vframes(10,default_vscroll_data,
        use_xft = 0;
 #endif
 
-
-       drag_radius = 10;
+       drag_radius = xS(10);
        recursive_resizing = 1;
-
-
 }
 
 void BC_Resources::del_vframes(VFrame *vframes[], int n)
@@ -955,6 +958,8 @@ BC_Resources::~BC_Resources()
        del_vframes(default_pot_images, 3);
        del_vframes(default_progress_images, 2);
        del_vframes(default_medium_7segment, 20);
+       del_vframes(default_vscroll_data, 10);
+       del_vframes(default_hscroll_data, 10);
        if( fontlist ) {
                fontlist->remove_all_objects();
                delete fontlist;
@@ -1774,33 +1779,7 @@ int utf8conv::
 wnext()
 {
   int v = 0, n = 0, ch = next();
-  if( ch == '\\' ) {
-    switch( (ch=next()) ) {
-    case 'n': return '\n';
-    case 't': return '\t';
-    case 'r': return '\r';
-    case 'b': return '\b';
-    case 'f': return '\f';
-    case 'v': return '\v';
-    case 'a': return '\a';
-    case '0': case '1': case '2': case '3':
-    case '4': case '5': case '6': case '7':
-      v = ch - '0';
-      for( int i=3; --i>0; v=v*8+ch, next() )
-        if( (ch=cur()-'0') < 0 || ch >= 8 ) break;
-      return v;
-    case 'x':  n = 2;  break;
-    case 'u':  n = 4;  break;
-    case 'U':  n = 8;  break;
-    default: return ch;
-    }
-    for( int i=n; --i>=0; v=v*16+ch, next() ) {
-      if( (ch=cur()-'0')>=0 && ch<10 ) continue;
-      if( (ch-='A'-'0'-10)>=10 && ch<16 ) continue;
-      if( (ch-='a'-'A')<10 || ch>=16 ) break;
-    }
-  }
-  else if( ch >= 0x80 ) {
+  if( ch >= 0x80 ) {
     static const unsigned char byts[] = {
       1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 5,
     };
@@ -1878,7 +1857,7 @@ void BC_Resources::encode_to_utf8(char *buffer, int buflen)
 {
         if(BC_Resources::locale_utf8) return;
        char lbuf[buflen];
-       encode(encoding, 0, buffer, buflen, lbuf, buflen);
+       encode(encoding, 0, buffer, -1, lbuf, buflen);
        strcpy(buffer, lbuf);
 }