prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / cinelerra / confirmsave.C
index d51774695653e39f2e24a2b98c1d4a7cff5101ce..5fe6ab90baae8e4f811cbc6ad0f11d1fe3531d0e 100644 (file)
@@ -2,21 +2,21 @@
 /*
  * CINELERRA
  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * 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
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  */
 
 #include "asset.h"
@@ -45,37 +45,30 @@ int ConfirmSave::test_file(MWindow *mwindow, char *path)
        return result;
 }
 
-int ConfirmSave::test_files(MWindow *mwindow, 
-       ArrayList<char*> *paths)
+int ConfirmSave::test_files(MWindow *mwindow, ArrayList<char*> *paths)
 {
        FILE *file;
        ArrayList<BC_ListBoxItem*> list;
        int result = 0;
 
-       for(int i = 0; i < paths->total; i++)
-       {
+       for(int i = 0; i < paths->size(); i++) {
                char *path = paths->values[i];
-               if( (file=fopen(path, "r")) != 0 )
-               {
+               if( (file=fopen(path, "r")) != 0 ) {
                        fclose(file);
                        list.append(new BC_ListBoxItem(path));
                }
        }
 
-       if(list.total)
-       {
-               if(mwindow)
-               {
+       if(list.total) {
+               if(mwindow) {
                        ConfirmSaveWindow window(mwindow, &list);
                        window.create_objects();
                        window.raise_window();
                        result = window.run_window();
                }
-               else
-               {
+               else {
                        printf(_("The following files exist:\n"));
-                       for(int i = 0; i < list.total; i++)
-                       {
+                       for(int i = 0; i < list.total; i++) {
                                printf("    %s\n", list.values[i]->get_text());
                        }
                        printf(_("Won't overwrite existing files.\n"));
@@ -84,8 +77,7 @@ int ConfirmSave::test_files(MWindow *mwindow,
                list.remove_all_objects();
                return result;
        }
-       else
-       {
+       else {
                list.remove_all_objects();
                return 0;
        }
@@ -101,12 +93,12 @@ int ConfirmSave::test_files(MWindow *mwindow,
 
 
 
-ConfirmSaveWindow::ConfirmSaveWindow(MWindow *mwindow, 
+ConfirmSaveWindow::ConfirmSaveWindow(MWindow *mwindow,
        ArrayList<BC_ListBoxItem*> *list)
- : BC_Window(_(PROGRAM_NAME ": File Exists"), 
-               mwindow->gui->get_abs_cursor_x(1) - 160, 
-               mwindow->gui->get_abs_cursor_y(1) - 120, 
-               320, 
+ : BC_Window(_(PROGRAM_NAME ": File Exists"),
+               mwindow->gui->get_abs_cursor_x(1) - 160,
+               mwindow->gui->get_abs_cursor_y(1) - 120,
+               320,
                320)
 {
        this->list = list;
@@ -124,12 +116,12 @@ void ConfirmSaveWindow::create_objects()
        add_subwindow(new BC_OKButton(this));
        add_subwindow(new BC_CancelButton(this));
 
-       add_subwindow(title = new BC_Title(x, 
-               y, 
+       add_subwindow(title = new BC_Title(x,
+               y,
                _("The following files exist.  Overwrite them?")));
        y += 30;
-       add_subwindow(listbox = new BC_ListBox(x, 
-               y, 
+       add_subwindow(listbox = new BC_ListBox(x,
+               y,
                get_w() - x - 10,
                get_h() - y - BC_OKButton::calculate_h() - 10,
                LISTBOX_TEXT,