From: Good Guy Date: Mon, 19 Nov 2018 20:59:24 +0000 (-0700) Subject: add load_file apply button, sketcher colorpicker alpha fix, tweak resize filebox... X-Git-Tag: 2019-08~182 X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=commitdiff_plain;h=269d410062641e8f0094e73f87a3d9900c69dfd4 add load_file apply button, sketcher colorpicker alpha fix, tweak resize filebox recent_list --- diff --git a/cinelerra-5.1/cinelerra/loadfile.C b/cinelerra-5.1/cinelerra/loadfile.C index 3be7223f..434edfe6 100644 --- a/cinelerra-5.1/cinelerra/loadfile.C +++ b/cinelerra-5.1/cinelerra/loadfile.C @@ -102,52 +102,40 @@ BC_Window* LoadFileThread::new_gui() void LoadFileThread::handle_done_event(int result) { - ArrayList path_list; - path_list.set_array_delete(); + window->lock_window("LoadFileThread::handle_done_event"); + window->hide_window(); + window->unlock_window(); -// Collect all selected files - if(!result) - { - char *in_path, *out_path; - int i = 0; - window->lock_window("LoadFileThread::handle_done_event"); - window->hide_window(); - window->unlock_window(); - - while((in_path = window->get_path(i))) - { - int j; - for(j = 0; j < path_list.total; j++) - { - if(!strcmp(in_path, path_list.values[j])) break; - } - - if(j == path_list.total) - { - path_list.append(out_path = new char[strlen(in_path) + 1]); - strcpy(out_path, in_path); - } - i++; - } - } + if( !result ) load_apply(); +} +void LoadFileThread::load_apply() +{ mwindow->defaults->update("DEFAULT_LOADPATH", window->get_submitted_path()); mwindow->defaults->update("LOAD_MODE", load_mode); -// No file selected - if(path_list.total == 0 || result == 1) - { - return; + ArrayList path_list; + path_list.set_array_delete(); + +// Collect all selected files + char *in_path; + for( int i=0; (in_path = window->get_path(i))!=0; ++i ) { + int k = path_list.size(); + while( --k >= 0 && strcmp(in_path, path_list.values[k]) ); + if( k < 0 ) path_list.append(cstrdup(in_path)); } +// No file selected + if( !path_list.size() ) return; + if( load_mode == LOADMODE_REPLACE ) mwindow->set_filename(path_list[0]); mwindow->interrupt_indexes(); mwindow->gui->lock_window("LoadFileThread::run"); - result = mwindow->load_filenames(&path_list, load_mode, 0); + mwindow->load_filenames(&path_list, load_mode, 0); mwindow->gui->mainmenu->add_load(path_list.values[0]); mwindow->gui->unlock_window(); path_list.remove_all_objects(); @@ -163,7 +151,6 @@ void LoadFileThread::handle_done_event(int result) } - LoadFileWindow::LoadFileWindow(MWindow *mwindow, LoadFileThread *thread, char *init_directory) @@ -200,6 +187,7 @@ void LoadFileWindow::create_objects() LoadMode::calculate_h(this, mwindow->theme); loadmode = new LoadMode(mwindow, this, x, y, &thread->load_mode, 0); loadmode->create_objects(); + add_subwindow(load_file_apply = new LoadFileApply(this)); show_window(1); unlock_window(); @@ -208,26 +196,34 @@ void LoadFileWindow::create_objects() int LoadFileWindow::resize_event(int w, int h) { + draw_background(0, 0, w, h); int x = w / 2 - 200; int y = get_cancel_button()->get_y() - LoadMode::calculate_h(this, mwindow->theme); - draw_background(0, 0, w, h); - loadmode->reposition_window(x, y); + x = (get_w() - BC_GenericButton::calculate_w(this, _("Apply")))/2; + y = get_h() - BC_GenericButton::calculate_h() - 15; + load_file_apply->reposition_window(x, y); + return BC_FileBox::resize_event(w, h); } +LoadFileApply::LoadFileApply(LoadFileWindow *load_file_window) + : BC_GenericButton( (load_file_window->get_w() - + BC_GenericButton::calculate_w(load_file_window, _("Apply")))/2, + load_file_window->get_h() - BC_GenericButton::calculate_h() - 15, + _("Apply")) +{ + this->load_file_window = load_file_window; +} - - - - - - - - +int LoadFileApply::handle_event() +{ + load_file_window->thread->load_apply(); + return 1; +} LocateFileWindow::LocateFileWindow(MWindow *mwindow, diff --git a/cinelerra-5.1/cinelerra/loadfile.h b/cinelerra-5.1/cinelerra/loadfile.h index 64c1f78e..7d860203 100644 --- a/cinelerra-5.1/cinelerra/loadfile.h +++ b/cinelerra-5.1/cinelerra/loadfile.h @@ -28,8 +28,13 @@ #include "mainmenu.inc" #include "mwindow.inc" +class Load; class LoadFileThread; class LoadFileWindow; +class LocateFileWindow; +class LoadPrevious; +class LoadBackup; +class LoadFileApply; class Load : public BC_MenuItem { @@ -54,6 +59,7 @@ public: BC_Window* new_gui(); void handle_done_event(int result); + void load_apply(); MWindow *mwindow; Load *load; @@ -74,6 +80,7 @@ public: LoadFileThread *thread; LoadMode *loadmode; + LoadFileApply *load_file_apply; MWindow *mwindow; }; @@ -107,4 +114,12 @@ public: MWindow *mwindow; }; +class LoadFileApply : public BC_GenericButton +{ +public: + LoadFileApply(LoadFileWindow *load_file_window); + int handle_event(); + LoadFileWindow *load_file_window; +}; + #endif diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index fa2f8b24..7fba2ec6 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -748,8 +748,7 @@ int BC_FileBox::resize_event(int w, int h) recent_popup->reposition_window( directory_title->get_x() + directory_title->get_w() + 8, directory_title->get_y(), - directory_title->get_w() + recent_popup->get_w(), - recent_popup->get_h()); + directory_title->get_w() + recent_popup->get_w(), 200); search_text->reposition_window( search_text->get_x(), search_text->get_y(), diff --git a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C index fc2ca4fc..76bd8d8f 100644 --- a/cinelerra-5.1/plugins/sketcher/sketcherwindow.C +++ b/cinelerra-5.1/plugins/sketcher/sketcherwindow.C @@ -183,7 +183,7 @@ void SketcherCurveColorPicker::handle_done_event(int result) { color_update->stop(); gui->lock_window("SketcherCurveColorPicker::handle_done_event"); - if( result ) color = orig_color; + if( result ) { color = orig_color | (~orig_alpha<<24); } color_button->update_gui(color); gui->unlock_window(); SketcherConfig &config = gui->plugin->config;