add load_file apply button, sketcher colorpicker alpha fix, tweak resize filebox...
authorGood Guy <good1.2guy@gmail.com>
Mon, 19 Nov 2018 20:59:24 +0000 (13:59 -0700)
committerGood Guy <good1.2guy@gmail.com>
Mon, 19 Nov 2018 20:59:24 +0000 (13:59 -0700)
cinelerra-5.1/cinelerra/loadfile.C
cinelerra-5.1/cinelerra/loadfile.h
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/plugins/sketcher/sketcherwindow.C

index 3be7223f77a8f3fbe545f5a4a2110f9488728667..434edfe6e4c20b436008e4e947410a33d283bfcf 100644 (file)
@@ -102,52 +102,40 @@ BC_Window* LoadFileThread::new_gui()
 
 void LoadFileThread::handle_done_event(int result)
 {
-       ArrayList<char*> 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<char*> 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,
index 64c1f78e5fae4dcbfbe6fb06f04610f01dbac0c1..7d860203c8ca752e211f025e0d4f2d02c0c2be63 100644 (file)
 #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
index fa2f8b24401483dc332e28db2a8cd5ace6419d20..7fba2ec63dfa468d6569d9073cabbf0dace5cc0e 100644 (file)
@@ -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(),
index fc2ca4fcc7729ac25f5a1ad750340f7c23b774b7..76bd8d8fa5cf00a310c7dd40bad1b8fee91f0d19 100644 (file)
@@ -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;