rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt
[goodguy/history.git] / cinelerra-5.1 / guicast / bcscrollbar.C
index 5de4db6b79618a83d9bb3f79a3930e970c2b722e..680341d0beebf0e990e1b74a5bf42c62670e9473 100644 (file)
 #include "bcresources.h"
 #include "bcscrollbar.h"
 #include "clip.h"
-#include "colors.h"
+#include "bccolors.h"
 #include "vframe.h"
 
 #include <string.h>
 
-BC_ScrollBar::BC_ScrollBar(int x,
-       int y,
-       int orientation,
-       int pixels,
-       int64_t length,
-       int64_t position,
-       int64_t handlelength,
+BC_ScrollBar::BC_ScrollBar(int x, int y, int orientation, int pixels,
+       int64_t length, int64_t position, int64_t handlelength,
        VFrame **data)
  : BC_SubWindow(x, y, 0, 0, -1)
 {
@@ -43,16 +38,15 @@ BC_ScrollBar::BC_ScrollBar(int x,
        this->handlelength = handlelength;
        this->selection_status = 0;
        this->highlight_status = 0;
+       this->stretch = orientation & SCROLL_STRETCH ? 1 : 0;
+       orientation &= ~SCROLL_STRETCH;
        this->orientation = orientation;
        this->pixels = pixels;
 
-       if(data)
-               this->data = data;
-       else
-       if(orientation == SCROLL_HORIZ)
-               this->data = BC_WindowBase::get_resources()->hscroll_data;
-       else
-               this->data = BC_WindowBase::get_resources()->vscroll_data;
+       if( !data ) data = orientation == SCROLL_HORIZ ?
+               BC_WindowBase::get_resources()->hscroll_data :
+               BC_WindowBase::get_resources()->vscroll_data ;
+       this->data = data;
 
        handle_pixel = 0;
        handle_pixels = 0;
@@ -90,8 +84,6 @@ void BC_ScrollBar::set_images(VFrame **data)
        calculate_dimensions(w, h);
 }
 
-
-
 void BC_ScrollBar::calculate_dimensions(int &w, int &h)
 {
        switch(orientation)
@@ -125,30 +117,18 @@ int BC_ScrollBar::get_span(int orientation)
 
 int BC_ScrollBar::get_span()
 {
-       switch(orientation)
-       {
-               case SCROLL_HORIZ:
-                       return data[SCROLL_HANDLE_UP]->get_h();
-                       break;
-
-               case SCROLL_VERT:
-                       return data[SCROLL_HANDLE_UP]->get_w();
-                       break;
+       switch(orientation) {
+       case SCROLL_HORIZ: return data[SCROLL_HANDLE_UP]->get_h();
+       case SCROLL_VERT:  return data[SCROLL_HANDLE_UP]->get_w();
        }
        return 0;
 }
 
 int BC_ScrollBar::get_arrow_pixels()
 {
-       switch(orientation)
-       {
-               case SCROLL_HORIZ:
-                       return data[SCROLL_BACKARROW_UP]->get_w();
-                       break;
-
-               case SCROLL_VERT:
-                       return data[SCROLL_BACKARROW_UP]->get_h();
-                       break;
+       switch(orientation) {
+       case SCROLL_HORIZ: return data[SCROLL_BACKARROW_UP]->get_w();
+       case SCROLL_VERT:  return data[SCROLL_BACKARROW_UP]->get_h();
        }
        return 0;
 }
@@ -664,6 +644,7 @@ int BC_ScrollBar::update_value(int64_t value)
 
 int BC_ScrollBar::update_length(int64_t length, int64_t position, int64_t handlelength, int flush)
 {
+       if( stretch ) length += handlelength/4;
        this->length = length;
        this->position = position;
        this->handlelength = handlelength;