olaf neophyte and de.po updates, valgrind tweaks, delete green lady, inkscape dpi=96
[goodguy/history.git] / cinelerra-5.1 / cinelerra / patchgui.C
index a2a19864703cb2cb9ff1c6b46b8c3ec741fe675f..f7f4c7e25846ee9b49cadb1783e3d0532a59b3dc 100644 (file)
@@ -96,59 +96,36 @@ int PatchGUI::reposition(int x, int y)
        int y1 = 0;
 
 
-       if(x != this->x || y != this->y)
-       {
-               this->x = x;
-               this->y = y;
+       if( x != this->x || y != this->y ) {
+               this->x = x;  this->y = y;
 
-               if(title)
-               {
-TRACE("PatchGUI::reposition 1\n");
+               if( title )
                        title->reposition_window(title->get_x(), y1 + y, 0);
-TRACE("PatchGUI::reposition 2\n");
-               }
+               if( expand )
+                       expand->reposition_window(expand->get_x(), y1 + y);
                y1 += mwindow->theme->title_h;
 
-               if(play)
-               {
-TRACE("PatchGUI::reposition 3\n");
+               if( play ) {
                        play->reposition_window(play->get_x(), y1 + y);
                        x1 += play->get_w();
-TRACE("PatchGUI::reposition 4\n");
                        record->reposition_window(record->get_x(), y1 + y);
                        x1 += record->get_w();
-TRACE("PatchGUI::reposition 5\n");
 //                     automate->reposition_window(x1, y1 + y);
 //                     x1 += automate->get_w();
                        gang->reposition_window(gang->get_x(), y1 + y);
                        x1 += gang->get_w();
-TRACE("PatchGUI::reposition 6\n");
                        draw->reposition_window(draw->get_x(), y1 + y);
                        x1 += draw->get_w();
-TRACE("PatchGUI::reposition 7\n");
                        mute->reposition_window(mute->get_x(), y1 + y);
                        x1 += mute->get_w();
-TRACE("PatchGUI::reposition 8\n");
-
-                       if(expand)
-                       {
-TRACE("PatchGUI::reposition 9\n");
-//     VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data");
-//     int x = patchbay->get_w() - 10 - expandpatch_data[0]->get_w();
-                               expand->reposition_window(
-                                       expand->get_x(),
-                                       y1 + y);
-TRACE("PatchGUI::reposition 10\n");
-                               x1 += expand->get_w();
-TRACE("PatchGUI::reposition 11\n");
-                       }
                }
                y1 += mwindow->theme->play_h;
        }
-       else
-       {
-               y1 += mwindow->theme->title_h;
-               y1 += mwindow->theme->play_h;
+       else {
+               if( title )
+                       y1 += mwindow->theme->title_h;
+               if( play )
+                       y1 += mwindow->theme->play_h;
        }
 
        return y1;
@@ -165,49 +142,45 @@ int PatchGUI::update(int x, int y)
        int x1 = 0;
 //printf("PatchGUI::update 10\n");
 
-       if(title)
-       {
-               if(h - y1 < 0)
-               {
-                       delete title;
-                       title = 0;
+       int y2 = y1 + mwindow->theme->title_h;
+       if( title ) {
+               if( h < y2 ) {
+                       delete title;   title = 0;
+                       delete expand;  expand = 0;
                }
-               else
-               {
+               else {
                        title->update(track->title);
+                       expand->update(track->expand_view);
                }
        }
-       else
-       if(h - y1 >= 0)
-       {
-               patchbay->add_subwindow(title = new TitlePatch(mwindow, this, x1 + x, y1 + y));
+       else if( h >= y2 ) {
+               VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data");
+               int x2 = patchbay->get_w() - expandpatch_data[0]->get_w() - 5;
+               patchbay->add_subwindow(title = new TitlePatch(mwindow, this, x1 + x, y1 + y, x2-x1-5));
+               patchbay->add_subwindow(expand = new ExpandPatch(mwindow, this, x2, y1 + y));
        }
-       y1 += mwindow->theme->title_h;
 
-       if(play)
-       {
-               if(h - y1 < mwindow->theme->play_h)
-               {
+       if( title )
+               y1 = y2;
+
+       y2 = y1 + mwindow->theme->play_h;
+       if( play ) {
+               if( h < y2 ) {
                        delete play;    play = 0;
                        delete record;  record = 0;
                        delete gang;    gang = 0;
                        delete draw;    draw = 0;
                        delete mute;    mute = 0;
-                       delete expand;  expand = 0;
                }
-               else
-               {
+               else {
                        play->update(track->play);
                        record->update(track->record);
                        gang->update(track->gang);
                        draw->update(track->draw);
                        mute->update(mwindow->get_int_auto(this, AUTOMATION_MUTE)->value);
-                       expand->update(track->expand_view);
                }
        }
-       else
-       if(h - y1 >= mwindow->theme->play_h)
-       {
+       else if( h >= y2 ) {
                patchbay->add_subwindow(play = new PlayPatch(mwindow, this, x1 + x, y1 + y));
 //printf("PatchGUI::update %d %d\n", __LINE__, play->get_h());
                x1 += play->get_w();
@@ -219,15 +192,9 @@ int PatchGUI::update(int x, int y)
                x1 += draw->get_w();
                patchbay->add_subwindow(mute = new MutePatch(mwindow, this, x1 + x, y1 + y));
                x1 += mute->get_w();
-
-               VFrame **expandpatch_data = mwindow->theme->get_image_set("expandpatch_data");
-               patchbay->add_subwindow(expand = new ExpandPatch(mwindow,
-                       this,
-                       patchbay->get_w() - 10 - expandpatch_data[0]->get_w(),
-                       y1 + y));
-               x1 += expand->get_w();
        }
-       y1 += mwindow->theme->play_h;
+       if( play )
+               y1 = y2;
 
 //UNTRACE
        return y1;
@@ -335,16 +302,6 @@ int64_t PatchGUI::calculate_nudge(const char *string)
 }
 
 
-
-
-
-
-
-
-
-
-
-
 PlayPatch::PlayPatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
  : BC_Toggle(x,
                y,
@@ -425,6 +382,10 @@ int RecordPatch::button_press_event()
                        get_value(),
                        this,
                        &patch->track->record);
+               patch->title->set_back_color(patch->track->record ?
+                       get_resources()->text_background :
+                       get_resources()->text_background_disarmed);
+               patch->title->set_text_row(0);
                return 1;
        }
        return 0;
@@ -658,19 +619,22 @@ int ExpandPatch::button_release_event()
 }
 
 
-
-
-
-TitlePatch::TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y)
- : BC_TextBox(x,
-               y,
-               patch->patchbay->get_w() - 10,
-               1,
-               patch->track->title,
-               1, MEDIUMFONT, 1)
+TitlePatch::TitlePatch(MWindow *mwindow, PatchGUI *patch, int x, int y, int w)
+ : BC_TextBox(x, y, w, 1, patch->track->title, 1, MEDIUMFONT, 1)
 {
        this->mwindow = mwindow;
        this->patch = patch;
+       set_back_color(patch->track->record ?
+                       get_resources()->text_background :
+                       get_resources()->text_background_disarmed);
+}
+
+void TitlePatch::update(const char *text)
+{
+       set_back_color(patch->track->record ?
+                       get_resources()->text_background :
+                       get_resources()->text_background_disarmed);
+       BC_TextBox::update(text);
 }
 
 int TitlePatch::handle_event()
@@ -684,13 +648,6 @@ int TitlePatch::handle_event()
 }
 
 
-
-
-
-
-
-
-
 NudgePatch::NudgePatch(MWindow *mwindow,
        PatchGUI *patch,
        int x,