X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcwindowtool.C;h=fefe2d4ca28b259e365c4c9489098fbb92c43a5c;hb=17061ff8d289bfa96bef2da5bac789762f631d4a;hp=d73a265b5727d15d3e4391d479ea21845ddc57b4;hpb=4784a8d70bc39f9b7e467f93304d2df3f23fd2df;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/cwindowtool.C b/cinelerra-5.1/cinelerra/cwindowtool.C index d73a265b..fefe2d4c 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.C +++ b/cinelerra-5.1/cinelerra/cwindowtool.C @@ -1,7 +1,6 @@ - /* * CINELERRA - * Copyright (C) 2008-2014 Adam Williams + * Copyright (C) 2008-2017 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +22,7 @@ #include #include "automation.h" -#include "cicolors.h" +#include "bccolors.h" #include "clip.h" #include "condition.h" #include "cpanel.h" @@ -290,9 +289,27 @@ int CWindowToolGUI::close_event() int CWindowToolGUI::keypress_event() { - if(get_keypress() == 'w' || get_keypress() == 'W') + int result = 0; + + switch( get_keypress() ) { + case 'w': + case 'W': return close_event(); - return 0; + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + case KEY_F5: + case KEY_F6: + case KEY_F7: + case KEY_F8: + case KEY_F9: + case KEY_F10: + resend_event(thread->gui); + result = 1; + } + + return result; } int CWindowToolGUI::translation_event() @@ -461,7 +478,7 @@ void CWindowCropGUI::update() CWindowEyedropGUI::CWindowEyedropGUI(MWindow *mwindow, CWindowTool *thread) - : CWindowToolGUI(mwindow, thread, _(PROGRAM_NAME ": Color"), 220, 250) + : CWindowToolGUI(mwindow, thread, _(PROGRAM_NAME ": Color"), 220, 290) { } @@ -514,6 +531,8 @@ void CWindowEyedropGUI::create_objects() y = title6->get_y() + this->v->get_h() + 2*margin; add_subwindow(sample = new BC_SubWindow(x, y, 50, 50)); + y += sample->get_h() + margin; + add_subwindow(use_max = new CWindowEyedropCheckBox(mwindow, this, x, y)); update(); unlock_window(); } @@ -528,27 +547,28 @@ void CWindowEyedropGUI::update() radius->update((int64_t)mwindow->edl->session->eyedrop_radius); - float r = mwindow->edl->local_session->red; - float g = mwindow->edl->local_session->green; - float b = mwindow->edl->local_session->blue; - red->update(r); - green->update(g); - blue->update(b); + LocalSession *local_session = mwindow->edl->local_session; + int use_max = local_session->use_max; + float r = use_max ? local_session->red_max : local_session->red; + float g = use_max ? local_session->green_max : local_session->green; + float b = use_max ? local_session->blue_max : local_session->blue; + this->red->update(r); + this->green->update(g); + this->blue->update(b); + int rx = 255*r + 0.5; bclamp(rx,0,255); int gx = 255*g + 0.5; bclamp(gx,0,255); int bx = 255*b + 0.5; bclamp(bx,0,255); char rgb_text[BCSTRLEN]; sprintf(rgb_text, "#%02x%02x%02x", rx, gx, bx); rgb_hex->update(rgb_text); - + float y, u, v; - YUV::rgb_to_yuv_f(mwindow->edl->local_session->red, - mwindow->edl->local_session->green, - mwindow->edl->local_session->blue, - y, u, v); + YUV::yuv.rgb_to_yuv_f(r, g, b, y, u, v); this->y->update(y); this->u->update(u); u += 0.5; this->v->update(v); v += 0.5; + int yx = 255*y + 0.5; bclamp(yx,0,255); int ux = 255*u + 0.5; bclamp(ux,0,255); int vx = 255*v + 0.5; bclamp(vx,0,255); @@ -690,6 +710,23 @@ int CWindowCurveToggle::handle_event() } +CWindowEyedropCheckBox::CWindowEyedropCheckBox(MWindow *mwindow, + CWindowEyedropGUI *gui, int x, int y) + : BC_CheckBox(x, y, mwindow->edl->local_session->use_max, _("Use maximum")) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +int CWindowEyedropCheckBox::handle_event() +{ + mwindow->edl->local_session->use_max = get_value(); + + gui->update(); + return 1; +} + + CWindowCameraGUI::CWindowCameraGUI(MWindow *mwindow, CWindowTool *thread) : CWindowToolGUI(mwindow, thread, @@ -770,16 +807,12 @@ void CWindowCameraGUI::create_objects() void CWindowCameraGUI::update_preview() { - mwindow->restart_brender(); - mwindow->sync_parameters(CHANGE_PARAMS); - - mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_NONE, - mwindow->edl, - 1); mwindow->gui->lock_window("CWindowCameraGUI::update_preview"); + mwindow->restart_brender(); mwindow->gui->draw_overlays(1); + mwindow->sync_parameters(CHANGE_PARAMS); mwindow->gui->unlock_window(); + mwindow->cwindow->refresh_frame(CHANGE_NONE); mwindow->cwindow->gui->lock_window("CWindowCameraGUI::update_preview"); mwindow->cwindow->gui->canvas->draw_refresh(); mwindow->cwindow->gui->unlock_window(); @@ -1218,16 +1251,12 @@ void CWindowProjectorGUI::create_objects() void CWindowProjectorGUI::update_preview() { + mwindow->gui->lock_window("CWindowProjectorGUI::update_preview"); mwindow->restart_brender(); mwindow->sync_parameters(CHANGE_PARAMS); - mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_NONE, - mwindow->edl, - 1); - // TODO: really need to lock the main window?? - mwindow->gui->lock_window("CWindowProjectorGUI::update_preview"); mwindow->gui->draw_overlays(1); mwindow->gui->unlock_window(); + mwindow->cwindow->refresh_frame(CHANGE_NONE); mwindow->cwindow->gui->lock_window("CWindowProjectorGUI::update_preview"); mwindow->cwindow->gui->canvas->draw_refresh(); mwindow->cwindow->gui->unlock_window(); @@ -1651,6 +1680,9 @@ int CWindowMaskDelete::handle_event() temp_keyframe.copy_data(keyframe); // Update parameter SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask); + if( shift_down() ) + submask->points.remove_all_objects(); + for(int i = mwindow->cwindow->gui->affected_point; i < submask->points.total - 1; i++) @@ -1672,6 +1704,8 @@ int CWindowMaskDelete::handle_event() current; ) { SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask); + if( shift_down() ) + submask->points.remove_all_objects(); for(int i = mwindow->cwindow->gui->affected_point; i < submask->points.total - 1; @@ -2034,11 +2068,8 @@ int CWindowDisableOpenGLMasking::handle_event() CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread) - : CWindowToolGUI(mwindow, - thread, - _(PROGRAM_NAME ": Mask"), - 330, - 310) + : CWindowToolGUI(mwindow, thread, + _(PROGRAM_NAME ": Mask"), 330, 320) { this->mwindow = mwindow; this->thread = thread; @@ -2106,6 +2137,8 @@ void CWindowMaskGUI::create_objects() y += title->get_h() + margin; add_subwindow(title = new BC_Title(x, y, _("Press Ctrl to move a control point"))); y += title->get_h() + margin; + add_subwindow(title = new BC_Title(x, y, _("Shift+click Delete to delete the mask"))); + y += title->get_h() + margin; add_subwindow(title = new BC_Title(x, y, _("Press Alt to translate the mask"))); y += 30; @@ -2245,12 +2278,12 @@ void CWindowMaskGUI::handle_event() void CWindowMaskGUI::update_preview() { + mwindow->gui->lock_window("CWindowMaskGUI::update_preview"); mwindow->restart_brender(); mwindow->sync_parameters(CHANGE_PARAMS); - mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_NONE, - mwindow->edl, - 1); + mwindow->gui->draw_overlays(1); + mwindow->gui->unlock_window(); + mwindow->cwindow->refresh_frame(CHANGE_NONE); mwindow->cwindow->gui->lock_window("CWindowMaskGUI::update_preview"); mwindow->cwindow->gui->canvas->draw_refresh(); mwindow->cwindow->gui->unlock_window();